@zuplo/core 6.40.25 → 6.40.26
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/customer.cli.minified.js +2 -2
- package/index.minified.js +2 -2
- package/package.json +4 -4
package/customer.cli.minified.js
CHANGED
|
@@ -635,11 +635,11 @@ Did you specify these with the most recent transformation maps first?`);let d=_5
|
|
|
635
635
|
`).slice(1);return s[1].includes(Wvt)||s[2].includes(Wvt)},"isFromCjsLexer"),cTr=yp((a,s)=>{let c=a.split("?"),f=new URLSearchParams(c[1]);if(s?.filename){let d=Qvt(s.filename),v;if(d){let A=d.split("?"),O=A[0];v=A[1],s.filename=O,s.path=IS.dirname(O),s.paths=dk._nodeModulePaths(s.path),dk._cache[O]=s}v||(v=s.filename.split("?")[1]);let E=new URLSearchParams(v).get("namespace");E&&f.append("namespace",E)}return[c[0],f,(d,v)=>(IS.isAbsolute(d)&&!d.endsWith(".json")&&!d.endsWith(".node")&&!(v===0&&oTr(new Error))&&(d+=h5e(f)),d)]},"preserveQuery"),lTr=yp((a,s,c)=>{if(a.startsWith(aY)&&(a=Gvt(a)),m5e&&!Upe(a)&&!s?.filename?.includes(Zvt)){let f=m5e(a);for(let d of f)try{return c(d)}catch{}}return c(a)},"resolveTsPaths"),uTr=yp((a,s,c)=>(f,d,...v)=>{if(a.enabled===!1)return s(f,d,...v);f=g5e(f);let[E,A,O]=cTr(f,d);if((A.get("namespace")??void 0)!==c)return s(f,d,...v);let M=yp($=>s($,d,...v),"nextResolveSimple");M=aTr(M,!!(c||d?.filename&&KSr.test(d.filename))),M=rTr(M);let W=lTr(E,d,M);return O(W,v.length)},"createResolveFilename"),Hvt=yp((a,s)=>{if(!s)throw new Error("The current file path (__filename or import.meta.url) must be provided in the second argument of tsx.require()");return a.startsWith(".")?((typeof s=="string"&&s.startsWith(aY)||s instanceof URL)&&(s=Gvt(s)),IS.resolve(IS.dirname(s),a)):a},"resolveContext"),oY=yp(a=>{let{sourceMapsEnabled:s}=process,c={enabled:!0};YSr(process.env.TSX_TSCONFIG_PATH),process.setSourceMapsEnabled(!0);let f=dk._resolveFilename,d=uTr(c,f,a?.namespace);dk._resolveFilename=d;let v=tTr(c,dk._extensions,a?.namespace),E=yp(()=>{s===!1&&process.setSourceMapsEnabled(!1),c.enabled=!1,dk._resolveFilename===d&&(dk._resolveFilename=f),v()},"unregister");if(a?.namespace){let A=yp((M,W)=>{let $=Hvt(M,W),[Y,Ne]=$.split("?"),De=new URLSearchParams(Ne);return a.namespace&&!Y.startsWith("node:")&&De.set("namespace",a.namespace),T7(Y+h5e(De))},"scopedRequire");E.require=A;let O=yp((M,W,$)=>{let Y=Hvt(M,W),[Ne,De]=Y.split("?"),Se=new URLSearchParams(De);return a.namespace&&!Ne.startsWith("node:")&&Se.set("namespace",a.namespace),d(Ne+h5e(Se),module,!1,$)},"scopedResolve");E.resolve=O,E.unregister=E}return E},"register");import{pathToFileURL as pTr}from"url";var fTr=Object.defineProperty,Jpe=t((a,s)=>fTr(a,"name",{value:s,configurable:!0}),"o"),dTr=Jpe(a=>(s,c)=>{if(!c)throw new Error("The current file path (import.meta.url) must be provided in the second argument of tsImport()");let f=c.startsWith(aY)?c:pTr(c).toString();return import(`tsx://${JSON.stringify({specifier:s,parentURL:f,namespace:a})}`)},"createScopedImport"),ibt=!1,sbt=Jpe(a=>{if(!$pe.register)throw new Error(`This version of Node.js (${process.version}) does not support module.register(). Please upgrade to Node v18.19 or v20.6 and above.`);if(!ibt){let{_resolveFilename:A}=$pe;$pe._resolveFilename=(O,...M)=>A(g5e(O),...M),ibt=!0}let{sourceMapsEnabled:s}=process;process.setSourceMapsEnabled(!0);let{port1:c,port2:f}=new _Tr;$pe.register(`./esm/index.mjs?${Date.now()}`,{parentURL:import.meta.url,data:{port:f,namespace:a?.namespace,tsconfig:a?.tsconfig},transferList:[f]});let d=a?.onImport,v=d&&(A=>{A.type==="load"&&d(A.url)});v&&(c.on("message",v),c.unref());let E=Jpe(()=>(s===!1&&process.setSourceMapsEnabled(!1),v&&c.off("message",v),c.postMessage("deactivate"),new Promise(A=>{let O=Jpe(M=>{M.type==="deactivated"&&(A(),c.off("message",O))},"onDeactivated");c.on("message",O)})),"unregister");return a?.namespace&&(E.import=dTr(a.namespace),E.unregister=E),E},"register");var mTr=Object.defineProperty,obt=t((a,s)=>mTr(a,"name",{value:s,configurable:!0}),"a"),oU,qpe=obt((a,s)=>(oU||(oU=oY({namespace:Date.now().toString()})),oU.require(a,s)),"tsxRequire"),abt=obt((a,s,c)=>(oU||(oU=oY({namespace:Date.now().toString()})),oU.resolve(a,s,c)),"resolve");abt.paths=T7.resolve.paths,qpe.resolve=abt,qpe.main=T7.main,qpe.extensions=T7.extensions,qpe.cache=T7.cache;var hTr=Object.defineProperty,cbt=t((a,s)=>hTr(a,"name",{value:s,configurable:!0}),"o"),gTr=cbt((a,s)=>{let c=a[0]-s[0];if(c===0){let f=a[1]-s[1];return f===0?a[2]>=s[2]:f>0}return c>0},"isVersionGreaterOrEqual"),yTr=process.versions.node.split(".").map(Number),lbt=cbt((a,s=yTr)=>{for(let c=0;c<a.length;c+=1){let f=a[c];if(c===a.length-1||s[0]===f[0])return gTr(s,f)}return!1},"isFeatureSupported");var ubt=[[20,11,0],[21,3,0]];import"esbuild";var vTr=Object.defineProperty,bTr=t((a,s)=>vTr(a,"name",{value:s,configurable:!0}),"i"),STr=bTr((a,s)=>{if(!s||typeof s=="object"&&!s.parentURL)throw new Error("The current file path (import.meta.url) must be provided in the second argument of tsImport()");let c=typeof s=="string",f=c?s:s.parentURL,d=Date.now().toString(),v=oY({namespace:d});return!lbt(ubt)&&!Xvt.test(a)&&Kvt.test(a)?Promise.resolve(v.require(a,f)):sbt({namespace:d,...c?{}:s}).import(a,f)},"tsImport");var cf;(function(a){a.assertEqual=d=>d;function s(d){}t(s,"assertIs"),a.assertIs=s;function c(d){throw new Error}t(c,"assertNever"),a.assertNever=c,a.arrayToEnum=d=>{let v={};for(let E of d)v[E]=E;return v},a.getValidEnumValues=d=>{let v=a.objectKeys(d).filter(A=>typeof d[d[A]]!="number"),E={};for(let A of v)E[A]=d[A];return a.objectValues(E)},a.objectValues=d=>a.objectKeys(d).map(function(v){return d[v]}),a.objectKeys=typeof Object.keys=="function"?d=>Object.keys(d):d=>{let v=[];for(let E in d)Object.prototype.hasOwnProperty.call(d,E)&&v.push(E);return v},a.find=(d,v)=>{for(let E of d)if(v(E))return E},a.isInteger=typeof Number.isInteger=="function"?d=>Number.isInteger(d):d=>typeof d=="number"&&isFinite(d)&&Math.floor(d)===d;function f(d,v=" | "){return d.map(E=>typeof E=="string"?`'${E}'`:E).join(v)}t(f,"joinValues"),a.joinValues=f,a.jsonStringifyReplacer=(d,v)=>typeof v=="bigint"?v.toString():v})(cf||(cf={}));var v5e;(function(a){a.mergeShapes=(s,c)=>({...s,...c})})(v5e||(v5e={}));var Xa=cf.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),HN=t(a=>{switch(typeof a){case"undefined":return Xa.undefined;case"string":return Xa.string;case"number":return isNaN(a)?Xa.nan:Xa.number;case"boolean":return Xa.boolean;case"function":return Xa.function;case"bigint":return Xa.bigint;case"symbol":return Xa.symbol;case"object":return Array.isArray(a)?Xa.array:a===null?Xa.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?Xa.promise:typeof Map<"u"&&a instanceof Map?Xa.map:typeof Set<"u"&&a instanceof Set?Xa.set:typeof Date<"u"&&a instanceof Date?Xa.date:Xa.object;default:return Xa.unknown}},"getParsedType"),Rs=cf.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),TTr=t(a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),OS=class a extends Error{static{t(this,"ZodError")}constructor(s){super(),this.issues=[],this.addIssue=f=>{this.issues=[...this.issues,f]},this.addIssues=(f=[])=>{this.issues=[...this.issues,...f]};let c=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,c):this.__proto__=c,this.name="ZodError",this.issues=s}get errors(){return this.issues}format(s){let c=s||function(v){return v.message},f={_errors:[]},d=t(v=>{for(let E of v.issues)if(E.code==="invalid_union")E.unionErrors.map(d);else if(E.code==="invalid_return_type")d(E.returnTypeError);else if(E.code==="invalid_arguments")d(E.argumentsError);else if(E.path.length===0)f._errors.push(c(E));else{let A=f,O=0;for(;O<E.path.length;){let M=E.path[O];O===E.path.length-1?(A[M]=A[M]||{_errors:[]},A[M]._errors.push(c(E))):A[M]=A[M]||{_errors:[]},A=A[M],O++}}},"processError");return d(this),f}static assert(s){if(!(s instanceof a))throw new Error(`Not a ZodError: ${s}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,cf.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(s=c=>c.message){let c={},f=[];for(let d of this.issues)d.path.length>0?(c[d.path[0]]=c[d.path[0]]||[],c[d.path[0]].push(s(d))):f.push(s(d));return{formErrors:f,fieldErrors:c}}get formErrors(){return this.flatten()}};OS.create=a=>new OS(a);var uU=t((a,s)=>{let c;switch(a.code){case Rs.invalid_type:a.received===Xa.undefined?c="Required":c=`Expected ${a.expected}, received ${a.received}`;break;case Rs.invalid_literal:c=`Invalid literal value, expected ${JSON.stringify(a.expected,cf.jsonStringifyReplacer)}`;break;case Rs.unrecognized_keys:c=`Unrecognized key(s) in object: ${cf.joinValues(a.keys,", ")}`;break;case Rs.invalid_union:c="Invalid input";break;case Rs.invalid_union_discriminator:c=`Invalid discriminator value. Expected ${cf.joinValues(a.options)}`;break;case Rs.invalid_enum_value:c=`Invalid enum value. Expected ${cf.joinValues(a.options)}, received '${a.received}'`;break;case Rs.invalid_arguments:c="Invalid function arguments";break;case Rs.invalid_return_type:c="Invalid function return type";break;case Rs.invalid_date:c="Invalid date";break;case Rs.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(c=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(c=`${c} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?c=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?c=`Invalid input: must end with "${a.validation.endsWith}"`:cf.assertNever(a.validation):a.validation!=="regex"?c=`Invalid ${a.validation}`:c="Invalid";break;case Rs.too_small:a.type==="array"?c=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?c=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?c=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?c=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:c="Invalid input";break;case Rs.too_big:a.type==="array"?c=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?c=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?c=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?c=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?c=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:c="Invalid input";break;case Rs.custom:c="Invalid input";break;case Rs.invalid_intersection_types:c="Intersection results could not be merged";break;case Rs.not_multiple_of:c=`Number must be a multiple of ${a.multipleOf}`;break;case Rs.not_finite:c="Number must be finite";break;default:c=s.defaultError,cf.assertNever(a)}return{message:c}},"errorMap"),pbt=uU;function CTr(a){pbt=a}t(CTr,"setErrorMap");function zpe(){return pbt}t(zpe,"getErrorMap");var Vpe=t(a=>{let{data:s,path:c,errorMaps:f,issueData:d}=a,v=[...c,...d.path||[]],E={...d,path:v};if(d.message!==void 0)return{...d,path:v,message:d.message};let A="",O=f.filter(M=>!!M).slice().reverse();for(let M of O)A=M(E,{data:s,defaultError:A}).message;return{...d,path:v,message:A}},"makeIssue"),ETr=[];function Ba(a,s){let c=zpe(),f=Vpe({issueData:s,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,c,c===uU?void 0:uU].filter(d=>!!d)});a.common.issues.push(f)}t(Ba,"addIssueToContext");var u1=class a{static{t(this,"ParseStatus")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(s,c){let f=[];for(let d of c){if(d.status==="aborted")return Oc;d.status==="dirty"&&s.dirty(),f.push(d.value)}return{status:s.value,value:f}}static async mergeObjectAsync(s,c){let f=[];for(let d of c){let v=await d.key,E=await d.value;f.push({key:v,value:E})}return a.mergeObjectSync(s,f)}static mergeObjectSync(s,c){let f={};for(let d of c){let{key:v,value:E}=d;if(v.status==="aborted"||E.status==="aborted")return Oc;v.status==="dirty"&&s.dirty(),E.status==="dirty"&&s.dirty(),v.value!=="__proto__"&&(typeof E.value<"u"||d.alwaysSet)&&(f[v.value]=E.value)}return{status:s.value,value:f}}},Oc=Object.freeze({status:"aborted"}),lU=t(a=>({status:"dirty",value:a}),"DIRTY"),Nv=t(a=>({status:"valid",value:a}),"OK"),b5e=t(a=>a.status==="aborted","isAborted"),S5e=t(a=>a.status==="dirty","isDirty"),uY=t(a=>a.status==="valid","isValid"),fY=t(a=>typeof Promise<"u"&&a instanceof Promise,"isAsync");function Wpe(a,s,c,f){if(c==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof s=="function"?a!==s||!f:!s.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return c==="m"?f:c==="a"?f.call(a):f?f.value:s.get(a)}t(Wpe,"__classPrivateFieldGet");function dbt(a,s,c,f,d){if(f==="m")throw new TypeError("Private method is not writable");if(f==="a"&&!d)throw new TypeError("Private accessor was defined without a setter");if(typeof s=="function"?a!==s||!d:!s.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return f==="a"?d.call(a,c):d?d.value=c:s.set(a,c),c}t(dbt,"__classPrivateFieldSet");var Jo;(function(a){a.errToObj=s=>typeof s=="string"?{message:s}:s||{},a.toString=s=>typeof s=="string"?s:s?.message})(Jo||(Jo={}));var cY,lY,IC=class{static{t(this,"ParseInputLazyPath")}constructor(s,c,f,d){this._cachedPath=[],this.parent=s,this.data=c,this._path=f,this._key=d}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},fbt=t((a,s)=>{if(uY(s))return{success:!0,data:s.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let c=new OS(a.common.issues);return this._error=c,this._error}}},"handleResult");function xl(a){if(!a)return{};let{errorMap:s,invalid_type_error:c,required_error:f,description:d}=a;if(s&&(c||f))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return s?{errorMap:s,description:d}:{errorMap:t((E,A)=>{var O,M;let{message:W}=a;return E.code==="invalid_enum_value"?{message:W??A.defaultError}:typeof A.data>"u"?{message:(O=W??f)!==null&&O!==void 0?O:A.defaultError}:E.code!=="invalid_type"?{message:A.defaultError}:{message:(M=W??c)!==null&&M!==void 0?M:A.defaultError}},"customMap"),description:d}}t(xl,"processCreateParams");var Dl=class{static{t(this,"ZodType")}constructor(s){this.spa=this.safeParseAsync,this._def=s,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(s){return HN(s.data)}_getOrReturnCtx(s,c){return c||{common:s.parent.common,data:s.data,parsedType:HN(s.data),schemaErrorMap:this._def.errorMap,path:s.path,parent:s.parent}}_processInputParams(s){return{status:new u1,ctx:{common:s.parent.common,data:s.data,parsedType:HN(s.data),schemaErrorMap:this._def.errorMap,path:s.path,parent:s.parent}}}_parseSync(s){let c=this._parse(s);if(fY(c))throw new Error("Synchronous parse encountered promise.");return c}_parseAsync(s){let c=this._parse(s);return Promise.resolve(c)}parse(s,c){let f=this.safeParse(s,c);if(f.success)return f.data;throw f.error}safeParse(s,c){var f;let d={common:{issues:[],async:(f=c?.async)!==null&&f!==void 0?f:!1,contextualErrorMap:c?.errorMap},path:c?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:s,parsedType:HN(s)},v=this._parseSync({data:s,path:d.path,parent:d});return fbt(d,v)}async parseAsync(s,c){let f=await this.safeParseAsync(s,c);if(f.success)return f.data;throw f.error}async safeParseAsync(s,c){let f={common:{issues:[],contextualErrorMap:c?.errorMap,async:!0},path:c?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:s,parsedType:HN(s)},d=this._parse({data:s,path:f.path,parent:f}),v=await(fY(d)?d:Promise.resolve(d));return fbt(f,v)}refine(s,c){let f=t(d=>typeof c=="string"||typeof c>"u"?{message:c}:typeof c=="function"?c(d):c,"getIssueProperties");return this._refinement((d,v)=>{let E=s(d),A=t(()=>v.addIssue({code:Rs.custom,...f(d)}),"setError");return typeof Promise<"u"&&E instanceof Promise?E.then(O=>O?!0:(A(),!1)):E?!0:(A(),!1)})}refinement(s,c){return this._refinement((f,d)=>s(f)?!0:(d.addIssue(typeof c=="function"?c(f,d):c),!1))}_refinement(s){return new FS({schema:this,typeName:kc.ZodEffects,effect:{type:"refinement",refinement:s}})}superRefine(s){return this._refinement(s)}optional(){return NC.create(this,this._def)}nullable(){return hk.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return D6.create(this,this._def)}promise(){return KN.create(this,this._def)}or(s){return N7.create([this,s],this._def)}and(s){return I7.create(this,s,this._def)}transform(s){return new FS({...xl(this._def),schema:this,typeName:kc.ZodEffects,effect:{type:"transform",transform:s}})}default(s){let c=typeof s=="function"?s:()=>s;return new M7({...xl(this._def),innerType:this,defaultValue:c,typeName:kc.ZodDefault})}brand(){return new _Y({typeName:kc.ZodBranded,type:this,...xl(this._def)})}catch(s){let c=typeof s=="function"?s:()=>s;return new j7({...xl(this._def),innerType:this,catchValue:c,typeName:kc.ZodCatch})}describe(s){let c=this.constructor;return new c({...this._def,description:s})}pipe(s){return pY.create(this,s)}readonly(){return B7.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},xTr=/^c[^\s-]{8,}$/i,DTr=/^[0-9a-z]+$/,ATr=/^[0-9A-HJKMNP-TV-Z]{26}$/,kTr=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,wTr=/^[a-z0-9_-]{21}$/i,PTr=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,NTr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ITr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",y5e,OTr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,FTr=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,LTr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mbt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",RTr=new RegExp(`^${mbt}$`);function hbt(a){let s="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return a.precision?s=`${s}\\.\\d{${a.precision}}`:a.precision==null&&(s=`${s}(\\.\\d+)?`),s}t(hbt,"timeRegexSource");function MTr(a){return new RegExp(`^${hbt(a)}$`)}t(MTr,"timeRegex");function gbt(a){let s=`${mbt}T${hbt(a)}`,c=[];return c.push(a.local?"Z?":"Z"),a.offset&&c.push("([+-]\\d{2}:?\\d{2})"),s=`${s}(${c.join("|")})`,new RegExp(`^${s}$`)}t(gbt,"datetimeRegex");function jTr(a,s){return!!((s==="v4"||!s)&&OTr.test(a)||(s==="v6"||!s)&&FTr.test(a))}t(jTr,"isValidIP");var GN=class a extends Dl{static{t(this,"ZodString")}_parse(s){if(this._def.coerce&&(s.data=String(s.data)),this._getType(s)!==Xa.string){let v=this._getOrReturnCtx(s);return Ba(v,{code:Rs.invalid_type,expected:Xa.string,received:v.parsedType}),Oc}let f=new u1,d;for(let v of this._def.checks)if(v.kind==="min")s.data.length<v.value&&(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.too_small,minimum:v.value,type:"string",inclusive:!0,exact:!1,message:v.message}),f.dirty());else if(v.kind==="max")s.data.length>v.value&&(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.too_big,maximum:v.value,type:"string",inclusive:!0,exact:!1,message:v.message}),f.dirty());else if(v.kind==="length"){let E=s.data.length>v.value,A=s.data.length<v.value;(E||A)&&(d=this._getOrReturnCtx(s,d),E?Ba(d,{code:Rs.too_big,maximum:v.value,type:"string",inclusive:!0,exact:!0,message:v.message}):A&&Ba(d,{code:Rs.too_small,minimum:v.value,type:"string",inclusive:!0,exact:!0,message:v.message}),f.dirty())}else if(v.kind==="email")NTr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"email",code:Rs.invalid_string,message:v.message}),f.dirty());else if(v.kind==="emoji")y5e||(y5e=new RegExp(ITr,"u")),y5e.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"emoji",code:Rs.invalid_string,message:v.message}),f.dirty());else if(v.kind==="uuid")kTr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"uuid",code:Rs.invalid_string,message:v.message}),f.dirty());else if(v.kind==="nanoid")wTr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"nanoid",code:Rs.invalid_string,message:v.message}),f.dirty());else if(v.kind==="cuid")xTr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"cuid",code:Rs.invalid_string,message:v.message}),f.dirty());else if(v.kind==="cuid2")DTr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"cuid2",code:Rs.invalid_string,message:v.message}),f.dirty());else if(v.kind==="ulid")ATr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"ulid",code:Rs.invalid_string,message:v.message}),f.dirty());else if(v.kind==="url")try{new URL(s.data)}catch{d=this._getOrReturnCtx(s,d),Ba(d,{validation:"url",code:Rs.invalid_string,message:v.message}),f.dirty()}else v.kind==="regex"?(v.regex.lastIndex=0,v.regex.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"regex",code:Rs.invalid_string,message:v.message}),f.dirty())):v.kind==="trim"?s.data=s.data.trim():v.kind==="includes"?s.data.includes(v.value,v.position)||(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.invalid_string,validation:{includes:v.value,position:v.position},message:v.message}),f.dirty()):v.kind==="toLowerCase"?s.data=s.data.toLowerCase():v.kind==="toUpperCase"?s.data=s.data.toUpperCase():v.kind==="startsWith"?s.data.startsWith(v.value)||(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.invalid_string,validation:{startsWith:v.value},message:v.message}),f.dirty()):v.kind==="endsWith"?s.data.endsWith(v.value)||(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.invalid_string,validation:{endsWith:v.value},message:v.message}),f.dirty()):v.kind==="datetime"?gbt(v).test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.invalid_string,validation:"datetime",message:v.message}),f.dirty()):v.kind==="date"?RTr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.invalid_string,validation:"date",message:v.message}),f.dirty()):v.kind==="time"?MTr(v).test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.invalid_string,validation:"time",message:v.message}),f.dirty()):v.kind==="duration"?PTr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"duration",code:Rs.invalid_string,message:v.message}),f.dirty()):v.kind==="ip"?jTr(s.data,v.version)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"ip",code:Rs.invalid_string,message:v.message}),f.dirty()):v.kind==="base64"?LTr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"base64",code:Rs.invalid_string,message:v.message}),f.dirty()):cf.assertNever(v);return{status:f.value,value:s.data}}_regex(s,c,f){return this.refinement(d=>s.test(d),{validation:c,code:Rs.invalid_string,...Jo.errToObj(f)})}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}email(s){return this._addCheck({kind:"email",...Jo.errToObj(s)})}url(s){return this._addCheck({kind:"url",...Jo.errToObj(s)})}emoji(s){return this._addCheck({kind:"emoji",...Jo.errToObj(s)})}uuid(s){return this._addCheck({kind:"uuid",...Jo.errToObj(s)})}nanoid(s){return this._addCheck({kind:"nanoid",...Jo.errToObj(s)})}cuid(s){return this._addCheck({kind:"cuid",...Jo.errToObj(s)})}cuid2(s){return this._addCheck({kind:"cuid2",...Jo.errToObj(s)})}ulid(s){return this._addCheck({kind:"ulid",...Jo.errToObj(s)})}base64(s){return this._addCheck({kind:"base64",...Jo.errToObj(s)})}ip(s){return this._addCheck({kind:"ip",...Jo.errToObj(s)})}datetime(s){var c,f;return typeof s=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:s}):this._addCheck({kind:"datetime",precision:typeof s?.precision>"u"?null:s?.precision,offset:(c=s?.offset)!==null&&c!==void 0?c:!1,local:(f=s?.local)!==null&&f!==void 0?f:!1,...Jo.errToObj(s?.message)})}date(s){return this._addCheck({kind:"date",message:s})}time(s){return typeof s=="string"?this._addCheck({kind:"time",precision:null,message:s}):this._addCheck({kind:"time",precision:typeof s?.precision>"u"?null:s?.precision,...Jo.errToObj(s?.message)})}duration(s){return this._addCheck({kind:"duration",...Jo.errToObj(s)})}regex(s,c){return this._addCheck({kind:"regex",regex:s,...Jo.errToObj(c)})}includes(s,c){return this._addCheck({kind:"includes",value:s,position:c?.position,...Jo.errToObj(c?.message)})}startsWith(s,c){return this._addCheck({kind:"startsWith",value:s,...Jo.errToObj(c)})}endsWith(s,c){return this._addCheck({kind:"endsWith",value:s,...Jo.errToObj(c)})}min(s,c){return this._addCheck({kind:"min",value:s,...Jo.errToObj(c)})}max(s,c){return this._addCheck({kind:"max",value:s,...Jo.errToObj(c)})}length(s,c){return this._addCheck({kind:"length",value:s,...Jo.errToObj(c)})}nonempty(s){return this.min(1,Jo.errToObj(s))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(s=>s.kind==="datetime")}get isDate(){return!!this._def.checks.find(s=>s.kind==="date")}get isTime(){return!!this._def.checks.find(s=>s.kind==="time")}get isDuration(){return!!this._def.checks.find(s=>s.kind==="duration")}get isEmail(){return!!this._def.checks.find(s=>s.kind==="email")}get isURL(){return!!this._def.checks.find(s=>s.kind==="url")}get isEmoji(){return!!this._def.checks.find(s=>s.kind==="emoji")}get isUUID(){return!!this._def.checks.find(s=>s.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(s=>s.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(s=>s.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(s=>s.kind==="cuid2")}get isULID(){return!!this._def.checks.find(s=>s.kind==="ulid")}get isIP(){return!!this._def.checks.find(s=>s.kind==="ip")}get isBase64(){return!!this._def.checks.find(s=>s.kind==="base64")}get minLength(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s}get maxLength(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s}};GN.create=a=>{var s;return new GN({checks:[],typeName:kc.ZodString,coerce:(s=a?.coerce)!==null&&s!==void 0?s:!1,...xl(a)})};function BTr(a,s){let c=(a.toString().split(".")[1]||"").length,f=(s.toString().split(".")[1]||"").length,d=c>f?c:f,v=parseInt(a.toFixed(d).replace(".","")),E=parseInt(s.toFixed(d).replace(".",""));return v%E/Math.pow(10,d)}t(BTr,"floatSafeRemainder");var x7=class a extends Dl{static{t(this,"ZodNumber")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(s){if(this._def.coerce&&(s.data=Number(s.data)),this._getType(s)!==Xa.number){let v=this._getOrReturnCtx(s);return Ba(v,{code:Rs.invalid_type,expected:Xa.number,received:v.parsedType}),Oc}let f,d=new u1;for(let v of this._def.checks)v.kind==="int"?cf.isInteger(s.data)||(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.invalid_type,expected:"integer",received:"float",message:v.message}),d.dirty()):v.kind==="min"?(v.inclusive?s.data<v.value:s.data<=v.value)&&(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.too_small,minimum:v.value,type:"number",inclusive:v.inclusive,exact:!1,message:v.message}),d.dirty()):v.kind==="max"?(v.inclusive?s.data>v.value:s.data>=v.value)&&(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.too_big,maximum:v.value,type:"number",inclusive:v.inclusive,exact:!1,message:v.message}),d.dirty()):v.kind==="multipleOf"?BTr(s.data,v.value)!==0&&(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.not_multiple_of,multipleOf:v.value,message:v.message}),d.dirty()):v.kind==="finite"?Number.isFinite(s.data)||(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.not_finite,message:v.message}),d.dirty()):cf.assertNever(v);return{status:d.value,value:s.data}}gte(s,c){return this.setLimit("min",s,!0,Jo.toString(c))}gt(s,c){return this.setLimit("min",s,!1,Jo.toString(c))}lte(s,c){return this.setLimit("max",s,!0,Jo.toString(c))}lt(s,c){return this.setLimit("max",s,!1,Jo.toString(c))}setLimit(s,c,f,d){return new a({...this._def,checks:[...this._def.checks,{kind:s,value:c,inclusive:f,message:Jo.toString(d)}]})}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}int(s){return this._addCheck({kind:"int",message:Jo.toString(s)})}positive(s){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Jo.toString(s)})}negative(s){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Jo.toString(s)})}nonpositive(s){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Jo.toString(s)})}nonnegative(s){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Jo.toString(s)})}multipleOf(s,c){return this._addCheck({kind:"multipleOf",value:s,message:Jo.toString(c)})}finite(s){return this._addCheck({kind:"finite",message:Jo.toString(s)})}safe(s){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Jo.toString(s)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Jo.toString(s)})}get minValue(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s}get maxValue(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s}get isInt(){return!!this._def.checks.find(s=>s.kind==="int"||s.kind==="multipleOf"&&cf.isInteger(s.value))}get isFinite(){let s=null,c=null;for(let f of this._def.checks){if(f.kind==="finite"||f.kind==="int"||f.kind==="multipleOf")return!0;f.kind==="min"?(c===null||f.value>c)&&(c=f.value):f.kind==="max"&&(s===null||f.value<s)&&(s=f.value)}return Number.isFinite(c)&&Number.isFinite(s)}};x7.create=a=>new x7({checks:[],typeName:kc.ZodNumber,coerce:a?.coerce||!1,...xl(a)});var D7=class a extends Dl{static{t(this,"ZodBigInt")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(s){if(this._def.coerce&&(s.data=BigInt(s.data)),this._getType(s)!==Xa.bigint){let v=this._getOrReturnCtx(s);return Ba(v,{code:Rs.invalid_type,expected:Xa.bigint,received:v.parsedType}),Oc}let f,d=new u1;for(let v of this._def.checks)v.kind==="min"?(v.inclusive?s.data<v.value:s.data<=v.value)&&(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.too_small,type:"bigint",minimum:v.value,inclusive:v.inclusive,message:v.message}),d.dirty()):v.kind==="max"?(v.inclusive?s.data>v.value:s.data>=v.value)&&(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.too_big,type:"bigint",maximum:v.value,inclusive:v.inclusive,message:v.message}),d.dirty()):v.kind==="multipleOf"?s.data%v.value!==BigInt(0)&&(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.not_multiple_of,multipleOf:v.value,message:v.message}),d.dirty()):cf.assertNever(v);return{status:d.value,value:s.data}}gte(s,c){return this.setLimit("min",s,!0,Jo.toString(c))}gt(s,c){return this.setLimit("min",s,!1,Jo.toString(c))}lte(s,c){return this.setLimit("max",s,!0,Jo.toString(c))}lt(s,c){return this.setLimit("max",s,!1,Jo.toString(c))}setLimit(s,c,f,d){return new a({...this._def,checks:[...this._def.checks,{kind:s,value:c,inclusive:f,message:Jo.toString(d)}]})}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}positive(s){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Jo.toString(s)})}negative(s){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Jo.toString(s)})}nonpositive(s){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Jo.toString(s)})}nonnegative(s){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Jo.toString(s)})}multipleOf(s,c){return this._addCheck({kind:"multipleOf",value:s,message:Jo.toString(c)})}get minValue(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s}get maxValue(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s}};D7.create=a=>{var s;return new D7({checks:[],typeName:kc.ZodBigInt,coerce:(s=a?.coerce)!==null&&s!==void 0?s:!1,...xl(a)})};var A7=class extends Dl{static{t(this,"ZodBoolean")}_parse(s){if(this._def.coerce&&(s.data=!!s.data),this._getType(s)!==Xa.boolean){let f=this._getOrReturnCtx(s);return Ba(f,{code:Rs.invalid_type,expected:Xa.boolean,received:f.parsedType}),Oc}return Nv(s.data)}};A7.create=a=>new A7({typeName:kc.ZodBoolean,coerce:a?.coerce||!1,...xl(a)});var k7=class a extends Dl{static{t(this,"ZodDate")}_parse(s){if(this._def.coerce&&(s.data=new Date(s.data)),this._getType(s)!==Xa.date){let v=this._getOrReturnCtx(s);return Ba(v,{code:Rs.invalid_type,expected:Xa.date,received:v.parsedType}),Oc}if(isNaN(s.data.getTime())){let v=this._getOrReturnCtx(s);return Ba(v,{code:Rs.invalid_date}),Oc}let f=new u1,d;for(let v of this._def.checks)v.kind==="min"?s.data.getTime()<v.value&&(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.too_small,message:v.message,inclusive:!0,exact:!1,minimum:v.value,type:"date"}),f.dirty()):v.kind==="max"?s.data.getTime()>v.value&&(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.too_big,message:v.message,inclusive:!0,exact:!1,maximum:v.value,type:"date"}),f.dirty()):cf.assertNever(v);return{status:f.value,value:new Date(s.data.getTime())}}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}min(s,c){return this._addCheck({kind:"min",value:s.getTime(),message:Jo.toString(c)})}max(s,c){return this._addCheck({kind:"max",value:s.getTime(),message:Jo.toString(c)})}get minDate(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s!=null?new Date(s):null}get maxDate(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s!=null?new Date(s):null}};k7.create=a=>new k7({checks:[],coerce:a?.coerce||!1,typeName:kc.ZodDate,...xl(a)});var fU=class extends Dl{static{t(this,"ZodSymbol")}_parse(s){if(this._getType(s)!==Xa.symbol){let f=this._getOrReturnCtx(s);return Ba(f,{code:Rs.invalid_type,expected:Xa.symbol,received:f.parsedType}),Oc}return Nv(s.data)}};fU.create=a=>new fU({typeName:kc.ZodSymbol,...xl(a)});var w7=class extends Dl{static{t(this,"ZodUndefined")}_parse(s){if(this._getType(s)!==Xa.undefined){let f=this._getOrReturnCtx(s);return Ba(f,{code:Rs.invalid_type,expected:Xa.undefined,received:f.parsedType}),Oc}return Nv(s.data)}};w7.create=a=>new w7({typeName:kc.ZodUndefined,...xl(a)});var P7=class extends Dl{static{t(this,"ZodNull")}_parse(s){if(this._getType(s)!==Xa.null){let f=this._getOrReturnCtx(s);return Ba(f,{code:Rs.invalid_type,expected:Xa.null,received:f.parsedType}),Oc}return Nv(s.data)}};P7.create=a=>new P7({typeName:kc.ZodNull,...xl(a)});var QN=class extends Dl{static{t(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(s){return Nv(s.data)}};QN.create=a=>new QN({typeName:kc.ZodAny,...xl(a)});var x6=class extends Dl{static{t(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(s){return Nv(s.data)}};x6.create=a=>new x6({typeName:kc.ZodUnknown,...xl(a)});var Vx=class extends Dl{static{t(this,"ZodNever")}_parse(s){let c=this._getOrReturnCtx(s);return Ba(c,{code:Rs.invalid_type,expected:Xa.never,received:c.parsedType}),Oc}};Vx.create=a=>new Vx({typeName:kc.ZodNever,...xl(a)});var _U=class extends Dl{static{t(this,"ZodVoid")}_parse(s){if(this._getType(s)!==Xa.undefined){let f=this._getOrReturnCtx(s);return Ba(f,{code:Rs.invalid_type,expected:Xa.void,received:f.parsedType}),Oc}return Nv(s.data)}};_U.create=a=>new _U({typeName:kc.ZodVoid,...xl(a)});var D6=class a extends Dl{static{t(this,"ZodArray")}_parse(s){let{ctx:c,status:f}=this._processInputParams(s),d=this._def;if(c.parsedType!==Xa.array)return Ba(c,{code:Rs.invalid_type,expected:Xa.array,received:c.parsedType}),Oc;if(d.exactLength!==null){let E=c.data.length>d.exactLength.value,A=c.data.length<d.exactLength.value;(E||A)&&(Ba(c,{code:E?Rs.too_big:Rs.too_small,minimum:A?d.exactLength.value:void 0,maximum:E?d.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:d.exactLength.message}),f.dirty())}if(d.minLength!==null&&c.data.length<d.minLength.value&&(Ba(c,{code:Rs.too_small,minimum:d.minLength.value,type:"array",inclusive:!0,exact:!1,message:d.minLength.message}),f.dirty()),d.maxLength!==null&&c.data.length>d.maxLength.value&&(Ba(c,{code:Rs.too_big,maximum:d.maxLength.value,type:"array",inclusive:!0,exact:!1,message:d.maxLength.message}),f.dirty()),c.common.async)return Promise.all([...c.data].map((E,A)=>d.type._parseAsync(new IC(c,E,c.path,A)))).then(E=>u1.mergeArray(f,E));let v=[...c.data].map((E,A)=>d.type._parseSync(new IC(c,E,c.path,A)));return u1.mergeArray(f,v)}get element(){return this._def.type}min(s,c){return new a({...this._def,minLength:{value:s,message:Jo.toString(c)}})}max(s,c){return new a({...this._def,maxLength:{value:s,message:Jo.toString(c)}})}length(s,c){return new a({...this._def,exactLength:{value:s,message:Jo.toString(c)}})}nonempty(s){return this.min(1,s)}};D6.create=(a,s)=>new D6({type:a,minLength:null,maxLength:null,exactLength:null,typeName:kc.ZodArray,...xl(s)});function cU(a){if(a instanceof Qb){let s={};for(let c in a.shape){let f=a.shape[c];s[c]=NC.create(cU(f))}return new Qb({...a._def,shape:t(()=>s,"shape")})}else return a instanceof D6?new D6({...a._def,type:cU(a.element)}):a instanceof NC?NC.create(cU(a.unwrap())):a instanceof hk?hk.create(cU(a.unwrap())):a instanceof mk?mk.create(a.items.map(s=>cU(s))):a}t(cU,"deepPartialify");var Qb=class a extends Dl{static{t(this,"ZodObject")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let s=this._def.shape(),c=cf.objectKeys(s);return this._cached={shape:s,keys:c}}_parse(s){if(this._getType(s)!==Xa.object){let M=this._getOrReturnCtx(s);return Ba(M,{code:Rs.invalid_type,expected:Xa.object,received:M.parsedType}),Oc}let{status:f,ctx:d}=this._processInputParams(s),{shape:v,keys:E}=this._getCached(),A=[];if(!(this._def.catchall instanceof Vx&&this._def.unknownKeys==="strip"))for(let M in d.data)E.includes(M)||A.push(M);let O=[];for(let M of E){let W=v[M],$=d.data[M];O.push({key:{status:"valid",value:M},value:W._parse(new IC(d,$,d.path,M)),alwaysSet:M in d.data})}if(this._def.catchall instanceof Vx){let M=this._def.unknownKeys;if(M==="passthrough")for(let W of A)O.push({key:{status:"valid",value:W},value:{status:"valid",value:d.data[W]}});else if(M==="strict")A.length>0&&(Ba(d,{code:Rs.unrecognized_keys,keys:A}),f.dirty());else if(M!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let M=this._def.catchall;for(let W of A){let $=d.data[W];O.push({key:{status:"valid",value:W},value:M._parse(new IC(d,$,d.path,W)),alwaysSet:W in d.data})}}return d.common.async?Promise.resolve().then(async()=>{let M=[];for(let W of O){let $=await W.key,Y=await W.value;M.push({key:$,value:Y,alwaysSet:W.alwaysSet})}return M}).then(M=>u1.mergeObjectSync(f,M)):u1.mergeObjectSync(f,O)}get shape(){return this._def.shape()}strict(s){return Jo.errToObj,new a({...this._def,unknownKeys:"strict",...s!==void 0?{errorMap:t((c,f)=>{var d,v,E,A;let O=(E=(v=(d=this._def).errorMap)===null||v===void 0?void 0:v.call(d,c,f).message)!==null&&E!==void 0?E:f.defaultError;return c.code==="unrecognized_keys"?{message:(A=Jo.errToObj(s).message)!==null&&A!==void 0?A:O}:{message:O}},"errorMap")}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(s){return new a({...this._def,shape:t(()=>({...this._def.shape(),...s}),"shape")})}merge(s){return new a({unknownKeys:s._def.unknownKeys,catchall:s._def.catchall,shape:t(()=>({...this._def.shape(),...s._def.shape()}),"shape"),typeName:kc.ZodObject})}setKey(s,c){return this.augment({[s]:c})}catchall(s){return new a({...this._def,catchall:s})}pick(s){let c={};return cf.objectKeys(s).forEach(f=>{s[f]&&this.shape[f]&&(c[f]=this.shape[f])}),new a({...this._def,shape:t(()=>c,"shape")})}omit(s){let c={};return cf.objectKeys(this.shape).forEach(f=>{s[f]||(c[f]=this.shape[f])}),new a({...this._def,shape:t(()=>c,"shape")})}deepPartial(){return cU(this)}partial(s){let c={};return cf.objectKeys(this.shape).forEach(f=>{let d=this.shape[f];s&&!s[f]?c[f]=d:c[f]=d.optional()}),new a({...this._def,shape:t(()=>c,"shape")})}required(s){let c={};return cf.objectKeys(this.shape).forEach(f=>{if(s&&!s[f])c[f]=this.shape[f];else{let v=this.shape[f];for(;v instanceof NC;)v=v._def.innerType;c[f]=v}}),new a({...this._def,shape:t(()=>c,"shape")})}keyof(){return ybt(cf.objectKeys(this.shape))}};Qb.create=(a,s)=>new Qb({shape:t(()=>a,"shape"),unknownKeys:"strip",catchall:Vx.create(),typeName:kc.ZodObject,...xl(s)});Qb.strictCreate=(a,s)=>new Qb({shape:t(()=>a,"shape"),unknownKeys:"strict",catchall:Vx.create(),typeName:kc.ZodObject,...xl(s)});Qb.lazycreate=(a,s)=>new Qb({shape:a,unknownKeys:"strip",catchall:Vx.create(),typeName:kc.ZodObject,...xl(s)});var N7=class extends Dl{static{t(this,"ZodUnion")}_parse(s){let{ctx:c}=this._processInputParams(s),f=this._def.options;function d(v){for(let A of v)if(A.result.status==="valid")return A.result;for(let A of v)if(A.result.status==="dirty")return c.common.issues.push(...A.ctx.common.issues),A.result;let E=v.map(A=>new OS(A.ctx.common.issues));return Ba(c,{code:Rs.invalid_union,unionErrors:E}),Oc}if(t(d,"handleResults"),c.common.async)return Promise.all(f.map(async v=>{let E={...c,common:{...c.common,issues:[]},parent:null};return{result:await v._parseAsync({data:c.data,path:c.path,parent:E}),ctx:E}})).then(d);{let v,E=[];for(let O of f){let M={...c,common:{...c.common,issues:[]},parent:null},W=O._parseSync({data:c.data,path:c.path,parent:M});if(W.status==="valid")return W;W.status==="dirty"&&!v&&(v={result:W,ctx:M}),M.common.issues.length&&E.push(M.common.issues)}if(v)return c.common.issues.push(...v.ctx.common.issues),v.result;let A=E.map(O=>new OS(O));return Ba(c,{code:Rs.invalid_union,unionErrors:A}),Oc}}get options(){return this._def.options}};N7.create=(a,s)=>new N7({options:a,typeName:kc.ZodUnion,...xl(s)});var E6=t(a=>a instanceof O7?E6(a.schema):a instanceof FS?E6(a.innerType()):a instanceof F7?[a.value]:a instanceof L7?a.options:a instanceof R7?cf.objectValues(a.enum):a instanceof M7?E6(a._def.innerType):a instanceof w7?[void 0]:a instanceof P7?[null]:a instanceof NC?[void 0,...E6(a.unwrap())]:a instanceof hk?[null,...E6(a.unwrap())]:a instanceof _Y||a instanceof B7?E6(a.unwrap()):a instanceof j7?E6(a._def.innerType):[],"getDiscriminator"),Hpe=class a extends Dl{static{t(this,"ZodDiscriminatedUnion")}_parse(s){let{ctx:c}=this._processInputParams(s);if(c.parsedType!==Xa.object)return Ba(c,{code:Rs.invalid_type,expected:Xa.object,received:c.parsedType}),Oc;let f=this.discriminator,d=c.data[f],v=this.optionsMap.get(d);return v?c.common.async?v._parseAsync({data:c.data,path:c.path,parent:c}):v._parseSync({data:c.data,path:c.path,parent:c}):(Ba(c,{code:Rs.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[f]}),Oc)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(s,c,f){let d=new Map;for(let v of c){let E=E6(v.shape[s]);if(!E.length)throw new Error(`A discriminator value for key \`${s}\` could not be extracted from all schema options`);for(let A of E){if(d.has(A))throw new Error(`Discriminator property ${String(s)} has duplicate value ${String(A)}`);d.set(A,v)}}return new a({typeName:kc.ZodDiscriminatedUnion,discriminator:s,options:c,optionsMap:d,...xl(f)})}};function T5e(a,s){let c=HN(a),f=HN(s);if(a===s)return{valid:!0,data:a};if(c===Xa.object&&f===Xa.object){let d=cf.objectKeys(s),v=cf.objectKeys(a).filter(A=>d.indexOf(A)!==-1),E={...a,...s};for(let A of v){let O=T5e(a[A],s[A]);if(!O.valid)return{valid:!1};E[A]=O.data}return{valid:!0,data:E}}else if(c===Xa.array&&f===Xa.array){if(a.length!==s.length)return{valid:!1};let d=[];for(let v=0;v<a.length;v++){let E=a[v],A=s[v],O=T5e(E,A);if(!O.valid)return{valid:!1};d.push(O.data)}return{valid:!0,data:d}}else return c===Xa.date&&f===Xa.date&&+a==+s?{valid:!0,data:a}:{valid:!1}}t(T5e,"mergeValues");var I7=class extends Dl{static{t(this,"ZodIntersection")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s),d=t((v,E)=>{if(b5e(v)||b5e(E))return Oc;let A=T5e(v.value,E.value);return A.valid?((S5e(v)||S5e(E))&&c.dirty(),{status:c.value,value:A.data}):(Ba(f,{code:Rs.invalid_intersection_types}),Oc)},"handleParsed");return f.common.async?Promise.all([this._def.left._parseAsync({data:f.data,path:f.path,parent:f}),this._def.right._parseAsync({data:f.data,path:f.path,parent:f})]).then(([v,E])=>d(v,E)):d(this._def.left._parseSync({data:f.data,path:f.path,parent:f}),this._def.right._parseSync({data:f.data,path:f.path,parent:f}))}};I7.create=(a,s,c)=>new I7({left:a,right:s,typeName:kc.ZodIntersection,...xl(c)});var mk=class a extends Dl{static{t(this,"ZodTuple")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Xa.array)return Ba(f,{code:Rs.invalid_type,expected:Xa.array,received:f.parsedType}),Oc;if(f.data.length<this._def.items.length)return Ba(f,{code:Rs.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Oc;!this._def.rest&&f.data.length>this._def.items.length&&(Ba(f,{code:Rs.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c.dirty());let v=[...f.data].map((E,A)=>{let O=this._def.items[A]||this._def.rest;return O?O._parse(new IC(f,E,f.path,A)):null}).filter(E=>!!E);return f.common.async?Promise.all(v).then(E=>u1.mergeArray(c,E)):u1.mergeArray(c,v)}get items(){return this._def.items}rest(s){return new a({...this._def,rest:s})}};mk.create=(a,s)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mk({items:a,typeName:kc.ZodTuple,rest:null,...xl(s)})};var Gpe=class a extends Dl{static{t(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Xa.object)return Ba(f,{code:Rs.invalid_type,expected:Xa.object,received:f.parsedType}),Oc;let d=[],v=this._def.keyType,E=this._def.valueType;for(let A in f.data)d.push({key:v._parse(new IC(f,A,f.path,A)),value:E._parse(new IC(f,f.data[A],f.path,A)),alwaysSet:A in f.data});return f.common.async?u1.mergeObjectAsync(c,d):u1.mergeObjectSync(c,d)}get element(){return this._def.valueType}static create(s,c,f){return c instanceof Dl?new a({keyType:s,valueType:c,typeName:kc.ZodRecord,...xl(f)}):new a({keyType:GN.create(),valueType:s,typeName:kc.ZodRecord,...xl(c)})}},pU=class extends Dl{static{t(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Xa.map)return Ba(f,{code:Rs.invalid_type,expected:Xa.map,received:f.parsedType}),Oc;let d=this._def.keyType,v=this._def.valueType,E=[...f.data.entries()].map(([A,O],M)=>({key:d._parse(new IC(f,A,f.path,[M,"key"])),value:v._parse(new IC(f,O,f.path,[M,"value"]))}));if(f.common.async){let A=new Map;return Promise.resolve().then(async()=>{for(let O of E){let M=await O.key,W=await O.value;if(M.status==="aborted"||W.status==="aborted")return Oc;(M.status==="dirty"||W.status==="dirty")&&c.dirty(),A.set(M.value,W.value)}return{status:c.value,value:A}})}else{let A=new Map;for(let O of E){let M=O.key,W=O.value;if(M.status==="aborted"||W.status==="aborted")return Oc;(M.status==="dirty"||W.status==="dirty")&&c.dirty(),A.set(M.value,W.value)}return{status:c.value,value:A}}}};pU.create=(a,s,c)=>new pU({valueType:s,keyType:a,typeName:kc.ZodMap,...xl(c)});var dU=class a extends Dl{static{t(this,"ZodSet")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Xa.set)return Ba(f,{code:Rs.invalid_type,expected:Xa.set,received:f.parsedType}),Oc;let d=this._def;d.minSize!==null&&f.data.size<d.minSize.value&&(Ba(f,{code:Rs.too_small,minimum:d.minSize.value,type:"set",inclusive:!0,exact:!1,message:d.minSize.message}),c.dirty()),d.maxSize!==null&&f.data.size>d.maxSize.value&&(Ba(f,{code:Rs.too_big,maximum:d.maxSize.value,type:"set",inclusive:!0,exact:!1,message:d.maxSize.message}),c.dirty());let v=this._def.valueType;function E(O){let M=new Set;for(let W of O){if(W.status==="aborted")return Oc;W.status==="dirty"&&c.dirty(),M.add(W.value)}return{status:c.value,value:M}}t(E,"finalizeSet");let A=[...f.data.values()].map((O,M)=>v._parse(new IC(f,O,f.path,M)));return f.common.async?Promise.all(A).then(O=>E(O)):E(A)}min(s,c){return new a({...this._def,minSize:{value:s,message:Jo.toString(c)}})}max(s,c){return new a({...this._def,maxSize:{value:s,message:Jo.toString(c)}})}size(s,c){return this.min(s,c).max(s,c)}nonempty(s){return this.min(1,s)}};dU.create=(a,s)=>new dU({valueType:a,minSize:null,maxSize:null,typeName:kc.ZodSet,...xl(s)});var Qpe=class a extends Dl{static{t(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(s){let{ctx:c}=this._processInputParams(s);if(c.parsedType!==Xa.function)return Ba(c,{code:Rs.invalid_type,expected:Xa.function,received:c.parsedType}),Oc;function f(A,O){return Vpe({data:A,path:c.path,errorMaps:[c.common.contextualErrorMap,c.schemaErrorMap,zpe(),uU].filter(M=>!!M),issueData:{code:Rs.invalid_arguments,argumentsError:O}})}t(f,"makeArgsIssue");function d(A,O){return Vpe({data:A,path:c.path,errorMaps:[c.common.contextualErrorMap,c.schemaErrorMap,zpe(),uU].filter(M=>!!M),issueData:{code:Rs.invalid_return_type,returnTypeError:O}})}t(d,"makeReturnsIssue");let v={errorMap:c.common.contextualErrorMap},E=c.data;if(this._def.returns instanceof KN){let A=this;return Nv(async function(...O){let M=new OS([]),W=await A._def.args.parseAsync(O,v).catch(Ne=>{throw M.addIssue(f(O,Ne)),M}),$=await Reflect.apply(E,this,W);return await A._def.returns._def.type.parseAsync($,v).catch(Ne=>{throw M.addIssue(d($,Ne)),M})})}else{let A=this;return Nv(function(...O){let M=A._def.args.safeParse(O,v);if(!M.success)throw new OS([f(O,M.error)]);let W=Reflect.apply(E,this,M.data),$=A._def.returns.safeParse(W,v);if(!$.success)throw new OS([d(W,$.error)]);return $.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...s){return new a({...this._def,args:mk.create(s).rest(x6.create())})}returns(s){return new a({...this._def,returns:s})}implement(s){return this.parse(s)}strictImplement(s){return this.parse(s)}static create(s,c,f){return new a({args:s||mk.create([]).rest(x6.create()),returns:c||x6.create(),typeName:kc.ZodFunction,...xl(f)})}},O7=class extends Dl{static{t(this,"ZodLazy")}get schema(){return this._def.getter()}_parse(s){let{ctx:c}=this._processInputParams(s);return this._def.getter()._parse({data:c.data,path:c.path,parent:c})}};O7.create=(a,s)=>new O7({getter:a,typeName:kc.ZodLazy,...xl(s)});var F7=class extends Dl{static{t(this,"ZodLiteral")}_parse(s){if(s.data!==this._def.value){let c=this._getOrReturnCtx(s);return Ba(c,{received:c.data,code:Rs.invalid_literal,expected:this._def.value}),Oc}return{status:"valid",value:s.data}}get value(){return this._def.value}};F7.create=(a,s)=>new F7({value:a,typeName:kc.ZodLiteral,...xl(s)});function ybt(a,s){return new L7({values:a,typeName:kc.ZodEnum,...xl(s)})}t(ybt,"createZodEnum");var L7=class a extends Dl{static{t(this,"ZodEnum")}constructor(){super(...arguments),cY.set(this,void 0)}_parse(s){if(typeof s.data!="string"){let c=this._getOrReturnCtx(s),f=this._def.values;return Ba(c,{expected:cf.joinValues(f),received:c.parsedType,code:Rs.invalid_type}),Oc}if(Wpe(this,cY,"f")||dbt(this,cY,new Set(this._def.values),"f"),!Wpe(this,cY,"f").has(s.data)){let c=this._getOrReturnCtx(s),f=this._def.values;return Ba(c,{received:c.data,code:Rs.invalid_enum_value,options:f}),Oc}return Nv(s.data)}get options(){return this._def.values}get enum(){let s={};for(let c of this._def.values)s[c]=c;return s}get Values(){let s={};for(let c of this._def.values)s[c]=c;return s}get Enum(){let s={};for(let c of this._def.values)s[c]=c;return s}extract(s,c=this._def){return a.create(s,{...this._def,...c})}exclude(s,c=this._def){return a.create(this.options.filter(f=>!s.includes(f)),{...this._def,...c})}};cY=new WeakMap;L7.create=ybt;var R7=class extends Dl{static{t(this,"ZodNativeEnum")}constructor(){super(...arguments),lY.set(this,void 0)}_parse(s){let c=cf.getValidEnumValues(this._def.values),f=this._getOrReturnCtx(s);if(f.parsedType!==Xa.string&&f.parsedType!==Xa.number){let d=cf.objectValues(c);return Ba(f,{expected:cf.joinValues(d),received:f.parsedType,code:Rs.invalid_type}),Oc}if(Wpe(this,lY,"f")||dbt(this,lY,new Set(cf.getValidEnumValues(this._def.values)),"f"),!Wpe(this,lY,"f").has(s.data)){let d=cf.objectValues(c);return Ba(f,{received:f.data,code:Rs.invalid_enum_value,options:d}),Oc}return Nv(s.data)}get enum(){return this._def.values}};lY=new WeakMap;R7.create=(a,s)=>new R7({values:a,typeName:kc.ZodNativeEnum,...xl(s)});var KN=class extends Dl{static{t(this,"ZodPromise")}unwrap(){return this._def.type}_parse(s){let{ctx:c}=this._processInputParams(s);if(c.parsedType!==Xa.promise&&c.common.async===!1)return Ba(c,{code:Rs.invalid_type,expected:Xa.promise,received:c.parsedType}),Oc;let f=c.parsedType===Xa.promise?c.data:Promise.resolve(c.data);return Nv(f.then(d=>this._def.type.parseAsync(d,{path:c.path,errorMap:c.common.contextualErrorMap})))}};KN.create=(a,s)=>new KN({type:a,typeName:kc.ZodPromise,...xl(s)});var FS=class extends Dl{static{t(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===kc.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(s){let{status:c,ctx:f}=this._processInputParams(s),d=this._def.effect||null,v={addIssue:t(E=>{Ba(f,E),E.fatal?c.abort():c.dirty()},"addIssue"),get path(){return f.path}};if(v.addIssue=v.addIssue.bind(v),d.type==="preprocess"){let E=d.transform(f.data,v);if(f.common.async)return Promise.resolve(E).then(async A=>{if(c.value==="aborted")return Oc;let O=await this._def.schema._parseAsync({data:A,path:f.path,parent:f});return O.status==="aborted"?Oc:O.status==="dirty"||c.value==="dirty"?lU(O.value):O});{if(c.value==="aborted")return Oc;let A=this._def.schema._parseSync({data:E,path:f.path,parent:f});return A.status==="aborted"?Oc:A.status==="dirty"||c.value==="dirty"?lU(A.value):A}}if(d.type==="refinement"){let E=t(A=>{let O=d.refinement(A,v);if(f.common.async)return Promise.resolve(O);if(O instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return A},"executeRefinement");if(f.common.async===!1){let A=this._def.schema._parseSync({data:f.data,path:f.path,parent:f});return A.status==="aborted"?Oc:(A.status==="dirty"&&c.dirty(),E(A.value),{status:c.value,value:A.value})}else return this._def.schema._parseAsync({data:f.data,path:f.path,parent:f}).then(A=>A.status==="aborted"?Oc:(A.status==="dirty"&&c.dirty(),E(A.value).then(()=>({status:c.value,value:A.value}))))}if(d.type==="transform")if(f.common.async===!1){let E=this._def.schema._parseSync({data:f.data,path:f.path,parent:f});if(!uY(E))return E;let A=d.transform(E.value,v);if(A instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:c.value,value:A}}else return this._def.schema._parseAsync({data:f.data,path:f.path,parent:f}).then(E=>uY(E)?Promise.resolve(d.transform(E.value,v)).then(A=>({status:c.value,value:A})):E);cf.assertNever(d)}};FS.create=(a,s,c)=>new FS({schema:a,typeName:kc.ZodEffects,effect:s,...xl(c)});FS.createWithPreprocess=(a,s,c)=>new FS({schema:s,effect:{type:"preprocess",transform:a},typeName:kc.ZodEffects,...xl(c)});var NC=class extends Dl{static{t(this,"ZodOptional")}_parse(s){return this._getType(s)===Xa.undefined?Nv(void 0):this._def.innerType._parse(s)}unwrap(){return this._def.innerType}};NC.create=(a,s)=>new NC({innerType:a,typeName:kc.ZodOptional,...xl(s)});var hk=class extends Dl{static{t(this,"ZodNullable")}_parse(s){return this._getType(s)===Xa.null?Nv(null):this._def.innerType._parse(s)}unwrap(){return this._def.innerType}};hk.create=(a,s)=>new hk({innerType:a,typeName:kc.ZodNullable,...xl(s)});var M7=class extends Dl{static{t(this,"ZodDefault")}_parse(s){let{ctx:c}=this._processInputParams(s),f=c.data;return c.parsedType===Xa.undefined&&(f=this._def.defaultValue()),this._def.innerType._parse({data:f,path:c.path,parent:c})}removeDefault(){return this._def.innerType}};M7.create=(a,s)=>new M7({innerType:a,typeName:kc.ZodDefault,defaultValue:typeof s.default=="function"?s.default:()=>s.default,...xl(s)});var j7=class extends Dl{static{t(this,"ZodCatch")}_parse(s){let{ctx:c}=this._processInputParams(s),f={...c,common:{...c.common,issues:[]}},d=this._def.innerType._parse({data:f.data,path:f.path,parent:{...f}});return fY(d)?d.then(v=>({status:"valid",value:v.status==="valid"?v.value:this._def.catchValue({get error(){return new OS(f.common.issues)},input:f.data})})):{status:"valid",value:d.status==="valid"?d.value:this._def.catchValue({get error(){return new OS(f.common.issues)},input:f.data})}}removeCatch(){return this._def.innerType}};j7.create=(a,s)=>new j7({innerType:a,typeName:kc.ZodCatch,catchValue:typeof s.catch=="function"?s.catch:()=>s.catch,...xl(s)});var mU=class extends Dl{static{t(this,"ZodNaN")}_parse(s){if(this._getType(s)!==Xa.nan){let f=this._getOrReturnCtx(s);return Ba(f,{code:Rs.invalid_type,expected:Xa.nan,received:f.parsedType}),Oc}return{status:"valid",value:s.data}}};mU.create=a=>new mU({typeName:kc.ZodNaN,...xl(a)});var UTr=Symbol("zod_brand"),_Y=class extends Dl{static{t(this,"ZodBranded")}_parse(s){let{ctx:c}=this._processInputParams(s),f=c.data;return this._def.type._parse({data:f,path:c.path,parent:c})}unwrap(){return this._def.type}},pY=class a extends Dl{static{t(this,"ZodPipeline")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.common.async)return t(async()=>{let v=await this._def.in._parseAsync({data:f.data,path:f.path,parent:f});return v.status==="aborted"?Oc:v.status==="dirty"?(c.dirty(),lU(v.value)):this._def.out._parseAsync({data:v.value,path:f.path,parent:f})},"handleAsync")();{let d=this._def.in._parseSync({data:f.data,path:f.path,parent:f});return d.status==="aborted"?Oc:d.status==="dirty"?(c.dirty(),{status:"dirty",value:d.value}):this._def.out._parseSync({data:d.value,path:f.path,parent:f})}}static create(s,c){return new a({in:s,out:c,typeName:kc.ZodPipeline})}},B7=class extends Dl{static{t(this,"ZodReadonly")}_parse(s){let c=this._def.innerType._parse(s),f=t(d=>(uY(d)&&(d.value=Object.freeze(d.value)),d),"freeze");return fY(c)?c.then(d=>f(d)):f(c)}unwrap(){return this._def.innerType}};B7.create=(a,s)=>new B7({innerType:a,typeName:kc.ZodReadonly,...xl(s)});function vbt(a,s={},c){return a?QN.create().superRefine((f,d)=>{var v,E;if(!a(f)){let A=typeof s=="function"?s(f):typeof s=="string"?{message:s}:s,O=(E=(v=A.fatal)!==null&&v!==void 0?v:c)!==null&&E!==void 0?E:!0,M=typeof A=="string"?{message:A}:A;d.addIssue({code:"custom",...M,fatal:O})}}):QN.create()}t(vbt,"custom");var $Tr={object:Qb.lazycreate},kc;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(kc||(kc={}));var JTr=t((a,s={message:`Input not instance of ${a.name}`})=>vbt(c=>c instanceof a,s),"instanceOfType"),bbt=GN.create,Sbt=x7.create,qTr=mU.create,zTr=D7.create,Tbt=A7.create,VTr=k7.create,WTr=fU.create,HTr=w7.create,GTr=P7.create,QTr=QN.create,KTr=x6.create,YTr=Vx.create,XTr=_U.create,ZTr=D6.create,eCr=Qb.create,tCr=Qb.strictCreate,rCr=N7.create,nCr=Hpe.create,iCr=I7.create,sCr=mk.create,aCr=Gpe.create,oCr=pU.create,cCr=dU.create,lCr=Qpe.create,uCr=O7.create,fCr=F7.create,_Cr=L7.create,pCr=R7.create,dCr=KN.create,_bt=FS.create,mCr=NC.create,hCr=hk.create,gCr=FS.createWithPreprocess,yCr=pY.create,vCr=t(()=>bbt().optional(),"ostring"),bCr=t(()=>Sbt().optional(),"onumber"),SCr=t(()=>Tbt().optional(),"oboolean"),TCr={string:t(a=>GN.create({...a,coerce:!0}),"string"),number:t(a=>x7.create({...a,coerce:!0}),"number"),boolean:t(a=>A7.create({...a,coerce:!0}),"boolean"),bigint:t(a=>D7.create({...a,coerce:!0}),"bigint"),date:t(a=>k7.create({...a,coerce:!0}),"date")},CCr=Oc,Vr=Object.freeze({__proto__:null,defaultErrorMap:uU,setErrorMap:CTr,getErrorMap:zpe,makeIssue:Vpe,EMPTY_PATH:ETr,addIssueToContext:Ba,ParseStatus:u1,INVALID:Oc,DIRTY:lU,OK:Nv,isAborted:b5e,isDirty:S5e,isValid:uY,isAsync:fY,get util(){return cf},get objectUtil(){return v5e},ZodParsedType:Xa,getParsedType:HN,ZodType:Dl,datetimeRegex:gbt,ZodString:GN,ZodNumber:x7,ZodBigInt:D7,ZodBoolean:A7,ZodDate:k7,ZodSymbol:fU,ZodUndefined:w7,ZodNull:P7,ZodAny:QN,ZodUnknown:x6,ZodNever:Vx,ZodVoid:_U,ZodArray:D6,ZodObject:Qb,ZodUnion:N7,ZodDiscriminatedUnion:Hpe,ZodIntersection:I7,ZodTuple:mk,ZodRecord:Gpe,ZodMap:pU,ZodSet:dU,ZodFunction:Qpe,ZodLazy:O7,ZodLiteral:F7,ZodEnum:L7,ZodNativeEnum:R7,ZodPromise:KN,ZodEffects:FS,ZodTransformer:FS,ZodOptional:NC,ZodNullable:hk,ZodDefault:M7,ZodCatch:j7,ZodNaN:mU,BRAND:UTr,ZodBranded:_Y,ZodPipeline:pY,ZodReadonly:B7,custom:vbt,Schema:Dl,ZodSchema:Dl,late:$Tr,get ZodFirstPartyTypeKind(){return kc},coerce:TCr,any:QTr,array:ZTr,bigint:zTr,boolean:Tbt,date:VTr,discriminatedUnion:nCr,effect:_bt,enum:_Cr,function:lCr,instanceof:JTr,intersection:iCr,lazy:uCr,literal:fCr,map:oCr,nan:qTr,nativeEnum:pCr,never:YTr,null:GTr,nullable:hCr,number:Sbt,object:eCr,oboolean:SCr,onumber:bCr,optional:mCr,ostring:vCr,pipeline:yCr,preprocess:gCr,promise:dCr,record:aCr,set:cCr,strictObject:tCr,string:bbt,symbol:WTr,transformer:_bt,tuple:sCr,undefined:HTr,union:rCr,unknown:KTr,void:XTr,NEVER:CCr,ZodIssueCode:Rs,quotelessJson:TTr,ZodError:OS});var wbt=Vr.object({label:Vr.string(),color:Vr.enum(["green","blue","yellow","red","purple","indigo","gray"]),placement:Vr.enum(["start","end"]).optional()}),xCr=Vr.object({type:Vr.literal("doc"),id:Vr.string(),label:Vr.string().optional()}),DCr=Vr.union([xCr,Vr.string()]),ACr=Vr.object({type:Vr.literal("doc"),id:Vr.string(),icon:Vr.custom().optional(),label:Vr.string().optional(),badge:wbt.optional()}),kCr=Vr.union([ACr,Vr.string()]),wCr=Vr.object({type:Vr.literal("link"),label:Vr.string(),href:Vr.string(),description:Vr.string().optional(),badge:wbt.optional()}),PCr=Vr.object({type:Vr.literal("category"),icon:Vr.custom().optional(),label:Vr.string(),description:Vr.string().optional(),collapsible:Vr.boolean().optional(),collapsed:Vr.boolean().optional(),link:DCr.optional()}),Pbt=Vr.lazy(()=>Vr.union([kCr,wCr,NCr])),NCr=PCr.extend({items:Pbt.array()}),ICr=Pbt.array(),C5e=Vr.object({}).passthrough(),Ebt=Vr.object({background:Vr.string(),foreground:Vr.string(),card:Vr.string(),cardForeground:Vr.string(),popover:Vr.string(),popoverForeground:Vr.string(),primary:Vr.string(),primaryForeground:Vr.string(),secondary:Vr.string(),secondaryForeground:Vr.string(),muted:Vr.string(),mutedForeground:Vr.string(),accent:Vr.string(),accentForeground:Vr.string(),destructive:Vr.string(),destructiveForeground:Vr.string(),border:Vr.string(),input:Vr.string(),ring:Vr.string(),radius:Vr.string()}).partial(),OCr=Vr.object({label:Vr.string(),tags:Vr.array(Vr.string())}),E5e=Vr.object({id:Vr.string().optional(),server:Vr.string().optional(),navigationId:Vr.string().optional(),categories:Vr.array(OCr).optional()}),FCr=Vr.function().args(C5e).returns(Vr.union([C5e,Vr.promise(C5e)])),xbt=Vr.union([Vr.object({type:Vr.literal("url"),input:Vr.string()}).merge(E5e),Vr.object({type:Vr.literal("file"),input:Vr.string()}).merge(E5e).merge(Vr.object({postProcessors:FCr.array().optional()})),Vr.object({type:Vr.literal("raw"),input:Vr.string()}).merge(E5e)]),LCr=Vr.union([Vr.object({enabled:Vr.boolean(),endpoint:Vr.string()}),Vr.object({enabled:Vr.boolean(),getKeys:Vr.custom(a=>typeof a=="function"),rollKey:Vr.custom(a=>typeof a=="function").optional(),deleteKey:Vr.custom(a=>typeof a=="function").optional(),updateKeyDescription:Vr.custom(a=>typeof a=="function").optional(),createKey:Vr.custom(a=>typeof a=="function").optional()})]),RCr=Vr.object({src:Vr.object({light:Vr.string(),dark:Vr.string()}),alt:Vr.string().optional(),width:Vr.string().optional()}),MCr=Vr.object({siteUrl:Vr.string(),changefreq:Vr.optional(Vr.enum(["always","hourly","daily","weekly","monthly","yearly","never"])),priority:Vr.optional(Vr.number()),outDir:Vr.string().optional(),autoLastmod:Vr.boolean().optional(),exclude:Vr.union([Vr.function().returns(Vr.promise(Vr.array(Vr.string()))),Vr.array(Vr.string())]).optional()}).optional(),Dbt=Vr.object({files:Vr.string(),defaultOptions:Vr.object({toc:Vr.boolean(),disablePager:Vr.boolean()}).partial().optional()}),jCr=Vr.object({label:Vr.string(),id:Vr.string(),default:Vr.string().optional(),display:Vr.enum(["auth","anon","always"]).default("always").optional()}),BCr=Vr.object({from:Vr.string(),to:Vr.string()}),UCr=Vr.object({type:Vr.literal("inkeep"),apiKey:Vr.string(),integrationId:Vr.string(),organizationId:Vr.string(),primaryBrandColor:Vr.string(),organizationDisplayName:Vr.string()}).optional(),$Cr=Vr.union([Vr.object({type:Vr.literal("clerk"),clerkPubKey:Vr.custom(a=>typeof a=="string"?/^pk_(test|live)_\w+$/.test(a):!1),redirectToAfterSignUp:Vr.string().optional(),redirectToAfterSignIn:Vr.string().optional(),redirectToAfterSignOut:Vr.string().optional()}),Vr.object({type:Vr.literal("openid"),clientId:Vr.string(),issuer:Vr.string(),audience:Vr.string().optional(),scopes:Vr.array(Vr.string()).optional(),redirectToAfterSignUp:Vr.string().optional(),redirectToAfterSignIn:Vr.string().optional(),redirectToAfterSignOut:Vr.string().optional()}),Vr.object({type:Vr.literal("auth0"),clientId:Vr.string(),domain:Vr.string(),audience:Vr.string().optional(),redirectToAfterSignUp:Vr.string().optional(),redirectToAfterSignIn:Vr.string().optional(),redirectToAfterSignOut:Vr.string().optional()})]),JCr=Vr.object({title:Vr.string(),description:Vr.string(),logo:Vr.string(),favicon:Vr.string(),generator:Vr.string(),applicationName:Vr.string(),referrer:Vr.string(),keywords:Vr.array(Vr.string()),authors:Vr.array(Vr.string()),creator:Vr.string(),publisher:Vr.string()}).partial(),Abt=Vr.object({url:Vr.string(),fontFamily:Vr.string()}),qCr=Vr.object({sans:Abt.optional(),mono:Abt.optional()}),zCr=Vr.object({pageTitle:Vr.string(),logoUrl:Vr.string(),logo:RCr,banner:Vr.object({message:Vr.custom(),color:Vr.enum(["note","tip","info","caution","danger"]).or(Vr.string()).optional(),dismissible:Vr.boolean().optional()})}).partial(),kbt=Vr.object({navigationId:Vr.string(),label:Vr.string(),items:Vr.array(Vr.string()).optional()}),Nbt=Vr.object({basePath:Vr.string().optional(),page:zCr,topNavigation:Vr.array(jCr),sidebar:Vr.record(ICr),theme:Vr.object({light:Ebt,dark:Ebt,fonts:qCr}).partial(),metadata:JCr,authentication:$Cr,search:UCr,docs:Vr.union([Dbt,Vr.array(Dbt)]),apis:Vr.union([xbt,Vr.array(xbt)]),catalog:Vr.union([kbt,Vr.array(kbt)]),apiKeys:LCr,redirects:Vr.array(BCr),sitemap:MCr}),Ibt=t((a,s)=>{if(!a.sidebar||!a.topNavigation)return;let c=a.topNavigation.map(d=>d.id),f=Object.keys(a.sidebar).filter(d=>!c.includes(d));f.length>0&&s.addIssue({code:Vr.ZodIssueCode.custom,message:`Sidebar ID [${f.map(d=>`"${d}"`).join(", ")}] not found in top navigation.
|
|
636
636
|
Following IDs are available: ${c.join(", ")}`})},"refine"),VCr=Nbt.partial(),zWr=VCr.superRefine(Ibt);var WCr=Vr.object({UNSAFE_slotlets:Vr.record(Vr.string(),Vr.custom()),mdx:Vr.object({components:Vr.custom()}).partial(),customPages:Vr.array(Vr.object({path:Vr.string(),element:Vr.custom().optional(),render:Vr.custom().optional(),prose:Vr.boolean().optional()})),plugins:Vr.array(Vr.custom()),build:Vr.custom()}),WWr=Nbt.merge(WCr).partial().superRefine(Ibt);var HCr=["zudoku.config.js","zudoku.config.jsx","zudoku.config.ts","zudoku.config.tsx","zudoku.config.mjs"],GCr="dev-portal.json",x5e=t(a=>ECr(a).then(()=>!0).catch(()=>!1),"fileExists"),A6,YN;async function Obt(a){if(A6&&YN&&await x5e(A6))return{configPath:A6,configType:YN};let s=Cbt.join(a,GCr);if(await x5e(s))return A6=s,YN="dev-portal",{configPath:A6,configType:YN};for(let c of HCr){let f=Cbt.join(a,c);if(await x5e(f))return A6=f,YN="zudoku",{configPath:A6,configType:YN}}return A6=void 0,YN=void 0,{configPath:A6,configType:YN}}t(Obt,"findConfigFilePath");import{readFile as QCr}from"fs/promises";import D5e from"path";async function Fbt(a){let s=`${a}/config/dev-portal.json`,c=!0,f;if(await Bu.fileExists(s)){try{let v=await QCr(s,"utf-8"),E=JSON.parse(v);E.enabled===!1&&(c=!1),f=E.sitePathname}catch{}return{enabled:c,type:"dev-portal",basePath:f}}return(await Obt(D5e.join(a,"docs")))?.configType?{enabled:!0,type:"zudoku"}:{enabled:!1,type:void 0}}t(Fbt,"getDevPortalConfig");function hU(a,s){let c=D5e.relative(process.cwd(),D5e.join(a,Hj));return Object.keys(s?.outputs??{}).map(d=>`.${d.replace(c,"")}`)}t(hU,"getBuildModules");var Lbt="/docs",YCr="/__zuplo/dev-portal";function XCr(a){let s=a.trim().toLowerCase();return s.endsWith("/")&&(s=s.slice(0,-1)),s}t(XCr,"normalizePathname");function ZCr(a){let s={sitePathname:a?.sitePathname===YCr?Lbt:a?.sitePathname?XCr(a.sitePathname):Lbt,enabled:a?a.enabled??!0:!1,version:a?.version??"legacy"};return`const devPortal = ${JSON.stringify(s)};
|
|
637
637
|
export default devPortal;`}t(ZCr,"generateSource");function Rbt(a){return{name:"dev-portal-config",setup(s){s.onResolve({filter:/dev-portal.json$/},c=>({namespace:"dev-portal-json",path:Kpe.isAbsolute(c.path)?c.path:Kpe.join(c.resolveDir,c.path),pluginName:"dev-portal"})),s.onLoad({filter:/.*/,namespace:"dev-portal-json"},async c=>of.timeFn("Generating dev-portal.json data",async()=>{let f,d,v=[],E=await Fbt(a.sourceDirectory);if(E.type==="zudoku")f={version:"zudoku",enabled:!1,sitePathname:void 0};else if(E.type==="dev-portal"){d=await KCr.readFile(c.path,"utf-8");try{f=JSON.parse(d)}catch(O){v.push({id:"dev-portal-build-error",text:"Could not parse dev-portal.json. Ensure that the file is valid JSON.",location:{file:"config/dev-portal.json",namespace:"",line:1,column:0,length:0,lineText:"",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:O.message,location:null}]})}}let A;try{if(A=ZCr(f),Mh.DEBUG_BUILD_MODE&&A){let O=Kpe.join(a.sourceDirectory,".zuplo","dev-portal.js");await _k(O,A)}}catch(O){v.push({id:"dev-portal-build-error",text:O.message,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:O.message,location:null}]})}return{contents:A,errors:v,pluginName:"dev-portal",loader:"js",resolveDir:Kpe.dirname(c.path),watchFiles:[c.path]}}))}}}t(Rbt,"devPortalConfigPlugin");import Mbt from"path";var jbt="legacy-environment",Bbt="legacy-environment",eEr=`import { environment } from "@zuplo/runtime";
|
|
638
|
-
export default environment;`;function Ubt(a){return{name:"environment",setup(s){s.onResolve({filter:/@app\/environment$/},()=>({namespace:Bbt,pluginName:jbt,path:Mbt.join(a.sourceDirectory,gN,"environment.js")})),s.onLoad({filter:/.*/,namespace:Bbt},async c=>({contents:eEr,loader:"ts",resolveDir:Mbt.dirname(c.path),pluginName:jbt}))}}}t(Ubt,"environmentPlugin");var YTt=jp(mLe(),1),XTt=jp(vTt(),1),ZTt=jp(ULe(),1),eCt=jp($Le(),1);import e6r from"fs/promises";import LS from"path";var Ck="schemas",Ide="json-schema";function tCt(a){return{name:Ck,async setup(s){let c=new ZTt.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0}),f=LS.join(a.sourceDirectory,lQ),d=[],v=[],E;await of.timeFn("Initializing schema validation",async()=>{if((0,XTt.default)(c,{mode:"fast"}),c.opts.code.formats=YTt._`require("ajv-formats/dist/formats").fastFormats`,await Bu.dirExists(f)&&(c.addKeyword("faker"),E=await Bu.listFolderContents(f,lQ),await Promise.all(E.map(async A=>{try{let O=Bu.safePath(a.sourceDirectory).resolve(f,A);if(!O.startsWith(f))throw new Error("All schemas must be in the schemas directory");let M=await e6r.readFile(O,"utf-8");if(M===""||M===void 0)throw new Error(`Schema 'schemas/${A}' is empty and will be ignored.`);let W=JSON.parse(M);if(W.$schema&&W.$schema!=="https://json-schema.org/draft/2020-12/schema")throw new Error(`Error in ${A}: All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html`);if(c.addSchema(W,A),c.errors?.length){let $=c.errors[0];d.push({id:"json-schema-validation-error",pluginName:Ck,text:`Error: ${$.message}`,location:{file:LS.join(lQ,A)},detail:{params:$.params,propertyName:$.propertyName,schemaPath:$.schemaPath,data:$.data}})}}catch(O){if(O.message.endsWith("is empty and will be ignored.")){v.push({id:"empty-json-schema-file",pluginName:Ck,text:`Schema 'schemas/${A}' is empty and will be ignored.`,location:{file:`schemas/${A}`,suggestion:"Add schema details or remove the file from the project."},detail:"EmptyJSONSchemaFile",notes:[{text:`Schema 'schemas/${A}' is empty and will be ignored.`,location:{file:`schemas/${A}`,suggestion:"Add schema details or remove the file from the project."}}]});return}let M=await v7e(A,a.sourceDirectory,O.message);d.push({id:"json-schema-add-error",pluginName:Ck,text:`Error: ${O.message}`,location:M,detail:"InvalidAddSchemaError",notes:[{text:O.message}]})}})),await Promise.all(E.map(async A=>{try{let O=c.getSchema(A);O&&c.compile(O.schema).errors?.forEach(W=>{d.push({text:`Failed to compile ${A}: ${W.message}`})})}catch(O){let M=await v7e(A,a.sourceDirectory,O.message);d.push({id:"json-schema-compile-error",pluginName:Ck,text:`The schema file '${A}' is not valid. Error: ${O.message}`,location:M,detail:"InvalidSchemaError",notes:[{text:O.message}]})}})),Mh.DEBUG_BUILD_MODE)){let A=LS.resolve(a.outputDirectory,lQ);await Bu.mkdirIfNotExists(A)}}),s.onStart(async()=>{if(E)return{errors:d,warnings:v}}),s.onResolve({filter:/schemas\/.*\.json$/},async A=>of.timeFn("Generating JSON schemas...",async()=>{let O=LS.isAbsolute(A.path)?A.path:LS.join(A.resolveDir,A.path);if(A.importer&&A.importer!==LS.join(a.sourceDirectory,"config/routes.json"))return{path:O};if(!await Bu.fileExists(O)){let M="policies.json";return{errors:[{id:"json-schema-build-error",text:`Unable to resolve reference to '${A.path}' from ${M}`,location:{file:LS.join(A.resolveDir,M),namespace:Ide,line:1,column:0,length:0,lineText:`Invalid JSON schema reference in ${M}`,suggestion:""},detail:"RouteReferenceError",pluginName:Ck,notes:[{text:`Unable to resolve reference to '${A.path}' from ${M}`,location:null}]}],namespace:Ide,path:O,pluginName:Ck}}return{path:O,namespace:Ide,pluginName:Ck}})),s.onLoad({filter:/.*/,namespace:Ide},async A=>of.timeFn(`Generating json schema data: ${LS.basename(A.path)}`,async()=>{let O=[],M;try{let W=LS.relative(f,A.path),$=c.getSchema(W);if(!$)throw new Error(`Could not load schema at ${A.path}`);M=$.source?.validateCode;let Y=c.compile($.schema);M=(0,eCt.default)(c,Y)}catch(W){O.push({pluginName:Ck,text:`Cannot parse project's schemas/${LS.basename(A.path)} file. Error: ${W.message}`,location:null,notes:[{text:W.message,location:null}],detail:W})}if(Mh.DEBUG_BUILD_MODE&&M){let W=LS.relative(f,A.path),$=LS.join(a.sourceDirectory,".zuplo",`${W}.js`);await _k($,M)}return{contents:M,errors:O,pluginName:Ck,resolveDir:LS.dirname(A.path),watchFiles:[A.path]}}))}}}t(tCt,"jsonSchemaPlugin");import{relative as t6r}from"path";var rCt=["node:assert","node:async_hooks","node:buffer","node:crypto","node:diagnostics_channel","node:events","node:path","node:process","node:stream","node:string_decoder","node:util"],r6r="nodejs-compat-plugin";function nCt({sourceDirectory:a}){return{name:r6r,setup(s){let c=new Set;s.onStart(()=>{c.clear()}),s.onResolve({filter:/node:.*/},async({path:f,kind:d,resolveDir:v,...E})=>{let A=`${f}:${d}:${v}:${E.importer}`;if(c.has(A))return;c.add(A);let O=await s.resolve(f,{kind:d,resolveDir:v,importer:E.importer});return O.errors.length>0?rCt.includes(f)||f.includes("/")&&rCt.includes(f.split("/")[0])?{external:!0}:{external:!0,warnings:O.errors.map(W=>({...W,location:{file:t6r(a,E.importer),line:0,column:0,namespace:"",length:0,lineText:"",suggestion:"Remove the imported node module"},detail:`The package "${f}" wasn't found on the file system but is built into node. If this code is executed it will fail.`}))}:O})}}}t(nCt,"nodejsCompatPlugin");import iCt from"fs/promises";import Xx from"path";var jU="open-api-routes-plugin",Ode="open-api-routes-json";function sCt(a){return{name:"open-api-routes-plugin",setup(s){s.onResolve({filter:/routes.json$/},c=>({watchFiles:[...JLe(Xx.join(a.sourceDirectory,DS),[".oas.json"],!0),Xx.join(a.sourceDirectory,DS,$ue)],namespace:Ode,path:Xx.isAbsolute(c.path)?c.path:Xx.join(c.resolveDir,c.path),pluginName:jU})),s.onResolve({filter:/^\.\.\/modules\/.*/,namespace:Ode},async c=>of.timeFn("Generating route data...",async()=>{let f=Xx.join(c.resolveDir,`${c.path}.ts`);if(!await Bu.fileExists(f)){let d=`$import(.${c.path.replace(/^../,"")})`,v=Xx.resolve(a.sourceDirectory,"config"),E=await GF(v),A=await vft(E,d,"Update your route configuration to use code from the 'modules' folder");return{errors:[{id:"route-build-error",text:`Invalid handler reference in routes.json. Unable to resolve reference to '${d}' from routes.json`,location:A,detail:"RouteReferenceError",pluginName:jU}],namespace:Ode,path:c.path,pluginName:jU}}})),s.onLoad({filter:/.*/,namespace:Ode},async c=>of.timeFn("Generating route.json data",async()=>{let f=Xx.resolve(a.sourceDirectory,"config"),d=await GF(f),v=await Promise.all(d.map(async M=>({content:await iCt.readFile(M,"utf-8"),fileName:M}))),E=Xx.resolve(f,"policies.json");if(!await Bu.fileExists(E))return{errors:[{text:"The project must include a policies file ('/config/policies.json')",detail:"OASPoliciesFileMissing",pluginName:jU,location:{line:0,column:0,file:"/config/policies.json"}}],pluginName:jU};let A={content:await iCt.readFile(E,"utf-8"),fileName:E},O;try{O=await m7e({sourceDirectory:a.sourceDirectory,oasContent:v,policiesContent:A})}catch(M){throw new Error("Error compiling routes: "+M.message)}if(Mh.DEBUG_BUILD_MODE&&O.content){let M=Xx.join(a.sourceDirectory,".zuplo"),W=Xx.resolve(M,"routes.js");await _k(W,O.content)}return{contents:O.content,errors:O.errors,pluginName:jU,resolveDir:Xx.dirname(c.path),watchFiles:[c.path]}}))}}}t(sCt,"openApiRoutesPlugin");import Fde from"path";var WY="raw-route-plugin",aCt="raw-route";function oCt(a){return{name:"raw-route-plugin",setup(s){s.onResolve({filter:/raw.json$/},c=>({namespace:aCt,path:c.path,pluginName:WY})),s.onLoad({filter:/.*/,namespace:aCt},async c=>of.timeFn("Building route data",async()=>{let f=Fde.resolve(a.sourceDirectory,DS);if(!await Bu.dirExists(f))return{loader:"js",resolveDir:Fde.dirname(c.path),pluginName:WY};let d=await GF(f);try{let v=await y7e({oasFiles:d,sourceDirectory:a.sourceDirectory,logger:a.logger});if(Mh.DEBUG_BUILD_MODE&&v){let E=Fde.join(a.sourceDirectory,".zuplo","raw-routes.js");await _k(E,v)}return{contents:v,loader:"js",resolveDir:Fde.dirname(c.path),pluginName:WY}}catch(v){if(v instanceof Tv)return{contents:"",loader:"ts",errors:[{id:"route-build-error",text:v.issue.text,location:v.issue.location,detail:v.issue.detail,pluginName:WY}],pluginName:WY};throw v}}))}}}t(oCt,"rawRoutePlugin");import n6r from"fs/promises";import qLe from"path";var Lde="runtime-config",cCt="runtime-config-plugin";function lCt(){return{name:Lde,setup(a){a.onResolve({filter:/^\.\.\/modules\/zuplo.runtime.ts$/},s=>({namespace:cCt,path:qLe.isAbsolute(s.path)?s.path:qLe.join(s.resolveDir,s.path),pluginName:Lde})),a.onLoad({filter:/.*/,namespace:cCt},async s=>of.timeFn("Generating zuplo.runtime.ts data",async()=>{let c="export const runtimeInit = undefined;",f=[];return await Bu.fileExists(s.path)?(c=await n6r.readFile(s.path,"utf-8"),{contents:c,loader:"ts",resolveDir:qLe.dirname(s.path),errors:f,pluginName:Lde,watchFiles:[s.path]}):{contents:c,loader:"ts",errors:f,pluginName:Lde}}))}}}t(lCt,"runtimeConfigPlugin");var fCt=jp(ULe(),1),_Ct=jp($Le(),1);import WLe from"fs/promises";import Y7 from"path";var zLe="schema-validation-plugin",uCt="schema-validation",i6r="module.exports = {}";function pCt(a){return{name:"schema-validation-plugin",setup(s){s.onResolve({filter:/ajv-schema.json$/},c=>({namespace:uCt,path:c.path,pluginName:zLe})),s.onLoad({filter:/.*/,namespace:uCt},async c=>of.timeFn("Validating schemas",async()=>{let f=Y7.resolve(a.sourceDirectory,DS,"policies.json");if(!await Bu.fileExists(f))return{contents:i6r,loader:"js",resolveDir:Y7.dirname(c.path),pluginName:zLe};let d=await a6r(a.sourceDirectory),v=Y7.resolve(a.sourceDirectory,DS),E=await GF(v),A=await u6r(E,d),O=await s6r({oasFiles:E,routesWithSchemaValidation:A,sourceDirectory:a.sourceDirectory,logger:a.logger});if(Mh.DEBUG_BUILD_MODE&&O){let M=Y7.join(a.sourceDirectory,".zuplo","schema-validation.js");await _k(M,O)}return{contents:O,loader:"js",resolveDir:Y7.dirname(c.path),pluginName:zLe}}))}}}t(pCt,"schemaValidationPlugin");async function s6r({oasFiles:a,routesWithSchemaValidation:s,sourceDirectory:c,logger:f}){let d="",v=new PN(c,f);if(s.length===0)return d;let E=new fCt.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0});for(let A of a){let O=await WLe.readFile(A,"utf-8"),M=Y7.basename(A,".oas.json"),W=s.filter(Se=>Se.fileName===M),$=await v.resolve(A),Y=JSON.parse(O),Ne=[],De=new Map;W.forEach(Se=>{let Ct=Y.paths[Se.path][Se.method];if(Ct.requestBody){let Tt;if(Ct.requestBody.$ref){let br=Ct.requestBody.$ref;Tt=$.get(br)?.content}else Ct.requestBody.content&&(Tt=Ct.requestBody.content);if(Tt)for(let br in Tt){let Cr=Tt[br].schema,Lr=XIe(Se.path,Se.method,br);Cr.$id=Lr,E.addSchema(Cr),VLe(Cr,A,M,E,$,Ne,De)}}if(Ct.parameters)for(let Tt of Ct.parameters){let br=Tt.$ref?$.get(Tt.$ref):Tt,Cr=br.schema.$ref?$.get(br.schema.$ref):br.schema,Lr=YIe(Se.path,Se.method,br.in,br.name);Cr.$id=Lr,E.addSchema(Cr),VLe(br,A,M,E,$,Ne,De)}});for(let Se of Ne){let Ct=$.get(Se),Tt=XQ(M,Se);E.addSchema(Ct,Tt)}}return d=(0,_Ct.default)(E),d}t(s6r,"schemaValidationSource");function VLe(a,s,c,f,d,v,E){for(let A in a){let O=a[A];if(A==="$ref"){let M=XQ(c,SN(s,O));a[A]=M,OQ(s,c,SN(s,O),d,v,E,(W,$)=>XQ(W,SN(s,$)))}else typeof O=="object"&&VLe(O,s,c,f,d,v,E)}}t(VLe,"addRefsToSchema");async function a6r(a){let s=new Set(["RequestValidationInboundPolicy"]),c=await WLe.readFile(`${a}/config/policies.json`,"utf-8"),f=JSON.parse(c);return o6r(f,s)}t(a6r,"getPolicyNamesUsingSchemaValidationPolicies");function o6r(a,s){let c=new Set;a.policies?.forEach(d=>{d.handler?.export&&s.has(d.handler.export)&&d.handler.module==="$import(@zuplo/runtime)"&&c.add(d.name)});let f=c6r(a,c);return new Set([...c,...f])}t(o6r,"getPolicyNamesReferencingPolicyHandlers");function c6r(a,s){let c=new Set;return a.policies?.forEach(f=>{f.handler?.export==="CompositeInboundPolicy"&&f.handler?.options?.policies?.forEach(d=>{s.has(d)&&c.add(f.name)})}),c}t(c6r,"getCompositePoliciesContainingPolicy");function l6r(a,s){if(!a["x-zuplo-route"]||!a["x-zuplo-route"].policies)return!1;let c=a["x-zuplo-route"].policies.inbound;if(c){for(let d of c)if(s.has(d))return!0}let f=a["x-zuplo-route"].policies.outbound;if(f){for(let d of f)if(s.has(d))return!0}return!1}t(l6r,"isPolicyPresentInOperation");async function u6r(a,s){let c=[];for(let f of a){let d=await WLe.readFile(f,"utf-8"),E=JSON.parse(d).paths;for(let A in E){let O=E[A];for(let M in O){let W=O[M];l6r(W,s)&&c.push({fileName:Y7.basename(f,".oas.json"),path:A,method:M})}}}return c}t(u6r,"getRoutesContainingPolicies");import{mkdirSync as f6r,writeFileSync as _6r}from"fs";import p6r from"path";function dCt(a){return{name:"write-modules-plugin",setup(s){s.onEnd(async c=>{if(c){let f=hU(a.sourceDirectory,c.metafile);f6r(a.outputDirectory,{recursive:!0}),_6r(p6r.join(a.outputDirectory,"modules.json"),JSON.stringify(f,null,2))}})}}}t(dCt,"writeModulesPlugin");var d6r=t1t("zuplo:core:build"),m6r=["workerd","worker","browser"],gCt=[...process.env.GLOBAL_MODULE_LOCATION?[process.env.GLOBAL_MODULE_LOCATION]:[],HLe.resolve(mCt(hCt(import.meta.url)),"..","..","..","node_modules"),HLe.resolve(mCt(hCt(import.meta.url)),"..","..","..","..","..","node_modules")];async function HY({systemDirectory:a,outputDirectory:s,sourceDirectory:c,cacheDirectory:f,logger:d,minify:v=!0,command:E,flags:A}){let O=HLe.join(a,que);d6r(`Building with node paths: ${gCt.join(", ")}`);let M=v&&E!=="dev"&&!process.env.DEBUG_BUILD_DISABLE_MINIFY?{minify:!0,chunkNames:"[hash]"}:{minify:!1,keepNames:!0,chunkNames:"[name]-[hash]"},W=Object.freeze({sourceDirectory:c,outputDirectory:s,cacheDirectory:f,logger:d,debugMode:Mh.DEBUG_BUILD_MODE,flags:A});return{platform:"browser",target:"es2022",outdir:s,splitting:!0,metafile:!0,format:"esm",nodePaths:gCt,entryPoints:[O],sourcemap:"linked",legalComments:"none",treeShaking:!0,bundle:!0,...M,external:[],logLevel:"silent",conditions:m6r,plugins:[Ubt(W),r1t(W),sCt(W),oCt(W),pCt(W),lCt(),Rbt(W),tCt(W),nCt(W),dCt(W)]}}t(HY,"getBaseESBuildConfig");var X7="run-esbuild",vCt=t(async function({systemDirectory:a,outputDirectory:s,sourceDirectory:c,cacheDirectory:f,buildId:d,logger:v,config:E,command:A,minify:O},{data:M}){v.debug("Running esbuild");let W=await HY({command:A,minify:O,systemDirectory:a,outputDirectory:s,cacheDirectory:f,sourceDirectory:c,logger:v,flags:E.flags}),$;try{if(!await iB(c))throw new Error("Failed to build project because no open-api file was found on the 'config' folder");$=await yCt.build(W),M.set("metafile",$.metafile)}catch(De){if(v.error(De),De.errors||De.warnings)$=De;else if(De.message.includes("Failed to build project because no open-api file was found on the 'config' folder"))$={warnings:[],errors:[{id:"missing-open-api-file",text:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:X7,location:null,notes:[],detail:"Failed to build project because no open-api file was found on the 'config' folder"}],outputFiles:void 0,metafile:void 0,mangleCache:void 0};else throw De}$.errors.length>0&&$.errors.length>1&&($.errors.length=1);let{errors:Y,warnings:Ne}=GLe({buildId:d,result:$});return{errors:Y,warnings:Ne}},"runEsbuild");function GLe({buildId:a,result:s}){return{status:s.errors.length>0?"Failed":s.warnings.length>0?"Warnings":"Good",runtimeVersion:"0.0.0",buildTime:"",buildTimeMs:0,buildId:a,warnings:s.warnings.map(f=>f.text==="Using direct eval with a bundler is not recommended and may cause problems"?{location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:"We do not support the use of 'eval' or 'new Function(...)'",severity:Rue,pluginName:f.pluginName||X7}:{location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:f.text,severity:Rue,pluginName:f.pluginName||X7}),errors:s.errors.map(f=>({location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:f.text,severity:$3e,pluginName:f.pluginName||X7})),metafile:s.metafile}}t(GLe,"esbuildResultToBuildResult");var h6r=t((a,s)=>{let c=s;if(s.includes(a)){let f=new RegExp(`.*(${a})`,"g");c=s.replace(f,"")}return c.match(/^(\/)?(\.\.(\/)?)+/)&&(c=c.replace(/^(\/)?(\.\.(\/)?)+/,"/")),c},"removePrefixFromString"),g6r=t((a,s)=>{let c=s;if(c.includes(a)){let f=new RegExp(`[a-zA-Z0-9-_.\\/]+(${a})`,"g");c=c.replace(f,"")}return c},"cleanFilePathsInMessage"),bCt=t((a,s,c)=>{if(!a||a.length<=0)return a;let f=a.filter(d=>d.message!=='Could not resolve "@zuplo/runtime"');return f&&f.length>0&&f.forEach(d=>{try{d.location&&d.location.file&&(d.location.file=h6r(s,d.location.file)),d.location&&d.location.lineText&&d.location.lineText.includes("@zuplo/core/index.minified.js")&&(d.location.lineText=d.location.lineText.substring(0,200)+"...<Truncated>"),d.message=g6r(s,d.message),d.notes&&d.notes.length>0&&delete d.notes,d.text&&delete d.text,d.pluginName===""&&(d.pluginName=c)}catch{}}),f},"cleanDataOnBuildIssue");function SCt(a,s){let c=QLe.basename(s);a.errors&&(a.errors=bCt(a.errors,c,X7)),a.warnings&&(a.warnings=bCt(a.warnings,c,X7))}t(SCt,"formatBuildResult");var y6r=t(a=>QLe.basename(a).startsWith("."),"isHiddenOnUnix"),v6r=t((a,s=[])=>s.map(c=>c.startsWith(".")?c:`.${c}`).some(c=>a.endsWith(c)),"hasMatchingExtname");function JLe(a,s=[],c=!1){let f=[],d;if(!Rde.existsSync(a)){let v;if(wQ.hasMagic(a))v=a;else{let E=s.map(A=>A.startsWith(".")?A:`.${A}`).join("|");v=`${a}+(${E})`}if(f.push(...wQ.sync(v,{nodir:!0})),!f.length)throw Error(`Cannot find any files matching pattern "${a}"`);return f}try{if(d=Rde.statSync(a),d.isFile())return[a]}catch{return[]}return Rde.readdirSync(a).forEach(v=>{let E=QLe.join(a,v),A;try{if(A=Rde.statSync(E),A.isDirectory()){c&&f.push(...JLe(E,s,c));return}}catch{return}if(!s.length)throw Error(`Argument '${s}' required when argument '${a}' is a directory`);!A.isFile()||!v6r(E,s)||y6r(E)||f.push(E)}),f}t(JLe,"lookupFiles");var Z7=new Bue({level:process.env.FORCE_BUILD_COLORS?2:void 0}),aI=` ${Z7.gray("|")} `;function KLe({output:a,buildId:s,runtimeVersion:c,compatibilityDate:f}){let d=["Building Zuplo API...",`${aI}Build ID: ${s}`,`${aI}Runtime Version: ${c}`];f&&d.push(`${aI}Compatibility Date: ${f}`),a.info(d.join(`
|
|
638
|
+
export default environment;`;function Ubt(a){return{name:"environment",setup(s){s.onResolve({filter:/@app\/environment$/},()=>({namespace:Bbt,pluginName:jbt,path:Mbt.join(a.sourceDirectory,gN,"environment.js")})),s.onLoad({filter:/.*/,namespace:Bbt},async c=>({contents:eEr,loader:"ts",resolveDir:Mbt.dirname(c.path),pluginName:jbt}))}}}t(Ubt,"environmentPlugin");var YTt=jp(mLe(),1),XTt=jp(vTt(),1),ZTt=jp(ULe(),1),eCt=jp($Le(),1);import e6r from"fs/promises";import LS from"path";var Ck="schemas",Ide="json-schema";function tCt(a){return{name:Ck,async setup(s){let c=new ZTt.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0}),f=LS.join(a.sourceDirectory,lQ),d=[],v=[],E;await of.timeFn("Initializing schema validation",async()=>{if((0,XTt.default)(c,{mode:"fast"}),c.opts.code.formats=YTt._`require("ajv-formats/dist/formats").fastFormats`,await Bu.dirExists(f)&&(c.addKeyword("faker"),E=await Bu.listFolderContents(f,lQ),await Promise.all(E.map(async A=>{try{let O=Bu.safePath(a.sourceDirectory).resolve(f,A);if(!O.startsWith(f))throw new Error("All schemas must be in the schemas directory");let M=await e6r.readFile(O,"utf-8");if(M===""||M===void 0)throw new Error(`Schema 'schemas/${A}' is empty and will be ignored.`);let W=JSON.parse(M);if(W.$schema&&W.$schema!=="https://json-schema.org/draft/2020-12/schema")throw new Error(`Error in ${A}: All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html`);if(c.addSchema(W,A),c.errors?.length){let $=c.errors[0];d.push({id:"json-schema-validation-error",pluginName:Ck,text:`Error: ${$.message}`,location:{file:LS.join(lQ,A)},detail:{params:$.params,propertyName:$.propertyName,schemaPath:$.schemaPath,data:$.data}})}}catch(O){if(O.message.endsWith("is empty and will be ignored.")){v.push({id:"empty-json-schema-file",pluginName:Ck,text:`Schema 'schemas/${A}' is empty and will be ignored.`,location:{file:`schemas/${A}`,suggestion:"Add schema details or remove the file from the project."},detail:"EmptyJSONSchemaFile",notes:[{text:`Schema 'schemas/${A}' is empty and will be ignored.`,location:{file:`schemas/${A}`,suggestion:"Add schema details or remove the file from the project."}}]});return}let M=await v7e(A,a.sourceDirectory,O.message);d.push({id:"json-schema-add-error",pluginName:Ck,text:`Error: ${O.message}`,location:M,detail:"InvalidAddSchemaError",notes:[{text:O.message}]})}})),await Promise.all(E.map(async A=>{try{let O=c.getSchema(A);O&&c.compile(O.schema).errors?.forEach(W=>{d.push({text:`Failed to compile ${A}: ${W.message}`})})}catch(O){let M=await v7e(A,a.sourceDirectory,O.message);d.push({id:"json-schema-compile-error",pluginName:Ck,text:`The schema file '${A}' is not valid. Error: ${O.message}`,location:M,detail:"InvalidSchemaError",notes:[{text:O.message}]})}})),Mh.DEBUG_BUILD_MODE)){let A=LS.resolve(a.outputDirectory,lQ);await Bu.mkdirIfNotExists(A)}}),s.onStart(async()=>{if(E)return{errors:d,warnings:v}}),s.onResolve({filter:/schemas\/.*\.json$/},async A=>of.timeFn("Generating JSON schemas...",async()=>{let O=LS.isAbsolute(A.path)?A.path:LS.join(A.resolveDir,A.path);if(A.importer&&A.importer!==LS.join(a.sourceDirectory,"config/routes.json"))return{path:O};if(!await Bu.fileExists(O)){let M="policies.json";return{errors:[{id:"json-schema-build-error",text:`Unable to resolve reference to '${A.path}' from ${M}`,location:{file:LS.join(A.resolveDir,M),namespace:Ide,line:1,column:0,length:0,lineText:`Invalid JSON schema reference in ${M}`,suggestion:""},detail:"RouteReferenceError",pluginName:Ck,notes:[{text:`Unable to resolve reference to '${A.path}' from ${M}`,location:null}]}],namespace:Ide,path:O,pluginName:Ck}}return{path:O,namespace:Ide,pluginName:Ck}})),s.onLoad({filter:/.*/,namespace:Ide},async A=>of.timeFn(`Generating json schema data: ${LS.basename(A.path)}`,async()=>{let O=[],M;try{let W=LS.relative(f,A.path),$=c.getSchema(W);if(!$)throw new Error(`Could not load schema at ${A.path}`);M=$.source?.validateCode;let Y=c.compile($.schema);M=(0,eCt.default)(c,Y)}catch(W){O.push({pluginName:Ck,text:`Cannot parse project's schemas/${LS.basename(A.path)} file. Error: ${W.message}`,location:null,notes:[{text:W.message,location:null}],detail:W})}if(Mh.DEBUG_BUILD_MODE&&M){let W=LS.relative(f,A.path),$=LS.join(a.sourceDirectory,".zuplo",`${W}.js`);await _k($,M)}return{contents:M,errors:O,pluginName:Ck,resolveDir:LS.dirname(A.path),watchFiles:[A.path]}}))}}}t(tCt,"jsonSchemaPlugin");import{relative as t6r}from"path";var rCt=["node:assert","node:async_hooks","node:buffer","node:crypto","node:diagnostics_channel","node:events","node:path","node:process","node:stream","node:string_decoder","node:util"],r6r="nodejs-compat-plugin";function nCt({sourceDirectory:a}){return{name:r6r,setup(s){let c=new Set;s.onStart(()=>{c.clear()}),s.onResolve({filter:/node:.*/},async({path:f,kind:d,resolveDir:v,...E})=>{let A=`${f}:${d}:${v}:${E.importer}`;if(c.has(A))return;c.add(A);let O=await s.resolve(f,{kind:d,resolveDir:v,importer:E.importer});return O.errors.length>0?rCt.includes(f)||f.includes("/")&&rCt.includes(f.split("/")[0])?{external:!0}:{external:!0,warnings:O.errors.map(W=>({...W,location:{file:t6r(a,E.importer),line:0,column:0,namespace:"",length:0,lineText:"",suggestion:"Remove the imported node module"},detail:`The package "${f}" wasn't found on the file system but is built into node. If this code is executed it will fail.`}))}:O})}}}t(nCt,"nodejsCompatPlugin");import iCt from"fs/promises";import Xx from"path";var jU="open-api-routes-plugin",Ode="open-api-routes-json";function sCt(a){return{name:"open-api-routes-plugin",setup(s){s.onResolve({filter:/routes.json$/},c=>({watchFiles:[...JLe(Xx.join(a.sourceDirectory,DS),[".oas.json"],!0),Xx.join(a.sourceDirectory,DS,$ue)],namespace:Ode,path:Xx.isAbsolute(c.path)?c.path:Xx.join(c.resolveDir,c.path),pluginName:jU})),s.onResolve({filter:/^\.\.\/modules\/.*/,namespace:Ode},async c=>of.timeFn("Generating route data...",async()=>{let f=Xx.join(c.resolveDir,`${c.path}.ts`);if(!await Bu.fileExists(f)){let d=`$import(.${c.path.replace(/^../,"")})`,v=Xx.resolve(a.sourceDirectory,"config"),E=await GF(v),A=await vft(E,d,"Update your route configuration to use code from the 'modules' folder");return{errors:[{id:"route-build-error",text:`Invalid handler reference in routes.json. Unable to resolve reference to '${d}' from routes.json`,location:A,detail:"RouteReferenceError",pluginName:jU}],namespace:Ode,path:c.path,pluginName:jU}}})),s.onLoad({filter:/.*/,namespace:Ode},async c=>of.timeFn("Generating route.json data",async()=>{let f=Xx.resolve(a.sourceDirectory,"config"),d=await GF(f),v=await Promise.all(d.map(async M=>({content:await iCt.readFile(M,"utf-8"),fileName:M}))),E=Xx.resolve(f,"policies.json");if(!await Bu.fileExists(E))return{errors:[{text:"The project must include a policies file ('/config/policies.json')",detail:"OASPoliciesFileMissing",pluginName:jU,location:{line:0,column:0,file:"/config/policies.json"}}],pluginName:jU};let A={content:await iCt.readFile(E,"utf-8"),fileName:E},O;try{O=await m7e({sourceDirectory:a.sourceDirectory,oasContent:v,policiesContent:A})}catch(M){throw new Error("Error compiling routes: "+M.message)}if(Mh.DEBUG_BUILD_MODE&&O.content){let M=Xx.join(a.sourceDirectory,".zuplo"),W=Xx.resolve(M,"routes.js");await _k(W,O.content)}return{contents:O.content,errors:O.errors,pluginName:jU,resolveDir:Xx.dirname(c.path),watchFiles:[c.path]}}))}}}t(sCt,"openApiRoutesPlugin");import Fde from"path";var WY="raw-route-plugin",aCt="raw-route";function oCt(a){return{name:"raw-route-plugin",setup(s){s.onResolve({filter:/raw.json$/},c=>({namespace:aCt,path:c.path,pluginName:WY})),s.onLoad({filter:/.*/,namespace:aCt},async c=>of.timeFn("Building route data",async()=>{let f=Fde.resolve(a.sourceDirectory,DS);if(!await Bu.dirExists(f))return{loader:"js",resolveDir:Fde.dirname(c.path),pluginName:WY};let d=await GF(f);try{let v=await y7e({oasFiles:d,sourceDirectory:a.sourceDirectory,logger:a.logger});if(Mh.DEBUG_BUILD_MODE&&v){let E=Fde.join(a.sourceDirectory,".zuplo","raw-routes.js");await _k(E,v)}return{contents:v,loader:"js",resolveDir:Fde.dirname(c.path),pluginName:WY}}catch(v){if(v instanceof Tv)return{contents:"",loader:"ts",errors:[{id:"route-build-error",text:v.issue.text,location:v.issue.location,detail:v.issue.detail,pluginName:WY}],pluginName:WY};throw v}}))}}}t(oCt,"rawRoutePlugin");import n6r from"fs/promises";import qLe from"path";var Lde="runtime-config",cCt="runtime-config-plugin";function lCt(){return{name:Lde,setup(a){a.onResolve({filter:/^\.\.\/modules\/zuplo.runtime.ts$/},s=>({namespace:cCt,path:qLe.isAbsolute(s.path)?s.path:qLe.join(s.resolveDir,s.path),pluginName:Lde})),a.onLoad({filter:/.*/,namespace:cCt},async s=>of.timeFn("Generating zuplo.runtime.ts data",async()=>{let c="export const runtimeInit = undefined;",f=[];return await Bu.fileExists(s.path)?(c=await n6r.readFile(s.path,"utf-8"),{contents:c,loader:"ts",resolveDir:qLe.dirname(s.path),errors:f,pluginName:Lde,watchFiles:[s.path]}):{contents:c,loader:"ts",errors:f,pluginName:Lde}}))}}}t(lCt,"runtimeConfigPlugin");var fCt=jp(ULe(),1),_Ct=jp($Le(),1);import WLe from"fs/promises";import Y7 from"path";var zLe="schema-validation-plugin",uCt="schema-validation",i6r="module.exports = {}";function pCt(a){return{name:"schema-validation-plugin",setup(s){s.onResolve({filter:/ajv-schema.json$/},c=>({namespace:uCt,path:c.path,pluginName:zLe})),s.onLoad({filter:/.*/,namespace:uCt},async c=>of.timeFn("Validating schemas",async()=>{let f=Y7.resolve(a.sourceDirectory,DS,"policies.json");if(!await Bu.fileExists(f))return{contents:i6r,loader:"js",resolveDir:Y7.dirname(c.path),pluginName:zLe};let d=await a6r(a.sourceDirectory),v=Y7.resolve(a.sourceDirectory,DS),E=await GF(v),A=await u6r(E,d),O=await s6r({oasFiles:E,routesWithSchemaValidation:A,sourceDirectory:a.sourceDirectory,logger:a.logger});if(Mh.DEBUG_BUILD_MODE&&O){let M=Y7.join(a.sourceDirectory,".zuplo","schema-validation.js");await _k(M,O)}return{contents:O,loader:"js",resolveDir:Y7.dirname(c.path),pluginName:zLe}}))}}}t(pCt,"schemaValidationPlugin");async function s6r({oasFiles:a,routesWithSchemaValidation:s,sourceDirectory:c,logger:f}){let d="",v=new PN(c,f);if(s.length===0)return d;let E=new fCt.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0});for(let A of a){let O=await WLe.readFile(A,"utf-8"),M=Y7.basename(A,".oas.json"),W=s.filter(Se=>Se.fileName===M),$=await v.resolve(A),Y=JSON.parse(O),Ne=[],De=new Map;W.forEach(Se=>{let Ct=Y.paths[Se.path][Se.method];if(Ct.requestBody){let Tt;if(Ct.requestBody.$ref){let br=Ct.requestBody.$ref;Tt=$.get(br)?.content}else Ct.requestBody.content&&(Tt=Ct.requestBody.content);if(Tt)for(let br in Tt){let Cr=Tt[br].schema,Lr=XIe(Se.path,Se.method,br);Cr.$id=Lr,E.addSchema(Cr),VLe(Cr,A,M,E,$,Ne,De)}}if(Ct.parameters)for(let Tt of Ct.parameters){let br=Tt.$ref?$.get(Tt.$ref):Tt,Cr=br.schema.$ref?$.get(br.schema.$ref):br.schema,Lr=YIe(Se.path,Se.method,br.in,br.name);Cr.$id=Lr,E.addSchema(Cr),VLe(br,A,M,E,$,Ne,De)}});for(let Se of Ne){let Ct=$.get(Se),Tt=XQ(M,Se);E.addSchema(Ct,Tt)}}return d=(0,_Ct.default)(E),d}t(s6r,"schemaValidationSource");function VLe(a,s,c,f,d,v,E){for(let A in a){let O=a[A];if(A==="$ref"){let M=XQ(c,SN(s,O));a[A]=M,OQ(s,c,SN(s,O),d,v,E,(W,$)=>XQ(W,SN(s,$)))}else typeof O=="object"&&VLe(O,s,c,f,d,v,E)}}t(VLe,"addRefsToSchema");async function a6r(a){let s=new Set(["RequestValidationInboundPolicy"]),c=await WLe.readFile(`${a}/config/policies.json`,"utf-8"),f=JSON.parse(c);return o6r(f,s)}t(a6r,"getPolicyNamesUsingSchemaValidationPolicies");function o6r(a,s){let c=new Set;a.policies?.forEach(d=>{d.handler?.export&&s.has(d.handler.export)&&d.handler.module==="$import(@zuplo/runtime)"&&c.add(d.name)});let f=c6r(a,c);return new Set([...c,...f])}t(o6r,"getPolicyNamesReferencingPolicyHandlers");function c6r(a,s){let c=new Set;return a.policies?.forEach(f=>{f.handler?.export==="CompositeInboundPolicy"&&f.handler?.options?.policies?.forEach(d=>{s.has(d)&&c.add(f.name)})}),c}t(c6r,"getCompositePoliciesContainingPolicy");function l6r(a,s){if(!a["x-zuplo-route"]||!a["x-zuplo-route"].policies)return!1;let c=a["x-zuplo-route"].policies.inbound;if(c){for(let d of c)if(s.has(d))return!0}let f=a["x-zuplo-route"].policies.outbound;if(f){for(let d of f)if(s.has(d))return!0}return!1}t(l6r,"isPolicyPresentInOperation");async function u6r(a,s){let c=[];for(let f of a){let d=await WLe.readFile(f,"utf-8"),E=JSON.parse(d).paths;for(let A in E){let O=E[A];for(let M in O){let W=O[M];l6r(W,s)&&c.push({fileName:Y7.basename(f,".oas.json"),path:A,method:M})}}}return c}t(u6r,"getRoutesContainingPolicies");import{mkdirSync as f6r,writeFileSync as _6r}from"fs";import p6r from"path";function dCt(a){return{name:"write-modules-plugin",setup(s){s.onEnd(async c=>{if(c){let f=hU(a.sourceDirectory,c.metafile);f6r(a.outputDirectory,{recursive:!0}),_6r(p6r.join(a.outputDirectory,"modules.json"),JSON.stringify(f,null,2))}})}}}t(dCt,"writeModulesPlugin");var d6r=t1t("zuplo:core:build"),m6r=["workerd","worker","browser"],gCt=[...process.env.GLOBAL_MODULE_LOCATION?[process.env.GLOBAL_MODULE_LOCATION]:[],HLe.resolve(mCt(hCt(import.meta.url)),"..","..","..","node_modules"),HLe.resolve(mCt(hCt(import.meta.url)),"..","..","..","..","..","node_modules")];async function HY({systemDirectory:a,outputDirectory:s,sourceDirectory:c,cacheDirectory:f,logger:d,minify:v=!0,command:E,flags:A}){let O=HLe.join(a,que);d6r(`Building with node paths: ${gCt.join(", ")}`);let M=v&&E!=="dev"&&!process.env.DEBUG_BUILD_DISABLE_MINIFY?{minify:!0,chunkNames:"[hash]"}:{minify:!1,keepNames:!0,chunkNames:"[name]-[hash]"},W=Object.freeze({sourceDirectory:c,outputDirectory:s,cacheDirectory:f,logger:d,debugMode:Mh.DEBUG_BUILD_MODE,flags:A});return{platform:"browser",target:"es2022",outdir:s,splitting:!0,metafile:!0,format:"esm",nodePaths:gCt,entryPoints:[O],sourcemap:"linked",legalComments:"none",treeShaking:!0,bundle:!0,...M,external:[],logLevel:"silent",conditions:m6r,plugins:[Ubt(W),r1t(W),sCt(W),oCt(W),pCt(W),lCt(),Rbt(W),tCt(W),nCt(W),dCt(W)]}}t(HY,"getBaseESBuildConfig");var X7="run-esbuild",vCt=t(async function({systemDirectory:a,outputDirectory:s,sourceDirectory:c,cacheDirectory:f,buildId:d,logger:v,config:E,command:A,minify:O},{data:M}){v.debug("Running esbuild");let W=await HY({command:A,minify:O,systemDirectory:a,outputDirectory:s,cacheDirectory:f,sourceDirectory:c,logger:v,flags:E.flags}),$;try{if(!await iB(c))throw new Error("Failed to build project because no open-api file was found on the 'config' folder");$=await yCt.build(W),M.set("metafile",$.metafile)}catch(De){if(v.error(De),De.errors||De.warnings)$=De;else if(De.message.includes("Failed to build project because no open-api file was found on the 'config' folder"))$={warnings:[],errors:[{id:"missing-open-api-file",text:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:X7,location:null,notes:[],detail:"Failed to build project because no open-api file was found on the 'config' folder"}],outputFiles:void 0,metafile:void 0,mangleCache:void 0};else throw De}$.errors.length>0&&$.errors.length>1&&($.errors.length=1);let{errors:Y,warnings:Ne}=GLe({buildId:d,result:$});return{errors:Y,warnings:Ne}},"runEsbuild");function GLe({buildId:a,result:s}){return{status:s.errors.length>0?"Failed":s.warnings.length>0?"Warnings":"Good",runtimeVersion:"0.0.0",buildTime:"",buildTimeMs:0,buildId:a,warnings:s.warnings.map(f=>f.text==="Using direct eval with a bundler is not recommended and may cause problems"?{location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:"We do not support the use of 'eval' or 'new Function(...)'",severity:Rue,pluginName:f.pluginName||X7}:{location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:f.text,severity:Rue,pluginName:f.pluginName||X7}),errors:s.errors.map(f=>({location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:f.text,severity:$3e,pluginName:f.pluginName||X7})),metafile:s.metafile}}t(GLe,"esbuildResultToBuildResult");var h6r=t((a,s)=>{let c=s;if(s.includes(a)){let f=new RegExp(`.*(${a})`,"g");c=s.replace(f,"")}return c.match(/^(\/)?(\.\.(\/)?)+/)&&(c=c.replace(/^(\/)?(\.\.(\/)?)+/,"/")),c},"removePrefixFromString"),g6r=t((a,s)=>{let c=s;if(c.includes(a)){let f=new RegExp(`[a-zA-Z0-9-_.\\/]+(${a})`,"g");c=c.replace(f,"")}return c},"cleanFilePathsInMessage"),bCt=t((a,s,c)=>{if(!a||a.length<=0)return a;let f=a.filter(d=>d.message!=='Could not resolve "@zuplo/runtime"');return f&&f.length>0&&f.forEach(d=>{try{d.location&&d.location.file&&(d.location.file=h6r(s,d.location.file)),d.location&&d.location.lineText&&d.location.lineText.includes("@zuplo/core/index.minified.js")&&(d.location.lineText=d.location.lineText.substring(0,200)+"...<Truncated>"),d.message=g6r(s,d.message),d.notes&&d.notes.length>0&&delete d.notes,d.text&&delete d.text,d.pluginName===""&&(d.pluginName=c)}catch{}}),f},"cleanDataOnBuildIssue");function SCt(a,s){let c=QLe.basename(s);a.errors&&(a.errors=bCt(a.errors,c,X7)),a.warnings&&(a.warnings=bCt(a.warnings,c,X7))}t(SCt,"formatBuildResult");var y6r=t(a=>QLe.basename(a).startsWith("."),"isHiddenOnUnix"),v6r=t((a,s=[])=>s.map(c=>c.startsWith(".")?c:`.${c}`).some(c=>a.endsWith(c)),"hasMatchingExtname");function JLe(a,s=[],c=!1){let f=[],d;if(!Rde.existsSync(a)){let v;if(wQ.hasMagic(a))v=a;else{let E=s.map(A=>A.startsWith(".")?A:`.${A}`).join("|");v=`${a}+(${E})`}if(f.push(...wQ.sync(v,{nodir:!0})),!f.length)throw Error(`Cannot find any files matching pattern "${a}"`);return f}try{if(d=Rde.statSync(a),d.isFile())return[a]}catch{return[]}return Rde.readdirSync(a).forEach(v=>{let E=QLe.join(a,v),A;try{if(A=Rde.statSync(E),A.isDirectory()){c&&f.push(...JLe(E,s,c));return}}catch{return}if(!s.length)throw Error(`Argument '${s}' required when argument '${a}' is a directory`);!A.isFile()||!v6r(E,s)||y6r(E)||f.push(E)}),f}t(JLe,"lookupFiles");var Z7=new Bue,aI=` ${Z7.gray("|")} `;function KLe({output:a,buildId:s,runtimeVersion:c,compatibilityDate:f}){let d=["Building Zuplo API...",`${aI}Build ID: ${s}`,`${aI}Runtime Version: ${c}`];f&&d.push(`${aI}Compatibility Date: ${f}`),a.info(d.join(`
|
|
639
639
|
`))}t(KLe,"outputApiBuildStart");async function Mde(a,s,c){SCt(c,a),await Promise.all(c.warnings.map(async d=>TCt(a,s,d))),await Promise.all(c.errors.map(async d=>TCt(a,s,d)));let f=process.env.CODEBUILD_BUILD_ID?new Date(new Date().getTime()+1):new Date;c.status==="Good"?s.info(Z7.green("Build succeeded"),{timestamp:f}):c.status==="Warnings"?s.warn(Z7.yellow("Build succeeded with warnings"),{timestamp:f}):c.status==="Failed"&&s.error(Z7.red("Build failed."),{timestamp:f})}t(Mde,"outputBuildResult");async function TCt(a,s,c){let f=[],d=c.severity??"error",v=d==="error"?Z7.red:Z7.yellow,E=v(`${d.toUpperCase()}: ${c.message}${c.detail?`
|
|
640
640
|
${aI}${c.detail.toString().split(`
|
|
641
641
|
`).join(`
|
|
642
|
-
${aI}`)}`:""}`);f.push(E);let A=T6r(c.location??void 0);if(A&&f.push(`${aI}${v(`The error was found in the file: ${A}`)}`),c.location&&c.location.file&&c.location.column!==0&&c.location.line!==0)try{let O=S6r.join(a,c.location.file),M=await b6r(O,"utf-8"),W=(0,CCt.codeFrameColumns)(M,{start:{line:c.location.line,column:c.location.column}},{highlightCode:!0,
|
|
642
|
+
${aI}`)}`:""}`);f.push(E);let A=T6r(c.location??void 0);if(A&&f.push(`${aI}${v(`The error was found in the file: ${A}`)}`),c.location&&c.location.file&&c.location.column!==0&&c.location.line!==0)try{let O=S6r.join(a,c.location.file),M=await b6r(O,"utf-8"),W=(0,CCt.codeFrameColumns)(M,{start:{line:c.location.line,column:c.location.column}},{highlightCode:!0,message:c.message,linesAbove:3,linesBelow:3});f.push(aI),f.push(W)}catch{}else c.location&&c.location.file&&f.push(Z7.red(`${aI}File: ${c.location.file}:${c.location.line}:${c.location.column}`));f.push(""),c.severity==="warning"?s.warn(f.join(`
|
|
643
643
|
`)):s.error(f.join(`
|
|
644
644
|
`))}t(TCt,"logIssue");function T6r(a){if(a&&a.file){let s=a.file;if(a.line)return`${s}:${a.line}`;if(a.column)return`${s}:${a.column}`}}t(T6r,"getFileLocation");var jC=class{static{t(this,"PluginResult")}errors=[];warnings=[];constructor(s){s&&this.errors.push(s)}};async function ECt(a,s,c){let f=[],d=[],v=new Map;for await(let E of a)try{let A=await E(s,{data:v,errors:d,warnings:f});if(d.push(...A.errors.map(O=>(O.pluginName===""&&(O.pluginName=E.name),O))),f.push(...A.warnings),A.errors.length>0)break}catch(A){if(A instanceof Tv?d.push({...A.issue,pluginName:A.pluginName??"unknown"}):d.push(A),c?.throwOnException)throw A;break}return{errors:d,warnings:f,data:v}}t(ECt,"runPlugins");import{parse as C6r}from"jsonc-parser";import{readFile as E6r}from"fs/promises";import xCt from"path";async function jde(a){let s=xCt.join(a,Jlt),c=xCt.join(a,qlt),f=!1,d=s;await Bu.fileExists(s)?(f=!0,d=s):await Bu.fileExists(c)&&(f=!0,d=c);let v,E;if(f){let O=await E6r(d,"utf-8"),W=C6r(O,[]);if(typeof W!="object")return{status:qF,errors:[{message:"Invalid zuplo.jsonc file.",detail:"The zuplo.jsonc file is not a valid JSON object",pluginName:"buildData",severity:"error"}]};if("version"in W&&W.version!==1)return{status:qF,errors:[{message:"Invalid version set in zuplo.jsonc file.",detail:"version in zuplo.jsonc must be set to 1",pluginName:"buildData",severity:"error"}]};if("compatibilityDate"in W&&qj&&typeof W.compatibilityDate=="string"){if(!qj.includes(W.compatibilityDate)){let $={message:"Invalid compatibilityDate set in zuplo.jsonc file.",detail:`compatibilityDate was set to ${W.compatibilityDate}. Valid compatibility dates are ${qj.join(", ")}`,pluginName:"buildData",severity:"error"};return{status:qF,errors:[$]}}v=W.compatibilityDate}E=Lue(v,W.flags)}else E=Lue(void 0,void 0);return{status:JF,config:{version:1,compatibilityDate:v,flags:E}}}t(jde,"getZuploConfig");import x6r from"fs";import{mkdir as DCt,readFile as D6r,readdir as A6r,writeFile as k6r}from"fs/promises";import GY from"path";import w6r from"readline";var ACt=t(async function({sourceDirectory:a,logger:s,outputDirectory:c,deploymentName:f,environmentType:d,deploymentUrl:v}){return of.timeFn("Building OpenAPI files",async()=>{s.debug("Building OpenAPI files");let E=GY.join(a,DS),A=GY.join(E,$ue),O=GY.join(c,Ult,DS);try{if(await Bu.dirExists(c)||await DCt(c),await Bu.dirExists(O)||await DCt(O,{recursive:!0}),!await iB(a))return new jC({message:"Failed to build project because no OpenAPI file was found on the 'config' folder",pluginName:"build-open-api-files",severity:"error"});let $=(await A6r(E)).filter(Se=>Se.endsWith(".oas.json"));if(!await Bu.fileExists(A))return new jC({message:"The project must include a policies file ('/config/policies.json')",pluginName:"build-open-api-files",severity:"error"});let Y=await D6r(A,"utf-8"),Ne=JSON.parse(Y),De=t(async Se=>{let Ct=GY.join(E,Se);if(!await P6r(Ct)){s.debug(`Skipping ${Se} as it does not use the OpenAPI handler`);return}let Tt;try{Tt=await Xpt({sourceDirectory:a,openApiDocPath:Ct,policiesConfig:Ne,logger:s,environmentType:d,deploymentName:f,deploymentUrl:v})}catch(Lr){if(s.error(Lr),Lr instanceof SyntaxError||Lr instanceof SC.ResolverError||Lr instanceof SC.JSONParserError||Lr instanceof SC.ParserError||Lr instanceof SC.MissingPointerError||Lr instanceof n7)return new jC({message:Lr.message,location:{file:Se,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:""},pluginName:"build-open-api-files",severity:"error"});if(Lr instanceof Tv)return new jC({...Lr.issue,pluginName:"build-open-api-files"});throw Lr}let br=JSON.stringify(Tt,null,2),Cr=GY.join(O,Se);await k6r(Cr,br,"utf-8")},"processFile");await Promise.all($.map(De))}catch(M){return s.error(M),new jC({message:"Error building OpenAPI files",pluginName:"build-open-api-files",severity:"error"})}return new jC})},"buildOpenApiFiles");async function P6r(a){let s=x6r.createReadStream(a),c=w6r.createInterface({input:s,crlfDelay:1/0}),f=!1,d=!1;for await(let v of c)if(v.includes('"openApiSpecHandler"')&&(f=!0),v.includes('"openApiFilePath"')&&(d=!0),f&&d)break;return c.close(),s.destroy(),f&&d}t(P6r,"usesOpenApiHandler");import N6r from"fs/promises";import I6r from"path";var kCt=t(async function({outputDirectory:a,systemDirectory:s,cacheDirectory:c,logger:f}){return of.timeFn("Cleaning output",async()=>{f.debug("Cleaning output");let d=I6r.join(c,"routes");return await Promise.all([a,s,d].map(async v=>{try{await N6r.rm(v,{recursive:!0,force:!0})}catch(E){f.error(E)}})),{warnings:[],errors:[]}})},"cleanOutput");import wCt from"fs/promises";var PCt=t(async function({systemDirectory:a,cacheDirectory:s,logger:c}){return of.timeFn("Creating system directory",async()=>{c.debug("Creating system directory");try{return await Promise.all([wCt.mkdir(a,{recursive:!0}),wCt.mkdir(s,{recursive:!0})]),{warnings:[],errors:[]}}catch(f){return c.error(f),{warnings:[],errors:[]}}return{warnings:[],errors:[]}})},"createSystemDir");var NCt=t(async function({logger:a}){return of.timeFn("Checking for breaking changes",async()=>(a.debug("Checking for breaking changes"),{warnings:[],errors:[]}))},"checkForDeprecations");import{readFile as O6r,writeFile as F6r}from"fs/promises";import ICt,{dirname as L6r}from"path";import{fileURLToPath as R6r}from"url";var OCt=t(async function({systemDirectory:a,buildId:s,logger:c,config:f,publicZuploEnvironmentVariables:d}){return of.timeFn("Generating build data",async()=>{c.debug("Generating build data");let v=await O6r(ICt.resolve(L6r(R6r(import.meta.url)),"../../../package.json"),"utf-8"),E=JSON.parse(v),A={BUILD_ID:s??"",GIT_SHA:process.env.GIT_SHA,TIMESTAMP:new Date().toISOString(),BUILD_ENV:Mh.NODE_ENV,ZUPLO_VERSION:E.version,API_VERSION:process.env.API_VERSION,COMPATIBILITY_DATE:f?.compatibilityDate,ACCOUNT_NAME:d?.ZUPLO_ACCOUNT_NAME,PROJECT_NAME:d?.ZUPLO_PROJECT_NAME,ENVIRONMENT_TYPE:d?.ZUPLO_ENVIRONMENT_TYPE,IS_LOCAL_DEVELOPMENT:Mh.isLocalDevelopment(),COMPATIBILITY_FLAGS:J3e[f?.compatibilityDate??"none"]},O=JSON.stringify(A,void 0,2),M=ICt.join(a,Jue);try{await F6r(M,O.trimStart(),"utf-8")}catch(W){c.error(W);let $={message:`Error creating file at ${M}`,pluginName:"buildData",severity:"error"};return{warnings:[],errors:[$]}}return{warnings:[],errors:[]}})},"generateBuildData");import M6r from"fs/promises";import j6r from"path";var B6r=`import { Handler, ServiceProviderImpl } from "@zuplo/runtime";
|
|
645
645
|
import routeLoader from "../config/routes.json";
|
package/index.minified.js
CHANGED
|
@@ -635,7 +635,7 @@ Did you specify these with the most recent transformation maps first?`);let d=y5
|
|
|
635
635
|
`).slice(1);return s[1].includes(Xvt)||s[2].includes(Xvt)},"isFromCjsLexer"),OTr=vp((a,s)=>{let c=a.split("?"),f=new URLSearchParams(c[1]);if(s?.filename){let d=tbt(s.filename),v;if(d){let A=d.split("?"),O=A[0];v=A[1],s.filename=O,s.path=IS.dirname(O),s.paths=mk._nodeModulePaths(s.path),mk._cache[O]=s}v||(v=s.filename.split("?")[1]);let E=new URLSearchParams(v).get("namespace");E&&f.append("namespace",E)}return[c[0],f,(d,v)=>(IS.isAbsolute(d)&&!d.endsWith(".json")&&!d.endsWith(".node")&&!(v===0&&ITr(new Error))&&(d+=T5e(f)),d)]},"preserveQuery"),FTr=vp((a,s,c)=>{if(a.startsWith(aY)&&(a=ebt(a)),S5e&&!$pe(a)&&!s?.filename?.includes(sbt)){let f=S5e(a);for(let d of f)try{return c(d)}catch{}}return c(a)},"resolveTsPaths"),LTr=vp((a,s,c)=>(f,d,...v)=>{if(a.enabled===!1)return s(f,d,...v);f=C5e(f);let[E,A,O]=OTr(f,d);if((A.get("namespace")??void 0)!==c)return s(f,d,...v);let M=vp($=>s($,d,...v),"nextResolveSimple");M=NTr(M,!!(c||d?.filename&&STr.test(d.filename))),M=ATr(M);let W=FTr(E,d,M);return O(W,v.length)},"createResolveFilename"),Zvt=vp((a,s)=>{if(!s)throw new Error("The current file path (__filename or import.meta.url) must be provided in the second argument of tsx.require()");return a.startsWith(".")?((typeof s=="string"&&s.startsWith(aY)||s instanceof URL)&&(s=ebt(s)),IS.resolve(IS.dirname(s),a)):a},"resolveContext"),oY=vp(a=>{let{sourceMapsEnabled:s}=process,c={enabled:!0};TTr(process.env.TSX_TSCONFIG_PATH),process.setSourceMapsEnabled(!0);let f=mk._resolveFilename,d=LTr(c,f,a?.namespace);mk._resolveFilename=d;let v=DTr(c,mk._extensions,a?.namespace),E=vp(()=>{s===!1&&process.setSourceMapsEnabled(!1),c.enabled=!1,mk._resolveFilename===d&&(mk._resolveFilename=f),v()},"unregister");if(a?.namespace){let A=vp((M,W)=>{let $=Zvt(M,W),[Y,Ne]=$.split("?"),De=new URLSearchParams(Ne);return a.namespace&&!Y.startsWith("node:")&&De.set("namespace",a.namespace),E7(Y+T5e(De))},"scopedRequire");E.require=A;let O=vp((M,W,$)=>{let Y=Zvt(M,W),[Ne,De]=Y.split("?"),Se=new URLSearchParams(De);return a.namespace&&!Ne.startsWith("node:")&&Se.set("namespace",a.namespace),d(Ne+T5e(Se),module,!1,$)},"scopedResolve");E.resolve=O,E.unregister=E}return E},"register");import{pathToFileURL as jTr}from"url";var RTr=Object.defineProperty,qpe=t((a,s)=>RTr(a,"name",{value:s,configurable:!0}),"o"),BTr=qpe(a=>(s,c)=>{if(!c)throw new Error("The current file path (import.meta.url) must be provided in the second argument of tsImport()");let f=c.startsWith(aY)?c:jTr(c).toString();return import(`tsx://${JSON.stringify({specifier:s,parentURL:f,namespace:a})}`)},"createScopedImport"),ubt=!1,fbt=qpe(a=>{if(!Jpe.register)throw new Error(`This version of Node.js (${process.version}) does not support module.register(). Please upgrade to Node v18.19 or v20.6 and above.`);if(!ubt){let{_resolveFilename:A}=Jpe;Jpe._resolveFilename=(O,...M)=>A(C5e(O),...M),ubt=!0}let{sourceMapsEnabled:s}=process;process.setSourceMapsEnabled(!0);let{port1:c,port2:f}=new MTr;Jpe.register(`./esm/index.mjs?${Date.now()}`,{parentURL:import.meta.url,data:{port:f,namespace:a?.namespace,tsconfig:a?.tsconfig},transferList:[f]});let d=a?.onImport,v=d&&(A=>{A.type==="load"&&d(A.url)});v&&(c.on("message",v),c.unref());let E=qpe(()=>(s===!1&&process.setSourceMapsEnabled(!1),v&&c.off("message",v),c.postMessage("deactivate"),new Promise(A=>{let O=qpe(M=>{M.type==="deactivated"&&(A(),c.off("message",O))},"onDeactivated");c.on("message",O)})),"unregister");return a?.namespace&&(E.import=BTr(a.namespace),E.unregister=E),E},"register");var UTr=Object.defineProperty,pbt=t((a,s)=>UTr(a,"name",{value:s,configurable:!0}),"a"),cU,zpe=pbt((a,s)=>(cU||(cU=oY({namespace:Date.now().toString()})),cU.require(a,s)),"tsxRequire"),_bt=pbt((a,s,c)=>(cU||(cU=oY({namespace:Date.now().toString()})),cU.resolve(a,s,c)),"resolve");_bt.paths=E7.resolve.paths,zpe.resolve=_bt,zpe.main=E7.main,zpe.extensions=E7.extensions,zpe.cache=E7.cache;var $Tr=Object.defineProperty,dbt=t((a,s)=>$Tr(a,"name",{value:s,configurable:!0}),"o"),JTr=dbt((a,s)=>{let c=a[0]-s[0];if(c===0){let f=a[1]-s[1];return f===0?a[2]>=s[2]:f>0}return c>0},"isVersionGreaterOrEqual"),qTr=process.versions.node.split(".").map(Number),mbt=dbt((a,s=qTr)=>{for(let c=0;c<a.length;c+=1){let f=a[c];if(c===a.length-1||s[0]===f[0])return JTr(s,f)}return!1},"isFeatureSupported");var hbt=[[20,11,0],[21,3,0]];import"esbuild";var zTr=Object.defineProperty,VTr=t((a,s)=>zTr(a,"name",{value:s,configurable:!0}),"i"),WTr=VTr((a,s)=>{if(!s||typeof s=="object"&&!s.parentURL)throw new Error("The current file path (import.meta.url) must be provided in the second argument of tsImport()");let c=typeof s=="string",f=c?s:s.parentURL,d=Date.now().toString(),v=oY({namespace:d});return!mbt(hbt)&&!ibt.test(a)&&rbt.test(a)?Promise.resolve(v.require(a,f)):fbt({namespace:d,...c?{}:s}).import(a,f)},"tsImport");var cf;(function(a){a.assertEqual=d=>d;function s(d){}t(s,"assertIs"),a.assertIs=s;function c(d){throw new Error}t(c,"assertNever"),a.assertNever=c,a.arrayToEnum=d=>{let v={};for(let E of d)v[E]=E;return v},a.getValidEnumValues=d=>{let v=a.objectKeys(d).filter(A=>typeof d[d[A]]!="number"),E={};for(let A of v)E[A]=d[A];return a.objectValues(E)},a.objectValues=d=>a.objectKeys(d).map(function(v){return d[v]}),a.objectKeys=typeof Object.keys=="function"?d=>Object.keys(d):d=>{let v=[];for(let E in d)Object.prototype.hasOwnProperty.call(d,E)&&v.push(E);return v},a.find=(d,v)=>{for(let E of d)if(v(E))return E},a.isInteger=typeof Number.isInteger=="function"?d=>Number.isInteger(d):d=>typeof d=="number"&&isFinite(d)&&Math.floor(d)===d;function f(d,v=" | "){return d.map(E=>typeof E=="string"?`'${E}'`:E).join(v)}t(f,"joinValues"),a.joinValues=f,a.jsonStringifyReplacer=(d,v)=>typeof v=="bigint"?v.toString():v})(cf||(cf={}));var x5e;(function(a){a.mergeShapes=(s,c)=>({...s,...c})})(x5e||(x5e={}));var Xa=cf.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),QN=t(a=>{switch(typeof a){case"undefined":return Xa.undefined;case"string":return Xa.string;case"number":return isNaN(a)?Xa.nan:Xa.number;case"boolean":return Xa.boolean;case"function":return Xa.function;case"bigint":return Xa.bigint;case"symbol":return Xa.symbol;case"object":return Array.isArray(a)?Xa.array:a===null?Xa.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?Xa.promise:typeof Map<"u"&&a instanceof Map?Xa.map:typeof Set<"u"&&a instanceof Set?Xa.set:typeof Date<"u"&&a instanceof Date?Xa.date:Xa.object;default:return Xa.unknown}},"getParsedType"),Rs=cf.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),HTr=t(a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),OS=class a extends Error{static{t(this,"ZodError")}constructor(s){super(),this.issues=[],this.addIssue=f=>{this.issues=[...this.issues,f]},this.addIssues=(f=[])=>{this.issues=[...this.issues,...f]};let c=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,c):this.__proto__=c,this.name="ZodError",this.issues=s}get errors(){return this.issues}format(s){let c=s||function(v){return v.message},f={_errors:[]},d=t(v=>{for(let E of v.issues)if(E.code==="invalid_union")E.unionErrors.map(d);else if(E.code==="invalid_return_type")d(E.returnTypeError);else if(E.code==="invalid_arguments")d(E.argumentsError);else if(E.path.length===0)f._errors.push(c(E));else{let A=f,O=0;for(;O<E.path.length;){let M=E.path[O];O===E.path.length-1?(A[M]=A[M]||{_errors:[]},A[M]._errors.push(c(E))):A[M]=A[M]||{_errors:[]},A=A[M],O++}}},"processError");return d(this),f}static assert(s){if(!(s instanceof a))throw new Error(`Not a ZodError: ${s}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,cf.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(s=c=>c.message){let c={},f=[];for(let d of this.issues)d.path.length>0?(c[d.path[0]]=c[d.path[0]]||[],c[d.path[0]].push(s(d))):f.push(s(d));return{formErrors:f,fieldErrors:c}}get formErrors(){return this.flatten()}};OS.create=a=>new OS(a);var fU=t((a,s)=>{let c;switch(a.code){case Rs.invalid_type:a.received===Xa.undefined?c="Required":c=`Expected ${a.expected}, received ${a.received}`;break;case Rs.invalid_literal:c=`Invalid literal value, expected ${JSON.stringify(a.expected,cf.jsonStringifyReplacer)}`;break;case Rs.unrecognized_keys:c=`Unrecognized key(s) in object: ${cf.joinValues(a.keys,", ")}`;break;case Rs.invalid_union:c="Invalid input";break;case Rs.invalid_union_discriminator:c=`Invalid discriminator value. Expected ${cf.joinValues(a.options)}`;break;case Rs.invalid_enum_value:c=`Invalid enum value. Expected ${cf.joinValues(a.options)}, received '${a.received}'`;break;case Rs.invalid_arguments:c="Invalid function arguments";break;case Rs.invalid_return_type:c="Invalid function return type";break;case Rs.invalid_date:c="Invalid date";break;case Rs.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(c=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(c=`${c} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?c=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?c=`Invalid input: must end with "${a.validation.endsWith}"`:cf.assertNever(a.validation):a.validation!=="regex"?c=`Invalid ${a.validation}`:c="Invalid";break;case Rs.too_small:a.type==="array"?c=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?c=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?c=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?c=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:c="Invalid input";break;case Rs.too_big:a.type==="array"?c=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?c=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?c=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?c=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?c=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:c="Invalid input";break;case Rs.custom:c="Invalid input";break;case Rs.invalid_intersection_types:c="Intersection results could not be merged";break;case Rs.not_multiple_of:c=`Number must be a multiple of ${a.multipleOf}`;break;case Rs.not_finite:c="Number must be finite";break;default:c=s.defaultError,cf.assertNever(a)}return{message:c}},"errorMap"),vbt=fU;function GTr(a){vbt=a}t(GTr,"setErrorMap");function Vpe(){return vbt}t(Vpe,"getErrorMap");var Wpe=t(a=>{let{data:s,path:c,errorMaps:f,issueData:d}=a,v=[...c,...d.path||[]],E={...d,path:v};if(d.message!==void 0)return{...d,path:v,message:d.message};let A="",O=f.filter(M=>!!M).slice().reverse();for(let M of O)A=M(E,{data:s,defaultError:A}).message;return{...d,path:v,message:A}},"makeIssue"),QTr=[];function Ba(a,s){let c=Vpe(),f=Wpe({issueData:s,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,c,c===fU?void 0:fU].filter(d=>!!d)});a.common.issues.push(f)}t(Ba,"addIssueToContext");var u1=class a{static{t(this,"ParseStatus")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(s,c){let f=[];for(let d of c){if(d.status==="aborted")return Oc;d.status==="dirty"&&s.dirty(),f.push(d.value)}return{status:s.value,value:f}}static async mergeObjectAsync(s,c){let f=[];for(let d of c){let v=await d.key,E=await d.value;f.push({key:v,value:E})}return a.mergeObjectSync(s,f)}static mergeObjectSync(s,c){let f={};for(let d of c){let{key:v,value:E}=d;if(v.status==="aborted"||E.status==="aborted")return Oc;v.status==="dirty"&&s.dirty(),E.status==="dirty"&&s.dirty(),v.value!=="__proto__"&&(typeof E.value<"u"||d.alwaysSet)&&(f[v.value]=E.value)}return{status:s.value,value:f}}},Oc=Object.freeze({status:"aborted"}),uU=t(a=>({status:"dirty",value:a}),"DIRTY"),Nv=t(a=>({status:"valid",value:a}),"OK"),D5e=t(a=>a.status==="aborted","isAborted"),A5e=t(a=>a.status==="dirty","isDirty"),uY=t(a=>a.status==="valid","isValid"),fY=t(a=>typeof Promise<"u"&&a instanceof Promise,"isAsync");function Hpe(a,s,c,f){if(c==="a"&&!f)throw new TypeError("Private accessor was defined without a getter");if(typeof s=="function"?a!==s||!f:!s.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return c==="m"?f:c==="a"?f.call(a):f?f.value:s.get(a)}t(Hpe,"__classPrivateFieldGet");function bbt(a,s,c,f,d){if(f==="m")throw new TypeError("Private method is not writable");if(f==="a"&&!d)throw new TypeError("Private accessor was defined without a setter");if(typeof s=="function"?a!==s||!d:!s.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return f==="a"?d.call(a,c):d?d.value=c:s.set(a,c),c}t(bbt,"__classPrivateFieldSet");var Jo;(function(a){a.errToObj=s=>typeof s=="string"?{message:s}:s||{},a.toString=s=>typeof s=="string"?s:s?.message})(Jo||(Jo={}));var cY,lY,IC=class{static{t(this,"ParseInputLazyPath")}constructor(s,c,f,d){this._cachedPath=[],this.parent=s,this.data=c,this._path=f,this._key=d}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},gbt=t((a,s)=>{if(uY(s))return{success:!0,data:s.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let c=new OS(a.common.issues);return this._error=c,this._error}}},"handleResult");function xl(a){if(!a)return{};let{errorMap:s,invalid_type_error:c,required_error:f,description:d}=a;if(s&&(c||f))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return s?{errorMap:s,description:d}:{errorMap:t((E,A)=>{var O,M;let{message:W}=a;return E.code==="invalid_enum_value"?{message:W??A.defaultError}:typeof A.data>"u"?{message:(O=W??f)!==null&&O!==void 0?O:A.defaultError}:E.code!=="invalid_type"?{message:A.defaultError}:{message:(M=W??c)!==null&&M!==void 0?M:A.defaultError}},"customMap"),description:d}}t(xl,"processCreateParams");var Dl=class{static{t(this,"ZodType")}constructor(s){this.spa=this.safeParseAsync,this._def=s,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(s){return QN(s.data)}_getOrReturnCtx(s,c){return c||{common:s.parent.common,data:s.data,parsedType:QN(s.data),schemaErrorMap:this._def.errorMap,path:s.path,parent:s.parent}}_processInputParams(s){return{status:new u1,ctx:{common:s.parent.common,data:s.data,parsedType:QN(s.data),schemaErrorMap:this._def.errorMap,path:s.path,parent:s.parent}}}_parseSync(s){let c=this._parse(s);if(fY(c))throw new Error("Synchronous parse encountered promise.");return c}_parseAsync(s){let c=this._parse(s);return Promise.resolve(c)}parse(s,c){let f=this.safeParse(s,c);if(f.success)return f.data;throw f.error}safeParse(s,c){var f;let d={common:{issues:[],async:(f=c?.async)!==null&&f!==void 0?f:!1,contextualErrorMap:c?.errorMap},path:c?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:s,parsedType:QN(s)},v=this._parseSync({data:s,path:d.path,parent:d});return gbt(d,v)}async parseAsync(s,c){let f=await this.safeParseAsync(s,c);if(f.success)return f.data;throw f.error}async safeParseAsync(s,c){let f={common:{issues:[],contextualErrorMap:c?.errorMap,async:!0},path:c?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:s,parsedType:QN(s)},d=this._parse({data:s,path:f.path,parent:f}),v=await(fY(d)?d:Promise.resolve(d));return gbt(f,v)}refine(s,c){let f=t(d=>typeof c=="string"||typeof c>"u"?{message:c}:typeof c=="function"?c(d):c,"getIssueProperties");return this._refinement((d,v)=>{let E=s(d),A=t(()=>v.addIssue({code:Rs.custom,...f(d)}),"setError");return typeof Promise<"u"&&E instanceof Promise?E.then(O=>O?!0:(A(),!1)):E?!0:(A(),!1)})}refinement(s,c){return this._refinement((f,d)=>s(f)?!0:(d.addIssue(typeof c=="function"?c(f,d):c),!1))}_refinement(s){return new FS({schema:this,typeName:kc.ZodEffects,effect:{type:"refinement",refinement:s}})}superRefine(s){return this._refinement(s)}optional(){return NC.create(this,this._def)}nullable(){return gk.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return w6.create(this,this._def)}promise(){return XN.create(this,this._def)}or(s){return O7.create([this,s],this._def)}and(s){return F7.create(this,s,this._def)}transform(s){return new FS({...xl(this._def),schema:this,typeName:kc.ZodEffects,effect:{type:"transform",transform:s}})}default(s){let c=typeof s=="function"?s:()=>s;return new B7({...xl(this._def),innerType:this,defaultValue:c,typeName:kc.ZodDefault})}brand(){return new _Y({typeName:kc.ZodBranded,type:this,...xl(this._def)})}catch(s){let c=typeof s=="function"?s:()=>s;return new U7({...xl(this._def),innerType:this,catchValue:c,typeName:kc.ZodCatch})}describe(s){let c=this.constructor;return new c({...this._def,description:s})}pipe(s){return pY.create(this,s)}readonly(){return $7.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},KTr=/^c[^\s-]{8,}$/i,YTr=/^[0-9a-z]+$/,XTr=/^[0-9A-HJKMNP-TV-Z]{26}$/,ZTr=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,eCr=/^[a-z0-9_-]{21}$/i,tCr=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,rCr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nCr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",E5e,iCr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sCr=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,aCr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Sbt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",oCr=new RegExp(`^${Sbt}$`);function Tbt(a){let s="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return a.precision?s=`${s}\\.\\d{${a.precision}}`:a.precision==null&&(s=`${s}(\\.\\d+)?`),s}t(Tbt,"timeRegexSource");function cCr(a){return new RegExp(`^${Tbt(a)}$`)}t(cCr,"timeRegex");function Cbt(a){let s=`${Sbt}T${Tbt(a)}`,c=[];return c.push(a.local?"Z?":"Z"),a.offset&&c.push("([+-]\\d{2}:?\\d{2})"),s=`${s}(${c.join("|")})`,new RegExp(`^${s}$`)}t(Cbt,"datetimeRegex");function lCr(a,s){return!!((s==="v4"||!s)&&iCr.test(a)||(s==="v6"||!s)&&sCr.test(a))}t(lCr,"isValidIP");var KN=class a extends Dl{static{t(this,"ZodString")}_parse(s){if(this._def.coerce&&(s.data=String(s.data)),this._getType(s)!==Xa.string){let v=this._getOrReturnCtx(s);return Ba(v,{code:Rs.invalid_type,expected:Xa.string,received:v.parsedType}),Oc}let f=new u1,d;for(let v of this._def.checks)if(v.kind==="min")s.data.length<v.value&&(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.too_small,minimum:v.value,type:"string",inclusive:!0,exact:!1,message:v.message}),f.dirty());else if(v.kind==="max")s.data.length>v.value&&(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.too_big,maximum:v.value,type:"string",inclusive:!0,exact:!1,message:v.message}),f.dirty());else if(v.kind==="length"){let E=s.data.length>v.value,A=s.data.length<v.value;(E||A)&&(d=this._getOrReturnCtx(s,d),E?Ba(d,{code:Rs.too_big,maximum:v.value,type:"string",inclusive:!0,exact:!0,message:v.message}):A&&Ba(d,{code:Rs.too_small,minimum:v.value,type:"string",inclusive:!0,exact:!0,message:v.message}),f.dirty())}else if(v.kind==="email")rCr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"email",code:Rs.invalid_string,message:v.message}),f.dirty());else if(v.kind==="emoji")E5e||(E5e=new RegExp(nCr,"u")),E5e.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"emoji",code:Rs.invalid_string,message:v.message}),f.dirty());else if(v.kind==="uuid")ZTr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"uuid",code:Rs.invalid_string,message:v.message}),f.dirty());else if(v.kind==="nanoid")eCr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"nanoid",code:Rs.invalid_string,message:v.message}),f.dirty());else if(v.kind==="cuid")KTr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"cuid",code:Rs.invalid_string,message:v.message}),f.dirty());else if(v.kind==="cuid2")YTr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"cuid2",code:Rs.invalid_string,message:v.message}),f.dirty());else if(v.kind==="ulid")XTr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"ulid",code:Rs.invalid_string,message:v.message}),f.dirty());else if(v.kind==="url")try{new URL(s.data)}catch{d=this._getOrReturnCtx(s,d),Ba(d,{validation:"url",code:Rs.invalid_string,message:v.message}),f.dirty()}else v.kind==="regex"?(v.regex.lastIndex=0,v.regex.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"regex",code:Rs.invalid_string,message:v.message}),f.dirty())):v.kind==="trim"?s.data=s.data.trim():v.kind==="includes"?s.data.includes(v.value,v.position)||(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.invalid_string,validation:{includes:v.value,position:v.position},message:v.message}),f.dirty()):v.kind==="toLowerCase"?s.data=s.data.toLowerCase():v.kind==="toUpperCase"?s.data=s.data.toUpperCase():v.kind==="startsWith"?s.data.startsWith(v.value)||(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.invalid_string,validation:{startsWith:v.value},message:v.message}),f.dirty()):v.kind==="endsWith"?s.data.endsWith(v.value)||(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.invalid_string,validation:{endsWith:v.value},message:v.message}),f.dirty()):v.kind==="datetime"?Cbt(v).test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.invalid_string,validation:"datetime",message:v.message}),f.dirty()):v.kind==="date"?oCr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.invalid_string,validation:"date",message:v.message}),f.dirty()):v.kind==="time"?cCr(v).test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.invalid_string,validation:"time",message:v.message}),f.dirty()):v.kind==="duration"?tCr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"duration",code:Rs.invalid_string,message:v.message}),f.dirty()):v.kind==="ip"?lCr(s.data,v.version)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"ip",code:Rs.invalid_string,message:v.message}),f.dirty()):v.kind==="base64"?aCr.test(s.data)||(d=this._getOrReturnCtx(s,d),Ba(d,{validation:"base64",code:Rs.invalid_string,message:v.message}),f.dirty()):cf.assertNever(v);return{status:f.value,value:s.data}}_regex(s,c,f){return this.refinement(d=>s.test(d),{validation:c,code:Rs.invalid_string,...Jo.errToObj(f)})}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}email(s){return this._addCheck({kind:"email",...Jo.errToObj(s)})}url(s){return this._addCheck({kind:"url",...Jo.errToObj(s)})}emoji(s){return this._addCheck({kind:"emoji",...Jo.errToObj(s)})}uuid(s){return this._addCheck({kind:"uuid",...Jo.errToObj(s)})}nanoid(s){return this._addCheck({kind:"nanoid",...Jo.errToObj(s)})}cuid(s){return this._addCheck({kind:"cuid",...Jo.errToObj(s)})}cuid2(s){return this._addCheck({kind:"cuid2",...Jo.errToObj(s)})}ulid(s){return this._addCheck({kind:"ulid",...Jo.errToObj(s)})}base64(s){return this._addCheck({kind:"base64",...Jo.errToObj(s)})}ip(s){return this._addCheck({kind:"ip",...Jo.errToObj(s)})}datetime(s){var c,f;return typeof s=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:s}):this._addCheck({kind:"datetime",precision:typeof s?.precision>"u"?null:s?.precision,offset:(c=s?.offset)!==null&&c!==void 0?c:!1,local:(f=s?.local)!==null&&f!==void 0?f:!1,...Jo.errToObj(s?.message)})}date(s){return this._addCheck({kind:"date",message:s})}time(s){return typeof s=="string"?this._addCheck({kind:"time",precision:null,message:s}):this._addCheck({kind:"time",precision:typeof s?.precision>"u"?null:s?.precision,...Jo.errToObj(s?.message)})}duration(s){return this._addCheck({kind:"duration",...Jo.errToObj(s)})}regex(s,c){return this._addCheck({kind:"regex",regex:s,...Jo.errToObj(c)})}includes(s,c){return this._addCheck({kind:"includes",value:s,position:c?.position,...Jo.errToObj(c?.message)})}startsWith(s,c){return this._addCheck({kind:"startsWith",value:s,...Jo.errToObj(c)})}endsWith(s,c){return this._addCheck({kind:"endsWith",value:s,...Jo.errToObj(c)})}min(s,c){return this._addCheck({kind:"min",value:s,...Jo.errToObj(c)})}max(s,c){return this._addCheck({kind:"max",value:s,...Jo.errToObj(c)})}length(s,c){return this._addCheck({kind:"length",value:s,...Jo.errToObj(c)})}nonempty(s){return this.min(1,Jo.errToObj(s))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(s=>s.kind==="datetime")}get isDate(){return!!this._def.checks.find(s=>s.kind==="date")}get isTime(){return!!this._def.checks.find(s=>s.kind==="time")}get isDuration(){return!!this._def.checks.find(s=>s.kind==="duration")}get isEmail(){return!!this._def.checks.find(s=>s.kind==="email")}get isURL(){return!!this._def.checks.find(s=>s.kind==="url")}get isEmoji(){return!!this._def.checks.find(s=>s.kind==="emoji")}get isUUID(){return!!this._def.checks.find(s=>s.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(s=>s.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(s=>s.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(s=>s.kind==="cuid2")}get isULID(){return!!this._def.checks.find(s=>s.kind==="ulid")}get isIP(){return!!this._def.checks.find(s=>s.kind==="ip")}get isBase64(){return!!this._def.checks.find(s=>s.kind==="base64")}get minLength(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s}get maxLength(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s}};KN.create=a=>{var s;return new KN({checks:[],typeName:kc.ZodString,coerce:(s=a?.coerce)!==null&&s!==void 0?s:!1,...xl(a)})};function uCr(a,s){let c=(a.toString().split(".")[1]||"").length,f=(s.toString().split(".")[1]||"").length,d=c>f?c:f,v=parseInt(a.toFixed(d).replace(".","")),E=parseInt(s.toFixed(d).replace(".",""));return v%E/Math.pow(10,d)}t(uCr,"floatSafeRemainder");var A7=class a extends Dl{static{t(this,"ZodNumber")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(s){if(this._def.coerce&&(s.data=Number(s.data)),this._getType(s)!==Xa.number){let v=this._getOrReturnCtx(s);return Ba(v,{code:Rs.invalid_type,expected:Xa.number,received:v.parsedType}),Oc}let f,d=new u1;for(let v of this._def.checks)v.kind==="int"?cf.isInteger(s.data)||(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.invalid_type,expected:"integer",received:"float",message:v.message}),d.dirty()):v.kind==="min"?(v.inclusive?s.data<v.value:s.data<=v.value)&&(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.too_small,minimum:v.value,type:"number",inclusive:v.inclusive,exact:!1,message:v.message}),d.dirty()):v.kind==="max"?(v.inclusive?s.data>v.value:s.data>=v.value)&&(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.too_big,maximum:v.value,type:"number",inclusive:v.inclusive,exact:!1,message:v.message}),d.dirty()):v.kind==="multipleOf"?uCr(s.data,v.value)!==0&&(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.not_multiple_of,multipleOf:v.value,message:v.message}),d.dirty()):v.kind==="finite"?Number.isFinite(s.data)||(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.not_finite,message:v.message}),d.dirty()):cf.assertNever(v);return{status:d.value,value:s.data}}gte(s,c){return this.setLimit("min",s,!0,Jo.toString(c))}gt(s,c){return this.setLimit("min",s,!1,Jo.toString(c))}lte(s,c){return this.setLimit("max",s,!0,Jo.toString(c))}lt(s,c){return this.setLimit("max",s,!1,Jo.toString(c))}setLimit(s,c,f,d){return new a({...this._def,checks:[...this._def.checks,{kind:s,value:c,inclusive:f,message:Jo.toString(d)}]})}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}int(s){return this._addCheck({kind:"int",message:Jo.toString(s)})}positive(s){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Jo.toString(s)})}negative(s){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Jo.toString(s)})}nonpositive(s){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Jo.toString(s)})}nonnegative(s){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Jo.toString(s)})}multipleOf(s,c){return this._addCheck({kind:"multipleOf",value:s,message:Jo.toString(c)})}finite(s){return this._addCheck({kind:"finite",message:Jo.toString(s)})}safe(s){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Jo.toString(s)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Jo.toString(s)})}get minValue(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s}get maxValue(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s}get isInt(){return!!this._def.checks.find(s=>s.kind==="int"||s.kind==="multipleOf"&&cf.isInteger(s.value))}get isFinite(){let s=null,c=null;for(let f of this._def.checks){if(f.kind==="finite"||f.kind==="int"||f.kind==="multipleOf")return!0;f.kind==="min"?(c===null||f.value>c)&&(c=f.value):f.kind==="max"&&(s===null||f.value<s)&&(s=f.value)}return Number.isFinite(c)&&Number.isFinite(s)}};A7.create=a=>new A7({checks:[],typeName:kc.ZodNumber,coerce:a?.coerce||!1,...xl(a)});var k7=class a extends Dl{static{t(this,"ZodBigInt")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(s){if(this._def.coerce&&(s.data=BigInt(s.data)),this._getType(s)!==Xa.bigint){let v=this._getOrReturnCtx(s);return Ba(v,{code:Rs.invalid_type,expected:Xa.bigint,received:v.parsedType}),Oc}let f,d=new u1;for(let v of this._def.checks)v.kind==="min"?(v.inclusive?s.data<v.value:s.data<=v.value)&&(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.too_small,type:"bigint",minimum:v.value,inclusive:v.inclusive,message:v.message}),d.dirty()):v.kind==="max"?(v.inclusive?s.data>v.value:s.data>=v.value)&&(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.too_big,type:"bigint",maximum:v.value,inclusive:v.inclusive,message:v.message}),d.dirty()):v.kind==="multipleOf"?s.data%v.value!==BigInt(0)&&(f=this._getOrReturnCtx(s,f),Ba(f,{code:Rs.not_multiple_of,multipleOf:v.value,message:v.message}),d.dirty()):cf.assertNever(v);return{status:d.value,value:s.data}}gte(s,c){return this.setLimit("min",s,!0,Jo.toString(c))}gt(s,c){return this.setLimit("min",s,!1,Jo.toString(c))}lte(s,c){return this.setLimit("max",s,!0,Jo.toString(c))}lt(s,c){return this.setLimit("max",s,!1,Jo.toString(c))}setLimit(s,c,f,d){return new a({...this._def,checks:[...this._def.checks,{kind:s,value:c,inclusive:f,message:Jo.toString(d)}]})}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}positive(s){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Jo.toString(s)})}negative(s){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Jo.toString(s)})}nonpositive(s){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Jo.toString(s)})}nonnegative(s){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Jo.toString(s)})}multipleOf(s,c){return this._addCheck({kind:"multipleOf",value:s,message:Jo.toString(c)})}get minValue(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s}get maxValue(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s}};k7.create=a=>{var s;return new k7({checks:[],typeName:kc.ZodBigInt,coerce:(s=a?.coerce)!==null&&s!==void 0?s:!1,...xl(a)})};var w7=class extends Dl{static{t(this,"ZodBoolean")}_parse(s){if(this._def.coerce&&(s.data=!!s.data),this._getType(s)!==Xa.boolean){let f=this._getOrReturnCtx(s);return Ba(f,{code:Rs.invalid_type,expected:Xa.boolean,received:f.parsedType}),Oc}return Nv(s.data)}};w7.create=a=>new w7({typeName:kc.ZodBoolean,coerce:a?.coerce||!1,...xl(a)});var P7=class a extends Dl{static{t(this,"ZodDate")}_parse(s){if(this._def.coerce&&(s.data=new Date(s.data)),this._getType(s)!==Xa.date){let v=this._getOrReturnCtx(s);return Ba(v,{code:Rs.invalid_type,expected:Xa.date,received:v.parsedType}),Oc}if(isNaN(s.data.getTime())){let v=this._getOrReturnCtx(s);return Ba(v,{code:Rs.invalid_date}),Oc}let f=new u1,d;for(let v of this._def.checks)v.kind==="min"?s.data.getTime()<v.value&&(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.too_small,message:v.message,inclusive:!0,exact:!1,minimum:v.value,type:"date"}),f.dirty()):v.kind==="max"?s.data.getTime()>v.value&&(d=this._getOrReturnCtx(s,d),Ba(d,{code:Rs.too_big,message:v.message,inclusive:!0,exact:!1,maximum:v.value,type:"date"}),f.dirty()):cf.assertNever(v);return{status:f.value,value:new Date(s.data.getTime())}}_addCheck(s){return new a({...this._def,checks:[...this._def.checks,s]})}min(s,c){return this._addCheck({kind:"min",value:s.getTime(),message:Jo.toString(c)})}max(s,c){return this._addCheck({kind:"max",value:s.getTime(),message:Jo.toString(c)})}get minDate(){let s=null;for(let c of this._def.checks)c.kind==="min"&&(s===null||c.value>s)&&(s=c.value);return s!=null?new Date(s):null}get maxDate(){let s=null;for(let c of this._def.checks)c.kind==="max"&&(s===null||c.value<s)&&(s=c.value);return s!=null?new Date(s):null}};P7.create=a=>new P7({checks:[],coerce:a?.coerce||!1,typeName:kc.ZodDate,...xl(a)});var _U=class extends Dl{static{t(this,"ZodSymbol")}_parse(s){if(this._getType(s)!==Xa.symbol){let f=this._getOrReturnCtx(s);return Ba(f,{code:Rs.invalid_type,expected:Xa.symbol,received:f.parsedType}),Oc}return Nv(s.data)}};_U.create=a=>new _U({typeName:kc.ZodSymbol,...xl(a)});var N7=class extends Dl{static{t(this,"ZodUndefined")}_parse(s){if(this._getType(s)!==Xa.undefined){let f=this._getOrReturnCtx(s);return Ba(f,{code:Rs.invalid_type,expected:Xa.undefined,received:f.parsedType}),Oc}return Nv(s.data)}};N7.create=a=>new N7({typeName:kc.ZodUndefined,...xl(a)});var I7=class extends Dl{static{t(this,"ZodNull")}_parse(s){if(this._getType(s)!==Xa.null){let f=this._getOrReturnCtx(s);return Ba(f,{code:Rs.invalid_type,expected:Xa.null,received:f.parsedType}),Oc}return Nv(s.data)}};I7.create=a=>new I7({typeName:kc.ZodNull,...xl(a)});var YN=class extends Dl{static{t(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(s){return Nv(s.data)}};YN.create=a=>new YN({typeName:kc.ZodAny,...xl(a)});var k6=class extends Dl{static{t(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(s){return Nv(s.data)}};k6.create=a=>new k6({typeName:kc.ZodUnknown,...xl(a)});var Wx=class extends Dl{static{t(this,"ZodNever")}_parse(s){let c=this._getOrReturnCtx(s);return Ba(c,{code:Rs.invalid_type,expected:Xa.never,received:c.parsedType}),Oc}};Wx.create=a=>new Wx({typeName:kc.ZodNever,...xl(a)});var pU=class extends Dl{static{t(this,"ZodVoid")}_parse(s){if(this._getType(s)!==Xa.undefined){let f=this._getOrReturnCtx(s);return Ba(f,{code:Rs.invalid_type,expected:Xa.void,received:f.parsedType}),Oc}return Nv(s.data)}};pU.create=a=>new pU({typeName:kc.ZodVoid,...xl(a)});var w6=class a extends Dl{static{t(this,"ZodArray")}_parse(s){let{ctx:c,status:f}=this._processInputParams(s),d=this._def;if(c.parsedType!==Xa.array)return Ba(c,{code:Rs.invalid_type,expected:Xa.array,received:c.parsedType}),Oc;if(d.exactLength!==null){let E=c.data.length>d.exactLength.value,A=c.data.length<d.exactLength.value;(E||A)&&(Ba(c,{code:E?Rs.too_big:Rs.too_small,minimum:A?d.exactLength.value:void 0,maximum:E?d.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:d.exactLength.message}),f.dirty())}if(d.minLength!==null&&c.data.length<d.minLength.value&&(Ba(c,{code:Rs.too_small,minimum:d.minLength.value,type:"array",inclusive:!0,exact:!1,message:d.minLength.message}),f.dirty()),d.maxLength!==null&&c.data.length>d.maxLength.value&&(Ba(c,{code:Rs.too_big,maximum:d.maxLength.value,type:"array",inclusive:!0,exact:!1,message:d.maxLength.message}),f.dirty()),c.common.async)return Promise.all([...c.data].map((E,A)=>d.type._parseAsync(new IC(c,E,c.path,A)))).then(E=>u1.mergeArray(f,E));let v=[...c.data].map((E,A)=>d.type._parseSync(new IC(c,E,c.path,A)));return u1.mergeArray(f,v)}get element(){return this._def.type}min(s,c){return new a({...this._def,minLength:{value:s,message:Jo.toString(c)}})}max(s,c){return new a({...this._def,maxLength:{value:s,message:Jo.toString(c)}})}length(s,c){return new a({...this._def,exactLength:{value:s,message:Jo.toString(c)}})}nonempty(s){return this.min(1,s)}};w6.create=(a,s)=>new w6({type:a,minLength:null,maxLength:null,exactLength:null,typeName:kc.ZodArray,...xl(s)});function lU(a){if(a instanceof Kb){let s={};for(let c in a.shape){let f=a.shape[c];s[c]=NC.create(lU(f))}return new Kb({...a._def,shape:t(()=>s,"shape")})}else return a instanceof w6?new w6({...a._def,type:lU(a.element)}):a instanceof NC?NC.create(lU(a.unwrap())):a instanceof gk?gk.create(lU(a.unwrap())):a instanceof hk?hk.create(a.items.map(s=>lU(s))):a}t(lU,"deepPartialify");var Kb=class a extends Dl{static{t(this,"ZodObject")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let s=this._def.shape(),c=cf.objectKeys(s);return this._cached={shape:s,keys:c}}_parse(s){if(this._getType(s)!==Xa.object){let M=this._getOrReturnCtx(s);return Ba(M,{code:Rs.invalid_type,expected:Xa.object,received:M.parsedType}),Oc}let{status:f,ctx:d}=this._processInputParams(s),{shape:v,keys:E}=this._getCached(),A=[];if(!(this._def.catchall instanceof Wx&&this._def.unknownKeys==="strip"))for(let M in d.data)E.includes(M)||A.push(M);let O=[];for(let M of E){let W=v[M],$=d.data[M];O.push({key:{status:"valid",value:M},value:W._parse(new IC(d,$,d.path,M)),alwaysSet:M in d.data})}if(this._def.catchall instanceof Wx){let M=this._def.unknownKeys;if(M==="passthrough")for(let W of A)O.push({key:{status:"valid",value:W},value:{status:"valid",value:d.data[W]}});else if(M==="strict")A.length>0&&(Ba(d,{code:Rs.unrecognized_keys,keys:A}),f.dirty());else if(M!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let M=this._def.catchall;for(let W of A){let $=d.data[W];O.push({key:{status:"valid",value:W},value:M._parse(new IC(d,$,d.path,W)),alwaysSet:W in d.data})}}return d.common.async?Promise.resolve().then(async()=>{let M=[];for(let W of O){let $=await W.key,Y=await W.value;M.push({key:$,value:Y,alwaysSet:W.alwaysSet})}return M}).then(M=>u1.mergeObjectSync(f,M)):u1.mergeObjectSync(f,O)}get shape(){return this._def.shape()}strict(s){return Jo.errToObj,new a({...this._def,unknownKeys:"strict",...s!==void 0?{errorMap:t((c,f)=>{var d,v,E,A;let O=(E=(v=(d=this._def).errorMap)===null||v===void 0?void 0:v.call(d,c,f).message)!==null&&E!==void 0?E:f.defaultError;return c.code==="unrecognized_keys"?{message:(A=Jo.errToObj(s).message)!==null&&A!==void 0?A:O}:{message:O}},"errorMap")}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(s){return new a({...this._def,shape:t(()=>({...this._def.shape(),...s}),"shape")})}merge(s){return new a({unknownKeys:s._def.unknownKeys,catchall:s._def.catchall,shape:t(()=>({...this._def.shape(),...s._def.shape()}),"shape"),typeName:kc.ZodObject})}setKey(s,c){return this.augment({[s]:c})}catchall(s){return new a({...this._def,catchall:s})}pick(s){let c={};return cf.objectKeys(s).forEach(f=>{s[f]&&this.shape[f]&&(c[f]=this.shape[f])}),new a({...this._def,shape:t(()=>c,"shape")})}omit(s){let c={};return cf.objectKeys(this.shape).forEach(f=>{s[f]||(c[f]=this.shape[f])}),new a({...this._def,shape:t(()=>c,"shape")})}deepPartial(){return lU(this)}partial(s){let c={};return cf.objectKeys(this.shape).forEach(f=>{let d=this.shape[f];s&&!s[f]?c[f]=d:c[f]=d.optional()}),new a({...this._def,shape:t(()=>c,"shape")})}required(s){let c={};return cf.objectKeys(this.shape).forEach(f=>{if(s&&!s[f])c[f]=this.shape[f];else{let v=this.shape[f];for(;v instanceof NC;)v=v._def.innerType;c[f]=v}}),new a({...this._def,shape:t(()=>c,"shape")})}keyof(){return Ebt(cf.objectKeys(this.shape))}};Kb.create=(a,s)=>new Kb({shape:t(()=>a,"shape"),unknownKeys:"strip",catchall:Wx.create(),typeName:kc.ZodObject,...xl(s)});Kb.strictCreate=(a,s)=>new Kb({shape:t(()=>a,"shape"),unknownKeys:"strict",catchall:Wx.create(),typeName:kc.ZodObject,...xl(s)});Kb.lazycreate=(a,s)=>new Kb({shape:a,unknownKeys:"strip",catchall:Wx.create(),typeName:kc.ZodObject,...xl(s)});var O7=class extends Dl{static{t(this,"ZodUnion")}_parse(s){let{ctx:c}=this._processInputParams(s),f=this._def.options;function d(v){for(let A of v)if(A.result.status==="valid")return A.result;for(let A of v)if(A.result.status==="dirty")return c.common.issues.push(...A.ctx.common.issues),A.result;let E=v.map(A=>new OS(A.ctx.common.issues));return Ba(c,{code:Rs.invalid_union,unionErrors:E}),Oc}if(t(d,"handleResults"),c.common.async)return Promise.all(f.map(async v=>{let E={...c,common:{...c.common,issues:[]},parent:null};return{result:await v._parseAsync({data:c.data,path:c.path,parent:E}),ctx:E}})).then(d);{let v,E=[];for(let O of f){let M={...c,common:{...c.common,issues:[]},parent:null},W=O._parseSync({data:c.data,path:c.path,parent:M});if(W.status==="valid")return W;W.status==="dirty"&&!v&&(v={result:W,ctx:M}),M.common.issues.length&&E.push(M.common.issues)}if(v)return c.common.issues.push(...v.ctx.common.issues),v.result;let A=E.map(O=>new OS(O));return Ba(c,{code:Rs.invalid_union,unionErrors:A}),Oc}}get options(){return this._def.options}};O7.create=(a,s)=>new O7({options:a,typeName:kc.ZodUnion,...xl(s)});var A6=t(a=>a instanceof L7?A6(a.schema):a instanceof FS?A6(a.innerType()):a instanceof R7?[a.value]:a instanceof M7?a.options:a instanceof j7?cf.objectValues(a.enum):a instanceof B7?A6(a._def.innerType):a instanceof N7?[void 0]:a instanceof I7?[null]:a instanceof NC?[void 0,...A6(a.unwrap())]:a instanceof gk?[null,...A6(a.unwrap())]:a instanceof _Y||a instanceof $7?A6(a.unwrap()):a instanceof U7?A6(a._def.innerType):[],"getDiscriminator"),Gpe=class a extends Dl{static{t(this,"ZodDiscriminatedUnion")}_parse(s){let{ctx:c}=this._processInputParams(s);if(c.parsedType!==Xa.object)return Ba(c,{code:Rs.invalid_type,expected:Xa.object,received:c.parsedType}),Oc;let f=this.discriminator,d=c.data[f],v=this.optionsMap.get(d);return v?c.common.async?v._parseAsync({data:c.data,path:c.path,parent:c}):v._parseSync({data:c.data,path:c.path,parent:c}):(Ba(c,{code:Rs.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[f]}),Oc)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(s,c,f){let d=new Map;for(let v of c){let E=A6(v.shape[s]);if(!E.length)throw new Error(`A discriminator value for key \`${s}\` could not be extracted from all schema options`);for(let A of E){if(d.has(A))throw new Error(`Discriminator property ${String(s)} has duplicate value ${String(A)}`);d.set(A,v)}}return new a({typeName:kc.ZodDiscriminatedUnion,discriminator:s,options:c,optionsMap:d,...xl(f)})}};function k5e(a,s){let c=QN(a),f=QN(s);if(a===s)return{valid:!0,data:a};if(c===Xa.object&&f===Xa.object){let d=cf.objectKeys(s),v=cf.objectKeys(a).filter(A=>d.indexOf(A)!==-1),E={...a,...s};for(let A of v){let O=k5e(a[A],s[A]);if(!O.valid)return{valid:!1};E[A]=O.data}return{valid:!0,data:E}}else if(c===Xa.array&&f===Xa.array){if(a.length!==s.length)return{valid:!1};let d=[];for(let v=0;v<a.length;v++){let E=a[v],A=s[v],O=k5e(E,A);if(!O.valid)return{valid:!1};d.push(O.data)}return{valid:!0,data:d}}else return c===Xa.date&&f===Xa.date&&+a==+s?{valid:!0,data:a}:{valid:!1}}t(k5e,"mergeValues");var F7=class extends Dl{static{t(this,"ZodIntersection")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s),d=t((v,E)=>{if(D5e(v)||D5e(E))return Oc;let A=k5e(v.value,E.value);return A.valid?((A5e(v)||A5e(E))&&c.dirty(),{status:c.value,value:A.data}):(Ba(f,{code:Rs.invalid_intersection_types}),Oc)},"handleParsed");return f.common.async?Promise.all([this._def.left._parseAsync({data:f.data,path:f.path,parent:f}),this._def.right._parseAsync({data:f.data,path:f.path,parent:f})]).then(([v,E])=>d(v,E)):d(this._def.left._parseSync({data:f.data,path:f.path,parent:f}),this._def.right._parseSync({data:f.data,path:f.path,parent:f}))}};F7.create=(a,s,c)=>new F7({left:a,right:s,typeName:kc.ZodIntersection,...xl(c)});var hk=class a extends Dl{static{t(this,"ZodTuple")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Xa.array)return Ba(f,{code:Rs.invalid_type,expected:Xa.array,received:f.parsedType}),Oc;if(f.data.length<this._def.items.length)return Ba(f,{code:Rs.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Oc;!this._def.rest&&f.data.length>this._def.items.length&&(Ba(f,{code:Rs.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c.dirty());let v=[...f.data].map((E,A)=>{let O=this._def.items[A]||this._def.rest;return O?O._parse(new IC(f,E,f.path,A)):null}).filter(E=>!!E);return f.common.async?Promise.all(v).then(E=>u1.mergeArray(c,E)):u1.mergeArray(c,v)}get items(){return this._def.items}rest(s){return new a({...this._def,rest:s})}};hk.create=(a,s)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new hk({items:a,typeName:kc.ZodTuple,rest:null,...xl(s)})};var Qpe=class a extends Dl{static{t(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Xa.object)return Ba(f,{code:Rs.invalid_type,expected:Xa.object,received:f.parsedType}),Oc;let d=[],v=this._def.keyType,E=this._def.valueType;for(let A in f.data)d.push({key:v._parse(new IC(f,A,f.path,A)),value:E._parse(new IC(f,f.data[A],f.path,A)),alwaysSet:A in f.data});return f.common.async?u1.mergeObjectAsync(c,d):u1.mergeObjectSync(c,d)}get element(){return this._def.valueType}static create(s,c,f){return c instanceof Dl?new a({keyType:s,valueType:c,typeName:kc.ZodRecord,...xl(f)}):new a({keyType:KN.create(),valueType:s,typeName:kc.ZodRecord,...xl(c)})}},dU=class extends Dl{static{t(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Xa.map)return Ba(f,{code:Rs.invalid_type,expected:Xa.map,received:f.parsedType}),Oc;let d=this._def.keyType,v=this._def.valueType,E=[...f.data.entries()].map(([A,O],M)=>({key:d._parse(new IC(f,A,f.path,[M,"key"])),value:v._parse(new IC(f,O,f.path,[M,"value"]))}));if(f.common.async){let A=new Map;return Promise.resolve().then(async()=>{for(let O of E){let M=await O.key,W=await O.value;if(M.status==="aborted"||W.status==="aborted")return Oc;(M.status==="dirty"||W.status==="dirty")&&c.dirty(),A.set(M.value,W.value)}return{status:c.value,value:A}})}else{let A=new Map;for(let O of E){let M=O.key,W=O.value;if(M.status==="aborted"||W.status==="aborted")return Oc;(M.status==="dirty"||W.status==="dirty")&&c.dirty(),A.set(M.value,W.value)}return{status:c.value,value:A}}}};dU.create=(a,s,c)=>new dU({valueType:s,keyType:a,typeName:kc.ZodMap,...xl(c)});var mU=class a extends Dl{static{t(this,"ZodSet")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.parsedType!==Xa.set)return Ba(f,{code:Rs.invalid_type,expected:Xa.set,received:f.parsedType}),Oc;let d=this._def;d.minSize!==null&&f.data.size<d.minSize.value&&(Ba(f,{code:Rs.too_small,minimum:d.minSize.value,type:"set",inclusive:!0,exact:!1,message:d.minSize.message}),c.dirty()),d.maxSize!==null&&f.data.size>d.maxSize.value&&(Ba(f,{code:Rs.too_big,maximum:d.maxSize.value,type:"set",inclusive:!0,exact:!1,message:d.maxSize.message}),c.dirty());let v=this._def.valueType;function E(O){let M=new Set;for(let W of O){if(W.status==="aborted")return Oc;W.status==="dirty"&&c.dirty(),M.add(W.value)}return{status:c.value,value:M}}t(E,"finalizeSet");let A=[...f.data.values()].map((O,M)=>v._parse(new IC(f,O,f.path,M)));return f.common.async?Promise.all(A).then(O=>E(O)):E(A)}min(s,c){return new a({...this._def,minSize:{value:s,message:Jo.toString(c)}})}max(s,c){return new a({...this._def,maxSize:{value:s,message:Jo.toString(c)}})}size(s,c){return this.min(s,c).max(s,c)}nonempty(s){return this.min(1,s)}};mU.create=(a,s)=>new mU({valueType:a,minSize:null,maxSize:null,typeName:kc.ZodSet,...xl(s)});var Kpe=class a extends Dl{static{t(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(s){let{ctx:c}=this._processInputParams(s);if(c.parsedType!==Xa.function)return Ba(c,{code:Rs.invalid_type,expected:Xa.function,received:c.parsedType}),Oc;function f(A,O){return Wpe({data:A,path:c.path,errorMaps:[c.common.contextualErrorMap,c.schemaErrorMap,Vpe(),fU].filter(M=>!!M),issueData:{code:Rs.invalid_arguments,argumentsError:O}})}t(f,"makeArgsIssue");function d(A,O){return Wpe({data:A,path:c.path,errorMaps:[c.common.contextualErrorMap,c.schemaErrorMap,Vpe(),fU].filter(M=>!!M),issueData:{code:Rs.invalid_return_type,returnTypeError:O}})}t(d,"makeReturnsIssue");let v={errorMap:c.common.contextualErrorMap},E=c.data;if(this._def.returns instanceof XN){let A=this;return Nv(async function(...O){let M=new OS([]),W=await A._def.args.parseAsync(O,v).catch(Ne=>{throw M.addIssue(f(O,Ne)),M}),$=await Reflect.apply(E,this,W);return await A._def.returns._def.type.parseAsync($,v).catch(Ne=>{throw M.addIssue(d($,Ne)),M})})}else{let A=this;return Nv(function(...O){let M=A._def.args.safeParse(O,v);if(!M.success)throw new OS([f(O,M.error)]);let W=Reflect.apply(E,this,M.data),$=A._def.returns.safeParse(W,v);if(!$.success)throw new OS([d(W,$.error)]);return $.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...s){return new a({...this._def,args:hk.create(s).rest(k6.create())})}returns(s){return new a({...this._def,returns:s})}implement(s){return this.parse(s)}strictImplement(s){return this.parse(s)}static create(s,c,f){return new a({args:s||hk.create([]).rest(k6.create()),returns:c||k6.create(),typeName:kc.ZodFunction,...xl(f)})}},L7=class extends Dl{static{t(this,"ZodLazy")}get schema(){return this._def.getter()}_parse(s){let{ctx:c}=this._processInputParams(s);return this._def.getter()._parse({data:c.data,path:c.path,parent:c})}};L7.create=(a,s)=>new L7({getter:a,typeName:kc.ZodLazy,...xl(s)});var R7=class extends Dl{static{t(this,"ZodLiteral")}_parse(s){if(s.data!==this._def.value){let c=this._getOrReturnCtx(s);return Ba(c,{received:c.data,code:Rs.invalid_literal,expected:this._def.value}),Oc}return{status:"valid",value:s.data}}get value(){return this._def.value}};R7.create=(a,s)=>new R7({value:a,typeName:kc.ZodLiteral,...xl(s)});function Ebt(a,s){return new M7({values:a,typeName:kc.ZodEnum,...xl(s)})}t(Ebt,"createZodEnum");var M7=class a extends Dl{static{t(this,"ZodEnum")}constructor(){super(...arguments),cY.set(this,void 0)}_parse(s){if(typeof s.data!="string"){let c=this._getOrReturnCtx(s),f=this._def.values;return Ba(c,{expected:cf.joinValues(f),received:c.parsedType,code:Rs.invalid_type}),Oc}if(Hpe(this,cY,"f")||bbt(this,cY,new Set(this._def.values),"f"),!Hpe(this,cY,"f").has(s.data)){let c=this._getOrReturnCtx(s),f=this._def.values;return Ba(c,{received:c.data,code:Rs.invalid_enum_value,options:f}),Oc}return Nv(s.data)}get options(){return this._def.values}get enum(){let s={};for(let c of this._def.values)s[c]=c;return s}get Values(){let s={};for(let c of this._def.values)s[c]=c;return s}get Enum(){let s={};for(let c of this._def.values)s[c]=c;return s}extract(s,c=this._def){return a.create(s,{...this._def,...c})}exclude(s,c=this._def){return a.create(this.options.filter(f=>!s.includes(f)),{...this._def,...c})}};cY=new WeakMap;M7.create=Ebt;var j7=class extends Dl{static{t(this,"ZodNativeEnum")}constructor(){super(...arguments),lY.set(this,void 0)}_parse(s){let c=cf.getValidEnumValues(this._def.values),f=this._getOrReturnCtx(s);if(f.parsedType!==Xa.string&&f.parsedType!==Xa.number){let d=cf.objectValues(c);return Ba(f,{expected:cf.joinValues(d),received:f.parsedType,code:Rs.invalid_type}),Oc}if(Hpe(this,lY,"f")||bbt(this,lY,new Set(cf.getValidEnumValues(this._def.values)),"f"),!Hpe(this,lY,"f").has(s.data)){let d=cf.objectValues(c);return Ba(f,{received:f.data,code:Rs.invalid_enum_value,options:d}),Oc}return Nv(s.data)}get enum(){return this._def.values}};lY=new WeakMap;j7.create=(a,s)=>new j7({values:a,typeName:kc.ZodNativeEnum,...xl(s)});var XN=class extends Dl{static{t(this,"ZodPromise")}unwrap(){return this._def.type}_parse(s){let{ctx:c}=this._processInputParams(s);if(c.parsedType!==Xa.promise&&c.common.async===!1)return Ba(c,{code:Rs.invalid_type,expected:Xa.promise,received:c.parsedType}),Oc;let f=c.parsedType===Xa.promise?c.data:Promise.resolve(c.data);return Nv(f.then(d=>this._def.type.parseAsync(d,{path:c.path,errorMap:c.common.contextualErrorMap})))}};XN.create=(a,s)=>new XN({type:a,typeName:kc.ZodPromise,...xl(s)});var FS=class extends Dl{static{t(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===kc.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(s){let{status:c,ctx:f}=this._processInputParams(s),d=this._def.effect||null,v={addIssue:t(E=>{Ba(f,E),E.fatal?c.abort():c.dirty()},"addIssue"),get path(){return f.path}};if(v.addIssue=v.addIssue.bind(v),d.type==="preprocess"){let E=d.transform(f.data,v);if(f.common.async)return Promise.resolve(E).then(async A=>{if(c.value==="aborted")return Oc;let O=await this._def.schema._parseAsync({data:A,path:f.path,parent:f});return O.status==="aborted"?Oc:O.status==="dirty"||c.value==="dirty"?uU(O.value):O});{if(c.value==="aborted")return Oc;let A=this._def.schema._parseSync({data:E,path:f.path,parent:f});return A.status==="aborted"?Oc:A.status==="dirty"||c.value==="dirty"?uU(A.value):A}}if(d.type==="refinement"){let E=t(A=>{let O=d.refinement(A,v);if(f.common.async)return Promise.resolve(O);if(O instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return A},"executeRefinement");if(f.common.async===!1){let A=this._def.schema._parseSync({data:f.data,path:f.path,parent:f});return A.status==="aborted"?Oc:(A.status==="dirty"&&c.dirty(),E(A.value),{status:c.value,value:A.value})}else return this._def.schema._parseAsync({data:f.data,path:f.path,parent:f}).then(A=>A.status==="aborted"?Oc:(A.status==="dirty"&&c.dirty(),E(A.value).then(()=>({status:c.value,value:A.value}))))}if(d.type==="transform")if(f.common.async===!1){let E=this._def.schema._parseSync({data:f.data,path:f.path,parent:f});if(!uY(E))return E;let A=d.transform(E.value,v);if(A instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:c.value,value:A}}else return this._def.schema._parseAsync({data:f.data,path:f.path,parent:f}).then(E=>uY(E)?Promise.resolve(d.transform(E.value,v)).then(A=>({status:c.value,value:A})):E);cf.assertNever(d)}};FS.create=(a,s,c)=>new FS({schema:a,typeName:kc.ZodEffects,effect:s,...xl(c)});FS.createWithPreprocess=(a,s,c)=>new FS({schema:s,effect:{type:"preprocess",transform:a},typeName:kc.ZodEffects,...xl(c)});var NC=class extends Dl{static{t(this,"ZodOptional")}_parse(s){return this._getType(s)===Xa.undefined?Nv(void 0):this._def.innerType._parse(s)}unwrap(){return this._def.innerType}};NC.create=(a,s)=>new NC({innerType:a,typeName:kc.ZodOptional,...xl(s)});var gk=class extends Dl{static{t(this,"ZodNullable")}_parse(s){return this._getType(s)===Xa.null?Nv(null):this._def.innerType._parse(s)}unwrap(){return this._def.innerType}};gk.create=(a,s)=>new gk({innerType:a,typeName:kc.ZodNullable,...xl(s)});var B7=class extends Dl{static{t(this,"ZodDefault")}_parse(s){let{ctx:c}=this._processInputParams(s),f=c.data;return c.parsedType===Xa.undefined&&(f=this._def.defaultValue()),this._def.innerType._parse({data:f,path:c.path,parent:c})}removeDefault(){return this._def.innerType}};B7.create=(a,s)=>new B7({innerType:a,typeName:kc.ZodDefault,defaultValue:typeof s.default=="function"?s.default:()=>s.default,...xl(s)});var U7=class extends Dl{static{t(this,"ZodCatch")}_parse(s){let{ctx:c}=this._processInputParams(s),f={...c,common:{...c.common,issues:[]}},d=this._def.innerType._parse({data:f.data,path:f.path,parent:{...f}});return fY(d)?d.then(v=>({status:"valid",value:v.status==="valid"?v.value:this._def.catchValue({get error(){return new OS(f.common.issues)},input:f.data})})):{status:"valid",value:d.status==="valid"?d.value:this._def.catchValue({get error(){return new OS(f.common.issues)},input:f.data})}}removeCatch(){return this._def.innerType}};U7.create=(a,s)=>new U7({innerType:a,typeName:kc.ZodCatch,catchValue:typeof s.catch=="function"?s.catch:()=>s.catch,...xl(s)});var hU=class extends Dl{static{t(this,"ZodNaN")}_parse(s){if(this._getType(s)!==Xa.nan){let f=this._getOrReturnCtx(s);return Ba(f,{code:Rs.invalid_type,expected:Xa.nan,received:f.parsedType}),Oc}return{status:"valid",value:s.data}}};hU.create=a=>new hU({typeName:kc.ZodNaN,...xl(a)});var fCr=Symbol("zod_brand"),_Y=class extends Dl{static{t(this,"ZodBranded")}_parse(s){let{ctx:c}=this._processInputParams(s),f=c.data;return this._def.type._parse({data:f,path:c.path,parent:c})}unwrap(){return this._def.type}},pY=class a extends Dl{static{t(this,"ZodPipeline")}_parse(s){let{status:c,ctx:f}=this._processInputParams(s);if(f.common.async)return t(async()=>{let v=await this._def.in._parseAsync({data:f.data,path:f.path,parent:f});return v.status==="aborted"?Oc:v.status==="dirty"?(c.dirty(),uU(v.value)):this._def.out._parseAsync({data:v.value,path:f.path,parent:f})},"handleAsync")();{let d=this._def.in._parseSync({data:f.data,path:f.path,parent:f});return d.status==="aborted"?Oc:d.status==="dirty"?(c.dirty(),{status:"dirty",value:d.value}):this._def.out._parseSync({data:d.value,path:f.path,parent:f})}}static create(s,c){return new a({in:s,out:c,typeName:kc.ZodPipeline})}},$7=class extends Dl{static{t(this,"ZodReadonly")}_parse(s){let c=this._def.innerType._parse(s),f=t(d=>(uY(d)&&(d.value=Object.freeze(d.value)),d),"freeze");return fY(c)?c.then(d=>f(d)):f(c)}unwrap(){return this._def.innerType}};$7.create=(a,s)=>new $7({innerType:a,typeName:kc.ZodReadonly,...xl(s)});function xbt(a,s={},c){return a?YN.create().superRefine((f,d)=>{var v,E;if(!a(f)){let A=typeof s=="function"?s(f):typeof s=="string"?{message:s}:s,O=(E=(v=A.fatal)!==null&&v!==void 0?v:c)!==null&&E!==void 0?E:!0,M=typeof A=="string"?{message:A}:A;d.addIssue({code:"custom",...M,fatal:O})}}):YN.create()}t(xbt,"custom");var _Cr={object:Kb.lazycreate},kc;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(kc||(kc={}));var pCr=t((a,s={message:`Input not instance of ${a.name}`})=>xbt(c=>c instanceof a,s),"instanceOfType"),Dbt=KN.create,Abt=A7.create,dCr=hU.create,mCr=k7.create,kbt=w7.create,hCr=P7.create,gCr=_U.create,yCr=N7.create,vCr=I7.create,bCr=YN.create,SCr=k6.create,TCr=Wx.create,CCr=pU.create,ECr=w6.create,xCr=Kb.create,DCr=Kb.strictCreate,ACr=O7.create,kCr=Gpe.create,wCr=F7.create,PCr=hk.create,NCr=Qpe.create,ICr=dU.create,OCr=mU.create,FCr=Kpe.create,LCr=L7.create,RCr=R7.create,MCr=M7.create,jCr=j7.create,BCr=XN.create,ybt=FS.create,UCr=NC.create,$Cr=gk.create,JCr=FS.createWithPreprocess,qCr=pY.create,zCr=t(()=>Dbt().optional(),"ostring"),VCr=t(()=>Abt().optional(),"onumber"),WCr=t(()=>kbt().optional(),"oboolean"),HCr={string:t(a=>KN.create({...a,coerce:!0}),"string"),number:t(a=>A7.create({...a,coerce:!0}),"number"),boolean:t(a=>w7.create({...a,coerce:!0}),"boolean"),bigint:t(a=>k7.create({...a,coerce:!0}),"bigint"),date:t(a=>P7.create({...a,coerce:!0}),"date")},GCr=Oc,Vr=Object.freeze({__proto__:null,defaultErrorMap:fU,setErrorMap:GTr,getErrorMap:Vpe,makeIssue:Wpe,EMPTY_PATH:QTr,addIssueToContext:Ba,ParseStatus:u1,INVALID:Oc,DIRTY:uU,OK:Nv,isAborted:D5e,isDirty:A5e,isValid:uY,isAsync:fY,get util(){return cf},get objectUtil(){return x5e},ZodParsedType:Xa,getParsedType:QN,ZodType:Dl,datetimeRegex:Cbt,ZodString:KN,ZodNumber:A7,ZodBigInt:k7,ZodBoolean:w7,ZodDate:P7,ZodSymbol:_U,ZodUndefined:N7,ZodNull:I7,ZodAny:YN,ZodUnknown:k6,ZodNever:Wx,ZodVoid:pU,ZodArray:w6,ZodObject:Kb,ZodUnion:O7,ZodDiscriminatedUnion:Gpe,ZodIntersection:F7,ZodTuple:hk,ZodRecord:Qpe,ZodMap:dU,ZodSet:mU,ZodFunction:Kpe,ZodLazy:L7,ZodLiteral:R7,ZodEnum:M7,ZodNativeEnum:j7,ZodPromise:XN,ZodEffects:FS,ZodTransformer:FS,ZodOptional:NC,ZodNullable:gk,ZodDefault:B7,ZodCatch:U7,ZodNaN:hU,BRAND:fCr,ZodBranded:_Y,ZodPipeline:pY,ZodReadonly:$7,custom:xbt,Schema:Dl,ZodSchema:Dl,late:_Cr,get ZodFirstPartyTypeKind(){return kc},coerce:HCr,any:bCr,array:ECr,bigint:mCr,boolean:kbt,date:hCr,discriminatedUnion:kCr,effect:ybt,enum:MCr,function:FCr,instanceof:pCr,intersection:wCr,lazy:LCr,literal:RCr,map:ICr,nan:dCr,nativeEnum:jCr,never:TCr,null:vCr,nullable:$Cr,number:Abt,object:xCr,oboolean:WCr,onumber:VCr,optional:UCr,ostring:zCr,pipeline:qCr,preprocess:JCr,promise:BCr,record:NCr,set:OCr,strictObject:DCr,string:Dbt,symbol:gCr,transformer:ybt,tuple:PCr,undefined:yCr,union:ACr,unknown:SCr,void:CCr,NEVER:GCr,ZodIssueCode:Rs,quotelessJson:HTr,ZodError:OS});var Lbt=Vr.object({label:Vr.string(),color:Vr.enum(["green","blue","yellow","red","purple","indigo","gray"]),placement:Vr.enum(["start","end"]).optional()}),KCr=Vr.object({type:Vr.literal("doc"),id:Vr.string(),label:Vr.string().optional()}),YCr=Vr.union([KCr,Vr.string()]),XCr=Vr.object({type:Vr.literal("doc"),id:Vr.string(),icon:Vr.custom().optional(),label:Vr.string().optional(),badge:Lbt.optional()}),ZCr=Vr.union([XCr,Vr.string()]),eEr=Vr.object({type:Vr.literal("link"),label:Vr.string(),href:Vr.string(),description:Vr.string().optional(),badge:Lbt.optional()}),tEr=Vr.object({type:Vr.literal("category"),icon:Vr.custom().optional(),label:Vr.string(),description:Vr.string().optional(),collapsible:Vr.boolean().optional(),collapsed:Vr.boolean().optional(),link:YCr.optional()}),Rbt=Vr.lazy(()=>Vr.union([ZCr,eEr,rEr])),rEr=tEr.extend({items:Rbt.array()}),nEr=Rbt.array(),w5e=Vr.object({}).passthrough(),Pbt=Vr.object({background:Vr.string(),foreground:Vr.string(),card:Vr.string(),cardForeground:Vr.string(),popover:Vr.string(),popoverForeground:Vr.string(),primary:Vr.string(),primaryForeground:Vr.string(),secondary:Vr.string(),secondaryForeground:Vr.string(),muted:Vr.string(),mutedForeground:Vr.string(),accent:Vr.string(),accentForeground:Vr.string(),destructive:Vr.string(),destructiveForeground:Vr.string(),border:Vr.string(),input:Vr.string(),ring:Vr.string(),radius:Vr.string()}).partial(),iEr=Vr.object({label:Vr.string(),tags:Vr.array(Vr.string())}),P5e=Vr.object({id:Vr.string().optional(),server:Vr.string().optional(),navigationId:Vr.string().optional(),categories:Vr.array(iEr).optional()}),sEr=Vr.function().args(w5e).returns(Vr.union([w5e,Vr.promise(w5e)])),Nbt=Vr.union([Vr.object({type:Vr.literal("url"),input:Vr.string()}).merge(P5e),Vr.object({type:Vr.literal("file"),input:Vr.string()}).merge(P5e).merge(Vr.object({postProcessors:sEr.array().optional()})),Vr.object({type:Vr.literal("raw"),input:Vr.string()}).merge(P5e)]),aEr=Vr.union([Vr.object({enabled:Vr.boolean(),endpoint:Vr.string()}),Vr.object({enabled:Vr.boolean(),getKeys:Vr.custom(a=>typeof a=="function"),rollKey:Vr.custom(a=>typeof a=="function").optional(),deleteKey:Vr.custom(a=>typeof a=="function").optional(),updateKeyDescription:Vr.custom(a=>typeof a=="function").optional(),createKey:Vr.custom(a=>typeof a=="function").optional()})]),oEr=Vr.object({src:Vr.object({light:Vr.string(),dark:Vr.string()}),alt:Vr.string().optional(),width:Vr.string().optional()}),cEr=Vr.object({siteUrl:Vr.string(),changefreq:Vr.optional(Vr.enum(["always","hourly","daily","weekly","monthly","yearly","never"])),priority:Vr.optional(Vr.number()),outDir:Vr.string().optional(),autoLastmod:Vr.boolean().optional(),exclude:Vr.union([Vr.function().returns(Vr.promise(Vr.array(Vr.string()))),Vr.array(Vr.string())]).optional()}).optional(),Ibt=Vr.object({files:Vr.string(),defaultOptions:Vr.object({toc:Vr.boolean(),disablePager:Vr.boolean()}).partial().optional()}),lEr=Vr.object({label:Vr.string(),id:Vr.string(),default:Vr.string().optional(),display:Vr.enum(["auth","anon","always"]).default("always").optional()}),uEr=Vr.object({from:Vr.string(),to:Vr.string()}),fEr=Vr.object({type:Vr.literal("inkeep"),apiKey:Vr.string(),integrationId:Vr.string(),organizationId:Vr.string(),primaryBrandColor:Vr.string(),organizationDisplayName:Vr.string()}).optional(),_Er=Vr.union([Vr.object({type:Vr.literal("clerk"),clerkPubKey:Vr.custom(a=>typeof a=="string"?/^pk_(test|live)_\w+$/.test(a):!1),redirectToAfterSignUp:Vr.string().optional(),redirectToAfterSignIn:Vr.string().optional(),redirectToAfterSignOut:Vr.string().optional()}),Vr.object({type:Vr.literal("openid"),clientId:Vr.string(),issuer:Vr.string(),audience:Vr.string().optional(),scopes:Vr.array(Vr.string()).optional(),redirectToAfterSignUp:Vr.string().optional(),redirectToAfterSignIn:Vr.string().optional(),redirectToAfterSignOut:Vr.string().optional()}),Vr.object({type:Vr.literal("auth0"),clientId:Vr.string(),domain:Vr.string(),audience:Vr.string().optional(),redirectToAfterSignUp:Vr.string().optional(),redirectToAfterSignIn:Vr.string().optional(),redirectToAfterSignOut:Vr.string().optional()})]),pEr=Vr.object({title:Vr.string(),description:Vr.string(),logo:Vr.string(),favicon:Vr.string(),generator:Vr.string(),applicationName:Vr.string(),referrer:Vr.string(),keywords:Vr.array(Vr.string()),authors:Vr.array(Vr.string()),creator:Vr.string(),publisher:Vr.string()}).partial(),Obt=Vr.object({url:Vr.string(),fontFamily:Vr.string()}),dEr=Vr.object({sans:Obt.optional(),mono:Obt.optional()}),mEr=Vr.object({pageTitle:Vr.string(),logoUrl:Vr.string(),logo:oEr,banner:Vr.object({message:Vr.custom(),color:Vr.enum(["note","tip","info","caution","danger"]).or(Vr.string()).optional(),dismissible:Vr.boolean().optional()})}).partial(),Fbt=Vr.object({navigationId:Vr.string(),label:Vr.string(),items:Vr.array(Vr.string()).optional()}),Mbt=Vr.object({basePath:Vr.string().optional(),page:mEr,topNavigation:Vr.array(lEr),sidebar:Vr.record(nEr),theme:Vr.object({light:Pbt,dark:Pbt,fonts:dEr}).partial(),metadata:pEr,authentication:_Er,search:fEr,docs:Vr.union([Ibt,Vr.array(Ibt)]),apis:Vr.union([Nbt,Vr.array(Nbt)]),catalog:Vr.union([Fbt,Vr.array(Fbt)]),apiKeys:aEr,redirects:Vr.array(uEr),sitemap:cEr}),jbt=t((a,s)=>{if(!a.sidebar||!a.topNavigation)return;let c=a.topNavigation.map(d=>d.id),f=Object.keys(a.sidebar).filter(d=>!c.includes(d));f.length>0&&s.addIssue({code:Vr.ZodIssueCode.custom,message:`Sidebar ID [${f.map(d=>`"${d}"`).join(", ")}] not found in top navigation.
|
|
636
636
|
Following IDs are available: ${c.join(", ")}`})},"refine"),hEr=Mbt.partial(),pHr=hEr.superRefine(jbt);var gEr=Vr.object({UNSAFE_slotlets:Vr.record(Vr.string(),Vr.custom()),mdx:Vr.object({components:Vr.custom()}).partial(),customPages:Vr.array(Vr.object({path:Vr.string(),element:Vr.custom().optional(),render:Vr.custom().optional(),prose:Vr.boolean().optional()})),plugins:Vr.array(Vr.custom()),build:Vr.custom()}),mHr=Mbt.merge(gEr).partial().superRefine(jbt);var yEr=["zudoku.config.js","zudoku.config.jsx","zudoku.config.ts","zudoku.config.tsx","zudoku.config.mjs"],vEr="dev-portal.json",N5e=t(a=>QCr(a).then(()=>!0).catch(()=>!1),"fileExists"),P6,ZN;async function Bbt(a){if(P6&&ZN&&await N5e(P6))return{configPath:P6,configType:ZN};let s=wbt.join(a,vEr);if(await N5e(s))return P6=s,ZN="dev-portal",{configPath:P6,configType:ZN};for(let c of yEr){let f=wbt.join(a,c);if(await N5e(f))return P6=f,ZN="zudoku",{configPath:P6,configType:ZN}}return P6=void 0,ZN=void 0,{configPath:P6,configType:ZN}}t(Bbt,"findConfigFilePath");import{readFile as bEr}from"fs/promises";import I5e from"path";async function O5e(a){let s=`${a}/config/dev-portal.json`,c=!0,f;if(await Bu.fileExists(s)){try{let v=await bEr(s,"utf-8"),E=JSON.parse(v);E.enabled===!1&&(c=!1),f=E.sitePathname}catch{}return{enabled:c,type:"dev-portal",basePath:f}}return(await Bbt(I5e.join(a,"docs")))?.configType?{enabled:!0,type:"zudoku"}:{enabled:!1,type:void 0}}t(O5e,"getDevPortalConfig");function gU(a,s){let c=I5e.relative(process.cwd(),I5e.join(a,VF));return Object.keys(s?.outputs??{}).map(d=>`.${d.replace(c,"")}`)}t(gU,"getBuildModules");var Ubt="/docs",TEr="/__zuplo/dev-portal";function CEr(a){let s=a.trim().toLowerCase();return s.endsWith("/")&&(s=s.slice(0,-1)),s}t(CEr,"normalizePathname");function EEr(a){let s={sitePathname:a?.sitePathname===TEr?Ubt:a?.sitePathname?CEr(a.sitePathname):Ubt,enabled:a?a.enabled??!0:!1,version:a?.version??"legacy"};return`const devPortal = ${JSON.stringify(s)};
|
|
637
637
|
export default devPortal;`}t(EEr,"generateSource");function $bt(a){return{name:"dev-portal-config",setup(s){s.onResolve({filter:/dev-portal.json$/},c=>({namespace:"dev-portal-json",path:Ype.isAbsolute(c.path)?c.path:Ype.join(c.resolveDir,c.path),pluginName:"dev-portal"})),s.onLoad({filter:/.*/,namespace:"dev-portal-json"},async c=>of.timeFn("Generating dev-portal.json data",async()=>{let f,d,v=[],E=await O5e(a.sourceDirectory);if(E.type==="zudoku")f={version:"zudoku",enabled:!1,sitePathname:void 0};else if(E.type==="dev-portal"){d=await SEr.readFile(c.path,"utf-8");try{f=JSON.parse(d)}catch(O){v.push({id:"dev-portal-build-error",text:"Could not parse dev-portal.json. Ensure that the file is valid JSON.",location:{file:"config/dev-portal.json",namespace:"",line:1,column:0,length:0,lineText:"",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:O.message,location:null}]})}}let A;try{if(A=EEr(f),_h.DEBUG_BUILD_MODE&&A){let O=Ype.join(a.sourceDirectory,".zuplo","dev-portal.js");await pk(O,A)}}catch(O){v.push({id:"dev-portal-build-error",text:O.message,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:O.message,location:null}]})}return{contents:A,errors:v,pluginName:"dev-portal",loader:"js",resolveDir:Ype.dirname(c.path),watchFiles:[c.path]}}))}}}t($bt,"devPortalConfigPlugin");import Jbt from"path";var qbt="legacy-environment",zbt="legacy-environment",xEr=`import { environment } from "@zuplo/runtime";
|
|
638
|
-
export default environment;`;function Vbt(a){return{name:"environment",setup(s){s.onResolve({filter:/@app\/environment$/},()=>({namespace:zbt,pluginName:qbt,path:Jbt.join(a.sourceDirectory,vN,"environment.js")})),s.onLoad({filter:/.*/,namespace:zbt},async c=>({contents:xEr,loader:"ts",resolveDir:Jbt.dirname(c.path),pluginName:qbt}))}}}t(Vbt,"environmentPlugin");var rCt=H_(TLe(),1),nCt=H_(ETt(),1),iCt=H_(HLe(),1),sCt=H_(GLe(),1);import x6r from"fs/promises";import LS from"path";var Ek="schemas",Ode="json-schema";function aCt(a){return{name:Ek,async setup(s){let c=new iCt.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0}),f=LS.join(a.sourceDirectory,lQ),d=[],v=[],E;await of.timeFn("Initializing schema validation",async()=>{if((0,nCt.default)(c,{mode:"fast"}),c.opts.code.formats=rCt._`require("ajv-formats/dist/formats").fastFormats`,await Bu.dirExists(f)&&(c.addKeyword("faker"),E=await Bu.listFolderContents(f,lQ),await Promise.all(E.map(async A=>{try{let O=Bu.safePath(a.sourceDirectory).resolve(f,A);if(!O.startsWith(f))throw new Error("All schemas must be in the schemas directory");let M=await x6r.readFile(O,"utf-8");if(M===""||M===void 0)throw new Error(`Schema 'schemas/${A}' is empty and will be ignored.`);let W=JSON.parse(M);if(W.$schema&&W.$schema!=="https://json-schema.org/draft/2020-12/schema")throw new Error(`Error in ${A}: All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html`);if(c.addSchema(W,A),c.errors?.length){let $=c.errors[0];d.push({id:"json-schema-validation-error",pluginName:Ek,text:`Error: ${$.message}`,location:{file:LS.join(lQ,A)},detail:{params:$.params,propertyName:$.propertyName,schemaPath:$.schemaPath,data:$.data}})}}catch(O){if(O.message.endsWith("is empty and will be ignored.")){v.push({id:"empty-json-schema-file",pluginName:Ek,text:`Schema 'schemas/${A}' is empty and will be ignored.`,location:{file:`schemas/${A}`,suggestion:"Add schema details or remove the file from the project."},detail:"EmptyJSONSchemaFile",notes:[{text:`Schema 'schemas/${A}' is empty and will be ignored.`,location:{file:`schemas/${A}`,suggestion:"Add schema details or remove the file from the project."}}]});return}let M=await x7e(A,a.sourceDirectory,O.message);d.push({id:"json-schema-add-error",pluginName:Ek,text:`Error: ${O.message}`,location:M,detail:"InvalidAddSchemaError",notes:[{text:O.message}]})}})),await Promise.all(E.map(async A=>{try{let O=c.getSchema(A);O&&c.compile(O.schema).errors?.forEach(W=>{d.push({text:`Failed to compile ${A}: ${W.message}`})})}catch(O){let M=await x7e(A,a.sourceDirectory,O.message);d.push({id:"json-schema-compile-error",pluginName:Ek,text:`The schema file '${A}' is not valid. Error: ${O.message}`,location:M,detail:"InvalidSchemaError",notes:[{text:O.message}]})}})),_h.DEBUG_BUILD_MODE)){let A=LS.resolve(a.outputDirectory,lQ);await Bu.mkdirIfNotExists(A)}}),s.onStart(async()=>{if(E)return{errors:d,warnings:v}}),s.onResolve({filter:/schemas\/.*\.json$/},async A=>of.timeFn("Generating JSON schemas...",async()=>{let O=LS.isAbsolute(A.path)?A.path:LS.join(A.resolveDir,A.path);if(A.importer&&A.importer!==LS.join(a.sourceDirectory,"config/routes.json"))return{path:O};if(!await Bu.fileExists(O)){let M="policies.json";return{errors:[{id:"json-schema-build-error",text:`Unable to resolve reference to '${A.path}' from ${M}`,location:{file:LS.join(A.resolveDir,M),namespace:Ode,line:1,column:0,length:0,lineText:`Invalid JSON schema reference in ${M}`,suggestion:""},detail:"RouteReferenceError",pluginName:Ek,notes:[{text:`Unable to resolve reference to '${A.path}' from ${M}`,location:null}]}],namespace:Ode,path:O,pluginName:Ek}}return{path:O,namespace:Ode,pluginName:Ek}})),s.onLoad({filter:/.*/,namespace:Ode},async A=>of.timeFn(`Generating json schema data: ${LS.basename(A.path)}`,async()=>{let O=[],M;try{let W=LS.relative(f,A.path),$=c.getSchema(W);if(!$)throw new Error(`Could not load schema at ${A.path}`);M=$.source?.validateCode;let Y=c.compile($.schema);M=(0,sCt.default)(c,Y)}catch(W){O.push({pluginName:Ek,text:`Cannot parse project's schemas/${LS.basename(A.path)} file. Error: ${W.message}`,location:null,notes:[{text:W.message,location:null}],detail:W})}if(_h.DEBUG_BUILD_MODE&&M){let W=LS.relative(f,A.path),$=LS.join(a.sourceDirectory,".zuplo",`${W}.js`);await pk($,M)}return{contents:M,errors:O,pluginName:Ek,resolveDir:LS.dirname(A.path),watchFiles:[A.path]}}))}}}t(aCt,"jsonSchemaPlugin");import{relative as D6r}from"path";var oCt=["node:assert","node:async_hooks","node:buffer","node:crypto","node:diagnostics_channel","node:events","node:path","node:process","node:stream","node:string_decoder","node:util"],A6r="nodejs-compat-plugin";function cCt({sourceDirectory:a}){return{name:A6r,setup(s){let c=new Set;s.onStart(()=>{c.clear()}),s.onResolve({filter:/node:.*/},async({path:f,kind:d,resolveDir:v,...E})=>{let A=`${f}:${d}:${v}:${E.importer}`;if(c.has(A))return;c.add(A);let O=await s.resolve(f,{kind:d,resolveDir:v,importer:E.importer});return O.errors.length>0?oCt.includes(f)||f.includes("/")&&oCt.includes(f.split("/")[0])?{external:!0}:{external:!0,warnings:O.errors.map(W=>({...W,location:{file:D6r(a,E.importer),line:0,column:0,namespace:"",length:0,lineText:"",suggestion:"Remove the imported node module"},detail:`The package "${f}" wasn't found on the file system but is built into node. If this code is executed it will fail.`}))}:O})}}}t(cCt,"nodejsCompatPlugin");import lCt from"fs/promises";import Zx from"path";var BU="open-api-routes-plugin",Fde="open-api-routes-json";function uCt(a){return{name:"open-api-routes-plugin",setup(s){s.onResolve({filter:/routes.json$/},c=>({watchFiles:[...QLe(Zx.join(a.sourceDirectory,qb),[".oas.json"],!0),Zx.join(a.sourceDirectory,qb,Jue)],namespace:Fde,path:Zx.isAbsolute(c.path)?c.path:Zx.join(c.resolveDir,c.path),pluginName:BU})),s.onResolve({filter:/^\.\.\/modules\/.*/,namespace:Fde},async c=>of.timeFn("Generating route data...",async()=>{let f=Zx.join(c.resolveDir,`${c.path}.ts`);if(!await Bu.fileExists(f)){let d=`$import(.${c.path.replace(/^../,"")})`,v=Zx.resolve(a.sourceDirectory,"config"),E=await KF(v),A=await xft(E,d,"Update your route configuration to use code from the 'modules' folder");return{errors:[{id:"route-build-error",text:`Invalid handler reference in routes.json. Unable to resolve reference to '${d}' from routes.json`,location:A,detail:"RouteReferenceError",pluginName:BU}],namespace:Fde,path:c.path,pluginName:BU}}})),s.onLoad({filter:/.*/,namespace:Fde},async c=>of.timeFn("Generating route.json data",async()=>{let f=Zx.resolve(a.sourceDirectory,"config"),d=await KF(f),v=await Promise.all(d.map(async M=>({content:await lCt.readFile(M,"utf-8"),fileName:M}))),E=Zx.resolve(f,"policies.json");if(!await Bu.fileExists(E))return{errors:[{text:"The project must include a policies file ('/config/policies.json')",detail:"OASPoliciesFileMissing",pluginName:BU,location:{line:0,column:0,file:"/config/policies.json"}}],pluginName:BU};let A={content:await lCt.readFile(E,"utf-8"),fileName:E},O;try{O=await S7e({sourceDirectory:a.sourceDirectory,oasContent:v,policiesContent:A})}catch(M){throw new Error("Error compiling routes: "+M.message)}if(_h.DEBUG_BUILD_MODE&&O.content){let M=Zx.join(a.sourceDirectory,".zuplo"),W=Zx.resolve(M,"routes.js");await pk(W,O.content)}return{contents:O.content,errors:O.errors,pluginName:BU,resolveDir:Zx.dirname(c.path),watchFiles:[c.path]}}))}}}t(uCt,"openApiRoutesPlugin");import Lde from"path";var WY="raw-route-plugin",fCt="raw-route";function _Ct(a){return{name:"raw-route-plugin",setup(s){s.onResolve({filter:/raw.json$/},c=>({namespace:fCt,path:c.path,pluginName:WY})),s.onLoad({filter:/.*/,namespace:fCt},async c=>of.timeFn("Building route data",async()=>{let f=Lde.resolve(a.sourceDirectory,qb);if(!await Bu.dirExists(f))return{loader:"js",resolveDir:Lde.dirname(c.path),pluginName:WY};let d=await KF(f);try{let v=await E7e({oasFiles:d,sourceDirectory:a.sourceDirectory,logger:a.logger});if(_h.DEBUG_BUILD_MODE&&v){let E=Lde.join(a.sourceDirectory,".zuplo","raw-routes.js");await pk(E,v)}return{contents:v,loader:"js",resolveDir:Lde.dirname(c.path),pluginName:WY}}catch(v){if(v instanceof Tv)return{contents:"",loader:"ts",errors:[{id:"route-build-error",text:v.issue.text,location:v.issue.location,detail:v.issue.detail,pluginName:WY}],pluginName:WY};throw v}}))}}}t(_Ct,"rawRoutePlugin");import k6r from"fs/promises";import KLe from"path";var Rde="runtime-config",pCt="runtime-config-plugin";function dCt(){return{name:Rde,setup(a){a.onResolve({filter:/^\.\.\/modules\/zuplo.runtime.ts$/},s=>({namespace:pCt,path:KLe.isAbsolute(s.path)?s.path:KLe.join(s.resolveDir,s.path),pluginName:Rde})),a.onLoad({filter:/.*/,namespace:pCt},async s=>of.timeFn("Generating zuplo.runtime.ts data",async()=>{let c="export const runtimeInit = undefined;",f=[];return await Bu.fileExists(s.path)?(c=await k6r.readFile(s.path,"utf-8"),{contents:c,loader:"ts",resolveDir:KLe.dirname(s.path),errors:f,pluginName:Rde,watchFiles:[s.path]}):{contents:c,loader:"ts",errors:f,pluginName:Rde}}))}}}t(dCt,"runtimeConfigPlugin");var hCt=H_(HLe(),1),gCt=H_(GLe(),1);import ZLe from"fs/promises";import Z7 from"path";var YLe="schema-validation-plugin",mCt="schema-validation",w6r="module.exports = {}";function yCt(a){return{name:"schema-validation-plugin",setup(s){s.onResolve({filter:/ajv-schema.json$/},c=>({namespace:mCt,path:c.path,pluginName:YLe})),s.onLoad({filter:/.*/,namespace:mCt},async c=>of.timeFn("Validating schemas",async()=>{let f=Z7.resolve(a.sourceDirectory,qb,"policies.json");if(!await Bu.fileExists(f))return{contents:w6r,loader:"js",resolveDir:Z7.dirname(c.path),pluginName:YLe};let d=await N6r(a.sourceDirectory),v=Z7.resolve(a.sourceDirectory,qb),E=await KF(v),A=await L6r(E,d),O=await P6r({oasFiles:E,routesWithSchemaValidation:A,sourceDirectory:a.sourceDirectory,logger:a.logger});if(_h.DEBUG_BUILD_MODE&&O){let M=Z7.join(a.sourceDirectory,".zuplo","schema-validation.js");await pk(M,O)}return{contents:O,loader:"js",resolveDir:Z7.dirname(c.path),pluginName:YLe}}))}}}t(yCt,"schemaValidationPlugin");async function P6r({oasFiles:a,routesWithSchemaValidation:s,sourceDirectory:c,logger:f}){let d="",v=new IN(c,f);if(s.length===0)return d;let E=new hCt.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0});for(let A of a){let O=await ZLe.readFile(A,"utf-8"),M=Z7.basename(A,".oas.json"),W=s.filter(Se=>Se.fileName===M),$=await v.resolve(A),Y=JSON.parse(O),Ne=[],De=new Map;W.forEach(Se=>{let Ct=Y.paths[Se.path][Se.method];if(Ct.requestBody){let Tt;if(Ct.requestBody.$ref){let br=Ct.requestBody.$ref;Tt=$.get(br)?.content}else Ct.requestBody.content&&(Tt=Ct.requestBody.content);if(Tt)for(let br in Tt){let Cr=Tt[br].schema,Lr=i8e(Se.path,Se.method,br);Cr.$id=Lr,E.addSchema(Cr),XLe(Cr,A,M,E,$,Ne,De)}}if(Ct.parameters)for(let Tt of Ct.parameters){let br=Tt.$ref?$.get(Tt.$ref):Tt,Cr=br.schema.$ref?$.get(br.schema.$ref):br.schema,Lr=n8e(Se.path,Se.method,br.in,br.name);Cr.$id=Lr,E.addSchema(Cr),XLe(br,A,M,E,$,Ne,De)}});for(let Se of Ne){let Ct=$.get(Se),Tt=XQ(M,Se);E.addSchema(Ct,Tt)}}return d=(0,gCt.default)(E),d}t(P6r,"schemaValidationSource");function XLe(a,s,c,f,d,v,E){for(let A in a){let O=a[A];if(A==="$ref"){let M=XQ(c,CN(s,O));a[A]=M,OQ(s,c,CN(s,O),d,v,E,(W,$)=>XQ(W,CN(s,$)))}else typeof O=="object"&&XLe(O,s,c,f,d,v,E)}}t(XLe,"addRefsToSchema");async function N6r(a){let s=new Set(["RequestValidationInboundPolicy"]),c=await ZLe.readFile(`${a}/config/policies.json`,"utf-8"),f=JSON.parse(c);return I6r(f,s)}t(N6r,"getPolicyNamesUsingSchemaValidationPolicies");function I6r(a,s){let c=new Set;a.policies?.forEach(d=>{d.handler?.export&&s.has(d.handler.export)&&d.handler.module==="$import(@zuplo/runtime)"&&c.add(d.name)});let f=O6r(a,c);return new Set([...c,...f])}t(I6r,"getPolicyNamesReferencingPolicyHandlers");function O6r(a,s){let c=new Set;return a.policies?.forEach(f=>{f.handler?.export==="CompositeInboundPolicy"&&f.handler?.options?.policies?.forEach(d=>{s.has(d)&&c.add(f.name)})}),c}t(O6r,"getCompositePoliciesContainingPolicy");function F6r(a,s){if(!a["x-zuplo-route"]||!a["x-zuplo-route"].policies)return!1;let c=a["x-zuplo-route"].policies.inbound;if(c){for(let d of c)if(s.has(d))return!0}let f=a["x-zuplo-route"].policies.outbound;if(f){for(let d of f)if(s.has(d))return!0}return!1}t(F6r,"isPolicyPresentInOperation");async function L6r(a,s){let c=[];for(let f of a){let d=await ZLe.readFile(f,"utf-8"),E=JSON.parse(d).paths;for(let A in E){let O=E[A];for(let M in O){let W=O[M];F6r(W,s)&&c.push({fileName:Z7.basename(f,".oas.json"),path:A,method:M})}}}return c}t(L6r,"getRoutesContainingPolicies");import{mkdirSync as R6r,writeFileSync as M6r}from"fs";import j6r from"path";function vCt(a){return{name:"write-modules-plugin",setup(s){s.onEnd(async c=>{if(c){let f=gU(a.sourceDirectory,c.metafile);R6r(a.outputDirectory,{recursive:!0}),M6r(j6r.join(a.outputDirectory,"modules.json"),JSON.stringify(f,null,2))}})}}}t(vCt,"writeModulesPlugin");var B6r=o1t("zuplo:core:build"),U6r=["workerd","worker","browser"],TCt=[...process.env.GLOBAL_MODULE_LOCATION?[process.env.GLOBAL_MODULE_LOCATION]:[],eRe.resolve(bCt(SCt(import.meta.url)),"..","..","..","node_modules"),eRe.resolve(bCt(SCt(import.meta.url)),"..","..","..","..","..","node_modules")];async function HY({systemDirectory:a,outputDirectory:s,sourceDirectory:c,cacheDirectory:f,logger:d,minify:v=!0,command:E,flags:A}){let O=eRe.join(a,zue);B6r(`Building with node paths: ${TCt.join(", ")}`);let M=v&&E!=="dev"&&!process.env.DEBUG_BUILD_DISABLE_MINIFY?{minify:!0,chunkNames:"[hash]"}:{minify:!1,keepNames:!0,chunkNames:"[name]-[hash]"},W=Object.freeze({sourceDirectory:c,outputDirectory:s,cacheDirectory:f,logger:d,debugMode:_h.DEBUG_BUILD_MODE,flags:A});return{platform:"browser",target:"es2022",outdir:s,splitting:!0,metafile:!0,format:"esm",nodePaths:TCt,entryPoints:[O],sourcemap:"linked",legalComments:"none",treeShaking:!0,bundle:!0,...M,external:[],logLevel:"silent",conditions:U6r,plugins:[Vbt(W),c1t(W),uCt(W),_Ct(W),yCt(W),dCt(),$bt(W),aCt(W),cCt(W),vCt(W)]}}t(HY,"getBaseESBuildConfig");var e5="run-esbuild",ECt=t(async function({systemDirectory:a,outputDirectory:s,sourceDirectory:c,cacheDirectory:f,buildId:d,logger:v,config:E,command:A,minify:O},{data:M}){v.debug("Running esbuild");let W=await HY({command:A,minify:O,systemDirectory:a,outputDirectory:s,cacheDirectory:f,sourceDirectory:c,logger:v,flags:E.flags}),$;try{if(!await sB(c))throw new Error("Failed to build project because no open-api file was found on the 'config' folder");$=await CCt.build(W),M.set("metafile",$.metafile)}catch(De){if(v.error(De),De.errors||De.warnings)$=De;else if(De.message.includes("Failed to build project because no open-api file was found on the 'config' folder"))$={warnings:[],errors:[{id:"missing-open-api-file",text:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:e5,location:null,notes:[],detail:"Failed to build project because no open-api file was found on the 'config' folder"}],outputFiles:void 0,metafile:void 0,mangleCache:void 0};else throw De}$.errors.length>0&&$.errors.length>1&&($.errors.length=1);let{errors:Y,warnings:Ne}=tRe({buildId:d,result:$});return{errors:Y,warnings:Ne}},"runEsbuild");function tRe({buildId:a,result:s}){return{status:s.errors.length>0?"Failed":s.warnings.length>0?"Warnings":"Good",runtimeVersion:"0.0.0",buildTime:"",buildTimeMs:0,buildId:a,warnings:s.warnings.map(f=>f.text==="Using direct eval with a bundler is not recommended and may cause problems"?{location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:"We do not support the use of 'eval' or 'new Function(...)'",severity:Mue,pluginName:f.pluginName||e5}:{location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:f.text,severity:Mue,pluginName:f.pluginName||e5}),errors:s.errors.map(f=>({location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:f.text,severity:V3e,pluginName:f.pluginName||e5})),metafile:s.metafile}}t(tRe,"esbuildResultToBuildResult");var $6r=t((a,s)=>{let c=s;if(s.includes(a)){let f=new RegExp(`.*(${a})`,"g");c=s.replace(f,"")}return c.match(/^(\/)?(\.\.(\/)?)+/)&&(c=c.replace(/^(\/)?(\.\.(\/)?)+/,"/")),c},"removePrefixFromString"),J6r=t((a,s)=>{let c=s;if(c.includes(a)){let f=new RegExp(`[a-zA-Z0-9-_.\\/]+(${a})`,"g");c=c.replace(f,"")}return c},"cleanFilePathsInMessage"),xCt=t((a,s,c)=>{if(!a||a.length<=0)return a;let f=a.filter(d=>d.message!=='Could not resolve "@zuplo/runtime"');return f&&f.length>0&&f.forEach(d=>{try{d.location&&d.location.file&&(d.location.file=$6r(s,d.location.file)),d.location&&d.location.lineText&&d.location.lineText.includes("@zuplo/core/index.minified.js")&&(d.location.lineText=d.location.lineText.substring(0,200)+"...<Truncated>"),d.message=J6r(s,d.message),d.notes&&d.notes.length>0&&delete d.notes,d.text&&delete d.text,d.pluginName===""&&(d.pluginName=c)}catch{}}),f},"cleanDataOnBuildIssue");function DCt(a,s){let c=rRe.basename(s);a.errors&&(a.errors=xCt(a.errors,c,e5)),a.warnings&&(a.warnings=xCt(a.warnings,c,e5))}t(DCt,"formatBuildResult");var q6r=t(a=>rRe.basename(a).startsWith("."),"isHiddenOnUnix"),z6r=t((a,s=[])=>s.map(c=>c.startsWith(".")?c:`.${c}`).some(c=>a.endsWith(c)),"hasMatchingExtname");function QLe(a,s=[],c=!1){let f=[],d;if(!Mde.existsSync(a)){let v;if(wQ.hasMagic(a))v=a;else{let E=s.map(A=>A.startsWith(".")?A:`.${A}`).join("|");v=`${a}+(${E})`}if(f.push(...wQ.sync(v,{nodir:!0})),!f.length)throw Error(`Cannot find any files matching pattern "${a}"`);return f}try{if(d=Mde.statSync(a),d.isFile())return[a]}catch{return[]}return Mde.readdirSync(a).forEach(v=>{let E=rRe.join(a,v),A;try{if(A=Mde.statSync(E),A.isDirectory()){c&&f.push(...QLe(E,s,c));return}}catch{return}if(!s.length)throw Error(`Argument '${s}' required when argument '${a}' is a directory`);!A.isFile()||!z6r(E,s)||q6r(E)||f.push(E)}),f}t(QLe,"lookupFiles");var jC=new Uue({level:process.env.FORCE_BUILD_COLORS?2:void 0}),xk=` ${jC.gray("|")} `;function cXr(a,s){a.info(jC.green(s))}t(cXr,"outputSuccess");function lXr(a,s){a.warn(jC.yellow(s))}t(lXr,"outputWarning");function uXr(a,s){a.error(`
|
|
638
|
+
export default environment;`;function Vbt(a){return{name:"environment",setup(s){s.onResolve({filter:/@app\/environment$/},()=>({namespace:zbt,pluginName:qbt,path:Jbt.join(a.sourceDirectory,vN,"environment.js")})),s.onLoad({filter:/.*/,namespace:zbt},async c=>({contents:xEr,loader:"ts",resolveDir:Jbt.dirname(c.path),pluginName:qbt}))}}}t(Vbt,"environmentPlugin");var rCt=H_(TLe(),1),nCt=H_(ETt(),1),iCt=H_(HLe(),1),sCt=H_(GLe(),1);import x6r from"fs/promises";import LS from"path";var Ek="schemas",Ode="json-schema";function aCt(a){return{name:Ek,async setup(s){let c=new iCt.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0}),f=LS.join(a.sourceDirectory,lQ),d=[],v=[],E;await of.timeFn("Initializing schema validation",async()=>{if((0,nCt.default)(c,{mode:"fast"}),c.opts.code.formats=rCt._`require("ajv-formats/dist/formats").fastFormats`,await Bu.dirExists(f)&&(c.addKeyword("faker"),E=await Bu.listFolderContents(f,lQ),await Promise.all(E.map(async A=>{try{let O=Bu.safePath(a.sourceDirectory).resolve(f,A);if(!O.startsWith(f))throw new Error("All schemas must be in the schemas directory");let M=await x6r.readFile(O,"utf-8");if(M===""||M===void 0)throw new Error(`Schema 'schemas/${A}' is empty and will be ignored.`);let W=JSON.parse(M);if(W.$schema&&W.$schema!=="https://json-schema.org/draft/2020-12/schema")throw new Error(`Error in ${A}: All JSON schemas must use version 2020-12. See release notes for changes: https://json-schema.org/draft/2020-12/release-notes.html`);if(c.addSchema(W,A),c.errors?.length){let $=c.errors[0];d.push({id:"json-schema-validation-error",pluginName:Ek,text:`Error: ${$.message}`,location:{file:LS.join(lQ,A)},detail:{params:$.params,propertyName:$.propertyName,schemaPath:$.schemaPath,data:$.data}})}}catch(O){if(O.message.endsWith("is empty and will be ignored.")){v.push({id:"empty-json-schema-file",pluginName:Ek,text:`Schema 'schemas/${A}' is empty and will be ignored.`,location:{file:`schemas/${A}`,suggestion:"Add schema details or remove the file from the project."},detail:"EmptyJSONSchemaFile",notes:[{text:`Schema 'schemas/${A}' is empty and will be ignored.`,location:{file:`schemas/${A}`,suggestion:"Add schema details or remove the file from the project."}}]});return}let M=await x7e(A,a.sourceDirectory,O.message);d.push({id:"json-schema-add-error",pluginName:Ek,text:`Error: ${O.message}`,location:M,detail:"InvalidAddSchemaError",notes:[{text:O.message}]})}})),await Promise.all(E.map(async A=>{try{let O=c.getSchema(A);O&&c.compile(O.schema).errors?.forEach(W=>{d.push({text:`Failed to compile ${A}: ${W.message}`})})}catch(O){let M=await x7e(A,a.sourceDirectory,O.message);d.push({id:"json-schema-compile-error",pluginName:Ek,text:`The schema file '${A}' is not valid. Error: ${O.message}`,location:M,detail:"InvalidSchemaError",notes:[{text:O.message}]})}})),_h.DEBUG_BUILD_MODE)){let A=LS.resolve(a.outputDirectory,lQ);await Bu.mkdirIfNotExists(A)}}),s.onStart(async()=>{if(E)return{errors:d,warnings:v}}),s.onResolve({filter:/schemas\/.*\.json$/},async A=>of.timeFn("Generating JSON schemas...",async()=>{let O=LS.isAbsolute(A.path)?A.path:LS.join(A.resolveDir,A.path);if(A.importer&&A.importer!==LS.join(a.sourceDirectory,"config/routes.json"))return{path:O};if(!await Bu.fileExists(O)){let M="policies.json";return{errors:[{id:"json-schema-build-error",text:`Unable to resolve reference to '${A.path}' from ${M}`,location:{file:LS.join(A.resolveDir,M),namespace:Ode,line:1,column:0,length:0,lineText:`Invalid JSON schema reference in ${M}`,suggestion:""},detail:"RouteReferenceError",pluginName:Ek,notes:[{text:`Unable to resolve reference to '${A.path}' from ${M}`,location:null}]}],namespace:Ode,path:O,pluginName:Ek}}return{path:O,namespace:Ode,pluginName:Ek}})),s.onLoad({filter:/.*/,namespace:Ode},async A=>of.timeFn(`Generating json schema data: ${LS.basename(A.path)}`,async()=>{let O=[],M;try{let W=LS.relative(f,A.path),$=c.getSchema(W);if(!$)throw new Error(`Could not load schema at ${A.path}`);M=$.source?.validateCode;let Y=c.compile($.schema);M=(0,sCt.default)(c,Y)}catch(W){O.push({pluginName:Ek,text:`Cannot parse project's schemas/${LS.basename(A.path)} file. Error: ${W.message}`,location:null,notes:[{text:W.message,location:null}],detail:W})}if(_h.DEBUG_BUILD_MODE&&M){let W=LS.relative(f,A.path),$=LS.join(a.sourceDirectory,".zuplo",`${W}.js`);await pk($,M)}return{contents:M,errors:O,pluginName:Ek,resolveDir:LS.dirname(A.path),watchFiles:[A.path]}}))}}}t(aCt,"jsonSchemaPlugin");import{relative as D6r}from"path";var oCt=["node:assert","node:async_hooks","node:buffer","node:crypto","node:diagnostics_channel","node:events","node:path","node:process","node:stream","node:string_decoder","node:util"],A6r="nodejs-compat-plugin";function cCt({sourceDirectory:a}){return{name:A6r,setup(s){let c=new Set;s.onStart(()=>{c.clear()}),s.onResolve({filter:/node:.*/},async({path:f,kind:d,resolveDir:v,...E})=>{let A=`${f}:${d}:${v}:${E.importer}`;if(c.has(A))return;c.add(A);let O=await s.resolve(f,{kind:d,resolveDir:v,importer:E.importer});return O.errors.length>0?oCt.includes(f)||f.includes("/")&&oCt.includes(f.split("/")[0])?{external:!0}:{external:!0,warnings:O.errors.map(W=>({...W,location:{file:D6r(a,E.importer),line:0,column:0,namespace:"",length:0,lineText:"",suggestion:"Remove the imported node module"},detail:`The package "${f}" wasn't found on the file system but is built into node. If this code is executed it will fail.`}))}:O})}}}t(cCt,"nodejsCompatPlugin");import lCt from"fs/promises";import Zx from"path";var BU="open-api-routes-plugin",Fde="open-api-routes-json";function uCt(a){return{name:"open-api-routes-plugin",setup(s){s.onResolve({filter:/routes.json$/},c=>({watchFiles:[...QLe(Zx.join(a.sourceDirectory,qb),[".oas.json"],!0),Zx.join(a.sourceDirectory,qb,Jue)],namespace:Fde,path:Zx.isAbsolute(c.path)?c.path:Zx.join(c.resolveDir,c.path),pluginName:BU})),s.onResolve({filter:/^\.\.\/modules\/.*/,namespace:Fde},async c=>of.timeFn("Generating route data...",async()=>{let f=Zx.join(c.resolveDir,`${c.path}.ts`);if(!await Bu.fileExists(f)){let d=`$import(.${c.path.replace(/^../,"")})`,v=Zx.resolve(a.sourceDirectory,"config"),E=await KF(v),A=await xft(E,d,"Update your route configuration to use code from the 'modules' folder");return{errors:[{id:"route-build-error",text:`Invalid handler reference in routes.json. Unable to resolve reference to '${d}' from routes.json`,location:A,detail:"RouteReferenceError",pluginName:BU}],namespace:Fde,path:c.path,pluginName:BU}}})),s.onLoad({filter:/.*/,namespace:Fde},async c=>of.timeFn("Generating route.json data",async()=>{let f=Zx.resolve(a.sourceDirectory,"config"),d=await KF(f),v=await Promise.all(d.map(async M=>({content:await lCt.readFile(M,"utf-8"),fileName:M}))),E=Zx.resolve(f,"policies.json");if(!await Bu.fileExists(E))return{errors:[{text:"The project must include a policies file ('/config/policies.json')",detail:"OASPoliciesFileMissing",pluginName:BU,location:{line:0,column:0,file:"/config/policies.json"}}],pluginName:BU};let A={content:await lCt.readFile(E,"utf-8"),fileName:E},O;try{O=await S7e({sourceDirectory:a.sourceDirectory,oasContent:v,policiesContent:A})}catch(M){throw new Error("Error compiling routes: "+M.message)}if(_h.DEBUG_BUILD_MODE&&O.content){let M=Zx.join(a.sourceDirectory,".zuplo"),W=Zx.resolve(M,"routes.js");await pk(W,O.content)}return{contents:O.content,errors:O.errors,pluginName:BU,resolveDir:Zx.dirname(c.path),watchFiles:[c.path]}}))}}}t(uCt,"openApiRoutesPlugin");import Lde from"path";var WY="raw-route-plugin",fCt="raw-route";function _Ct(a){return{name:"raw-route-plugin",setup(s){s.onResolve({filter:/raw.json$/},c=>({namespace:fCt,path:c.path,pluginName:WY})),s.onLoad({filter:/.*/,namespace:fCt},async c=>of.timeFn("Building route data",async()=>{let f=Lde.resolve(a.sourceDirectory,qb);if(!await Bu.dirExists(f))return{loader:"js",resolveDir:Lde.dirname(c.path),pluginName:WY};let d=await KF(f);try{let v=await E7e({oasFiles:d,sourceDirectory:a.sourceDirectory,logger:a.logger});if(_h.DEBUG_BUILD_MODE&&v){let E=Lde.join(a.sourceDirectory,".zuplo","raw-routes.js");await pk(E,v)}return{contents:v,loader:"js",resolveDir:Lde.dirname(c.path),pluginName:WY}}catch(v){if(v instanceof Tv)return{contents:"",loader:"ts",errors:[{id:"route-build-error",text:v.issue.text,location:v.issue.location,detail:v.issue.detail,pluginName:WY}],pluginName:WY};throw v}}))}}}t(_Ct,"rawRoutePlugin");import k6r from"fs/promises";import KLe from"path";var Rde="runtime-config",pCt="runtime-config-plugin";function dCt(){return{name:Rde,setup(a){a.onResolve({filter:/^\.\.\/modules\/zuplo.runtime.ts$/},s=>({namespace:pCt,path:KLe.isAbsolute(s.path)?s.path:KLe.join(s.resolveDir,s.path),pluginName:Rde})),a.onLoad({filter:/.*/,namespace:pCt},async s=>of.timeFn("Generating zuplo.runtime.ts data",async()=>{let c="export const runtimeInit = undefined;",f=[];return await Bu.fileExists(s.path)?(c=await k6r.readFile(s.path,"utf-8"),{contents:c,loader:"ts",resolveDir:KLe.dirname(s.path),errors:f,pluginName:Rde,watchFiles:[s.path]}):{contents:c,loader:"ts",errors:f,pluginName:Rde}}))}}}t(dCt,"runtimeConfigPlugin");var hCt=H_(HLe(),1),gCt=H_(GLe(),1);import ZLe from"fs/promises";import Z7 from"path";var YLe="schema-validation-plugin",mCt="schema-validation",w6r="module.exports = {}";function yCt(a){return{name:"schema-validation-plugin",setup(s){s.onResolve({filter:/ajv-schema.json$/},c=>({namespace:mCt,path:c.path,pluginName:YLe})),s.onLoad({filter:/.*/,namespace:mCt},async c=>of.timeFn("Validating schemas",async()=>{let f=Z7.resolve(a.sourceDirectory,qb,"policies.json");if(!await Bu.fileExists(f))return{contents:w6r,loader:"js",resolveDir:Z7.dirname(c.path),pluginName:YLe};let d=await N6r(a.sourceDirectory),v=Z7.resolve(a.sourceDirectory,qb),E=await KF(v),A=await L6r(E,d),O=await P6r({oasFiles:E,routesWithSchemaValidation:A,sourceDirectory:a.sourceDirectory,logger:a.logger});if(_h.DEBUG_BUILD_MODE&&O){let M=Z7.join(a.sourceDirectory,".zuplo","schema-validation.js");await pk(M,O)}return{contents:O,loader:"js",resolveDir:Z7.dirname(c.path),pluginName:YLe}}))}}}t(yCt,"schemaValidationPlugin");async function P6r({oasFiles:a,routesWithSchemaValidation:s,sourceDirectory:c,logger:f}){let d="",v=new IN(c,f);if(s.length===0)return d;let E=new hCt.Ajv2020({code:{source:!0},allErrors:!0,strict:!1,verbose:!0,meta:!0});for(let A of a){let O=await ZLe.readFile(A,"utf-8"),M=Z7.basename(A,".oas.json"),W=s.filter(Se=>Se.fileName===M),$=await v.resolve(A),Y=JSON.parse(O),Ne=[],De=new Map;W.forEach(Se=>{let Ct=Y.paths[Se.path][Se.method];if(Ct.requestBody){let Tt;if(Ct.requestBody.$ref){let br=Ct.requestBody.$ref;Tt=$.get(br)?.content}else Ct.requestBody.content&&(Tt=Ct.requestBody.content);if(Tt)for(let br in Tt){let Cr=Tt[br].schema,Lr=i8e(Se.path,Se.method,br);Cr.$id=Lr,E.addSchema(Cr),XLe(Cr,A,M,E,$,Ne,De)}}if(Ct.parameters)for(let Tt of Ct.parameters){let br=Tt.$ref?$.get(Tt.$ref):Tt,Cr=br.schema.$ref?$.get(br.schema.$ref):br.schema,Lr=n8e(Se.path,Se.method,br.in,br.name);Cr.$id=Lr,E.addSchema(Cr),XLe(br,A,M,E,$,Ne,De)}});for(let Se of Ne){let Ct=$.get(Se),Tt=XQ(M,Se);E.addSchema(Ct,Tt)}}return d=(0,gCt.default)(E),d}t(P6r,"schemaValidationSource");function XLe(a,s,c,f,d,v,E){for(let A in a){let O=a[A];if(A==="$ref"){let M=XQ(c,CN(s,O));a[A]=M,OQ(s,c,CN(s,O),d,v,E,(W,$)=>XQ(W,CN(s,$)))}else typeof O=="object"&&XLe(O,s,c,f,d,v,E)}}t(XLe,"addRefsToSchema");async function N6r(a){let s=new Set(["RequestValidationInboundPolicy"]),c=await ZLe.readFile(`${a}/config/policies.json`,"utf-8"),f=JSON.parse(c);return I6r(f,s)}t(N6r,"getPolicyNamesUsingSchemaValidationPolicies");function I6r(a,s){let c=new Set;a.policies?.forEach(d=>{d.handler?.export&&s.has(d.handler.export)&&d.handler.module==="$import(@zuplo/runtime)"&&c.add(d.name)});let f=O6r(a,c);return new Set([...c,...f])}t(I6r,"getPolicyNamesReferencingPolicyHandlers");function O6r(a,s){let c=new Set;return a.policies?.forEach(f=>{f.handler?.export==="CompositeInboundPolicy"&&f.handler?.options?.policies?.forEach(d=>{s.has(d)&&c.add(f.name)})}),c}t(O6r,"getCompositePoliciesContainingPolicy");function F6r(a,s){if(!a["x-zuplo-route"]||!a["x-zuplo-route"].policies)return!1;let c=a["x-zuplo-route"].policies.inbound;if(c){for(let d of c)if(s.has(d))return!0}let f=a["x-zuplo-route"].policies.outbound;if(f){for(let d of f)if(s.has(d))return!0}return!1}t(F6r,"isPolicyPresentInOperation");async function L6r(a,s){let c=[];for(let f of a){let d=await ZLe.readFile(f,"utf-8"),E=JSON.parse(d).paths;for(let A in E){let O=E[A];for(let M in O){let W=O[M];F6r(W,s)&&c.push({fileName:Z7.basename(f,".oas.json"),path:A,method:M})}}}return c}t(L6r,"getRoutesContainingPolicies");import{mkdirSync as R6r,writeFileSync as M6r}from"fs";import j6r from"path";function vCt(a){return{name:"write-modules-plugin",setup(s){s.onEnd(async c=>{if(c){let f=gU(a.sourceDirectory,c.metafile);R6r(a.outputDirectory,{recursive:!0}),M6r(j6r.join(a.outputDirectory,"modules.json"),JSON.stringify(f,null,2))}})}}}t(vCt,"writeModulesPlugin");var B6r=o1t("zuplo:core:build"),U6r=["workerd","worker","browser"],TCt=[...process.env.GLOBAL_MODULE_LOCATION?[process.env.GLOBAL_MODULE_LOCATION]:[],eRe.resolve(bCt(SCt(import.meta.url)),"..","..","..","node_modules"),eRe.resolve(bCt(SCt(import.meta.url)),"..","..","..","..","..","node_modules")];async function HY({systemDirectory:a,outputDirectory:s,sourceDirectory:c,cacheDirectory:f,logger:d,minify:v=!0,command:E,flags:A}){let O=eRe.join(a,zue);B6r(`Building with node paths: ${TCt.join(", ")}`);let M=v&&E!=="dev"&&!process.env.DEBUG_BUILD_DISABLE_MINIFY?{minify:!0,chunkNames:"[hash]"}:{minify:!1,keepNames:!0,chunkNames:"[name]-[hash]"},W=Object.freeze({sourceDirectory:c,outputDirectory:s,cacheDirectory:f,logger:d,debugMode:_h.DEBUG_BUILD_MODE,flags:A});return{platform:"browser",target:"es2022",outdir:s,splitting:!0,metafile:!0,format:"esm",nodePaths:TCt,entryPoints:[O],sourcemap:"linked",legalComments:"none",treeShaking:!0,bundle:!0,...M,external:[],logLevel:"silent",conditions:U6r,plugins:[Vbt(W),c1t(W),uCt(W),_Ct(W),yCt(W),dCt(),$bt(W),aCt(W),cCt(W),vCt(W)]}}t(HY,"getBaseESBuildConfig");var e5="run-esbuild",ECt=t(async function({systemDirectory:a,outputDirectory:s,sourceDirectory:c,cacheDirectory:f,buildId:d,logger:v,config:E,command:A,minify:O},{data:M}){v.debug("Running esbuild");let W=await HY({command:A,minify:O,systemDirectory:a,outputDirectory:s,cacheDirectory:f,sourceDirectory:c,logger:v,flags:E.flags}),$;try{if(!await sB(c))throw new Error("Failed to build project because no open-api file was found on the 'config' folder");$=await CCt.build(W),M.set("metafile",$.metafile)}catch(De){if(v.error(De),De.errors||De.warnings)$=De;else if(De.message.includes("Failed to build project because no open-api file was found on the 'config' folder"))$={warnings:[],errors:[{id:"missing-open-api-file",text:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:e5,location:null,notes:[],detail:"Failed to build project because no open-api file was found on the 'config' folder"}],outputFiles:void 0,metafile:void 0,mangleCache:void 0};else throw De}$.errors.length>0&&$.errors.length>1&&($.errors.length=1);let{errors:Y,warnings:Ne}=tRe({buildId:d,result:$});return{errors:Y,warnings:Ne}},"runEsbuild");function tRe({buildId:a,result:s}){return{status:s.errors.length>0?"Failed":s.warnings.length>0?"Warnings":"Good",runtimeVersion:"0.0.0",buildTime:"",buildTimeMs:0,buildId:a,warnings:s.warnings.map(f=>f.text==="Using direct eval with a bundler is not recommended and may cause problems"?{location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:"We do not support the use of 'eval' or 'new Function(...)'",severity:Mue,pluginName:f.pluginName||e5}:{location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:f.text,severity:Mue,pluginName:f.pluginName||e5}),errors:s.errors.map(f=>({location:f.location,detail:f.detail,id:f.id,notes:f.notes,message:f.text,severity:V3e,pluginName:f.pluginName||e5})),metafile:s.metafile}}t(tRe,"esbuildResultToBuildResult");var $6r=t((a,s)=>{let c=s;if(s.includes(a)){let f=new RegExp(`.*(${a})`,"g");c=s.replace(f,"")}return c.match(/^(\/)?(\.\.(\/)?)+/)&&(c=c.replace(/^(\/)?(\.\.(\/)?)+/,"/")),c},"removePrefixFromString"),J6r=t((a,s)=>{let c=s;if(c.includes(a)){let f=new RegExp(`[a-zA-Z0-9-_.\\/]+(${a})`,"g");c=c.replace(f,"")}return c},"cleanFilePathsInMessage"),xCt=t((a,s,c)=>{if(!a||a.length<=0)return a;let f=a.filter(d=>d.message!=='Could not resolve "@zuplo/runtime"');return f&&f.length>0&&f.forEach(d=>{try{d.location&&d.location.file&&(d.location.file=$6r(s,d.location.file)),d.location&&d.location.lineText&&d.location.lineText.includes("@zuplo/core/index.minified.js")&&(d.location.lineText=d.location.lineText.substring(0,200)+"...<Truncated>"),d.message=J6r(s,d.message),d.notes&&d.notes.length>0&&delete d.notes,d.text&&delete d.text,d.pluginName===""&&(d.pluginName=c)}catch{}}),f},"cleanDataOnBuildIssue");function DCt(a,s){let c=rRe.basename(s);a.errors&&(a.errors=xCt(a.errors,c,e5)),a.warnings&&(a.warnings=xCt(a.warnings,c,e5))}t(DCt,"formatBuildResult");var q6r=t(a=>rRe.basename(a).startsWith("."),"isHiddenOnUnix"),z6r=t((a,s=[])=>s.map(c=>c.startsWith(".")?c:`.${c}`).some(c=>a.endsWith(c)),"hasMatchingExtname");function QLe(a,s=[],c=!1){let f=[],d;if(!Mde.existsSync(a)){let v;if(wQ.hasMagic(a))v=a;else{let E=s.map(A=>A.startsWith(".")?A:`.${A}`).join("|");v=`${a}+(${E})`}if(f.push(...wQ.sync(v,{nodir:!0})),!f.length)throw Error(`Cannot find any files matching pattern "${a}"`);return f}try{if(d=Mde.statSync(a),d.isFile())return[a]}catch{return[]}return Mde.readdirSync(a).forEach(v=>{let E=rRe.join(a,v),A;try{if(A=Mde.statSync(E),A.isDirectory()){c&&f.push(...QLe(E,s,c));return}}catch{return}if(!s.length)throw Error(`Argument '${s}' required when argument '${a}' is a directory`);!A.isFile()||!z6r(E,s)||q6r(E)||f.push(E)}),f}t(QLe,"lookupFiles");var jC=new Uue,xk=` ${jC.gray("|")} `;function cXr(a,s){a.info(jC.green(s))}t(cXr,"outputSuccess");function lXr(a,s){a.warn(jC.yellow(s))}t(lXr,"outputWarning");function uXr(a,s){a.error(`
|
|
639
639
|
${jC.red(s)}`)}t(uXr,"outputCritical");function fXr(a,s,c){let f=c.sort((E,A)=>{let O=E.path.split("/").length,M=A.path.split("/").length;return O!==M?O-M:E.path.localeCompare(A.path)}),d=Math.max(...f.map(E=>E.path.length)),v=`${s}
|
|
640
640
|
`;f.forEach(E=>{let A=" ".repeat(d-E.path.length),O=E.bytes/1024,M=` ${E.path}${A} ${O.toFixed(2)} KB
|
|
641
641
|
`;v+=O>1024?jC.red(M):O>300?jC.yellow(M):M}),a.info(v)}t(fXr,"outputFileTree");function _Xr(a,s){if(s.length===0)return"";let c=Object.keys(s[0]).length,f=Array.from({length:c},(E,A)=>Math.max(...s.map(O=>String(Object.values(O)[A]).length))),v=s.map(E=>Object.values(E).map((A,O)=>String(A).padEnd(f[O])).join(" ")).join(`
|
|
@@ -644,7 +644,7 @@ ${jC.red(s)}`)}t(uXr,"outputCritical");function fXr(a,s,c){let f=c.sort((E,A)=>{
|
|
|
644
644
|
`))}t(pXr,"outputDevPortalBuildStart");async function jde(a,s,c){DCt(c,a),await Promise.all(c.warnings.map(async d=>ACt(a,s,d))),await Promise.all(c.errors.map(async d=>ACt(a,s,d)));let f=process.env.CODEBUILD_BUILD_ID?new Date(new Date().getTime()+1):new Date;c.status==="Good"?s.info(jC.green("Build succeeded"),{timestamp:f}):c.status==="Warnings"?s.warn(jC.yellow("Build succeeded with warnings"),{timestamp:f}):c.status==="Failed"&&s.error(jC.red("Build failed."),{timestamp:f})}t(jde,"outputBuildResult");async function ACt(a,s,c){let f=[],d=c.severity??"error",v=d==="error"?jC.red:jC.yellow,E=v(`${d.toUpperCase()}: ${c.message}${c.detail?`
|
|
645
645
|
${xk}${c.detail.toString().split(`
|
|
646
646
|
`).join(`
|
|
647
|
-
${xk}`)}`:""}`);f.push(E);let A=H6r(c.location??void 0);if(A&&f.push(`${xk}${v(`The error was found in the file: ${A}`)}`),c.location&&c.location.file&&c.location.column!==0&&c.location.line!==0)try{let O=W6r.join(a,c.location.file),M=await V6r(O,"utf-8"),W=(0,kCt.codeFrameColumns)(M,{start:{line:c.location.line,column:c.location.column}},{highlightCode:!0,
|
|
647
|
+
${xk}`)}`:""}`);f.push(E);let A=H6r(c.location??void 0);if(A&&f.push(`${xk}${v(`The error was found in the file: ${A}`)}`),c.location&&c.location.file&&c.location.column!==0&&c.location.line!==0)try{let O=W6r.join(a,c.location.file),M=await V6r(O,"utf-8"),W=(0,kCt.codeFrameColumns)(M,{start:{line:c.location.line,column:c.location.column}},{highlightCode:!0,message:c.message,linesAbove:3,linesBelow:3});f.push(xk),f.push(W)}catch{}else c.location&&c.location.file&&f.push(jC.red(`${xk}File: ${c.location.file}:${c.location.line}:${c.location.column}`));f.push(""),c.severity==="warning"?s.warn(f.join(`
|
|
648
648
|
`)):s.error(f.join(`
|
|
649
649
|
`))}t(ACt,"logIssue");function H6r(a){if(a&&a.file){let s=a.file;if(a.line)return`${s}:${a.line}`;if(a.column)return`${s}:${a.column}`}}t(H6r,"getFileLocation");var BC=class{static{t(this,"PluginResult")}errors=[];warnings=[];constructor(s){s&&this.errors.push(s)}};async function wCt(a,s,c){let f=[],d=[],v=new Map;for await(let E of a)try{let A=await E(s,{data:v,errors:d,warnings:f});if(d.push(...A.errors.map(O=>(O.pluginName===""&&(O.pluginName=E.name),O))),f.push(...A.warnings),A.errors.length>0)break}catch(A){if(A instanceof Tv?d.push({...A.issue,pluginName:A.pluginName??"unknown"}):d.push(A),c?.throwOnException)throw A;break}return{errors:d,warnings:f,data:v}}t(wCt,"runPlugins");import{parse as G6r}from"jsonc-parser";import{readFile as Q6r}from"fs/promises";import PCt from"path";async function Bde(a){let s=PCt.join(a,Y3e),c=PCt.join(a,X3e),f=!1,d=s;await Bu.fileExists(s)?(f=!0,d=s):await Bu.fileExists(c)&&(f=!0,d=c);let v,E;if(f){let O=await Q6r(d,"utf-8"),W=G6r(O,[]);if(typeof W!="object")return{status:zF,errors:[{message:"Invalid zuplo.jsonc file.",detail:"The zuplo.jsonc file is not a valid JSON object",pluginName:"buildData",severity:"error"}]};if("version"in W&&W.version!==1)return{status:zF,errors:[{message:"Invalid version set in zuplo.jsonc file.",detail:"version in zuplo.jsonc must be set to 1",pluginName:"buildData",severity:"error"}]};if("compatibilityDate"in W&&Vj&&typeof W.compatibilityDate=="string"){if(!Vj.includes(W.compatibilityDate)){let $={message:"Invalid compatibilityDate set in zuplo.jsonc file.",detail:`compatibilityDate was set to ${W.compatibilityDate}. Valid compatibility dates are ${Vj.join(", ")}`,pluginName:"buildData",severity:"error"};return{status:zF,errors:[$]}}v=W.compatibilityDate}E=Rue(v,W.flags)}else E=Rue(void 0,void 0);return{status:qF,config:{version:1,compatibilityDate:v,flags:E}}}t(Bde,"getZuploConfig");import K6r from"fs";import{mkdir as NCt,readFile as Y6r,readdir as X6r,writeFile as Z6r}from"fs/promises";import GY from"path";import e4r from"readline";var ICt=t(async function({sourceDirectory:a,logger:s,outputDirectory:c,deploymentName:f,environmentType:d,deploymentUrl:v}){return of.timeFn("Building OpenAPI files",async()=>{s.debug("Building OpenAPI files");let E=GY.join(a,qb),A=GY.join(E,Jue),O=GY.join(c,Glt,qb);try{if(await Bu.dirExists(c)||await NCt(c),await Bu.dirExists(O)||await NCt(O,{recursive:!0}),!await sB(a))return new BC({message:"Failed to build project because no OpenAPI file was found on the 'config' folder",pluginName:"build-open-api-files",severity:"error"});let $=(await X6r(E)).filter(Se=>Se.endsWith(".oas.json"));if(!await Bu.fileExists(A))return new BC({message:"The project must include a policies file ('/config/policies.json')",pluginName:"build-open-api-files",severity:"error"});let Y=await Y6r(A,"utf-8"),Ne=JSON.parse(Y),De=t(async Se=>{let Ct=GY.join(E,Se);if(!await t4r(Ct)){s.debug(`Skipping ${Se} as it does not use the OpenAPI handler`);return}let Tt;try{Tt=await idt({sourceDirectory:a,openApiDocPath:Ct,policiesConfig:Ne,logger:s,environmentType:d,deploymentName:f,deploymentUrl:v})}catch(Lr){if(s.error(Lr),Lr instanceof SyntaxError||Lr instanceof SC.ResolverError||Lr instanceof SC.JSONParserError||Lr instanceof SC.ParserError||Lr instanceof SC.MissingPointerError||Lr instanceof s7)return new BC({message:Lr.message,location:{file:Se,column:0,length:0,line:0,lineText:"",namespace:"",suggestion:""},pluginName:"build-open-api-files",severity:"error"});if(Lr instanceof Tv)return new BC({...Lr.issue,pluginName:"build-open-api-files"});throw Lr}let br=JSON.stringify(Tt,null,2),Cr=GY.join(O,Se);await Z6r(Cr,br,"utf-8")},"processFile");await Promise.all($.map(De))}catch(M){return s.error(M),new BC({message:"Error building OpenAPI files",pluginName:"build-open-api-files",severity:"error"})}return new BC})},"buildOpenApiFiles");async function t4r(a){let s=K6r.createReadStream(a),c=e4r.createInterface({input:s,crlfDelay:1/0}),f=!1,d=!1;for await(let v of c)if(v.includes('"openApiSpecHandler"')&&(f=!0),v.includes('"openApiFilePath"')&&(d=!0),f&&d)break;return c.close(),s.destroy(),f&&d}t(t4r,"usesOpenApiHandler");import r4r from"fs/promises";import n4r from"path";var OCt=t(async function({outputDirectory:a,systemDirectory:s,cacheDirectory:c,logger:f}){return of.timeFn("Cleaning output",async()=>{f.debug("Cleaning output");let d=n4r.join(c,"routes");return await Promise.all([a,s,d].map(async v=>{try{await r4r.rm(v,{recursive:!0,force:!0})}catch(E){f.error(E)}})),{warnings:[],errors:[]}})},"cleanOutput");import FCt from"fs/promises";var LCt=t(async function({systemDirectory:a,cacheDirectory:s,logger:c}){return of.timeFn("Creating system directory",async()=>{c.debug("Creating system directory");try{return await Promise.all([FCt.mkdir(a,{recursive:!0}),FCt.mkdir(s,{recursive:!0})]),{warnings:[],errors:[]}}catch(f){return c.error(f),{warnings:[],errors:[]}}return{warnings:[],errors:[]}})},"createSystemDir");var RCt=t(async function({logger:a}){return of.timeFn("Checking for breaking changes",async()=>(a.debug("Checking for breaking changes"),{warnings:[],errors:[]}))},"checkForDeprecations");import{readFile as i4r,writeFile as s4r}from"fs/promises";import MCt,{dirname as a4r}from"path";import{fileURLToPath as o4r}from"url";var jCt=t(async function({systemDirectory:a,buildId:s,logger:c,config:f,publicZuploEnvironmentVariables:d}){return of.timeFn("Generating build data",async()=>{c.debug("Generating build data");let v=await i4r(MCt.resolve(a4r(o4r(import.meta.url)),"../../../package.json"),"utf-8"),E=JSON.parse(v),A={BUILD_ID:s??"",GIT_SHA:process.env.GIT_SHA,TIMESTAMP:new Date().toISOString(),BUILD_ENV:_h.NODE_ENV,ZUPLO_VERSION:E.version,API_VERSION:process.env.API_VERSION,COMPATIBILITY_DATE:f?.compatibilityDate,ACCOUNT_NAME:d?.ZUPLO_ACCOUNT_NAME,PROJECT_NAME:d?.ZUPLO_PROJECT_NAME,ENVIRONMENT_TYPE:d?.ZUPLO_ENVIRONMENT_TYPE,IS_LOCAL_DEVELOPMENT:_h.isLocalDevelopment(),COMPATIBILITY_FLAGS:W3e[f?.compatibilityDate??"none"]},O=JSON.stringify(A,void 0,2),M=MCt.join(a,que);try{await s4r(M,O.trimStart(),"utf-8")}catch(W){c.error(W);let $={message:`Error creating file at ${M}`,pluginName:"buildData",severity:"error"};return{warnings:[],errors:[$]}}return{warnings:[],errors:[]}})},"generateBuildData");import c4r from"fs/promises";import l4r from"path";var u4r=`import { Handler, ServiceProviderImpl } from "@zuplo/runtime";
|
|
650
650
|
import routeLoader from "../config/routes.json";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/core",
|
|
3
|
-
"version": "6.40.
|
|
3
|
+
"version": "6.40.26",
|
|
4
4
|
"repository": "https://github.com/zuplo/zuplo",
|
|
5
5
|
"author": "Zuplo, Inc.",
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"prettier": "^3.3.3"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@zuplo/graphql": "^6.40.
|
|
44
|
-
"@zuplo/otel": "^6.40.
|
|
45
|
-
"@zuplo/runtime": "^6.40.
|
|
43
|
+
"@zuplo/graphql": "^6.40.26",
|
|
44
|
+
"@zuplo/otel": "^6.40.26",
|
|
45
|
+
"@zuplo/runtime": "^6.40.26"
|
|
46
46
|
}
|
|
47
47
|
}
|