@povio/openapi-codegen-cli 0.14.6 → 0.14.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +2 -2
- package/dist/sh.js +3 -3
- package/package.json +1 -1
- package/src/generators/templates/zod-utils.hbs +4 -4
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ yarn openapi-codegen generate --input http://localhost:3001/docs-json --standalo
|
|
|
45
45
|
--importPath Module import style for generated files (default: 'ts'; options: 'ts' | 'relative' | 'absolute')
|
|
46
46
|
--removeOperationPrefixEndingWith Remove operation name prefixes that end with the specified string (Default: 'Controller_')
|
|
47
47
|
--extractEnums Extract enums into separate Zod schemas (default: true)
|
|
48
|
-
--branded Apply branded types to ambiguous Zod schemas (default:
|
|
48
|
+
--branded Apply branded types to ambiguous Zod schemas (default: true)
|
|
49
49
|
--replaceOptionalWithNullish Replace `.optional()` chains with `.nullish()` in generated Zod schemas (default: false)
|
|
50
50
|
|
|
51
51
|
--axiosRequestConfig Include Axios request config parameters in query hooks (default: false)
|
package/dist/index.js
CHANGED
|
@@ -69,9 +69,9 @@ Expecting `+yn.join(", ")+", got '"+(this.terminals_[E]||E)+"'":gc="Parse error
|
|
|
69
69
|
return undefined
|
|
70
70
|
}
|
|
71
71
|
`.trim()},"lookupPropertyFunctionVarDeclaration"),blockValue:o(function(t){var r=this.aliasable("container.hooks.blockHelperMissing"),n=[this.contextName(0)];this.setupHelperArgs(t,0,n);var i=this.popStack();n.splice(1,0,i),this.push(this.source.functionCall(r,"call",n))},"blockValue"),ambiguousBlockValue:o(function(){var t=this.aliasable("container.hooks.blockHelperMissing"),r=[this.contextName(0)];this.setupHelperArgs("",0,r,!0),this.flushInline();var n=this.topStack();r.splice(1,0,n),this.pushSource(["if (!",this.lastHelper,") { ",n," = ",this.source.functionCall(t,"call",r),"}"])},"ambiguousBlockValue"),appendContent:o(function(t){this.pendingContent?t=this.pendingContent+t:this.pendingLocation=this.source.currentLocation,this.pendingContent=t},"appendContent"),append:o(function(){if(this.isInline())this.replaceStack(function(r){return[" != null ? ",r,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var t=this.popStack();this.pushSource(["if (",t," != null) { ",this.appendToBuffer(t,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},"append"),appendEscaped:o(function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},"appendEscaped"),getContext:o(function(t){this.lastContext=t},"getContext"),pushContext:o(function(){this.pushStackLiteral(this.contextName(this.lastContext))},"pushContext"),lookupOnContext:o(function(t,r,n,i){var s=0;!i&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(t[s++])):this.pushContext(),this.resolvePath("context",t,s,r,n)},"lookupOnContext"),lookupBlockParam:o(function(t,r){this.useBlockParams=!0,this.push(["blockParams[",t[0],"][",t[1],"]"]),this.resolvePath("context",r,1)},"lookupBlockParam"),lookupData:o(function(t,r,n){t?this.pushStackLiteral("container.data(data, "+t+")"):this.pushStackLiteral("data"),this.resolvePath("data",r,0,!0,n)},"lookupData"),resolvePath:o(function(t,r,n,i,s){var a=this;if(this.options.strict||this.options.assumeObjects){this.push($3(this.options.strict&&s,this,r,n,t));return}for(var c=r.length;n<c;n++)this.replaceStack(function(u){var l=a.nameLookup(u,r[n],t);return i?[" && ",l]:[" != null ? ",l," : ",u]})},"resolvePath"),resolvePossibleLambda:o(function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},"resolvePossibleLambda"),pushStringParam:o(function(t,r){this.pushContext(),this.pushString(r),r!=="SubExpression"&&(typeof t=="string"?this.pushString(t):this.pushStackLiteral(t))},"pushStringParam"),emptyHash:o(function(t){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(t?"undefined":"{}")},"emptyHash"),pushHash:o(function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},"pushHash"),popHash:o(function(){var t=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(t.ids)),this.stringParams&&(this.push(this.objectLiteral(t.contexts)),this.push(this.objectLiteral(t.types))),this.push(this.objectLiteral(t.values))},"popHash"),pushString:o(function(t){this.pushStackLiteral(this.quotedString(t))},"pushString"),pushLiteral:o(function(t){this.pushStackLiteral(t)},"pushLiteral"),pushProgram:o(function(t){t!=null?this.pushStackLiteral(this.programExpression(t)):this.pushStackLiteral(null)},"pushProgram"),registerDecorator:o(function(t,r){var n=this.nameLookup("decorators",r,"decorator"),i=this.setupHelperArgs(r,t);this.decorators.push(["fn = ",this.decorators.functionCall(n,"",["fn","props","container",i])," || fn;"])},"registerDecorator"),invokeHelper:o(function(t,r,n){var i=this.popStack(),s=this.setupHelper(t,r),a=[];n&&a.push(s.name),a.push(i),this.options.strict||a.push(this.aliasable("container.hooks.helperMissing"));var c=["(",this.itemsSeparatedBy(a,"||"),")"],u=this.source.functionCall(c,"call",s.callParams);this.push(u)},"invokeHelper"),itemsSeparatedBy:o(function(t,r){var n=[];n.push(t[0]);for(var i=1;i<t.length;i++)n.push(r,t[i]);return n},"itemsSeparatedBy"),invokeKnownHelper:o(function(t,r){var n=this.setupHelper(t,r);this.push(this.source.functionCall(n.name,"call",n.callParams))},"invokeKnownHelper"),invokeAmbiguous:o(function(t,r){this.useRegister("helper");var n=this.popStack();this.emptyHash();var i=this.setupHelper(0,t,r),s=this.lastHelper=this.nameLookup("helpers",t,"helper"),a=["(","(helper = ",s," || ",n,")"];this.options.strict||(a[0]="(helper = ",a.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"))),this.push(["(",a,i.paramsInit?["),(",i.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",i.callParams)," : helper))"])},"invokeAmbiguous"),invokePartial:o(function(t,r,n){var i=[],s=this.setupParams(r,1,i);t&&(r=this.popStack(),delete s.name),n&&(s.indent=JSON.stringify(n)),s.helpers="helpers",s.partials="partials",s.decorators="container.decorators",t?i.unshift(r):i.unshift(this.nameLookup("partials",r,"partial")),this.options.compat&&(s.depths="depths"),s=this.objectLiteral(s),i.push(s),this.push(this.source.functionCall("container.invokePartial","",i))},"invokePartial"),assignToHash:o(function(t){var r=this.popStack(),n=void 0,i=void 0,s=void 0;this.trackIds&&(s=this.popStack()),this.stringParams&&(i=this.popStack(),n=this.popStack());var a=this.hash;n&&(a.contexts[t]=n),i&&(a.types[t]=i),s&&(a.ids[t]=s),a.values[t]=r},"assignToHash"),pushId:o(function(t,r,n){t==="BlockParam"?this.pushStackLiteral("blockParams["+r[0]+"].path["+r[1]+"]"+(n?" + "+JSON.stringify("."+n):"")):t==="PathExpression"?this.pushString(r):t==="SubExpression"?this.pushStackLiteral("true"):this.pushStackLiteral("null")},"pushId"),compiler:_i,compileChildren:o(function(t,r){for(var n=t.children,i=void 0,s=void 0,a=0,c=n.length;a<c;a++){i=n[a],s=new this.compiler;var u=this.matchExistingProgram(i);if(u==null){this.context.programs.push("");var l=this.context.programs.length;i.index=l,i.name="program"+l,this.context.programs[l]=s.compile(i,r,this.context,!this.precompile),this.context.decorators[l]=s.decorators,this.context.environments[l]=i,this.useDepths=this.useDepths||s.useDepths,this.useBlockParams=this.useBlockParams||s.useBlockParams,i.useDepths=this.useDepths,i.useBlockParams=this.useBlockParams}else i.index=u.index,i.name="program"+u.index,this.useDepths=this.useDepths||u.useDepths,this.useBlockParams=this.useBlockParams||u.useBlockParams}},"compileChildren"),matchExistingProgram:o(function(t){for(var r=0,n=this.context.environments.length;r<n;r++){var i=this.context.environments[r];if(i&&i.equals(t))return i}},"matchExistingProgram"),programExpression:o(function(t){var r=this.environment.children[t],n=[r.index,"data",r.blockParams];return(this.useBlockParams||this.useDepths)&&n.push("blockParams"),this.useDepths&&n.push("depths"),"container.program("+n.join(", ")+")"},"programExpression"),useRegister:o(function(t){this.registers[t]||(this.registers[t]=!0,this.registers.list.push(t))},"useRegister"),push:o(function(t){return t instanceof bi||(t=this.source.wrap(t)),this.inlineStack.push(t),t},"push"),pushStackLiteral:o(function(t){this.push(new bi(t))},"pushStackLiteral"),pushSource:o(function(t){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),t&&this.source.push(t)},"pushSource"),replaceStack:o(function(t){var r=["("],n=void 0,i=void 0,s=void 0;if(!this.isInline())throw new _d.default("replaceStack on non-inline");var a=this.popStack(!0);if(a instanceof bi)n=[a.value],r=["(",n],s=!0;else{i=!0;var c=this.incrStack();r=["((",this.push(c)," = ",a,")"],n=this.topStack()}var u=t.call(this,n);s||this.popStack(),i&&this.stackSlot--,this.push(r.concat(u,")"))},"replaceStack"),incrStack:o(function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},"incrStack"),topStackName:o(function(){return"stack"+this.stackSlot},"topStackName"),flushInline:o(function(){var t=this.inlineStack;this.inlineStack=[];for(var r=0,n=t.length;r<n;r++){var i=t[r];if(i instanceof bi)this.compileStack.push(i);else{var s=this.incrStack();this.pushSource([s," = ",i,";"]),this.compileStack.push(s)}}},"flushInline"),isInline:o(function(){return this.inlineStack.length},"isInline"),popStack:o(function(t){var r=this.isInline(),n=(r?this.inlineStack:this.compileStack).pop();if(!t&&n instanceof bi)return n.value;if(!r){if(!this.stackSlot)throw new _d.default("Invalid stack pop");this.stackSlot--}return n},"popStack"),topStack:o(function(){var t=this.isInline()?this.inlineStack:this.compileStack,r=t[t.length-1];return r instanceof bi?r.value:r},"topStack"),contextName:o(function(t){return this.useDepths&&t?"depths["+t+"]":"depth"+t},"contextName"),quotedString:o(function(t){return this.source.quotedString(t)},"quotedString"),objectLiteral:o(function(t){return this.source.objectLiteral(t)},"objectLiteral"),aliasable:o(function(t){var r=this.aliases[t];return r?(r.referenceCount++,r):(r=this.aliases[t]=this.source.wrap(t),r.aliasable=!0,r.referenceCount=1,r)},"aliasable"),setupHelper:o(function(t,r,n){var i=[],s=this.setupHelperArgs(r,t,i,n),a=this.nameLookup("helpers",r,"helper"),c=this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})");return{params:i,paramsInit:s,name:a,callParams:[c].concat(i)}},"setupHelper"),setupParams:o(function(t,r,n){var i={},s=[],a=[],c=[],u=!n,l=void 0;u&&(n=[]),i.name=this.quotedString(t),i.hash=this.popStack(),this.trackIds&&(i.hashIds=this.popStack()),this.stringParams&&(i.hashTypes=this.popStack(),i.hashContexts=this.popStack());var f=this.popStack(),p=this.popStack();(p||f)&&(i.fn=p||"container.noop",i.inverse=f||"container.noop");for(var d=r;d--;)l=this.popStack(),n[d]=l,this.trackIds&&(c[d]=this.popStack()),this.stringParams&&(a[d]=this.popStack(),s[d]=this.popStack());return u&&(i.args=this.source.generateArray(n)),this.trackIds&&(i.ids=this.source.generateArray(c)),this.stringParams&&(i.types=this.source.generateArray(a),i.contexts=this.source.generateArray(s)),this.options.data&&(i.data="data"),this.useBlockParams&&(i.blockParams="blockParams"),i},"setupParams"),setupHelperArgs:o(function(t,r,n,i){var s=this.setupParams(t,r,n);return s.loc=JSON.stringify(this.source.currentLocation),s=this.objectLiteral(s),i?(this.useRegister("options"),n.push("options"),["options=",s]):n?(n.push(s),""):s},"setupHelperArgs")};(function(){for(var e="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),t=_i.RESERVED_WORDS={},r=0,n=e.length;r<n;r++)t[e[r]]=!0})();_i.isValidJavaScriptVariableName=function(e){return!_i.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(e)};function $3(e,t,r,n,i){var s=t.popStack(),a=r.length;for(e&&a--;n<a;n++)s=t.nameLookup(s,r[n],i);return e?[t.aliasable("container.strict"),"(",s,", ",t.quotedString(r[n]),", ",JSON.stringify(t.source.currentLocation)," )"]:s}o($3,"strictLookup");fc.default=_i;OP.exports=fc.default});var IP=h((dc,wP)=>{"use strict";dc.__esModule=!0;function Wo(e){return e&&e.__esModule?e:{default:e}}o(Wo,"_interopRequireDefault");var O3=T_(),x3=Wo(O3),A3=Jf(),w3=Wo(A3),Pd=B_(),Ed=z_(),I3=xP(),T3=Wo(I3),R3=nc(),C3=Wo(R3),N3=Kf(),k3=Wo(N3),j3=x3.default.create;function AP(){var e=j3();return e.compile=function(t,r){return Ed.compile(t,r,e)},e.precompile=function(t,r){return Ed.precompile(t,r,e)},e.AST=w3.default,e.Compiler=Ed.Compiler,e.JavaScriptCompiler=T3.default,e.Parser=Pd.parser,e.parse=Pd.parse,e.parseWithoutProcessing=Pd.parseWithoutProcessing,e}o(AP,"create");var Pi=AP();Pi.create=AP;k3.default(Pi);Pi.Visitor=C3.default;Pi.default=Pi;dc.default=Pi;wP.exports=dc.default});var TP=h(mc=>{"use strict";mc.__esModule=!0;mc.print=L3;mc.PrintVisitor=J;function q3(e){return e&&e.__esModule?e:{default:e}}o(q3,"_interopRequireDefault");var M3=nc(),D3=q3(M3);function L3(e){return new J().accept(e)}o(L3,"print");function J(){this.padding=0}o(J,"PrintVisitor");J.prototype=new D3.default;J.prototype.pad=function(e){for(var t="",r=0,n=this.padding;r<n;r++)t+=" ";return t+=e+`
|
|
72
|
-
`,t};J.prototype.Program=function(e){var t="",r=e.body,n=void 0,i=void 0;if(e.blockParams){var s="BLOCK PARAMS: [";for(n=0,i=e.blockParams.length;n<i;n++)s+=" "+e.blockParams[n];s+=" ]",t+=this.pad(s)}for(n=0,i=r.length;n<i;n++)t+=this.accept(r[n]);return this.padding--,t};J.prototype.MustacheStatement=function(e){return this.pad("{{ "+this.SubExpression(e)+" }}")};J.prototype.Decorator=function(e){return this.pad("{{ DIRECTIVE "+this.SubExpression(e)+" }}")};J.prototype.BlockStatement=J.prototype.DecoratorBlock=function(e){var t="";return t+=this.pad((e.type==="DecoratorBlock"?"DIRECTIVE ":"")+"BLOCK:"),this.padding++,t+=this.pad(this.SubExpression(e)),e.program&&(t+=this.pad("PROGRAM:"),this.padding++,t+=this.accept(e.program),this.padding--),e.inverse&&(e.program&&this.padding++,t+=this.pad("{{^}}"),this.padding++,t+=this.accept(e.inverse),this.padding--,e.program&&this.padding--),this.padding--,t};J.prototype.PartialStatement=function(e){var t="PARTIAL:"+e.name.original;return e.params[0]&&(t+=" "+this.accept(e.params[0])),e.hash&&(t+=" "+this.accept(e.hash)),this.pad("{{> "+t+" }}")};J.prototype.PartialBlockStatement=function(e){var t="PARTIAL BLOCK:"+e.name.original;return e.params[0]&&(t+=" "+this.accept(e.params[0])),e.hash&&(t+=" "+this.accept(e.hash)),t+=" "+this.pad("PROGRAM:"),this.padding++,t+=this.accept(e.program),this.padding--,this.pad("{{> "+t+" }}")};J.prototype.ContentStatement=function(e){return this.pad("CONTENT[ '"+e.value+"' ]")};J.prototype.CommentStatement=function(e){return this.pad("{{! '"+e.value+"' }}")};J.prototype.SubExpression=function(e){for(var t=e.params,r=[],n=void 0,i=0,s=t.length;i<s;i++)r.push(this.accept(t[i]));return t="["+r.join(", ")+"]",n=e.hash?" "+this.accept(e.hash):"",this.accept(e.path)+" "+t+n};J.prototype.PathExpression=function(e){var t=e.parts.join("/");return(e.data?"@":"")+"PATH:"+t};J.prototype.StringLiteral=function(e){return'"'+e.value+'"'};J.prototype.NumberLiteral=function(e){return"NUMBER{"+e.value+"}"};J.prototype.BooleanLiteral=function(e){return"BOOLEAN{"+e.value+"}"};J.prototype.UndefinedLiteral=function(){return"UNDEFINED"};J.prototype.NullLiteral=function(){return"NULL"};J.prototype.Hash=function(e){for(var t=e.pairs,r=[],n=0,i=t.length;n<i;n++)r.push(this.accept(t[n]));return"HASH{"+r.join(", ")+"}"};J.prototype.HashPair=function(e){return e.key+"="+this.accept(e.value)}});var Yt=h((AB,NP)=>{var hc=IP().default,CP=TP();hc.PrintVisitor=CP.PrintVisitor;hc.print=CP.print;NP.exports=hc;function RP(e,t){var r=require("fs"),n=r.readFileSync(t,"utf8");e.exports=hc.compile(n)}o(RP,"extension");typeof require<"u"&&require.extensions&&(require.extensions[".handlebars"]=RP,require.extensions[".hbs"]=RP)});var qq={};dE(qq,{getGenerateFilesData:()=>jq,getGenerateMetadata:()=>kq});module.exports=mE(qq);var Ad=rt(nS());var yo="AppRestClient",ra={query:"AppQueryOptions",infiniteQuery:"AppInfiniteQueryOptions",mutation:"AppMutationOptions"},af="src/data",cf="@/data",Xr={appRestClient:{template:"@/util/rest/clients/app-rest-client",monorepoTemplate:"@/clients/app-rest-client"},queryTypes:{template:"@/types/react-query",monorepoTemplate:"@povio/utils/types/react-query"},errorHandling:{template:"@/util/vendor/error-handling",monorepoTemplate:"@povio/utils/utils/vendor/error-handling"},abilityContext:{template:"@/data/acl/ability.context",monorepoTemplate:"@povio/auth/acl/ability.context"}},hr={ErrorHandler:"ErrorHandler",SharedErrorHandler:"SharedErrorHandler"},na={bindings:[hr.ErrorHandler,hr.SharedErrorHandler],from:Xr.errorHandling.template},uf="AbilityContext",iS={bindings:[uf],from:Xr.abilityContext.template};var ia={reactQueryTypes:{fileName:"react-query.types",extension:"ts"},restClient:{fileName:"rest-client",extension:"ts"},restInterceptor:{fileName:"rest-interceptor",extension:"ts"}},oa={fileName:"app-rest-client",extension:"ts"},lf="QueryModule",sa={fileName:"queryModules",extension:"ts"},oS={fileName:"queryConfig.context",extension:"tsx"},ri={optionsType:"MutationEffectsOptions",hookName:"useMutationEffects",runFunctionName:"runMutationEffects"},aa={fileName:"useMutationEffects",extension:"ts"},ue={namespace:"ZodUtils",exports:{parse:"parse",sortExp:"sortExp",brand:"brand"}},ca={fileName:"zod.utils",extension:"ts"};var sS="Schema",aS="Enum",cS="Body",uS="Param",lS="Response",pS="ErrorResponse",vo="z.void()",ua="z.instanceof(Blob)",So="z.enum",la="z.string()",ni={bindings:["z"],from:"zod"};var bo={input:"",output:"output",splitByTags:!0,defaultTag:"Common",excludeTags:[],excludePathRegex:"",excludeRedundantZodSchemas:!0,tsNamespaces:!0,importPath:"ts",configs:{models:{outputFileNameSuffix:"models",namespaceSuffix:"Models"},endpoints:{outputFileNameSuffix:"api",namespaceSuffix:"Api"},queries:{outputFileNameSuffix:"queries",namespaceSuffix:"Queries"},acl:{outputFileNameSuffix:"acl",namespaceSuffix:"Acl"}},acl:!0,checkAcl:!0,standalone:!1,baseUrl:"",abilityContextImportPath:Xr.abilityContext.template,abilityContextGenericAppAbilities:!1,schemaSuffix:sS,enumSuffix:aS,withDefaultValues:!0,extractEnums:!0,branded:!1,replaceOptionalWithNullish:!1,restClientImportPath:Xr.appRestClient.template,errorHandlingImportPath:Xr.errorHandling.template,removeOperationPrefixEndingWith:"Controller_",parseRequestParams:!0,queryTypesImportPath:Xr.queryTypes.template,axiosRequestConfig:!1,infiniteQueries:!1,mutationEffects:!0};var mt={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation"},fS={bindings:[mt.query,mt.infiniteQuery,mt.mutation],from:"@tanstack/react-query"},_o={pageParamName:"page"},pa={pageParamName:"page",totalItemsName:"totalItems",limitParamName:"limit"},Po="moduleName";var pf={"Content-Type":"application/json",Accept:"application/json"},fa="data",ff="axios",gr="config",At="AxiosRequestConfig",da={defaultImport:ff,bindings:[At],from:"axios"};var dS=o(e=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(e),"isValidPropertyName"),wt=o(e=>e.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"invalidVariableNameCharactersToCamel");function L(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"$ref")}o(L,"isReferenceObject");function re(e){return!L(e)}o(re,"isSchemaObject");function ma(e){return e.type==="array"}o(ma,"isArraySchemaObject");function mS(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(uN(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(L(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(mS,"inferRequiredSchema");var uN=o(e=>!L(e)&&!!e.required&&!e.type&&!e.properties&&!(e!=null&&e.allOf)&&!(e!=null&&e.anyOf)&&!e.oneOf,"isBrokenAllOfItem");var Zt=Symbol.for("@ts-pattern/matcher"),lN=Symbol.for("@ts-pattern/isVariadic"),ga="@ts-pattern/anonymous-select-key",df=o(e=>!!(e&&typeof e=="object"),"r"),ha=o(e=>e&&!!e[Zt],"i"),Rt=o((e,t,r)=>{if(ha(e)){let n=e[Zt](),{matched:i,selections:s}=n.match(t);return i&&s&&Object.keys(s).forEach(a=>r(a,s[a])),i}if(df(e)){if(!df(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];ha(c)&&c[lN]?s.push(c):s.length?i.push(c):n.push(c)}if(s.length){if(s.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<n.length+i.length)return!1;let a=t.slice(0,n.length),c=i.length===0?[]:t.slice(-i.length),u=t.slice(n.length,i.length===0?1/0:-i.length);return n.every((l,f)=>Rt(l,a[f],r))&&i.every((l,f)=>Rt(l,c[f],r))&&(s.length===0||Rt(s[0],u,r))}return e.length===t.length&&e.every((a,c)=>Rt(a,t[c],r))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in t||ha(s=i)&&s[Zt]().matcherType==="optional")&&Rt(i,t[n],r);var s})}return Object.is(t,e)},"s"),_r=o(e=>{var t,r,n;return df(e)?ha(e)?(t=(r=(n=e[Zt]()).getSelectionKeys)==null?void 0:r.call(n))!=null?t:[]:Array.isArray(e)?$o(e,_r):$o(Object.values(e),_r):[]},"o"),$o=o((e,t)=>e.reduce((r,n)=>r.concat(t(n)),[]),"c");function We(e){return Object.assign(e,{optional:o(()=>pN(e),"optional"),and:o(t=>K(e,t),"and"),or:o(t=>fN(e,t),"or"),select:o(t=>t===void 0?hS(e):hS(t,e),"select")})}o(We,"u");function pN(e){return We({[Zt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return t===void 0?(_r(e).forEach(i=>n(i,void 0)),{matched:!0,selections:r}):{matched:Rt(e,t,n),selections:r}},"match"),getSelectionKeys:o(()=>_r(e),"getSelectionKeys"),matcherType:"optional"})})}o(pN,"h");function K(...e){return We({[Zt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return{matched:e.every(i=>Rt(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>$o(e,_r),"getSelectionKeys"),matcherType:"and"})})}o(K,"m");function fN(...e){return We({[Zt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return $o(e,_r).forEach(i=>n(i,void 0)),{matched:e.some(i=>Rt(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>$o(e,_r),"getSelectionKeys"),matcherType:"or"})})}o(fN,"d");function F(e){return{[Zt]:()=>({match:o(t=>({matched:!!e(t)}),"match")})}}o(F,"p");function hS(...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 We({[Zt]:()=>({match:o(n=>{let i={[t??ga]:n};return{matched:r===void 0||Rt(r,n,(s,a)=>{i[s]=a}),selections:i}},"match"),getSelectionKeys:o(()=>[t??ga].concat(r===void 0?[]:_r(r)),"getSelectionKeys")})})}o(hS,"y");function It(e){return typeof e=="number"}o(It,"v");function yr(e){return typeof e=="string"}o(yr,"b");function vr(e){return typeof e=="bigint"}o(vr,"w");var o5=We(F(function(e){return!0}));var Sr=o(e=>Object.assign(We(e),{startsWith:o(t=>{return Sr(K(e,(r=t,F(n=>yr(n)&&n.startsWith(r)))));var r},"startsWith"),endsWith:o(t=>{return Sr(K(e,(r=t,F(n=>yr(n)&&n.endsWith(r)))));var r},"endsWith"),minLength:o(t=>Sr(K(e,(r=>F(n=>yr(n)&&n.length>=r))(t))),"minLength"),length:o(t=>Sr(K(e,(r=>F(n=>yr(n)&&n.length===r))(t))),"length"),maxLength:o(t=>Sr(K(e,(r=>F(n=>yr(n)&&n.length<=r))(t))),"maxLength"),includes:o(t=>{return Sr(K(e,(r=t,F(n=>yr(n)&&n.includes(r)))));var r},"includes"),regex:o(t=>{return Sr(K(e,(r=t,F(n=>yr(n)&&!!n.match(r)))));var r},"regex")}),"j"),s5=Sr(F(yr)),Tt=o(e=>Object.assign(We(e),{between:o((t,r)=>Tt(K(e,((n,i)=>F(s=>It(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>Tt(K(e,(r=>F(n=>It(n)&&n<r))(t))),"lt"),gt:o(t=>Tt(K(e,(r=>F(n=>It(n)&&n>r))(t))),"gt"),lte:o(t=>Tt(K(e,(r=>F(n=>It(n)&&n<=r))(t))),"lte"),gte:o(t=>Tt(K(e,(r=>F(n=>It(n)&&n>=r))(t))),"gte"),int:o(()=>Tt(K(e,F(t=>It(t)&&Number.isInteger(t)))),"int"),finite:o(()=>Tt(K(e,F(t=>It(t)&&Number.isFinite(t)))),"finite"),positive:o(()=>Tt(K(e,F(t=>It(t)&&t>0))),"positive"),negative:o(()=>Tt(K(e,F(t=>It(t)&&t<0))),"negative")}),"x"),a5=Tt(F(It)),br=o(e=>Object.assign(We(e),{between:o((t,r)=>br(K(e,((n,i)=>F(s=>vr(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>br(K(e,(r=>F(n=>vr(n)&&n<r))(t))),"lt"),gt:o(t=>br(K(e,(r=>F(n=>vr(n)&&n>r))(t))),"gt"),lte:o(t=>br(K(e,(r=>F(n=>vr(n)&&n<=r))(t))),"lte"),gte:o(t=>br(K(e,(r=>F(n=>vr(n)&&n>=r))(t))),"gte"),positive:o(()=>br(K(e,F(t=>vr(t)&&t>0))),"positive"),negative:o(()=>br(K(e,F(t=>vr(t)&&t<0))),"negative")}),"A"),c5=br(F(vr)),u5=We(F(function(e){return typeof e=="boolean"})),l5=We(F(function(e){return typeof e=="symbol"})),p5=We(F(function(e){return e==null})),f5=We(F(function(e){return e!=null}));var yf=class yf 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(yf,"W");var mf=yf,hf={matched:!1,value:void 0};function Ee(e){return new gf(e,hf)}o(Ee,"z");var Eo=class Eo{constructor(t,r){this.input=void 0,this.state=void 0,this.input=t,this.state=r}with(...t){if(this.state.matched)return this;let r=t[t.length-1],n=[t[0]],i;t.length===3&&typeof t[1]=="function"?i=t[1]:t.length>2&&n.push(...t.slice(1,t.length-1));let s=!1,a={},c=o((l,f)=>{s=!0,a[l]=f},"a"),u=!n.some(l=>Rt(l,this.input,c))||i&&!i(this.input)?hf:{matched:!0,value:r(s?ga in a?a[ga]:a:this.input,this.input)};return new Eo(this.input,u)}when(t,r){if(this.state.matched)return this;let n=!!t(this.input);return new Eo(this.input,n?{matched:!0,value:r(this.input,this.input)}:hf)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new mf(this.input)}run(){return this.exhaustive()}returnType(){return this}};o(Eo,"I");var gf=Eo;var vf=2,gS=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],yS=["query","header","path"],en=["get","put","post","delete","options","head","patch","trace"],vS=["string","number","integer","boolean"],ii=["allOf","anyOf","oneOf"];var B=o(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalize"),Pr=o(e=>e.charAt(0).toLowerCase()+e.slice(1),"decapitalize"),SS=o(e=>e.replace(/(-\w)/g,t=>t[1].toUpperCase()),"kebabToCamel"),le=o(e=>e.replace(/(_\w)/g,t=>t[1].toUpperCase()),"snakeToCamel"),bS=o(e=>e.replace(/[\W_]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"nonWordCharactersToCamel"),Sf=o((e,t="")=>e.endsWith(t)?e:`${e}${t}`,"suffixIfNeeded"),_S=o((e,t)=>e.replace(new RegExp(`${t}$`),""),"removeSuffix"),dN=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"),bf=o(e=>{let t=e.map(B).map(PS).map(r=>mN(r)).flat();return dN(t)},"getMostCommonAdjacentCombinationSplit"),PS=o(e=>e.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),ES=o(e=>PS(e).join(" "),"camelToSpaceSeparated"),mN=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"),$S=o((e,t)=>{let r=t.replace(/es$|s$/g,""),n=new RegExp(`(${Pr(r)}|${B(r)})[a-z]*(?=$|[A-Z])`,"g");return e.replace(n,"")},"removeWord");var xS=o(e=>`#/components/schemas/${e}`,"getSchemaRef"),tn=o(e=>e[1]==="/"?e:"#/"+e.slice(1),"autocorrectRef"),oi=o(e=>tn(e).split("/").at(-1),"getSchemaNameByRef");function Pf(e){let t=hN(e).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return le(t)}o(Pf,"normalizeString");function AS(e){return/^[a-zA-Z]\w*$/.test(e)?e:`"${e}"`}o(AS,"wrapWithQuotesIfNeeded");function wS(e){return typeof e=="string"&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}o(wS,"unwrapQuotesIfNeeded");function hN(e){let t=Number(e[0]);return typeof t=="number"&&!Number.isNaN(t)?"_"+e:e}o(hN,"prefixStringStartingWithNumberIfNeeded");function Ef(e){let t=e.replaceAll("_","#");return le(t.replaceAll("-","_")).replaceAll("#","_")}o(Ef,"pathParamToVariableName");var Ye=o(e=>vS.includes(e),"isPrimitiveType");function IS(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(IS,"escapeControlCharacters");function Je(e){return e.includes("application/")&&e.includes("json")||gS.includes(e)||e.includes("text/")}o(Je,"isParamMediaTypeAllowed");function Oo(e){return e>=200&&e<300}o(Oo,"isMainResponseStatus");function ya(e){return!(e>=200&&e<300)}o(ya,"isErrorStatus");function si(e){return e.startsWith("application/")}o(si,"isMediaTypeAllowed");var OS=/({\w+})/g,gN=/[^\w\-]+/g;function TS(e){e=B(SS(e.replaceAll("/","-")).replaceAll("-",""));let t=[...e.matchAll(OS)];if(t.length>0){let r=t.sort((n,i)=>n.index-i.index)[t.length-1][0];e=`${e.replace(OS,"")}By${B(r.slice(1,-1))}`}return e.replace(gN,"_")}o(TS,"pathToVariableName");var _f=/{(\b\w+(?:-\w+)*\b)}/g;function RS(e){let t=e.match(_f);return t===null?e.replaceAll(_f,":$1"):(t.forEach(r=>{let n=Ef(r.replaceAll(_f,":$1"));e=e.replaceAll(r,n)}),e)}o(RS,"replaceHyphenatedPath");var CS=o(e=>{let t=e["x-enumNames"],r=Array.isArray(t)&&t.length>0,n=!!e.schema&&re(e.schema)&&e.schema.type==="string";return r&&n},"isSortingParameterObject"),rn=o((e,t)=>t.excludePathRegex?new RegExp(t.excludePathRegex).test(e):!1,"isPathExcluded");function Ct(e){return bS(e)}o(Ct,"formatTag");function Er(e,t){var n;let r=(n=e.tags)==null?void 0:n[0];return Ct(r??t.defaultTag)}o(Er,"getOperationTag");function NS(e,t){return t.excludeTags.some(r=>r.toLowerCase()===e.toLowerCase())}o(NS,"isTagExcluded");var va={fileName:"acl/app.ability",extension:"ts"},xo="AllAbilities",Ao="AppAbilities",Sa={fileName:"acl/useAclCheck",extension:"ts"},$r="useAclCheck",$e={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subjectType:"Subject",subject:"subject"},$f={bindings:[$e.abilityTuple,$e.pureAbility,$e.forcedSubject,$e.subjectType,$e.subject],from:"@casl/ability"};var He=o((...e)=>[...new Set(e.flat())],"getUniqueArray");var kS=o(e=>`Use${B(le(e.operationName))}Ability`,"getAbilityTypeName"),wo=o(e=>`canUse${B(le(e.operationName))}`,"getAbilityFunctionName"),jS=o((e,t)=>`${t.tsNamespaces?`${U({type:"acl",tag:Or(e,t),options:t})}.`:""}${wo(e)}`,"getImportedAbilityFunctionName"),qS=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].action},"getAbilityAction"),MS=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].subject},"getAbilitySubject"),ba=o(e=>{var t;return!!((t=Io(e))!=null&&t.length)},"hasAbilityConditions"),Io=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].conditionsTypes},"getAbilityConditionsTypes"),DS=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].description},"getAbilityDescription"),_a=o(e=>`${B(e)}${xo}`,"getTagAllAbilitiesName");function me(e,t){if(!e)return;let{data:r,onSchema:n}=t;if(L(e)&&n({type:"reference",schema:e,data:r})===!0)return;let i=e;if(ii.some(s=>s in i&&i[s])){let s=i.allOf??i.anyOf??i.oneOf??[];for(let a of s)(n==null?void 0:n({type:"composite",parentSchema:e,schema:a,data:r}))!==!0&&me(a,{data:r,onSchema:n})}if(i.properties)for(let[s,a]of Object.entries(i.properties))n({type:"property",parentSchema:e,schema:a,data:r,propertyName:s})!==!0&&me(a,t);if(i.additionalProperties&&typeof i.additionalProperties=="object"){if(n({type:"additionalProperties",parentSchema:e,schema:i.additionalProperties,data:r})===!0)return;me(i.additionalProperties,t)}if(i.type==="array"){let s=e.items;if(n({type:"array",parentSchema:e,schema:s,data:r})===!0)return;me(s,t)}}o(me,"iterateSchema");var Nt=o((e,t)=>Sf(B(Pf(e)),t),"getZodSchemaName"),To=o((e,t,r)=>Sf(B(Pf(e)),`${t}${r}`),"getEnumZodSchemaName"),he=o(e=>["z.",`${ue.namespace}.`].every(t=>!e.startsWith(t)),"isNamedZodSchema"),LS=o(e=>e.startsWith(So),"isEnumZodSchema"),nn=o((e,t,r)=>t?e:`${r}_${e}`,"getZodSchemaOperationName"),Pa=o(e=>le(`${e}_${cS}`),"getBodyZodSchemaName"),FS=o((e,t)=>le(`${e}_${t}${uS}`),"getParamZodSchemaName"),yN=o(e=>le(`${e}${lS}`),"getMainResponseZodSchemaName"),vN=o((e,t)=>le(`${e}_${t}_${pS}`),"getErrorResponseZodSchemaName");function Ea({statusCode:e,operationName:t,isUniqueOperationName:r,tag:n}){let i=Number(e),s=nn(t,r,n);return!Oo(i)&&e!=="default"&&ya(i)?vN(s,e):yN(s)}o(Ea,"getResponseZodSchemaName");function Ro(e){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(n=>e[n]).reduce((n,i)=>[...n,`${B(ES(i))}: \`${e[i]}\``],[])}o(Ro,"getSchemaDescriptions");var Co=o((e,t)=>_S(e,t.schemaSuffix),"getZodSchemaInferedTypeName"),HS=o((e,t)=>he(t)?`${e.options.tsNamespaces?`${U({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${t}`:t,"getImportedZodSchemaName"),xr=o((e,t,r)=>{if(!he(t))return t===vo?"void":t;let n=e.getTagByZodSchemaName(t);return`${e.options.tsNamespaces&&n!==r?`${U({type:"models",tag:n,options:e.options})}.`:""}${Co(t,e.options)}`},"getImportedZodSchemaInferedTypeName");function VS(e){var t;return e.isEnum?"enum":((t=e.schemaObj)==null?void 0:t.type)??"object"}o(VS,"getZodSchemaType");function BS(e){if(e.schemaObj)return[e.schemaObj.description,...Ro(e.schemaObj).join(". ")].filter(Boolean)}o(BS,"getZodSchemaDescription");function US(e,t,r){var n;if(L(t)){let i=e.getZodSchemaNameByRef(t.$ref);return i?xr(e,i,r):void 0}if(ma(t)){if(!L(t.items))return`${((n=t.items)==null?void 0:n.type)??"unknown"}[]`;let i=e.getZodSchemaNameByRef(t.items.$ref);return i?`${xr(e,i,r)}[]`:void 0}if(ii.some(i=>i in t&&t[i])){let i=t.allOf??t.anyOf??t.oneOf??[];if(i.length>0)return US(e,i[0],r)}return t.type}o(US,"getType");function GS(e,t,r){if(!t.schemaObj)return[];let n="[0]",i="[key]",s={},a=o(c=>{var l;if(c.type==="reference")return!0;if(c.type==="composite")return;let u=[...((l=c.data)==null?void 0:l.pathSegments)??[]];if(c.type==="array"?u.push(n):c.type==="property"?u.push(c.propertyName):c.type==="additionalProperties"&&u.push(i),c.schema&&u[u.length-1]!==n){let f=e.resolveObject(c.schema),p=[f.description,...Ro(f)].filter(Boolean),d=u.join(".");s[d]&&"type"in c.schema&&c.schema.type==="object"||(delete s[d],s[d]={type:US(e,c.schema,r)??"unknown",description:p.join(". ")})}return me(c.schema,{data:{pathSegments:[...u]},onSchema:a}),!0},"onSchema");return"allOf"in t.schemaObj&&t.schemaObj.allOf&&t.schemaObj.allOf.forEach(c=>{if(L(c)){let u=e.resolveObject(c);me(u,{data:{pathSegments:[]},onSchema:a})}}),me(t.schemaObj,{data:{pathSegments:[]},onSchema:a}),s}o(GS,"getZodSchemaPropertyDescriptions");function Ar({resolver:e,tag:t,zodSchemas:r=[],zodSchemasAsTypes:n=[]}){let i="models",s=o(u=>e.getTagByZodSchemaName(u),"getTag"),a=$a({type:i,tag:t,entities:r,getTag:s,getEntityName:o(u=>u,"getEntityName"),options:e.options}),c=$a({type:i,tag:t,entities:n,getTag:s,getEntityName:o(u=>Co(u,e.options),"getEntityName"),options:e.options});return SN(e.options,a,c)}o(Ar,"getModelsImports");function ZS({tag:e,endpoints:t,options:r}){return $a({type:"endpoints",tag:e,entities:t,getTag:o(n=>Or(n,r),"getTag"),getEntityName:No,options:r})}o(ZS,"getEndpointsImports");function zS({tag:e,endpoints:t,options:r}){return $a({type:"acl",tag:e,entities:t,getTag:o(n=>Or(n,r),"getTag"),getEntityName:wo,options:r})}o(zS,"getAclImports");function KS({tags:e,entityName:t,getAliasEntityName:r,type:n,options:i}){let s=new Map;return e.forEach(a=>{let c=`${t}${r?` as ${r(a)}`:""}`;s.has(a)?i.tsNamespaces||s.get(a).bindings.push(c):s.set(a,{bindings:[i.tsNamespaces?U({type:n,tag:a,options:i}):c],from:`${kt(i)}${on({type:n,tag:a,includeTagDir:!0,options:i})}`})}),Array.from(s.values())}o(KS,"getEntityImports");function kt(e){let t=cf;return e.importPath==="relative"?t="../":e.importPath==="absolute"?t=e.output:new RegExp(`${af}`,"g").test(e.output)&&(t=e.output.replace(new RegExp(`.*${af}`,"g"),cf)),`${t}/`.replace(/\/\//g,"/")}o(kt,"getImportPath");function $a({type:e="models",tag:t,entities:r,getTag:n,getEntityName:i,options:s}){let a=new Map;return r.forEach(c=>{let u=n(c);if(a.has(u))s.tsNamespaces||a.get(u).bindings.push(i(c));else{let l=t===u;a.set(u,{bindings:[s.tsNamespaces?U({type:e,tag:u,options:s}):i(c)],from:`${l?"./":kt(s)}${on({type:e,tag:u,includeTagDir:!l,options:s})}`})}}),Array.from(a.values())}o($a,"getImports");function SN(e,...t){let r=new Map;return t.forEach(n=>{n.forEach(i=>{r.has(i.from)?e.tsNamespaces||r.get(i.from).bindings.push(...i.bindings):r.set(i.from,i)})}),Array.from(r.values()).map(n=>({...n,bindings:He(n.bindings)}))}o(SN,"mergeImports");function sn({fileName:e,extension:t}){return`${e}.${t}`}o(sn,"getFileNameWithExtension");function QS({type:e,tag:t,options:r,includeTagDir:n=!0}){let i=r.configs[e].outputFileNameSuffix;return t?`${n?`${Pr(t)}/`:""}${Pr(t)}.${i}`:i}o(QS,"getTagFileNameWithoutExtension");function on(...e){return QS(...e)}o(on,"getTagImportPath");function WS(...e){return`${QS(...e)}.ts`}o(WS,"getTagFileName");var U=o(({type:e,tag:t,options:r})=>`${B(t)}${r.configs[e].namespaceSuffix}`,"getNamespaceName");function YS(e){return e.standalone?`${kt(e)}${oa.fileName}`:e.restClientImportPath}o(YS,"getAppRestClientImportPath");function JS(e){return e.standalone?`${kt(e)}${ia.reactQueryTypes.fileName}`:e.queryTypesImportPath}o(JS,"getQueryTypesImportPath");function XS(e){return`${kt(e)}${sa.fileName}`}o(XS,"getQueryModulesImportPath");function eb(e){return`${kt(e)}${aa.fileName}`}o(eb,"getMutationEffectsImportPath");function tb(e){return`${kt(e)}${Sa.fileName}`}o(tb,"getAclCheckImportPath");function Oa(e){return`${kt(e)}${ca.fileName}`}o(Oa,"getZodUtilsImportPath");function rb(e){return`${kt(e)}${va.fileName}`}o(rb,"getAppAbilitiesImportPath");function xa(e){return Ee(e).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}o(xa,"primitiveTypeToTsType");function ai({zodSchemaName:e,schema:t,resolver:r}){let n="void",i;e&&he(e)?(n=xr(r,e),i=r.getTagByZodSchemaName(e)):t!=null&&t.type&&Ye(t==null?void 0:t.type)&&(n=xa(t==null?void 0:t.type));let s=n.split(".");return{type:s[s.length-1],...s.length>1?{namespace:s[0]}:{},...i?{importPath:on({type:"models",tag:i,includeTagDir:!0,options:r.options})}:{}}}o(ai,"getTsTypeBase");function an({schema:e,isCircular:t,parentTypes:r,resolver:n}){if(!e)return{metaType:"primitive"};for(let i of ii){let s=e[i];if(s)if(s.length>1){let a=s.map(c=>{let u=n.resolveObject(c);return an({schema:u,parentTypes:r,resolver:n})});return a.every(({metaType:c})=>c==="object")?{metaType:"object",objectProperties:a.reduce((c,{objectProperties:u})=>{let l=u.map(({name:f})=>f);return[...c.filter(({name:f})=>!l.includes(f)),...u]},[])}:{metaType:"composite",[i]:a}}else e=n.resolveObject(s[0])}return e.type==="array"?{metaType:"array",arrayType:nb({arraySchema:e,resolver:n,parentTypes:r})}:(e.type==="object"||e.properties)&&t?{metaType:"object",objectProperties:[],isCircular:!0}:e.type==="object"||e.properties?{metaType:"object",objectProperties:bN({schema:e,parentTypes:r,resolver:n})}:{metaType:"primitive"}}o(an,"getSchemaTsMetaType");function nb({arraySchema:e,parentTypes:t,resolver:r}){let n,i;if(L(e.items)){let u=e.items.$ref;n=r.getZodSchemaNameByRef(u),i=r.getSchemaByRef(u)}else i=e.items;let s=ai({zodSchemaName:n,schema:i,resolver:r}),a=ib(s,t),c=an({schema:i,isCircular:a,parentTypes:[...t,s],resolver:r});return{...s,...c}}o(nb,"getArraySchemaTsType");function bN({schema:e,parentTypes:t,resolver:r}){return Object.entries((e==null?void 0:e.properties)??{}).map(([n,i])=>{var a;let s=((a=e==null?void 0:e.required)==null?void 0:a.includes(n))??!1;if(L(i)){let c=r.getZodSchemaNameByRef(i.$ref),u=r.getSchemaByRef(i.$ref),l=ai({zodSchemaName:c,schema:u,resolver:r}),f=ib(l,t),p=an({schema:u,isCircular:f,parentTypes:[...t,l],resolver:r});return{name:n,isRequired:s,...l,...p}}else if(i.type==="array"){let c=nb({arraySchema:i,parentTypes:t,resolver:r});return{name:n,isRequired:s,type:"array",metaType:"array",arrayType:c}}else if(Ye(i.type))return{name:n,isRequired:s,type:xa(i.type),metaType:"primitive"};return{name:n,isRequired:s,type:"void",metaType:"primitive"}})}o(bN,"getSchemaTsProperties");function ib(e,t){return t.findIndex(({type:r,namespace:n})=>r===e.type&&n===e.namespace)>-1}o(ib,"getIsCircular");var No=o(e=>Pr(le(e.operationName)),"getEndpointName");function ob(e,t){return`${t.tsNamespaces?`${U({type:"endpoints",tag:Or(e,t),options:t})}.`:""}${No(e)}`}o(ob,"getImportedEndpointName");var sb=o(e=>e.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function Or(e,t){var n;let r=t.splitByTags?(n=e.tags)==null?void 0:n[0]:t.defaultTag;return Ct(r??t.defaultTag)}o(Or,"getEndpointTag");function wr(e,t,r){let n=t.parameters.map(i=>{var a,c,u,l;let s="string";if(he(i.zodSchema))s=xr(e,i.zodSchema);else if((a=i.parameterObject)!=null&&a.schema&&re(i.parameterObject.schema)){let f=(u=(c=i.parameterObject)==null?void 0:c.schema)==null?void 0:u.type;f&&Ye(f)&&(s=xa(f))}return{name:wt(i.name),type:s,paramType:i.type,required:((l=i.parameterObject)==null?void 0:l.required)??!0,parameterObject:i.parameterObject,bodyObject:i.bodyObject}});return r!=null&&r.includeFileParam&&t.mediaUpload&&n.push({name:"file",type:"File",paramType:"Body",required:!0,parameterObject:void 0,bodyObject:void 0}),n.sort((i,s)=>{if(i.required===s.required){let a=["Path","Body","Query","Header"];return a.indexOf(i.paramType)-a.indexOf(s.paramType)}return i.required?-1:1}).filter(i=>(!(r!=null&&r.excludeBodyParam)||i.name!==fa)&&(!(r!=null&&r.excludePageParam)||i.name!==_o.pageParamName)&&(!(r!=null&&r.includeOnlyRequiredParams)||i.required)).map(i=>({...i,name:r!=null&&r.replacePageParam&&i.name===_o.pageParamName?"pageParam":i.name}))}o(wr,"mapEndpointParamsToFunctionParams");function ab(e){let t=e.parameters.filter(i=>i.type==="Query").map(i=>{let s=dS(i.name)?i.name:`"${i.name}"`,a=wt(i.name);return{...i,name:s,value:a}}),r={};return e.requestFormat!==pf["Content-Type"]&&(r["Content-Type"]=`'${e.requestFormat}'`),e.responseFormat&&e.responseFormat!==pf.Accept&&(r.Accept=`'${e.responseFormat}'`),e.parameters.filter(i=>i.type==="Header").forEach(i=>{r[i.name]=wt(i.name)}),{...t.length>0?{params:t}:{},...Object.keys(r).length?{headers:r}:{}}}o(ab,"getEndpointConfig");function cb(e,t){return t.filter(r=>Ie(r)&&r.parameters.filter(n=>{var i;return(i=n.parameterObject)==null?void 0:i.required}).every(n=>e.parameters.some(i=>i.name===n.name))&&r.response===e.response)}o(cb,"getUpdateQueryEndpoints");var Ie=o(e=>e.method==="get","isQuery"),jt=o(e=>e.method!=="get"||!!e.mediaDownload,"isMutation"),ci=o((e,t)=>Ie(e)&&(t??Object.values(_o)).every(r=>e.parameters.some(n=>n.name===r&&n.type==="Query")),"isInfiniteQuery"),ub=o((e,t,r)=>{let n=r.reduce((i,s)=>[...i,...wr(e,s,{includeOnlyRequiredParams:!0}).map(a=>a.name)],[]);return wr(e,t,{includeOnlyRequiredParams:!0,excludeBodyParam:!0}).filter(i=>n.includes(i.name)).map(i=>i.name)},"getDestructuredVariables");var Aa=o((e,t)=>{let r=Ie(e)&&jt(e)&&t;return`use${B(le(e.operationName))}${r?"Mutation":""}`},"getQueryName"),lb=o(e=>`use${B(le(e.operationName))}Infinite`,"getInfiniteQueryName");var Of=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with"];function cn(e,t){let r={};return Object.keys(e).forEach(n=>{t.includes(n)&&(r[n]=e[n])}),r}o(cn,"pick");function ui(e,t){let r=e.deprecated&&!t.withDeprecatedEndpoints,n=Er(e,t),i=NS(n,t);return r||i}o(ui,"isOperationExcluded");function xf({path:e,method:t,operation:r,options:n,tag:i,keepOperationTag:s,keepOperationPrefix:a}){let c=`${t}${TS(e)}`,u=r.operationId?wt(r.operationId):c;if(n.removeOperationPrefixEndingWith&&a)u=u.split(n.removeOperationPrefixEndingWith).map((f,p)=>p===0?f:B(f)).join("");else if(n.removeOperationPrefixEndingWith&&!a){let l=new RegExp(`^.*${n.removeOperationPrefixEndingWith}`);u=u.replace(l,"")}if(n.tsNamespaces&&!s){let l=$S(u,i);l===""?u=t.toLowerCase():Of.includes(l)||(u=l)}return Of.includes(u)?c:u}o(xf,"getOperationName");function ko({operationsByTag:e,...t}){let{operation:r,options:n}=t,i=n.splitByTags?Er(r,n):n.defaultTag,s=o(a=>{let c=xf({...t,tag:i,keepOperationTag:a});if(e[i].filter(l=>xf({...t,operation:l,tag:i,keepOperationTag:a})===c).length===1)return c},"operationName");return s()??s(!0)??xf({...t,tag:i,keepOperationTag:!0,keepOperationPrefix:!0})}o(ko,"getUniqueOperationName");function pb(e,t,r){let n=[];for(let i in e.paths){if(rn(i,r))continue;let s=e.paths[i],a=cn(s,en);for(let c in a){let u=a[c];if(!u||ui(u,r))continue;let l=ko({path:i,method:c,operation:u,operationsByTag:t,options:r});n.push(l)}}return n}o(pb,"getUniqueOperationNamesWithoutSplitByTags");function fb(e,t){let r={};for(let n in e.paths){if(rn(n,t))continue;let i=e.paths[n],s=cn(i,en);for(let a in s){let c=s[a];if(!c||ui(c,t))continue;let u=t.splitByTags?Er(c,t):t.defaultTag;r[u]||(r[u]=[]),r[u].push(c)}}return r}o(fb,"getOperationsByTag");var db={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",300:"Ambiguous",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I Am a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",424:"Failed Dependency",428:"Precondition Required",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported"};function jo(e){return{type:"invalid-schema",message:e}}o(jo,"getInvalidSchemaError");function mb(e){return{type:"invalid-operation-id",message:`Operation ${e}`}}o(mb,"getInvalidOperationIdError");function hb(e,t){return{type:"missing-path-parameter",message:`Path ${t} is missing [${e.map(({name:r})=>r).join(", ")}]`}}o(hb,"getMissingPathParameterError");function gb(e){return{type:"not-allowed-inline-enum",message:`${e} is missing @IsEnum() and @ApiProperty(enum:, enumName:)`}}o(gb,"getNotAllowedInlineEnumError");function yb(e){return{type:"not-allowed-circular-schema",message:e}}o(yb,"getNotAllowedCircularSchemaError");function vb(e,t,r){return{type:"missing-acl-condition-property",message:`Condition property ${e} is not found in parameters or body in operation ${Ia(t,r)}`}}o(vb,"getMissingAclConditionPropertyError");function Af(e,t,r){return{type:"missing-status-code",message:`Missing HTTP status code ${wa(e)} in operation ${Ia(t,r)}`}}o(Af,"getMissingStatusCodeError");function Sb(e,t,r){return{type:"invalid-status-code",message:`Operation ${Ia(t,r)} expected HTTP status code ${wa(e.expected)} but received ${wa(e.received)}`}}o(Sb,"getInvalidStatusCodeError");function bb(e,t,r){return{type:"multiple-success-status-codes",message:`Operation ${Ia(t,r)} has multiple success HTTP status codes: ${e.map(wa).join(", ")}`}}o(bb,"getMultipleSuccessStatusCodesError");function Ia(e,t){return e.operationId??`${t.method} ${t.path}`}o(Ia,"getOperationDescriptor");function wa(e){return`${e} (${db[e]})`}o(wa,"getStatusCodeDescription");function qt({schema:e,meta:t,options:r}){let n=[];Ee(e.type).with("string",()=>n.push(EN(e))).with("number","integer",()=>n.push(ON(e))).with("array",()=>n.push(xN(e))).otherwise(()=>{}),typeof e.description=="string"&&e.description!==""&&r.withDescription&&([`
|
|
72
|
+
`,t};J.prototype.Program=function(e){var t="",r=e.body,n=void 0,i=void 0;if(e.blockParams){var s="BLOCK PARAMS: [";for(n=0,i=e.blockParams.length;n<i;n++)s+=" "+e.blockParams[n];s+=" ]",t+=this.pad(s)}for(n=0,i=r.length;n<i;n++)t+=this.accept(r[n]);return this.padding--,t};J.prototype.MustacheStatement=function(e){return this.pad("{{ "+this.SubExpression(e)+" }}")};J.prototype.Decorator=function(e){return this.pad("{{ DIRECTIVE "+this.SubExpression(e)+" }}")};J.prototype.BlockStatement=J.prototype.DecoratorBlock=function(e){var t="";return t+=this.pad((e.type==="DecoratorBlock"?"DIRECTIVE ":"")+"BLOCK:"),this.padding++,t+=this.pad(this.SubExpression(e)),e.program&&(t+=this.pad("PROGRAM:"),this.padding++,t+=this.accept(e.program),this.padding--),e.inverse&&(e.program&&this.padding++,t+=this.pad("{{^}}"),this.padding++,t+=this.accept(e.inverse),this.padding--,e.program&&this.padding--),this.padding--,t};J.prototype.PartialStatement=function(e){var t="PARTIAL:"+e.name.original;return e.params[0]&&(t+=" "+this.accept(e.params[0])),e.hash&&(t+=" "+this.accept(e.hash)),this.pad("{{> "+t+" }}")};J.prototype.PartialBlockStatement=function(e){var t="PARTIAL BLOCK:"+e.name.original;return e.params[0]&&(t+=" "+this.accept(e.params[0])),e.hash&&(t+=" "+this.accept(e.hash)),t+=" "+this.pad("PROGRAM:"),this.padding++,t+=this.accept(e.program),this.padding--,this.pad("{{> "+t+" }}")};J.prototype.ContentStatement=function(e){return this.pad("CONTENT[ '"+e.value+"' ]")};J.prototype.CommentStatement=function(e){return this.pad("{{! '"+e.value+"' }}")};J.prototype.SubExpression=function(e){for(var t=e.params,r=[],n=void 0,i=0,s=t.length;i<s;i++)r.push(this.accept(t[i]));return t="["+r.join(", ")+"]",n=e.hash?" "+this.accept(e.hash):"",this.accept(e.path)+" "+t+n};J.prototype.PathExpression=function(e){var t=e.parts.join("/");return(e.data?"@":"")+"PATH:"+t};J.prototype.StringLiteral=function(e){return'"'+e.value+'"'};J.prototype.NumberLiteral=function(e){return"NUMBER{"+e.value+"}"};J.prototype.BooleanLiteral=function(e){return"BOOLEAN{"+e.value+"}"};J.prototype.UndefinedLiteral=function(){return"UNDEFINED"};J.prototype.NullLiteral=function(){return"NULL"};J.prototype.Hash=function(e){for(var t=e.pairs,r=[],n=0,i=t.length;n<i;n++)r.push(this.accept(t[n]));return"HASH{"+r.join(", ")+"}"};J.prototype.HashPair=function(e){return e.key+"="+this.accept(e.value)}});var Yt=h((AB,NP)=>{var hc=IP().default,CP=TP();hc.PrintVisitor=CP.PrintVisitor;hc.print=CP.print;NP.exports=hc;function RP(e,t){var r=require("fs"),n=r.readFileSync(t,"utf8");e.exports=hc.compile(n)}o(RP,"extension");typeof require<"u"&&require.extensions&&(require.extensions[".handlebars"]=RP,require.extensions[".hbs"]=RP)});var qq={};dE(qq,{getGenerateFilesData:()=>jq,getGenerateMetadata:()=>kq});module.exports=mE(qq);var Ad=rt(nS());var yo="AppRestClient",ra={query:"AppQueryOptions",infiniteQuery:"AppInfiniteQueryOptions",mutation:"AppMutationOptions"},af="src/data",cf="@/data",Xr={appRestClient:{template:"@/util/rest/clients/app-rest-client",monorepoTemplate:"@/clients/app-rest-client"},queryTypes:{template:"@/types/react-query",monorepoTemplate:"@povio/utils/types/react-query"},errorHandling:{template:"@/util/vendor/error-handling",monorepoTemplate:"@povio/utils/utils/vendor/error-handling"},abilityContext:{template:"@/data/acl/ability.context",monorepoTemplate:"@povio/auth/acl/ability.context"}},hr={ErrorHandler:"ErrorHandler",SharedErrorHandler:"SharedErrorHandler"},na={bindings:[hr.ErrorHandler,hr.SharedErrorHandler],from:Xr.errorHandling.template},uf="AbilityContext",iS={bindings:[uf],from:Xr.abilityContext.template};var ia={reactQueryTypes:{fileName:"react-query.types",extension:"ts"},restClient:{fileName:"rest-client",extension:"ts"},restInterceptor:{fileName:"rest-interceptor",extension:"ts"}},oa={fileName:"app-rest-client",extension:"ts"},lf="QueryModule",sa={fileName:"queryModules",extension:"ts"},oS={fileName:"queryConfig.context",extension:"tsx"},ri={optionsType:"MutationEffectsOptions",hookName:"useMutationEffects",runFunctionName:"runMutationEffects"},aa={fileName:"useMutationEffects",extension:"ts"},ue={namespace:"ZodUtils",exports:{parse:"parse",sortExp:"sortExp",brand:"brand"}},ca={fileName:"zod.utils",extension:"ts"};var sS="Schema",aS="Enum",cS="Body",uS="Param",lS="Response",pS="ErrorResponse",vo="z.void()",ua="z.instanceof(Blob)",So="z.enum",la="z.string()",ni={bindings:["z"],from:"zod"};var bo={input:"",output:"output",splitByTags:!0,defaultTag:"Common",excludeTags:[],excludePathRegex:"",excludeRedundantZodSchemas:!0,tsNamespaces:!0,importPath:"ts",configs:{models:{outputFileNameSuffix:"models",namespaceSuffix:"Models"},endpoints:{outputFileNameSuffix:"api",namespaceSuffix:"Api"},queries:{outputFileNameSuffix:"queries",namespaceSuffix:"Queries"},acl:{outputFileNameSuffix:"acl",namespaceSuffix:"Acl"}},acl:!0,checkAcl:!0,standalone:!1,baseUrl:"",abilityContextImportPath:Xr.abilityContext.template,abilityContextGenericAppAbilities:!1,schemaSuffix:sS,enumSuffix:aS,withDefaultValues:!0,extractEnums:!0,branded:!0,replaceOptionalWithNullish:!1,restClientImportPath:Xr.appRestClient.template,errorHandlingImportPath:Xr.errorHandling.template,removeOperationPrefixEndingWith:"Controller_",parseRequestParams:!0,queryTypesImportPath:Xr.queryTypes.template,axiosRequestConfig:!1,infiniteQueries:!1,mutationEffects:!0};var mt={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation"},fS={bindings:[mt.query,mt.infiniteQuery,mt.mutation],from:"@tanstack/react-query"},_o={pageParamName:"page"},pa={pageParamName:"page",totalItemsName:"totalItems",limitParamName:"limit"},Po="moduleName";var pf={"Content-Type":"application/json",Accept:"application/json"},fa="data",ff="axios",gr="config",At="AxiosRequestConfig",da={defaultImport:ff,bindings:[At],from:"axios"};var dS=o(e=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(e),"isValidPropertyName"),wt=o(e=>e.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"invalidVariableNameCharactersToCamel");function L(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"$ref")}o(L,"isReferenceObject");function re(e){return!L(e)}o(re,"isSchemaObject");function ma(e){return e.type==="array"}o(ma,"isArraySchemaObject");function mS(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(uN(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(L(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(mS,"inferRequiredSchema");var uN=o(e=>!L(e)&&!!e.required&&!e.type&&!e.properties&&!(e!=null&&e.allOf)&&!(e!=null&&e.anyOf)&&!e.oneOf,"isBrokenAllOfItem");var Zt=Symbol.for("@ts-pattern/matcher"),lN=Symbol.for("@ts-pattern/isVariadic"),ga="@ts-pattern/anonymous-select-key",df=o(e=>!!(e&&typeof e=="object"),"r"),ha=o(e=>e&&!!e[Zt],"i"),Rt=o((e,t,r)=>{if(ha(e)){let n=e[Zt](),{matched:i,selections:s}=n.match(t);return i&&s&&Object.keys(s).forEach(a=>r(a,s[a])),i}if(df(e)){if(!df(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];ha(c)&&c[lN]?s.push(c):s.length?i.push(c):n.push(c)}if(s.length){if(s.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<n.length+i.length)return!1;let a=t.slice(0,n.length),c=i.length===0?[]:t.slice(-i.length),u=t.slice(n.length,i.length===0?1/0:-i.length);return n.every((l,f)=>Rt(l,a[f],r))&&i.every((l,f)=>Rt(l,c[f],r))&&(s.length===0||Rt(s[0],u,r))}return e.length===t.length&&e.every((a,c)=>Rt(a,t[c],r))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in t||ha(s=i)&&s[Zt]().matcherType==="optional")&&Rt(i,t[n],r);var s})}return Object.is(t,e)},"s"),_r=o(e=>{var t,r,n;return df(e)?ha(e)?(t=(r=(n=e[Zt]()).getSelectionKeys)==null?void 0:r.call(n))!=null?t:[]:Array.isArray(e)?$o(e,_r):$o(Object.values(e),_r):[]},"o"),$o=o((e,t)=>e.reduce((r,n)=>r.concat(t(n)),[]),"c");function We(e){return Object.assign(e,{optional:o(()=>pN(e),"optional"),and:o(t=>K(e,t),"and"),or:o(t=>fN(e,t),"or"),select:o(t=>t===void 0?hS(e):hS(t,e),"select")})}o(We,"u");function pN(e){return We({[Zt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return t===void 0?(_r(e).forEach(i=>n(i,void 0)),{matched:!0,selections:r}):{matched:Rt(e,t,n),selections:r}},"match"),getSelectionKeys:o(()=>_r(e),"getSelectionKeys"),matcherType:"optional"})})}o(pN,"h");function K(...e){return We({[Zt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return{matched:e.every(i=>Rt(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>$o(e,_r),"getSelectionKeys"),matcherType:"and"})})}o(K,"m");function fN(...e){return We({[Zt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return $o(e,_r).forEach(i=>n(i,void 0)),{matched:e.some(i=>Rt(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>$o(e,_r),"getSelectionKeys"),matcherType:"or"})})}o(fN,"d");function F(e){return{[Zt]:()=>({match:o(t=>({matched:!!e(t)}),"match")})}}o(F,"p");function hS(...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 We({[Zt]:()=>({match:o(n=>{let i={[t??ga]:n};return{matched:r===void 0||Rt(r,n,(s,a)=>{i[s]=a}),selections:i}},"match"),getSelectionKeys:o(()=>[t??ga].concat(r===void 0?[]:_r(r)),"getSelectionKeys")})})}o(hS,"y");function It(e){return typeof e=="number"}o(It,"v");function yr(e){return typeof e=="string"}o(yr,"b");function vr(e){return typeof e=="bigint"}o(vr,"w");var o5=We(F(function(e){return!0}));var Sr=o(e=>Object.assign(We(e),{startsWith:o(t=>{return Sr(K(e,(r=t,F(n=>yr(n)&&n.startsWith(r)))));var r},"startsWith"),endsWith:o(t=>{return Sr(K(e,(r=t,F(n=>yr(n)&&n.endsWith(r)))));var r},"endsWith"),minLength:o(t=>Sr(K(e,(r=>F(n=>yr(n)&&n.length>=r))(t))),"minLength"),length:o(t=>Sr(K(e,(r=>F(n=>yr(n)&&n.length===r))(t))),"length"),maxLength:o(t=>Sr(K(e,(r=>F(n=>yr(n)&&n.length<=r))(t))),"maxLength"),includes:o(t=>{return Sr(K(e,(r=t,F(n=>yr(n)&&n.includes(r)))));var r},"includes"),regex:o(t=>{return Sr(K(e,(r=t,F(n=>yr(n)&&!!n.match(r)))));var r},"regex")}),"j"),s5=Sr(F(yr)),Tt=o(e=>Object.assign(We(e),{between:o((t,r)=>Tt(K(e,((n,i)=>F(s=>It(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>Tt(K(e,(r=>F(n=>It(n)&&n<r))(t))),"lt"),gt:o(t=>Tt(K(e,(r=>F(n=>It(n)&&n>r))(t))),"gt"),lte:o(t=>Tt(K(e,(r=>F(n=>It(n)&&n<=r))(t))),"lte"),gte:o(t=>Tt(K(e,(r=>F(n=>It(n)&&n>=r))(t))),"gte"),int:o(()=>Tt(K(e,F(t=>It(t)&&Number.isInteger(t)))),"int"),finite:o(()=>Tt(K(e,F(t=>It(t)&&Number.isFinite(t)))),"finite"),positive:o(()=>Tt(K(e,F(t=>It(t)&&t>0))),"positive"),negative:o(()=>Tt(K(e,F(t=>It(t)&&t<0))),"negative")}),"x"),a5=Tt(F(It)),br=o(e=>Object.assign(We(e),{between:o((t,r)=>br(K(e,((n,i)=>F(s=>vr(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>br(K(e,(r=>F(n=>vr(n)&&n<r))(t))),"lt"),gt:o(t=>br(K(e,(r=>F(n=>vr(n)&&n>r))(t))),"gt"),lte:o(t=>br(K(e,(r=>F(n=>vr(n)&&n<=r))(t))),"lte"),gte:o(t=>br(K(e,(r=>F(n=>vr(n)&&n>=r))(t))),"gte"),positive:o(()=>br(K(e,F(t=>vr(t)&&t>0))),"positive"),negative:o(()=>br(K(e,F(t=>vr(t)&&t<0))),"negative")}),"A"),c5=br(F(vr)),u5=We(F(function(e){return typeof e=="boolean"})),l5=We(F(function(e){return typeof e=="symbol"})),p5=We(F(function(e){return e==null})),f5=We(F(function(e){return e!=null}));var yf=class yf 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(yf,"W");var mf=yf,hf={matched:!1,value:void 0};function Ee(e){return new gf(e,hf)}o(Ee,"z");var Eo=class Eo{constructor(t,r){this.input=void 0,this.state=void 0,this.input=t,this.state=r}with(...t){if(this.state.matched)return this;let r=t[t.length-1],n=[t[0]],i;t.length===3&&typeof t[1]=="function"?i=t[1]:t.length>2&&n.push(...t.slice(1,t.length-1));let s=!1,a={},c=o((l,f)=>{s=!0,a[l]=f},"a"),u=!n.some(l=>Rt(l,this.input,c))||i&&!i(this.input)?hf:{matched:!0,value:r(s?ga in a?a[ga]:a:this.input,this.input)};return new Eo(this.input,u)}when(t,r){if(this.state.matched)return this;let n=!!t(this.input);return new Eo(this.input,n?{matched:!0,value:r(this.input,this.input)}:hf)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new mf(this.input)}run(){return this.exhaustive()}returnType(){return this}};o(Eo,"I");var gf=Eo;var vf=2,gS=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],yS=["query","header","path"],en=["get","put","post","delete","options","head","patch","trace"],vS=["string","number","integer","boolean"],ii=["allOf","anyOf","oneOf"];var B=o(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalize"),Pr=o(e=>e.charAt(0).toLowerCase()+e.slice(1),"decapitalize"),SS=o(e=>e.replace(/(-\w)/g,t=>t[1].toUpperCase()),"kebabToCamel"),le=o(e=>e.replace(/(_\w)/g,t=>t[1].toUpperCase()),"snakeToCamel"),bS=o(e=>e.replace(/[\W_]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"nonWordCharactersToCamel"),Sf=o((e,t="")=>e.endsWith(t)?e:`${e}${t}`,"suffixIfNeeded"),_S=o((e,t)=>e.replace(new RegExp(`${t}$`),""),"removeSuffix"),dN=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"),bf=o(e=>{let t=e.map(B).map(PS).map(r=>mN(r)).flat();return dN(t)},"getMostCommonAdjacentCombinationSplit"),PS=o(e=>e.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),ES=o(e=>PS(e).join(" "),"camelToSpaceSeparated"),mN=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"),$S=o((e,t)=>{let r=t.replace(/es$|s$/g,""),n=new RegExp(`(${Pr(r)}|${B(r)})[a-z]*(?=$|[A-Z])`,"g");return e.replace(n,"")},"removeWord");var xS=o(e=>`#/components/schemas/${e}`,"getSchemaRef"),tn=o(e=>e[1]==="/"?e:"#/"+e.slice(1),"autocorrectRef"),oi=o(e=>tn(e).split("/").at(-1),"getSchemaNameByRef");function Pf(e){let t=hN(e).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return le(t)}o(Pf,"normalizeString");function AS(e){return/^[a-zA-Z]\w*$/.test(e)?e:`"${e}"`}o(AS,"wrapWithQuotesIfNeeded");function wS(e){return typeof e=="string"&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}o(wS,"unwrapQuotesIfNeeded");function hN(e){let t=Number(e[0]);return typeof t=="number"&&!Number.isNaN(t)?"_"+e:e}o(hN,"prefixStringStartingWithNumberIfNeeded");function Ef(e){let t=e.replaceAll("_","#");return le(t.replaceAll("-","_")).replaceAll("#","_")}o(Ef,"pathParamToVariableName");var Ye=o(e=>vS.includes(e),"isPrimitiveType");function IS(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(IS,"escapeControlCharacters");function Je(e){return e.includes("application/")&&e.includes("json")||gS.includes(e)||e.includes("text/")}o(Je,"isParamMediaTypeAllowed");function Oo(e){return e>=200&&e<300}o(Oo,"isMainResponseStatus");function ya(e){return!(e>=200&&e<300)}o(ya,"isErrorStatus");function si(e){return e.startsWith("application/")}o(si,"isMediaTypeAllowed");var OS=/({\w+})/g,gN=/[^\w\-]+/g;function TS(e){e=B(SS(e.replaceAll("/","-")).replaceAll("-",""));let t=[...e.matchAll(OS)];if(t.length>0){let r=t.sort((n,i)=>n.index-i.index)[t.length-1][0];e=`${e.replace(OS,"")}By${B(r.slice(1,-1))}`}return e.replace(gN,"_")}o(TS,"pathToVariableName");var _f=/{(\b\w+(?:-\w+)*\b)}/g;function RS(e){let t=e.match(_f);return t===null?e.replaceAll(_f,":$1"):(t.forEach(r=>{let n=Ef(r.replaceAll(_f,":$1"));e=e.replaceAll(r,n)}),e)}o(RS,"replaceHyphenatedPath");var CS=o(e=>{let t=e["x-enumNames"],r=Array.isArray(t)&&t.length>0,n=!!e.schema&&re(e.schema)&&e.schema.type==="string";return r&&n},"isSortingParameterObject"),rn=o((e,t)=>t.excludePathRegex?new RegExp(t.excludePathRegex).test(e):!1,"isPathExcluded");function Ct(e){return bS(e)}o(Ct,"formatTag");function Er(e,t){var n;let r=(n=e.tags)==null?void 0:n[0];return Ct(r??t.defaultTag)}o(Er,"getOperationTag");function NS(e,t){return t.excludeTags.some(r=>r.toLowerCase()===e.toLowerCase())}o(NS,"isTagExcluded");var va={fileName:"acl/app.ability",extension:"ts"},xo="AllAbilities",Ao="AppAbilities",Sa={fileName:"acl/useAclCheck",extension:"ts"},$r="useAclCheck",$e={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subjectType:"Subject",subject:"subject"},$f={bindings:[$e.abilityTuple,$e.pureAbility,$e.forcedSubject,$e.subjectType,$e.subject],from:"@casl/ability"};var He=o((...e)=>[...new Set(e.flat())],"getUniqueArray");var kS=o(e=>`Use${B(le(e.operationName))}Ability`,"getAbilityTypeName"),wo=o(e=>`canUse${B(le(e.operationName))}`,"getAbilityFunctionName"),jS=o((e,t)=>`${t.tsNamespaces?`${U({type:"acl",tag:Or(e,t),options:t})}.`:""}${wo(e)}`,"getImportedAbilityFunctionName"),qS=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].action},"getAbilityAction"),MS=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].subject},"getAbilitySubject"),ba=o(e=>{var t;return!!((t=Io(e))!=null&&t.length)},"hasAbilityConditions"),Io=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].conditionsTypes},"getAbilityConditionsTypes"),DS=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].description},"getAbilityDescription"),_a=o(e=>`${B(e)}${xo}`,"getTagAllAbilitiesName");function me(e,t){if(!e)return;let{data:r,onSchema:n}=t;if(L(e)&&n({type:"reference",schema:e,data:r})===!0)return;let i=e;if(ii.some(s=>s in i&&i[s])){let s=i.allOf??i.anyOf??i.oneOf??[];for(let a of s)(n==null?void 0:n({type:"composite",parentSchema:e,schema:a,data:r}))!==!0&&me(a,{data:r,onSchema:n})}if(i.properties)for(let[s,a]of Object.entries(i.properties))n({type:"property",parentSchema:e,schema:a,data:r,propertyName:s})!==!0&&me(a,t);if(i.additionalProperties&&typeof i.additionalProperties=="object"){if(n({type:"additionalProperties",parentSchema:e,schema:i.additionalProperties,data:r})===!0)return;me(i.additionalProperties,t)}if(i.type==="array"){let s=e.items;if(n({type:"array",parentSchema:e,schema:s,data:r})===!0)return;me(s,t)}}o(me,"iterateSchema");var Nt=o((e,t)=>Sf(B(Pf(e)),t),"getZodSchemaName"),To=o((e,t,r)=>Sf(B(Pf(e)),`${t}${r}`),"getEnumZodSchemaName"),he=o(e=>["z.",`${ue.namespace}.`].every(t=>!e.startsWith(t)),"isNamedZodSchema"),LS=o(e=>e.startsWith(So),"isEnumZodSchema"),nn=o((e,t,r)=>t?e:`${r}_${e}`,"getZodSchemaOperationName"),Pa=o(e=>le(`${e}_${cS}`),"getBodyZodSchemaName"),FS=o((e,t)=>le(`${e}_${t}${uS}`),"getParamZodSchemaName"),yN=o(e=>le(`${e}${lS}`),"getMainResponseZodSchemaName"),vN=o((e,t)=>le(`${e}_${t}_${pS}`),"getErrorResponseZodSchemaName");function Ea({statusCode:e,operationName:t,isUniqueOperationName:r,tag:n}){let i=Number(e),s=nn(t,r,n);return!Oo(i)&&e!=="default"&&ya(i)?vN(s,e):yN(s)}o(Ea,"getResponseZodSchemaName");function Ro(e){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(n=>e[n]).reduce((n,i)=>[...n,`${B(ES(i))}: \`${e[i]}\``],[])}o(Ro,"getSchemaDescriptions");var Co=o((e,t)=>_S(e,t.schemaSuffix),"getZodSchemaInferedTypeName"),HS=o((e,t)=>he(t)?`${e.options.tsNamespaces?`${U({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${t}`:t,"getImportedZodSchemaName"),xr=o((e,t,r)=>{if(!he(t))return t===vo?"void":t;let n=e.getTagByZodSchemaName(t);return`${e.options.tsNamespaces&&n!==r?`${U({type:"models",tag:n,options:e.options})}.`:""}${Co(t,e.options)}`},"getImportedZodSchemaInferedTypeName");function VS(e){var t;return e.isEnum?"enum":((t=e.schemaObj)==null?void 0:t.type)??"object"}o(VS,"getZodSchemaType");function BS(e){if(e.schemaObj)return[e.schemaObj.description,...Ro(e.schemaObj).join(". ")].filter(Boolean)}o(BS,"getZodSchemaDescription");function US(e,t,r){var n;if(L(t)){let i=e.getZodSchemaNameByRef(t.$ref);return i?xr(e,i,r):void 0}if(ma(t)){if(!L(t.items))return`${((n=t.items)==null?void 0:n.type)??"unknown"}[]`;let i=e.getZodSchemaNameByRef(t.items.$ref);return i?`${xr(e,i,r)}[]`:void 0}if(ii.some(i=>i in t&&t[i])){let i=t.allOf??t.anyOf??t.oneOf??[];if(i.length>0)return US(e,i[0],r)}return t.type}o(US,"getType");function GS(e,t,r){if(!t.schemaObj)return[];let n="[0]",i="[key]",s={},a=o(c=>{var l;if(c.type==="reference")return!0;if(c.type==="composite")return;let u=[...((l=c.data)==null?void 0:l.pathSegments)??[]];if(c.type==="array"?u.push(n):c.type==="property"?u.push(c.propertyName):c.type==="additionalProperties"&&u.push(i),c.schema&&u[u.length-1]!==n){let f=e.resolveObject(c.schema),p=[f.description,...Ro(f)].filter(Boolean),d=u.join(".");s[d]&&"type"in c.schema&&c.schema.type==="object"||(delete s[d],s[d]={type:US(e,c.schema,r)??"unknown",description:p.join(". ")})}return me(c.schema,{data:{pathSegments:[...u]},onSchema:a}),!0},"onSchema");return"allOf"in t.schemaObj&&t.schemaObj.allOf&&t.schemaObj.allOf.forEach(c=>{if(L(c)){let u=e.resolveObject(c);me(u,{data:{pathSegments:[]},onSchema:a})}}),me(t.schemaObj,{data:{pathSegments:[]},onSchema:a}),s}o(GS,"getZodSchemaPropertyDescriptions");function Ar({resolver:e,tag:t,zodSchemas:r=[],zodSchemasAsTypes:n=[]}){let i="models",s=o(u=>e.getTagByZodSchemaName(u),"getTag"),a=$a({type:i,tag:t,entities:r,getTag:s,getEntityName:o(u=>u,"getEntityName"),options:e.options}),c=$a({type:i,tag:t,entities:n,getTag:s,getEntityName:o(u=>Co(u,e.options),"getEntityName"),options:e.options});return SN(e.options,a,c)}o(Ar,"getModelsImports");function ZS({tag:e,endpoints:t,options:r}){return $a({type:"endpoints",tag:e,entities:t,getTag:o(n=>Or(n,r),"getTag"),getEntityName:No,options:r})}o(ZS,"getEndpointsImports");function zS({tag:e,endpoints:t,options:r}){return $a({type:"acl",tag:e,entities:t,getTag:o(n=>Or(n,r),"getTag"),getEntityName:wo,options:r})}o(zS,"getAclImports");function KS({tags:e,entityName:t,getAliasEntityName:r,type:n,options:i}){let s=new Map;return e.forEach(a=>{let c=`${t}${r?` as ${r(a)}`:""}`;s.has(a)?i.tsNamespaces||s.get(a).bindings.push(c):s.set(a,{bindings:[i.tsNamespaces?U({type:n,tag:a,options:i}):c],from:`${kt(i)}${on({type:n,tag:a,includeTagDir:!0,options:i})}`})}),Array.from(s.values())}o(KS,"getEntityImports");function kt(e){let t=cf;return e.importPath==="relative"?t="../":e.importPath==="absolute"?t=e.output:new RegExp(`${af}`,"g").test(e.output)&&(t=e.output.replace(new RegExp(`.*${af}`,"g"),cf)),`${t}/`.replace(/\/\//g,"/")}o(kt,"getImportPath");function $a({type:e="models",tag:t,entities:r,getTag:n,getEntityName:i,options:s}){let a=new Map;return r.forEach(c=>{let u=n(c);if(a.has(u))s.tsNamespaces||a.get(u).bindings.push(i(c));else{let l=t===u;a.set(u,{bindings:[s.tsNamespaces?U({type:e,tag:u,options:s}):i(c)],from:`${l?"./":kt(s)}${on({type:e,tag:u,includeTagDir:!l,options:s})}`})}}),Array.from(a.values())}o($a,"getImports");function SN(e,...t){let r=new Map;return t.forEach(n=>{n.forEach(i=>{r.has(i.from)?e.tsNamespaces||r.get(i.from).bindings.push(...i.bindings):r.set(i.from,i)})}),Array.from(r.values()).map(n=>({...n,bindings:He(n.bindings)}))}o(SN,"mergeImports");function sn({fileName:e,extension:t}){return`${e}.${t}`}o(sn,"getFileNameWithExtension");function QS({type:e,tag:t,options:r,includeTagDir:n=!0}){let i=r.configs[e].outputFileNameSuffix;return t?`${n?`${Pr(t)}/`:""}${Pr(t)}.${i}`:i}o(QS,"getTagFileNameWithoutExtension");function on(...e){return QS(...e)}o(on,"getTagImportPath");function WS(...e){return`${QS(...e)}.ts`}o(WS,"getTagFileName");var U=o(({type:e,tag:t,options:r})=>`${B(t)}${r.configs[e].namespaceSuffix}`,"getNamespaceName");function YS(e){return e.standalone?`${kt(e)}${oa.fileName}`:e.restClientImportPath}o(YS,"getAppRestClientImportPath");function JS(e){return e.standalone?`${kt(e)}${ia.reactQueryTypes.fileName}`:e.queryTypesImportPath}o(JS,"getQueryTypesImportPath");function XS(e){return`${kt(e)}${sa.fileName}`}o(XS,"getQueryModulesImportPath");function eb(e){return`${kt(e)}${aa.fileName}`}o(eb,"getMutationEffectsImportPath");function tb(e){return`${kt(e)}${Sa.fileName}`}o(tb,"getAclCheckImportPath");function Oa(e){return`${kt(e)}${ca.fileName}`}o(Oa,"getZodUtilsImportPath");function rb(e){return`${kt(e)}${va.fileName}`}o(rb,"getAppAbilitiesImportPath");function xa(e){return Ee(e).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}o(xa,"primitiveTypeToTsType");function ai({zodSchemaName:e,schema:t,resolver:r}){let n="void",i;e&&he(e)?(n=xr(r,e),i=r.getTagByZodSchemaName(e)):t!=null&&t.type&&Ye(t==null?void 0:t.type)&&(n=xa(t==null?void 0:t.type));let s=n.split(".");return{type:s[s.length-1],...s.length>1?{namespace:s[0]}:{},...i?{importPath:on({type:"models",tag:i,includeTagDir:!0,options:r.options})}:{}}}o(ai,"getTsTypeBase");function an({schema:e,isCircular:t,parentTypes:r,resolver:n}){if(!e)return{metaType:"primitive"};for(let i of ii){let s=e[i];if(s)if(s.length>1){let a=s.map(c=>{let u=n.resolveObject(c);return an({schema:u,parentTypes:r,resolver:n})});return a.every(({metaType:c})=>c==="object")?{metaType:"object",objectProperties:a.reduce((c,{objectProperties:u})=>{let l=u.map(({name:f})=>f);return[...c.filter(({name:f})=>!l.includes(f)),...u]},[])}:{metaType:"composite",[i]:a}}else e=n.resolveObject(s[0])}return e.type==="array"?{metaType:"array",arrayType:nb({arraySchema:e,resolver:n,parentTypes:r})}:(e.type==="object"||e.properties)&&t?{metaType:"object",objectProperties:[],isCircular:!0}:e.type==="object"||e.properties?{metaType:"object",objectProperties:bN({schema:e,parentTypes:r,resolver:n})}:{metaType:"primitive"}}o(an,"getSchemaTsMetaType");function nb({arraySchema:e,parentTypes:t,resolver:r}){let n,i;if(L(e.items)){let u=e.items.$ref;n=r.getZodSchemaNameByRef(u),i=r.getSchemaByRef(u)}else i=e.items;let s=ai({zodSchemaName:n,schema:i,resolver:r}),a=ib(s,t),c=an({schema:i,isCircular:a,parentTypes:[...t,s],resolver:r});return{...s,...c}}o(nb,"getArraySchemaTsType");function bN({schema:e,parentTypes:t,resolver:r}){return Object.entries((e==null?void 0:e.properties)??{}).map(([n,i])=>{var a;let s=((a=e==null?void 0:e.required)==null?void 0:a.includes(n))??!1;if(L(i)){let c=r.getZodSchemaNameByRef(i.$ref),u=r.getSchemaByRef(i.$ref),l=ai({zodSchemaName:c,schema:u,resolver:r}),f=ib(l,t),p=an({schema:u,isCircular:f,parentTypes:[...t,l],resolver:r});return{name:n,isRequired:s,...l,...p}}else if(i.type==="array"){let c=nb({arraySchema:i,parentTypes:t,resolver:r});return{name:n,isRequired:s,type:"array",metaType:"array",arrayType:c}}else if(Ye(i.type))return{name:n,isRequired:s,type:xa(i.type),metaType:"primitive"};return{name:n,isRequired:s,type:"void",metaType:"primitive"}})}o(bN,"getSchemaTsProperties");function ib(e,t){return t.findIndex(({type:r,namespace:n})=>r===e.type&&n===e.namespace)>-1}o(ib,"getIsCircular");var No=o(e=>Pr(le(e.operationName)),"getEndpointName");function ob(e,t){return`${t.tsNamespaces?`${U({type:"endpoints",tag:Or(e,t),options:t})}.`:""}${No(e)}`}o(ob,"getImportedEndpointName");var sb=o(e=>e.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function Or(e,t){var n;let r=t.splitByTags?(n=e.tags)==null?void 0:n[0]:t.defaultTag;return Ct(r??t.defaultTag)}o(Or,"getEndpointTag");function wr(e,t,r){let n=t.parameters.map(i=>{var a,c,u,l;let s="string";if(he(i.zodSchema))s=xr(e,i.zodSchema);else if((a=i.parameterObject)!=null&&a.schema&&re(i.parameterObject.schema)){let f=(u=(c=i.parameterObject)==null?void 0:c.schema)==null?void 0:u.type;f&&Ye(f)&&(s=xa(f))}return{name:wt(i.name),type:s,paramType:i.type,required:((l=i.parameterObject)==null?void 0:l.required)??!0,parameterObject:i.parameterObject,bodyObject:i.bodyObject}});return r!=null&&r.includeFileParam&&t.mediaUpload&&n.push({name:"file",type:"File",paramType:"Body",required:!0,parameterObject:void 0,bodyObject:void 0}),n.sort((i,s)=>{if(i.required===s.required){let a=["Path","Body","Query","Header"];return a.indexOf(i.paramType)-a.indexOf(s.paramType)}return i.required?-1:1}).filter(i=>(!(r!=null&&r.excludeBodyParam)||i.name!==fa)&&(!(r!=null&&r.excludePageParam)||i.name!==_o.pageParamName)&&(!(r!=null&&r.includeOnlyRequiredParams)||i.required)).map(i=>({...i,name:r!=null&&r.replacePageParam&&i.name===_o.pageParamName?"pageParam":i.name}))}o(wr,"mapEndpointParamsToFunctionParams");function ab(e){let t=e.parameters.filter(i=>i.type==="Query").map(i=>{let s=dS(i.name)?i.name:`"${i.name}"`,a=wt(i.name);return{...i,name:s,value:a}}),r={};return e.requestFormat!==pf["Content-Type"]&&(r["Content-Type"]=`'${e.requestFormat}'`),e.responseFormat&&e.responseFormat!==pf.Accept&&(r.Accept=`'${e.responseFormat}'`),e.parameters.filter(i=>i.type==="Header").forEach(i=>{r[i.name]=wt(i.name)}),{...t.length>0?{params:t}:{},...Object.keys(r).length?{headers:r}:{}}}o(ab,"getEndpointConfig");function cb(e,t){return t.filter(r=>Ie(r)&&r.parameters.filter(n=>{var i;return(i=n.parameterObject)==null?void 0:i.required}).every(n=>e.parameters.some(i=>i.name===n.name))&&r.response===e.response)}o(cb,"getUpdateQueryEndpoints");var Ie=o(e=>e.method==="get","isQuery"),jt=o(e=>e.method!=="get"||!!e.mediaDownload,"isMutation"),ci=o((e,t)=>Ie(e)&&(t??Object.values(_o)).every(r=>e.parameters.some(n=>n.name===r&&n.type==="Query")),"isInfiniteQuery"),ub=o((e,t,r)=>{let n=r.reduce((i,s)=>[...i,...wr(e,s,{includeOnlyRequiredParams:!0}).map(a=>a.name)],[]);return wr(e,t,{includeOnlyRequiredParams:!0,excludeBodyParam:!0}).filter(i=>n.includes(i.name)).map(i=>i.name)},"getDestructuredVariables");var Aa=o((e,t)=>{let r=Ie(e)&&jt(e)&&t;return`use${B(le(e.operationName))}${r?"Mutation":""}`},"getQueryName"),lb=o(e=>`use${B(le(e.operationName))}Infinite`,"getInfiniteQueryName");var Of=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with"];function cn(e,t){let r={};return Object.keys(e).forEach(n=>{t.includes(n)&&(r[n]=e[n])}),r}o(cn,"pick");function ui(e,t){let r=e.deprecated&&!t.withDeprecatedEndpoints,n=Er(e,t),i=NS(n,t);return r||i}o(ui,"isOperationExcluded");function xf({path:e,method:t,operation:r,options:n,tag:i,keepOperationTag:s,keepOperationPrefix:a}){let c=`${t}${TS(e)}`,u=r.operationId?wt(r.operationId):c;if(n.removeOperationPrefixEndingWith&&a)u=u.split(n.removeOperationPrefixEndingWith).map((f,p)=>p===0?f:B(f)).join("");else if(n.removeOperationPrefixEndingWith&&!a){let l=new RegExp(`^.*${n.removeOperationPrefixEndingWith}`);u=u.replace(l,"")}if(n.tsNamespaces&&!s){let l=$S(u,i);l===""?u=t.toLowerCase():Of.includes(l)||(u=l)}return Of.includes(u)?c:u}o(xf,"getOperationName");function ko({operationsByTag:e,...t}){let{operation:r,options:n}=t,i=n.splitByTags?Er(r,n):n.defaultTag,s=o(a=>{let c=xf({...t,tag:i,keepOperationTag:a});if(e[i].filter(l=>xf({...t,operation:l,tag:i,keepOperationTag:a})===c).length===1)return c},"operationName");return s()??s(!0)??xf({...t,tag:i,keepOperationTag:!0,keepOperationPrefix:!0})}o(ko,"getUniqueOperationName");function pb(e,t,r){let n=[];for(let i in e.paths){if(rn(i,r))continue;let s=e.paths[i],a=cn(s,en);for(let c in a){let u=a[c];if(!u||ui(u,r))continue;let l=ko({path:i,method:c,operation:u,operationsByTag:t,options:r});n.push(l)}}return n}o(pb,"getUniqueOperationNamesWithoutSplitByTags");function fb(e,t){let r={};for(let n in e.paths){if(rn(n,t))continue;let i=e.paths[n],s=cn(i,en);for(let a in s){let c=s[a];if(!c||ui(c,t))continue;let u=t.splitByTags?Er(c,t):t.defaultTag;r[u]||(r[u]=[]),r[u].push(c)}}return r}o(fb,"getOperationsByTag");var db={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",300:"Ambiguous",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I Am a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",424:"Failed Dependency",428:"Precondition Required",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported"};function jo(e){return{type:"invalid-schema",message:e}}o(jo,"getInvalidSchemaError");function mb(e){return{type:"invalid-operation-id",message:`Operation ${e}`}}o(mb,"getInvalidOperationIdError");function hb(e,t){return{type:"missing-path-parameter",message:`Path ${t} is missing [${e.map(({name:r})=>r).join(", ")}]`}}o(hb,"getMissingPathParameterError");function gb(e){return{type:"not-allowed-inline-enum",message:`${e} is missing @IsEnum() and @ApiProperty(enum:, enumName:)`}}o(gb,"getNotAllowedInlineEnumError");function yb(e){return{type:"not-allowed-circular-schema",message:e}}o(yb,"getNotAllowedCircularSchemaError");function vb(e,t,r){return{type:"missing-acl-condition-property",message:`Condition property ${e} is not found in parameters or body in operation ${Ia(t,r)}`}}o(vb,"getMissingAclConditionPropertyError");function Af(e,t,r){return{type:"missing-status-code",message:`Missing HTTP status code ${wa(e)} in operation ${Ia(t,r)}`}}o(Af,"getMissingStatusCodeError");function Sb(e,t,r){return{type:"invalid-status-code",message:`Operation ${Ia(t,r)} expected HTTP status code ${wa(e.expected)} but received ${wa(e.received)}`}}o(Sb,"getInvalidStatusCodeError");function bb(e,t,r){return{type:"multiple-success-status-codes",message:`Operation ${Ia(t,r)} has multiple success HTTP status codes: ${e.map(wa).join(", ")}`}}o(bb,"getMultipleSuccessStatusCodesError");function Ia(e,t){return e.operationId??`${t.method} ${t.path}`}o(Ia,"getOperationDescriptor");function wa(e){return`${e} (${db[e]})`}o(wa,"getStatusCodeDescription");function qt({schema:e,meta:t,options:r}){let n=[];Ee(e.type).with("string",()=>n.push(EN(e))).with("number","integer",()=>n.push(ON(e))).with("array",()=>n.push(xN(e))).otherwise(()=>{}),typeof e.description=="string"&&e.description!==""&&r.withDescription&&([`
|
|
73
73
|
`,"\r",`\r
|
|
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(_N({schema:e,meta:t,options:r}),r.withDefaultValues!==!1?PN(e):[]).filter(Boolean).join(".");return i?`.${i}`:""}o(qt,"getZodChain");function _N({schema:e,meta:t,options:r}){return e.nullable&&!(t!=null&&t.isRequired)?"nullish()":e.nullable||r.replaceOptionalWithNullish&&(t!=null&&t.isParentPartial)?"nullable()":t!=null&&t.isRequired?"":r.replaceOptionalWithNullish?"nullish()":"optional()"}o(_N,"getZodChainablePresence");function PN(e){return e.default!==void 0?`default(${Ee(e.type).with("number","integer",()=>wS(e.default)).otherwise(()=>JSON.stringify(e.default))})`:""}o(PN,"getZodChainableDefault");function EN(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(${$N(e.pattern)})`),e.format){let r=Ee(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(EN,"getZodChainableStringValidations");function $N(e){return e.startsWith("/")&&e.endsWith("/")&&(e=e.slice(1,-1)),e=IS(e),`/${e}/`}o($N,"formatPatternIfNeeded");function ON(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(ON,"getZodChainableNumberValidations");function xN(e){let t=[];return e.minItems&&t.push(`min(${e.minItems})`),e.maxItems&&t.push(`max(${e.maxItems})`),t.join(".")}o(xN,"getZodChainableArrayValidations");var AN={type:"string",format:"date-time"},wN={type:"string",format:"email"},IN={type:"object",properties:{start:{type:"string",format:"date-time"},end:{type:"string",format:"date-time"}}},TN={type:"object",properties:{html:{type:"string"},json:{type:"object"}}},li=(i=>(i.datetime="datetime",i.email="email",i.dateRange="dateRange",i.textEditor="textEditor",i))(li||{}),Ta={datetime:AN,email:wN,dateRange:IN,textEditor:TN};function _b(){return Object.values(li).filter(e=>Ye(Ta[e].type))}o(_b,"getPrimitiveBrands");function Pb(){return Object.values(li).filter(e=>!Ye(Ta[e].type))}o(Pb,"getOtherBrands");function pi(e,t){let r=Ta[t];return!(e.type!==r.type||r.format&&e.format!==r.format||!Object.entries(r.properties??{}).every(([i,s])=>{var c;let a=(c=e.properties)==null?void 0:c[i];return a&&a.type===s.type&&a.format===s.format}))}o(pi,"matchesBrand");function wf(e,t,r){return r.branded?`${ue.namespace}.${ue.exports.brand}(${e}, "${t}")`:e}o(wf,"wrapWithBrand");var un=o(e=>e.reduce((t,r)=>t+r,0),"sum");function pe(e,t){if(!t)return e;if(L(t))return e+2;if(Array.isArray(t.type))return t.type.length===1?Ve("oneOf")+pe(e,{...t,type:t.type[0]}):e+Ve("oneOf")+un(t.type.map(r=>pe(0,{...t,type:r})));if(t.oneOf)return t.oneOf.length===1?Ve("oneOf")+pe(e,t.oneOf[0]):e+Ve("oneOf")+un(t.oneOf.map(r=>pe(0,r)));if(t.anyOf)return t.anyOf.length===1?Ve("anyOf")+pe(e,t.anyOf[0]):e+Ve("anyOf")+un(t.anyOf.map(r=>pe(0,r)));if(t.allOf)return t.allOf.length===1?Ve("allOf")+pe(e,t.allOf[0]):e+Ve("allOf")+un(t.allOf.map(r=>pe(0,r)));if(!t.type)return e;if(Ye(t.type))return t.enum?e+Eb(t)+Ve("enum")+un(t.enum.map(r=>pe(0,r))):e+Eb(t);if(t.type==="array")return t.items?Ve("array")+pe(e,t.items):Ve("array")+pe(e);if(t.type==="object"||t.properties||t.additionalProperties){if(t.properties){let r=Object.values(t.properties);e+=Ve("object")+un(r.map(n=>pe(0,n)))}else e+=Ve("empty-object");t.additionalProperties&&(typeof t.additionalProperties=="object"?e+=pe(0,t.additionalProperties):e+=pe(1))}return e}o(pe,"getOpenAPISchemaComplexity");function Eb(e){return Ee(e.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}o(Eb,"complexityByType");function Ve(e){return Ee(e).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}o(Ve,"complexityByComposite");var If=class If{constructor(t,r,n={referencedBy:[]},i){this.schema=t;this.resolver=r;L(t)&&(this.ref=t.$ref),i&&(this.enumRef=i),this.meta={...n,referencedBy:[...(n==null?void 0:n.referencedBy)??[]]},this.ref&&this.meta.referencedBy.push(this)}code;ref;enumRef;children=[];meta;getCodeString(t,r){var s,a;if(!this.ref&&this.code)return this.code;if(!this.ref)throw new Error("Zod schema is missing both ref and code");let n=(s=this.resolver)==null?void 0:s.getZodSchemaNameByRef(this.ref);if(!n)return this.ref;let i=(a=this.resolver)==null?void 0:a.getTagByZodSchemaName(n);return r!=null&&r.tsNamespaces&&i&&i!==t?`${U({type:"models",tag:i,options:r})}.${n}`:n}get complexity(){return pe(0,this.schema)}assign(t){return this.code=t,this}inherit(t){return t&&t.children.push(this),this}};o(If,"ZodSchema");var qo=If;function Y({schema:e,resolver:t,meta:r,tag:n}){var g;let i=new qo(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(L(e))return RN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});let c=NN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(c)return c;let u=CN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(u)return u;let l=kN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(l)return l;let f=jN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(f)return f;let p=qN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(p)return p;let d=t.options.allReadonly?".readonly()":"";if(ma(e))return e.items?i.assign(`z.array(${Y({...a,schema:e.items}).getCodeString(n,t.options)}${qt({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=e.required&&e.required.length>0,v=t.options.withImplicitRequiredProps?!1:e.properties&&!((g=e.required)!=null&&g.length),S="{}";e.properties&&(S="{ "+Object.entries(e.properties).map(([k,X])=>{var ae;let se={...s,isRequired:v?!0:y?(ae=e.required)==null?void 0:ae.includes(k):t.options.withImplicitRequiredProps,name:k,isParentPartial:v},D=X;if(L(X)&&t&&(D=t.getSchemaByRef(X.$ref),!D))throw new Error(`Schema ${X.$ref} not found`);let Q=Y({...a,schema:X,meta:se}).getCodeString(n,t.options)+qt({schema:D,meta:se,options:t.options});return re(X)&&_b().forEach(Ft=>{pi(X,Ft)&&(Q=wf(Q,Ft,t.options))}),[k,Q]}).map(([k,X])=>`${AS(k)}: ${X}`).join(", ")+" }");let b="";e.additionalProperties&&(b=`.catchall(${typeof e.additionalProperties=="object"&&Object.keys(e.additionalProperties).length>0?Y({...a,schema:e.additionalProperties}).getCodeString(n,t.options)+qt({schema:e.additionalProperties,meta:{...s,isRequired:!0},options:t.options}):"z.any()"})`);let P=v?".partial()":"",E=t.options.strictObjects?".strict()":"",_=`z.object(${S})${P}${E}${b}${d}`;return Pb().forEach(T=>{pi(e,T)&&(_=wf(_,T,t.options))}),i.assign(_)}if(m==="any")return i.assign("z.any()");if(!m)return i.assign("z.unknown()");throw new Error(`Unsupported schema type: ${m}`)}o(Y,"getZodSchema");function RN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!L(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=Y({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)}return r.getCodeByZodSchemaName(a)||r.setZodSchema(a,c,i),t}o(RN,"getReferenceZodSchema");function CN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){var a;if(!re(e)||!e.oneOf)return;if(e.oneOf.length===1){let c=Y({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=>re(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=>Y({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])
|
|
76
76
|
`)}return t.assign(`z.union([${e.oneOf.map(c=>Y({schema:c,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])`)}o(CN,"getOneOfZodSchema");function NN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!(!re(e)||!Array.isArray(e.type)))return e.type.length===1?Y({schema:{...e,type:e.type[0]},resolver:r,meta:n,tag:i}):t.assign(`z.union([${e.type.map(s=>Y({schema:{...e,type:s},resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])`)}o(NN,"getArrayZodSchema");function kN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!re(e)||!e.anyOf)return;if(e.anyOf.length===1){let a=Y({schema:e.anyOf[0],resolver:r,meta:n,tag:i});return t.assign(a.getCodeString(i,r.options))}let s=e.anyOf.map(a=>Y({schema:a,resolver:r,meta:n,tag:i})).map(a=>a.getCodeString(i,r.options)).join(", ");return t.assign(`z.union([${s}])`)}o(kN,"getAnyOfZodSchema");function jN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!re(e)||!e.allOf)return;if(e.allOf.length===1){let p=Y({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}=mS(e),u=a.map(p=>{let d=Y({schema:p,resolver:r,meta:n,tag:i});return r&&s(p,r.getSchemaByRef.bind(r)),d});c.required.length&&u.push(Y({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(jN,"getAllOfZodSchema");function qN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!re(e))return;let s=e.type?e.type.toLowerCase():void 0;if(s&&Ye(s)){if(e.enum){if(s==="string")return MN({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(Ee(s).with("integer",()=>"z.number()").with("string",()=>Ee(e.format).with("binary",()=>ua).otherwise(()=>la)).otherwise(a=>`z.${a}()`))}}o(qN,"getPrimitiveZodSchema");function MN({resolver:e,schema:t,zodSchema:r,meta:n,tag:i}){var l;if(!re(t))return;let s=fi(t);if(!e.options.extractEnums)return r.assign(s);let a=e.getEnumZodSchemaDataByCode(s);if(a)return((l=r.meta.parent)==null?void 0:l.ref)===e.getRefByZodSchemaName(a.zodSchemaName)?r.assign(a.code):new qo({$ref:e.getRefByZodSchemaName(a.zodSchemaName)},e,n).inherit(r).assign(s);let c=e.getExtractedEnumZodSchemaDataByCode(s);if(!c)return r.assign(s);if(!c.zodSchemaName||!c.tag)throw new Error(`Enum zod schema name or tag not resolved for code: ${s}`);let u=e.options.tsNamespaces&&c.tag!==i?`${U({type:"models",tag:c.tag,options:e.options})}.`:"";return r.assign(`${u}${c.zodSchemaName}`)}o(MN,"getEnumZodSchema");function fi(e){var t;return`${So}([${(t=e.enum)==null?void 0:t.map(r=>r===null?"null":`"${r}"`).join(", ")}])`}o(fi,"getEnumZodSchemaCode");function $b(e){return`${So}([${e.map(t=>`"${t}"`).join(", ")}])`}o($b,"getEnumZodSchemaCodeFromEnumNames");function di({schema:e,zodSchema:t,fallbackName:r,resolver:n,tag:i}){var c;let s=t.getCodeString();if((!he(s)||t.ref===void 0)&&r){if(t.complexity<vf)return s;let u=Nt(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 pe(0,n.getSchemaByRef(t.ref))<vf?n.getCodeByZodSchemaName(s):s;if(t.ref)return n.getZodSchemaNameByRef(t.ref);throw new Error(`Invalid ref: ${t.ref}`)}o(di,"resolveZodSchemaName");function Ob({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=DN({resolver:e,endpoint:t,acl:n,name:c});return u?[...a,u]:(e.validationErrors.push(vb(c,r,t)),a)},[]);return{...i,conditionsTypes:s}})}o(Ob,"getEndpointAcl");function DN({resolver:e,endpoint:t,acl:r,name:n}){var p,d,m,g,y,v,S,b,P,E;let i=(d=(p=r[0])==null?void 0:p.conditions)==null?void 0:d[n];if(!i)return;let s=i.replace(/^\$[^.]*\./,"").split("."),a,c,u,l=0,f=t.parameters.find(({name:_})=>_===s[l]);if(f)c=(m=f.parameterObject)==null?void 0:m.required,a=(g=f.parameterObject)==null?void 0:g.schema,u=`${f.name} ${Pr(f.type)} parameter`,l++;else{let _=t.parameters.find(({bodyObject:X})=>!!X),k=Object.keys(((y=_==null?void 0:_.bodyObject)==null?void 0:y.content)??{}).find(Je);k&&(a=(b=(S=(v=_==null?void 0:_.bodyObject)==null?void 0:v.content)==null?void 0:S[k])==null?void 0:b.schema,u=`${Ie(t)?"query":"mutation"} data`)}for(;a&&l<s.length;){let _=e.resolveObject(a);a=(P=Object.entries(_.properties??{}).find(([k])=>k===s[l]))==null?void 0:P[1],c=((E=_.required)==null?void 0:E.includes(s[l]))??!1,l++}if(a)return{name:n,type:L(a)?void 0:a.type,zodSchemaName:L(a)?e.getZodSchemaNameByRef(a.$ref):void 0,required:c,info:u}}o(DN,"getEndpointAclConditionPropertyType");function xb({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(Je);if(!c)return;let u=(g=(m=s.content)==null?void 0:m[c])==null?void 0:g.schema;if(!u)return;let l=Y({schema:u,resolver:e,meta:{isRequired:s.required??!0},tag:i}),f=e.resolveObject(u),p=di({schema:f,zodSchema:l,fallbackName:Pa(nn(r,n,i)),resolver:e,tag:i}),d=qt({schema:f,meta:l.meta,options:e.options});return{endpointParameter:{name:fa,type:"Body",description:s.description,zodSchema:p+d,bodyObject:s},requestFormat:c}}o(xb,"getEndpointBody");function Ab({resolver:e,param:t,operationName:r,isUniqueOperationName:n,tag:i}){let s=e.resolveObject(t);if(!yS.includes(s.in))return;let a={};if(s.content){let m=Object.keys(s.content??{}),g=m.find(Je);if(!g)throw new Error(`Unsupported media type for param ${s.name}: ${m.join(", ")}`);let y=s.content[g];if(!y)throw new Error(`No content with media type for param ${s.name}: ${g}`);a=(y==null?void 0:y.schema)??y}else s.schema&&(a=s.schema);e.options.withDescription&&a&&(a.description=(s.description??"").trim());let c=FS(nn(r,n,i),s.name),u;if(CS(s)){let m=To(c,e.options.enumSuffix,e.options.schemaSuffix),g=$b(s["x-enumNames"]);e.setZodSchema(m,g,i),u=m}let l=Y({schema:a,resolver:e,meta:{isRequired:s.in==="path"?!0:s.required??!1},tag:i}),f=e.resolveObject(a),p=qt({schema:f,meta:l.meta,options:e.options}),d=di({schema:f,zodSchema:l.assign(l.getCodeString(i)+p),fallbackName:c,resolver:e,tag:i});return{name:Ee(s.in).with("path",()=>Ef(s.name)).otherwise(()=>s.name),type:Ee(s.in).with("header",()=>"Header").with("query",()=>"Query").with("path",()=>"Path").run(),zodSchema:d,parameterObject:s,parameterSortingEnumSchemaName:u}}o(Ab,"getEndpointParameter");function Ib(e){var r,n,i,s,a;let t=[];for(let c in e.openApiDoc.paths){if(rn(c,e.options))continue;let u=e.openApiDoc.paths[c],l=cn(u,en),f=wb(u.parameters??[]);for(let p in l){let d=l[p];if(!d||ui(d,e.options))continue;let m=d.operationId&&d.operationId!==wt(d.operationId);d.operationId&&m&&e.validationErrors.push(mb(d.operationId));let g=Object.entries({...f,...wb(d.parameters??[])}).map(([,_])=>_),y=ko({path:c,method:p,operation:d,operationsByTag:e.operationsByTag,options:e.options}),v=e.operationNames.filter(_=>_===y).length<=1,S=Er(d,e.options),b={method:p,path:RS(c),operationName:y,description:d.description,summary:d.summary,tags:(r=d.tags)==null?void 0:r.map(Ct),requestFormat:"application/json",parameters:[],response:"",errors:[],responseStatusCodes:[],mediaUpload:!!d["x-media-upload"],mediaDownload:!!d["x-media-download"]};if(d.requestBody){let _=xb({resolver:e,operation:d,operationName:y,isUniqueOperationName:v,tag:S});_&&(b.parameters.push(_.endpointParameter),b.requestFormat=_.requestFormat)}for(let _ of g){let T=Ab({resolver:e,param:_,operationName:y,isUniqueOperationName:v,tag:S});T&&b.parameters.push(T)}let P=LN(b);P.forEach(_=>{b.parameters.push(_)}),P.length>0&&e.validationErrors.push(hb(P,c));for(let _ in d.responses){b.responseStatusCodes.push(_);let T=e.resolveObject(d.responses[_]),X=Object.keys(T.content??{}).find(si),se,D;if(X?(b.responseFormat=X,se=(i=(n=T.content)==null?void 0:n[X])==null?void 0:i.schema):(D=vo,_==="200"&&e.validationErrors.push(Sb({received:"200",expected:"204"},d,b))),se){let Q=Y({schema:se,resolver:e,meta:{isRequired:!0},tag:S}),ae=e.resolveObject(se);D=di({schema:ae,zodSchema:Q,fallbackName:Q.ref?void 0:Ea({statusCode:_,operationName:y,isUniqueOperationName:v,tag:S}),resolver:e,tag:S})+qt({schema:ae,meta:Q.meta,options:e.options})}if(D){let Q=Number(_);Oo(Q)&&!b.response?(b.response=D,b.responseObject=T,b.responseDescription=T.description):_!=="default"&&ya(Q)&&b.errors.push({zodSchema:D,status:Q,description:T.description})}}b.response||(b.response=vo);let E=Object.keys(d.responses).map(Number).filter(Oo);E.length>1&&e.validationErrors.push(bb(E.map(String),d,b)),b.acl=Ob({resolver:e,endpoint:b,operation:d}),(s=d.security)!=null&&s[0].Authorization&&!b.responseStatusCodes.includes("401")&&e.validationErrors.push(Af("401",d,b)),(a=b.acl)!=null&&a[0]&&!b.responseStatusCodes.includes("403")&&e.validationErrors.push(Af("403",d,b)),t.push(b)}}return t}o(Ib,"getEndpointsFromOpenAPIDoc");function wb(e){return Object.fromEntries((e??[]).map(t=>[L(t)?t.$ref:t.name,t]))}o(wb,"getParameters");function LN(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=>FN(r))}o(LN,"getMissingPathParameters");function FN(e){return{name:e,type:"Path",zodSchema:la,parameterObject:{name:e,required:!0,in:"path",schema:{type:"string"}}}}o(FN,"getPathParameterFromName");function Tb(e,t){let r=HN(e,t),n=VN(e,r);return{refsDependencyGraph:r,deepDependencyGraph:n}}o(Tb,"getOpenAPISchemaDependencyGraph");function HN(e,t){let r={},n={};return e.forEach(i=>BN({schema:t(i),fromRef:i,getSchemaByRef:t,visitedRefs:r,refsDependencyGraph:n})),n}o(HN,"getRefsDependencyGraph");function VN(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(VN,"getDeepRefsDependencyGraph");function BN({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,me(r(c.$ref),{data:{fromRef:c.$ref},onSchema:s})},"onSchema");return me(e,{data:{fromRef:t},onSchema:s}),{visitedRefs:n,refsDependencyGraph:i}}o(BN,"getSchemaRefsDependencyGraph");function Ra(e,t,r){let n=[];return me(t,{onSchema:o(s=>{s.type==="reference"?n.push(s.schema):L(s.parentSchema)&&(s.type==="property"?e.validationErrors.push(jo(`${r} has both reference and properties`)):s.type==="additionalProperties"?e.validationErrors.push(jo(`${r} has both reference and additionalProperties`)):s.type==="array"?e.validationErrors.push(jo(`${r} is both reference and array schema`)):s.type==="composite"&&e.validationErrors.push(jo(`${r} has both reference and composite keyword`)))},"onSchema")}),n}o(Ra,"getSchemaRefObjs");function Rb(e,t){return t.map(i=>tn(i.$ref)).reduce((i,s)=>{let a=e.dependencyGraph.deepDependencyGraph[s];return[...i,s,...Array.from(a??[])]},[])}o(Rb,"getDeepSchemaRefObjs");function Cb(e){e.extractedEnumZodSchemaData.forEach(r=>{let n=r.meta.zodSchemaNameSegments.map(s=>s[s.length-1]).filter(Boolean),i=bf(n);if(!i)throw new Error(`No common last segment found for enum: ${r.code}`);r.zodSchemaName=To(i,e.options.enumSuffix,e.options.schemaSuffix)});let t=0;for(;t<5&&!Tf(e);)UN(e,t+2),t++;if(Tf(e)||e.extractedEnumZodSchemaData.filter(n=>!Nb(e,n)).forEach(n=>{n.zodSchemaName=To(n.meta.zodSchemaNameSegments[0].map(i=>Rf(B(i))).join(""),e.options.enumSuffix,e.options.schemaSuffix)}),!Tf(e))throw new Error("Failed to resolve unique names for enum zod schemas")}o(Cb,"resolveExtractedEnumZodSchemaNames");function Tf(e){return e.extractedEnumZodSchemaData.every(t=>Nb(e,t))}o(Tf,"allExtractedEnumZodSchemaNamesAreUnique");function UN(e,t){e.extractedEnumZodSchemaData.forEach(r=>{let n=e.extractedEnumZodSchemaData.filter(({zodSchemaName:i})=>r.zodSchemaName===i);n.length!==1&&GN(n,t)})}o(UN,"additionalResolveExtractedEnumZodSchemaName");function GN(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=[Rf(B(n[0])),r.zodSchemaName].filter(Boolean).join("");r.zodSchemaName=i}else{let i=bf(n),s=[i?Rf(B(i)):"",r.zodSchemaName].filter(Boolean).join("");r.zodSchemaName=s}})}o(GN,"suffixWithPreviousSegmentName");function Nb(e,t){return e.extractedEnumZodSchemaData.filter(({zodSchemaName:r})=>t.zodSchemaName===r).length===1}o(Nb,"isUnique");function Rf(e){return e.replace(/(Dto|DTO|Response|Request)/g,"")}o(Rf,"sanitizeName");function kb(e){e.extractedEnumZodSchemaData.forEach(t=>{let r=He(t.meta.tags);t.tag=r.length===1?r[0]:e.options.defaultTag})}o(kb,"resolveExtractedEnumZodSchemaTags");function Mo({schema:e,nameSegments:t=[],includeSelf:r,...n}){r&&jb({schema:e,nameSegments:t,...n}),me(e,{data:{nameSegments:t},onSchema:o(s=>{var c;if(s.type==="reference")return!0;let a=[...((c=s.data)==null?void 0:c.nameSegments)??[]];s.type==="property"&&a.push(s.propertyName),jb({schema:s.schema,nameSegments:[...a],...n})},"onSchema")})}o(Mo,"updateExtractedEnumZodSchemaData");function jb({resolver:e,schema:t,schemaRef:r,schemaInfo:n,tags:i,nameSegments:s=[]}){if(!t||L(t)||!t.enum)return;let a=fi(t),c=e.extractedEnumZodSchemaData.find(u=>u.code===a);c?(c.meta.zodSchemaNameSegments.push(s),c.meta.tags.push(...i),c.meta.schemaRefs.push(...r?[r]:[]),c.meta.schemas.push(...t?[t]:[])):e.extractedEnumZodSchemaData.push({code:a,meta:{zodSchemaNameSegments:[s],tags:[...i],schemaRefs:r?[r]:[],schemas:t?[t]:[]}}),e.validationErrors.push(gb(r?`${oi(r)}.${s[s.length-1]}`:n??s.join(".")))}o(jb,"handleExtractedEnumZodSchemaDataUpdate");function qb(e){var n;let t={},r={};return Object.entries(((n=e.openApiDoc.components)==null?void 0:n.schemas)??{}).forEach(([i,s])=>{let a=e.getSchemaDataByName(i);if(e.options.excludeRedundantZodSchemas&&(!a||a.deepRefOperations.length===0&&a.tags.length===0))return;let c=Nt(i,e.options.schemaSuffix);if(t[c])return;let u=e.getTagByZodSchemaName(c),l=e.resolveObject(s);l.enum?r[c]=fi(l):t[c]=Y({schema:s,resolver:e,tag:u}).getCodeString(u)}),{zodSchemas:t,enumZodSchemas:r}}o(qb,"getZodSchemasFromOpenAPIDoc");function Mb(e){var r;let t=[];return Object.entries(((r=e.openApiDoc.components)==null?void 0:r.schemas)??{}).forEach(([n,i])=>{let s=Nt(n,e.options.schemaSuffix),a=e.resolveObject(i);!t.find(c=>c.zodSchemaName===s)&&a.enum&&t.push({zodSchemaName:s,code:fi(a)})}),t}o(Mb,"getEnumZodSchemasFromOpenAPIDoc");var Cf=class Cf{constructor(t,r){this.openApiDoc=t;this.options=r;this.dependencyGraph=Tb(this.schemaRefs,this.getSchemaByRef.bind(this)),this.enumZodSchemas=Mb(this),this.operationsByTag=fb(t,r),this.operationNames=pb(t,this.operationsByTag,r),this.initialize()}schemaData=[];zodSchemaData=[];compositeZodSchemaData=[];dependencyGraph;enumZodSchemas=[];extractedEnumZodSchemaData=[];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(xS)}getSchemaByRef(t){return this.docSchemas[oi(t)]}getSchemaDataByName(t){return this.schemaData.find(r=>r.name===t)}getZodSchemaNameByRef(t){var n,i;let r=((n=this.getSchemaDataByRef(tn(t)))==null?void 0:n.zodSchemaName)??((i=this.extractedEnumZodSchemaData.find(s=>s.zodSchemaName===t))==null?void 0:i.zodSchemaName);if(!r)throw new Error(`Zod schema not found for ref: ${t}`);return r}getRefByZodSchemaName(t){var r;return(r=this.schemaData.find(n=>n.zodSchemaName===t))==null?void 0:r.ref}getTagByZodSchemaName(t){var u,l;if(!this.options.splitByTags)return this.options.defaultTag;let r=this.extractedEnumZodSchemaData.find(f=>f.zodSchemaName===t);if(r)return Ct(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=He(i,s),c=a.length===1?a[0]:this.options.defaultTag;return Ct(c??this.options.defaultTag)}getCodeByZodSchemaName(t){var r;return(r=this.zodSchemaData.find(n=>n.zodSchemaName===t))==null?void 0:r.code}getZodSchemaNamesByCompositeCode(t){var r;return(r=this.compositeZodSchemaData.find(n=>n.code===t))==null?void 0:r.zodSchemas.map(n=>n.zodSchemaName)}setZodSchema(t,r,n){let i=this.zodSchemaData.find(s=>s.zodSchemaName===t);i?(i.code=r,i.tags=(i.tags??[]).concat(n)):this.zodSchemaData.push({zodSchemaName:t,code:r,tags:[n]})}addZodSchemaForCompositeCode(t,r,n,i){let s={zodSchemaName:n,zodSchema:r,schema:i},a=this.compositeZodSchemaData.find(c=>c.code===t);a?a.zodSchemas.push(s):this.compositeZodSchemaData.push({code:t,zodSchemas:[s]})}getCompositeZodSchemaByZodSchemaName(t){var n;let r=this.compositeZodSchemaData.find(i=>i.zodSchemas.some(s=>s.zodSchemaName===t));return(n=r==null?void 0:r.zodSchemas.find(i=>i.zodSchemaName===t))==null?void 0:n.zodSchema}getSchemaByCompositeZodSchemaName(t){var r,n;return(n=(r=this.compositeZodSchemaData.find(i=>i.zodSchemas.some(s=>s.zodSchemaName===t)))==null?void 0:r.zodSchemas.find(i=>i.zodSchemaName===t))==null?void 0:n.schema}getEnumZodSchemaDataByCode(t){return this.enumZodSchemas.find(r=>r.code===t)}getExtractedEnumZodSchemaDataByCode(t){return this.extractedEnumZodSchemaData.find(r=>r.code===t)}getExtractedEnumZodSchemaNamesReferencedBySchemaRef(t){return this.extractedEnumZodSchemaData.reduce((r,{zodSchemaName:n,meta:i})=>(n&&i.schemaRefs.includes(t)&&r.push(n),r),[])}getZodSchemas(){return this.zodSchemaData.reduce((t,{zodSchemaName:r,code:n})=>({...t,[r]:n}),{})}getExtractedEnumZodSchemas(){return this.extractedEnumZodSchemaData.reduce((t,{zodSchemaName:r,code:n})=>r?{...t,[r]:n}:t,{})}resolveObject(t){return L(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=[],i=[]){var s,a;return i.includes(r)?[]:(i.push(r),(s=this.dependencyGraph.refsDependencyGraph[r])!=null&&s.has(t)?[...n,r,t]:Array.from(((a=this.dependencyGraph.refsDependencyGraph[r])==null?void 0:a.values())??[]).map(c=>{let u=this.getCircularSchemaChain(t,c,n,i);return u.length>0?[r,...u]:u}).flat())}getBaseUrl(){var r,n;let t=(n=(r=this.openApiDoc.servers)==null?void 0:r[0])==null?void 0:n.url;return this.options.baseUrl===""&&t?t:this.options.baseUrl}getZodSchemaObj(t){let r=this.getRefByZodSchemaName(t);if(r)return this.getSchemaByRef(r);let n=this.getSchemaByCompositeZodSchemaName(t);if(n)return n;let i=this.getExtractedEnumZodSchemaDataByName(t);if(i)return i.meta.schemas.reduce((s,a)=>({...s,...this.resolveObject(a)}),{})}getSchemaDataByRef(t){return this.schemaData.find(r=>r.ref===t)}getExtractedEnumZodSchemaDataByName(t){return this.extractedEnumZodSchemaData.find(({zodSchemaName:r})=>r===t)}initialize(){var t,r,n,i,s;this.schemaRefs.forEach(a=>{let c=tn(a),u=oi(c),l=Nt(u,this.options.schemaSuffix);this.schemaData.push({ref:c,name:u,zodSchemaName:l,tags:[],deepRefOperations:[]})});for(let a in this.openApiDoc.paths){if(rn(a,this.options))continue;let c=this.openApiDoc.paths[a],u=cn(c,en);for(let l in u){let f=u[l];if(!f||ui(f,this.options))continue;let p=Er(f,this.options),d=ko({path:a,method:l,operation:f,operationsByTag:this.operationsByTag,options:this.options}),m=this.operationNames.filter(S=>S===d).length<=1,g=le(nn(d,m,p)),y=[];if((t=f.parameters)==null||t.map(S=>{let b=S,P=b.schema,E=`Operation ${f.operationId??a} parameter ${b.name}`;y.push(...Ra(this,P,E)),this.options.extractEnums&&Mo({resolver:this,schema:P,schemaInfo:E,tags:[p],nameSegments:[g,b.name],includeSelf:!0})}),f.requestBody){let S=this.resolveObject(f.requestBody),P=Object.keys(S.content??{}).find(Je);if(P){let E=(n=(r=S.content)==null?void 0:r[P])==null?void 0:n.schema,_=`Operation ${f.operationId} request body`;y.push(...Ra(this,E,_)),this.options.extractEnums&&Mo({resolver:this,schema:E,schemaInfo:_,tags:[p],nameSegments:[Pa(g)]})}}for(let S in f.responses){let b=this.resolveObject(f.responses[S]),E=Object.keys(b.content??{}).find(si);if(E){let _=(s=(i=b.content)==null?void 0:i[E])==null?void 0:s.schema,T=`Operation ${f.operationId} response body`;y.push(...Ra(this,_,T)),this.options.extractEnums&&Mo({resolver:this,schema:_,schemaInfo:T,tags:[p],nameSegments:[Ea({statusCode:S,operationName:d,isUniqueOperationName:m,tag:p})]})}}Rb(this,y).forEach(S=>{let b=this.getSchemaDataByRef(S);b&&(b.tags.push(p),b.deepRefOperations.push(f))})}}this.options.extractEnums&&(this.schemaRefs.forEach(a=>{var u;let c=tn(a);Mo({resolver:this,schema:this.getSchemaByRef(c),schemaRef:c,tags:((u=this.getSchemaDataByRef(c))==null?void 0:u.tags)??[],nameSegments:[oi(c)]})}),kb(this),this.handleDuplicateEnumZodSchemas(),Cb(this))}handleDuplicateEnumZodSchemas(){let t=this.enumZodSchemas.map(({code:n})=>n),r=this.enumZodSchemas.filter(({code:n})=>t.includes(n));this.schemaData.forEach(n=>{var a,c;let i=(a=r.find(({zodSchemaName:u})=>u===n.zodSchemaName))==null?void 0:a.code;if(!i)return;let s=this.extractedEnumZodSchemaData.find(({code:u})=>u===i);!s||((c=this.getEnumZodSchemaDataByCode(s.code))==null?void 0:c.zodSchemaName)!==n.zodSchemaName||(n.tags.push(...s.meta.tags??[]),s.meta.schemaRefs.forEach(u=>{this.dependencyGraph.refsDependencyGraph[u]||(this.dependencyGraph.refsDependencyGraph[u]=new Set),this.dependencyGraph.refsDependencyGraph[u].add(n.ref),this.dependencyGraph.deepDependencyGraph[u]||(this.dependencyGraph.deepDependencyGraph[u]=new Set),this.dependencyGraph.deepDependencyGraph[u].add(n.ref)}))}),this.extractedEnumZodSchemaData.splice(0,this.extractedEnumZodSchemaData.length,...this.extractedEnumZodSchemaData.filter(({code:n})=>!t.includes(n)))}};o(Cf,"SchemaResolver");var Ca=Cf;function Db(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(Db,"topologicalSort");function Lb(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(Lb,"sortObjKeysFromArray");function Fb(e,t){let r=Db(e.dependencyGraph.deepDependencyGraph).map(i=>e.getZodSchemaNameByRef(i));return Lb(t,r)}o(Fb,"sortZodSchemasByTopology");function Hb(e,t){let r={};return Object.entries(t).forEach(([n,i])=>{let s=e.getRefByZodSchemaName(n);s&&e.isSchemaCircular(s)?(e.validationErrors.push(yb(e.getCircularSchemaChain(s).join(" -> "))),r[Nt(n,e.options.schemaSuffix)]=`z.lazy(() => ${i})`):r[Nt(n,e.options.schemaSuffix)]=i}),r}o(Hb,"wrapCircularZodSchemas");function Na(e,t){let r=new Ca(e,t),n=Ib(r),i=qb(r),s={...i.zodSchemas,...r.getZodSchemas(),...i.enumZodSchemas};return s=Hb(r,s),s=Fb(r,s),s={...r.getExtractedEnumZodSchemas(),...s},{resolver:r,data:ZN({resolver:r,endpoints:n,zodSchemas:s,options:t})}}o(Na,"getDataFromOpenAPIDoc");function ZN({resolver:e,endpoints:t,zodSchemas:r,options:n}){let i=new Map;return n.splitByTags?(t.forEach(s=>{let a=Or(s,n);Vb(a,i).endpoints.push(s)}),Object.entries(r).forEach(([s,a])=>{let c=e.getTagByZodSchemaName(s);c&&(Vb(c,i).zodSchemas[s]=a)}),i):(i.set(n.defaultTag,{endpoints:t,zodSchemas:r}),i)}o(ZN,"splitDataByTags");function Vb(e,t){return t.has(e)||t.set(e,{endpoints:[],zodSchemas:{}}),t.get(e)}o(Vb,"getTagElement");async function Bb(e,t){let{resolver:r,data:n}=await Na(e,t),i=[],s=[];return n.forEach(({endpoints:c,zodSchemas:u},l)=>{Object.keys(u).forEach(f=>{let p=r.getRefByZodSchemaName(f),d=p?r.getSchemaByRef(p):r.getSchemaByCompositeZodSchemaName(f),m=ai({zodSchemaName:f,schema:d,resolver:r}),g;d&&(g=an({schema:d,parentTypes:[m],resolver:r})),i.push({...m,metaType:"primitive",...g})}),c.forEach(f=>{let p="queries",d=Ct(l);s.push({name:Aa(f),importPath:on({type:p,tag:d,includeTagDir:!0,options:t}),namespace:t.tsNamespaces?U({type:p,tag:d,options:t}):void 0,isQuery:Ie(f),isMutation:jt(f),params:zN({resolver:r,endpoint:f}),response:KN({resolver:r,endpoint:f})})})}),{openApiDoc:e,models:i,queries:s}}o(Bb,"getMetadataFromOpenAPIDoc");function zN({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(Je);p&&(n=e.resolveObject((u=(c=r.bodyObject.content)==null?void 0:c[p])==null?void 0:u.schema))}let i=ai({zodSchemaName:r.zodSchema,schema:n,resolver:e}),s;return n&&(s=an({schema:n,parentTypes:[i],resolver:e})),{name:wt(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(zN,"getQueryMetadataParams");function KN({resolver:e,endpoint:t}){var a,c,u,l;let r,n=Object.keys(((a=t.responseObject)==null?void 0:a.content)??{}).find(si);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=ai({zodSchemaName:t.response,schema:r,resolver:e}),s;return r&&(s=an({schema:r,parentTypes:[i],resolver:e})),{...i,metaType:"primitive",...s}}o(KN,"getQueryMetadataResponse");var xd=rt(Yt());var $d=rt(require("fs")),kP=rt(require("path"));function jP(e){return $d.default.readFileSync(kP.default.join(__dirname,`../${e}`),"utf-8")}o(jP,"readFileSync");function Od(e){let t=`src/generators/templates/${e}.hbs`;return jP(t)}o(Od,"readHbsTemplateSync");function qP(e){let t=`src/assets/${e}`;return jP(t)}o(qP,"readAssetSync");function Jt({output:e,fileName:t}){return`${e}/${t}`}o(Jt,"getOutputFileName");var Lt=rt(Yt());function MP(e){F3(),H3(),V3(e.options),B3(),U3(),G3(),Z3(),z3(),K3()}o(MP,"registerAclHbsHelpers");function F3(){Lt.default.registerHelper("abilityTypeName",kS)}o(F3,"registerAbilityTypeNameHelper");function H3(){Lt.default.registerHelper("abilityFunctionName",wo)}o(H3,"registerAbilityFunctionNameHelper");function V3(e){Lt.default.registerHelper("importedAbilityFunctionName",t=>jS(t,e))}o(V3,"registerImportedAbilityFunctionNameHelper");function B3(){Lt.default.registerHelper("ablityAction",qS)}o(B3,"registerAbilityActionHelper");function U3(){Lt.default.registerHelper("ablitySubject",MS)}o(U3,"registerAbilitySubjectHelper");function G3(){Lt.default.registerHelper("hasAbilityConditions",ba)}o(G3,"registerHasAbilityConditionsHelper");function Z3(){Lt.default.registerHelper("abilityConditionsTypes",Io)}o(Z3,"registerAbilityConditionsTypesHelper");function z3(){Lt.default.registerHelper("abilityDescription",DS)}o(z3,"registerAbilityDescriptionHelper");function K3(){Lt.default.registerHelper("tagAllAbilitiesName",_a)}o(K3,"registerTagAllAbilitiesNameHelper");var Ei=rt(Yt());function DP(){Q3(),W3(),Y3(),J3(),X3()}o(DP,"registerCommonHbsHelpers");function Q3(){Ei.default.registerHelper("isEqual",(e,t)=>e===t)}o(Q3,"registerIsEqualHelper");function W3(){Ei.default.registerHelper("commaSeparated",e=>e.join(", "))}o(W3,"registerCommaSeparatedListHelper");function Y3(){Ei.default.registerHelper("addAsteriskAfterNewLine",e=>e.replace(/\n/g,`
|
|
77
|
-
*`))}o(Y3,"registerAddAsteriskAfterNewLineHelper");function J3(){Ei.default.registerHelper("jsonStringify",e=>JSON.stringify(e,null,2))}o(J3,"registerJsonStringifyHelper");function X3(){Ei.default.registerHelper("capitalize",B)}o(X3,"registerCapitalizeHelper");var Rr=rt(Yt());function LP(e){eq(),tq(e.options),iq(e),rq(),nq(),oq(e),sq()}o(LP,"registerEndpointsHbsHelpers");function eq(){Rr.default.registerHelper("endpointName",No)}o(eq,"registerEndpointNameHelper");function tq(e){Rr.default.registerHelper("importedEndpointName",t=>ob(t,e))}o(tq,"registerImportedEndpointNameHelper");function rq(){Rr.default.registerHelper("endpointPath",sb)}o(rq,"registerEndpointPathHelper");function nq(){Rr.default.registerHelper("endpointBody",e=>e.parameters.find(t=>t.type==="Body"))}o(nq,"registerEndpointBodyHelper");function iq(e){Rr.default.registerHelper("endpointParams",(t,r)=>wr(e,t,r.hash))}o(iq,"registerEndpointParamsHelper");function oq(e){Rr.default.registerHelper("endpointArgs",(t,r)=>wr(e,t,r.hash).map(n=>n.name).join(", "))}o(oq,"registerEndpointArgsHelper");function sq(){Rr.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&&re(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(Je);p&&(i=e.bodyObject.content[p],i.schema&&re(i.schema)&&(n=i.schema))}if(n){let f=Ro(n);t.push(...f)}return i!=null&&i.example&&t.push(`Example: \`${i.example}\``),t.join(". ")})}o(sq,"registerEndpointParamDescriptionHelper");var FP=rt(Yt());function HP(){aq()}o(HP,"registerImportsHbsHelpers");function aq(){FP.default.registerHelper("importNames",(e,t)=>[...t?[t]:[],...e?[`{ ${e.join(", ")} }`]:[]].join(", "))}o(aq,"registerBindingsHelper");var Re=rt(Yt());function VP(e){cq(),uq(),lq(),pq(e),fq(),dq(e),mq(e),hq(e),gq(e),yq(e),vq(),Sq(),bq(),_q()}o(VP,"registerPartialsHbsHelpers");function cq(){Re.default.registerHelper("genModelJsDocs",(e,t,r)=>Ce("model-js-docs")({name:e,zodSchema:t,tag:r}))}o(cq,"registerGenerateModelJsDocsHelper");function uq(){Re.default.registerHelper("genImport",e=>Ce("import")({import:e}))}o(uq,"registerImportHelper");function lq(){Re.default.registerHelper("genEndpointParams",(e,t)=>Ce("endpoint-params")({endpoint:e,options:t}))}o(lq,"registerGenerateEndpointParamsHelper");function pq(e){Re.default.registerHelper("genEndpointConfig",t=>{let r=ab(t),n=e.options.axiosRequestConfig;return Object.keys(r).length===0?n?gr:"":Ce("endpoint-config")({endpointConfig:r,hasAxiosRequestConfig:n,hasBlobResponse:t.response===ua,hasFileDownload:t.mediaDownload,axiosRequestConfigName:gr,generateParse:e.options.parseRequestParams})})}o(pq,"registerGenerateEndpointConfigHelper");function fq(){Re.default.registerHelper("genEndpointParamParse",(e,t)=>{var r;return Ce("endpoint-param-parse")({param:e,paramName:t,isQuery:e.type==="Query",zodUtilsNamespace:ue.namespace,parse:ue.exports.parse,sortExp:ue.exports.sortExp,addOptional:!((r=e.parameterObject??e.bodyObject)!=null&&r.required)&&(e.parameterSortingEnumSchemaName||he(e.zodSchema))})})}o(fq,"registerGenerateEndpointParamParseHelper");function dq(e){Re.default.registerHelper("genQueryKeys",t=>t.length===0?"":Ce("query-keys")({queryEndpoints:t,queriesModuleName:Po,generateInfiniteQueries:e.options.infiniteQueries}))}o(dq,"registerGenerateQueryKeysHelper");function mq(e){Re.default.registerHelper("genQuery",t=>{if(!Ie(t))return;let r=e.options.axiosRequestConfig,n=e.options.checkAcl&&t.acl;return Ce("query-use-query")({endpoint:t,queryHook:mt.query,hasQueryFn:wr(e,t).length>0||r||n,hasQueryFnBody:n,hasAxiosRequestConfig:r,axiosRequestConfigName:gr,axiosRequestConfigType:At,hasAclCheck:n,aclCheckHook:$r})})}o(mq,"registerGenerateQueryHelper");function hq(e){Re.default.registerHelper("genMutation",(t,r)=>{if(!jt(t))return;let n=cb(t,r),i=ub(e,t,n),s=e.options.checkAcl&&t.acl;return Ce("query-use-mutation")({endpoint:t,queryHook:mt.mutation,queriesModuleName:Po,hasAxiosRequestConfig:e.options.axiosRequestConfig,hasMutationFnBody:t.mediaUpload||s,axiosRequestConfigName:gr,axiosRequestConfigType:At,hasMutationEffects:e.options.mutationEffects,mutationEffectsType:ri.optionsType,updateQueryEndpoints:n,destructuredVariables:i,hasAclCheck:s,aclCheckHook:$r})})}o(hq,"registerGenerateMutationHelper");function gq(e){Re.default.registerHelper("genInfiniteQuery",t=>{if(!e.options.infiniteQueries||!ci(t))return;let r=e.options.checkAcl&&t.acl;return Ce("query-use-infinite-query")({endpoint:t,infiniteQueryHook:mt.infiniteQuery,hasQueryFnBody:r,pageParamName:pa.pageParamName,totalItemsName:pa.totalItemsName,limitParamName:pa.limitParamName,hasAxiosRequestConfig:e.options.axiosRequestConfig,axiosRequestConfigName:gr,axiosRequestConfigType:At,hasAclCheck:r,aclCheckHook:$r})})}o(gq,"registerGenerateInfiniteQueryHelper");function yq(e){Re.default.registerHelper("genQueryJsDocs",(t,r)=>Ce("query-js-docs")({endpoint:t,query:r.hash.query,mutation:r.hash.mutation,infiniteQuery:r.hash.infiniteQuery,hasMutationEffects:e.options.mutationEffects,mutationEffectsType:ri.optionsType}))}o(yq,"registerGenerateQueryJsDocsHelper");function vq(){Re.default.registerHelper("genCaslAbilityType",e=>Ce("casl-ability-type")({endpoint:e,abilityTupleType:$e.abilityTuple}))}o(vq,"registerGenerateCaslAbilityTypeHelper");function Sq(){Re.default.registerHelper("genCaslAbilityFunction",e=>Ce("casl-ability-function")({endpoint:e}))}o(Sq,"registerGenerateCaslAbilityFunctionHelper");function bq(){Re.default.registerHelper("genCaslAbilityQuery",e=>Ce("casl-ability-query")({endpoint:e}))}o(bq,"registerGenerateCaslAbilityQueryHelper");function _q(){Re.default.registerHelper("genAclCheckCall",e=>{var i;let t=(i=Io(e))==null?void 0:i.map(s=>s.name),r=e.parameters.map(s=>s.name),n=t==null?void 0:t.every(s=>r.includes(s));return Ce("acl-check-call")({endpoint:e,generateAclCheckParams:ba(e)&&n})})}o(_q,"registerGenerateAclCheckCallHelper");var $i=rt(Yt());function BP(){Pq(),$q(),Oq(),Eq(),xq()}o(BP,"registerQueryHbsHelpers");function Pq(){$i.default.registerHelper("queryName",(e,t)=>Aa(e,t.hash.mutation))}o(Pq,"registerQueryNameHelper");function Eq(){$i.default.registerHelper("infiniteQueryName",lb)}o(Eq,"registerInfiniteQueryNameHelper");function $q(){$i.default.registerHelper("isQuery",Ie)}o($q,"registerIsQueryHelper");function Oq(){$i.default.registerHelper("isMutation",jt)}o(Oq,"registerIsMutationHelper");function xq(){$i.default.registerHelper("isInfiniteQuery",e=>ci(e))}o(xq,"registerIsInfiniteQueryHelper");var gn=rt(Yt());function UP(e){Aq(e.options),wq(e),Iq(e),Tq(),Rq(),Cq(e)}o(UP,"registerZodHbsHelpers");function Aq(e){gn.default.registerHelper("zodInferedType",t=>Co(t,e))}o(Aq,"registerInferedTypeHelper");function wq(e){gn.default.registerHelper("importedZodSchemaName",t=>HS(e,t))}o(wq,"registerImportedZodSchemaNameHelper");function Iq(e){gn.default.registerHelper("importedZodSchemaInferedType",t=>xr(e,t))}o(Iq,"registerImportedZodSchemaInferedTypeHelper");function Tq(){gn.default.registerHelper("zodSchemaType",e=>VS(e))}o(Tq,"registerZodSchemaTypeHelper");function Rq(){gn.default.registerHelper("zodSchemaDescription",e=>BS(e))}o(Rq,"registerZodSchemaDescriptionHelper");function Cq(e){gn.default.registerHelper("zodSchemaPropertyDescriptions",(t,r)=>GS(e,t,r))}o(Cq,"registerZodSchemaPropertyDescriptionsHelper");function ye(e,t){let r=Od(t);return DP(),HP(),UP(e),LP(e),BP(),MP(e),VP(e),xd.default.compile(r)}o(ye,"getHbsTemplateDelegate");function Ce(e){let t=Od(`partials/${e}`);return xd.default.compile(t)}o(Ce,"getHbsPartialTemplateDelegate");function GP({resolver:e,data:t,tag:r=""}){var l;let n=(l=t.get(r))==null?void 0:l.endpoints.filter(({acl:f})=>f&&f.length>0);if(!n||n.length===0)return;let i=n.some(({acl:f})=>(f==null?void 0:f[0].conditions)&&Object.keys(f[0].conditions).length>0),s={bindings:[$e.abilityTuple,...i?[$e.forcedSubject,$e.subject]:[]],from:$f.from},a=n.reduce((f,p)=>{var m,g;let d=(g=(m=p.acl)==null?void 0:m[0].conditionsTypes)==null?void 0:g.reduce((y,v)=>[...y,...v!=null&&v.zodSchemaName?[v.zodSchemaName]:[]],[]);return[...f,...d??[]]},[]),c=Ar({resolver:e,tag:r,zodSchemasAsTypes:He(a)});return ye(e,"acl")({caslAbilityTupleImport:s,modelsImports:c,includeNamespace:e.options.tsNamespaces,namespace:U({type:"acl",tag:r,options:e.options}),endpoints:n})}o(GP,"generateAcl");function ZP(e,t){let r={bindings:[$e.pureAbility,...t.length===0?[$e.subjectType,$e.abilityTuple]:[]],from:$f.from},n=KS({tags:t,entityName:xo,getAliasEntityName:_a,type:"acl",options:e.options}),i=t.map(a=>U({type:"acl",tag:a,options:e.options}));return ye(e,"app-acl")({caslAbilityTupleImport:r,imports:n,allAbilities:xo,appAbilities:Ao,includeNamespace:e.options.tsNamespaces,tags:t,namespaces:i,abilityTuple:$e.abilityTuple,subjectType:$e.subjectType})}o(ZP,"generateAppAcl");function zP({resolver:e,data:t,tag:r=""}){var b;let n=(b=t.get(r))==null?void 0:b.endpoints;if(!n||n.length===0)return;let i={bindings:[yo],from:YS(e.options)},s=e.options.axiosRequestConfig,a=s,c={bindings:s?[At]:[],from:da.from},u=e.options.parseRequestParams,l=n.reduce((P,E)=>[...P,...E.parameters],[]),f=l.filter(P=>!["Path","Header"].includes(P.type)).map(P=>P.parameterSortingEnumSchemaName??P.zodSchema),p=n.map(P=>P.response),d=He([...p,...u?f:[]]),m=d.some(P=>!he(P)),g=e.options.parseRequestParams&&f.length>0,y={bindings:[ue.namespace],from:Oa(e.options)},v=Ar({resolver:e,tag:r,zodSchemas:d.filter(he),zodSchemasAsTypes:He(l.map(P=>P.zodSchema).filter(he))});return ye(e,"endpoints")({appRestClientImport:i,hasAxiosImport:a,axiosImport:c,hasZodImport:m,zodImport:ni,hasZodUtilsImport:g,zodUtilsImport:y,modelsImports:v,includeNamespace:e.options.tsNamespaces,namespace:U({type:"endpoints",tag:r,options:e.options}),restClientName:yo,hasAxiosRequestConfig:s,axiosRequestConfigName:gr,axiosRequestConfigType:At,endpoints:n,generateParse:u})}o(zP,"generateEndpoints");function KP(e,t){let r=e.getRefByZodSchemaName(t);if(r){let i=Array.from(e.dependencyGraph.refsDependencyGraph[r]??[]).map(a=>e.getZodSchemaNameByRef(a)),s=e.getExtractedEnumZodSchemaNamesReferencedBySchemaRef(r);return[...i,...s]}let n=e.getCompositeZodSchemaByZodSchemaName(t);return n?Array.from(QP(n)).map(i=>e.getZodSchemaNameByRef(i)):[]}o(KP,"getZodSchemaRefs");function QP(e){return e.children.reduce((r,n)=>{let i=n.ref??n.enumRef;return i&&r.add(i),n.children.length>0&&QP(n).forEach(s=>r.add(s)),r},new Set)}o(QP,"getSchemaRefs");function WP({resolver:e,data:t,tag:r=""}){var f;let n=(f=t.get(r))==null?void 0:f.zodSchemas;if(!n||Object.keys(n).length===0)return;let i=Object.keys(n).reduce((p,d)=>[...p,...KP(e,d)],[]).filter(p=>!n[p]),s=Ar({resolver:e,tag:r,zodSchemas:i}),a=Object.entries(n).reduce((p,[d,m])=>{let g=e.getRefByZodSchemaName(d),y=e.getZodSchemaObj(d),v=!1;y&&re(y)&&me(y,{onSchema:o(P=>{if(P.type==="reference")return!0;Object.values(li).forEach(E=>{(P.schema&&re(P.schema)&&pi(P.schema,E)||P.parentSchema&&re(P.parentSchema)&&pi(P.parentSchema,E))&&(v=!0)})},"onSchema")});let S={code:m,isCircular:!!g&&e.isSchemaCircular(g),isEnum:LS(m),schemaObj:y,hasBrand:v};return{...p,[d]:S}},{}),c=e.options.branded&&Object.values(a).some(p=>p.hasBrand),u={bindings:[ue.namespace],from:Oa(e.options)};return ye(e,"models")({zodImport:ni,hasZodUtilsImport:c,zodUtilsImport:u,modelsImports:s,includeNamespace:e.options.tsNamespaces,namespace:U({type:"models",tag:r,options:e.options}),tag:r,zodSchemasData:a})}o(WP,"generateModels");function YP({resolver:e,data:t,tag:r=""}){var se;let n=(se=t.get(r))==null?void 0:se.endpoints;if(!n||n.length===0)return;let i=e.options.axiosRequestConfig,s=n.some(({mediaUpload:D})=>D),a=i||s,c={defaultImport:s?ff:void 0,bindings:i?[At]:[],from:da.from},u=n.filter(Ie),l=u.filter(D=>ci(D)),f=n.filter(jt),p={bindings:[...u.length>0?[mt.query]:[],...e.options.infiniteQueries&&l.length>0?[mt.infiniteQuery]:[],...f.length>0?[mt.mutation]:[]],from:fS.from},d=e.options.mutationEffects,m={bindings:[lf],from:XS(e.options)},g=d&&f.length>0,y={bindings:[...f.length>0?[ri.optionsType,ri.hookName]:[]],from:eb(e.options)},v=n.filter(D=>D.acl),S=e.options.checkAcl&&v.length>0,b={bindings:[$r],from:tb(e.options)},P={bindings:[...u.length>0?[ra.query]:[],...e.options.infiniteQueries&&l.length>0?[ra.infiniteQuery]:[],...f.length>0?[ra.mutation]:[]],from:JS(e.options)},E=n.reduce((D,Q)=>[...D,...Q.parameters],[]),_=Ar({resolver:e,tag:r,zodSchemasAsTypes:He(E.map(D=>D.zodSchema).filter(he))}),T=ZS({tag:r,endpoints:n,options:e.options}),k=zS({tag:r,endpoints:v,options:e.options});return ye(e,"queries")({hasAxiosImport:a,axiosImport:c,queryImport:p,hasMutationEffects:d,queryModulesImport:m,hasMutationEffectsImport:g,mutationEffectsImport:y,hasAclCheck:S,aclCheckImport:b,queryTypesImport:P,modelsImports:_,endpointsImports:T,aclImports:k,includeNamespace:e.options.tsNamespaces,tag:r,namespace:U({type:"queries",tag:r,options:e.options}),queriesModuleName:Po,queryModuleEnum:lf,endpoints:n,queryEndpoints:u})}o(YP,"generateQueries");function JP(e){return ye(e,"acl-check")({abilityContextImport:{...iS,from:e.options.abilityContextImportPath},appAbilitiesImport:{bindings:[Ao],from:rb(e.options)},errorHandlingImport:{...na,from:e.options.errorHandlingImportPath},abilityContext:uf,appAbilities:Ao,errorHandler:hr.ErrorHandler,sharedErrorHandler:hr.SharedErrorHandler,aclCheckHook:$r,hasGenericAppAbilities:e.options.abilityContextGenericAppAbilities})}o(JP,"generateAclCheck");function XP(e){return ye(e,"app-rest-client")({appRestClientName:yo,baseUrl:e.getBaseUrl()})}o(XP,"generateAppRestClient");function eE({resolver:e,data:t}){let r=[];return t.forEach((i,s)=>{var c;let a=(c=t.get(s))==null?void 0:c.endpoints;!a||a.length===0||r.push({tag:s,namespace:U({type:"queries",tag:s,options:e.options})})}),ye(e,"query-modules")({modules:r})}o(eE,"generateQueryModules");function tE(e){return ye(e,"zod-utils")({zodImport:ni,zodUtilsNamespace:ue.namespace,parse:ue.exports.parse,sortExp:ue.exports.sortExp,brand:ue.exports.brand,errorHandler:hr.ErrorHandler,sharedErrorHandler:hr.SharedErrorHandler,errorHandlingImport:{...na,from:e.options.errorHandlingImportPath}})}o(tE,"generateZodUtils");function rE(e,t){return t.options.acl?[{fileName:Jt({output:t.options.output,fileName:sn(va)}),content:ZP(t,e)},...t.options.checkAcl?[{fileName:Jt({output:t.options.output,fileName:sn(Sa)}),content:JP(t)}]:[]]:[]}o(rE,"getAclFiles");function nE(e,t){return t.options.mutationEffects?[...sE([oS,aa],t),{fileName:Jt({output:t.options.output,fileName:sn(sa)}),content:eE({resolver:t,data:e})}]:[]}o(nE,"getMutationEffectsFiles");function iE(e){return e.options.standalone?[...sE(Object.values(ia),e),{fileName:Jt({output:e.options.output,fileName:sn(oa)}),content:XP(e)}]:[]}o(iE,"getStandaloneFiles");function oE(e,t){return t.options.parseRequestParams?[{fileName:Jt({output:t.options.output,fileName:sn(ca)}),content:tE(t)}]:[]}o(oE,"getZodUtilsFiles");function sE(e,t){return e.reduce((r,n)=>[...r,Nq(n,t)],[])}o(sE,"getAssetFiles");function Nq(e,t){let r=sn(e);return{fileName:Jt({output:t.options.output,fileName:r}),content:qP(r)}}o(Nq,"getAssetFile");function aE(e,t){let r=t.standalone&&t.importPath==="ts"?"relative":t.importPath,n={...bo,...t,importPath:r},{resolver:i,data:s}=Na(e,n),a=[],c=[],u=["models","endpoints","queries","acl"],l={models:WP,endpoints:zP,queries:YP,acl:GP};return s.forEach((f,p)=>{u.forEach(d=>{let m=l[d]({resolver:i,data:s,tag:p});if(m){let g=Jt({output:n.output,fileName:WS({tag:p,type:d,options:n})});a.push({fileName:g,content:m}),d==="acl"&&c.push(p)}})}),a.push(...rE(c,i),...nE(s,i),...oE(s,i),...iE(i)),a}o(aE,"generateCodeFromOpenAPIDoc");async function kq({input:e,options:t}){let r={...bo,...t},n=await Ad.default.bundle(e);return await Bb(n,r)}o(kq,"getGenerateMetadata");async function jq({input:e,options:t}){let r={...bo,...t},n=await Ad.default.bundle(e);return aE(n,r)}o(jq,"getGenerateFilesData");0&&(module.exports={getGenerateFilesData,getGenerateMetadata});
|
|
77
|
+
*`))}o(Y3,"registerAddAsteriskAfterNewLineHelper");function J3(){Ei.default.registerHelper("jsonStringify",e=>JSON.stringify(e,null,2))}o(J3,"registerJsonStringifyHelper");function X3(){Ei.default.registerHelper("capitalize",B)}o(X3,"registerCapitalizeHelper");var Rr=rt(Yt());function LP(e){eq(),tq(e.options),iq(e),rq(),nq(),oq(e),sq()}o(LP,"registerEndpointsHbsHelpers");function eq(){Rr.default.registerHelper("endpointName",No)}o(eq,"registerEndpointNameHelper");function tq(e){Rr.default.registerHelper("importedEndpointName",t=>ob(t,e))}o(tq,"registerImportedEndpointNameHelper");function rq(){Rr.default.registerHelper("endpointPath",sb)}o(rq,"registerEndpointPathHelper");function nq(){Rr.default.registerHelper("endpointBody",e=>e.parameters.find(t=>t.type==="Body"))}o(nq,"registerEndpointBodyHelper");function iq(e){Rr.default.registerHelper("endpointParams",(t,r)=>wr(e,t,r.hash))}o(iq,"registerEndpointParamsHelper");function oq(e){Rr.default.registerHelper("endpointArgs",(t,r)=>wr(e,t,r.hash).map(n=>n.name).join(", "))}o(oq,"registerEndpointArgsHelper");function sq(){Rr.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&&re(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(Je);p&&(i=e.bodyObject.content[p],i.schema&&re(i.schema)&&(n=i.schema))}if(n){let f=Ro(n);t.push(...f)}return i!=null&&i.example&&t.push(`Example: \`${i.example}\``),t.join(". ")})}o(sq,"registerEndpointParamDescriptionHelper");var FP=rt(Yt());function HP(){aq()}o(HP,"registerImportsHbsHelpers");function aq(){FP.default.registerHelper("importNames",(e,t)=>[...t?[t]:[],...e?[`{ ${e.join(", ")} }`]:[]].join(", "))}o(aq,"registerBindingsHelper");var Re=rt(Yt());function VP(e){cq(),uq(),lq(),pq(e),fq(),dq(e),mq(e),hq(e),gq(e),yq(e),vq(),Sq(),bq(),_q()}o(VP,"registerPartialsHbsHelpers");function cq(){Re.default.registerHelper("genModelJsDocs",(e,t,r)=>Ce("model-js-docs")({name:e,zodSchema:t,tag:r}))}o(cq,"registerGenerateModelJsDocsHelper");function uq(){Re.default.registerHelper("genImport",e=>Ce("import")({import:e}))}o(uq,"registerImportHelper");function lq(){Re.default.registerHelper("genEndpointParams",(e,t)=>Ce("endpoint-params")({endpoint:e,options:t}))}o(lq,"registerGenerateEndpointParamsHelper");function pq(e){Re.default.registerHelper("genEndpointConfig",t=>{let r=ab(t),n=e.options.axiosRequestConfig;return Object.keys(r).length===0?n?gr:"":Ce("endpoint-config")({endpointConfig:r,hasAxiosRequestConfig:n,hasBlobResponse:t.response===ua,hasFileDownload:t.mediaDownload,axiosRequestConfigName:gr,generateParse:e.options.parseRequestParams})})}o(pq,"registerGenerateEndpointConfigHelper");function fq(){Re.default.registerHelper("genEndpointParamParse",(e,t)=>{var r;return Ce("endpoint-param-parse")({param:e,paramName:t,isQuery:e.type==="Query",zodUtilsNamespace:ue.namespace,parse:ue.exports.parse,sortExp:ue.exports.sortExp,addOptional:!((r=e.parameterObject??e.bodyObject)!=null&&r.required)&&(e.parameterSortingEnumSchemaName||he(e.zodSchema))})})}o(fq,"registerGenerateEndpointParamParseHelper");function dq(e){Re.default.registerHelper("genQueryKeys",t=>t.length===0?"":Ce("query-keys")({queryEndpoints:t,queriesModuleName:Po,generateInfiniteQueries:e.options.infiniteQueries}))}o(dq,"registerGenerateQueryKeysHelper");function mq(e){Re.default.registerHelper("genQuery",t=>{if(!Ie(t))return;let r=e.options.axiosRequestConfig,n=e.options.checkAcl&&t.acl;return Ce("query-use-query")({endpoint:t,queryHook:mt.query,hasQueryFn:wr(e,t).length>0||r||n,hasQueryFnBody:n,hasAxiosRequestConfig:r,axiosRequestConfigName:gr,axiosRequestConfigType:At,hasAclCheck:n,aclCheckHook:$r})})}o(mq,"registerGenerateQueryHelper");function hq(e){Re.default.registerHelper("genMutation",(t,r)=>{if(!jt(t))return;let n=cb(t,r),i=ub(e,t,n),s=e.options.checkAcl&&t.acl;return Ce("query-use-mutation")({endpoint:t,queryHook:mt.mutation,queriesModuleName:Po,hasAxiosRequestConfig:e.options.axiosRequestConfig,hasMutationFnBody:t.mediaUpload||s,axiosRequestConfigName:gr,axiosRequestConfigType:At,hasMutationEffects:e.options.mutationEffects,mutationEffectsType:ri.optionsType,updateQueryEndpoints:n,destructuredVariables:i,hasAclCheck:s,aclCheckHook:$r})})}o(hq,"registerGenerateMutationHelper");function gq(e){Re.default.registerHelper("genInfiniteQuery",t=>{if(!e.options.infiniteQueries||!ci(t))return;let r=e.options.checkAcl&&t.acl;return Ce("query-use-infinite-query")({endpoint:t,infiniteQueryHook:mt.infiniteQuery,hasQueryFnBody:r,pageParamName:pa.pageParamName,totalItemsName:pa.totalItemsName,limitParamName:pa.limitParamName,hasAxiosRequestConfig:e.options.axiosRequestConfig,axiosRequestConfigName:gr,axiosRequestConfigType:At,hasAclCheck:r,aclCheckHook:$r})})}o(gq,"registerGenerateInfiniteQueryHelper");function yq(e){Re.default.registerHelper("genQueryJsDocs",(t,r)=>Ce("query-js-docs")({endpoint:t,query:r.hash.query,mutation:r.hash.mutation,infiniteQuery:r.hash.infiniteQuery,hasMutationEffects:e.options.mutationEffects,mutationEffectsType:ri.optionsType}))}o(yq,"registerGenerateQueryJsDocsHelper");function vq(){Re.default.registerHelper("genCaslAbilityType",e=>Ce("casl-ability-type")({endpoint:e,abilityTupleType:$e.abilityTuple}))}o(vq,"registerGenerateCaslAbilityTypeHelper");function Sq(){Re.default.registerHelper("genCaslAbilityFunction",e=>Ce("casl-ability-function")({endpoint:e}))}o(Sq,"registerGenerateCaslAbilityFunctionHelper");function bq(){Re.default.registerHelper("genCaslAbilityQuery",e=>Ce("casl-ability-query")({endpoint:e}))}o(bq,"registerGenerateCaslAbilityQueryHelper");function _q(){Re.default.registerHelper("genAclCheckCall",e=>{var i;let t=(i=Io(e))==null?void 0:i.map(s=>s.name),r=e.parameters.map(s=>s.name),n=t==null?void 0:t.every(s=>r.includes(s));return Ce("acl-check-call")({endpoint:e,generateAclCheckParams:ba(e)&&n})})}o(_q,"registerGenerateAclCheckCallHelper");var $i=rt(Yt());function BP(){Pq(),$q(),Oq(),Eq(),xq()}o(BP,"registerQueryHbsHelpers");function Pq(){$i.default.registerHelper("queryName",(e,t)=>Aa(e,t.hash.mutation))}o(Pq,"registerQueryNameHelper");function Eq(){$i.default.registerHelper("infiniteQueryName",lb)}o(Eq,"registerInfiniteQueryNameHelper");function $q(){$i.default.registerHelper("isQuery",Ie)}o($q,"registerIsQueryHelper");function Oq(){$i.default.registerHelper("isMutation",jt)}o(Oq,"registerIsMutationHelper");function xq(){$i.default.registerHelper("isInfiniteQuery",e=>ci(e))}o(xq,"registerIsInfiniteQueryHelper");var gn=rt(Yt());function UP(e){Aq(e.options),wq(e),Iq(e),Tq(),Rq(),Cq(e)}o(UP,"registerZodHbsHelpers");function Aq(e){gn.default.registerHelper("zodInferedType",t=>Co(t,e))}o(Aq,"registerInferedTypeHelper");function wq(e){gn.default.registerHelper("importedZodSchemaName",t=>HS(e,t))}o(wq,"registerImportedZodSchemaNameHelper");function Iq(e){gn.default.registerHelper("importedZodSchemaInferedType",t=>xr(e,t))}o(Iq,"registerImportedZodSchemaInferedTypeHelper");function Tq(){gn.default.registerHelper("zodSchemaType",e=>VS(e))}o(Tq,"registerZodSchemaTypeHelper");function Rq(){gn.default.registerHelper("zodSchemaDescription",e=>BS(e))}o(Rq,"registerZodSchemaDescriptionHelper");function Cq(e){gn.default.registerHelper("zodSchemaPropertyDescriptions",(t,r)=>GS(e,t,r))}o(Cq,"registerZodSchemaPropertyDescriptionsHelper");function ye(e,t){let r=Od(t);return DP(),HP(),UP(e),LP(e),BP(),MP(e),VP(e),xd.default.compile(r)}o(ye,"getHbsTemplateDelegate");function Ce(e){let t=Od(`partials/${e}`);return xd.default.compile(t)}o(Ce,"getHbsPartialTemplateDelegate");function GP({resolver:e,data:t,tag:r=""}){var l;let n=(l=t.get(r))==null?void 0:l.endpoints.filter(({acl:f})=>f&&f.length>0);if(!n||n.length===0)return;let i=n.some(({acl:f})=>(f==null?void 0:f[0].conditions)&&Object.keys(f[0].conditions).length>0),s={bindings:[$e.abilityTuple,...i?[$e.forcedSubject,$e.subject]:[]],from:$f.from},a=n.reduce((f,p)=>{var m,g;let d=(g=(m=p.acl)==null?void 0:m[0].conditionsTypes)==null?void 0:g.reduce((y,v)=>[...y,...v!=null&&v.zodSchemaName?[v.zodSchemaName]:[]],[]);return[...f,...d??[]]},[]),c=Ar({resolver:e,tag:r,zodSchemasAsTypes:He(a)});return ye(e,"acl")({caslAbilityTupleImport:s,modelsImports:c,includeNamespace:e.options.tsNamespaces,namespace:U({type:"acl",tag:r,options:e.options}),endpoints:n})}o(GP,"generateAcl");function ZP(e,t){let r={bindings:[$e.pureAbility,...t.length===0?[$e.subjectType,$e.abilityTuple]:[]],from:$f.from},n=KS({tags:t,entityName:xo,getAliasEntityName:_a,type:"acl",options:e.options}),i=t.map(a=>U({type:"acl",tag:a,options:e.options}));return ye(e,"app-acl")({caslAbilityTupleImport:r,imports:n,allAbilities:xo,appAbilities:Ao,includeNamespace:e.options.tsNamespaces,tags:t,namespaces:i,abilityTuple:$e.abilityTuple,subjectType:$e.subjectType})}o(ZP,"generateAppAcl");function zP({resolver:e,data:t,tag:r=""}){var b;let n=(b=t.get(r))==null?void 0:b.endpoints;if(!n||n.length===0)return;let i={bindings:[yo],from:YS(e.options)},s=e.options.axiosRequestConfig,a=s,c={bindings:s?[At]:[],from:da.from},u=e.options.parseRequestParams,l=n.reduce((P,E)=>[...P,...E.parameters],[]),f=l.filter(P=>!["Path","Header"].includes(P.type)).map(P=>P.parameterSortingEnumSchemaName??P.zodSchema),p=n.map(P=>P.response),d=He([...p,...u?f:[]]),m=d.some(P=>!he(P)),g=e.options.parseRequestParams&&f.length>0,y={bindings:[ue.namespace],from:Oa(e.options)},v=Ar({resolver:e,tag:r,zodSchemas:d.filter(he),zodSchemasAsTypes:He(l.map(P=>P.zodSchema).filter(he))});return ye(e,"endpoints")({appRestClientImport:i,hasAxiosImport:a,axiosImport:c,hasZodImport:m,zodImport:ni,hasZodUtilsImport:g,zodUtilsImport:y,modelsImports:v,includeNamespace:e.options.tsNamespaces,namespace:U({type:"endpoints",tag:r,options:e.options}),restClientName:yo,hasAxiosRequestConfig:s,axiosRequestConfigName:gr,axiosRequestConfigType:At,endpoints:n,generateParse:u})}o(zP,"generateEndpoints");function KP(e,t){let r=e.getRefByZodSchemaName(t);if(r){let i=Array.from(e.dependencyGraph.refsDependencyGraph[r]??[]).map(a=>e.getZodSchemaNameByRef(a)),s=e.getExtractedEnumZodSchemaNamesReferencedBySchemaRef(r);return[...i,...s]}let n=e.getCompositeZodSchemaByZodSchemaName(t);return n?Array.from(QP(n)).map(i=>e.getZodSchemaNameByRef(i)):[]}o(KP,"getZodSchemaRefs");function QP(e){return e.children.reduce((r,n)=>{let i=n.ref??n.enumRef;return i&&r.add(i),n.children.length>0&&QP(n).forEach(s=>r.add(s)),r},new Set)}o(QP,"getSchemaRefs");function WP({resolver:e,data:t,tag:r=""}){var f;let n=(f=t.get(r))==null?void 0:f.zodSchemas;if(!n||Object.keys(n).length===0)return;let i=Object.keys(n).reduce((p,d)=>[...p,...KP(e,d)],[]).filter(p=>!n[p]),s=Ar({resolver:e,tag:r,zodSchemas:i}),a=Object.entries(n).reduce((p,[d,m])=>{let g=e.getRefByZodSchemaName(d),y=e.getZodSchemaObj(d),v=!1;y&&re(y)&&me(y,{onSchema:o(P=>{if(P.type==="reference")return!0;Object.values(li).forEach(E=>{(P.schema&&re(P.schema)&&pi(P.schema,E)||P.parentSchema&&re(P.parentSchema)&&pi(P.parentSchema,E))&&(v=!0)})},"onSchema")});let S={code:m,isCircular:!!g&&e.isSchemaCircular(g),isEnum:LS(m),schemaObj:y,hasBrand:v};return{...p,[d]:S}},{}),c=e.options.branded&&Object.values(a).some(p=>p.hasBrand),u={bindings:[ue.namespace],from:Oa(e.options)};return ye(e,"models")({zodImport:ni,hasZodUtilsImport:c,zodUtilsImport:u,modelsImports:s,includeNamespace:e.options.tsNamespaces,namespace:U({type:"models",tag:r,options:e.options}),tag:r,zodSchemasData:a})}o(WP,"generateModels");function YP({resolver:e,data:t,tag:r=""}){var se;let n=(se=t.get(r))==null?void 0:se.endpoints;if(!n||n.length===0)return;let i=e.options.axiosRequestConfig,s=n.some(({mediaUpload:D})=>D),a=i||s,c={defaultImport:s?ff:void 0,bindings:i?[At]:[],from:da.from},u=n.filter(Ie),l=u.filter(D=>ci(D)),f=n.filter(jt),p={bindings:[...u.length>0?[mt.query]:[],...e.options.infiniteQueries&&l.length>0?[mt.infiniteQuery]:[],...f.length>0?[mt.mutation]:[]],from:fS.from},d=e.options.mutationEffects,m={bindings:[lf],from:XS(e.options)},g=d&&f.length>0,y={bindings:[...f.length>0?[ri.optionsType,ri.hookName]:[]],from:eb(e.options)},v=n.filter(D=>D.acl),S=e.options.checkAcl&&v.length>0,b={bindings:[$r],from:tb(e.options)},P={bindings:[...u.length>0?[ra.query]:[],...e.options.infiniteQueries&&l.length>0?[ra.infiniteQuery]:[],...f.length>0?[ra.mutation]:[]],from:JS(e.options)},E=n.reduce((D,Q)=>[...D,...Q.parameters],[]),_=Ar({resolver:e,tag:r,zodSchemasAsTypes:He(E.map(D=>D.zodSchema).filter(he))}),T=ZS({tag:r,endpoints:n,options:e.options}),k=zS({tag:r,endpoints:v,options:e.options});return ye(e,"queries")({hasAxiosImport:a,axiosImport:c,queryImport:p,hasMutationEffects:d,queryModulesImport:m,hasMutationEffectsImport:g,mutationEffectsImport:y,hasAclCheck:S,aclCheckImport:b,queryTypesImport:P,modelsImports:_,endpointsImports:T,aclImports:k,includeNamespace:e.options.tsNamespaces,tag:r,namespace:U({type:"queries",tag:r,options:e.options}),queriesModuleName:Po,queryModuleEnum:lf,endpoints:n,queryEndpoints:u})}o(YP,"generateQueries");function JP(e){return ye(e,"acl-check")({abilityContextImport:{...iS,from:e.options.abilityContextImportPath},appAbilitiesImport:{bindings:[Ao],from:rb(e.options)},errorHandlingImport:{...na,from:e.options.errorHandlingImportPath},abilityContext:uf,appAbilities:Ao,errorHandler:hr.ErrorHandler,sharedErrorHandler:hr.SharedErrorHandler,aclCheckHook:$r,hasGenericAppAbilities:e.options.abilityContextGenericAppAbilities})}o(JP,"generateAclCheck");function XP(e){return ye(e,"app-rest-client")({appRestClientName:yo,baseUrl:e.getBaseUrl()})}o(XP,"generateAppRestClient");function eE({resolver:e,data:t}){let r=[];return t.forEach((i,s)=>{var c;let a=(c=t.get(s))==null?void 0:c.endpoints;!a||a.length===0||r.push({tag:s,namespace:U({type:"queries",tag:s,options:e.options})})}),ye(e,"query-modules")({modules:r})}o(eE,"generateQueryModules");function tE(e){return ye(e,"zod-utils")({zodImport:ni,zodUtilsNamespace:ue.namespace,parse:ue.exports.parse,sortExp:ue.exports.sortExp,brand:ue.exports.brand,branded:e.options.branded,errorHandler:hr.ErrorHandler,sharedErrorHandler:hr.SharedErrorHandler,errorHandlingImport:{...na,from:e.options.errorHandlingImportPath}})}o(tE,"generateZodUtils");function rE(e,t){return t.options.acl?[{fileName:Jt({output:t.options.output,fileName:sn(va)}),content:ZP(t,e)},...t.options.checkAcl?[{fileName:Jt({output:t.options.output,fileName:sn(Sa)}),content:JP(t)}]:[]]:[]}o(rE,"getAclFiles");function nE(e,t){return t.options.mutationEffects?[...sE([oS,aa],t),{fileName:Jt({output:t.options.output,fileName:sn(sa)}),content:eE({resolver:t,data:e})}]:[]}o(nE,"getMutationEffectsFiles");function iE(e){return e.options.standalone?[...sE(Object.values(ia),e),{fileName:Jt({output:e.options.output,fileName:sn(oa)}),content:XP(e)}]:[]}o(iE,"getStandaloneFiles");function oE(e,t){return t.options.parseRequestParams?[{fileName:Jt({output:t.options.output,fileName:sn(ca)}),content:tE(t)}]:[]}o(oE,"getZodUtilsFiles");function sE(e,t){return e.reduce((r,n)=>[...r,Nq(n,t)],[])}o(sE,"getAssetFiles");function Nq(e,t){let r=sn(e);return{fileName:Jt({output:t.options.output,fileName:r}),content:qP(r)}}o(Nq,"getAssetFile");function aE(e,t){let r=t.standalone&&t.importPath==="ts"?"relative":t.importPath,n={...bo,...t,importPath:r},{resolver:i,data:s}=Na(e,n),a=[],c=[],u=["models","endpoints","queries","acl"],l={models:WP,endpoints:zP,queries:YP,acl:GP};return s.forEach((f,p)=>{u.forEach(d=>{let m=l[d]({resolver:i,data:s,tag:p});if(m){let g=Jt({output:n.output,fileName:WS({tag:p,type:d,options:n})});a.push({fileName:g,content:m}),d==="acl"&&c.push(p)}})}),a.push(...rE(c,i),...nE(s,i),...oE(s,i),...iE(i)),a}o(aE,"generateCodeFromOpenAPIDoc");async function kq({input:e,options:t}){let r={...bo,...t},n=await Ad.default.bundle(e);return await Bb(n,r)}o(kq,"getGenerateMetadata");async function jq({input:e,options:t}){let r={...bo,...t},n=await Ad.default.bundle(e);return aE(n,r)}o(jq,"getGenerateFilesData");0&&(module.exports={getGenerateFilesData,getGenerateMetadata});
|
package/dist/sh.js
CHANGED
|
@@ -133,11 +133,11 @@ ${y.join(`
|
|
|
133
133
|
`;d.forEach(y=>{h+=y}),t.fail(h)}},"implications");let u={};s.conflicts=o(function(f,d){F("<string|object> [array|string]",[f,d],arguments.length),typeof f=="object"?Object.keys(f).forEach(h=>{s.conflicts(h,f[h])}):(e.global(f),u[f]||(u[f]=[]),Array.isArray(d)?d.forEach(h=>s.conflicts(f,h)):u[f].push(d))},"conflicts"),s.getConflicting=()=>u,s.conflicting=o(function(f){Object.keys(f).forEach(d=>{u[d]&&u[d].forEach(h=>{h&&f[d]!==void 0&&f[h]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",d,h))})}),e.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(u).forEach(d=>{u[d].forEach(h=>{h&&f[r.Parser.camelCase(d)]!==void 0&&f[r.Parser.camelCase(h)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",d,h))})})},"conflictingFn"),s.recommendCommands=o(function(f,d){d=d.sort((g,P)=>P.length-g.length);let y=null,b=1/0;for(let g=0,P;(P=d[g])!==void 0;g++){let $=Dy(f,P);$<=3&&$<b&&(b=$,y=P)}y&&t.fail(n("Did you mean %s?",y))},"recommendCommands"),s.reset=o(function(f){return a=wn(a,d=>!f[d]),u=wn(u,d=>!f[d]),s},"reset");let l=[];return s.freeze=o(function(){l.push({implied:a,conflicting:u})},"freeze"),s.unfreeze=o(function(){let f=l.pop();Rt(f,void 0,r),{implied:a,conflicting:u}=f},"unfreeze"),s}o(Fy,"validation");var $f=[],Is;function Cs(e,t,r,n){Is=n;let i={};if(Object.prototype.hasOwnProperty.call(e,"extends")){if(typeof e.extends!="string")return i;let s=/\.json|\..*rc$/.test(e.extends),a=null;if(s)a=K2(t,e.extends);else try{a=require.resolve(e.extends)}catch{return e}W2(a),$f.push(a),i=s?JSON.parse(Is.readFileSync(a,"utf8")):require(e.extends),delete e.extends,i=Cs(i,Is.path.dirname(a),r,Is)}return $f=[],r?Hy(i,e):Object.assign({},i,e)}o(Cs,"applyExtends");function W2(e){if($f.indexOf(e)>-1)throw new De(`Circular extended configurations: '${e}'.`)}o(W2,"checkForCircularExtends");function K2(e,t){return Is.path.resolve(e,t)}o(K2,"getPathToDefaultConfig");function Hy(e,t){let r={};function n(i){return i&&typeof i=="object"&&!Array.isArray(i)}o(n,"isObject"),Object.assign(r,e);for(let i of Object.keys(t))n(t[i])&&n(r[i])?r[i]=Hy(e[i],t[i]):r[i]=t[i];return r}o(Hy,"mergeDeep");var B=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},m=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},tt,yi,Ts,sr,Wt,_c,In,bi,Sc,ar,Oc,cr,Hr,Kt,ur,Ec,mo,ft,W,Pc,xc,Yt,vi,go,_i,Cn,$c,ie,Si,Oi,Ei,se,wc,Br,Ke;function ab(e){return(t=[],r=e.process.cwd(),n)=>{let i=new qf(t,r,n,e);return Object.defineProperty(i,"argv",{get:o(()=>i.parse(),"get"),enumerable:!0}),i.help(),i.version(),i}}o(ab,"YargsFactory");var By=Symbol("copyDoubleDash"),Vy=Symbol("copyDoubleDash"),wf=Symbol("deleteFromParserHintObject"),Uy=Symbol("emitWarning"),Gy=Symbol("freeze"),zy=Symbol("getDollarZero"),Pi=Symbol("getParserConfiguration"),Zy=Symbol("getUsageConfiguration"),Af=Symbol("guessLocale"),Wy=Symbol("guessVersion"),Ky=Symbol("parsePositionalNumbers"),If=Symbol("pkgUp"),Tn=Symbol("populateParserHintArray"),yo=Symbol("populateParserHintSingleValueDictionary"),Cf=Symbol("populateParserHintArrayDictionary"),Tf=Symbol("populateParserHintDictionary"),Rf=Symbol("sanitizeKey"),Nf=Symbol("setKey"),jf=Symbol("unfreeze"),Yy=Symbol("validateAsync"),Qy=Symbol("getCommandInstance"),Jy=Symbol("getContext"),Xy=Symbol("getHasOutput"),eb=Symbol("getLoggerInstance"),tb=Symbol("getParseContext"),rb=Symbol("getUsageInstance"),nb=Symbol("getValidationInstance"),Ac=Symbol("hasParseCallback"),ib=Symbol("isGlobalContext"),xi=Symbol("postProcess"),ob=Symbol("rebase"),Mf=Symbol("reset"),Rs=Symbol("runYargsParserAndExecuteCommands"),kf=Symbol("runValidation"),sb=Symbol("setHasOutput"),$i=Symbol("kTrackManuallySetKeys"),Df=class Df{constructor(t=[],r,n,i){this.customScriptName=!1,this.parsed=!1,tt.set(this,void 0),yi.set(this,void 0),Ts.set(this,{commands:[],fullCommands:[]}),sr.set(this,null),Wt.set(this,null),_c.set(this,"show-hidden"),In.set(this,null),bi.set(this,!0),Sc.set(this,{}),ar.set(this,!0),Oc.set(this,[]),cr.set(this,void 0),Hr.set(this,{}),Kt.set(this,!1),ur.set(this,null),Ec.set(this,!0),mo.set(this,void 0),ft.set(this,""),W.set(this,void 0),Pc.set(this,void 0),xc.set(this,{}),Yt.set(this,null),vi.set(this,null),go.set(this,{}),_i.set(this,{}),Cn.set(this,void 0),$c.set(this,!1),ie.set(this,void 0),Si.set(this,!1),Oi.set(this,!1),Ei.set(this,!1),se.set(this,void 0),wc.set(this,{}),Br.set(this,null),Ke.set(this,void 0),B(this,ie,i,"f"),B(this,Cn,t,"f"),B(this,yi,r,"f"),B(this,Pc,n,"f"),B(this,cr,new yc(this),"f"),this.$0=this[zy](),this[Mf](),B(this,tt,m(this,tt,"f"),"f"),B(this,se,m(this,se,"f"),"f"),B(this,Ke,m(this,Ke,"f"),"f"),B(this,W,m(this,W,"f"),"f"),m(this,W,"f").showHiddenOpt=m(this,_c,"f"),B(this,mo,this[Vy](),"f")}addHelpOpt(t,r){let n="help";return F("[string|boolean] [string]",[t,r],arguments.length),m(this,ur,"f")&&(this[wf](m(this,ur,"f")),B(this,ur,null,"f")),t===!1&&r===void 0?this:(B(this,ur,typeof t=="string"?t:n,"f"),this.boolean(m(this,ur,"f")),this.describe(m(this,ur,"f"),r||m(this,se,"f").deferY18nLookup("Show help")),this)}help(t,r){return this.addHelpOpt(t,r)}addShowHiddenOpt(t,r){if(F("[string|boolean] [string]",[t,r],arguments.length),t===!1&&r===void 0)return this;let n=typeof t=="string"?t:m(this,_c,"f");return this.boolean(n),this.describe(n,r||m(this,se,"f").deferY18nLookup("Show hidden options")),m(this,W,"f").showHiddenOpt=n,this}showHidden(t,r){return this.addShowHiddenOpt(t,r)}alias(t,r){return F("<object|string|array> [string|array]",[t,r],arguments.length),this[Cf](this.alias.bind(this),"alias",t,r),this}array(t){return F("<array|string>",[t],arguments.length),this[Tn]("array",t),this[$i](t),this}boolean(t){return F("<array|string>",[t],arguments.length),this[Tn]("boolean",t),this[$i](t),this}check(t,r){return F("<function> [boolean]",[t,r],arguments.length),this.middleware((n,i)=>gi(()=>t(n,i.getOptions()),s=>(s?(typeof s=="string"||s instanceof Error)&&m(this,se,"f").fail(s.toString(),s):m(this,se,"f").fail(m(this,ie,"f").y18n.__("Argument check failed: %s",t.toString())),n),s=>(m(this,se,"f").fail(s.message?s.message:s.toString(),s),n)),!1,r),this}choices(t,r){return F("<object|string|array> [string|array]",[t,r],arguments.length),this[Cf](this.choices.bind(this),"choices",t,r),this}coerce(t,r){if(F("<object|string|array> [function]",[t,r],arguments.length),Array.isArray(t)){if(!r)throw new De("coerce callback must be provided");for(let n of t)this.coerce(n,r);return this}else if(typeof t=="object"){for(let n of Object.keys(t))this.coerce(n,t[n]);return this}if(!r)throw new De("coerce callback must be provided");return m(this,W,"f").key[t]=!0,m(this,cr,"f").addCoerceMiddleware((n,i)=>{let s;return Object.prototype.hasOwnProperty.call(n,t)?gi(()=>(s=i.getAliases(),r(n[t])),c=>{n[t]=c;let u=i.getInternalMethods().getParserConfiguration()["strip-aliased"];if(s[t]&&u!==!0)for(let l of s[t])n[l]=c;return n},c=>{throw new De(c.message)}):n},t),this}conflicts(t,r){return F("<string|object> [string|array]",[t,r],arguments.length),m(this,Ke,"f").conflicts(t,r),this}config(t="config",r,n){return F("[object|string] [string|function] [function]",[t,r,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=Cs(t,m(this,yi,"f"),this[Pi]()["deep-merge-config"]||!1,m(this,ie,"f")),m(this,W,"f").configObjects=(m(this,W,"f").configObjects||[]).concat(t),this):(typeof r=="function"&&(n=r,r=void 0),this.describe(t,r||m(this,se,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(i=>{m(this,W,"f").config[i]=n||!0}),this)}completion(t,r,n){return F("[string] [string|boolean|function] [function]",[t,r,n],arguments.length),typeof r=="function"&&(n=r,r=void 0),B(this,Wt,t||m(this,Wt,"f")||"completion","f"),!r&&r!==!1&&(r="generate completion script"),this.command(m(this,Wt,"f"),r),n&&m(this,sr,"f").registerFunction(n),this}command(t,r,n,i,s,a){return F("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,r,n,i,s,a],arguments.length),m(this,tt,"f").addHandler(t,r,n,i,s,a),this}commands(t,r,n,i,s,a){return this.command(t,r,n,i,s,a)}commandDir(t,r){F("<string> [object]",[t,r],arguments.length);let n=m(this,Pc,"f")||m(this,ie,"f").require;return m(this,tt,"f").addDirectory(t,n,m(this,ie,"f").getCallerFile(),r),this}count(t){return F("<array|string>",[t],arguments.length),this[Tn]("count",t),this[$i](t),this}default(t,r,n){return F("<object|string|array> [*] [string]",[t,r,n],arguments.length),n&&(bf(t,m(this,ie,"f")),m(this,W,"f").defaultDescription[t]=n),typeof r=="function"&&(bf(t,m(this,ie,"f")),m(this,W,"f").defaultDescription[t]||(m(this,W,"f").defaultDescription[t]=m(this,se,"f").functionDescription(r)),r=r.call()),this[yo](this.default.bind(this),"default",t,r),this}defaults(t,r,n){return this.default(t,r,n)}demandCommand(t=1,r,n,i){return F("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,r,n,i],arguments.length),typeof r!="number"&&(n=r,r=1/0),this.global("_",!1),m(this,W,"f").demandedCommands._={min:t,max:r,minMsg:n,maxMsg:i},this}demand(t,r,n){return Array.isArray(r)?(r.forEach(i=>{Rt(n,!0,m(this,ie,"f")),this.demandOption(i,n)}),r=1/0):typeof r!="number"&&(n=r,r=1/0),typeof t=="number"?(Rt(n,!0,m(this,ie,"f")),this.demandCommand(t,r,n,n)):Array.isArray(t)?t.forEach(i=>{Rt(n,!0,m(this,ie,"f")),this.demandOption(i,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,r){return F("<object|string|array> [string]",[t,r],arguments.length),this[yo](this.demandOption.bind(this),"demandedOptions",t,r),this}deprecateOption(t,r){return F("<string> [string|boolean]",[t,r],arguments.length),m(this,W,"f").deprecatedOptions[t]=r,this}describe(t,r){return F("<object|string|array> [string]",[t,r],arguments.length),this[Nf](t,!0),m(this,se,"f").describe(t,r),this}detectLocale(t){return F("<boolean>",[t],arguments.length),B(this,bi,t,"f"),this}env(t){return F("[string|boolean]",[t],arguments.length),t===!1?delete m(this,W,"f").envPrefix:m(this,W,"f").envPrefix=t||"",this}epilogue(t){return F("<string>",[t],arguments.length),m(this,se,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,r){return F("<string|array> [string]",[t,r],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):m(this,se,"f").example(t,r),this}exit(t,r){B(this,Kt,!0,"f"),B(this,In,r,"f"),m(this,ar,"f")&&m(this,ie,"f").process.exit(t)}exitProcess(t=!0){return F("[boolean]",[t],arguments.length),B(this,ar,t,"f"),this}fail(t){if(F("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new De("Invalid first argument. Expected function or boolean 'false'");return m(this,se,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,r){return F("<array> [function]",[t,r],arguments.length),r?m(this,sr,"f").getCompletion(t,r):new Promise((n,i)=>{m(this,sr,"f").getCompletion(t,(s,a)=>{s?i(s):n(a)})})}getDemandedOptions(){return F([],0),m(this,W,"f").demandedOptions}getDemandedCommands(){return F([],0),m(this,W,"f").demandedCommands}getDeprecatedOptions(){return F([],0),m(this,W,"f").deprecatedOptions}getDetectLocale(){return m(this,bi,"f")}getExitProcess(){return m(this,ar,"f")}getGroups(){return Object.assign({},m(this,Hr,"f"),m(this,_i,"f"))}getHelp(){if(B(this,Kt,!0,"f"),!m(this,se,"f").hasCachedHelpMessage()){if(!this.parsed){let r=this[Rs](m(this,Cn,"f"),void 0,void 0,0,!0);if(Le(r))return r.then(()=>m(this,se,"f").help())}let t=m(this,tt,"f").runDefaultBuilderOn(this);if(Le(t))return t.then(()=>m(this,se,"f").help())}return Promise.resolve(m(this,se,"f").help())}getOptions(){return m(this,W,"f")}getStrict(){return m(this,Si,"f")}getStrictCommands(){return m(this,Oi,"f")}getStrictOptions(){return m(this,Ei,"f")}global(t,r){return F("<string|array> [boolean]",[t,r],arguments.length),t=[].concat(t),r!==!1?m(this,W,"f").local=m(this,W,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{m(this,W,"f").local.includes(n)||m(this,W,"f").local.push(n)}),this}group(t,r){F("<string|array> <string>",[t,r],arguments.length);let n=m(this,_i,"f")[r]||m(this,Hr,"f")[r];m(this,_i,"f")[r]&&delete m(this,_i,"f")[r];let i={};return m(this,Hr,"f")[r]=(n||[]).concat(t).filter(s=>i[s]?!1:i[s]=!0),this}hide(t){return F("<string>",[t],arguments.length),m(this,W,"f").hiddenOptions.push(t),this}implies(t,r){return F("<string|object> [number|string|array]",[t,r],arguments.length),m(this,Ke,"f").implies(t,r),this}locale(t){return F("[string]",[t],arguments.length),t===void 0?(this[Af](),m(this,ie,"f").y18n.getLocale()):(B(this,bi,!1,"f"),m(this,ie,"f").y18n.setLocale(t),this)}middleware(t,r,n){return m(this,cr,"f").addMiddleware(t,!!r,n)}nargs(t,r){return F("<string|object|array> [number]",[t,r],arguments.length),this[yo](this.nargs.bind(this),"narg",t,r),this}normalize(t){return F("<array|string>",[t],arguments.length),this[Tn]("normalize",t),this}number(t){return F("<array|string>",[t],arguments.length),this[Tn]("number",t),this[$i](t),this}option(t,r){if(F("<string|object> [object]",[t,r],arguments.length),typeof t=="object")Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof r!="object"&&(r={}),this[$i](t),m(this,Br,"f")&&(t==="version"||(r==null?void 0:r.alias)==="version")&&this[Uy](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
|
|
134
134
|
`),void 0,"versionWarning"),m(this,W,"f").key[t]=!0,r.alias&&this.alias(t,r.alias);let n=r.deprecate||r.deprecated;n&&this.deprecateOption(t,n);let i=r.demand||r.required||r.require;i&&this.demand(t,i),r.demandOption&&this.demandOption(t,typeof r.demandOption=="string"?r.demandOption:void 0),r.conflicts&&this.conflicts(t,r.conflicts),"default"in r&&this.default(t,r.default),r.implies!==void 0&&this.implies(t,r.implies),r.nargs!==void 0&&this.nargs(t,r.nargs),r.config&&this.config(t,r.configParser),r.normalize&&this.normalize(t),r.choices&&this.choices(t,r.choices),r.coerce&&this.coerce(t,r.coerce),r.group&&this.group(t,r.group),(r.boolean||r.type==="boolean")&&(this.boolean(t),r.alias&&this.boolean(r.alias)),(r.array||r.type==="array")&&(this.array(t),r.alias&&this.array(r.alias)),(r.number||r.type==="number")&&(this.number(t),r.alias&&this.number(r.alias)),(r.string||r.type==="string")&&(this.string(t),r.alias&&this.string(r.alias)),(r.count||r.type==="count")&&this.count(t),typeof r.global=="boolean"&&this.global(t,r.global),r.defaultDescription&&(m(this,W,"f").defaultDescription[t]=r.defaultDescription),r.skipValidation&&this.skipValidation(t);let s=r.describe||r.description||r.desc,a=m(this,se,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(a,t)||typeof s=="string")&&this.describe(t,s),r.hidden&&this.hide(t),r.requiresArg&&this.requiresArg(t)}return this}options(t,r){return this.option(t,r)}parse(t,r,n){F("[string|array] [function|boolean|object] [function]",[t,r,n],arguments.length),this[Gy](),typeof t>"u"&&(t=m(this,Cn,"f")),typeof r=="object"&&(B(this,vi,r,"f"),r=n),typeof r=="function"&&(B(this,Yt,r,"f"),r=!1),r||B(this,Cn,t,"f"),m(this,Yt,"f")&&B(this,ar,!1,"f");let i=this[Rs](t,!!r),s=this.parsed;return m(this,sr,"f").setParsed(this.parsed),Le(i)?i.then(a=>(m(this,Yt,"f")&&m(this,Yt,"f").call(this,m(this,In,"f"),a,m(this,ft,"f")),a)).catch(a=>{throw m(this,Yt,"f")&&m(this,Yt,"f")(a,this.parsed.argv,m(this,ft,"f")),a}).finally(()=>{this[jf](),this.parsed=s}):(m(this,Yt,"f")&&m(this,Yt,"f").call(this,m(this,In,"f"),i,m(this,ft,"f")),this[jf](),this.parsed=s,i)}parseAsync(t,r,n){let i=this.parse(t,r,n);return Le(i)?i:Promise.resolve(i)}parseSync(t,r,n){let i=this.parse(t,r,n);if(Le(i))throw new De(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return i}parserConfiguration(t){return F("<object>",[t],arguments.length),B(this,xc,t,"f"),this}pkgConf(t,r){F("<string> [string]",[t,r],arguments.length);let n=null,i=this[If](r||m(this,yi,"f"));return i[t]&&typeof i[t]=="object"&&(n=Cs(i[t],r||m(this,yi,"f"),this[Pi]()["deep-merge-config"]||!1,m(this,ie,"f")),m(this,W,"f").configObjects=(m(this,W,"f").configObjects||[]).concat(n)),this}positional(t,r){F("<string> <object>",[t,r],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];r=wn(r,(a,c)=>a==="type"&&!["string","number","boolean"].includes(c)?!1:n.includes(a));let i=m(this,Ts,"f").fullCommands[m(this,Ts,"f").fullCommands.length-1],s=i?m(this,tt,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return po(s).forEach(a=>{let c=s[a];Array.isArray(c)?c.indexOf(t)!==-1&&(r[a]=!0):c[t]&&!(a in r)&&(r[a]=c[t])}),this.group(t,m(this,se,"f").getPositionalGroupName()),this.option(t,r)}recommendCommands(t=!0){return F("[boolean]",[t],arguments.length),B(this,$c,t,"f"),this}required(t,r,n){return this.demand(t,r,n)}require(t,r,n){return this.demand(t,r,n)}requiresArg(t){return F("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&m(this,W,"f").narg[t]?this:(this[yo](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,r){return F("[string] [string]",[t,r],arguments.length),t=t||this.$0,m(this,mo,"f").log(m(this,sr,"f").generateCompletionScript(t,r||m(this,Wt,"f")||"completion")),this}showHelp(t){if(F("[string|function]",[t],arguments.length),B(this,Kt,!0,"f"),!m(this,se,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[Rs](m(this,Cn,"f"),void 0,void 0,0,!0);if(Le(n))return n.then(()=>{m(this,se,"f").showHelp(t)}),this}let r=m(this,tt,"f").runDefaultBuilderOn(this);if(Le(r))return r.then(()=>{m(this,se,"f").showHelp(t)}),this}return m(this,se,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,r){return F("[boolean|string] [string]",[t,r],arguments.length),m(this,se,"f").showHelpOnFail(t,r),this}showVersion(t){return F("[string|function]",[t],arguments.length),m(this,se,"f").showVersion(t),this}skipValidation(t){return F("<array|string>",[t],arguments.length),this[Tn]("skipValidation",t),this}strict(t){return F("[boolean]",[t],arguments.length),B(this,Si,t!==!1,"f"),this}strictCommands(t){return F("[boolean]",[t],arguments.length),B(this,Oi,t!==!1,"f"),this}strictOptions(t){return F("[boolean]",[t],arguments.length),B(this,Ei,t!==!1,"f"),this}string(t){return F("<array|string>",[t],arguments.length),this[Tn]("string",t),this[$i](t),this}terminalWidth(){return F([],0),m(this,ie,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return F("<object>",[t],arguments.length),B(this,bi,!1,"f"),m(this,ie,"f").y18n.updateLocale(t),this}usage(t,r,n,i){if(F("<string|null|undefined> [string|boolean] [function|object] [function]",[t,r,n,i],arguments.length),r!==void 0){if(Rt(t,null,m(this,ie,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,r,n,i);throw new De(".usage() description must start with $0 if being used as alias for .command()")}else return m(this,se,"f").usage(t),this}usageConfiguration(t){return F("<object>",[t],arguments.length),B(this,wc,t,"f"),this}version(t,r,n){let i="version";if(F("[boolean|string] [string] [string]",[t,r,n],arguments.length),m(this,Br,"f")&&(this[wf](m(this,Br,"f")),m(this,se,"f").version(void 0),B(this,Br,null,"f")),arguments.length===0)n=this[Wy](),t=i;else if(arguments.length===1){if(t===!1)return this;n=t,t=i}else arguments.length===2&&(n=r,r=void 0);return B(this,Br,typeof t=="string"?t:i,"f"),r=r||m(this,se,"f").deferY18nLookup("Show version number"),m(this,se,"f").version(n||void 0),this.boolean(m(this,Br,"f")),this.describe(m(this,Br,"f"),r),this}wrap(t){return F("<number|null|undefined>",[t],arguments.length),m(this,se,"f").wrap(t),this}[(tt=new WeakMap,yi=new WeakMap,Ts=new WeakMap,sr=new WeakMap,Wt=new WeakMap,_c=new WeakMap,In=new WeakMap,bi=new WeakMap,Sc=new WeakMap,ar=new WeakMap,Oc=new WeakMap,cr=new WeakMap,Hr=new WeakMap,Kt=new WeakMap,ur=new WeakMap,Ec=new WeakMap,mo=new WeakMap,ft=new WeakMap,W=new WeakMap,Pc=new WeakMap,xc=new WeakMap,Yt=new WeakMap,vi=new WeakMap,go=new WeakMap,_i=new WeakMap,Cn=new WeakMap,$c=new WeakMap,ie=new WeakMap,Si=new WeakMap,Oi=new WeakMap,Ei=new WeakMap,se=new WeakMap,wc=new WeakMap,Br=new WeakMap,Ke=new WeakMap,By)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[Vy](){return{log:o((...t)=>{this[Ac]()||console.log(...t),B(this,Kt,!0,"f"),m(this,ft,"f").length&&B(this,ft,m(this,ft,"f")+`
|
|
135
135
|
`,"f"),B(this,ft,m(this,ft,"f")+t.join(" "),"f")},"log"),error:o((...t)=>{this[Ac]()||console.error(...t),B(this,Kt,!0,"f"),m(this,ft,"f").length&&B(this,ft,m(this,ft,"f")+`
|
|
136
|
-
`,"f"),B(this,ft,m(this,ft,"f")+t.join(" "),"f")},"error")}}[wf](t){po(m(this,W,"f")).forEach(r=>{if((i=>i==="configObjects")(r))return;let n=m(this,W,"f")[r];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete m(this,se,"f").getDescriptions()[t]}[Uy](t,r,n){m(this,Sc,"f")[n]||(m(this,ie,"f").process.emitWarning(t,r),m(this,Sc,"f")[n]=!0)}[Gy](){m(this,Oc,"f").push({options:m(this,W,"f"),configObjects:m(this,W,"f").configObjects.slice(0),exitProcess:m(this,ar,"f"),groups:m(this,Hr,"f"),strict:m(this,Si,"f"),strictCommands:m(this,Oi,"f"),strictOptions:m(this,Ei,"f"),completionCommand:m(this,Wt,"f"),output:m(this,ft,"f"),exitError:m(this,In,"f"),hasOutput:m(this,Kt,"f"),parsed:this.parsed,parseFn:m(this,Yt,"f"),parseContext:m(this,vi,"f")}),m(this,se,"f").freeze(),m(this,Ke,"f").freeze(),m(this,tt,"f").freeze(),m(this,cr,"f").freeze()}[zy](){let t="",r;return/\b(node|iojs|electron)(\.exe)?$/.test(m(this,ie,"f").process.argv()[0])?r=m(this,ie,"f").process.argv().slice(1,2):r=m(this,ie,"f").process.argv().slice(0,1),t=r.map(n=>{let i=this[ob](m(this,yi,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&i.length<n.length?i:n}).join(" ").trim(),m(this,ie,"f").getEnv("_")&&m(this,ie,"f").getProcessArgvBin()===m(this,ie,"f").getEnv("_")&&(t=m(this,ie,"f").getEnv("_").replace(`${m(this,ie,"f").path.dirname(m(this,ie,"f").process.execPath())}/`,"")),t}[Pi](){return m(this,xc,"f")}[Zy](){return m(this,wc,"f")}[Af](){if(!m(this,bi,"f"))return;let t=m(this,ie,"f").getEnv("LC_ALL")||m(this,ie,"f").getEnv("LC_MESSAGES")||m(this,ie,"f").getEnv("LANG")||m(this,ie,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Wy](){return this[If]().version||"unknown"}[Ky](t){let r=t["--"]?t["--"]:t._;for(let n=0,i;(i=r[n])!==void 0;n++)m(this,ie,"f").Parser.looksLikeNumber(i)&&Number.isSafeInteger(Math.floor(parseFloat(`${i}`)))&&(r[n]=Number(i));return t}[If](t){let r=t||"*";if(m(this,go,"f")[r])return m(this,go,"f")[r];let n={};try{let i=t||m(this,ie,"f").mainFilename;!t&&m(this,ie,"f").path.extname(i)&&(i=m(this,ie,"f").path.dirname(i));let s=m(this,ie,"f").findUp(i,(a,c)=>{if(c.includes("package.json"))return"package.json"});Rt(s,void 0,m(this,ie,"f")),n=JSON.parse(m(this,ie,"f").readFileSync(s,"utf8"))}catch{}return m(this,go,"f")[r]=n||{},m(this,go,"f")[r]}[Tn](t,r){r=[].concat(r),r.forEach(n=>{n=this[Rf](n),m(this,W,"f")[t].push(n)})}[yo](t,r,n,i){this[Tf](t,r,n,i,(s,a,c)=>{m(this,W,"f")[s][a]=c})}[Cf](t,r,n,i){this[Tf](t,r,n,i,(s,a,c)=>{m(this,W,"f")[s][a]=(m(this,W,"f")[s][a]||[]).concat(c)})}[Tf](t,r,n,i,s){if(Array.isArray(n))n.forEach(a=>{t(a,i)});else if((a=>typeof a=="object")(n))for(let a of po(n))t(a,n[a]);else s(r,this[Rf](n),i)}[Rf](t){return t==="__proto__"?"___proto___":t}[Nf](t,r){return this[yo](this[Nf].bind(this),"key",t,r),this}[jf](){var t,r,n,i,s,a,c,u,l,p,f,d;let h=m(this,Oc,"f").pop();Rt(h,void 0,m(this,ie,"f"));let y;t=this,r=this,n=this,i=this,s=this,a=this,c=this,u=this,l=this,p=this,f=this,d=this,{options:{set value(b){B(t,W,b,"f")}}.value,configObjects:y,exitProcess:{set value(b){B(r,ar,b,"f")}}.value,groups:{set value(b){B(n,Hr,b,"f")}}.value,output:{set value(b){B(i,ft,b,"f")}}.value,exitError:{set value(b){B(s,In,b,"f")}}.value,hasOutput:{set value(b){B(a,Kt,b,"f")}}.value,parsed:this.parsed,strict:{set value(b){B(c,Si,b,"f")}}.value,strictCommands:{set value(b){B(u,Oi,b,"f")}}.value,strictOptions:{set value(b){B(l,Ei,b,"f")}}.value,completionCommand:{set value(b){B(p,Wt,b,"f")}}.value,parseFn:{set value(b){B(f,Yt,b,"f")}}.value,parseContext:{set value(b){B(d,vi,b,"f")}}.value}=h,m(this,W,"f").configObjects=y,m(this,se,"f").unfreeze(),m(this,Ke,"f").unfreeze(),m(this,tt,"f").unfreeze(),m(this,cr,"f").unfreeze()}[Yy](t,r){return gi(r,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[Qy].bind(this),getContext:this[Jy].bind(this),getHasOutput:this[Xy].bind(this),getLoggerInstance:this[eb].bind(this),getParseContext:this[tb].bind(this),getParserConfiguration:this[Pi].bind(this),getUsageConfiguration:this[Zy].bind(this),getUsageInstance:this[rb].bind(this),getValidationInstance:this[nb].bind(this),hasParseCallback:this[Ac].bind(this),isGlobalContext:this[ib].bind(this),postProcess:this[xi].bind(this),reset:this[Mf].bind(this),runValidation:this[kf].bind(this),runYargsParserAndExecuteCommands:this[Rs].bind(this),setHasOutput:this[sb].bind(this)}}[Qy](){return m(this,tt,"f")}[Jy](){return m(this,Ts,"f")}[Xy](){return m(this,Kt,"f")}[eb](){return m(this,mo,"f")}[tb](){return m(this,vi,"f")||{}}[rb](){return m(this,se,"f")}[nb](){return m(this,Ke,"f")}[Ac](){return!!m(this,Yt,"f")}[ib](){return m(this,Ec,"f")}[xi](t,r,n,i){return n||Le(t)||(r||(t=this[By](t)),(this[Pi]()["parse-positional-numbers"]||this[Pi]()["parse-positional-numbers"]===void 0)&&(t=this[Ky](t)),i&&(t=mi(t,this,m(this,cr,"f").getMiddleware(),!1))),t}[Mf](t={}){B(this,W,m(this,W,"f")||{},"f");let r={};r.local=m(this,W,"f").local||[],r.configObjects=m(this,W,"f").configObjects||[];let n={};r.local.forEach(a=>{n[a]=!0,(t[a]||[]).forEach(c=>{n[c]=!0})}),Object.assign(m(this,_i,"f"),Object.keys(m(this,Hr,"f")).reduce((a,c)=>{let u=m(this,Hr,"f")[c].filter(l=>!(l in n));return u.length>0&&(a[c]=u),a},{})),B(this,Hr,{},"f");let i=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return i.forEach(a=>{r[a]=(m(this,W,"f")[a]||[]).filter(c=>!n[c])}),s.forEach(a=>{r[a]=wn(m(this,W,"f")[a],c=>!n[c])}),r.envPrefix=m(this,W,"f").envPrefix,B(this,W,r,"f"),B(this,se,m(this,se,"f")?m(this,se,"f").reset(n):jy(this,m(this,ie,"f")),"f"),B(this,Ke,m(this,Ke,"f")?m(this,Ke,"f").reset(n):Fy(this,m(this,se,"f"),m(this,ie,"f")),"f"),B(this,tt,m(this,tt,"f")?m(this,tt,"f").reset():Ty(m(this,se,"f"),m(this,Ke,"f"),m(this,cr,"f"),m(this,ie,"f")),"f"),m(this,sr,"f")||B(this,sr,qy(this,m(this,se,"f"),m(this,tt,"f"),m(this,ie,"f")),"f"),m(this,cr,"f").reset(),B(this,Wt,null,"f"),B(this,ft,"","f"),B(this,In,null,"f"),B(this,Kt,!1,"f"),this.parsed=!1,this}[ob](t,r){return m(this,ie,"f").path.relative(t,r)}[Rs](t,r,n,i=0,s=!1){let a=!!n||s;t=t||m(this,Cn,"f"),m(this,W,"f").__=m(this,ie,"f").y18n.__,m(this,W,"f").configuration=this[Pi]();let c=!!m(this,W,"f").configuration["populate--"],u=Object.assign({},m(this,W,"f").configuration,{"populate--":!0}),l=m(this,ie,"f").Parser.detailed(t,Object.assign({},m(this,W,"f"),{configuration:{"parse-positional-numbers":!1,...u}})),p=Object.assign(l.argv,m(this,vi,"f")),f,d=l.aliases,h=!1,y=!1;Object.keys(p).forEach(b=>{b===m(this,ur,"f")&&p[b]?h=!0:b===m(this,Br,"f")&&p[b]&&(y=!0)}),p.$0=this.$0,this.parsed=l,i===0&&m(this,se,"f").clearCachedHelpMessage();try{if(this[Af](),r)return this[xi](p,c,!!n,!1);m(this,ur,"f")&&[m(this,ur,"f")].concat(d[m(this,ur,"f")]||[]).filter(C=>C.length>1).includes(""+p._[p._.length-1])&&(p._.pop(),h=!0),B(this,Ec,!1,"f");let b=m(this,tt,"f").getCommands(),g=m(this,sr,"f").completionKey in p,P=h||g||s;if(p._.length){if(b.length){let $;for(let C=i||0,T;p._[C]!==void 0;C++)if(T=String(p._[C]),b.includes(T)&&T!==m(this,Wt,"f")){let w=m(this,tt,"f").runCommand(T,this,l,C+1,s,h||y||s);return this[xi](w,c,!!n,!1)}else if(!$&&T!==m(this,Wt,"f")){$=T;break}!m(this,tt,"f").hasDefaultCommand()&&m(this,$c,"f")&&$&&!P&&m(this,Ke,"f").recommendCommands($,b)}m(this,Wt,"f")&&p._.includes(m(this,Wt,"f"))&&!g&&(m(this,ar,"f")&&An(!0),this.showCompletionScript(),this.exit(0))}if(m(this,tt,"f").hasDefaultCommand()&&!P){let $=m(this,tt,"f").runCommand(null,this,l,0,s,h||y||s);return this[xi]($,c,!!n,!1)}if(g){m(this,ar,"f")&&An(!0),t=[].concat(t);let $=t.slice(t.indexOf(`--${m(this,sr,"f").completionKey}`)+1);return m(this,sr,"f").getCompletion($,(C,T)=>{if(C)throw new De(C.message);(T||[]).forEach(w=>{m(this,mo,"f").log(w)}),this.exit(0)}),this[xi](p,!c,!!n,!1)}if(m(this,Kt,"f")||(h?(m(this,ar,"f")&&An(!0),a=!0,this.showHelp("log"),this.exit(0)):y&&(m(this,ar,"f")&&An(!0),a=!0,m(this,se,"f").showVersion("log"),this.exit(0))),!a&&m(this,W,"f").skipValidation.length>0&&(a=Object.keys(p).some($=>m(this,W,"f").skipValidation.indexOf($)>=0&&p[$]===!0)),!a){if(l.error)throw new De(l.error.message);if(!g){let $=this[kf](d,{},l.error);n||(f=mi(p,this,m(this,cr,"f").getMiddleware(),!0)),f=this[Yy]($,f??p),Le(f)&&!n&&(f=f.then(()=>mi(p,this,m(this,cr,"f").getMiddleware(),!1)))}}}catch(b){if(b instanceof De)m(this,se,"f").fail(b.message,b);else throw b}return this[xi](f??p,c,!!n,!0)}[kf](t,r,n,i){let s={...this.getDemandedOptions()};return a=>{if(n)throw new De(n.message);m(this,Ke,"f").nonOptionCount(a),m(this,Ke,"f").requiredArguments(a,s);let c=!1;m(this,Oi,"f")&&(c=m(this,Ke,"f").unknownCommands(a)),m(this,Si,"f")&&!c?m(this,Ke,"f").unknownArguments(a,t,r,!!i):m(this,Ei,"f")&&m(this,Ke,"f").unknownArguments(a,t,{},!1,!1),m(this,Ke,"f").limitedChoices(a),m(this,Ke,"f").implications(a),m(this,Ke,"f").conflicting(a)}}[sb](){B(this,Kt,!0,"f")}[$i](t){if(typeof t=="string")m(this,W,"f").key[t]=!0;else for(let r of t)m(this,W,"f").key[r]=!0}};o(Df,"YargsInstance");var qf=Df;function Ry(e){return!!e&&typeof e.getInternalMethods=="function"}o(Ry,"isYargsInstance");var Y2=ab(yf),cb=Y2;var Ns="AppRestClient",Ic={query:"AppQueryOptions",infiniteQuery:"AppInfiniteQueryOptions",mutation:"AppMutationOptions"},Lf="src/data",Ff="@/data",lr={appRestClient:{template:"@/util/rest/clients/app-rest-client",monorepoTemplate:"@/clients/app-rest-client"},queryTypes:{template:"@/types/react-query",monorepoTemplate:"@povio/utils/types/react-query"},errorHandling:{template:"@/util/vendor/error-handling",monorepoTemplate:"@povio/utils/utils/vendor/error-handling"},abilityContext:{template:"@/data/acl/ability.context",monorepoTemplate:"@povio/auth/acl/ability.context"}},Rn={ErrorHandler:"ErrorHandler",SharedErrorHandler:"SharedErrorHandler"},Cc={bindings:[Rn.ErrorHandler,Rn.SharedErrorHandler],from:lr.errorHandling.template},Hf="AbilityContext",ub={bindings:[Hf],from:lr.abilityContext.template};var Tc={reactQueryTypes:{fileName:"react-query.types",extension:"ts"},restClient:{fileName:"rest-client",extension:"ts"},restInterceptor:{fileName:"rest-interceptor",extension:"ts"}},Rc={fileName:"app-rest-client",extension:"ts"},Bf="QueryModule",Nc={fileName:"queryModules",extension:"ts"},lb={fileName:"queryConfig.context",extension:"tsx"},bo={optionsType:"MutationEffectsOptions",hookName:"useMutationEffects",runFunctionName:"runMutationEffects"},jc={fileName:"useMutationEffects",extension:"ts"},pt={namespace:"ZodUtils",exports:{parse:"parse",sortExp:"sortExp",brand:"brand"}},Mc={fileName:"zod.utils",extension:"ts"};var fb="Schema",pb="Enum",db="Body",hb="Param",mb="Response",gb="ErrorResponse",js="z.void()",kc="z.instanceof(Blob)",Ms="z.enum",qc="z.string()",vo={bindings:["z"],from:"zod"};var Pe={input:"",output:"output",splitByTags:!0,defaultTag:"Common",excludeTags:[],excludePathRegex:"",excludeRedundantZodSchemas:!0,tsNamespaces:!0,importPath:"ts",configs:{models:{outputFileNameSuffix:"models",namespaceSuffix:"Models"},endpoints:{outputFileNameSuffix:"api",namespaceSuffix:"Api"},queries:{outputFileNameSuffix:"queries",namespaceSuffix:"Queries"},acl:{outputFileNameSuffix:"acl",namespaceSuffix:"Acl"}},acl:!0,checkAcl:!0,standalone:!1,baseUrl:"",abilityContextImportPath:lr.abilityContext.template,abilityContextGenericAppAbilities:!1,schemaSuffix:fb,enumSuffix:pb,withDefaultValues:!0,extractEnums:!0,branded:!1,replaceOptionalWithNullish:!1,restClientImportPath:lr.appRestClient.template,errorHandlingImportPath:lr.errorHandling.template,removeOperationPrefixEndingWith:"Controller_",parseRequestParams:!0,queryTypesImportPath:lr.queryTypes.template,axiosRequestConfig:!1,infiniteQueries:!1,mutationEffects:!0};var yb=o((e=0)=>t=>`\x1B[${t+e}m`,"wrapAnsi16"),bb=o((e=0)=>t=>`\x1B[${38+e};5;${t}m`,"wrapAnsi256"),vb=o((e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,"wrapAnsi16m"),Ge={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},e6=Object.keys(Ge.modifier),Q2=Object.keys(Ge.color),J2=Object.keys(Ge.bgColor),t6=[...Q2,...J2];function X2(){let e=new Map;for(let[t,r]of Object.entries(Ge)){for(let[n,i]of Object.entries(r))Ge[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=Ge[n],e.set(i[0],i[1]);Object.defineProperty(Ge,t,{value:r,enumerable:!1})}return Object.defineProperty(Ge,"codes",{value:e,enumerable:!1}),Ge.color.close="\x1B[39m",Ge.bgColor.close="\x1B[49m",Ge.color.ansi=yb(),Ge.color.ansi256=bb(),Ge.color.ansi16m=vb(),Ge.bgColor.ansi=yb(10),Ge.bgColor.ansi256=bb(10),Ge.bgColor.ansi16m=vb(10),Object.defineProperties(Ge,{rgbToAnsi256:{value(t,r,n){return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(s=>s+s).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:o(t=>Ge.rgbToAnsi256(...Ge.hexToRgb(t)),"value"),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,i;if(t>=232)r=((t-232)*10+8)/255,n=r,i=r;else{t-=16;let c=t%36;r=Math.floor(t/36)/5,n=Math.floor(c/6)/5,i=c%6/5}let s=Math.max(r,n,i)*2;if(s===0)return 30;let a=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return s===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:o((t,r,n)=>Ge.ansi256ToAnsi(Ge.rgbToAnsi256(t,r,n)),"value"),enumerable:!1},hexToAnsi:{value:o(t=>Ge.ansi256ToAnsi(Ge.hexToAnsi256(t)),"value"),enumerable:!1}}),Ge}o(X2,"assembleStyles");var ew=X2(),xr=ew;var Lc=yt(require("process"),1),Sb=yt(require("os"),1),Vf=yt(require("tty"),1);function fr(e,t=globalThis.Deno?globalThis.Deno.args:Lc.default.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),i=t.indexOf("--");return n!==-1&&(i===-1||n<i)}o(fr,"hasFlag");var{env:Ze}=Lc.default,Dc;fr("no-color")||fr("no-colors")||fr("color=false")||fr("color=never")?Dc=0:(fr("color")||fr("colors")||fr("color=true")||fr("color=always"))&&(Dc=1);function tw(){if("FORCE_COLOR"in Ze)return Ze.FORCE_COLOR==="true"?1:Ze.FORCE_COLOR==="false"?0:Ze.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Ze.FORCE_COLOR,10),3)}o(tw,"envForceColor");function rw(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}o(rw,"translateLevel");function nw(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=tw();n!==void 0&&(Dc=n);let i=r?Dc:n;if(i===0)return 0;if(r){if(fr("color=16m")||fr("color=full")||fr("color=truecolor"))return 3;if(fr("color=256"))return 2}if("TF_BUILD"in Ze&&"AGENT_NAME"in Ze)return 1;if(e&&!t&&i===void 0)return 0;let s=i||0;if(Ze.TERM==="dumb")return s;if(Lc.default.platform==="win32"){let a=Sb.default.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in Ze)return"GITHUB_ACTIONS"in Ze||"GITEA_ACTIONS"in Ze?3:["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in Ze)||Ze.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in Ze)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ze.TEAMCITY_VERSION)?1:0;if(Ze.COLORTERM==="truecolor"||Ze.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in Ze){let a=Number.parseInt((Ze.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ze.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ze.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ze.TERM)||"COLORTERM"in Ze?1:s}o(nw,"_supportsColor");function _b(e,t={}){let r=nw(e,{streamIsTTY:e&&e.isTTY,...t});return rw(r)}o(_b,"createSupportsColor");var iw={stdout:_b({isTTY:Vf.default.isatty(1)}),stderr:_b({isTTY:Vf.default.isatty(2)})},Ob=iw;function Eb(e,t,r){let n=e.indexOf(t);if(n===-1)return e;let i=t.length,s=0,a="";do a+=e.slice(s,n)+t+r,s=n+i,n=e.indexOf(t,s);while(n!==-1);return a+=e.slice(s),a}o(Eb,"stringReplaceAll");function Pb(e,t,r,n){let i=0,s="";do{let a=e[n-1]==="\r";s+=e.slice(i,a?n-1:n)+t+(a?`\r
|
|
136
|
+
`,"f"),B(this,ft,m(this,ft,"f")+t.join(" "),"f")},"error")}}[wf](t){po(m(this,W,"f")).forEach(r=>{if((i=>i==="configObjects")(r))return;let n=m(this,W,"f")[r];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete m(this,se,"f").getDescriptions()[t]}[Uy](t,r,n){m(this,Sc,"f")[n]||(m(this,ie,"f").process.emitWarning(t,r),m(this,Sc,"f")[n]=!0)}[Gy](){m(this,Oc,"f").push({options:m(this,W,"f"),configObjects:m(this,W,"f").configObjects.slice(0),exitProcess:m(this,ar,"f"),groups:m(this,Hr,"f"),strict:m(this,Si,"f"),strictCommands:m(this,Oi,"f"),strictOptions:m(this,Ei,"f"),completionCommand:m(this,Wt,"f"),output:m(this,ft,"f"),exitError:m(this,In,"f"),hasOutput:m(this,Kt,"f"),parsed:this.parsed,parseFn:m(this,Yt,"f"),parseContext:m(this,vi,"f")}),m(this,se,"f").freeze(),m(this,Ke,"f").freeze(),m(this,tt,"f").freeze(),m(this,cr,"f").freeze()}[zy](){let t="",r;return/\b(node|iojs|electron)(\.exe)?$/.test(m(this,ie,"f").process.argv()[0])?r=m(this,ie,"f").process.argv().slice(1,2):r=m(this,ie,"f").process.argv().slice(0,1),t=r.map(n=>{let i=this[ob](m(this,yi,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&i.length<n.length?i:n}).join(" ").trim(),m(this,ie,"f").getEnv("_")&&m(this,ie,"f").getProcessArgvBin()===m(this,ie,"f").getEnv("_")&&(t=m(this,ie,"f").getEnv("_").replace(`${m(this,ie,"f").path.dirname(m(this,ie,"f").process.execPath())}/`,"")),t}[Pi](){return m(this,xc,"f")}[Zy](){return m(this,wc,"f")}[Af](){if(!m(this,bi,"f"))return;let t=m(this,ie,"f").getEnv("LC_ALL")||m(this,ie,"f").getEnv("LC_MESSAGES")||m(this,ie,"f").getEnv("LANG")||m(this,ie,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Wy](){return this[If]().version||"unknown"}[Ky](t){let r=t["--"]?t["--"]:t._;for(let n=0,i;(i=r[n])!==void 0;n++)m(this,ie,"f").Parser.looksLikeNumber(i)&&Number.isSafeInteger(Math.floor(parseFloat(`${i}`)))&&(r[n]=Number(i));return t}[If](t){let r=t||"*";if(m(this,go,"f")[r])return m(this,go,"f")[r];let n={};try{let i=t||m(this,ie,"f").mainFilename;!t&&m(this,ie,"f").path.extname(i)&&(i=m(this,ie,"f").path.dirname(i));let s=m(this,ie,"f").findUp(i,(a,c)=>{if(c.includes("package.json"))return"package.json"});Rt(s,void 0,m(this,ie,"f")),n=JSON.parse(m(this,ie,"f").readFileSync(s,"utf8"))}catch{}return m(this,go,"f")[r]=n||{},m(this,go,"f")[r]}[Tn](t,r){r=[].concat(r),r.forEach(n=>{n=this[Rf](n),m(this,W,"f")[t].push(n)})}[yo](t,r,n,i){this[Tf](t,r,n,i,(s,a,c)=>{m(this,W,"f")[s][a]=c})}[Cf](t,r,n,i){this[Tf](t,r,n,i,(s,a,c)=>{m(this,W,"f")[s][a]=(m(this,W,"f")[s][a]||[]).concat(c)})}[Tf](t,r,n,i,s){if(Array.isArray(n))n.forEach(a=>{t(a,i)});else if((a=>typeof a=="object")(n))for(let a of po(n))t(a,n[a]);else s(r,this[Rf](n),i)}[Rf](t){return t==="__proto__"?"___proto___":t}[Nf](t,r){return this[yo](this[Nf].bind(this),"key",t,r),this}[jf](){var t,r,n,i,s,a,c,u,l,p,f,d;let h=m(this,Oc,"f").pop();Rt(h,void 0,m(this,ie,"f"));let y;t=this,r=this,n=this,i=this,s=this,a=this,c=this,u=this,l=this,p=this,f=this,d=this,{options:{set value(b){B(t,W,b,"f")}}.value,configObjects:y,exitProcess:{set value(b){B(r,ar,b,"f")}}.value,groups:{set value(b){B(n,Hr,b,"f")}}.value,output:{set value(b){B(i,ft,b,"f")}}.value,exitError:{set value(b){B(s,In,b,"f")}}.value,hasOutput:{set value(b){B(a,Kt,b,"f")}}.value,parsed:this.parsed,strict:{set value(b){B(c,Si,b,"f")}}.value,strictCommands:{set value(b){B(u,Oi,b,"f")}}.value,strictOptions:{set value(b){B(l,Ei,b,"f")}}.value,completionCommand:{set value(b){B(p,Wt,b,"f")}}.value,parseFn:{set value(b){B(f,Yt,b,"f")}}.value,parseContext:{set value(b){B(d,vi,b,"f")}}.value}=h,m(this,W,"f").configObjects=y,m(this,se,"f").unfreeze(),m(this,Ke,"f").unfreeze(),m(this,tt,"f").unfreeze(),m(this,cr,"f").unfreeze()}[Yy](t,r){return gi(r,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[Qy].bind(this),getContext:this[Jy].bind(this),getHasOutput:this[Xy].bind(this),getLoggerInstance:this[eb].bind(this),getParseContext:this[tb].bind(this),getParserConfiguration:this[Pi].bind(this),getUsageConfiguration:this[Zy].bind(this),getUsageInstance:this[rb].bind(this),getValidationInstance:this[nb].bind(this),hasParseCallback:this[Ac].bind(this),isGlobalContext:this[ib].bind(this),postProcess:this[xi].bind(this),reset:this[Mf].bind(this),runValidation:this[kf].bind(this),runYargsParserAndExecuteCommands:this[Rs].bind(this),setHasOutput:this[sb].bind(this)}}[Qy](){return m(this,tt,"f")}[Jy](){return m(this,Ts,"f")}[Xy](){return m(this,Kt,"f")}[eb](){return m(this,mo,"f")}[tb](){return m(this,vi,"f")||{}}[rb](){return m(this,se,"f")}[nb](){return m(this,Ke,"f")}[Ac](){return!!m(this,Yt,"f")}[ib](){return m(this,Ec,"f")}[xi](t,r,n,i){return n||Le(t)||(r||(t=this[By](t)),(this[Pi]()["parse-positional-numbers"]||this[Pi]()["parse-positional-numbers"]===void 0)&&(t=this[Ky](t)),i&&(t=mi(t,this,m(this,cr,"f").getMiddleware(),!1))),t}[Mf](t={}){B(this,W,m(this,W,"f")||{},"f");let r={};r.local=m(this,W,"f").local||[],r.configObjects=m(this,W,"f").configObjects||[];let n={};r.local.forEach(a=>{n[a]=!0,(t[a]||[]).forEach(c=>{n[c]=!0})}),Object.assign(m(this,_i,"f"),Object.keys(m(this,Hr,"f")).reduce((a,c)=>{let u=m(this,Hr,"f")[c].filter(l=>!(l in n));return u.length>0&&(a[c]=u),a},{})),B(this,Hr,{},"f");let i=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return i.forEach(a=>{r[a]=(m(this,W,"f")[a]||[]).filter(c=>!n[c])}),s.forEach(a=>{r[a]=wn(m(this,W,"f")[a],c=>!n[c])}),r.envPrefix=m(this,W,"f").envPrefix,B(this,W,r,"f"),B(this,se,m(this,se,"f")?m(this,se,"f").reset(n):jy(this,m(this,ie,"f")),"f"),B(this,Ke,m(this,Ke,"f")?m(this,Ke,"f").reset(n):Fy(this,m(this,se,"f"),m(this,ie,"f")),"f"),B(this,tt,m(this,tt,"f")?m(this,tt,"f").reset():Ty(m(this,se,"f"),m(this,Ke,"f"),m(this,cr,"f"),m(this,ie,"f")),"f"),m(this,sr,"f")||B(this,sr,qy(this,m(this,se,"f"),m(this,tt,"f"),m(this,ie,"f")),"f"),m(this,cr,"f").reset(),B(this,Wt,null,"f"),B(this,ft,"","f"),B(this,In,null,"f"),B(this,Kt,!1,"f"),this.parsed=!1,this}[ob](t,r){return m(this,ie,"f").path.relative(t,r)}[Rs](t,r,n,i=0,s=!1){let a=!!n||s;t=t||m(this,Cn,"f"),m(this,W,"f").__=m(this,ie,"f").y18n.__,m(this,W,"f").configuration=this[Pi]();let c=!!m(this,W,"f").configuration["populate--"],u=Object.assign({},m(this,W,"f").configuration,{"populate--":!0}),l=m(this,ie,"f").Parser.detailed(t,Object.assign({},m(this,W,"f"),{configuration:{"parse-positional-numbers":!1,...u}})),p=Object.assign(l.argv,m(this,vi,"f")),f,d=l.aliases,h=!1,y=!1;Object.keys(p).forEach(b=>{b===m(this,ur,"f")&&p[b]?h=!0:b===m(this,Br,"f")&&p[b]&&(y=!0)}),p.$0=this.$0,this.parsed=l,i===0&&m(this,se,"f").clearCachedHelpMessage();try{if(this[Af](),r)return this[xi](p,c,!!n,!1);m(this,ur,"f")&&[m(this,ur,"f")].concat(d[m(this,ur,"f")]||[]).filter(C=>C.length>1).includes(""+p._[p._.length-1])&&(p._.pop(),h=!0),B(this,Ec,!1,"f");let b=m(this,tt,"f").getCommands(),g=m(this,sr,"f").completionKey in p,P=h||g||s;if(p._.length){if(b.length){let $;for(let C=i||0,T;p._[C]!==void 0;C++)if(T=String(p._[C]),b.includes(T)&&T!==m(this,Wt,"f")){let w=m(this,tt,"f").runCommand(T,this,l,C+1,s,h||y||s);return this[xi](w,c,!!n,!1)}else if(!$&&T!==m(this,Wt,"f")){$=T;break}!m(this,tt,"f").hasDefaultCommand()&&m(this,$c,"f")&&$&&!P&&m(this,Ke,"f").recommendCommands($,b)}m(this,Wt,"f")&&p._.includes(m(this,Wt,"f"))&&!g&&(m(this,ar,"f")&&An(!0),this.showCompletionScript(),this.exit(0))}if(m(this,tt,"f").hasDefaultCommand()&&!P){let $=m(this,tt,"f").runCommand(null,this,l,0,s,h||y||s);return this[xi]($,c,!!n,!1)}if(g){m(this,ar,"f")&&An(!0),t=[].concat(t);let $=t.slice(t.indexOf(`--${m(this,sr,"f").completionKey}`)+1);return m(this,sr,"f").getCompletion($,(C,T)=>{if(C)throw new De(C.message);(T||[]).forEach(w=>{m(this,mo,"f").log(w)}),this.exit(0)}),this[xi](p,!c,!!n,!1)}if(m(this,Kt,"f")||(h?(m(this,ar,"f")&&An(!0),a=!0,this.showHelp("log"),this.exit(0)):y&&(m(this,ar,"f")&&An(!0),a=!0,m(this,se,"f").showVersion("log"),this.exit(0))),!a&&m(this,W,"f").skipValidation.length>0&&(a=Object.keys(p).some($=>m(this,W,"f").skipValidation.indexOf($)>=0&&p[$]===!0)),!a){if(l.error)throw new De(l.error.message);if(!g){let $=this[kf](d,{},l.error);n||(f=mi(p,this,m(this,cr,"f").getMiddleware(),!0)),f=this[Yy]($,f??p),Le(f)&&!n&&(f=f.then(()=>mi(p,this,m(this,cr,"f").getMiddleware(),!1)))}}}catch(b){if(b instanceof De)m(this,se,"f").fail(b.message,b);else throw b}return this[xi](f??p,c,!!n,!0)}[kf](t,r,n,i){let s={...this.getDemandedOptions()};return a=>{if(n)throw new De(n.message);m(this,Ke,"f").nonOptionCount(a),m(this,Ke,"f").requiredArguments(a,s);let c=!1;m(this,Oi,"f")&&(c=m(this,Ke,"f").unknownCommands(a)),m(this,Si,"f")&&!c?m(this,Ke,"f").unknownArguments(a,t,r,!!i):m(this,Ei,"f")&&m(this,Ke,"f").unknownArguments(a,t,{},!1,!1),m(this,Ke,"f").limitedChoices(a),m(this,Ke,"f").implications(a),m(this,Ke,"f").conflicting(a)}}[sb](){B(this,Kt,!0,"f")}[$i](t){if(typeof t=="string")m(this,W,"f").key[t]=!0;else for(let r of t)m(this,W,"f").key[r]=!0}};o(Df,"YargsInstance");var qf=Df;function Ry(e){return!!e&&typeof e.getInternalMethods=="function"}o(Ry,"isYargsInstance");var Y2=ab(yf),cb=Y2;var Ns="AppRestClient",Ic={query:"AppQueryOptions",infiniteQuery:"AppInfiniteQueryOptions",mutation:"AppMutationOptions"},Lf="src/data",Ff="@/data",lr={appRestClient:{template:"@/util/rest/clients/app-rest-client",monorepoTemplate:"@/clients/app-rest-client"},queryTypes:{template:"@/types/react-query",monorepoTemplate:"@povio/utils/types/react-query"},errorHandling:{template:"@/util/vendor/error-handling",monorepoTemplate:"@povio/utils/utils/vendor/error-handling"},abilityContext:{template:"@/data/acl/ability.context",monorepoTemplate:"@povio/auth/acl/ability.context"}},Rn={ErrorHandler:"ErrorHandler",SharedErrorHandler:"SharedErrorHandler"},Cc={bindings:[Rn.ErrorHandler,Rn.SharedErrorHandler],from:lr.errorHandling.template},Hf="AbilityContext",ub={bindings:[Hf],from:lr.abilityContext.template};var Tc={reactQueryTypes:{fileName:"react-query.types",extension:"ts"},restClient:{fileName:"rest-client",extension:"ts"},restInterceptor:{fileName:"rest-interceptor",extension:"ts"}},Rc={fileName:"app-rest-client",extension:"ts"},Bf="QueryModule",Nc={fileName:"queryModules",extension:"ts"},lb={fileName:"queryConfig.context",extension:"tsx"},bo={optionsType:"MutationEffectsOptions",hookName:"useMutationEffects",runFunctionName:"runMutationEffects"},jc={fileName:"useMutationEffects",extension:"ts"},pt={namespace:"ZodUtils",exports:{parse:"parse",sortExp:"sortExp",brand:"brand"}},Mc={fileName:"zod.utils",extension:"ts"};var fb="Schema",pb="Enum",db="Body",hb="Param",mb="Response",gb="ErrorResponse",js="z.void()",kc="z.instanceof(Blob)",Ms="z.enum",qc="z.string()",vo={bindings:["z"],from:"zod"};var Pe={input:"",output:"output",splitByTags:!0,defaultTag:"Common",excludeTags:[],excludePathRegex:"",excludeRedundantZodSchemas:!0,tsNamespaces:!0,importPath:"ts",configs:{models:{outputFileNameSuffix:"models",namespaceSuffix:"Models"},endpoints:{outputFileNameSuffix:"api",namespaceSuffix:"Api"},queries:{outputFileNameSuffix:"queries",namespaceSuffix:"Queries"},acl:{outputFileNameSuffix:"acl",namespaceSuffix:"Acl"}},acl:!0,checkAcl:!0,standalone:!1,baseUrl:"",abilityContextImportPath:lr.abilityContext.template,abilityContextGenericAppAbilities:!1,schemaSuffix:fb,enumSuffix:pb,withDefaultValues:!0,extractEnums:!0,branded:!0,replaceOptionalWithNullish:!1,restClientImportPath:lr.appRestClient.template,errorHandlingImportPath:lr.errorHandling.template,removeOperationPrefixEndingWith:"Controller_",parseRequestParams:!0,queryTypesImportPath:lr.queryTypes.template,axiosRequestConfig:!1,infiniteQueries:!1,mutationEffects:!0};var yb=o((e=0)=>t=>`\x1B[${t+e}m`,"wrapAnsi16"),bb=o((e=0)=>t=>`\x1B[${38+e};5;${t}m`,"wrapAnsi256"),vb=o((e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,"wrapAnsi16m"),Ge={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},e6=Object.keys(Ge.modifier),Q2=Object.keys(Ge.color),J2=Object.keys(Ge.bgColor),t6=[...Q2,...J2];function X2(){let e=new Map;for(let[t,r]of Object.entries(Ge)){for(let[n,i]of Object.entries(r))Ge[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=Ge[n],e.set(i[0],i[1]);Object.defineProperty(Ge,t,{value:r,enumerable:!1})}return Object.defineProperty(Ge,"codes",{value:e,enumerable:!1}),Ge.color.close="\x1B[39m",Ge.bgColor.close="\x1B[49m",Ge.color.ansi=yb(),Ge.color.ansi256=bb(),Ge.color.ansi16m=vb(),Ge.bgColor.ansi=yb(10),Ge.bgColor.ansi256=bb(10),Ge.bgColor.ansi16m=vb(10),Object.defineProperties(Ge,{rgbToAnsi256:{value(t,r,n){return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(s=>s+s).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:o(t=>Ge.rgbToAnsi256(...Ge.hexToRgb(t)),"value"),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,i;if(t>=232)r=((t-232)*10+8)/255,n=r,i=r;else{t-=16;let c=t%36;r=Math.floor(t/36)/5,n=Math.floor(c/6)/5,i=c%6/5}let s=Math.max(r,n,i)*2;if(s===0)return 30;let a=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return s===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:o((t,r,n)=>Ge.ansi256ToAnsi(Ge.rgbToAnsi256(t,r,n)),"value"),enumerable:!1},hexToAnsi:{value:o(t=>Ge.ansi256ToAnsi(Ge.hexToAnsi256(t)),"value"),enumerable:!1}}),Ge}o(X2,"assembleStyles");var ew=X2(),xr=ew;var Lc=yt(require("process"),1),Sb=yt(require("os"),1),Vf=yt(require("tty"),1);function fr(e,t=globalThis.Deno?globalThis.Deno.args:Lc.default.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),i=t.indexOf("--");return n!==-1&&(i===-1||n<i)}o(fr,"hasFlag");var{env:Ze}=Lc.default,Dc;fr("no-color")||fr("no-colors")||fr("color=false")||fr("color=never")?Dc=0:(fr("color")||fr("colors")||fr("color=true")||fr("color=always"))&&(Dc=1);function tw(){if("FORCE_COLOR"in Ze)return Ze.FORCE_COLOR==="true"?1:Ze.FORCE_COLOR==="false"?0:Ze.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Ze.FORCE_COLOR,10),3)}o(tw,"envForceColor");function rw(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}o(rw,"translateLevel");function nw(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=tw();n!==void 0&&(Dc=n);let i=r?Dc:n;if(i===0)return 0;if(r){if(fr("color=16m")||fr("color=full")||fr("color=truecolor"))return 3;if(fr("color=256"))return 2}if("TF_BUILD"in Ze&&"AGENT_NAME"in Ze)return 1;if(e&&!t&&i===void 0)return 0;let s=i||0;if(Ze.TERM==="dumb")return s;if(Lc.default.platform==="win32"){let a=Sb.default.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in Ze)return"GITHUB_ACTIONS"in Ze||"GITEA_ACTIONS"in Ze?3:["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in Ze)||Ze.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in Ze)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ze.TEAMCITY_VERSION)?1:0;if(Ze.COLORTERM==="truecolor"||Ze.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in Ze){let a=Number.parseInt((Ze.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ze.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ze.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ze.TERM)||"COLORTERM"in Ze?1:s}o(nw,"_supportsColor");function _b(e,t={}){let r=nw(e,{streamIsTTY:e&&e.isTTY,...t});return rw(r)}o(_b,"createSupportsColor");var iw={stdout:_b({isTTY:Vf.default.isatty(1)}),stderr:_b({isTTY:Vf.default.isatty(2)})},Ob=iw;function Eb(e,t,r){let n=e.indexOf(t);if(n===-1)return e;let i=t.length,s=0,a="";do a+=e.slice(s,n)+t+r,s=n+i,n=e.indexOf(t,s);while(n!==-1);return a+=e.slice(s),a}o(Eb,"stringReplaceAll");function Pb(e,t,r,n){let i=0,s="";do{let a=e[n-1]==="\r";s+=e.slice(i,a?n-1:n)+t+(a?`\r
|
|
137
137
|
`:`
|
|
138
138
|
`)+r,i=n+1,n=e.indexOf(`
|
|
139
139
|
`,i)}while(n!==-1);return s+=e.slice(i),s}o(Pb,"stringEncaseCRLFWithFirstIndex");var{stdout:xb,stderr:$b}=Ob,Uf=Symbol("GENERATOR"),_o=Symbol("STYLER"),ks=Symbol("IS_EMPTY"),wb=["ansi","ansi","ansi256","ansi16m"],So=Object.create(null),ow=o((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=xb?xb.level:0;e.level=t.level===void 0?r:t.level},"applyOptions"),Zf=class Zf{constructor(t){return Ab(t)}};o(Zf,"Chalk");var Fc=Zf,Ab=o(e=>{let t=o((...r)=>r.join(" "),"chalk");return ow(t,e),Object.setPrototypeOf(t,qs.prototype),t},"chalkFactory");function qs(e){return Ab(e)}o(qs,"createChalk");Object.setPrototypeOf(qs.prototype,Function.prototype);for(let[e,t]of Object.entries(xr))So[e]={get(){let r=Hc(this,zf(t.open,t.close,this[_o]),this[ks]);return Object.defineProperty(this,e,{value:r}),r}};So.visible={get(){let e=Hc(this,this[_o],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var Gf=o((e,t,r,...n)=>e==="rgb"?t==="ansi16m"?xr[r].ansi16m(...n):t==="ansi256"?xr[r].ansi256(xr.rgbToAnsi256(...n)):xr[r].ansi(xr.rgbToAnsi(...n)):e==="hex"?Gf("rgb",t,r,...xr.hexToRgb(...n)):xr[r][e](...n),"getModelAnsi"),sw=["rgb","hex","ansi256"];for(let e of sw){So[e]={get(){let{level:r}=this;return function(...n){let i=zf(Gf(e,wb[r],"color",...n),xr.color.close,this[_o]);return Hc(this,i,this[ks])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);So[t]={get(){let{level:r}=this;return function(...n){let i=zf(Gf(e,wb[r],"bgColor",...n),xr.bgColor.close,this[_o]);return Hc(this,i,this[ks])}}}}var aw=Object.defineProperties(()=>{},{...So,level:{enumerable:!0,get(){return this[Uf].level},set(e){this[Uf].level=e}}}),zf=o((e,t,r)=>{let n,i;return r===void 0?(n=e,i=t):(n=r.openAll+e,i=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:i,parent:r}},"createStyler"),Hc=o((e,t,r)=>{let n=o((...i)=>cw(n,i.length===1?""+i[0]:i.join(" ")),"builder");return Object.setPrototypeOf(n,aw),n[Uf]=e,n[_o]=t,n[ks]=r,n},"createBuilder"),cw=o((e,t)=>{if(e.level<=0||!t)return e[ks]?"":t;let r=e[_o];if(r===void 0)return t;let{openAll:n,closeAll:i}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=Eb(t,r.close,r.open),r=r.parent;let s=t.indexOf(`
|
|
140
|
-
`);return s!==-1&&(t=Pb(t,i,n,s)),n+t+i},"applyStyle");Object.defineProperties(qs.prototype,So);var f6=qs(),p6=qs({level:$b?$b.level:0});var Vr=new Fc;function Ds(e,t,r){console.log(r!==void 0&&r!==t?`${Vr.yellow(`${e}:`.padEnd(20))}${Vr.magenta(t)}`:`${`${e}:`.padEnd(20)}${t}`)}o(Ds,"logVariable");function pr(e){console.log(`[INFO] ${e}`)}o(pr,"logInfo");function Nn(e){console.log(Vr.green(`[SUCCESS] ${e}`))}o(Nn,"logSuccess");function Ls(e,t){e instanceof Error?(console.log(Vr.red(`[ERROR] ${t||e.message}`)),process.env.VERBOSE&&console.error(e)):console.log(Vr.red(`[ERROR] ${e}`))}o(Ls,"logError");function Bc(e){console.log(Vr.bgYellow(`==== ${e} ====`))}o(Bc,"logBanner");var Ib=yt(require("fs"));function Oo(){return"0.14.6"}o(Oo,"getVersion");var x6=yt(Tb());var Wf=Symbol("options_key");function Oe(e){return(t,r)=>{var n,i;if(e!=null){let s={...Reflect.getMetadata(Wf,t)||{},[r]:{...e,describe:e.envAlias?`${e.describe||""} [${e.envAlias}]`:e.describe,type:e.type||((i=(n=Reflect.getMetadata("design:type",t,r))==null?void 0:n.name)==null?void 0:i.toLowerCase())}};Reflect.defineMetadata(Wf,s,t)}}}o(Oe,"YargOption");function Rb(e){let t=Reflect.getMetadata(Wf,e.prototype);if(!t)throw new Error(`Options for ${e.name} were not defined`);return t}o(Rb,"getYargsOption");function Vc(e){return async t=>t.options(uw(e)).middleware(async r=>await lw(e,r),!0)}o(Vc,"getBuilder");function uw(e){return Object.entries(Rb(e)).reduce((t,[r,n])=>(t[r]=Object.fromEntries(Object.entries(n).filter(([i])=>!["envAlias","default"].includes(i))),t),{})}o(uw,"getYargsOptions");async function lw(e,t){let r=new e;for(let[n,i]of Object.entries(Rb(e)))r[n]=t[n]??i.default;return r}o(lw,"loadYargsConfig");var Hx=yt(Dm());var aP={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",300:"Ambiguous",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I Am a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",424:"Failed Dependency",428:"Precondition Required",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported"},cP={"invalid-schema":"Invalid OpenAPI Schemas","invalid-operation-id":"Invalid Operation IDs","missing-path-parameter":"Missing Path Parameters","not-allowed-inline-enum":"Not Allowed Inline Enums","not-allowed-circular-schema":"Not Allowed Circular Schemas","missing-acl-condition-property":"Missing x-acl Condition Properties","missing-status-code":"Missing HTTP Status Codes","invalid-status-code":"Invalid HTTP Status Codes","multiple-success-status-codes":"Multiple Success HTTP Status Codes"};var qr={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation"},uP={bindings:[qr.query,qr.infiniteQuery,qr.mutation],from:"@tanstack/react-query"},Ca={pageParamName:"page"},Ku={pageParamName:"page",totalItemsName:"totalItems",limitParamName:"limit"},Ta="moduleName";var Lm={"Content-Type":"application/json",Accept:"application/json"},Yu="data",Fm="axios",Yn="config",en="AxiosRequestConfig",Qu={defaultImport:Fm,bindings:[en],from:"axios"};var lP=o(e=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(e),"isValidPropertyName"),Qn=o(e=>e.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"invalidVariableNameCharactersToCamel");function we(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"$ref")}o(we,"isReferenceObject");function ot(e){return!we(e)}o(ot,"isSchemaObject");function Ju(e){return e.type==="array"}o(Ju,"isArraySchemaObject");function fP(e){if(!e.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[t,r]=e.allOf.reduce((i,s)=>{if(oD(s)){let a=s.required;i[0].push(...a??[])}else i[1].push(s);return i},[[],[]]),n={properties:t.reduce((i,s)=>(i[s]={},i),{}),type:"object",required:t};return{noRequiredOnlyAllof:r,composedRequiredSchema:n,patchRequiredSchemaInLoop:o((i,s)=>{if(we(i)){let a=s(i.$ref);a&&n.required.forEach(c=>{var u;n.properties[c]=((u=a==null?void 0:a.properties)==null?void 0:u[c])??{}})}else{let a=i.properties??{};n.required.forEach(c=>{a[c]&&(n.properties[c]=a[c]??{})})}},"patchRequiredSchemaInLoop")}}o(fP,"inferRequiredSchema");var oD=o(e=>!we(e)&&!!e.required&&!e.type&&!e.properties&&!(e!=null&&e.allOf)&&!(e!=null&&e.anyOf)&&!e.oneOf,"isBrokenAllOfItem");var _n=Symbol.for("@ts-pattern/matcher"),sD=Symbol.for("@ts-pattern/isVariadic"),el="@ts-pattern/anonymous-select-key",Hm=o(e=>!!(e&&typeof e=="object"),"r"),Xu=o(e=>e&&!!e[_n],"i"),nn=o((e,t,r)=>{if(Xu(e)){let n=e[_n](),{matched:i,selections:s}=n.match(t);return i&&s&&Object.keys(s).forEach(a=>r(a,s[a])),i}if(Hm(e)){if(!Hm(t))return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=[],i=[],s=[];for(let a of e.keys()){let c=e[a];Xu(c)&&c[sD]?s.push(c):s.length?i.push(c):n.push(c)}if(s.length){if(s.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<n.length+i.length)return!1;let a=t.slice(0,n.length),c=i.length===0?[]:t.slice(-i.length),u=t.slice(n.length,i.length===0?1/0:-i.length);return n.every((l,p)=>nn(l,a[p],r))&&i.every((l,p)=>nn(l,c[p],r))&&(s.length===0||nn(s[0],u,r))}return e.length===t.length&&e.every((a,c)=>nn(a,t[c],r))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in t||Xu(s=i)&&s[_n]().matcherType==="optional")&&nn(i,t[n],r);var s})}return Object.is(t,e)},"s"),ri=o(e=>{var t,r,n;return Hm(e)?Xu(e)?(t=(r=(n=e[_n]()).getSelectionKeys)==null?void 0:r.call(n))!=null?t:[]:Array.isArray(e)?Na(e,ri):Na(Object.values(e),ri):[]},"o"),Na=o((e,t)=>e.reduce((r,n)=>r.concat(t(n)),[]),"c");function br(e){return Object.assign(e,{optional:o(()=>aD(e),"optional"),and:o(t=>ze(e,t),"and"),or:o(t=>cD(e,t),"or"),select:o(t=>t===void 0?pP(e):pP(t,e),"select")})}o(br,"u");function aD(e){return br({[_n]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return t===void 0?(ri(e).forEach(i=>n(i,void 0)),{matched:!0,selections:r}):{matched:nn(e,t,n),selections:r}},"match"),getSelectionKeys:o(()=>ri(e),"getSelectionKeys"),matcherType:"optional"})})}o(aD,"h");function ze(...e){return br({[_n]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return{matched:e.every(i=>nn(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>Na(e,ri),"getSelectionKeys"),matcherType:"and"})})}o(ze,"m");function cD(...e){return br({[_n]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return Na(e,ri).forEach(i=>n(i,void 0)),{matched:e.some(i=>nn(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>Na(e,ri),"getSelectionKeys"),matcherType:"or"})})}o(cD,"d");function xe(e){return{[_n]:()=>({match:o(t=>({matched:!!e(t)}),"match")})}}o(xe,"p");function pP(...e){let t=typeof e[0]=="string"?e[0]:void 0,r=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return br({[_n]:()=>({match:o(n=>{let i={[t??el]:n};return{matched:r===void 0||nn(r,n,(s,a)=>{i[s]=a}),selections:i}},"match"),getSelectionKeys:o(()=>[t??el].concat(r===void 0?[]:ri(r)),"getSelectionKeys")})})}o(pP,"y");function tn(e){return typeof e=="number"}o(tn,"v");function Jn(e){return typeof e=="string"}o(Jn,"b");function Xn(e){return typeof e=="bigint"}o(Xn,"w");var VU=br(xe(function(e){return!0}));var ei=o(e=>Object.assign(br(e),{startsWith:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&n.startsWith(r)))));var r},"startsWith"),endsWith:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&n.endsWith(r)))));var r},"endsWith"),minLength:o(t=>ei(ze(e,(r=>xe(n=>Jn(n)&&n.length>=r))(t))),"minLength"),length:o(t=>ei(ze(e,(r=>xe(n=>Jn(n)&&n.length===r))(t))),"length"),maxLength:o(t=>ei(ze(e,(r=>xe(n=>Jn(n)&&n.length<=r))(t))),"maxLength"),includes:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&n.includes(r)))));var r},"includes"),regex:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&!!n.match(r)))));var r},"regex")}),"j"),UU=ei(xe(Jn)),rn=o(e=>Object.assign(br(e),{between:o((t,r)=>rn(ze(e,((n,i)=>xe(s=>tn(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n<r))(t))),"lt"),gt:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n>r))(t))),"gt"),lte:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n<=r))(t))),"lte"),gte:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n>=r))(t))),"gte"),int:o(()=>rn(ze(e,xe(t=>tn(t)&&Number.isInteger(t)))),"int"),finite:o(()=>rn(ze(e,xe(t=>tn(t)&&Number.isFinite(t)))),"finite"),positive:o(()=>rn(ze(e,xe(t=>tn(t)&&t>0))),"positive"),negative:o(()=>rn(ze(e,xe(t=>tn(t)&&t<0))),"negative")}),"x"),GU=rn(xe(tn)),ti=o(e=>Object.assign(br(e),{between:o((t,r)=>ti(ze(e,((n,i)=>xe(s=>Xn(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n<r))(t))),"lt"),gt:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n>r))(t))),"gt"),lte:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n<=r))(t))),"lte"),gte:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n>=r))(t))),"gte"),positive:o(()=>ti(ze(e,xe(t=>Xn(t)&&t>0))),"positive"),negative:o(()=>ti(ze(e,xe(t=>Xn(t)&&t<0))),"negative")}),"A"),zU=ti(xe(Xn)),ZU=br(xe(function(e){return typeof e=="boolean"})),WU=br(xe(function(e){return typeof e=="symbol"})),KU=br(xe(function(e){return e==null})),YU=br(xe(function(e){return e!=null}));var Gm=class Gm extends Error{constructor(t){let r;try{r=JSON.stringify(t)}catch{r=t}super(`Pattern matching error: no pattern matches value ${r}`),this.input=void 0,this.input=t}};o(Gm,"W");var Bm=Gm,Vm={matched:!1,value:void 0};function At(e){return new Um(e,Vm)}o(At,"z");var Ra=class Ra{constructor(t,r){this.input=void 0,this.state=void 0,this.input=t,this.state=r}with(...t){if(this.state.matched)return this;let r=t[t.length-1],n=[t[0]],i;t.length===3&&typeof t[1]=="function"?i=t[1]:t.length>2&&n.push(...t.slice(1,t.length-1));let s=!1,a={},c=o((l,p)=>{s=!0,a[l]=p},"a"),u=!n.some(l=>nn(l,this.input,c))||i&&!i(this.input)?Vm:{matched:!0,value:r(s?el in a?a[el]:a:this.input,this.input)};return new Ra(this.input,u)}when(t,r){if(this.state.matched)return this;let n=!!t(this.input);return new Ra(this.input,n?{matched:!0,value:r(this.input,this.input)}:Vm)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Bm(this.input)}run(){return this.exhaustive()}returnType(){return this}};o(Ra,"I");var Um=Ra;var zm=2,dP=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],hP=["query","header","path"],Wi=["get","put","post","delete","options","head","patch","trace"],mP=["string","number","integer","boolean"],ja=["allOf","anyOf","oneOf"];var Te=o(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalize"),ni=o(e=>e.charAt(0).toLowerCase()+e.slice(1),"decapitalize"),gP=o(e=>e.replace(/(-\w)/g,t=>t[1].toUpperCase()),"kebabToCamel"),ht=o(e=>e.replace(/(_\w)/g,t=>t[1].toUpperCase()),"snakeToCamel"),yP=o(e=>e.replace(/[\W_]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"nonWordCharactersToCamel"),Zm=o((e,t="")=>e.endsWith(t)?e:`${e}${t}`,"suffixIfNeeded"),bP=o((e,t)=>e.replace(new RegExp(`${t}$`),""),"removeSuffix"),uD=o(e=>{var n;let t=e.reduce((i,s)=>({...i,[s]:(i[s]??0)+1}),{});return(n=Object.entries(t).sort((i,s)=>i[1]===s[1]?s[0].length-i[0].length:s[1]-i[1])[0])==null?void 0:n[0]},"getLongestMostCommon"),Wm=o(e=>{let t=e.map(Te).map(vP).map(r=>lD(r)).flat();return uD(t)},"getMostCommonAdjacentCombinationSplit"),vP=o(e=>e.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),_P=o(e=>vP(e).join(" "),"camelToSpaceSeparated"),lD=o((e,t=["dto","by","for","of","in","to","and","with"])=>{var n;let r=[];for(let i=0;i<e.length;i++)if(!t.includes(e[i].toLowerCase()))for(let s=i+1;s<=e.length;s++)t.includes((n=e[s-1])==null?void 0:n.toLowerCase())||r.push(e.slice(i,s).join(""));return r},"getAdjacentStringCombinations"),SP=o((e,t)=>{let r=t.replace(/es$|s$/g,""),n=new RegExp(`(${ni(r)}|${Te(r)})[a-z]*(?=$|[A-Z])`,"g");return e.replace(n,"")},"removeWord");var EP=o(e=>`#/components/schemas/${e}`,"getSchemaRef"),Ki=o(e=>e[1]==="/"?e:"#/"+e.slice(1),"autocorrectRef"),as=o(e=>Ki(e).split("/").at(-1),"getSchemaNameByRef");function Ym(e){let t=fD(e).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ht(t)}o(Ym,"normalizeString");function PP(e){return/^[a-zA-Z]\w*$/.test(e)?e:`"${e}"`}o(PP,"wrapWithQuotesIfNeeded");function xP(e){return typeof e=="string"&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}o(xP,"unwrapQuotesIfNeeded");function fD(e){let t=Number(e[0]);return typeof t=="number"&&!Number.isNaN(t)?"_"+e:e}o(fD,"prefixStringStartingWithNumberIfNeeded");function Qm(e){let t=e.replaceAll("_","#");return ht(t.replaceAll("-","_")).replaceAll("#","_")}o(Qm,"pathParamToVariableName");var on=o(e=>mP.includes(e),"isPrimitiveType");function $P(e){return e.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(t,r)=>{let n=r.codePointAt(),i=n.toString(16);return n<=255?`\\x${`00${i}`.slice(-2)}`:`\\u${`0000${i}`.slice(-4)}`}).replace(/\//g,"\\/")}o($P,"escapeControlCharacters");function sn(e){return e.includes("application/")&&e.includes("json")||dP.includes(e)||e.includes("text/")}o(sn,"isParamMediaTypeAllowed");function Ma(e){return e>=200&&e<300}o(Ma,"isMainResponseStatus");function tl(e){return!(e>=200&&e<300)}o(tl,"isErrorStatus");function rl(e){return e.startsWith("application/")}o(rl,"isMediaTypeAllowed");var OP=/({\w+})/g,pD=/[^\w\-]+/g;function wP(e){e=Te(gP(e.replaceAll("/","-")).replaceAll("-",""));let t=[...e.matchAll(OP)];if(t.length>0){let r=t.sort((n,i)=>n.index-i.index)[t.length-1][0];e=`${e.replace(OP,"")}By${Te(r.slice(1,-1))}`}return e.replace(pD,"_")}o(wP,"pathToVariableName");var Km=/{(\b\w+(?:-\w+)*\b)}/g;function AP(e){let t=e.match(Km);return t===null?e.replaceAll(Km,":$1"):(t.forEach(r=>{let n=Qm(r.replaceAll(Km,":$1"));e=e.replaceAll(r,n)}),e)}o(AP,"replaceHyphenatedPath");var IP=o(e=>{let t=e["x-enumNames"],r=Array.isArray(t)&&t.length>0,n=!!e.schema&&ot(e.schema)&&e.schema.type==="string";return r&&n},"isSortingParameterObject"),Yi=o((e,t)=>t.excludePathRegex?new RegExp(t.excludePathRegex).test(e):!1,"isPathExcluded");var Xt=o(e=>e.method==="get","isQuery"),oi=o(e=>e.method!=="get"||!!e.mediaDownload,"isMutation"),cs=o((e,t)=>Xt(e)&&(t??Object.values(Ca)).every(r=>e.parameters.some(n=>n.name===r&&n.type==="Query")),"isInfiniteQuery"),CP=o((e,t,r)=>{let n=r.reduce((i,s)=>[...i,...ii(e,s,{includeOnlyRequiredParams:!0}).map(a=>a.name)],[]);return ii(e,t,{includeOnlyRequiredParams:!0,excludeBodyParam:!0}).filter(i=>n.includes(i.name)).map(i=>i.name)},"getDestructuredVariables");function si(e){return yP(e)}o(si,"formatTag");function ai(e,t){var n;let r=(n=e.tags)==null?void 0:n[0];return si(r??t.defaultTag)}o(ai,"getOperationTag");function TP(e,t){return t.excludeTags.some(r=>r.toLowerCase()===e.toLowerCase())}o(TP,"isTagExcluded");var nl={fileName:"acl/app.ability",extension:"ts"},ka="AllAbilities",qa="AppAbilities",il={fileName:"acl/useAclCheck",extension:"ts"},ci="useAclCheck",It={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subjectType:"Subject",subject:"subject"},Jm={bindings:[It.abilityTuple,It.pureAbility,It.forcedSubject,It.subjectType,It.subject],from:"@casl/ability"};var er=o((...e)=>[...new Set(e.flat())],"getUniqueArray");var RP=o(e=>`Use${Te(ht(e.operationName))}Ability`,"getAbilityTypeName"),Da=o(e=>`canUse${Te(ht(e.operationName))}`,"getAbilityFunctionName"),NP=o((e,t)=>`${t.tsNamespaces?`${Be({type:"acl",tag:ui(e,t),options:t})}.`:""}${Da(e)}`,"getImportedAbilityFunctionName"),jP=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].action},"getAbilityAction"),MP=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].subject},"getAbilitySubject"),ol=o(e=>{var t;return!!((t=La(e))!=null&&t.length)},"hasAbilityConditions"),La=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].conditionsTypes},"getAbilityConditionsTypes"),kP=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].description},"getAbilityDescription"),sl=o(e=>`${Te(e)}${ka}`,"getTagAllAbilitiesName");function _t(e,t){if(!e)return;let{data:r,onSchema:n}=t;if(we(e)&&n({type:"reference",schema:e,data:r})===!0)return;let i=e;if(ja.some(s=>s in i&&i[s])){let s=i.allOf??i.anyOf??i.oneOf??[];for(let a of s)(n==null?void 0:n({type:"composite",parentSchema:e,schema:a,data:r}))!==!0&&_t(a,{data:r,onSchema:n})}if(i.properties)for(let[s,a]of Object.entries(i.properties))n({type:"property",parentSchema:e,schema:a,data:r,propertyName:s})!==!0&&_t(a,t);if(i.additionalProperties&&typeof i.additionalProperties=="object"){if(n({type:"additionalProperties",parentSchema:e,schema:i.additionalProperties,data:r})===!0)return;_t(i.additionalProperties,t)}if(i.type==="array"){let s=e.items;if(n({type:"array",parentSchema:e,schema:s,data:r})===!0)return;_t(s,t)}}o(_t,"iterateSchema");var an=o((e,t)=>Zm(Te(Ym(e)),t),"getZodSchemaName"),Fa=o((e,t,r)=>Zm(Te(Ym(e)),`${t}${r}`),"getEnumZodSchemaName"),Ct=o(e=>["z.",`${pt.namespace}.`].every(t=>!e.startsWith(t)),"isNamedZodSchema"),qP=o(e=>e.startsWith(Ms),"isEnumZodSchema"),Qi=o((e,t,r)=>t?e:`${r}_${e}`,"getZodSchemaOperationName"),al=o(e=>ht(`${e}_${db}`),"getBodyZodSchemaName"),DP=o((e,t)=>ht(`${e}_${t}${hb}`),"getParamZodSchemaName"),dD=o(e=>ht(`${e}${mb}`),"getMainResponseZodSchemaName"),hD=o((e,t)=>ht(`${e}_${t}_${gb}`),"getErrorResponseZodSchemaName");function cl({statusCode:e,operationName:t,isUniqueOperationName:r,tag:n}){let i=Number(e),s=Qi(t,r,n);return!Ma(i)&&e!=="default"&&tl(i)?hD(s,e):dD(s)}o(cl,"getResponseZodSchemaName");function Ha(e){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(n=>e[n]).reduce((n,i)=>[...n,`${Te(_P(i))}: \`${e[i]}\``],[])}o(Ha,"getSchemaDescriptions");var Ba=o((e,t)=>bP(e,t.schemaSuffix),"getZodSchemaInferedTypeName"),LP=o((e,t)=>Ct(t)?`${e.options.tsNamespaces?`${Be({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${t}`:t,"getImportedZodSchemaName"),Ji=o((e,t,r)=>{if(!Ct(t))return t===js?"void":t;let n=e.getTagByZodSchemaName(t);return`${e.options.tsNamespaces&&n!==r?`${Be({type:"models",tag:n,options:e.options})}.`:""}${Ba(t,e.options)}`},"getImportedZodSchemaInferedTypeName");function FP(e){var t;return e.isEnum?"enum":((t=e.schemaObj)==null?void 0:t.type)??"object"}o(FP,"getZodSchemaType");function HP(e){if(e.schemaObj)return[e.schemaObj.description,...Ha(e.schemaObj).join(". ")].filter(Boolean)}o(HP,"getZodSchemaDescription");function BP(e,t,r){var n;if(we(t)){let i=e.getZodSchemaNameByRef(t.$ref);return i?Ji(e,i,r):void 0}if(Ju(t)){if(!we(t.items))return`${((n=t.items)==null?void 0:n.type)??"unknown"}[]`;let i=e.getZodSchemaNameByRef(t.items.$ref);return i?`${Ji(e,i,r)}[]`:void 0}if(ja.some(i=>i in t&&t[i])){let i=t.allOf??t.anyOf??t.oneOf??[];if(i.length>0)return BP(e,i[0],r)}return t.type}o(BP,"getType");function VP(e,t,r){if(!t.schemaObj)return[];let n="[0]",i="[key]",s={},a=o(c=>{var l;if(c.type==="reference")return!0;if(c.type==="composite")return;let u=[...((l=c.data)==null?void 0:l.pathSegments)??[]];if(c.type==="array"?u.push(n):c.type==="property"?u.push(c.propertyName):c.type==="additionalProperties"&&u.push(i),c.schema&&u[u.length-1]!==n){let p=e.resolveObject(c.schema),f=[p.description,...Ha(p)].filter(Boolean),d=u.join(".");s[d]&&"type"in c.schema&&c.schema.type==="object"||(delete s[d],s[d]={type:BP(e,c.schema,r)??"unknown",description:f.join(". ")})}return _t(c.schema,{data:{pathSegments:[...u]},onSchema:a}),!0},"onSchema");return"allOf"in t.schemaObj&&t.schemaObj.allOf&&t.schemaObj.allOf.forEach(c=>{if(we(c)){let u=e.resolveObject(c);_t(u,{data:{pathSegments:[]},onSchema:a})}}),_t(t.schemaObj,{data:{pathSegments:[]},onSchema:a}),s}o(VP,"getZodSchemaPropertyDescriptions");function li({resolver:e,tag:t,zodSchemas:r=[],zodSchemasAsTypes:n=[]}){let i="models",s=o(u=>e.getTagByZodSchemaName(u),"getTag"),a=ul({type:i,tag:t,entities:r,getTag:s,getEntityName:o(u=>u,"getEntityName"),options:e.options}),c=ul({type:i,tag:t,entities:n,getTag:s,getEntityName:o(u=>Ba(u,e.options),"getEntityName"),options:e.options});return mD(e.options,a,c)}o(li,"getModelsImports");function UP({tag:e,endpoints:t,options:r}){return ul({type:"endpoints",tag:e,entities:t,getTag:o(n=>ui(n,r),"getTag"),getEntityName:Va,options:r})}o(UP,"getEndpointsImports");function GP({tag:e,endpoints:t,options:r}){return ul({type:"acl",tag:e,entities:t,getTag:o(n=>ui(n,r),"getTag"),getEntityName:Da,options:r})}o(GP,"getAclImports");function zP({tags:e,entityName:t,getAliasEntityName:r,type:n,options:i}){let s=new Map;return e.forEach(a=>{let c=`${t}${r?` as ${r(a)}`:""}`;s.has(a)?i.tsNamespaces||s.get(a).bindings.push(c):s.set(a,{bindings:[i.tsNamespaces?Be({type:n,tag:a,options:i}):c],from:`${cn(i)}${ll({type:n,tag:a,includeTagDir:!0,options:i})}`})}),Array.from(s.values())}o(zP,"getEntityImports");function cn(e){let t=Ff;return e.importPath==="relative"?t="../":e.importPath==="absolute"?t=e.output:new RegExp(`${Lf}`,"g").test(e.output)&&(t=e.output.replace(new RegExp(`.*${Lf}`,"g"),Ff)),`${t}/`.replace(/\/\//g,"/")}o(cn,"getImportPath");function ul({type:e="models",tag:t,entities:r,getTag:n,getEntityName:i,options:s}){let a=new Map;return r.forEach(c=>{let u=n(c);if(a.has(u))s.tsNamespaces||a.get(u).bindings.push(i(c));else{let l=t===u;a.set(u,{bindings:[s.tsNamespaces?Be({type:e,tag:u,options:s}):i(c)],from:`${l?"./":cn(s)}${ll({type:e,tag:u,includeTagDir:!l,options:s})}`})}}),Array.from(a.values())}o(ul,"getImports");function mD(e,...t){let r=new Map;return t.forEach(n=>{n.forEach(i=>{r.has(i.from)?e.tsNamespaces||r.get(i.from).bindings.push(...i.bindings):r.set(i.from,i)})}),Array.from(r.values()).map(n=>({...n,bindings:er(n.bindings)}))}o(mD,"mergeImports");function Xi({fileName:e,extension:t}){return`${e}.${t}`}o(Xi,"getFileNameWithExtension");function ZP({type:e,tag:t,options:r,includeTagDir:n=!0}){let i=r.configs[e].outputFileNameSuffix;return t?`${n?`${ni(t)}/`:""}${ni(t)}.${i}`:i}o(ZP,"getTagFileNameWithoutExtension");function ll(...e){return ZP(...e)}o(ll,"getTagImportPath");function fl(...e){return`${ZP(...e)}.ts`}o(fl,"getTagFileName");var Be=o(({type:e,tag:t,options:r})=>`${Te(t)}${r.configs[e].namespaceSuffix}`,"getNamespaceName");function WP(e){return e.standalone?`${cn(e)}${Rc.fileName}`:e.restClientImportPath}o(WP,"getAppRestClientImportPath");function KP(e){return e.standalone?`${cn(e)}${Tc.reactQueryTypes.fileName}`:e.queryTypesImportPath}o(KP,"getQueryTypesImportPath");function YP(e){return`${cn(e)}${Nc.fileName}`}o(YP,"getQueryModulesImportPath");function QP(e){return`${cn(e)}${jc.fileName}`}o(QP,"getMutationEffectsImportPath");function JP(e){return`${cn(e)}${il.fileName}`}o(JP,"getAclCheckImportPath");function pl(e){return`${cn(e)}${Mc.fileName}`}o(pl,"getZodUtilsImportPath");function XP(e){return`${cn(e)}${nl.fileName}`}o(XP,"getAppAbilitiesImportPath");function ex(e){return At(e).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}o(ex,"primitiveTypeToTsType");var Va=o(e=>ni(ht(e.operationName)),"getEndpointName");function tx(e,t){return`${t.tsNamespaces?`${Be({type:"endpoints",tag:ui(e,t),options:t})}.`:""}${Va(e)}`}o(tx,"getImportedEndpointName");var rx=o(e=>e.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function ui(e,t){var n;let r=t.splitByTags?(n=e.tags)==null?void 0:n[0]:t.defaultTag;return si(r??t.defaultTag)}o(ui,"getEndpointTag");function ii(e,t,r){let n=t.parameters.map(i=>{var a,c,u,l;let s="string";if(Ct(i.zodSchema))s=Ji(e,i.zodSchema);else if((a=i.parameterObject)!=null&&a.schema&&ot(i.parameterObject.schema)){let p=(u=(c=i.parameterObject)==null?void 0:c.schema)==null?void 0:u.type;p&&on(p)&&(s=ex(p))}return{name:Qn(i.name),type:s,paramType:i.type,required:((l=i.parameterObject)==null?void 0:l.required)??!0,parameterObject:i.parameterObject,bodyObject:i.bodyObject}});return r!=null&&r.includeFileParam&&t.mediaUpload&&n.push({name:"file",type:"File",paramType:"Body",required:!0,parameterObject:void 0,bodyObject:void 0}),n.sort((i,s)=>{if(i.required===s.required){let a=["Path","Body","Query","Header"];return a.indexOf(i.paramType)-a.indexOf(s.paramType)}return i.required?-1:1}).filter(i=>(!(r!=null&&r.excludeBodyParam)||i.name!==Yu)&&(!(r!=null&&r.excludePageParam)||i.name!==Ca.pageParamName)&&(!(r!=null&&r.includeOnlyRequiredParams)||i.required)).map(i=>({...i,name:r!=null&&r.replacePageParam&&i.name===Ca.pageParamName?"pageParam":i.name}))}o(ii,"mapEndpointParamsToFunctionParams");function nx(e){let t=e.parameters.filter(i=>i.type==="Query").map(i=>{let s=lP(i.name)?i.name:`"${i.name}"`,a=Qn(i.name);return{...i,name:s,value:a}}),r={};return e.requestFormat!==Lm["Content-Type"]&&(r["Content-Type"]=`'${e.requestFormat}'`),e.responseFormat&&e.responseFormat!==Lm.Accept&&(r.Accept=`'${e.responseFormat}'`),e.parameters.filter(i=>i.type==="Header").forEach(i=>{r[i.name]=Qn(i.name)}),{...t.length>0?{params:t}:{},...Object.keys(r).length?{headers:r}:{}}}o(nx,"getEndpointConfig");function ix(e,t){return t.filter(r=>Xt(r)&&r.parameters.filter(n=>{var i;return(i=n.parameterObject)==null?void 0:i.required}).every(n=>e.parameters.some(i=>i.name===n.name))&&r.response===e.response)}o(ix,"getUpdateQueryEndpoints");var Xm=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with"];function eo(e,t){let r={};return Object.keys(e).forEach(n=>{t.includes(n)&&(r[n]=e[n])}),r}o(eo,"pick");function us(e,t){let r=e.deprecated&&!t.withDeprecatedEndpoints,n=ai(e,t),i=TP(n,t);return r||i}o(us,"isOperationExcluded");function eg({path:e,method:t,operation:r,options:n,tag:i,keepOperationTag:s,keepOperationPrefix:a}){let c=`${t}${wP(e)}`,u=r.operationId?Qn(r.operationId):c;if(n.removeOperationPrefixEndingWith&&a)u=u.split(n.removeOperationPrefixEndingWith).map((p,f)=>f===0?p:Te(p)).join("");else if(n.removeOperationPrefixEndingWith&&!a){let l=new RegExp(`^.*${n.removeOperationPrefixEndingWith}`);u=u.replace(l,"")}if(n.tsNamespaces&&!s){let l=SP(u,i);l===""?u=t.toLowerCase():Xm.includes(l)||(u=l)}return Xm.includes(u)?c:u}o(eg,"getOperationName");function Ua({operationsByTag:e,...t}){let{operation:r,options:n}=t,i=n.splitByTags?ai(r,n):n.defaultTag,s=o(a=>{let c=eg({...t,tag:i,keepOperationTag:a});if(e[i].filter(l=>eg({...t,operation:l,tag:i,keepOperationTag:a})===c).length===1)return c},"operationName");return s()??s(!0)??eg({...t,tag:i,keepOperationTag:!0,keepOperationPrefix:!0})}o(Ua,"getUniqueOperationName");function ox(e,t,r){let n=[];for(let i in e.paths){if(Yi(i,r))continue;let s=e.paths[i],a=eo(s,Wi);for(let c in a){let u=a[c];if(!u||us(u,r))continue;let l=Ua({path:i,method:c,operation:u,operationsByTag:t,options:r});n.push(l)}}return n}o(ox,"getUniqueOperationNamesWithoutSplitByTags");function sx(e,t){let r={};for(let n in e.paths){if(Yi(n,t))continue;let i=e.paths[n],s=eo(i,Wi);for(let a in s){let c=s[a];if(!c||us(c,t))continue;let u=t.splitByTags?ai(c,t):t.defaultTag;r[u]||(r[u]=[]),r[u].push(c)}}return r}o(sx,"getOperationsByTag");function Ga(e){return{type:"invalid-schema",message:e}}o(Ga,"getInvalidSchemaError");function ax(e){return{type:"invalid-operation-id",message:`Operation ${e}`}}o(ax,"getInvalidOperationIdError");function cx(e,t){return{type:"missing-path-parameter",message:`Path ${t} is missing [${e.map(({name:r})=>r).join(", ")}]`}}o(cx,"getMissingPathParameterError");function ux(e){return{type:"not-allowed-inline-enum",message:`${e} is missing @IsEnum() and @ApiProperty(enum:, enumName:)`}}o(ux,"getNotAllowedInlineEnumError");function lx(e){return{type:"not-allowed-circular-schema",message:e}}o(lx,"getNotAllowedCircularSchemaError");function fx(e,t,r){return{type:"missing-acl-condition-property",message:`Condition property ${e} is not found in parameters or body in operation ${hl(t,r)}`}}o(fx,"getMissingAclConditionPropertyError");function tg(e,t,r){return{type:"missing-status-code",message:`Missing HTTP status code ${dl(e)} in operation ${hl(t,r)}`}}o(tg,"getMissingStatusCodeError");function px(e,t,r){return{type:"invalid-status-code",message:`Operation ${hl(t,r)} expected HTTP status code ${dl(e.expected)} but received ${dl(e.received)}`}}o(px,"getInvalidStatusCodeError");function dx(e,t,r){return{type:"multiple-success-status-codes",message:`Operation ${hl(t,r)} has multiple success HTTP status codes: ${e.map(dl).join(", ")}`}}o(dx,"getMultipleSuccessStatusCodesError");function hl(e,t){return e.operationId??`${t.method} ${t.path}`}o(hl,"getOperationDescriptor");function dl(e){return`${e} (${aP[e]})`}o(dl,"getStatusCodeDescription");function hx(e){return e.reduce((t,r)=>({...t,[r.type]:[...t[r.type]??[],r.message]}),{})}o(hx,"groupByType");function un({schema:e,meta:t,options:r}){let n=[];At(e.type).with("string",()=>n.push(bD(e))).with("number","integer",()=>n.push(_D(e))).with("array",()=>n.push(SD(e))).otherwise(()=>{}),typeof e.description=="string"&&e.description!==""&&r.withDescription&&([`
|
|
140
|
+
`);return s!==-1&&(t=Pb(t,i,n,s)),n+t+i},"applyStyle");Object.defineProperties(qs.prototype,So);var f6=qs(),p6=qs({level:$b?$b.level:0});var Vr=new Fc;function Ds(e,t,r){console.log(r!==void 0&&r!==t?`${Vr.yellow(`${e}:`.padEnd(20))}${Vr.magenta(t)}`:`${`${e}:`.padEnd(20)}${t}`)}o(Ds,"logVariable");function pr(e){console.log(`[INFO] ${e}`)}o(pr,"logInfo");function Nn(e){console.log(Vr.green(`[SUCCESS] ${e}`))}o(Nn,"logSuccess");function Ls(e,t){e instanceof Error?(console.log(Vr.red(`[ERROR] ${t||e.message}`)),process.env.VERBOSE&&console.error(e)):console.log(Vr.red(`[ERROR] ${e}`))}o(Ls,"logError");function Bc(e){console.log(Vr.bgYellow(`==== ${e} ====`))}o(Bc,"logBanner");var Ib=yt(require("fs"));function Oo(){return"0.14.7"}o(Oo,"getVersion");var x6=yt(Tb());var Wf=Symbol("options_key");function Oe(e){return(t,r)=>{var n,i;if(e!=null){let s={...Reflect.getMetadata(Wf,t)||{},[r]:{...e,describe:e.envAlias?`${e.describe||""} [${e.envAlias}]`:e.describe,type:e.type||((i=(n=Reflect.getMetadata("design:type",t,r))==null?void 0:n.name)==null?void 0:i.toLowerCase())}};Reflect.defineMetadata(Wf,s,t)}}}o(Oe,"YargOption");function Rb(e){let t=Reflect.getMetadata(Wf,e.prototype);if(!t)throw new Error(`Options for ${e.name} were not defined`);return t}o(Rb,"getYargsOption");function Vc(e){return async t=>t.options(uw(e)).middleware(async r=>await lw(e,r),!0)}o(Vc,"getBuilder");function uw(e){return Object.entries(Rb(e)).reduce((t,[r,n])=>(t[r]=Object.fromEntries(Object.entries(n).filter(([i])=>!["envAlias","default"].includes(i))),t),{})}o(uw,"getYargsOptions");async function lw(e,t){let r=new e;for(let[n,i]of Object.entries(Rb(e)))r[n]=t[n]??i.default;return r}o(lw,"loadYargsConfig");var Hx=yt(Dm());var aP={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",300:"Ambiguous",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I Am a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",424:"Failed Dependency",428:"Precondition Required",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported"},cP={"invalid-schema":"Invalid OpenAPI Schemas","invalid-operation-id":"Invalid Operation IDs","missing-path-parameter":"Missing Path Parameters","not-allowed-inline-enum":"Not Allowed Inline Enums","not-allowed-circular-schema":"Not Allowed Circular Schemas","missing-acl-condition-property":"Missing x-acl Condition Properties","missing-status-code":"Missing HTTP Status Codes","invalid-status-code":"Invalid HTTP Status Codes","multiple-success-status-codes":"Multiple Success HTTP Status Codes"};var qr={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation"},uP={bindings:[qr.query,qr.infiniteQuery,qr.mutation],from:"@tanstack/react-query"},Ca={pageParamName:"page"},Ku={pageParamName:"page",totalItemsName:"totalItems",limitParamName:"limit"},Ta="moduleName";var Lm={"Content-Type":"application/json",Accept:"application/json"},Yu="data",Fm="axios",Yn="config",en="AxiosRequestConfig",Qu={defaultImport:Fm,bindings:[en],from:"axios"};var lP=o(e=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(e),"isValidPropertyName"),Qn=o(e=>e.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"invalidVariableNameCharactersToCamel");function we(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"$ref")}o(we,"isReferenceObject");function ot(e){return!we(e)}o(ot,"isSchemaObject");function Ju(e){return e.type==="array"}o(Ju,"isArraySchemaObject");function fP(e){if(!e.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[t,r]=e.allOf.reduce((i,s)=>{if(oD(s)){let a=s.required;i[0].push(...a??[])}else i[1].push(s);return i},[[],[]]),n={properties:t.reduce((i,s)=>(i[s]={},i),{}),type:"object",required:t};return{noRequiredOnlyAllof:r,composedRequiredSchema:n,patchRequiredSchemaInLoop:o((i,s)=>{if(we(i)){let a=s(i.$ref);a&&n.required.forEach(c=>{var u;n.properties[c]=((u=a==null?void 0:a.properties)==null?void 0:u[c])??{}})}else{let a=i.properties??{};n.required.forEach(c=>{a[c]&&(n.properties[c]=a[c]??{})})}},"patchRequiredSchemaInLoop")}}o(fP,"inferRequiredSchema");var oD=o(e=>!we(e)&&!!e.required&&!e.type&&!e.properties&&!(e!=null&&e.allOf)&&!(e!=null&&e.anyOf)&&!e.oneOf,"isBrokenAllOfItem");var _n=Symbol.for("@ts-pattern/matcher"),sD=Symbol.for("@ts-pattern/isVariadic"),el="@ts-pattern/anonymous-select-key",Hm=o(e=>!!(e&&typeof e=="object"),"r"),Xu=o(e=>e&&!!e[_n],"i"),nn=o((e,t,r)=>{if(Xu(e)){let n=e[_n](),{matched:i,selections:s}=n.match(t);return i&&s&&Object.keys(s).forEach(a=>r(a,s[a])),i}if(Hm(e)){if(!Hm(t))return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=[],i=[],s=[];for(let a of e.keys()){let c=e[a];Xu(c)&&c[sD]?s.push(c):s.length?i.push(c):n.push(c)}if(s.length){if(s.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<n.length+i.length)return!1;let a=t.slice(0,n.length),c=i.length===0?[]:t.slice(-i.length),u=t.slice(n.length,i.length===0?1/0:-i.length);return n.every((l,p)=>nn(l,a[p],r))&&i.every((l,p)=>nn(l,c[p],r))&&(s.length===0||nn(s[0],u,r))}return e.length===t.length&&e.every((a,c)=>nn(a,t[c],r))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in t||Xu(s=i)&&s[_n]().matcherType==="optional")&&nn(i,t[n],r);var s})}return Object.is(t,e)},"s"),ri=o(e=>{var t,r,n;return Hm(e)?Xu(e)?(t=(r=(n=e[_n]()).getSelectionKeys)==null?void 0:r.call(n))!=null?t:[]:Array.isArray(e)?Na(e,ri):Na(Object.values(e),ri):[]},"o"),Na=o((e,t)=>e.reduce((r,n)=>r.concat(t(n)),[]),"c");function br(e){return Object.assign(e,{optional:o(()=>aD(e),"optional"),and:o(t=>ze(e,t),"and"),or:o(t=>cD(e,t),"or"),select:o(t=>t===void 0?pP(e):pP(t,e),"select")})}o(br,"u");function aD(e){return br({[_n]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return t===void 0?(ri(e).forEach(i=>n(i,void 0)),{matched:!0,selections:r}):{matched:nn(e,t,n),selections:r}},"match"),getSelectionKeys:o(()=>ri(e),"getSelectionKeys"),matcherType:"optional"})})}o(aD,"h");function ze(...e){return br({[_n]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return{matched:e.every(i=>nn(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>Na(e,ri),"getSelectionKeys"),matcherType:"and"})})}o(ze,"m");function cD(...e){return br({[_n]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return Na(e,ri).forEach(i=>n(i,void 0)),{matched:e.some(i=>nn(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>Na(e,ri),"getSelectionKeys"),matcherType:"or"})})}o(cD,"d");function xe(e){return{[_n]:()=>({match:o(t=>({matched:!!e(t)}),"match")})}}o(xe,"p");function pP(...e){let t=typeof e[0]=="string"?e[0]:void 0,r=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return br({[_n]:()=>({match:o(n=>{let i={[t??el]:n};return{matched:r===void 0||nn(r,n,(s,a)=>{i[s]=a}),selections:i}},"match"),getSelectionKeys:o(()=>[t??el].concat(r===void 0?[]:ri(r)),"getSelectionKeys")})})}o(pP,"y");function tn(e){return typeof e=="number"}o(tn,"v");function Jn(e){return typeof e=="string"}o(Jn,"b");function Xn(e){return typeof e=="bigint"}o(Xn,"w");var VU=br(xe(function(e){return!0}));var ei=o(e=>Object.assign(br(e),{startsWith:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&n.startsWith(r)))));var r},"startsWith"),endsWith:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&n.endsWith(r)))));var r},"endsWith"),minLength:o(t=>ei(ze(e,(r=>xe(n=>Jn(n)&&n.length>=r))(t))),"minLength"),length:o(t=>ei(ze(e,(r=>xe(n=>Jn(n)&&n.length===r))(t))),"length"),maxLength:o(t=>ei(ze(e,(r=>xe(n=>Jn(n)&&n.length<=r))(t))),"maxLength"),includes:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&n.includes(r)))));var r},"includes"),regex:o(t=>{return ei(ze(e,(r=t,xe(n=>Jn(n)&&!!n.match(r)))));var r},"regex")}),"j"),UU=ei(xe(Jn)),rn=o(e=>Object.assign(br(e),{between:o((t,r)=>rn(ze(e,((n,i)=>xe(s=>tn(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n<r))(t))),"lt"),gt:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n>r))(t))),"gt"),lte:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n<=r))(t))),"lte"),gte:o(t=>rn(ze(e,(r=>xe(n=>tn(n)&&n>=r))(t))),"gte"),int:o(()=>rn(ze(e,xe(t=>tn(t)&&Number.isInteger(t)))),"int"),finite:o(()=>rn(ze(e,xe(t=>tn(t)&&Number.isFinite(t)))),"finite"),positive:o(()=>rn(ze(e,xe(t=>tn(t)&&t>0))),"positive"),negative:o(()=>rn(ze(e,xe(t=>tn(t)&&t<0))),"negative")}),"x"),GU=rn(xe(tn)),ti=o(e=>Object.assign(br(e),{between:o((t,r)=>ti(ze(e,((n,i)=>xe(s=>Xn(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n<r))(t))),"lt"),gt:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n>r))(t))),"gt"),lte:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n<=r))(t))),"lte"),gte:o(t=>ti(ze(e,(r=>xe(n=>Xn(n)&&n>=r))(t))),"gte"),positive:o(()=>ti(ze(e,xe(t=>Xn(t)&&t>0))),"positive"),negative:o(()=>ti(ze(e,xe(t=>Xn(t)&&t<0))),"negative")}),"A"),zU=ti(xe(Xn)),ZU=br(xe(function(e){return typeof e=="boolean"})),WU=br(xe(function(e){return typeof e=="symbol"})),KU=br(xe(function(e){return e==null})),YU=br(xe(function(e){return e!=null}));var Gm=class Gm extends Error{constructor(t){let r;try{r=JSON.stringify(t)}catch{r=t}super(`Pattern matching error: no pattern matches value ${r}`),this.input=void 0,this.input=t}};o(Gm,"W");var Bm=Gm,Vm={matched:!1,value:void 0};function At(e){return new Um(e,Vm)}o(At,"z");var Ra=class Ra{constructor(t,r){this.input=void 0,this.state=void 0,this.input=t,this.state=r}with(...t){if(this.state.matched)return this;let r=t[t.length-1],n=[t[0]],i;t.length===3&&typeof t[1]=="function"?i=t[1]:t.length>2&&n.push(...t.slice(1,t.length-1));let s=!1,a={},c=o((l,p)=>{s=!0,a[l]=p},"a"),u=!n.some(l=>nn(l,this.input,c))||i&&!i(this.input)?Vm:{matched:!0,value:r(s?el in a?a[el]:a:this.input,this.input)};return new Ra(this.input,u)}when(t,r){if(this.state.matched)return this;let n=!!t(this.input);return new Ra(this.input,n?{matched:!0,value:r(this.input,this.input)}:Vm)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Bm(this.input)}run(){return this.exhaustive()}returnType(){return this}};o(Ra,"I");var Um=Ra;var zm=2,dP=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],hP=["query","header","path"],Wi=["get","put","post","delete","options","head","patch","trace"],mP=["string","number","integer","boolean"],ja=["allOf","anyOf","oneOf"];var Te=o(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalize"),ni=o(e=>e.charAt(0).toLowerCase()+e.slice(1),"decapitalize"),gP=o(e=>e.replace(/(-\w)/g,t=>t[1].toUpperCase()),"kebabToCamel"),ht=o(e=>e.replace(/(_\w)/g,t=>t[1].toUpperCase()),"snakeToCamel"),yP=o(e=>e.replace(/[\W_]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"nonWordCharactersToCamel"),Zm=o((e,t="")=>e.endsWith(t)?e:`${e}${t}`,"suffixIfNeeded"),bP=o((e,t)=>e.replace(new RegExp(`${t}$`),""),"removeSuffix"),uD=o(e=>{var n;let t=e.reduce((i,s)=>({...i,[s]:(i[s]??0)+1}),{});return(n=Object.entries(t).sort((i,s)=>i[1]===s[1]?s[0].length-i[0].length:s[1]-i[1])[0])==null?void 0:n[0]},"getLongestMostCommon"),Wm=o(e=>{let t=e.map(Te).map(vP).map(r=>lD(r)).flat();return uD(t)},"getMostCommonAdjacentCombinationSplit"),vP=o(e=>e.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),_P=o(e=>vP(e).join(" "),"camelToSpaceSeparated"),lD=o((e,t=["dto","by","for","of","in","to","and","with"])=>{var n;let r=[];for(let i=0;i<e.length;i++)if(!t.includes(e[i].toLowerCase()))for(let s=i+1;s<=e.length;s++)t.includes((n=e[s-1])==null?void 0:n.toLowerCase())||r.push(e.slice(i,s).join(""));return r},"getAdjacentStringCombinations"),SP=o((e,t)=>{let r=t.replace(/es$|s$/g,""),n=new RegExp(`(${ni(r)}|${Te(r)})[a-z]*(?=$|[A-Z])`,"g");return e.replace(n,"")},"removeWord");var EP=o(e=>`#/components/schemas/${e}`,"getSchemaRef"),Ki=o(e=>e[1]==="/"?e:"#/"+e.slice(1),"autocorrectRef"),as=o(e=>Ki(e).split("/").at(-1),"getSchemaNameByRef");function Ym(e){let t=fD(e).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ht(t)}o(Ym,"normalizeString");function PP(e){return/^[a-zA-Z]\w*$/.test(e)?e:`"${e}"`}o(PP,"wrapWithQuotesIfNeeded");function xP(e){return typeof e=="string"&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}o(xP,"unwrapQuotesIfNeeded");function fD(e){let t=Number(e[0]);return typeof t=="number"&&!Number.isNaN(t)?"_"+e:e}o(fD,"prefixStringStartingWithNumberIfNeeded");function Qm(e){let t=e.replaceAll("_","#");return ht(t.replaceAll("-","_")).replaceAll("#","_")}o(Qm,"pathParamToVariableName");var on=o(e=>mP.includes(e),"isPrimitiveType");function $P(e){return e.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(t,r)=>{let n=r.codePointAt(),i=n.toString(16);return n<=255?`\\x${`00${i}`.slice(-2)}`:`\\u${`0000${i}`.slice(-4)}`}).replace(/\//g,"\\/")}o($P,"escapeControlCharacters");function sn(e){return e.includes("application/")&&e.includes("json")||dP.includes(e)||e.includes("text/")}o(sn,"isParamMediaTypeAllowed");function Ma(e){return e>=200&&e<300}o(Ma,"isMainResponseStatus");function tl(e){return!(e>=200&&e<300)}o(tl,"isErrorStatus");function rl(e){return e.startsWith("application/")}o(rl,"isMediaTypeAllowed");var OP=/({\w+})/g,pD=/[^\w\-]+/g;function wP(e){e=Te(gP(e.replaceAll("/","-")).replaceAll("-",""));let t=[...e.matchAll(OP)];if(t.length>0){let r=t.sort((n,i)=>n.index-i.index)[t.length-1][0];e=`${e.replace(OP,"")}By${Te(r.slice(1,-1))}`}return e.replace(pD,"_")}o(wP,"pathToVariableName");var Km=/{(\b\w+(?:-\w+)*\b)}/g;function AP(e){let t=e.match(Km);return t===null?e.replaceAll(Km,":$1"):(t.forEach(r=>{let n=Qm(r.replaceAll(Km,":$1"));e=e.replaceAll(r,n)}),e)}o(AP,"replaceHyphenatedPath");var IP=o(e=>{let t=e["x-enumNames"],r=Array.isArray(t)&&t.length>0,n=!!e.schema&&ot(e.schema)&&e.schema.type==="string";return r&&n},"isSortingParameterObject"),Yi=o((e,t)=>t.excludePathRegex?new RegExp(t.excludePathRegex).test(e):!1,"isPathExcluded");var Xt=o(e=>e.method==="get","isQuery"),oi=o(e=>e.method!=="get"||!!e.mediaDownload,"isMutation"),cs=o((e,t)=>Xt(e)&&(t??Object.values(Ca)).every(r=>e.parameters.some(n=>n.name===r&&n.type==="Query")),"isInfiniteQuery"),CP=o((e,t,r)=>{let n=r.reduce((i,s)=>[...i,...ii(e,s,{includeOnlyRequiredParams:!0}).map(a=>a.name)],[]);return ii(e,t,{includeOnlyRequiredParams:!0,excludeBodyParam:!0}).filter(i=>n.includes(i.name)).map(i=>i.name)},"getDestructuredVariables");function si(e){return yP(e)}o(si,"formatTag");function ai(e,t){var n;let r=(n=e.tags)==null?void 0:n[0];return si(r??t.defaultTag)}o(ai,"getOperationTag");function TP(e,t){return t.excludeTags.some(r=>r.toLowerCase()===e.toLowerCase())}o(TP,"isTagExcluded");var nl={fileName:"acl/app.ability",extension:"ts"},ka="AllAbilities",qa="AppAbilities",il={fileName:"acl/useAclCheck",extension:"ts"},ci="useAclCheck",It={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subjectType:"Subject",subject:"subject"},Jm={bindings:[It.abilityTuple,It.pureAbility,It.forcedSubject,It.subjectType,It.subject],from:"@casl/ability"};var er=o((...e)=>[...new Set(e.flat())],"getUniqueArray");var RP=o(e=>`Use${Te(ht(e.operationName))}Ability`,"getAbilityTypeName"),Da=o(e=>`canUse${Te(ht(e.operationName))}`,"getAbilityFunctionName"),NP=o((e,t)=>`${t.tsNamespaces?`${Be({type:"acl",tag:ui(e,t),options:t})}.`:""}${Da(e)}`,"getImportedAbilityFunctionName"),jP=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].action},"getAbilityAction"),MP=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].subject},"getAbilitySubject"),ol=o(e=>{var t;return!!((t=La(e))!=null&&t.length)},"hasAbilityConditions"),La=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].conditionsTypes},"getAbilityConditionsTypes"),kP=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].description},"getAbilityDescription"),sl=o(e=>`${Te(e)}${ka}`,"getTagAllAbilitiesName");function _t(e,t){if(!e)return;let{data:r,onSchema:n}=t;if(we(e)&&n({type:"reference",schema:e,data:r})===!0)return;let i=e;if(ja.some(s=>s in i&&i[s])){let s=i.allOf??i.anyOf??i.oneOf??[];for(let a of s)(n==null?void 0:n({type:"composite",parentSchema:e,schema:a,data:r}))!==!0&&_t(a,{data:r,onSchema:n})}if(i.properties)for(let[s,a]of Object.entries(i.properties))n({type:"property",parentSchema:e,schema:a,data:r,propertyName:s})!==!0&&_t(a,t);if(i.additionalProperties&&typeof i.additionalProperties=="object"){if(n({type:"additionalProperties",parentSchema:e,schema:i.additionalProperties,data:r})===!0)return;_t(i.additionalProperties,t)}if(i.type==="array"){let s=e.items;if(n({type:"array",parentSchema:e,schema:s,data:r})===!0)return;_t(s,t)}}o(_t,"iterateSchema");var an=o((e,t)=>Zm(Te(Ym(e)),t),"getZodSchemaName"),Fa=o((e,t,r)=>Zm(Te(Ym(e)),`${t}${r}`),"getEnumZodSchemaName"),Ct=o(e=>["z.",`${pt.namespace}.`].every(t=>!e.startsWith(t)),"isNamedZodSchema"),qP=o(e=>e.startsWith(Ms),"isEnumZodSchema"),Qi=o((e,t,r)=>t?e:`${r}_${e}`,"getZodSchemaOperationName"),al=o(e=>ht(`${e}_${db}`),"getBodyZodSchemaName"),DP=o((e,t)=>ht(`${e}_${t}${hb}`),"getParamZodSchemaName"),dD=o(e=>ht(`${e}${mb}`),"getMainResponseZodSchemaName"),hD=o((e,t)=>ht(`${e}_${t}_${gb}`),"getErrorResponseZodSchemaName");function cl({statusCode:e,operationName:t,isUniqueOperationName:r,tag:n}){let i=Number(e),s=Qi(t,r,n);return!Ma(i)&&e!=="default"&&tl(i)?hD(s,e):dD(s)}o(cl,"getResponseZodSchemaName");function Ha(e){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(n=>e[n]).reduce((n,i)=>[...n,`${Te(_P(i))}: \`${e[i]}\``],[])}o(Ha,"getSchemaDescriptions");var Ba=o((e,t)=>bP(e,t.schemaSuffix),"getZodSchemaInferedTypeName"),LP=o((e,t)=>Ct(t)?`${e.options.tsNamespaces?`${Be({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${t}`:t,"getImportedZodSchemaName"),Ji=o((e,t,r)=>{if(!Ct(t))return t===js?"void":t;let n=e.getTagByZodSchemaName(t);return`${e.options.tsNamespaces&&n!==r?`${Be({type:"models",tag:n,options:e.options})}.`:""}${Ba(t,e.options)}`},"getImportedZodSchemaInferedTypeName");function FP(e){var t;return e.isEnum?"enum":((t=e.schemaObj)==null?void 0:t.type)??"object"}o(FP,"getZodSchemaType");function HP(e){if(e.schemaObj)return[e.schemaObj.description,...Ha(e.schemaObj).join(". ")].filter(Boolean)}o(HP,"getZodSchemaDescription");function BP(e,t,r){var n;if(we(t)){let i=e.getZodSchemaNameByRef(t.$ref);return i?Ji(e,i,r):void 0}if(Ju(t)){if(!we(t.items))return`${((n=t.items)==null?void 0:n.type)??"unknown"}[]`;let i=e.getZodSchemaNameByRef(t.items.$ref);return i?`${Ji(e,i,r)}[]`:void 0}if(ja.some(i=>i in t&&t[i])){let i=t.allOf??t.anyOf??t.oneOf??[];if(i.length>0)return BP(e,i[0],r)}return t.type}o(BP,"getType");function VP(e,t,r){if(!t.schemaObj)return[];let n="[0]",i="[key]",s={},a=o(c=>{var l;if(c.type==="reference")return!0;if(c.type==="composite")return;let u=[...((l=c.data)==null?void 0:l.pathSegments)??[]];if(c.type==="array"?u.push(n):c.type==="property"?u.push(c.propertyName):c.type==="additionalProperties"&&u.push(i),c.schema&&u[u.length-1]!==n){let p=e.resolveObject(c.schema),f=[p.description,...Ha(p)].filter(Boolean),d=u.join(".");s[d]&&"type"in c.schema&&c.schema.type==="object"||(delete s[d],s[d]={type:BP(e,c.schema,r)??"unknown",description:f.join(". ")})}return _t(c.schema,{data:{pathSegments:[...u]},onSchema:a}),!0},"onSchema");return"allOf"in t.schemaObj&&t.schemaObj.allOf&&t.schemaObj.allOf.forEach(c=>{if(we(c)){let u=e.resolveObject(c);_t(u,{data:{pathSegments:[]},onSchema:a})}}),_t(t.schemaObj,{data:{pathSegments:[]},onSchema:a}),s}o(VP,"getZodSchemaPropertyDescriptions");function li({resolver:e,tag:t,zodSchemas:r=[],zodSchemasAsTypes:n=[]}){let i="models",s=o(u=>e.getTagByZodSchemaName(u),"getTag"),a=ul({type:i,tag:t,entities:r,getTag:s,getEntityName:o(u=>u,"getEntityName"),options:e.options}),c=ul({type:i,tag:t,entities:n,getTag:s,getEntityName:o(u=>Ba(u,e.options),"getEntityName"),options:e.options});return mD(e.options,a,c)}o(li,"getModelsImports");function UP({tag:e,endpoints:t,options:r}){return ul({type:"endpoints",tag:e,entities:t,getTag:o(n=>ui(n,r),"getTag"),getEntityName:Va,options:r})}o(UP,"getEndpointsImports");function GP({tag:e,endpoints:t,options:r}){return ul({type:"acl",tag:e,entities:t,getTag:o(n=>ui(n,r),"getTag"),getEntityName:Da,options:r})}o(GP,"getAclImports");function zP({tags:e,entityName:t,getAliasEntityName:r,type:n,options:i}){let s=new Map;return e.forEach(a=>{let c=`${t}${r?` as ${r(a)}`:""}`;s.has(a)?i.tsNamespaces||s.get(a).bindings.push(c):s.set(a,{bindings:[i.tsNamespaces?Be({type:n,tag:a,options:i}):c],from:`${cn(i)}${ll({type:n,tag:a,includeTagDir:!0,options:i})}`})}),Array.from(s.values())}o(zP,"getEntityImports");function cn(e){let t=Ff;return e.importPath==="relative"?t="../":e.importPath==="absolute"?t=e.output:new RegExp(`${Lf}`,"g").test(e.output)&&(t=e.output.replace(new RegExp(`.*${Lf}`,"g"),Ff)),`${t}/`.replace(/\/\//g,"/")}o(cn,"getImportPath");function ul({type:e="models",tag:t,entities:r,getTag:n,getEntityName:i,options:s}){let a=new Map;return r.forEach(c=>{let u=n(c);if(a.has(u))s.tsNamespaces||a.get(u).bindings.push(i(c));else{let l=t===u;a.set(u,{bindings:[s.tsNamespaces?Be({type:e,tag:u,options:s}):i(c)],from:`${l?"./":cn(s)}${ll({type:e,tag:u,includeTagDir:!l,options:s})}`})}}),Array.from(a.values())}o(ul,"getImports");function mD(e,...t){let r=new Map;return t.forEach(n=>{n.forEach(i=>{r.has(i.from)?e.tsNamespaces||r.get(i.from).bindings.push(...i.bindings):r.set(i.from,i)})}),Array.from(r.values()).map(n=>({...n,bindings:er(n.bindings)}))}o(mD,"mergeImports");function Xi({fileName:e,extension:t}){return`${e}.${t}`}o(Xi,"getFileNameWithExtension");function ZP({type:e,tag:t,options:r,includeTagDir:n=!0}){let i=r.configs[e].outputFileNameSuffix;return t?`${n?`${ni(t)}/`:""}${ni(t)}.${i}`:i}o(ZP,"getTagFileNameWithoutExtension");function ll(...e){return ZP(...e)}o(ll,"getTagImportPath");function fl(...e){return`${ZP(...e)}.ts`}o(fl,"getTagFileName");var Be=o(({type:e,tag:t,options:r})=>`${Te(t)}${r.configs[e].namespaceSuffix}`,"getNamespaceName");function WP(e){return e.standalone?`${cn(e)}${Rc.fileName}`:e.restClientImportPath}o(WP,"getAppRestClientImportPath");function KP(e){return e.standalone?`${cn(e)}${Tc.reactQueryTypes.fileName}`:e.queryTypesImportPath}o(KP,"getQueryTypesImportPath");function YP(e){return`${cn(e)}${Nc.fileName}`}o(YP,"getQueryModulesImportPath");function QP(e){return`${cn(e)}${jc.fileName}`}o(QP,"getMutationEffectsImportPath");function JP(e){return`${cn(e)}${il.fileName}`}o(JP,"getAclCheckImportPath");function pl(e){return`${cn(e)}${Mc.fileName}`}o(pl,"getZodUtilsImportPath");function XP(e){return`${cn(e)}${nl.fileName}`}o(XP,"getAppAbilitiesImportPath");function ex(e){return At(e).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}o(ex,"primitiveTypeToTsType");var Va=o(e=>ni(ht(e.operationName)),"getEndpointName");function tx(e,t){return`${t.tsNamespaces?`${Be({type:"endpoints",tag:ui(e,t),options:t})}.`:""}${Va(e)}`}o(tx,"getImportedEndpointName");var rx=o(e=>e.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function ui(e,t){var n;let r=t.splitByTags?(n=e.tags)==null?void 0:n[0]:t.defaultTag;return si(r??t.defaultTag)}o(ui,"getEndpointTag");function ii(e,t,r){let n=t.parameters.map(i=>{var a,c,u,l;let s="string";if(Ct(i.zodSchema))s=Ji(e,i.zodSchema);else if((a=i.parameterObject)!=null&&a.schema&&ot(i.parameterObject.schema)){let p=(u=(c=i.parameterObject)==null?void 0:c.schema)==null?void 0:u.type;p&&on(p)&&(s=ex(p))}return{name:Qn(i.name),type:s,paramType:i.type,required:((l=i.parameterObject)==null?void 0:l.required)??!0,parameterObject:i.parameterObject,bodyObject:i.bodyObject}});return r!=null&&r.includeFileParam&&t.mediaUpload&&n.push({name:"file",type:"File",paramType:"Body",required:!0,parameterObject:void 0,bodyObject:void 0}),n.sort((i,s)=>{if(i.required===s.required){let a=["Path","Body","Query","Header"];return a.indexOf(i.paramType)-a.indexOf(s.paramType)}return i.required?-1:1}).filter(i=>(!(r!=null&&r.excludeBodyParam)||i.name!==Yu)&&(!(r!=null&&r.excludePageParam)||i.name!==Ca.pageParamName)&&(!(r!=null&&r.includeOnlyRequiredParams)||i.required)).map(i=>({...i,name:r!=null&&r.replacePageParam&&i.name===Ca.pageParamName?"pageParam":i.name}))}o(ii,"mapEndpointParamsToFunctionParams");function nx(e){let t=e.parameters.filter(i=>i.type==="Query").map(i=>{let s=lP(i.name)?i.name:`"${i.name}"`,a=Qn(i.name);return{...i,name:s,value:a}}),r={};return e.requestFormat!==Lm["Content-Type"]&&(r["Content-Type"]=`'${e.requestFormat}'`),e.responseFormat&&e.responseFormat!==Lm.Accept&&(r.Accept=`'${e.responseFormat}'`),e.parameters.filter(i=>i.type==="Header").forEach(i=>{r[i.name]=Qn(i.name)}),{...t.length>0?{params:t}:{},...Object.keys(r).length?{headers:r}:{}}}o(nx,"getEndpointConfig");function ix(e,t){return t.filter(r=>Xt(r)&&r.parameters.filter(n=>{var i;return(i=n.parameterObject)==null?void 0:i.required}).every(n=>e.parameters.some(i=>i.name===n.name))&&r.response===e.response)}o(ix,"getUpdateQueryEndpoints");var Xm=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with"];function eo(e,t){let r={};return Object.keys(e).forEach(n=>{t.includes(n)&&(r[n]=e[n])}),r}o(eo,"pick");function us(e,t){let r=e.deprecated&&!t.withDeprecatedEndpoints,n=ai(e,t),i=TP(n,t);return r||i}o(us,"isOperationExcluded");function eg({path:e,method:t,operation:r,options:n,tag:i,keepOperationTag:s,keepOperationPrefix:a}){let c=`${t}${wP(e)}`,u=r.operationId?Qn(r.operationId):c;if(n.removeOperationPrefixEndingWith&&a)u=u.split(n.removeOperationPrefixEndingWith).map((p,f)=>f===0?p:Te(p)).join("");else if(n.removeOperationPrefixEndingWith&&!a){let l=new RegExp(`^.*${n.removeOperationPrefixEndingWith}`);u=u.replace(l,"")}if(n.tsNamespaces&&!s){let l=SP(u,i);l===""?u=t.toLowerCase():Xm.includes(l)||(u=l)}return Xm.includes(u)?c:u}o(eg,"getOperationName");function Ua({operationsByTag:e,...t}){let{operation:r,options:n}=t,i=n.splitByTags?ai(r,n):n.defaultTag,s=o(a=>{let c=eg({...t,tag:i,keepOperationTag:a});if(e[i].filter(l=>eg({...t,operation:l,tag:i,keepOperationTag:a})===c).length===1)return c},"operationName");return s()??s(!0)??eg({...t,tag:i,keepOperationTag:!0,keepOperationPrefix:!0})}o(Ua,"getUniqueOperationName");function ox(e,t,r){let n=[];for(let i in e.paths){if(Yi(i,r))continue;let s=e.paths[i],a=eo(s,Wi);for(let c in a){let u=a[c];if(!u||us(u,r))continue;let l=Ua({path:i,method:c,operation:u,operationsByTag:t,options:r});n.push(l)}}return n}o(ox,"getUniqueOperationNamesWithoutSplitByTags");function sx(e,t){let r={};for(let n in e.paths){if(Yi(n,t))continue;let i=e.paths[n],s=eo(i,Wi);for(let a in s){let c=s[a];if(!c||us(c,t))continue;let u=t.splitByTags?ai(c,t):t.defaultTag;r[u]||(r[u]=[]),r[u].push(c)}}return r}o(sx,"getOperationsByTag");function Ga(e){return{type:"invalid-schema",message:e}}o(Ga,"getInvalidSchemaError");function ax(e){return{type:"invalid-operation-id",message:`Operation ${e}`}}o(ax,"getInvalidOperationIdError");function cx(e,t){return{type:"missing-path-parameter",message:`Path ${t} is missing [${e.map(({name:r})=>r).join(", ")}]`}}o(cx,"getMissingPathParameterError");function ux(e){return{type:"not-allowed-inline-enum",message:`${e} is missing @IsEnum() and @ApiProperty(enum:, enumName:)`}}o(ux,"getNotAllowedInlineEnumError");function lx(e){return{type:"not-allowed-circular-schema",message:e}}o(lx,"getNotAllowedCircularSchemaError");function fx(e,t,r){return{type:"missing-acl-condition-property",message:`Condition property ${e} is not found in parameters or body in operation ${hl(t,r)}`}}o(fx,"getMissingAclConditionPropertyError");function tg(e,t,r){return{type:"missing-status-code",message:`Missing HTTP status code ${dl(e)} in operation ${hl(t,r)}`}}o(tg,"getMissingStatusCodeError");function px(e,t,r){return{type:"invalid-status-code",message:`Operation ${hl(t,r)} expected HTTP status code ${dl(e.expected)} but received ${dl(e.received)}`}}o(px,"getInvalidStatusCodeError");function dx(e,t,r){return{type:"multiple-success-status-codes",message:`Operation ${hl(t,r)} has multiple success HTTP status codes: ${e.map(dl).join(", ")}`}}o(dx,"getMultipleSuccessStatusCodesError");function hl(e,t){return e.operationId??`${t.method} ${t.path}`}o(hl,"getOperationDescriptor");function dl(e){return`${e} (${aP[e]})`}o(dl,"getStatusCodeDescription");function hx(e){return e.reduce((t,r)=>({...t,[r.type]:[...t[r.type]??[],r.message]}),{})}o(hx,"groupByType");function un({schema:e,meta:t,options:r}){let n=[];At(e.type).with("string",()=>n.push(bD(e))).with("number","integer",()=>n.push(_D(e))).with("array",()=>n.push(SD(e))).otherwise(()=>{}),typeof e.description=="string"&&e.description!==""&&r.withDescription&&([`
|
|
141
141
|
`,"\r",`\r
|
|
142
142
|
`].some(s=>String.prototype.includes.call(e.description,s))?n.push(`describe(\`${e.description}\`)`):n.push(`describe("${e.description}")`));let i=n.concat(gD({schema:e,meta:t,options:r}),r.withDefaultValues!==!1?yD(e):[]).filter(Boolean).join(".");return i?`.${i}`:""}o(un,"getZodChain");function gD({schema:e,meta:t,options:r}){return e.nullable&&!(t!=null&&t.isRequired)?"nullish()":e.nullable||r.replaceOptionalWithNullish&&(t!=null&&t.isParentPartial)?"nullable()":t!=null&&t.isRequired?"":r.replaceOptionalWithNullish?"nullish()":"optional()"}o(gD,"getZodChainablePresence");function yD(e){return e.default!==void 0?`default(${At(e.type).with("number","integer",()=>xP(e.default)).otherwise(()=>JSON.stringify(e.default))})`:""}o(yD,"getZodChainableDefault");function bD(e){let t=[];if(e.enum||(e.minLength!==void 0&&t.push(`min(${e.minLength})`),e.maxLength!==void 0&&t.push(`max(${e.maxLength})`)),e.pattern&&t.push(`regex(${vD(e.pattern)})`),e.format){let r=At(e.format).with("email",()=>"email()").with("hostname","uri",()=>"url()").with("uuid",()=>"uuid()").with("date-time",()=>"datetime({ offset: true })").otherwise(()=>"");r&&t.push(r)}return t.join(".")}o(bD,"getZodChainableStringValidations");function vD(e){return e.startsWith("/")&&e.endsWith("/")&&(e=e.slice(1,-1)),e=$P(e),`/${e}/`}o(vD,"formatPatternIfNeeded");function _D(e){let t=[];return e.enum?"":(e.type==="integer"&&t.push("int()"),e.minimum!==void 0?e.exclusiveMinimum===!0?t.push(`gt(${e.minimum})`):t.push(`gte(${e.minimum})`):typeof e.exclusiveMinimum=="number"&&t.push(`gt(${e.exclusiveMinimum})`),e.maximum!==void 0?e.exclusiveMaximum===!0?t.push(`lt(${e.maximum})`):t.push(`lte(${e.maximum})`):typeof e.exclusiveMaximum=="number"&&t.push(`lt(${e.exclusiveMaximum})`),e.multipleOf&&t.push(`multipleOf(${e.multipleOf})`),t.join("."))}o(_D,"getZodChainableNumberValidations");function SD(e){let t=[];return e.minItems&&t.push(`min(${e.minItems})`),e.maxItems&&t.push(`max(${e.maxItems})`),t.join(".")}o(SD,"getZodChainableArrayValidations");var OD={type:"string",format:"date-time"},ED={type:"string",format:"email"},PD={type:"object",properties:{start:{type:"string",format:"date-time"},end:{type:"string",format:"date-time"}}},xD={type:"object",properties:{html:{type:"string"},json:{type:"object"}}},ls=(i=>(i.datetime="datetime",i.email="email",i.dateRange="dateRange",i.textEditor="textEditor",i))(ls||{}),ml={datetime:OD,email:ED,dateRange:PD,textEditor:xD};function mx(){return Object.values(ls).filter(e=>on(ml[e].type))}o(mx,"getPrimitiveBrands");function gx(){return Object.values(ls).filter(e=>!on(ml[e].type))}o(gx,"getOtherBrands");function fs(e,t){let r=ml[t];return!(e.type!==r.type||r.format&&e.format!==r.format||!Object.entries(r.properties??{}).every(([i,s])=>{var c;let a=(c=e.properties)==null?void 0:c[i];return a&&a.type===s.type&&a.format===s.format}))}o(fs,"matchesBrand");function rg(e,t,r){return r.branded?`${pt.namespace}.${pt.exports.brand}(${e}, "${t}")`:e}o(rg,"wrapWithBrand");var to=o(e=>e.reduce((t,r)=>t+r,0),"sum");function mt(e,t){if(!t)return e;if(we(t))return e+2;if(Array.isArray(t.type))return t.type.length===1?tr("oneOf")+mt(e,{...t,type:t.type[0]}):e+tr("oneOf")+to(t.type.map(r=>mt(0,{...t,type:r})));if(t.oneOf)return t.oneOf.length===1?tr("oneOf")+mt(e,t.oneOf[0]):e+tr("oneOf")+to(t.oneOf.map(r=>mt(0,r)));if(t.anyOf)return t.anyOf.length===1?tr("anyOf")+mt(e,t.anyOf[0]):e+tr("anyOf")+to(t.anyOf.map(r=>mt(0,r)));if(t.allOf)return t.allOf.length===1?tr("allOf")+mt(e,t.allOf[0]):e+tr("allOf")+to(t.allOf.map(r=>mt(0,r)));if(!t.type)return e;if(on(t.type))return t.enum?e+yx(t)+tr("enum")+to(t.enum.map(r=>mt(0,r))):e+yx(t);if(t.type==="array")return t.items?tr("array")+mt(e,t.items):tr("array")+mt(e);if(t.type==="object"||t.properties||t.additionalProperties){if(t.properties){let r=Object.values(t.properties);e+=tr("object")+to(r.map(n=>mt(0,n)))}else e+=tr("empty-object");t.additionalProperties&&(typeof t.additionalProperties=="object"?e+=mt(0,t.additionalProperties):e+=mt(1))}return e}o(mt,"getOpenAPISchemaComplexity");function yx(e){return At(e.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}o(yx,"complexityByType");function tr(e){return At(e).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}o(tr,"complexityByComposite");var ng=class ng{constructor(t,r,n={referencedBy:[]},i){this.schema=t;this.resolver=r;we(t)&&(this.ref=t.$ref),i&&(this.enumRef=i),this.meta={...n,referencedBy:[...(n==null?void 0:n.referencedBy)??[]]},this.ref&&this.meta.referencedBy.push(this)}code;ref;enumRef;children=[];meta;getCodeString(t,r){var s,a;if(!this.ref&&this.code)return this.code;if(!this.ref)throw new Error("Zod schema is missing both ref and code");let n=(s=this.resolver)==null?void 0:s.getZodSchemaNameByRef(this.ref);if(!n)return this.ref;let i=(a=this.resolver)==null?void 0:a.getTagByZodSchemaName(n);return r!=null&&r.tsNamespaces&&i&&i!==t?`${Be({type:"models",tag:i,options:r})}.${n}`:n}get complexity(){return mt(0,this.schema)}assign(t){return this.code=t,this}inherit(t){return t&&t.children.push(this),this}};o(ng,"ZodSchema");var za=ng;function Qe({schema:e,resolver:t,meta:r,tag:n}){var y;let i=new za(e,t,r),s={parent:i.inherit(r==null?void 0:r.parent),referencedBy:[...i.meta.referencedBy]},a={resolver:t,meta:s,tag:n};if(we(e))return $D({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});let c=AD({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(c)return c;let u=wD({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(u)return u;let l=ID({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(l)return l;let p=CD({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(p)return p;let f=TD({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(f)return f;let d=t.options.allReadonly?".readonly()":"";if(Ju(e))return e.items?i.assign(`z.array(${Qe({...a,schema:e.items}).getCodeString(n,t.options)}${un({schema:e.items,meta:{...s,isRequired:!0},options:t.options})})${d}`):i.assign(`z.array(z.any())${d}`);let h=e.type?e.type.toLowerCase():void 0;if(h==="object"||e.properties||e.additionalProperties){let b=e.required&&e.required.length>0,g=t.options.withImplicitRequiredProps?!1:e.properties&&!((y=e.required)!=null&&y.length),P="{}";e.properties&&(P="{ "+Object.entries(e.properties).map(([re,$e])=>{var R;let Ae={...s,isRequired:g?!0:b?(R=e.required)==null?void 0:R.includes(re):t.options.withImplicitRequiredProps,name:re,isParentPartial:g},G=$e;if(we($e)&&t&&(G=t.getSchemaByRef($e.$ref),!G))throw new Error(`Schema ${$e.$ref} not found`);let j=Qe({...a,schema:$e,meta:Ae}).getCodeString(n,t.options)+un({schema:G,meta:Ae,options:t.options});return ot($e)&&mx().forEach(k=>{fs($e,k)&&(j=rg(j,k,t.options))}),[re,j]}).map(([re,$e])=>`${PP(re)}: ${$e}`).join(", ")+" }");let $="";e.additionalProperties&&($=`.catchall(${typeof e.additionalProperties=="object"&&Object.keys(e.additionalProperties).length>0?Qe({...a,schema:e.additionalProperties}).getCodeString(n,t.options)+un({schema:e.additionalProperties,meta:{...s,isRequired:!0},options:t.options}):"z.any()"})`);let C=g?".partial()":"",T=t.options.strictObjects?".strict()":"",w=`z.object(${P})${C}${T}${$}${d}`;return gx().forEach(te=>{fs(e,te)&&(w=rg(w,te,t.options))}),i.assign(w)}if(h==="any")return i.assign("z.any()");if(!h)return i.assign("z.unknown()");throw new Error(`Unsupported schema type: ${h}`)}o(Qe,"getZodSchema");function $D({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!we(e))return;let s=t.meta.referencedBy.slice(0,-1).map(u=>u.ref?r.getZodSchemaNameByRef(u.ref)??u.ref:void 0).filter(Boolean),a=r.getZodSchemaNameByRef(e.$ref);if(s.length>1&&s.includes(a))return t.assign(r.getCodeByZodSchemaName(t.ref));let c=r.getCodeByZodSchemaName(e.$ref);if(!c){let u=r.getSchemaByRef(e.$ref);if(!u)throw new Error(`Schema ${e.$ref} not found`);c=Qe({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)}return r.getCodeByZodSchemaName(a)||r.setZodSchema(a,c,i),t}o($D,"getReferenceZodSchema");function wD({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){var a;if(!ot(e)||!e.oneOf)return;if(e.oneOf.length===1){let c=Qe({schema:e.oneOf[0],resolver:r,meta:n,tag:i});return t.assign(c.getCodeString(i,r.options))}let s=(a=e.oneOf)==null?void 0:a.some(c=>ot(c)&&((c==null?void 0:c.allOf)||[]).length>1);if(e.discriminator&&!s){let c=e.discriminator.propertyName;return t.assign(`
|
|
143
143
|
z.discriminatedUnion("${c}", [${e.oneOf.map(u=>Qe({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])
|
|
@@ -148,7 +148,7 @@ ${c.map(u=>`- ${u}`).join(`
|
|
|
148
148
|
${s.map(a=>`- ${a}`).join(`
|
|
149
149
|
`)}
|
|
150
150
|
`)}return n.validationErrors}o(Fx,"checkOpenAPIDoc");function UD(e,t){return["models","endpoints","queries"].map(r=>Dr({output:t.output,fileName:fl({tag:e,type:r,options:t})}))}o(UD,"getOutputFileNames");async function Bx({input:e,excludeTags:t,verbose:r,...n}){let i=Date.now();r&&pr("Parsing OpenAPI spec...");let s=await Hx.default.bundle(e);r&&Nn("Parsing finished."),r&&pr("Running check...");let a=Fx(s,{input:e,excludeTags:t.split(","),...n});if(r&&pr(`TIME: ${Date.now()-i}ms`),a.length===0)Nn("Check finished.");else throw new Error(`Check finished. Found ${a.length} issues.`)}o(Bx,"check");var ln=class ln{input;splitByTags;defaultTag;excludeTags;excludePathRegex;excludeRedundantZodSchemas;verbose};o(ln,"CheckOptions"),Se([Oe({envAlias:"input",demandOption:!0})],ln.prototype,"input",2),Se([Oe({envAlias:"splitByTags",default:Pe.splitByTags,type:"boolean"})],ln.prototype,"splitByTags",2),Se([Oe({envAlias:"defaultTag",default:Pe.defaultTag})],ln.prototype,"defaultTag",2),Se([Oe({envAlias:"excludeTags",default:Pe.excludeTags.join(",")})],ln.prototype,"excludeTags",2),Se([Oe({envAlias:"excludePathRegex",default:Pe.excludePathRegex})],ln.prototype,"excludePathRegex",2),Se([Oe({envAlias:"excludeRedundantZodSchemas",default:Pe.excludeRedundantZodSchemas,type:"boolean"})],ln.prototype,"excludeRedundantZodSchemas",2),Se([Oe({envAlias:"verbose",default:!1,type:"boolean"})],ln.prototype,"verbose",2);var ug=ln,Vx={command:"check",describe:"Check OpenAPI spec",builder:Vc(ug),handler:o(async e=>{let t=await e;return t.verbose&&(Bc(`OpenAPI CodeGen ${Oo()}`),Ds("input",t.input)),Bx(t)},"handler")};var a2=yt(Dm()),c2=require("child_process");var ty=yt(xn());var dn=yt(xn());function j$(e){k8(),q8(),D8(e.options),L8(),F8(),H8(),B8(),V8(),U8()}o(j$,"registerAclHbsHelpers");function k8(){dn.default.registerHelper("abilityTypeName",RP)}o(k8,"registerAbilityTypeNameHelper");function q8(){dn.default.registerHelper("abilityFunctionName",Da)}o(q8,"registerAbilityFunctionNameHelper");function D8(e){dn.default.registerHelper("importedAbilityFunctionName",t=>NP(t,e))}o(D8,"registerImportedAbilityFunctionNameHelper");function L8(){dn.default.registerHelper("ablityAction",jP)}o(L8,"registerAbilityActionHelper");function F8(){dn.default.registerHelper("ablitySubject",MP)}o(F8,"registerAbilitySubjectHelper");function H8(){dn.default.registerHelper("hasAbilityConditions",ol)}o(H8,"registerHasAbilityConditionsHelper");function B8(){dn.default.registerHelper("abilityConditionsTypes",La)}o(B8,"registerAbilityConditionsTypesHelper");function V8(){dn.default.registerHelper("abilityDescription",kP)}o(V8,"registerAbilityDescriptionHelper");function U8(){dn.default.registerHelper("tagAllAbilitiesName",sl)}o(U8,"registerTagAllAbilitiesNameHelper");var Ps=yt(xn());function M$(){G8(),z8(),Z8(),W8(),K8()}o(M$,"registerCommonHbsHelpers");function G8(){Ps.default.registerHelper("isEqual",(e,t)=>e===t)}o(G8,"registerIsEqualHelper");function z8(){Ps.default.registerHelper("commaSeparated",e=>e.join(", "))}o(z8,"registerCommaSeparatedListHelper");function Z8(){Ps.default.registerHelper("addAsteriskAfterNewLine",e=>e.replace(/\n/g,`
|
|
151
|
-
*`))}o(Z8,"registerAddAsteriskAfterNewLineHelper");function W8(){Ps.default.registerHelper("jsonStringify",e=>JSON.stringify(e,null,2))}o(W8,"registerJsonStringifyHelper");function K8(){Ps.default.registerHelper("capitalize",Te)}o(K8,"registerCapitalizeHelper");var di=yt(xn());function k$(e){Y8(),Q8(e.options),eF(e),J8(),X8(),tF(e),rF()}o(k$,"registerEndpointsHbsHelpers");function Y8(){di.default.registerHelper("endpointName",Va)}o(Y8,"registerEndpointNameHelper");function Q8(e){di.default.registerHelper("importedEndpointName",t=>tx(t,e))}o(Q8,"registerImportedEndpointNameHelper");function J8(){di.default.registerHelper("endpointPath",rx)}o(J8,"registerEndpointPathHelper");function X8(){di.default.registerHelper("endpointBody",e=>e.parameters.find(t=>t.type==="Body"))}o(X8,"registerEndpointBodyHelper");function eF(e){di.default.registerHelper("endpointParams",(t,r)=>ii(e,t,r.hash))}o(eF,"registerEndpointParamsHelper");function tF(e){di.default.registerHelper("endpointArgs",(t,r)=>ii(e,t,r.hash).map(n=>n.name).join(", "))}o(tF,"registerEndpointArgsHelper");function rF(){di.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&&ot(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(sn);f&&(i=e.bodyObject.content[f],i.schema&&ot(i.schema)&&(n=i.schema))}if(n){let p=Ha(n);t.push(...p)}return i!=null&&i.example&&t.push(`Example: \`${i.example}\``),t.join(". ")})}o(rF,"registerEndpointParamDescriptionHelper");var q$=yt(xn());function D$(){nF()}o(D$,"registerImportsHbsHelpers");function nF(){q$.default.registerHelper("importNames",(e,t)=>[...t?[t]:[],...e?[`{ ${e.join(", ")} }`]:[]].join(", "))}o(nF,"registerBindingsHelper");var qt=yt(xn());function L$(e){iF(),oF(),sF(),aF(e),cF(),uF(e),lF(e),fF(e),pF(e),dF(e),hF(),mF(),gF(),yF()}o(L$,"registerPartialsHbsHelpers");function iF(){qt.default.registerHelper("genModelJsDocs",(e,t,r)=>Dt("model-js-docs")({name:e,zodSchema:t,tag:r}))}o(iF,"registerGenerateModelJsDocsHelper");function oF(){qt.default.registerHelper("genImport",e=>Dt("import")({import:e}))}o(oF,"registerImportHelper");function sF(){qt.default.registerHelper("genEndpointParams",(e,t)=>Dt("endpoint-params")({endpoint:e,options:t}))}o(sF,"registerGenerateEndpointParamsHelper");function aF(e){qt.default.registerHelper("genEndpointConfig",t=>{let r=nx(t),n=e.options.axiosRequestConfig;return Object.keys(r).length===0?n?Yn:"":Dt("endpoint-config")({endpointConfig:r,hasAxiosRequestConfig:n,hasBlobResponse:t.response===kc,hasFileDownload:t.mediaDownload,axiosRequestConfigName:Yn,generateParse:e.options.parseRequestParams})})}o(aF,"registerGenerateEndpointConfigHelper");function cF(){qt.default.registerHelper("genEndpointParamParse",(e,t)=>{var r;return Dt("endpoint-param-parse")({param:e,paramName:t,isQuery:e.type==="Query",zodUtilsNamespace:pt.namespace,parse:pt.exports.parse,sortExp:pt.exports.sortExp,addOptional:!((r=e.parameterObject??e.bodyObject)!=null&&r.required)&&(e.parameterSortingEnumSchemaName||Ct(e.zodSchema))})})}o(cF,"registerGenerateEndpointParamParseHelper");function uF(e){qt.default.registerHelper("genQueryKeys",t=>t.length===0?"":Dt("query-keys")({queryEndpoints:t,queriesModuleName:Ta,generateInfiniteQueries:e.options.infiniteQueries}))}o(uF,"registerGenerateQueryKeysHelper");function lF(e){qt.default.registerHelper("genQuery",t=>{if(!Xt(t))return;let r=e.options.axiosRequestConfig,n=e.options.checkAcl&&t.acl;return Dt("query-use-query")({endpoint:t,queryHook:qr.query,hasQueryFn:ii(e,t).length>0||r||n,hasQueryFnBody:n,hasAxiosRequestConfig:r,axiosRequestConfigName:Yn,axiosRequestConfigType:en,hasAclCheck:n,aclCheckHook:ci})})}o(lF,"registerGenerateQueryHelper");function fF(e){qt.default.registerHelper("genMutation",(t,r)=>{if(!oi(t))return;let n=ix(t,r),i=CP(e,t,n),s=e.options.checkAcl&&t.acl;return Dt("query-use-mutation")({endpoint:t,queryHook:qr.mutation,queriesModuleName:Ta,hasAxiosRequestConfig:e.options.axiosRequestConfig,hasMutationFnBody:t.mediaUpload||s,axiosRequestConfigName:Yn,axiosRequestConfigType:en,hasMutationEffects:e.options.mutationEffects,mutationEffectsType:bo.optionsType,updateQueryEndpoints:n,destructuredVariables:i,hasAclCheck:s,aclCheckHook:ci})})}o(fF,"registerGenerateMutationHelper");function pF(e){qt.default.registerHelper("genInfiniteQuery",t=>{if(!e.options.infiniteQueries||!cs(t))return;let r=e.options.checkAcl&&t.acl;return Dt("query-use-infinite-query")({endpoint:t,infiniteQueryHook:qr.infiniteQuery,hasQueryFnBody:r,pageParamName:Ku.pageParamName,totalItemsName:Ku.totalItemsName,limitParamName:Ku.limitParamName,hasAxiosRequestConfig:e.options.axiosRequestConfig,axiosRequestConfigName:Yn,axiosRequestConfigType:en,hasAclCheck:r,aclCheckHook:ci})})}o(pF,"registerGenerateInfiniteQueryHelper");function dF(e){qt.default.registerHelper("genQueryJsDocs",(t,r)=>Dt("query-js-docs")({endpoint:t,query:r.hash.query,mutation:r.hash.mutation,infiniteQuery:r.hash.infiniteQuery,hasMutationEffects:e.options.mutationEffects,mutationEffectsType:bo.optionsType}))}o(dF,"registerGenerateQueryJsDocsHelper");function hF(){qt.default.registerHelper("genCaslAbilityType",e=>Dt("casl-ability-type")({endpoint:e,abilityTupleType:It.abilityTuple}))}o(hF,"registerGenerateCaslAbilityTypeHelper");function mF(){qt.default.registerHelper("genCaslAbilityFunction",e=>Dt("casl-ability-function")({endpoint:e}))}o(mF,"registerGenerateCaslAbilityFunctionHelper");function gF(){qt.default.registerHelper("genCaslAbilityQuery",e=>Dt("casl-ability-query")({endpoint:e}))}o(gF,"registerGenerateCaslAbilityQueryHelper");function yF(){qt.default.registerHelper("genAclCheckCall",e=>{var i;let t=(i=La(e))==null?void 0:i.map(s=>s.name),r=e.parameters.map(s=>s.name),n=t==null?void 0:t.every(s=>r.includes(s));return Dt("acl-check-call")({endpoint:e,generateAclCheckParams:ol(e)&&n})})}o(yF,"registerGenerateAclCheckCallHelper");var xs=yt(xn());var F$=o((e,t)=>{let r=Xt(e)&&oi(e)&&t;return`use${Te(ht(e.operationName))}${r?"Mutation":""}`},"getQueryName"),H$=o(e=>`use${Te(ht(e.operationName))}Infinite`,"getInfiniteQueryName");function B$(){bF(),_F(),SF(),vF(),OF()}o(B$,"registerQueryHbsHelpers");function bF(){xs.default.registerHelper("queryName",(e,t)=>F$(e,t.hash.mutation))}o(bF,"registerQueryNameHelper");function vF(){xs.default.registerHelper("infiniteQueryName",H$)}o(vF,"registerInfiniteQueryNameHelper");function _F(){xs.default.registerHelper("isQuery",Xt)}o(_F,"registerIsQueryHelper");function SF(){xs.default.registerHelper("isMutation",oi)}o(SF,"registerIsMutationHelper");function OF(){xs.default.registerHelper("isInfiniteQuery",e=>cs(e))}o(OF,"registerIsInfiniteQueryHelper");var co=yt(xn());function V$(e){EF(e.options),PF(e),xF(e),$F(),wF(),AF(e)}o(V$,"registerZodHbsHelpers");function EF(e){co.default.registerHelper("zodInferedType",t=>Ba(t,e))}o(EF,"registerInferedTypeHelper");function PF(e){co.default.registerHelper("importedZodSchemaName",t=>LP(e,t))}o(PF,"registerImportedZodSchemaNameHelper");function xF(e){co.default.registerHelper("importedZodSchemaInferedType",t=>Ji(e,t))}o(xF,"registerImportedZodSchemaInferedTypeHelper");function $F(){co.default.registerHelper("zodSchemaType",e=>FP(e))}o($F,"registerZodSchemaTypeHelper");function wF(){co.default.registerHelper("zodSchemaDescription",e=>HP(e))}o(wF,"registerZodSchemaDescriptionHelper");function AF(e){co.default.registerHelper("zodSchemaPropertyDescriptions",(t,r)=>VP(e,t,r))}o(AF,"registerZodSchemaPropertyDescriptionsHelper");function Ot(e,t){let r=cg(t);return M$(),D$(),V$(e),k$(e),B$(),j$(e),L$(e),ty.default.compile(r)}o(Ot,"getHbsTemplateDelegate");function Dt(e){let t=cg(`partials/${e}`);return ty.default.compile(t)}o(Dt,"getHbsPartialTemplateDelegate");function U$({resolver:e,data:t,tag:r=""}){var l;let n=(l=t.get(r))==null?void 0:l.endpoints.filter(({acl:p})=>p&&p.length>0);if(!n||n.length===0)return;let i=n.some(({acl:p})=>(p==null?void 0:p[0].conditions)&&Object.keys(p[0].conditions).length>0),s={bindings:[It.abilityTuple,...i?[It.forcedSubject,It.subject]:[]],from:Jm.from},a=n.reduce((p,f)=>{var h,y;let d=(y=(h=f.acl)==null?void 0:h[0].conditionsTypes)==null?void 0:y.reduce((b,g)=>[...b,...g!=null&&g.zodSchemaName?[g.zodSchemaName]:[]],[]);return[...p,...d??[]]},[]),c=li({resolver:e,tag:r,zodSchemasAsTypes:er(a)});return Ot(e,"acl")({caslAbilityTupleImport:s,modelsImports:c,includeNamespace:e.options.tsNamespaces,namespace:Be({type:"acl",tag:r,options:e.options}),endpoints:n})}o(U$,"generateAcl");function G$(e,t){let r={bindings:[It.pureAbility,...t.length===0?[It.subjectType,It.abilityTuple]:[]],from:Jm.from},n=zP({tags:t,entityName:ka,getAliasEntityName:sl,type:"acl",options:e.options}),i=t.map(a=>Be({type:"acl",tag:a,options:e.options}));return Ot(e,"app-acl")({caslAbilityTupleImport:r,imports:n,allAbilities:ka,appAbilities:qa,includeNamespace:e.options.tsNamespaces,tags:t,namespaces:i,abilityTuple:It.abilityTuple,subjectType:It.subjectType})}o(G$,"generateAppAcl");function z$({resolver:e,data:t,tag:r=""}){var $;let n=($=t.get(r))==null?void 0:$.endpoints;if(!n||n.length===0)return;let i={bindings:[Ns],from:WP(e.options)},s=e.options.axiosRequestConfig,a=s,c={bindings:s?[en]:[],from:Qu.from},u=e.options.parseRequestParams,l=n.reduce((C,T)=>[...C,...T.parameters],[]),p=l.filter(C=>!["Path","Header"].includes(C.type)).map(C=>C.parameterSortingEnumSchemaName??C.zodSchema),f=n.map(C=>C.response),d=er([...f,...u?p:[]]),h=d.some(C=>!Ct(C)),y=e.options.parseRequestParams&&p.length>0,b={bindings:[pt.namespace],from:pl(e.options)},g=li({resolver:e,tag:r,zodSchemas:d.filter(Ct),zodSchemasAsTypes:er(l.map(C=>C.zodSchema).filter(Ct))});return Ot(e,"endpoints")({appRestClientImport:i,hasAxiosImport:a,axiosImport:c,hasZodImport:h,zodImport:vo,hasZodUtilsImport:y,zodUtilsImport:b,modelsImports:g,includeNamespace:e.options.tsNamespaces,namespace:Be({type:"endpoints",tag:r,options:e.options}),restClientName:Ns,hasAxiosRequestConfig:s,axiosRequestConfigName:Yn,axiosRequestConfigType:en,endpoints:n,generateParse:u})}o(z$,"generateEndpoints");function Z$(e,t){let r=e.getRefByZodSchemaName(t);if(r){let i=Array.from(e.dependencyGraph.refsDependencyGraph[r]??[]).map(a=>e.getZodSchemaNameByRef(a)),s=e.getExtractedEnumZodSchemaNamesReferencedBySchemaRef(r);return[...i,...s]}let n=e.getCompositeZodSchemaByZodSchemaName(t);return n?Array.from(W$(n)).map(i=>e.getZodSchemaNameByRef(i)):[]}o(Z$,"getZodSchemaRefs");function W$(e){return e.children.reduce((r,n)=>{let i=n.ref??n.enumRef;return i&&r.add(i),n.children.length>0&&W$(n).forEach(s=>r.add(s)),r},new Set)}o(W$,"getSchemaRefs");function K$({resolver:e,data:t,tag:r=""}){var p;let n=(p=t.get(r))==null?void 0:p.zodSchemas;if(!n||Object.keys(n).length===0)return;let i=Object.keys(n).reduce((f,d)=>[...f,...Z$(e,d)],[]).filter(f=>!n[f]),s=li({resolver:e,tag:r,zodSchemas:i}),a=Object.entries(n).reduce((f,[d,h])=>{let y=e.getRefByZodSchemaName(d),b=e.getZodSchemaObj(d),g=!1;b&&ot(b)&&_t(b,{onSchema:o(C=>{if(C.type==="reference")return!0;Object.values(ls).forEach(T=>{(C.schema&&ot(C.schema)&&fs(C.schema,T)||C.parentSchema&&ot(C.parentSchema)&&fs(C.parentSchema,T))&&(g=!0)})},"onSchema")});let P={code:h,isCircular:!!y&&e.isSchemaCircular(y),isEnum:qP(h),schemaObj:b,hasBrand:g};return{...f,[d]:P}},{}),c=e.options.branded&&Object.values(a).some(f=>f.hasBrand),u={bindings:[pt.namespace],from:pl(e.options)};return Ot(e,"models")({zodImport:vo,hasZodUtilsImport:c,zodUtilsImport:u,modelsImports:s,includeNamespace:e.options.tsNamespaces,namespace:Be({type:"models",tag:r,options:e.options}),tag:r,zodSchemasData:a})}o(K$,"generateModels");function Y$({resolver:e,data:t,tag:r=""}){var Ae;let n=(Ae=t.get(r))==null?void 0:Ae.endpoints;if(!n||n.length===0)return;let i=e.options.axiosRequestConfig,s=n.some(({mediaUpload:G})=>G),a=i||s,c={defaultImport:s?Fm:void 0,bindings:i?[en]:[],from:Qu.from},u=n.filter(Xt),l=u.filter(G=>cs(G)),p=n.filter(oi),f={bindings:[...u.length>0?[qr.query]:[],...e.options.infiniteQueries&&l.length>0?[qr.infiniteQuery]:[],...p.length>0?[qr.mutation]:[]],from:uP.from},d=e.options.mutationEffects,h={bindings:[Bf],from:YP(e.options)},y=d&&p.length>0,b={bindings:[...p.length>0?[bo.optionsType,bo.hookName]:[]],from:QP(e.options)},g=n.filter(G=>G.acl),P=e.options.checkAcl&&g.length>0,$={bindings:[ci],from:JP(e.options)},C={bindings:[...u.length>0?[Ic.query]:[],...e.options.infiniteQueries&&l.length>0?[Ic.infiniteQuery]:[],...p.length>0?[Ic.mutation]:[]],from:KP(e.options)},T=n.reduce((G,j)=>[...G,...j.parameters],[]),w=li({resolver:e,tag:r,zodSchemasAsTypes:er(T.map(G=>G.zodSchema).filter(Ct))}),te=UP({tag:r,endpoints:n,options:e.options}),re=GP({tag:r,endpoints:g,options:e.options});return Ot(e,"queries")({hasAxiosImport:a,axiosImport:c,queryImport:f,hasMutationEffects:d,queryModulesImport:h,hasMutationEffectsImport:y,mutationEffectsImport:b,hasAclCheck:P,aclCheckImport:$,queryTypesImport:C,modelsImports:w,endpointsImports:te,aclImports:re,includeNamespace:e.options.tsNamespaces,tag:r,namespace:Be({type:"queries",tag:r,options:e.options}),queriesModuleName:Ta,queryModuleEnum:Bf,endpoints:n,queryEndpoints:u})}o(Y$,"generateQueries");function Q$(e){return Ot(e,"acl-check")({abilityContextImport:{...ub,from:e.options.abilityContextImportPath},appAbilitiesImport:{bindings:[qa],from:XP(e.options)},errorHandlingImport:{...Cc,from:e.options.errorHandlingImportPath},abilityContext:Hf,appAbilities:qa,errorHandler:Rn.ErrorHandler,sharedErrorHandler:Rn.SharedErrorHandler,aclCheckHook:ci,hasGenericAppAbilities:e.options.abilityContextGenericAppAbilities})}o(Q$,"generateAclCheck");function J$(e){return Ot(e,"app-rest-client")({appRestClientName:Ns,baseUrl:e.getBaseUrl()})}o(J$,"generateAppRestClient");function X$({resolver:e,data:t}){let r=[];return t.forEach((i,s)=>{var c;let a=(c=t.get(s))==null?void 0:c.endpoints;!a||a.length===0||r.push({tag:s,namespace:Be({type:"queries",tag:s,options:e.options})})}),Ot(e,"query-modules")({modules:r})}o(X$,"generateQueryModules");function e2(e){return Ot(e,"zod-utils")({zodImport:vo,zodUtilsNamespace:pt.namespace,parse:pt.exports.parse,sortExp:pt.exports.sortExp,brand:pt.exports.brand,errorHandler:Rn.ErrorHandler,sharedErrorHandler:Rn.SharedErrorHandler,errorHandlingImport:{...Cc,from:e.options.errorHandlingImportPath}})}o(e2,"generateZodUtils");function t2(e,t){return t.options.acl?[{fileName:Dr({output:t.options.output,fileName:Xi(nl)}),content:G$(t,e)},...t.options.checkAcl?[{fileName:Dr({output:t.options.output,fileName:Xi(il)}),content:Q$(t)}]:[]]:[]}o(t2,"getAclFiles");function r2(e,t){return t.options.mutationEffects?[...o2([lb,jc],t),{fileName:Dr({output:t.options.output,fileName:Xi(Nc)}),content:X$({resolver:t,data:e})}]:[]}o(r2,"getMutationEffectsFiles");function n2(e){return e.options.standalone?[...o2(Object.values(Tc),e),{fileName:Dr({output:e.options.output,fileName:Xi(Rc)}),content:J$(e)}]:[]}o(n2,"getStandaloneFiles");function i2(e,t){return t.options.parseRequestParams?[{fileName:Dr({output:t.options.output,fileName:Xi(Mc)}),content:e2(t)}]:[]}o(i2,"getZodUtilsFiles");function o2(e,t){return e.reduce((r,n)=>[...r,IF(n,t)],[])}o(o2,"getAssetFiles");function IF(e,t){let r=Xi(e);return{fileName:Dr({output:t.options.output,fileName:r}),content:Dx(r)}}o(IF,"getAssetFile");function s2(e,t){let r=t.standalone&&t.importPath==="ts"?"relative":t.importPath,n={...Pe,...t,importPath:r},{resolver:i,data:s}=bl(e,n),a=[],c=[],u=["models","endpoints","queries","acl"],l={models:K$,endpoints:z$,queries:Y$,acl:U$};return s.forEach((p,f)=>{u.forEach(d=>{let h=l[d]({resolver:i,data:s,tag:f});if(h){let y=Dr({output:n.output,fileName:fl({tag:f,type:d,options:n})});a.push({fileName:y,content:h}),d==="acl"&&c.push(f)}})}),a.push(...t2(c,i),...r2(s,i),...i2(s,i),...n2(i)),a}o(s2,"generateCodeFromOpenAPIDoc");async function u2({input:e,excludeTags:t,monorepo:r,prettier:n,verbose:i,...s}){let a=Date.now();i&&pr("Parsing OpenAPI spec...");let c=await a2.default.bundle(e);i&&Nn("Parsing finished."),i&&pr("Generating code...");let u=r?"monorepoTemplate":"template",l=s2(c,{input:e,excludeTags:t.split(","),restClientImportPath:lr.appRestClient[u],errorHandlingImportPath:lr.errorHandling[u],queryTypesImportPath:lr.queryTypes[u],abilityContextImportPath:lr.abilityContext[u],abilityContextGenericAppAbilities:r,...s});i&&Nn("Generation finished."),i&&pr("Writing files..."),Lx(l),i&&Nn("Writing finished."),n&&CF({output:s.output,verbose:i}),i&&pr(`TIME: ${Date.now()-a}ms`)}o(u2,"generate");function CF({output:e,verbose:t}){t&&pr("Running Prettier..."),(0,c2.exec)(`prettier --write ${e} `,n=>{t&&(n?Ls(n,"Prettier error"):Nn("Prettier finished."))})}o(CF,"execPrettier");var Re=class Re{input;output;tsNamespaces;splitByTags;defaultTag;excludeTags;excludePathRegex;excludeRedundantZodSchemas;importPath;extractEnums;removeOperationPrefixEndingWith;acl;checkAcl;standalone;baseUrl;branded;replaceOptionalWithNullish;infiniteQueries;mutationEffects;parseRequestParams;axiosRequestConfig;monorepo;prettier;verbose};o(Re,"GenerateOptions"),Se([Oe({envAlias:"input",demandOption:!0})],Re.prototype,"input",2),Se([Oe({envAlias:"output",default:Pe.output})],Re.prototype,"output",2),Se([Oe({envAlias:"tsNamespaces",default:Pe.tsNamespaces,type:"boolean"})],Re.prototype,"tsNamespaces",2),Se([Oe({envAlias:"splitByTags",default:Pe.splitByTags,type:"boolean"})],Re.prototype,"splitByTags",2),Se([Oe({envAlias:"defaultTag",default:Pe.defaultTag})],Re.prototype,"defaultTag",2),Se([Oe({envAlias:"excludeTags",default:Pe.excludeTags.join(",")})],Re.prototype,"excludeTags",2),Se([Oe({envAlias:"excludePathRegex",default:Pe.excludePathRegex})],Re.prototype,"excludePathRegex",2),Se([Oe({envAlias:"excludeRedundantZodSchemas",default:Pe.excludeRedundantZodSchemas,type:"boolean"})],Re.prototype,"excludeRedundantZodSchemas",2),Se([Oe({envAlias:"importPath",default:Pe.importPath})],Re.prototype,"importPath",2),Se([Oe({envAlias:"extractEnums",default:Pe.extractEnums,type:"boolean"})],Re.prototype,"extractEnums",2),Se([Oe({envAlias:"removeOperationPrefixEndingWith",default:Pe.removeOperationPrefixEndingWith})],Re.prototype,"removeOperationPrefixEndingWith",2),Se([Oe({envAlias:"acl",default:Pe.acl,type:"boolean"})],Re.prototype,"acl",2),Se([Oe({envAlias:"checkAcl",default:Pe.checkAcl,type:"boolean"})],Re.prototype,"checkAcl",2),Se([Oe({envAlias:"standalone",default:Pe.standalone,type:"boolean"})],Re.prototype,"standalone",2),Se([Oe({envAlias:"baseUrl",default:Pe.baseUrl})],Re.prototype,"baseUrl",2),Se([Oe({envAlias:"branded",default:Pe.branded,type:"boolean"})],Re.prototype,"branded",2),Se([Oe({envAlias:"replaceOptionalWithNullish",default:Pe.replaceOptionalWithNullish,type:"boolean"})],Re.prototype,"replaceOptionalWithNullish",2),Se([Oe({envAlias:"infiniteQueries",default:Pe.infiniteQueries,type:"boolean"})],Re.prototype,"infiniteQueries",2),Se([Oe({envAlias:"mutationEffects",default:Pe.mutationEffects,type:"boolean"})],Re.prototype,"mutationEffects",2),Se([Oe({envAlias:"parseRequestParams",default:Pe.parseRequestParams,type:"boolean"})],Re.prototype,"parseRequestParams",2),Se([Oe({envAlias:"axiosRequestConfig",default:Pe.axiosRequestConfig,type:"boolean"})],Re.prototype,"axiosRequestConfig",2),Se([Oe({envAlias:"monorepo",default:!1,type:"boolean"})],Re.prototype,"monorepo",2),Se([Oe({envAlias:"prettier",default:!0,type:"boolean"})],Re.prototype,"prettier",2),Se([Oe({envAlias:"verbose",default:!1,type:"boolean"})],Re.prototype,"verbose",2);var ry=Re,l2={command:"generate",describe:"Generate code from OpenAPI spec",builder:Vc(ry),handler:o(async e=>{let t=await e;return t.verbose&&(Bc(`OpenAPI CodeGen ${Oo()}`),Ds("input",t.input),Ds("output",t.output)),u2(t)},"handler")};cb(hf(process.argv)).version(Oo()||"unknown").scriptName("openapi-codegen").command(l2).command(Vx).help().demandCommand(1).strictCommands(!0).showHelpOnFail(!0).fail((e,t)=>{e&&Ls(e),t&&Ls(t),pr("Use '--help' for more info"),process.exit(1)}).parse();
|
|
151
|
+
*`))}o(Z8,"registerAddAsteriskAfterNewLineHelper");function W8(){Ps.default.registerHelper("jsonStringify",e=>JSON.stringify(e,null,2))}o(W8,"registerJsonStringifyHelper");function K8(){Ps.default.registerHelper("capitalize",Te)}o(K8,"registerCapitalizeHelper");var di=yt(xn());function k$(e){Y8(),Q8(e.options),eF(e),J8(),X8(),tF(e),rF()}o(k$,"registerEndpointsHbsHelpers");function Y8(){di.default.registerHelper("endpointName",Va)}o(Y8,"registerEndpointNameHelper");function Q8(e){di.default.registerHelper("importedEndpointName",t=>tx(t,e))}o(Q8,"registerImportedEndpointNameHelper");function J8(){di.default.registerHelper("endpointPath",rx)}o(J8,"registerEndpointPathHelper");function X8(){di.default.registerHelper("endpointBody",e=>e.parameters.find(t=>t.type==="Body"))}o(X8,"registerEndpointBodyHelper");function eF(e){di.default.registerHelper("endpointParams",(t,r)=>ii(e,t,r.hash))}o(eF,"registerEndpointParamsHelper");function tF(e){di.default.registerHelper("endpointArgs",(t,r)=>ii(e,t,r.hash).map(n=>n.name).join(", "))}o(tF,"registerEndpointArgsHelper");function rF(){di.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&&ot(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(sn);f&&(i=e.bodyObject.content[f],i.schema&&ot(i.schema)&&(n=i.schema))}if(n){let p=Ha(n);t.push(...p)}return i!=null&&i.example&&t.push(`Example: \`${i.example}\``),t.join(". ")})}o(rF,"registerEndpointParamDescriptionHelper");var q$=yt(xn());function D$(){nF()}o(D$,"registerImportsHbsHelpers");function nF(){q$.default.registerHelper("importNames",(e,t)=>[...t?[t]:[],...e?[`{ ${e.join(", ")} }`]:[]].join(", "))}o(nF,"registerBindingsHelper");var qt=yt(xn());function L$(e){iF(),oF(),sF(),aF(e),cF(),uF(e),lF(e),fF(e),pF(e),dF(e),hF(),mF(),gF(),yF()}o(L$,"registerPartialsHbsHelpers");function iF(){qt.default.registerHelper("genModelJsDocs",(e,t,r)=>Dt("model-js-docs")({name:e,zodSchema:t,tag:r}))}o(iF,"registerGenerateModelJsDocsHelper");function oF(){qt.default.registerHelper("genImport",e=>Dt("import")({import:e}))}o(oF,"registerImportHelper");function sF(){qt.default.registerHelper("genEndpointParams",(e,t)=>Dt("endpoint-params")({endpoint:e,options:t}))}o(sF,"registerGenerateEndpointParamsHelper");function aF(e){qt.default.registerHelper("genEndpointConfig",t=>{let r=nx(t),n=e.options.axiosRequestConfig;return Object.keys(r).length===0?n?Yn:"":Dt("endpoint-config")({endpointConfig:r,hasAxiosRequestConfig:n,hasBlobResponse:t.response===kc,hasFileDownload:t.mediaDownload,axiosRequestConfigName:Yn,generateParse:e.options.parseRequestParams})})}o(aF,"registerGenerateEndpointConfigHelper");function cF(){qt.default.registerHelper("genEndpointParamParse",(e,t)=>{var r;return Dt("endpoint-param-parse")({param:e,paramName:t,isQuery:e.type==="Query",zodUtilsNamespace:pt.namespace,parse:pt.exports.parse,sortExp:pt.exports.sortExp,addOptional:!((r=e.parameterObject??e.bodyObject)!=null&&r.required)&&(e.parameterSortingEnumSchemaName||Ct(e.zodSchema))})})}o(cF,"registerGenerateEndpointParamParseHelper");function uF(e){qt.default.registerHelper("genQueryKeys",t=>t.length===0?"":Dt("query-keys")({queryEndpoints:t,queriesModuleName:Ta,generateInfiniteQueries:e.options.infiniteQueries}))}o(uF,"registerGenerateQueryKeysHelper");function lF(e){qt.default.registerHelper("genQuery",t=>{if(!Xt(t))return;let r=e.options.axiosRequestConfig,n=e.options.checkAcl&&t.acl;return Dt("query-use-query")({endpoint:t,queryHook:qr.query,hasQueryFn:ii(e,t).length>0||r||n,hasQueryFnBody:n,hasAxiosRequestConfig:r,axiosRequestConfigName:Yn,axiosRequestConfigType:en,hasAclCheck:n,aclCheckHook:ci})})}o(lF,"registerGenerateQueryHelper");function fF(e){qt.default.registerHelper("genMutation",(t,r)=>{if(!oi(t))return;let n=ix(t,r),i=CP(e,t,n),s=e.options.checkAcl&&t.acl;return Dt("query-use-mutation")({endpoint:t,queryHook:qr.mutation,queriesModuleName:Ta,hasAxiosRequestConfig:e.options.axiosRequestConfig,hasMutationFnBody:t.mediaUpload||s,axiosRequestConfigName:Yn,axiosRequestConfigType:en,hasMutationEffects:e.options.mutationEffects,mutationEffectsType:bo.optionsType,updateQueryEndpoints:n,destructuredVariables:i,hasAclCheck:s,aclCheckHook:ci})})}o(fF,"registerGenerateMutationHelper");function pF(e){qt.default.registerHelper("genInfiniteQuery",t=>{if(!e.options.infiniteQueries||!cs(t))return;let r=e.options.checkAcl&&t.acl;return Dt("query-use-infinite-query")({endpoint:t,infiniteQueryHook:qr.infiniteQuery,hasQueryFnBody:r,pageParamName:Ku.pageParamName,totalItemsName:Ku.totalItemsName,limitParamName:Ku.limitParamName,hasAxiosRequestConfig:e.options.axiosRequestConfig,axiosRequestConfigName:Yn,axiosRequestConfigType:en,hasAclCheck:r,aclCheckHook:ci})})}o(pF,"registerGenerateInfiniteQueryHelper");function dF(e){qt.default.registerHelper("genQueryJsDocs",(t,r)=>Dt("query-js-docs")({endpoint:t,query:r.hash.query,mutation:r.hash.mutation,infiniteQuery:r.hash.infiniteQuery,hasMutationEffects:e.options.mutationEffects,mutationEffectsType:bo.optionsType}))}o(dF,"registerGenerateQueryJsDocsHelper");function hF(){qt.default.registerHelper("genCaslAbilityType",e=>Dt("casl-ability-type")({endpoint:e,abilityTupleType:It.abilityTuple}))}o(hF,"registerGenerateCaslAbilityTypeHelper");function mF(){qt.default.registerHelper("genCaslAbilityFunction",e=>Dt("casl-ability-function")({endpoint:e}))}o(mF,"registerGenerateCaslAbilityFunctionHelper");function gF(){qt.default.registerHelper("genCaslAbilityQuery",e=>Dt("casl-ability-query")({endpoint:e}))}o(gF,"registerGenerateCaslAbilityQueryHelper");function yF(){qt.default.registerHelper("genAclCheckCall",e=>{var i;let t=(i=La(e))==null?void 0:i.map(s=>s.name),r=e.parameters.map(s=>s.name),n=t==null?void 0:t.every(s=>r.includes(s));return Dt("acl-check-call")({endpoint:e,generateAclCheckParams:ol(e)&&n})})}o(yF,"registerGenerateAclCheckCallHelper");var xs=yt(xn());var F$=o((e,t)=>{let r=Xt(e)&&oi(e)&&t;return`use${Te(ht(e.operationName))}${r?"Mutation":""}`},"getQueryName"),H$=o(e=>`use${Te(ht(e.operationName))}Infinite`,"getInfiniteQueryName");function B$(){bF(),_F(),SF(),vF(),OF()}o(B$,"registerQueryHbsHelpers");function bF(){xs.default.registerHelper("queryName",(e,t)=>F$(e,t.hash.mutation))}o(bF,"registerQueryNameHelper");function vF(){xs.default.registerHelper("infiniteQueryName",H$)}o(vF,"registerInfiniteQueryNameHelper");function _F(){xs.default.registerHelper("isQuery",Xt)}o(_F,"registerIsQueryHelper");function SF(){xs.default.registerHelper("isMutation",oi)}o(SF,"registerIsMutationHelper");function OF(){xs.default.registerHelper("isInfiniteQuery",e=>cs(e))}o(OF,"registerIsInfiniteQueryHelper");var co=yt(xn());function V$(e){EF(e.options),PF(e),xF(e),$F(),wF(),AF(e)}o(V$,"registerZodHbsHelpers");function EF(e){co.default.registerHelper("zodInferedType",t=>Ba(t,e))}o(EF,"registerInferedTypeHelper");function PF(e){co.default.registerHelper("importedZodSchemaName",t=>LP(e,t))}o(PF,"registerImportedZodSchemaNameHelper");function xF(e){co.default.registerHelper("importedZodSchemaInferedType",t=>Ji(e,t))}o(xF,"registerImportedZodSchemaInferedTypeHelper");function $F(){co.default.registerHelper("zodSchemaType",e=>FP(e))}o($F,"registerZodSchemaTypeHelper");function wF(){co.default.registerHelper("zodSchemaDescription",e=>HP(e))}o(wF,"registerZodSchemaDescriptionHelper");function AF(e){co.default.registerHelper("zodSchemaPropertyDescriptions",(t,r)=>VP(e,t,r))}o(AF,"registerZodSchemaPropertyDescriptionsHelper");function Ot(e,t){let r=cg(t);return M$(),D$(),V$(e),k$(e),B$(),j$(e),L$(e),ty.default.compile(r)}o(Ot,"getHbsTemplateDelegate");function Dt(e){let t=cg(`partials/${e}`);return ty.default.compile(t)}o(Dt,"getHbsPartialTemplateDelegate");function U$({resolver:e,data:t,tag:r=""}){var l;let n=(l=t.get(r))==null?void 0:l.endpoints.filter(({acl:p})=>p&&p.length>0);if(!n||n.length===0)return;let i=n.some(({acl:p})=>(p==null?void 0:p[0].conditions)&&Object.keys(p[0].conditions).length>0),s={bindings:[It.abilityTuple,...i?[It.forcedSubject,It.subject]:[]],from:Jm.from},a=n.reduce((p,f)=>{var h,y;let d=(y=(h=f.acl)==null?void 0:h[0].conditionsTypes)==null?void 0:y.reduce((b,g)=>[...b,...g!=null&&g.zodSchemaName?[g.zodSchemaName]:[]],[]);return[...p,...d??[]]},[]),c=li({resolver:e,tag:r,zodSchemasAsTypes:er(a)});return Ot(e,"acl")({caslAbilityTupleImport:s,modelsImports:c,includeNamespace:e.options.tsNamespaces,namespace:Be({type:"acl",tag:r,options:e.options}),endpoints:n})}o(U$,"generateAcl");function G$(e,t){let r={bindings:[It.pureAbility,...t.length===0?[It.subjectType,It.abilityTuple]:[]],from:Jm.from},n=zP({tags:t,entityName:ka,getAliasEntityName:sl,type:"acl",options:e.options}),i=t.map(a=>Be({type:"acl",tag:a,options:e.options}));return Ot(e,"app-acl")({caslAbilityTupleImport:r,imports:n,allAbilities:ka,appAbilities:qa,includeNamespace:e.options.tsNamespaces,tags:t,namespaces:i,abilityTuple:It.abilityTuple,subjectType:It.subjectType})}o(G$,"generateAppAcl");function z$({resolver:e,data:t,tag:r=""}){var $;let n=($=t.get(r))==null?void 0:$.endpoints;if(!n||n.length===0)return;let i={bindings:[Ns],from:WP(e.options)},s=e.options.axiosRequestConfig,a=s,c={bindings:s?[en]:[],from:Qu.from},u=e.options.parseRequestParams,l=n.reduce((C,T)=>[...C,...T.parameters],[]),p=l.filter(C=>!["Path","Header"].includes(C.type)).map(C=>C.parameterSortingEnumSchemaName??C.zodSchema),f=n.map(C=>C.response),d=er([...f,...u?p:[]]),h=d.some(C=>!Ct(C)),y=e.options.parseRequestParams&&p.length>0,b={bindings:[pt.namespace],from:pl(e.options)},g=li({resolver:e,tag:r,zodSchemas:d.filter(Ct),zodSchemasAsTypes:er(l.map(C=>C.zodSchema).filter(Ct))});return Ot(e,"endpoints")({appRestClientImport:i,hasAxiosImport:a,axiosImport:c,hasZodImport:h,zodImport:vo,hasZodUtilsImport:y,zodUtilsImport:b,modelsImports:g,includeNamespace:e.options.tsNamespaces,namespace:Be({type:"endpoints",tag:r,options:e.options}),restClientName:Ns,hasAxiosRequestConfig:s,axiosRequestConfigName:Yn,axiosRequestConfigType:en,endpoints:n,generateParse:u})}o(z$,"generateEndpoints");function Z$(e,t){let r=e.getRefByZodSchemaName(t);if(r){let i=Array.from(e.dependencyGraph.refsDependencyGraph[r]??[]).map(a=>e.getZodSchemaNameByRef(a)),s=e.getExtractedEnumZodSchemaNamesReferencedBySchemaRef(r);return[...i,...s]}let n=e.getCompositeZodSchemaByZodSchemaName(t);return n?Array.from(W$(n)).map(i=>e.getZodSchemaNameByRef(i)):[]}o(Z$,"getZodSchemaRefs");function W$(e){return e.children.reduce((r,n)=>{let i=n.ref??n.enumRef;return i&&r.add(i),n.children.length>0&&W$(n).forEach(s=>r.add(s)),r},new Set)}o(W$,"getSchemaRefs");function K$({resolver:e,data:t,tag:r=""}){var p;let n=(p=t.get(r))==null?void 0:p.zodSchemas;if(!n||Object.keys(n).length===0)return;let i=Object.keys(n).reduce((f,d)=>[...f,...Z$(e,d)],[]).filter(f=>!n[f]),s=li({resolver:e,tag:r,zodSchemas:i}),a=Object.entries(n).reduce((f,[d,h])=>{let y=e.getRefByZodSchemaName(d),b=e.getZodSchemaObj(d),g=!1;b&&ot(b)&&_t(b,{onSchema:o(C=>{if(C.type==="reference")return!0;Object.values(ls).forEach(T=>{(C.schema&&ot(C.schema)&&fs(C.schema,T)||C.parentSchema&&ot(C.parentSchema)&&fs(C.parentSchema,T))&&(g=!0)})},"onSchema")});let P={code:h,isCircular:!!y&&e.isSchemaCircular(y),isEnum:qP(h),schemaObj:b,hasBrand:g};return{...f,[d]:P}},{}),c=e.options.branded&&Object.values(a).some(f=>f.hasBrand),u={bindings:[pt.namespace],from:pl(e.options)};return Ot(e,"models")({zodImport:vo,hasZodUtilsImport:c,zodUtilsImport:u,modelsImports:s,includeNamespace:e.options.tsNamespaces,namespace:Be({type:"models",tag:r,options:e.options}),tag:r,zodSchemasData:a})}o(K$,"generateModels");function Y$({resolver:e,data:t,tag:r=""}){var Ae;let n=(Ae=t.get(r))==null?void 0:Ae.endpoints;if(!n||n.length===0)return;let i=e.options.axiosRequestConfig,s=n.some(({mediaUpload:G})=>G),a=i||s,c={defaultImport:s?Fm:void 0,bindings:i?[en]:[],from:Qu.from},u=n.filter(Xt),l=u.filter(G=>cs(G)),p=n.filter(oi),f={bindings:[...u.length>0?[qr.query]:[],...e.options.infiniteQueries&&l.length>0?[qr.infiniteQuery]:[],...p.length>0?[qr.mutation]:[]],from:uP.from},d=e.options.mutationEffects,h={bindings:[Bf],from:YP(e.options)},y=d&&p.length>0,b={bindings:[...p.length>0?[bo.optionsType,bo.hookName]:[]],from:QP(e.options)},g=n.filter(G=>G.acl),P=e.options.checkAcl&&g.length>0,$={bindings:[ci],from:JP(e.options)},C={bindings:[...u.length>0?[Ic.query]:[],...e.options.infiniteQueries&&l.length>0?[Ic.infiniteQuery]:[],...p.length>0?[Ic.mutation]:[]],from:KP(e.options)},T=n.reduce((G,j)=>[...G,...j.parameters],[]),w=li({resolver:e,tag:r,zodSchemasAsTypes:er(T.map(G=>G.zodSchema).filter(Ct))}),te=UP({tag:r,endpoints:n,options:e.options}),re=GP({tag:r,endpoints:g,options:e.options});return Ot(e,"queries")({hasAxiosImport:a,axiosImport:c,queryImport:f,hasMutationEffects:d,queryModulesImport:h,hasMutationEffectsImport:y,mutationEffectsImport:b,hasAclCheck:P,aclCheckImport:$,queryTypesImport:C,modelsImports:w,endpointsImports:te,aclImports:re,includeNamespace:e.options.tsNamespaces,tag:r,namespace:Be({type:"queries",tag:r,options:e.options}),queriesModuleName:Ta,queryModuleEnum:Bf,endpoints:n,queryEndpoints:u})}o(Y$,"generateQueries");function Q$(e){return Ot(e,"acl-check")({abilityContextImport:{...ub,from:e.options.abilityContextImportPath},appAbilitiesImport:{bindings:[qa],from:XP(e.options)},errorHandlingImport:{...Cc,from:e.options.errorHandlingImportPath},abilityContext:Hf,appAbilities:qa,errorHandler:Rn.ErrorHandler,sharedErrorHandler:Rn.SharedErrorHandler,aclCheckHook:ci,hasGenericAppAbilities:e.options.abilityContextGenericAppAbilities})}o(Q$,"generateAclCheck");function J$(e){return Ot(e,"app-rest-client")({appRestClientName:Ns,baseUrl:e.getBaseUrl()})}o(J$,"generateAppRestClient");function X$({resolver:e,data:t}){let r=[];return t.forEach((i,s)=>{var c;let a=(c=t.get(s))==null?void 0:c.endpoints;!a||a.length===0||r.push({tag:s,namespace:Be({type:"queries",tag:s,options:e.options})})}),Ot(e,"query-modules")({modules:r})}o(X$,"generateQueryModules");function e2(e){return Ot(e,"zod-utils")({zodImport:vo,zodUtilsNamespace:pt.namespace,parse:pt.exports.parse,sortExp:pt.exports.sortExp,brand:pt.exports.brand,branded:e.options.branded,errorHandler:Rn.ErrorHandler,sharedErrorHandler:Rn.SharedErrorHandler,errorHandlingImport:{...Cc,from:e.options.errorHandlingImportPath}})}o(e2,"generateZodUtils");function t2(e,t){return t.options.acl?[{fileName:Dr({output:t.options.output,fileName:Xi(nl)}),content:G$(t,e)},...t.options.checkAcl?[{fileName:Dr({output:t.options.output,fileName:Xi(il)}),content:Q$(t)}]:[]]:[]}o(t2,"getAclFiles");function r2(e,t){return t.options.mutationEffects?[...o2([lb,jc],t),{fileName:Dr({output:t.options.output,fileName:Xi(Nc)}),content:X$({resolver:t,data:e})}]:[]}o(r2,"getMutationEffectsFiles");function n2(e){return e.options.standalone?[...o2(Object.values(Tc),e),{fileName:Dr({output:e.options.output,fileName:Xi(Rc)}),content:J$(e)}]:[]}o(n2,"getStandaloneFiles");function i2(e,t){return t.options.parseRequestParams?[{fileName:Dr({output:t.options.output,fileName:Xi(Mc)}),content:e2(t)}]:[]}o(i2,"getZodUtilsFiles");function o2(e,t){return e.reduce((r,n)=>[...r,IF(n,t)],[])}o(o2,"getAssetFiles");function IF(e,t){let r=Xi(e);return{fileName:Dr({output:t.options.output,fileName:r}),content:Dx(r)}}o(IF,"getAssetFile");function s2(e,t){let r=t.standalone&&t.importPath==="ts"?"relative":t.importPath,n={...Pe,...t,importPath:r},{resolver:i,data:s}=bl(e,n),a=[],c=[],u=["models","endpoints","queries","acl"],l={models:K$,endpoints:z$,queries:Y$,acl:U$};return s.forEach((p,f)=>{u.forEach(d=>{let h=l[d]({resolver:i,data:s,tag:f});if(h){let y=Dr({output:n.output,fileName:fl({tag:f,type:d,options:n})});a.push({fileName:y,content:h}),d==="acl"&&c.push(f)}})}),a.push(...t2(c,i),...r2(s,i),...i2(s,i),...n2(i)),a}o(s2,"generateCodeFromOpenAPIDoc");async function u2({input:e,excludeTags:t,monorepo:r,prettier:n,verbose:i,...s}){let a=Date.now();i&&pr("Parsing OpenAPI spec...");let c=await a2.default.bundle(e);i&&Nn("Parsing finished."),i&&pr("Generating code...");let u=r?"monorepoTemplate":"template",l=s2(c,{input:e,excludeTags:t.split(","),restClientImportPath:lr.appRestClient[u],errorHandlingImportPath:lr.errorHandling[u],queryTypesImportPath:lr.queryTypes[u],abilityContextImportPath:lr.abilityContext[u],abilityContextGenericAppAbilities:r,...s});i&&Nn("Generation finished."),i&&pr("Writing files..."),Lx(l),i&&Nn("Writing finished."),n&&CF({output:s.output,verbose:i}),i&&pr(`TIME: ${Date.now()-a}ms`)}o(u2,"generate");function CF({output:e,verbose:t}){t&&pr("Running Prettier..."),(0,c2.exec)(`prettier --write ${e} `,n=>{t&&(n?Ls(n,"Prettier error"):Nn("Prettier finished."))})}o(CF,"execPrettier");var Re=class Re{input;output;tsNamespaces;splitByTags;defaultTag;excludeTags;excludePathRegex;excludeRedundantZodSchemas;importPath;extractEnums;removeOperationPrefixEndingWith;acl;checkAcl;standalone;baseUrl;branded;replaceOptionalWithNullish;infiniteQueries;mutationEffects;parseRequestParams;axiosRequestConfig;monorepo;prettier;verbose};o(Re,"GenerateOptions"),Se([Oe({envAlias:"input",demandOption:!0})],Re.prototype,"input",2),Se([Oe({envAlias:"output",default:Pe.output})],Re.prototype,"output",2),Se([Oe({envAlias:"tsNamespaces",default:Pe.tsNamespaces,type:"boolean"})],Re.prototype,"tsNamespaces",2),Se([Oe({envAlias:"splitByTags",default:Pe.splitByTags,type:"boolean"})],Re.prototype,"splitByTags",2),Se([Oe({envAlias:"defaultTag",default:Pe.defaultTag})],Re.prototype,"defaultTag",2),Se([Oe({envAlias:"excludeTags",default:Pe.excludeTags.join(",")})],Re.prototype,"excludeTags",2),Se([Oe({envAlias:"excludePathRegex",default:Pe.excludePathRegex})],Re.prototype,"excludePathRegex",2),Se([Oe({envAlias:"excludeRedundantZodSchemas",default:Pe.excludeRedundantZodSchemas,type:"boolean"})],Re.prototype,"excludeRedundantZodSchemas",2),Se([Oe({envAlias:"importPath",default:Pe.importPath})],Re.prototype,"importPath",2),Se([Oe({envAlias:"extractEnums",default:Pe.extractEnums,type:"boolean"})],Re.prototype,"extractEnums",2),Se([Oe({envAlias:"removeOperationPrefixEndingWith",default:Pe.removeOperationPrefixEndingWith})],Re.prototype,"removeOperationPrefixEndingWith",2),Se([Oe({envAlias:"acl",default:Pe.acl,type:"boolean"})],Re.prototype,"acl",2),Se([Oe({envAlias:"checkAcl",default:Pe.checkAcl,type:"boolean"})],Re.prototype,"checkAcl",2),Se([Oe({envAlias:"standalone",default:Pe.standalone,type:"boolean"})],Re.prototype,"standalone",2),Se([Oe({envAlias:"baseUrl",default:Pe.baseUrl})],Re.prototype,"baseUrl",2),Se([Oe({envAlias:"branded",default:Pe.branded,type:"boolean"})],Re.prototype,"branded",2),Se([Oe({envAlias:"replaceOptionalWithNullish",default:Pe.replaceOptionalWithNullish,type:"boolean"})],Re.prototype,"replaceOptionalWithNullish",2),Se([Oe({envAlias:"infiniteQueries",default:Pe.infiniteQueries,type:"boolean"})],Re.prototype,"infiniteQueries",2),Se([Oe({envAlias:"mutationEffects",default:Pe.mutationEffects,type:"boolean"})],Re.prototype,"mutationEffects",2),Se([Oe({envAlias:"parseRequestParams",default:Pe.parseRequestParams,type:"boolean"})],Re.prototype,"parseRequestParams",2),Se([Oe({envAlias:"axiosRequestConfig",default:Pe.axiosRequestConfig,type:"boolean"})],Re.prototype,"axiosRequestConfig",2),Se([Oe({envAlias:"monorepo",default:!1,type:"boolean"})],Re.prototype,"monorepo",2),Se([Oe({envAlias:"prettier",default:!0,type:"boolean"})],Re.prototype,"prettier",2),Se([Oe({envAlias:"verbose",default:!1,type:"boolean"})],Re.prototype,"verbose",2);var ry=Re,l2={command:"generate",describe:"Generate code from OpenAPI spec",builder:Vc(ry),handler:o(async e=>{let t=await e;return t.verbose&&(Bc(`OpenAPI CodeGen ${Oo()}`),Ds("input",t.input),Ds("output",t.output)),u2(t)},"handler")};cb(hf(process.argv)).version(Oo()||"unknown").scriptName("openapi-codegen").command(l2).command(Vx).help().demandCommand(1).strictCommands(!0).showHelpOnFail(!0).fail((e,t)=>{e&&Ls(e),t&&Ls(t),pr("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
|
@@ -43,12 +43,12 @@ export namespace {{zodUtilsNamespace}} {
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
{{#if branded}}
|
|
46
|
-
export class ZodBranded<T extends z.ZodTypeAny> extends z.ZodType<T["_output"], z.ZodTypeDef, T["_input"]> {
|
|
46
|
+
export class ZodBranded<T extends z.ZodTypeAny, B extends string> extends z.ZodType<T["_output"], z.ZodTypeDef, T["_input"]> {
|
|
47
47
|
readonly _schema: T;
|
|
48
48
|
|
|
49
|
-
readonly _brand:
|
|
49
|
+
readonly _brand: B;
|
|
50
50
|
|
|
51
|
-
constructor(_schema: T, _brand:
|
|
51
|
+
constructor(_schema: T, _brand: B) {
|
|
52
52
|
super(_schema._def);
|
|
53
53
|
this._schema = _schema;
|
|
54
54
|
this._brand = _brand;
|
|
@@ -63,7 +63,7 @@ export namespace {{zodUtilsNamespace}} {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export function {{brand}}<T extends z.ZodTypeAny>(schema: T, _brand:
|
|
66
|
+
export function {{brand}}<T extends z.ZodTypeAny, B extends string>(schema: T, _brand: B): ZodBranded<T, B> {
|
|
67
67
|
return new ZodBranded(schema, _brand);
|
|
68
68
|
}
|
|
69
69
|
{{/if}}
|