@telia-ace/alliance-cli 1.1.0-next.2 → 1.1.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-VK4VKE7N.js → build-I3X32XDY.js} +1 -1
- package/dist/chunk-3NIYGSPA.js +8 -0
- package/dist/index.js +1 -1
- package/dist/{jwt-44OP6IAD.js → jwt-664I4MZH.js} +1 -1
- package/dist/{public-key-XJHOSPD7.js → public-key-P2YSCBG2.js} +1 -1
- package/dist/{serve-3GDWXOJ2.js → serve-ZS6GYL4L.js} +1 -1
- package/dist/{upgrade-DJXSXOP2.js → upgrade-V6EYUERP.js} +1 -1
- package/package.json +3 -3
- package/dist/chunk-2QT2TRN4.js +0 -8
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as c__createRequire } from 'node:module';
|
|
2
|
+
const require = c__createRequire(import.meta.url);
|
|
3
|
+
import{h as O,i as Ae,l as I}from"./chunk-AEIX73UA.js";var b;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{let a={};for(let i of s)a[i]=i;return a},r.getValidEnumValues=s=>{let a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(let o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let a=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(let i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(b||(b={}));var Ee;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ee||(Ee={}));var u=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),L=r=>{switch(typeof r){case"undefined":return u.undefined;case"string":return u.string;case"number":return isNaN(r)?u.nan:u.number;case"boolean":return u.boolean;case"function":return u.function;case"bigint":return u.bigint;case"symbol":return u.symbol;case"object":return Array.isArray(r)?u.array:r===null?u.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?u.promise:typeof Map<"u"&&r instanceof Map?u.map:typeof Set<"u"&&r instanceof Set?u.set:typeof Date<"u"&&r instanceof Date?u.date:u.object;default:return u.unknown}},c=b.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"]),nt=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),T=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,f=0;for(;f<i.path.length;){let d=i.path[f];f===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],f++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};T.create=r=>new T(r);var le=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===u.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,b.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:b.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(r)}return{message:t}},De=le;function st(r){De=r}function ye(){return De}var ve=r=>{let{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a},o="",f=n.filter(d=>!!d).slice().reverse();for(let d of f)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},at=[];function l(r,e){let t=ve({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ye(),le].filter(n=>!!n)});r.common.issues.push(t)}var x=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let s of t){if(s.status==="aborted")return m;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let s of t)n.push({key:await s.key,value:await s.value});return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return m;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}},m=Object.freeze({status:"aborted"}),ze=r=>({status:"dirty",value:r}),w=r=>({status:"valid",value:r}),je=r=>r.status==="aborted",Oe=r=>r.status==="dirty",fe=r=>r.status==="valid",_e=r=>typeof Promise<"u"&&r instanceof Promise,p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(p||(p={}));var A=class{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}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}},Le=(r,e)=>{if(fe(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new T(r.common.issues);return this._error=t,this._error}}};function g(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:t??o.defaultError},description:s}}var y=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,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(e){return L(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new x,ctx:{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(_e(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let s={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Le(s,a)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(_e(s)?s:Promise.resolve(s));return Le(n,a)}refine(e,t){let n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{let i=e(s),o=()=>a.addIssue({code:c.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(f=>f?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new C({schema:this,typeName:h.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return S.create(this,this._def)}nullable(){return Z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return P.create(this,this._def)}promise(){return z.create(this,this._def)}or(e){return H.create([this,e],this._def)}and(e){return Y.create(this,e,this._def)}transform(e){return new C({...g(this._def),schema:this,typeName:h.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ee({...g(this._def),innerType:this,defaultValue:t,typeName:h.ZodDefault})}brand(){return new ke({typeName:h.ZodBranded,type:this,...g(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new ce({...g(this._def),innerType:this,catchValue:t,typeName:h.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return pe.create(this,e)}readonly(){return ue.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},it=/^c[^\s-]{8,}$/i,ot=/^[a-z][a-z0-9]*$/,ct=/^[0-9A-HJKMNP-TV-Z]{26}$/,dt=/^[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,ut=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,lt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Se,ft=/^(((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}))$/,pt=/^(([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})))$/,ht=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function mt(r,e){return!!((e==="v4"||!e)&&ft.test(r)||(e==="v6"||!e)&&pt.test(r))}var V=class r extends y{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:u.string,received:a.parsedType}),m}let n=new x,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?l(s,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(s,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ut.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"email",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Se||(Se=new RegExp(lt,"u")),Se.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"emoji",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")dt.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"uuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")it.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")ot.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid2",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")ct.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ulid",code:c.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),l(s,{validation:"url",code:c.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"regex",code:c.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?ht(a).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?mt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ip",code:c.invalid_string,message:a.message}),n.dirty()):b.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:c.invalid_string,...p.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,...p.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...p.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};V.create=r=>{var e;return new V({checks:[],typeName:h.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...g(r)})};function gt(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}var U=class r extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==u.number){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:u.number,received:a.parsedType}),m}let n,s=new x;for(let a of this._def.checks)a.kind==="int"?b.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?gt(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_finite,message:a.message}),s.dirty()):b.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};U.create=r=>new U({checks:[],typeName:h.ZodNumber,coerce:r?.coerce||!1,...g(r)});var B=class r extends y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==u.bigint){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:u.bigint,received:a.parsedType}),m}let n,s=new x;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):b.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};B.create=r=>{var e;return new B({checks:[],typeName:h.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...g(r)})};var W=class extends y{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.boolean){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.boolean,received:n.parsedType}),m}return w(e.data)}};W.create=r=>new W({typeName:h.ZodBoolean,coerce:r?.coerce||!1,...g(r)});var q=class r extends y{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:u.date,received:a.parsedType}),m}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_date}),m}let n=new x,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):b.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};q.create=r=>new q({checks:[],coerce:r?.coerce||!1,typeName:h.ZodDate,...g(r)});var se=class extends y{_parse(e){if(this._getType(e)!==u.symbol){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.symbol,received:n.parsedType}),m}return w(e.data)}};se.create=r=>new se({typeName:h.ZodSymbol,...g(r)});var J=class extends y{_parse(e){if(this._getType(e)!==u.undefined){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.undefined,received:n.parsedType}),m}return w(e.data)}};J.create=r=>new J({typeName:h.ZodUndefined,...g(r)});var F=class extends y{_parse(e){if(this._getType(e)!==u.null){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.null,received:n.parsedType}),m}return w(e.data)}};F.create=r=>new F({typeName:h.ZodNull,...g(r)});var D=class extends y{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}};D.create=r=>new D({typeName:h.ZodAny,...g(r)});var R=class extends y{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}};R.create=r=>new R({typeName:h.ZodUnknown,...g(r)});var E=class extends y{_parse(e){let t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:u.never,received:t.parsedType}),m}};E.create=r=>new E({typeName:h.ZodNever,...g(r)});var ae=class extends y{_parse(e){if(this._getType(e)!==u.undefined){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.void,received:n.parsedType}),m}return w(e.data)}};ae.create=r=>new ae({typeName:h.ZodVoid,...g(r)});var P=class r extends y{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==u.array)return l(t,{code:c.invalid_type,expected:u.array,received:t.parsedType}),m;if(s.exactLength!==null){let i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(l(t,{code:i?c.too_big:c.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(l(t,{code:c.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(l(t,{code:c.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new A(t,i,t.path,o)))).then(i=>x.mergeArray(n,i));let a=[...t.data].map((i,o)=>s.type._parseSync(new A(t,i,t.path,o)));return x.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}};P.create=(r,e)=>new P({type:r,minLength:null,maxLength:null,exactLength:null,typeName:h.ZodArray,...g(e)});function ne(r){if(r instanceof k){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=S.create(ne(n))}return new k({...r._def,shape:()=>e})}else return r instanceof P?new P({...r._def,type:ne(r.element)}):r instanceof S?S.create(ne(r.unwrap())):r instanceof Z?Z.create(ne(r.unwrap())):r instanceof j?j.create(r.items.map(e=>ne(e))):r}var k=class r extends y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==u.object){let d=this._getOrReturnCtx(e);return l(d,{code:c.invalid_type,expected:u.object,received:d.parsedType}),m}let{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof E&&this._def.unknownKeys==="strip"))for(let d in s.data)i.includes(d)||o.push(d);let f=[];for(let d of i){let _=a[d],N=s.data[d];f.push({key:{status:"valid",value:d},value:_._parse(new A(s,N,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof E){let d=this._def.unknownKeys;if(d==="passthrough")for(let _ of o)f.push({key:{status:"valid",value:_},value:{status:"valid",value:s.data[_]}});else if(d==="strict")o.length>0&&(l(s,{code:c.unrecognized_keys,keys:o}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let _ of o){let N=s.data[_];f.push({key:{status:"valid",value:_},value:d._parse(new A(s,N,s.path,_)),alwaysSet:_ in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let _ of f){let N=await _.key;d.push({key:N,value:await _.value,alwaysSet:_.alwaysSet})}return d}).then(d=>x.mergeObjectSync(n,d)):x.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;let f=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=p.errToObj(e).message)!==null&&o!==void 0?o:f}:{message:f}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:h.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return b.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return b.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}deepPartial(){return ne(this)}partial(e){let t={};return b.objectKeys(this.shape).forEach(n=>{let s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return b.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof S;)a=a._def.innerType;t[n]=a}}),new r({...this._def,shape:()=>t})}keyof(){return Ue(b.objectKeys(this.shape))}};k.create=(r,e)=>new k({shape:()=>r,unknownKeys:"strip",catchall:E.create(),typeName:h.ZodObject,...g(e)});k.strictCreate=(r,e)=>new k({shape:()=>r,unknownKeys:"strict",catchall:E.create(),typeName:h.ZodObject,...g(e)});k.lazycreate=(r,e)=>new k({shape:r,unknownKeys:"strip",catchall:E.create(),typeName:h.ZodObject,...g(e)});var H=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new T(o.ctx.common.issues));return l(t,{code:c.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(n.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a,i=[];for(let f of n){let d={...t,common:{...t.common,issues:[]},parent:null},_=f._parseSync({data:t.data,path:t.path,parent:d});if(_.status==="valid")return _;_.status==="dirty"&&!a&&(a={result:_,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(f=>new T(f));return l(t,{code:c.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}};H.create=(r,e)=>new H({options:r,typeName:h.ZodUnion,...g(e)});var ge=r=>r instanceof G?ge(r.schema):r instanceof C?ge(r.innerType()):r instanceof K?[r.value]:r instanceof X?r.options:r instanceof Q?Object.keys(r.enum):r instanceof ee?ge(r._def.innerType):r instanceof J?[void 0]:r instanceof F?[null]:null,be=class r extends y{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.object)return l(t,{code:c.invalid_type,expected:u.object,received:t.parsedType}),m;let n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let s=new Map;for(let a of t){let i=ge(a.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new r({typeName:h.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...g(n)})}};function Ie(r,e){let t=L(r),n=L(e);if(r===e)return{valid:!0,data:r};if(t===u.object&&n===u.object){let s=b.objectKeys(e),a=b.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(let o of a){let f=Ie(r[o],e[o]);if(!f.valid)return{valid:!1};i[o]=f.data}return{valid:!0,data:i}}else if(t===u.array&&n===u.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let a=0;a<r.length;a++){let i=r[a],o=e[a],f=Ie(i,o);if(!f.valid)return{valid:!1};s.push(f.data)}return{valid:!0,data:s}}else return t===u.date&&n===u.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var Y=class extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(je(a)||je(i))return m;let o=Ie(a.value,i.value);return o.valid?((Oe(a)||Oe(i))&&t.dirty(),{status:t.value,value:o.data}):(l(n,{code:c.invalid_intersection_types}),m)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Y.create=(r,e,t)=>new Y({left:r,right:e,typeName:h.ZodIntersection,...g(t)});var j=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.array)return l(n,{code:c.invalid_type,expected:u.array,received:n.parsedType}),m;if(n.data.length<this._def.items.length)return l(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&n.data.length>this._def.items.length&&(l(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...n.data].map((i,o)=>{let f=this._def.items[o]||this._def.rest;return f?f._parse(new A(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>x.mergeArray(t,i)):x.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};j.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new j({items:r,typeName:h.ZodTuple,rest:null,...g(e)})};var xe=class r extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.object)return l(n,{code:c.invalid_type,expected:u.object,received:n.parsedType}),m;let s=[],a=this._def.keyType,i=this._def.valueType;for(let o in n.data)s.push({key:a._parse(new A(n,o,n.path,o)),value:i._parse(new A(n,n.data[o],n.path,o))});return n.common.async?x.mergeObjectAsync(t,s):x.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof y?new r({keyType:e,valueType:t,typeName:h.ZodRecord,...g(n)}):new r({keyType:V.create(),valueType:e,typeName:h.ZodRecord,...g(t)})}},ie=class extends y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.map)return l(n,{code:c.invalid_type,expected:u.map,received:n.parsedType}),m;let s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,f],d)=>({key:s._parse(new A(n,o,n.path,[d,"key"])),value:a._parse(new A(n,f,n.path,[d,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let f of i){let d=await f.key,_=await f.value;if(d.status==="aborted"||_.status==="aborted")return m;(d.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(d.value,_.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let f of i){let d=f.key,_=f.value;if(d.status==="aborted"||_.status==="aborted")return m;(d.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(d.value,_.value)}return{status:t.value,value:o}}}};ie.create=(r,e,t)=>new ie({valueType:e,keyType:r,typeName:h.ZodMap,...g(t)});var oe=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.set)return l(n,{code:c.invalid_type,expected:u.set,received:n.parsedType}),m;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(l(n,{code:c.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(l(n,{code:c.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let a=this._def.valueType;function i(f){let d=new Set;for(let _ of f){if(_.status==="aborted")return m;_.status==="dirty"&&t.dirty(),d.add(_.value)}return{status:t.value,value:d}}let o=[...n.data.values()].map((f,d)=>a._parse(new A(n,f,n.path,d)));return n.common.async?Promise.all(o).then(f=>i(f)):i(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};oe.create=(r,e)=>new oe({valueType:r,minSize:null,maxSize:null,typeName:h.ZodSet,...g(e)});var we=class r extends y{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.function)return l(t,{code:c.invalid_type,expected:u.function,received:t.parsedType}),m;function n(o,f){return ve({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ye(),le].filter(d=>!!d),issueData:{code:c.invalid_arguments,argumentsError:f}})}function s(o,f){return ve({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ye(),le].filter(d=>!!d),issueData:{code:c.invalid_return_type,returnTypeError:f}})}let a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof z){let o=this;return w(async function(...f){let d=new T([]),_=await o._def.args.parseAsync(f,a).catch(Ne=>{throw d.addIssue(n(f,Ne)),d}),N=await Reflect.apply(i,this,_);return await o._def.returns._def.type.parseAsync(N,a).catch(Ne=>{throw d.addIssue(s(N,Ne)),d})})}else{let o=this;return w(function(...f){let d=o._def.args.safeParse(f,a);if(!d.success)throw new T([n(f,d.error)]);let _=Reflect.apply(i,this,d.data),N=o._def.returns.safeParse(_,a);if(!N.success)throw new T([s(_,N.error)]);return N.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:j.create(e).rest(R.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||j.create([]).rest(R.create()),returns:t||R.create(),typeName:h.ZodFunction,...g(n)})}},G=class extends y{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};G.create=(r,e)=>new G({getter:r,typeName:h.ZodLazy,...g(e)});var K=class extends y{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};K.create=(r,e)=>new K({value:r,typeName:h.ZodLiteral,...g(e)});function Ue(r,e){return new X({values:r,typeName:h.ZodEnum,...g(e)})}var X=class r extends y{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{expected:b.joinValues(n),received:t.parsedType,code:c.invalid_type}),m}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{received:t.data,code:c.invalid_enum_value,options:n}),m}return w(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e){return r.create(e)}exclude(e){return r.create(this.options.filter(t=>!e.includes(t)))}};X.create=Ue;var Q=class extends y{_parse(e){let t=b.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==u.string&&n.parsedType!==u.number){let s=b.objectValues(t);return l(n,{expected:b.joinValues(s),received:n.parsedType,code:c.invalid_type}),m}if(t.indexOf(e.data)===-1){let s=b.objectValues(t);return l(n,{received:n.data,code:c.invalid_enum_value,options:s}),m}return w(e.data)}get enum(){return this._def.values}};Q.create=(r,e)=>new Q({values:r,typeName:h.ZodNativeEnum,...g(e)});var z=class extends y{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.promise&&t.common.async===!1)return l(t,{code:c.invalid_type,expected:u.promise,received:t.parsedType}),m;let n=t.parsedType===u.promise?t.data:Promise.resolve(t.data);return w(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};z.create=(r,e)=>new z({type:r,typeName:h.ZodPromise,...g(e)});var C=class extends y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===h.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{l(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){let i=s.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}if(s.type==="refinement"){let i=o=>{let f=s.refinement(o,a);if(n.common.async)return Promise.resolve(f);if(f instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!fe(i))return i;let o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>fe(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);b.assertNever(s)}};C.create=(r,e,t)=>new C({schema:r,typeName:h.ZodEffects,effect:e,...g(t)});C.createWithPreprocess=(r,e,t)=>new C({schema:e,effect:{type:"preprocess",transform:r},typeName:h.ZodEffects,...g(t)});var S=class extends y{_parse(e){return this._getType(e)===u.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};S.create=(r,e)=>new S({innerType:r,typeName:h.ZodOptional,...g(e)});var Z=class extends y{_parse(e){return this._getType(e)===u.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Z.create=(r,e)=>new Z({innerType:r,typeName:h.ZodNullable,...g(e)});var ee=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===u.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ee.create=(r,e)=>new ee({innerType:r,typeName:h.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});var ce=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return _e(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new T(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new T(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ce.create=(r,e)=>new ce({innerType:r,typeName:h.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var de=class extends y{_parse(e){if(this._getType(e)!==u.nan){let n=this._getOrReturnCtx(e);return l(n,{code:c.invalid_type,expected:u.nan,received:n.parsedType}),m}return{status:"valid",value:e.data}}};de.create=r=>new de({typeName:h.ZodNaN,...g(r)});var yt=Symbol("zod_brand"),ke=class extends y{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},pe=class r extends y{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),ze(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?m:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:h.ZodPipeline})}},ue=class extends y{_parse(e){let t=this._def.innerType._parse(e);return fe(t)&&(t.value=Object.freeze(t.value)),t}};ue.create=(r,e)=>new ue({innerType:r,typeName:h.ZodReadonly,...g(e)});var Be=(r,e={},t)=>r?D.create().superRefine((n,s)=>{var a,i;if(!r(n)){let o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,f=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:f})}}):D.create(),vt={object:k.lazycreate},h;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(h||(h={}));var _t=(r,e={message:`Input not instance of ${r.name}`})=>Be(t=>t instanceof r,e),We=V.create,qe=U.create,bt=de.create,xt=B.create,Je=W.create,wt=q.create,kt=se.create,Tt=J.create,Ct=F.create,Nt=D.create,At=R.create,St=E.create,Et=ae.create,jt=P.create,Ot=k.create,It=k.strictCreate,Rt=H.create,Pt=be.create,Zt=Y.create,$t=j.create,Mt=xe.create,Lt=ie.create,Vt=oe.create,Dt=we.create,zt=G.create,Ut=K.create,Bt=X.create,Wt=Q.create,qt=z.create,Ve=C.create,Jt=S.create,Ft=Z.create,Ht=C.createWithPreprocess,Yt=pe.create,Gt=()=>We().optional(),Kt=()=>qe().optional(),Xt=()=>Je().optional(),Qt={string:r=>V.create({...r,coerce:!0}),number:r=>U.create({...r,coerce:!0}),boolean:r=>W.create({...r,coerce:!0}),bigint:r=>B.create({...r,coerce:!0}),date:r=>q.create({...r,coerce:!0})},er=m,v=Object.freeze({__proto__:null,defaultErrorMap:le,setErrorMap:st,getErrorMap:ye,makeIssue:ve,EMPTY_PATH:at,addIssueToContext:l,ParseStatus:x,INVALID:m,DIRTY:ze,OK:w,isAborted:je,isDirty:Oe,isValid:fe,isAsync:_e,get util(){return b},get objectUtil(){return Ee},ZodParsedType:u,getParsedType:L,ZodType:y,ZodString:V,ZodNumber:U,ZodBigInt:B,ZodBoolean:W,ZodDate:q,ZodSymbol:se,ZodUndefined:J,ZodNull:F,ZodAny:D,ZodUnknown:R,ZodNever:E,ZodVoid:ae,ZodArray:P,ZodObject:k,ZodUnion:H,ZodDiscriminatedUnion:be,ZodIntersection:Y,ZodTuple:j,ZodRecord:xe,ZodMap:ie,ZodSet:oe,ZodFunction:we,ZodLazy:G,ZodLiteral:K,ZodEnum:X,ZodNativeEnum:Q,ZodPromise:z,ZodEffects:C,ZodTransformer:C,ZodOptional:S,ZodNullable:Z,ZodDefault:ee,ZodCatch:ce,ZodNaN:de,BRAND:yt,ZodBranded:ke,ZodPipeline:pe,ZodReadonly:ue,custom:Be,Schema:y,ZodSchema:y,late:vt,get ZodFirstPartyTypeKind(){return h},coerce:Qt,any:Nt,array:jt,bigint:xt,boolean:Je,date:wt,discriminatedUnion:Pt,effect:Ve,enum:Bt,function:Dt,instanceof:_t,intersection:Zt,lazy:zt,literal:Ut,map:Lt,nan:bt,nativeEnum:Wt,never:St,null:Ct,nullable:Ft,number:qe,object:Ot,oboolean:Xt,onumber:Kt,optional:Jt,ostring:Gt,pipeline:Yt,preprocess:Ht,promise:qt,record:Mt,set:Vt,strictObject:It,string:We,symbol:kt,transformer:Ve,tuple:$t,undefined:Tt,union:Rt,unknown:At,void:Et,NEVER:er,ZodIssueCode:c,quotelessJson:nt,ZodError:T});var tr=v.object({}),rr=v.object({alias:v.object({}).passthrough().default({}).describe("Equivalent to `vite.resolve.alias`.\n\nhttps://vitejs.dev/config/shared-options.html#resolve-alias"),plugins:v.any().array().default([]).describe("Equivalent to `vite.plugins`.\n\nhttps://vitejs.dev/config/shared-options.html#plugins")}),nr=v.object({server:v.number().default(3e3).describe("The port that the dev server should use."),gateway:v.number().default(3001).describe("The port that the api gateway should use.")}),sr=v.object({apps:v.string().array().default([]).describe(`Additional apps to include.
|
|
4
|
+
|
|
5
|
+
Note: additional apps need to be added as devDependencies.`),ports:nr.default({}).describe("Options for ports."),open:v.boolean().default(!1).describe("Whether the dev server should automatically open in your browser or not."),logging:v.boolean().default(!1).describe("Whether the dev server and browser console should output more log information or not.")}),ar=v.object({mode:v.string().default("production").describe("Which mode to use when building the app. [production | development]"),watch:v.boolean().default(!1).describe("Whether the build should start watching and rebuild when files change or not.")}),ir=v.object({app:v.string().default("./src/app.ts").describe("The entry file for the app."),manifest:v.string().default("./src/manifest.json").describe("The entry file for the app manifest.")}),he=v.object({vite:rr.default({}).describe("Options related to Vite."),server:sr.default({}).describe("Options related to the dev server."),entries:ir.default({}).describe("Options related to the app entry points."),build:ar.default({}).describe("Options related to app build."),experimental:tr.default({}).describe("Experimental options.")}),or=v.enum(["build","serve"]),cr=v.object({command:or,mode:v.string()}),dr=v.function().args(cr).returns(he.or(v.promise(he))),Mr=v.function().args(v.union([he,dr]));var ur=v.enum(["necessary","functional","analytics","marketing"]),lr=v.object({purpose:v.string().describe("Purpose of the storing the value."),category:ur.describe("Category of the storage value - necessary, functional, analytics or marketing."),lifespan:v.string().describe("Basic description of how long the value will be stored.")}),fr=v.record(lr.describe("Key used when writing to the storage.")),pr=v.object({value:v.string().describe("The localization token default value."),description:v.string().describe("The localization token description.")}),hr=v.object({localization:v.record(pr.describe("Key used when getting the localized text.")).default({}).describe("Translateable texts used in the app")}),mr=v.object({name:v.string().describe("URL friendly name of the app."),endpoints:v.string().array().default([]).describe("Endpoints that should be communicated with using the API gateway."),permissions:v.string().array().default([]).describe("Permissions that can be added to user roles."),resources:hr.default({}).describe("Resources used by the app."),storage:fr.default({}).describe("Cookies, session storage, and local storage values that are used by the app.")}).passthrough();function Fe(r,e){let t=mr.safeParse(r);return t.success?t.data:He(t.error.format(),e?[e]:[]).join(`
|
|
6
|
+
`)}function He(r,e=[],t=""){r._errors?.length&&e.push(`${t} - ${r._errors.join(" + ")}`);for(let[n,s]of Object.entries(r))n==="_errors"||!s||typeof s!="object"||Array.isArray(s)||He(s,e,t?`${t}.${n}`:n);return e}function Pe(r,e,t=".",n){if(!Re(e))return Pe(r,{},t,n);let s=Object.assign({},e);for(let a in r){if(a==="__proto__"||a==="constructor")continue;let i=r[a];i!=null&&(n&&n(s,a,i,t)||(Array.isArray(i)&&Array.isArray(s[a])?s[a]=[...i,...s[a]]:Re(i)&&Re(s[a])?s[a]=Pe(i,s[a],(t?`${t}.`:"")+a.toString(),n):s[a]=i))}return s}function Re(r){if(r===null||typeof r!="object")return!1;let e=Object.getPrototypeOf(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)}function Ze(r){return(...e)=>e.reduce((t,n)=>Pe(t,n,"",r),{})}var Ye=Ze(),zr=Ze((r,e,t)=>{if(r[e]!==void 0&&typeof t=="function")return r[e]=t(r[e]),!0}),Ur=Ze((r,e,t)=>{if(Array.isArray(r[e])&&typeof t=="function")return r[e]=t(r[e]),!0});var gr=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,yr=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,vr=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function _r(r,e){if(r==="__proto__"||r==="constructor"&&e&&typeof e=="object"&&"prototype"in e){br(r);return}return e}function br(r){console.warn(`[destr] Dropping "${r}" key to prevent prototype pollution.`)}function $e(r,e={}){if(typeof r!="string")return r;let t=r.trim();if(r[0]==='"'&&r.at(-1)==='"'&&!r.includes("\\"))return t.slice(1,-1);if(t.length<=9){let n=t.toLowerCase();if(n==="true")return!0;if(n==="false")return!1;if(n==="undefined")return;if(n==="null")return null;if(n==="nan")return Number.NaN;if(n==="infinity")return Number.POSITIVE_INFINITY;if(n==="-infinity")return Number.NEGATIVE_INFINITY}if(!vr.test(r)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return r}try{if(gr.test(r)||yr.test(r)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(r,_r)}return JSON.parse(r)}catch(n){if(e.strict)throw n;return r}}import{createServer as xr}from"node:net";import{networkInterfaces as wr}from"node:os";var kr=new Set([1,7,9,11,13,15,17,19,20,21,22,23,25,37,42,43,53,69,77,79,87,95,101,102,103,104,109,110,111,113,115,117,119,123,135,137,139,143,161,179,389,427,465,512,513,514,515,526,530,531,532,540,548,554,556,563,587,601,636,989,990,993,995,1719,1720,1723,2049,3659,4045,5060,5061,6e3,6566,6665,6666,6667,6668,6669,6697,10080]);function Tr(r){return kr.has(r)}function Cr(r){return!Tr(r)}function Nr(r,e){r&&console.log(`[get-port] ${e}`)}function Ge(r,e){return new Promise(t=>{let n=xr();n.unref(),n.on("error",()=>{t(!1)}),n.listen({port:r,host:e},()=>{let{port:s}=n.address();n.close(()=>{t(Cr(s)&&s)})})})}function Ar(r){let e=new Set(r);for(let t of Object.values(wr()))for(let n of t||[])n.address&&!n.internal&&!n.address.startsWith("fe80::")&&e.add(n.address);return[...e]}function Sr(r){return r?`on host ${JSON.stringify(r)}`:"on any host"}async function Me(r,e=process.env.HOST,t){if(e||(e=Ar([void 0,"0.0.0.0"])),!Array.isArray(e))return Ge(r,e);for(let n of e){let s=await Ge(r,n);if(s===!1)return r<1024&&t&&Nr(t,`Unable to listen to the priviliged port ${r} ${Sr(n)}`),!1;r===0&&s!==0&&(r=s)}return r}import{existsSync as $,readFileSync as tt}from"node:fs";import{relative as Ce,resolve as M}from"node:path";import{loadConfigFromFile as Er}from"vite";var te=O("yellow"),Te=O("green"),Ke=O("red"),Xe=O("cyan"),me=O("bold"),Qe=O("underline"),sn=O("italic"),an=O("magentaBright"),rt={"arg.build.watch":"Whether the build should start watching and rebuild when files change or not.","arg.config":"The path to the app configuration file.","arg.debug":"Whether to output debug information or not.","arg.entries.app":"The entry file for the app.","arg.entries.manifest":"The entry file for the app manifest.","arg.jwt.app":"Token app name.","arg.jwt.expiration":"Token expiration time compatible with https://npmjs.com/package/ms.","arg.jwt.user.email":"Token user email.","arg.jwt.user.name":"Token user name.","arg.jwt.user.permission":"Token user permission(s).","arg.jwt.user.sub":"Token user object id.","arg.jwt.user.type":"Token user type.","arg.jwt.workspace":"Token workspace name.","arg.mode":"Which mode to use when building the app.","arg.public-key.clean":"Whether to exclude the -----BEGIN PUBLIC KEY----- prefix and -----END PUBLIC KEY----- suffix or not.","arg.public-key.type":"Type of public key.","arg.serve.logging":"Whether the server and browser console should output more log information or not.","arg.serve.open":"Whether the server should automatically open in your browser or not.","arg.serve.ports.gateway":"The port that the gateway should use.","arg.serve.ports.server":"The port that the server should use.","arg.upgrade.next":"Whether or not the CLI should include the 'next' tag when upgrading @telia-ace packages.","changes.upgraded":`Upgraded ${te("'{{pkg}}'")} to ${Te("'{{v}}'")}`,"command.build":"Builds an Alliance app.","command.jwt":"Creates an Alliance JWT.","command.public-key":"Creates a public key used to verify an Alliance JWT.","command.serve":"Starts the Alliance development server.","command.upgrade":"Upgrades Alliance app(s).","errors.invalid-manifest":"Invalid app manifest","errors.no-entry":"Could not find any app and/or manifest entry file at '{{app}}' or '{{manifest}}'","errors.npm-error":"Could not get upgrade information from NPM.","errors.port-busy":"Port {{busy}} is busy","info.gateway-url":`${me("Gateway:")} ${Qe(Xe("{{url}}"))}`,"info.header.changes":"Changes","info.header.recommendations":"Recommendations","info.header.warnings":"Warnings","info.next-steps":"Next steps:","info.server-url":`${me("Server:")} ${Qe(Xe("{{url}}"))}`,"info.steps.install":`Run ${te("'{{cmd}}'")} to install the changed package versions`,"info.steps.warnings":`Address the ${Ke("warnings")} and ${te("recommendations")} detailed above`,"info.stop-server":me("Press CTRL + C to stop the server."),"info.upgraded":`Upgraded ${te("'{{pkg}}'")} to ${Te("'{{v}}'")}`,"recommendations.upgrade":`Upgrade ${te("'{{pkg}}'")} to ${Te("'{{v}}'")}`,"warnings.change":`Change ${te("'{{property}}'")} from ${Ke("'{{current}}'")} to ${Te("'{{new}}'")}`,"warnings.remove":`Remove ${te("'{{property}}'")}{{alt}}`},on=Object.keys(rt);function re(r,e={}){return Object.entries(e).reduce((t,[n,s])=>t.replaceAll(`{{${n}}}`,String(s)),rt[r]).trim()}var cn={type:"string",description:re("arg.config"),required:!1,alias:"c",valueHint:"./alliance.config.ts"},dn={type:"boolean",description:re("arg.debug"),required:!1,default:!1,alias:"d"};function un({debug:r,input:e,output:t}){r&&(I.log(me(Ae("cyan","Input:"))),console.log(JSON.stringify(e,null,2),`
|
|
7
|
+
`),I.log(me(Ae("cyan","Output:")))),console.log(t,`
|
|
8
|
+
`)}var et=["./src/app.ts","./src/app.js","./src/app.mts","./src/app.mjs","./src/app.cts","./src/app.cjs"],jr=["alliance.config.js","alliance.config.mjs","alliance.config.ts","alliance.config.cjs","alliance.config.mts","alliance.config.cts","alliance.config.json"];async function Or(r,e){let t;if(e?t=M(process.cwd(),e):t=Rr(),t&&$(t)){if(t.endsWith(".json"))return $e(tt(t).toString());try{return(await Er(r,t))?.config||{}}catch(n){I.error(n.message),process.exit(1)}}return{}}function Ir(r){let e=M(process.cwd(),r.app);if(r.manifest=M(process.cwd(),r.manifest),!et.includes(r.app))return r.app=e,r;for(let t of et){let n=M(process.cwd(),t);if($(n)){r.app=n;break}}return r}function Rr(){let r=jr.reduce((e,t)=>{if(e.length)return e;let n=M(process.cwd(),t);return $(n)?n:e},"");if($(r))return r}async function ln(r,e="",t={}){let n=Ye(t,await Or(r,e));!n.build?.mode&&(n.build?.watch||r.command==="serve")&&(n.build={...n.build,mode:"development"});let s=he.parse(n);return r.command==="serve"&&(await Me(s.server.ports.server)||(I.error(re("errors.port-busy",{busy:s.server.ports.server})),process.exit(1)),await Me(s.server.ports.gateway)||(I.error(re("errors.port-busy",{busy:s.server.ports.gateway})),process.exit(1))),{...s,entries:Ir(s.entries)}}function fn(r,e){let t={};if($(e.entries.manifest)){let n=$e(tt(e.entries.manifest).toString()),s=Fe(n,re("errors.invalid-manifest"));typeof s=="string"&&(I.error(s),process.exit(1)),t.ALLIANCE_APP_MANIFEST=s,t.ALLIANCE_APP_NAME=JSON.stringify(s.name)}return r==="build"&&(!$(e.entries.manifest)||!$(e.entries.app))&&(I.error(re("errors.no-entry",{app:Ce(process.cwd(),M(e.entries.app)),manifest:Ce(process.cwd(),M(e.entries.manifest))})),process.exit(1)),r==="serve"&&(t.ALLIANCE_ENVIRONMENT={logging:e.server.logging}),t}function pn({entries:r,server:e}){let t=[];$(r.app)&&$(r.manifest)&&t.push({packageName:"entry",appImportPath:r.app,manifestImportPath:r.manifest});for(let n of e.apps)t.push({packageName:n,appImportPath:`${n}/app`,manifestImportPath:`${n}/manifest`});return t.length||(I.error(re("errors.no-entry",{app:Ce(process.cwd(),M(r.app)),manifest:Ce(process.cwd(),M(r.manifest))})),process.exit(1)),t}export{$e as a,te as b,Te as c,Ke as d,Xe as e,me as f,Qe as g,on as h,re as i,cn as j,dn as k,un as l,ln as m,fn as n,pn as o};
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as c__createRequire } from 'node:module';
|
|
3
3
|
const require = c__createRequire(import.meta.url);
|
|
4
|
-
import{a}from"./chunk-TTCH5DKE.js";import{i,l as n}from"./chunk-AEIX73UA.js";var l="@telia-ace/alliance-cli",o="1.1.0-next.
|
|
4
|
+
import{a}from"./chunk-TTCH5DKE.js";import{i,l as n}from"./chunk-AEIX73UA.js";var l="@telia-ace/alliance-cli",o="1.1.0-next.3",s="CLI used when developing ACE Alliance apps.";try{await a({meta:{name:l,version:o,description:s},subCommands:{build:()=>import("./build-I3X32XDY.js").then(e=>e.default),serve:()=>import("./serve-ZS6GYL4L.js").then(e=>e.default),jwt:()=>import("./jwt-664I4MZH.js").then(e=>e.default),"public-key":()=>import("./public-key-P2YSCBG2.js").then(e=>e.default),upgrade:()=>import("./upgrade-V6EYUERP.js").then(e=>e.default)}})}catch(e){n.error(i("bold",i("red","Error:")),i("bold",e?.message||"something went wrong"))}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as c__createRequire } from 'node:module';
|
|
2
2
|
const require = c__createRequire(import.meta.url);
|
|
3
|
-
import{i as r,k as p,l as a}from"./chunk-
|
|
3
|
+
import{i as r,k as p,l as a}from"./chunk-3NIYGSPA.js";import"./chunk-TTCH5DKE.js";import"./chunk-AEIX73UA.js";import{createBearerToken as o,getPrivateKey as u,slugify as m,zSharedConfig as d}from"@telia-ace/alliance-internal-node-utilities";var c={meta:{name:"jwt",description:r("command.jwt")},args:{app:{type:"string",description:r("arg.jwt.app"),required:!1,alias:"a",default:"the-app"},workspace:{type:"string",description:r("arg.jwt.workspace"),required:!1,alias:"w",default:"The Workspace"},expiration:{type:"string",description:r("arg.jwt.expiration"),required:!1,alias:"e",default:"1d"},"user.name":{type:"string",description:r("arg.jwt.user.name"),required:!1,default:"John Doe"},"user.type":{type:"string",description:r("arg.jwt.user.type"),required:!1,default:"user",valueHint:"user|system-admin|system"},"user.email":{type:"string",description:r("arg.jwt.user.email"),required:!1,default:"john.doe@mail.com"},"user.permission":{type:"string",description:r("arg.jwt.user.permission"),required:!1,alias:"p"},"user.sub":{type:"string",description:r("arg.jwt.user.sub"),required:!1,alias:"s",default:"2ccaa1b2-5e34-4dd7-bb47-28435e973969"},debug:p},run({args:e}){let i=[];if(Array.isArray(e["user.permission"]))for(let t of e["user.permission"])typeof t=="string"&&i.push(t);else typeof e["user.permission"]=="string"&&i.push(e["user.permission"]);let s={user:{name:e["user.name"],email:e["user.email"],permissions:i,sub:e["user.sub"],type:e["user.type"]},app:e.app,workspace:{name:e.workspace,slug:m(e.workspace)},expiration:e.expiration},n=o({...s,aud:s.app,name:s.user.name,sub:s.user.sub,privateKey:u(d.pick({JWT_PRIVATE_KEY:!0}).parse({}))});a({debug:e.debug,input:s,output:n})}};export{c as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as c__createRequire } from 'node:module';
|
|
2
2
|
const require = c__createRequire(import.meta.url);
|
|
3
|
-
import{i as t,k as l,l as c}from"./chunk-
|
|
3
|
+
import{i as t,k as l,l as c}from"./chunk-3NIYGSPA.js";import"./chunk-TTCH5DKE.js";import"./chunk-AEIX73UA.js";import{createPublicKeys as a,getCleanPublicKey as n,zSharedConfig as o}from"@telia-ace/alliance-internal-node-utilities";var r={meta:{name:"public-key",description:t("command.public-key")},args:{type:{type:"string",required:!1,default:"spki",alias:"t",description:t("arg.public-key.type"),valueHint:"pkcs|spki|csp"},clean:{type:"boolean",required:!1,default:!1,alias:"c",description:t("arg.public-key.clean")},debug:l},run({args:i}){let e={clean:i.clean,type:i.type},p=a(o.pick({JWT_PUBLIC_CSP_KEY:!0,JWT_PRIVATE_KEY:!0}).parse({})),u=e.clean?n(e.type,p):p[e.type];c({debug:i.debug,input:e,output:u})}};export{r as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as c__createRequire } from 'node:module';
|
|
2
2
|
const require = c__createRequire(import.meta.url);
|
|
3
|
-
import{a as p,i as r,j as l,m,n as f,o as c}from"./chunk-
|
|
3
|
+
import{a as p,i as r,j as l,m,n as f,o as c}from"./chunk-3NIYGSPA.js";import"./chunk-TTCH5DKE.js";import{l as s}from"./chunk-AEIX73UA.js";import{start as h}from"@telia-ace/alliance-gateway/dev";import{createIndexHtml as S,getAppManifests as x}from"@telia-ace/alliance-internal-node-utilities";import{existsSync as v,readFileSync as b,rmSync as A}from"node:fs";import{onExit as D}from"signal-exit";import y from"node:dns";import{createServer as g}from"vite";var w=process.env.CI==="true"||process.env.NODE_ENV==="test";async function d(e){let t=f("serve",e);y.setDefaultResultOrder("verbatim");let i=await g({plugins:e.vite.plugins,configFile:!1,mode:e.build.mode,server:{open:e.server.open,port:e.server.ports.server,host:"localhost",proxy:{"/-/":{target:`http://localhost:${e.server.ports.gateway}/`,prependPath:!1,rewrite:o=>o.replace("/-/","/")}},strictPort:!0},clearScreen:!1,resolve:{alias:e.vite.alias},define:t}).then(o=>o.listen());return(w?console.log:s.box)([r("info.server-url",{url:`http://localhost:${e.server.ports.server}`}),r("info.gateway-url",{url:`http://localhost:${e.server.ports.gateway}`}),r("info.stop-server")].join(`
|
|
4
4
|
`)),i}async function u(e){let t,i,o;D(()=>{if(t)try{t.close()}catch(n){s.error(n)}if(i&&v(i))try{A(i,{force:!0})}catch(n){s.error(n)}if(o)try{o.close()}catch(n){s.error(n)}});let a=await x(e.server.apps);v(e.entries.manifest)&&a.unshift(p(b(e.entries.manifest).toString())),t=await h(e,a),i=S(c(e)),o=await d(e)}var _={meta:{name:"serve",description:r("command.serve")},args:{"ports.server":{type:"string",description:r("arg.serve.ports.server"),required:!1},"ports.gateway":{type:"string",description:r("arg.serve.ports.gateway"),required:!1},"entries.app":{type:"string",valueHint:"./src/app.ts",description:r("arg.entries.app"),required:!1},"entries.manifest":{type:"string",valueHint:"./src/manifest.json",description:r("arg.entries.manifest"),required:!1},mode:{type:"string",default:"development",alias:"m",description:r("arg.mode"),required:!1},logging:{type:"boolean",default:!1,alias:"l",description:r("arg.serve.logging"),required:!1},open:{type:"boolean",default:!1,alias:"o",description:r("arg.serve.open"),required:!1},config:l},async run({args:e}){let t=await m({command:"serve",mode:e.mode||"production"},e.config,{build:{mode:e.mode},server:{open:e.open,ports:{gateway:e["ports.gateway"]?Number(e["ports.gateway"]):void 0,server:e["ports.server"]?Number(e["ports.server"]):void 0},logging:e.logging},entries:{app:e["entries.app"],manifest:e["entries.manifest"]}});await u(t)}};export{_ as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as c__createRequire } from 'node:module';
|
|
2
2
|
const require = c__createRequire(import.meta.url);
|
|
3
|
-
import{a as P,b as I,c as C,d as z,e as M,f as E,g as A,h as F,i as p}from"./chunk-
|
|
3
|
+
import{a as P,b as I,c as C,d as z,e as M,f as E,g as A,h as F,i as p}from"./chunk-3NIYGSPA.js";import"./chunk-TTCH5DKE.js";import{a as b,c as O,e as fe,l as S}from"./chunk-AEIX73UA.js";var X=O((Ne,B)=>{"use strict";var H=process.platform==="win32",ue=H?"\\\\+":"\\/",T=H?"\\\\":"/",ge="((?:[^/]*(?:/|$))*)",pe="([^/]*)",k=`((?:[^${T}]*(?:${T}|$))*)`,de=`([^${T}]*)`;function me(e,{extended:r=!1,globstar:t=!1,strict:l=!1,filepath:i=!1,flags:s=""}={}){let c="",a="",m={regex:"",segments:[]},w=!1,h=!1,d=[];function o(f,{split:g,last:R,only:$}={}){$!=="path"&&(c+=f),i&&$!=="regex"&&(m.regex+=f==="\\/"?ue:f,g?(R&&(a+=f),a!==""&&(s.includes("g")||(a=`^${a}$`),m.segments.push(new RegExp(a,s))),a=""):a+=f)}let n,u;for(let f=0;f<e.length;f++){if(n=e[f],u=e[f+1],["\\","$","^",".","="].includes(n)){o(`\\${n}`);continue}if(n==="/"){o(`\\${n}`,{split:!0}),u==="/"&&!l&&(c+="?");continue}if(n==="("){if(d.length){o(n);continue}o(`\\${n}`);continue}if(n===")"){if(d.length){o(n);let g=d.pop();o(g==="@"?"{1}":g==="!"?"([^/]*)":g);continue}o(`\\${n}`);continue}if(n==="|"){if(d.length){o(n);continue}o(`\\${n}`);continue}if(n==="+"){if(u==="("&&r){d.push(n);continue}o(`\\${n}`);continue}if(n==="@"&&r&&u==="("){d.push(n);continue}if(n==="!"){if(r){if(h){o("^");continue}if(u==="("){d.push(n),o("(?!"),f++;continue}o(`\\${n}`);continue}o(`\\${n}`);continue}if(n==="?"){if(r){u==="("?d.push(n):o(".");continue}o(`\\${n}`);continue}if(n==="["){if(h&&u===":"){f++;let g="";for(;e[++f]!==":";)g+=e[f];g==="alnum"?o("(\\w|\\d)"):g==="space"?o("\\s"):g==="digit"&&o("\\d"),f++;continue}if(r){h=!0,o(n);continue}o(`\\${n}`);continue}if(n==="]"){if(r){h=!1,o(n);continue}o(`\\${n}`);continue}if(n==="{"){if(r){w=!0,o("(");continue}o(`\\${n}`);continue}if(n==="}"){if(r){w=!1,o(")");continue}o(`\\${n}`);continue}if(n===","){if(w){o("|");continue}o(`\\${n}`);continue}if(n==="*"){if(u==="("&&r){d.push(n);continue}let g=e[f-1],R=1;for(;e[f+1]==="*";)R++,f++;let $=e[f+1];t?R>1&&(g==="/"||g===void 0)&&($==="/"||$===void 0)?(o(ge,{only:"regex"}),o(k,{only:"path",last:!0,split:!0}),f++):(o(pe,{only:"regex"}),o(de,{only:"path"})):o(".*");continue}o(n)}s.includes("g")||(c=`^${c}$`,a=`^${a}$`,i&&(m.regex=`^${m.regex}$`));let y={regex:new RegExp(c,s)};return i&&(m.segments.push(new RegExp(a,s)),m.regex=new RegExp(m.regex,s),m.globstar=new RegExp(s.includes("g")?k:`^${k}$`,s),y.path=m),y}B.exports=me});var V=O((Ge,U)=>{"use strict";var he=b("os"),K=b("path"),ye=he.platform()==="win32",we={"{":"}","(":")","[":"]"},xe=/\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\)|(\\).|([@?!+*]\(.*\)))/,$e=/\\(.)|(^!|[*?{}()[\]]|\(\?)/;function Q(e,{strict:r=!0}={}){if(e==="")return!1;let t,l=r?xe:$e;for(;t=l.exec(e);){if(t[2])return!0;let i=t.index+t[0].length,s=t[1],c=s?we[s]:null;if(s&&c){let a=e.indexOf(c,i);a!==-1&&(i=a+1)}e=e.slice(i)}return!1}function be(e,{strict:r=!1}={}){ye&&e.includes("/")&&(e=e.split("\\").join("/")),/[\{\[].*[\/]*.*[\}\]]$/.test(e)&&(e+="/"),e+="a";do e=K.dirname(e);while(Q(e,{strict:r})||/(^|[^\\])([\{\[]|\([^\)]+$)/.test(e));return e.replace(/\\([\*\?\|\[\]\(\)\{\}])/g,"$1")}function ve(e,r={}){let t=be(e,r),l=Q(e,r),i;return t!="."?(i=e.substr(t.length),i.startsWith("/")&&(i=i.substr(1))):i=e,l||(t=K.dirname(e),i=t!=="."?e.substr(t.length):e),i.startsWith("./")&&(i=i.substr(2)),i.startsWith("/")&&(i=i.substr(1)),{base:t,glob:i,isGlob:l}}U.exports=ve});var ne=O((qe,ee)=>{"use strict";var j=b("fs"),Re=X(),{promisify:Y}=b("util"),Se=V(),{join:_,resolve:D,relative:Ce}=b("path"),Ee=/(^|[\\\/])\.[^\\\/\.]/g,Ae=Y(j.readdir),Oe=Y(j.stat),W={};async function Z(e,r,t,l,i="",s=0){let c=t.segments[s],a=D(l.cwd,r,i),m=await Ae(a),{dot:w,filesOnly:h}=l,d=0,o=m.length,n,u,y,f,g;for(;d<o;d++)if(u=_(a,n=m[d]),y=i?_(i,n):n,!(!w&&Ee.test(y))){if(g=t.regex.test(y),(f=W[y])===void 0&&(W[y]=f=j.lstatSync(u)),!f.isDirectory()){g&&e.push(Ce(l.cwd,u));continue}c&&!c.test(n)||(!h&&g&&e.push(_(r,y)),await Z(e,r,t,l,y,c&&c.toString()!==t.globstar&&s+1))}}ee.exports=async function(e,r={}){if(!e)return[];let t=Se(e);if(r.cwd=r.cwd||".",!t.isGlob)try{let s=D(r.cwd,e),c=await Oe(s);return r.filesOnly&&!c.isFile()?[]:r.absolute?[s]:[e]}catch(s){if(s.code!="ENOENT")throw s;return[]}r.flush&&(W={});let l=[],{path:i}=Re(t.glob,{filepath:!0,globstar:!0,extended:!0});return i.globstar=i.globstar.toString(),await Z(l,t.base,i,r,".",0),r.absolute?l.map(s=>D(r.cwd,s)):l}});var re=fe(ne(),1);import Pe from"detect-indent";import{loadFile as ze}from"magicast";import{getDefaultExportOptions as ke}from"magicast/helpers";import{existsSync as N,readFileSync as J,writeFileSync as Te}from"node:fs";import{dirname as _e,relative as ie,resolve as v,sep as q}from"node:path";import{run as De}from"npm-check-updates";function x(...e){let r=" ";return(t,l)=>e.reduce((i,s)=>typeof s=="number"?`${new Array(s).fill(r).join("")}${i}`:typeof s=="string"?`${s}${i}`:s(i),F.includes(t)?p(t,l):t)}async function oe(e){let r=await De({deep:!0,cwd:process.cwd(),filter:t=>t.startsWith("@telia-ace")||["typescript","vite"].includes(t),target:t=>t.startsWith("@telia-ace")&&e?"@next":"@latest"});return r||(S.error(p("errors.npm-error")),process.exit(1)),Promise.all(Object.entries(r).filter(([t])=>{try{return J(v(t)).toString().includes("@telia-ace")}catch{return!1}}).map(async([t,l])=>{let i=v(_e(t)),s=v(i,"tsconfig.json"),c=v(i,"package.json"),[a]=await(0,re.default)(`${te(i)}/alliance.config*`);return{path:te(ie(process.cwd(),i)),packageJson:N(c)?G(c,i):void 0,tsConfigJson:N(s)?G(s,i):void 0,allianceConfig:N(a)?G(a,i):void 0,upgrades:l}}))}async function se({tsConfigJson:e}){if(!e)return;let{warn:r,error:t,output:l}=L(e.relative);try{let i=P(J(e.full).toString());i?.compilerOptions?.moduleResolution?.toLowerCase()!=="bundler"&&r(p("warnings.change",{property:"compilerOptions.moduleResolution",current:i?.compilerOptions?.moduleResolution,new:"bundler"}))}catch(i){t(i)}l()}async function le({allianceConfig:e}){if(!e)return;let{warn:r,error:t,output:l}=L(e.relative,!1);try{let i=await ze(e.full),s=ke(i);typeof s?.experimental?.logging=="boolean"&&r(p("warnings.remove",{property:"experimental.logging",alt:`, use ${C("'server.logging'")} instead`})),typeof s?.server?.mode<"u"&&r(p("warnings.remove",{property:"experimental.mode",alt:", no longer supported"}))}catch(i){t(i)}l()}async function ce({packageJson:e,allianceConfig:r,tsConfigJson:t,upgrades:l}){if(!e)return;let{change:i,warn:s,output:c,error:a,recommend:m}=L(e.relative,!!r||!!t);try{let w=J(e.full).toString(),h=P(w);if(h.alliance?.apps&&s(p("warnings.remove",{property:"alliance.apps",alt:`, use the app config ${C("'server.apps'")} option instead`})),h.scripts){let o=Object.entries(h.scripts).filter(([n,u])=>u.includes("create alliance")||u.includes("create-alliance"));for(let[n,u]of o)try{u.includes("serve")||u.includes("server")?(s(p("warnings.change",{property:`scripts.${n}`,current:u,new:"npx @telia-ace/alliance-cli serve"})),u.includes("--server-mode")&&s(p("warnings.remove",{property:"--server-mode",alt:", no longer supported"}))):u.includes("build")&&s(p("warnings.change",{property:`scripts.${n}`,current:u,new:"npx @telia-ace/alliance-cli build"}))}catch(y){a(y)}}let d=o=>{if(o)for(let n of Object.keys(o))!n.startsWith("@telia-ace")||!l[n]||(o[n]=l[n])};d(h.dependencies),d(h.devDependencies);for(let[o,n]of Object.entries(l))o.startsWith("@telia-ace")?i(p("changes.upgraded",{pkg:o,v:n})):m(p("recommendations.upgrade",{pkg:o,v:n}));Te(e.full,JSON.stringify(h,null,Pe(w).indent))}catch(w){a(w)}c()}function L(e,r=!0){let t=[],l=[],i=[],s=[];return{warn:c=>l.push(c),change:c=>t.push(c),recommend:c=>i.push(c),error:c=>s.push(c),output:()=>{if(!t.length&&!l.length&&!i.length)return;console.log(x(M,1)(e));let c=x("- ",2);if(t.length){console.log(x(2,C)("info.header.changes"));for(let a of t)console.log(c(a))}if(l.length){console.log(x(2,z)("info.header.warnings"));for(let a of l)console.log(c(a))}if(i.length){console.log(x(2,I)("info.header.recommendations"));for(let a of i)console.log(c(a))}if(s.length){console.log(x(2,z)("Errors"));for(let a of s)S.error(c(a))}r&&console.log()}}}function te(e){return e.replaceAll(q,"/")}function G(e,r=process.cwd()){let t=v(process.cwd(),e);return{full:t.replaceAll(q,"/"),relative:ie(r,t).replaceAll(q,"/")}}function ae(){let e=We();return S.log(x(A,E)("info.next-steps")),console.log([p("info.steps.warnings"),p("info.steps.install",{cmd:`${e} install`})].map(r=>x("- ",1)(r)).join(`
|
|
4
4
|
`))}function We(){try{if(!process.env.npm_config_user_agent)return"npm";let r=process.env.npm_config_user_agent.split(" ")[0],t=r.lastIndexOf("/"),l=r.substring(0,t);return l==="npminstall"?"cnpm":l}catch{return"npm"}}var Ye={meta:{name:"upgrade",description:p("command.upgrade")},args:{next:{type:"boolean",description:p("arg.upgrade.next"),default:!1,required:!1,alias:"n"}},async run(e){let r=await oe(e.args.next);for(let t of r)console.log(),console.log(x(A,E)(t.path||"root")),await ce(t),await se(t),await le(t);console.log(),ae(),console.log()}};export{Ye as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/alliance-cli",
|
|
3
|
-
"version": "1.1.0-next.
|
|
3
|
+
"version": "1.1.0-next.3",
|
|
4
4
|
"description": "CLI used when developing ACE Alliance apps.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"type": "module",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"npm-check-updates": "^16.14.11",
|
|
19
19
|
"signal-exit": "^4.1.0",
|
|
20
20
|
"vite": "^5.0.7",
|
|
21
|
-
"@telia-ace/alliance-gateway": "^1.1.0-next.
|
|
21
|
+
"@telia-ace/alliance-gateway": "^1.1.0-next.1",
|
|
22
22
|
"@telia-ace/alliance-internal-node-utilities": "^1.1.0-next.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@telia-ace/alliance-framework": "^1.1.0-next.
|
|
25
|
+
"@telia-ace/alliance-framework": "^1.1.0-next.1"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
28
28
|
"node": ">=15.0.0"
|
package/dist/chunk-2QT2TRN4.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { createRequire as c__createRequire } from 'node:module';
|
|
2
|
-
const require = c__createRequire(import.meta.url);
|
|
3
|
-
import{h as O,i as Ne,l as A}from"./chunk-AEIX73UA.js";var _;(function(t){t.assertEqual=n=>n;function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let i={};for(let s of n)i[s]=s;return i},t.getValidEnumValues=n=>{let i=t.objectKeys(n).filter(d=>typeof n[n[d]]!="number"),s={};for(let d of i)s[d]=n[d];return t.objectValues(s)},t.objectValues=n=>t.objectKeys(n).map(function(i){return n[i]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&i.push(s);return i},t.find=(n,i)=>{for(let s of n)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function a(n,i=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=a,t.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(_||(_={}));var Oe;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Oe||(Oe={}));var l=_.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),I=t=>{switch(typeof t){case"undefined":return l.undefined;case"string":return l.string;case"number":return isNaN(t)?l.nan:l.number;case"boolean":return l.boolean;case"function":return l.function;case"bigint":return l.bigint;case"symbol":return l.symbol;case"object":return Array.isArray(t)?l.array:t===null?l.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?l.promise:typeof Map<"u"&&t instanceof Map?l.map:typeof Set<"u"&&t instanceof Set?l.set:typeof Date<"u"&&t instanceof Date?l.date:l.object;default:return l.unknown}},o=_.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"]),yt=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Z=class extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let e=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){let e=t||function(n){return n.message},r={_errors:[]},a=n=>{for(let i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)r._errors.push(e(i));else{let s=r,d=0;for(;d<i.path.length;){let u=i.path[d];d===i.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(e(i))):s[u]=s[u]||{_errors:[]},s=s[u],d++}}};return a(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,_.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=e=>e.message){let e={},r=[];for(let a of this.issues)a.path.length>0?(e[a.path[0]]=e[a.path[0]]||[],e[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:e}}get formErrors(){return this.flatten()}};Z.create=t=>new Z(t);var q=(t,e)=>{let r;switch(t.code){case o.invalid_type:t.received===l.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case o.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,_.jsonStringifyReplacer)}`;break;case o.unrecognized_keys:r=`Unrecognized key(s) in object: ${_.joinValues(t.keys,", ")}`;break;case o.invalid_union:r="Invalid input";break;case o.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${_.joinValues(t.options)}`;break;case o.invalid_enum_value:r=`Invalid enum value. Expected ${_.joinValues(t.options)}, received '${t.received}'`;break;case o.invalid_arguments:r="Invalid function arguments";break;case o.invalid_return_type:r="Invalid function return type";break;case o.invalid_date:r="Invalid date";break;case o.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:_.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case o.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case o.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case o.custom:r="Invalid input";break;case o.invalid_intersection_types:r="Intersection results could not be merged";break;case o.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case o.not_finite:r="Number must be finite";break;default:r=e.defaultError,_.assertNever(t)}return{message:r}},Ke=q;function vt(t){Ke=t}function he(){return Ke}var fe=t=>{let{data:e,path:r,errorMaps:a,issueData:n}=t,i=[...r,...n.path||[]],s={...n,path:i},d="",u=a.filter(h=>!!h).slice().reverse();for(let h of u)d=h(s,{data:e,defaultError:d}).message;return{...n,path:i,message:n.message||d}},_t=[];function c(t,e){let r=fe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,he(),q].filter(a=>!!a)});t.common.issues.push(r)}var w=class Be{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let a=[];for(let n of r){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,r){let a=[];for(let n of r)a.push({key:await n.key,value:await n.value});return Be.mergeObjectSync(e,a)}static mergeObjectSync(e,r){let a={};for(let n of r){let{key:i,value:s}=n;if(i.status==="aborted"||s.status==="aborted")return m;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(a[i.value]=s.value)}return{status:e.value,value:a}}},m=Object.freeze({status:"aborted"}),qe=t=>({status:"dirty",value:t}),b=t=>({status:"valid",value:t}),Ae=t=>t.status==="aborted",Se=t=>t.status==="dirty",J=t=>t.status==="valid",me=t=>typeof Promise<"u"&&t instanceof Promise,p;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(p||(p={}));var C=class{constructor(t,e,r,a){this._cachedPath=[],this.parent=t,this.data=e,this._path=r,this._key=a}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}},Ve=(t,e)=>{if(J(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Z(t.common.issues);return this._error=r,this._error}}};function g(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:a,description:n}=t;if(e&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,s)=>i.code!=="invalid_type"?{message:s.defaultError}:typeof s.data>"u"?{message:a??s.defaultError}:{message:r??s.defaultError},description:n}}var v=class{constructor(t){this.spa=this.safeParseAsync,this._def=t,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(t){return I(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:I(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new w,ctx:{common:t.parent.common,data:t.data,parsedType:I(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let e=this._parse(t);if(me(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(t){let e=this._parse(t);return Promise.resolve(e)}parse(t,e){let r=this.safeParse(t,e);if(r.success)return r.data;throw r.error}safeParse(t,e){var r;let a={common:{issues:[],async:(r=e?.async)!==null&&r!==void 0?r:!1,contextualErrorMap:e?.errorMap},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:I(t)},n=this._parseSync({data:t,path:a.path,parent:a});return Ve(a,n)}async parseAsync(t,e){let r=await this.safeParseAsync(t,e);if(r.success)return r.data;throw r.error}async safeParseAsync(t,e){let r={common:{issues:[],contextualErrorMap:e?.errorMap,async:!0},path:e?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:I(t)},a=this._parse({data:t,path:r.path,parent:r}),n=await(me(a)?a:Promise.resolve(a));return Ve(r,n)}refine(t,e){let r=a=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(a):e;return this._refinement((a,n)=>{let i=t(a),s=()=>n.addIssue({code:o.custom,...r(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(s(),!1)):i?!0:(s(),!1)})}refinement(t,e){return this._refinement((r,a)=>t(r)?!0:(a.addIssue(typeof e=="function"?e(r,a):e),!1))}_refinement(t){return new N({schema:this,typeName:f.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return S.create(this,this._def)}nullable(){return M.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return L.create(this,this._def)}promise(){return K.create(this,this._def)}or(t){return te.create([this,t],this._def)}and(t){return re.create(this,t,this._def)}transform(t){return new N({...g(this._def),schema:this,typeName:f.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let e=typeof t=="function"?t:()=>t;return new se({...g(this._def),innerType:this,defaultValue:e,typeName:f.ZodDefault})}brand(){return new tt({typeName:f.ZodBranded,type:this,...g(this._def)})}catch(t){let e=typeof t=="function"?t:()=>t;return new be({...g(this._def),innerType:this,catchValue:e,typeName:f.ZodCatch})}describe(t){let e=this.constructor;return new e({...this._def,description:t})}pipe(t){return Le.create(this,t)}readonly(){return we.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},bt=/^c[^\s-]{8,}$/i,xt=/^[a-z][a-z0-9]*$/,wt=/^[0-9A-HJKMNP-TV-Z]{26}$/,kt=/^[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,Tt=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ce,Nt=/^(((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}))$/,Ct=/^(([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})))$/,Ot=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function At(t,e){return!!((e==="v4"||!e)&&Nt.test(t)||(e==="v6"||!e)&&Ct.test(t))}var V=class B extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==l.string){let n=this._getOrReturnCtx(e);return c(n,{code:o.invalid_type,expected:l.string,received:n.parsedType}),m}let r=new w,a;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:o.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:o.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="length"){let i=e.data.length>n.value,s=e.data.length<n.value;(i||s)&&(a=this._getOrReturnCtx(e,a),i?c(a,{code:o.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):s&&c(a,{code:o.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),r.dirty())}else if(n.kind==="email")Tt.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"email",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="emoji")Ce||(Ce=new RegExp(Zt,"u")),Ce.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"emoji",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="uuid")kt.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"uuid",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid")bt.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"cuid",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid2")xt.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"cuid2",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="ulid")wt.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"ulid",code:o.invalid_string,message:n.message}),r.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),c(a,{validation:"url",code:o.invalid_string,message:n.message}),r.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"regex",code:o.invalid_string,message:n.message}),r.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()):n.kind==="datetime"?Ot(n).test(e.data)||(a=this._getOrReturnCtx(e,a),c(a,{code:o.invalid_string,validation:"datetime",message:n.message}),r.dirty()):n.kind==="ip"?At(e.data,n.version)||(a=this._getOrReturnCtx(e,a),c(a,{validation:"ip",code:o.invalid_string,message:n.message}),r.dirty()):_.assertNever(n);return{status:r.value,value:e.data}}_regex(e,r,a){return this.refinement(n=>e.test(n),{validation:r,code:o.invalid_string,...p.errToObj(a)})}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,...p.errToObj(e?.message)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...p.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...p.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...p.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...p.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...p.errToObj(r)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new B({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new B({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new B({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};V.create=t=>{var e;return new V({checks:[],typeName:f.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...g(t)})};function St(t,e){let r=(t.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,n=r>a?r:a,i=parseInt(t.toFixed(n).replace(".","")),s=parseInt(e.toFixed(n).replace(".",""));return i%s/Math.pow(10,n)}var H=class je extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==l.number){let n=this._getOrReturnCtx(e);return c(n,{code:o.invalid_type,expected:l.number,received:n.parsedType}),m}let r,a=new w;for(let n of this._def.checks)n.kind==="int"?_.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:o.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?St(e.data,n.value)!==0&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),c(r,{code:o.not_finite,message:n.message}),a.dirty()):_.assertNever(n);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,p.toString(r))}gt(e,r){return this.setLimit("min",e,!1,p.toString(r))}lte(e,r){return this.setLimit("max",e,!0,p.toString(r))}lt(e,r){return this.setLimit("max",e,!1,p.toString(r))}setLimit(e,r,a,n){return new je({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:p.toString(n)}]})}_addCheck(e){return new je({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&_.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(r)&&Number.isFinite(e)}};H.create=t=>new H({checks:[],typeName:f.ZodNumber,coerce:t?.coerce||!1,...g(t)});var Y=class Ee extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==l.bigint){let n=this._getOrReturnCtx(e);return c(n,{code:o.invalid_type,expected:l.bigint,received:n.parsedType}),m}let r,a=new w;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),c(r,{code:o.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):_.assertNever(n);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,p.toString(r))}gt(e,r){return this.setLimit("min",e,!1,p.toString(r))}lte(e,r){return this.setLimit("max",e,!0,p.toString(r))}lt(e,r){return this.setLimit("max",e,!1,p.toString(r))}setLimit(e,r,a,n){return new Ee({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:a,message:p.toString(n)}]})}_addCheck(e){return new Ee({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Y.create=t=>{var e;return new Y({checks:[],typeName:f.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...g(t)})};var G=class extends v{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==l.boolean){let e=this._getOrReturnCtx(t);return c(e,{code:o.invalid_type,expected:l.boolean,received:e.parsedType}),m}return b(t.data)}};G.create=t=>new G({typeName:f.ZodBoolean,coerce:t?.coerce||!1,...g(t)});var X=class Je extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==l.date){let n=this._getOrReturnCtx(e);return c(n,{code:o.invalid_type,expected:l.date,received:n.parsedType}),m}if(isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return c(n,{code:o.invalid_date}),m}let r=new w,a;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:o.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),c(a,{code:o.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):_.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Je({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};X.create=t=>new X({checks:[],coerce:t?.coerce||!1,typeName:f.ZodDate,...g(t)});var ge=class extends v{_parse(t){if(this._getType(t)!==l.symbol){let e=this._getOrReturnCtx(t);return c(e,{code:o.invalid_type,expected:l.symbol,received:e.parsedType}),m}return b(t.data)}};ge.create=t=>new ge({typeName:f.ZodSymbol,...g(t)});var Q=class extends v{_parse(t){if(this._getType(t)!==l.undefined){let e=this._getOrReturnCtx(t);return c(e,{code:o.invalid_type,expected:l.undefined,received:e.parsedType}),m}return b(t.data)}};Q.create=t=>new Q({typeName:f.ZodUndefined,...g(t)});var ee=class extends v{_parse(t){if(this._getType(t)!==l.null){let e=this._getOrReturnCtx(t);return c(e,{code:o.invalid_type,expected:l.null,received:e.parsedType}),m}return b(t.data)}};ee.create=t=>new ee({typeName:f.ZodNull,...g(t)});var W=class extends v{constructor(){super(...arguments),this._any=!0}_parse(t){return b(t.data)}};W.create=t=>new W({typeName:f.ZodAny,...g(t)});var $=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(t){return b(t.data)}};$.create=t=>new $({typeName:f.ZodUnknown,...g(t)});var j=class extends v{_parse(t){let e=this._getOrReturnCtx(t);return c(e,{code:o.invalid_type,expected:l.never,received:e.parsedType}),m}};j.create=t=>new j({typeName:f.ZodNever,...g(t)});var ye=class extends v{_parse(t){if(this._getType(t)!==l.undefined){let e=this._getOrReturnCtx(t);return c(e,{code:o.invalid_type,expected:l.void,received:e.parsedType}),m}return b(t.data)}};ye.create=t=>new ye({typeName:f.ZodVoid,...g(t)});var L=class le extends v{_parse(e){let{ctx:r,status:a}=this._processInputParams(e),n=this._def;if(r.parsedType!==l.array)return c(r,{code:o.invalid_type,expected:l.array,received:r.parsedType}),m;if(n.exactLength!==null){let s=r.data.length>n.exactLength.value,d=r.data.length<n.exactLength.value;(s||d)&&(c(r,{code:s?o.too_big:o.too_small,minimum:d?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(c(r,{code:o.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(c(r,{code:o.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((s,d)=>n.type._parseAsync(new C(r,s,r.path,d)))).then(s=>w.mergeArray(a,s));let i=[...r.data].map((s,d)=>n.type._parseSync(new C(r,s,r.path,d)));return w.mergeArray(a,i)}get element(){return this._def.type}min(e,r){return new le({...this._def,minLength:{value:e,message:p.toString(r)}})}max(e,r){return new le({...this._def,maxLength:{value:e,message:p.toString(r)}})}length(e,r){return new le({...this._def,exactLength:{value:e,message:p.toString(r)}})}nonempty(e){return this.min(1,e)}};L.create=(t,e)=>new L({type:t,minLength:null,maxLength:null,exactLength:null,typeName:f.ZodArray,...g(e)});function F(t){if(t instanceof k){let e={};for(let r in t.shape){let a=t.shape[r];e[r]=S.create(F(a))}return new k({...t._def,shape:()=>e})}else return t instanceof L?new L({...t._def,type:F(t.element)}):t instanceof S?S.create(F(t.unwrap())):t instanceof M?M.create(F(t.unwrap())):t instanceof R?R.create(t.items.map(e=>F(e))):t}var k=class T extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=_.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==l.object){let u=this._getOrReturnCtx(e);return c(u,{code:o.invalid_type,expected:l.object,received:u.parsedType}),m}let{status:r,ctx:a}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys==="strip"))for(let u in a.data)i.includes(u)||s.push(u);let d=[];for(let u of i){let h=n[u],x=a.data[u];d.push({key:{status:"valid",value:u},value:h._parse(new C(a,x,a.path,u)),alwaysSet:u in a.data})}if(this._def.catchall instanceof j){let u=this._def.unknownKeys;if(u==="passthrough")for(let h of s)d.push({key:{status:"valid",value:h},value:{status:"valid",value:a.data[h]}});else if(u==="strict")s.length>0&&(c(a,{code:o.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let h of s){let x=a.data[h];d.push({key:{status:"valid",value:h},value:u._parse(new C(a,x,a.path,h)),alwaysSet:h in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let u=[];for(let h of d){let x=await h.key;u.push({key:x,value:await h.value,alwaysSet:h.alwaysSet})}return u}).then(u=>w.mergeObjectSync(r,u)):w.mergeObjectSync(r,d)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new T({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,a)=>{var n,i,s,d;let u=(s=(i=(n=this._def).errorMap)===null||i===void 0?void 0:i.call(n,r,a).message)!==null&&s!==void 0?s:a.defaultError;return r.code==="unrecognized_keys"?{message:(d=p.errToObj(e).message)!==null&&d!==void 0?d:u}:{message:u}}}:{}})}strip(){return new T({...this._def,unknownKeys:"strip"})}passthrough(){return new T({...this._def,unknownKeys:"passthrough"})}extend(e){return new T({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new T({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:f.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new T({...this._def,catchall:e})}pick(e){let r={};return _.objectKeys(e).forEach(a=>{e[a]&&this.shape[a]&&(r[a]=this.shape[a])}),new T({...this._def,shape:()=>r})}omit(e){let r={};return _.objectKeys(this.shape).forEach(a=>{e[a]||(r[a]=this.shape[a])}),new T({...this._def,shape:()=>r})}deepPartial(){return F(this)}partial(e){let r={};return _.objectKeys(this.shape).forEach(a=>{let n=this.shape[a];e&&!e[a]?r[a]=n:r[a]=n.optional()}),new T({...this._def,shape:()=>r})}required(e){let r={};return _.objectKeys(this.shape).forEach(a=>{if(e&&!e[a])r[a]=this.shape[a];else{let n=this.shape[a];for(;n instanceof S;)n=n._def.innerType;r[a]=n}}),new T({...this._def,shape:()=>r})}keyof(){return et(_.objectKeys(this.shape))}};k.create=(t,e)=>new k({shape:()=>t,unknownKeys:"strip",catchall:j.create(),typeName:f.ZodObject,...g(e)});k.strictCreate=(t,e)=>new k({shape:()=>t,unknownKeys:"strict",catchall:j.create(),typeName:f.ZodObject,...g(e)});k.lazycreate=(t,e)=>new k({shape:t,unknownKeys:"strip",catchall:j.create(),typeName:f.ZodObject,...g(e)});var te=class extends v{_parse(t){let{ctx:e}=this._processInputParams(t),r=this._def.options;function a(n){for(let s of n)if(s.result.status==="valid")return s.result;for(let s of n)if(s.result.status==="dirty")return e.common.issues.push(...s.ctx.common.issues),s.result;let i=n.map(s=>new Z(s.ctx.common.issues));return c(e,{code:o.invalid_union,unionErrors:i}),m}if(e.common.async)return Promise.all(r.map(async n=>{let i={...e,common:{...e.common,issues:[]},parent:null};return{result:await n._parseAsync({data:e.data,path:e.path,parent:i}),ctx:i}})).then(a);{let n,i=[];for(let d of r){let u={...e,common:{...e.common,issues:[]},parent:null},h=d._parseSync({data:e.data,path:e.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!n&&(n={result:h,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(n)return e.common.issues.push(...n.ctx.common.issues),n.result;let s=i.map(d=>new Z(d));return c(e,{code:o.invalid_union,unionErrors:s}),m}}get options(){return this._def.options}};te.create=(t,e)=>new te({options:t,typeName:f.ZodUnion,...g(e)});var ce=t=>t instanceof ae?ce(t.schema):t instanceof N?ce(t.innerType()):t instanceof ne?[t.value]:t instanceof oe?t.options:t instanceof ie?Object.keys(t.enum):t instanceof se?ce(t._def.innerType):t instanceof Q?[void 0]:t instanceof ee?[null]:null,He=class Ye extends v{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==l.object)return c(r,{code:o.invalid_type,expected:l.object,received:r.parsedType}),m;let a=this.discriminator,n=r.data[a],i=this.optionsMap.get(n);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(c(r,{code:o.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,a){let n=new Map;for(let i of r){let s=ce(i.shape[e]);if(!s)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let d of s){if(n.has(d))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(d)}`);n.set(d,i)}}return new Ye({typeName:f.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...g(a)})}};function Pe(t,e){let r=I(t),a=I(e);if(t===e)return{valid:!0,data:t};if(r===l.object&&a===l.object){let n=_.objectKeys(e),i=_.objectKeys(t).filter(d=>n.indexOf(d)!==-1),s={...t,...e};for(let d of i){let u=Pe(t[d],e[d]);if(!u.valid)return{valid:!1};s[d]=u.data}return{valid:!0,data:s}}else if(r===l.array&&a===l.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let i=0;i<t.length;i++){let s=t[i],d=e[i],u=Pe(s,d);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return r===l.date&&a===l.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var re=class extends v{_parse(t){let{status:e,ctx:r}=this._processInputParams(t),a=(n,i)=>{if(Ae(n)||Ae(i))return m;let s=Pe(n.value,i.value);return s.valid?((Se(n)||Se(i))&&e.dirty(),{status:e.value,value:s.data}):(c(r,{code:o.invalid_intersection_types}),m)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,i])=>a(n,i)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};re.create=(t,e,r)=>new re({left:t,right:e,typeName:f.ZodIntersection,...g(r)});var R=class Ge extends v{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==l.array)return c(a,{code:o.invalid_type,expected:l.array,received:a.parsedType}),m;if(a.data.length<this._def.items.length)return c(a,{code:o.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&a.data.length>this._def.items.length&&(c(a,{code:o.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let n=[...a.data].map((i,s)=>{let d=this._def.items[s]||this._def.rest;return d?d._parse(new C(a,i,a.path,s)):null}).filter(i=>!!i);return a.common.async?Promise.all(n).then(i=>w.mergeArray(r,i)):w.mergeArray(r,n)}get items(){return this._def.items}rest(e){return new Ge({...this._def,rest:e})}};R.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new R({items:t,typeName:f.ZodTuple,rest:null,...g(e)})};var Xe=class Ie extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==l.object)return c(a,{code:o.invalid_type,expected:l.object,received:a.parsedType}),m;let n=[],i=this._def.keyType,s=this._def.valueType;for(let d in a.data)n.push({key:i._parse(new C(a,d,a.path,d)),value:s._parse(new C(a,a.data[d],a.path,d))});return a.common.async?w.mergeObjectAsync(r,n):w.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,a){return r instanceof v?new Ie({keyType:e,valueType:r,typeName:f.ZodRecord,...g(a)}):new Ie({keyType:V.create(),valueType:e,typeName:f.ZodRecord,...g(r)})}},ve=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==l.map)return c(r,{code:o.invalid_type,expected:l.map,received:r.parsedType}),m;let a=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map(([s,d],u)=>({key:a._parse(new C(r,s,r.path,[u,"key"])),value:n._parse(new C(r,d,r.path,[u,"value"]))}));if(r.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let d of i){let u=await d.key,h=await d.value;if(u.status==="aborted"||h.status==="aborted")return m;(u.status==="dirty"||h.status==="dirty")&&e.dirty(),s.set(u.value,h.value)}return{status:e.value,value:s}})}else{let s=new Map;for(let d of i){let u=d.key,h=d.value;if(u.status==="aborted"||h.status==="aborted")return m;(u.status==="dirty"||h.status==="dirty")&&e.dirty(),s.set(u.value,h.value)}return{status:e.value,value:s}}}};ve.create=(t,e,r)=>new ve({valueType:e,keyType:t,typeName:f.ZodMap,...g(r)});var _e=class Re extends v{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.parsedType!==l.set)return c(a,{code:o.invalid_type,expected:l.set,received:a.parsedType}),m;let n=this._def;n.minSize!==null&&a.data.size<n.minSize.value&&(c(a,{code:o.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&a.data.size>n.maxSize.value&&(c(a,{code:o.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let i=this._def.valueType;function s(u){let h=new Set;for(let x of u){if(x.status==="aborted")return m;x.status==="dirty"&&r.dirty(),h.add(x.value)}return{status:r.value,value:h}}let d=[...a.data.values()].map((u,h)=>i._parse(new C(a,u,a.path,h)));return a.common.async?Promise.all(d).then(u=>s(u)):s(d)}min(e,r){return new Re({...this._def,minSize:{value:e,message:p.toString(r)}})}max(e,r){return new Re({...this._def,maxSize:{value:e,message:p.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};_e.create=(t,e)=>new _e({valueType:t,minSize:null,maxSize:null,typeName:f.ZodSet,...g(e)});var Qe=class pe extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==l.function)return c(r,{code:o.invalid_type,expected:l.function,received:r.parsedType}),m;function a(d,u){return fe({data:d,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,he(),q].filter(h=>!!h),issueData:{code:o.invalid_arguments,argumentsError:u}})}function n(d,u){return fe({data:d,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,he(),q].filter(h=>!!h),issueData:{code:o.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof K){let d=this;return b(async function(...u){let h=new Z([]),x=await d._def.args.parseAsync(u,i).catch(Ze=>{throw h.addIssue(a(u,Ze)),h}),z=await Reflect.apply(s,this,x);return await d._def.returns._def.type.parseAsync(z,i).catch(Ze=>{throw h.addIssue(n(z,Ze)),h})})}else{let d=this;return b(function(...u){let h=d._def.args.safeParse(u,i);if(!h.success)throw new Z([a(u,h.error)]);let x=Reflect.apply(s,this,h.data),z=d._def.returns.safeParse(x,i);if(!z.success)throw new Z([n(x,z.error)]);return z.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new pe({...this._def,args:R.create(e).rest($.create())})}returns(e){return new pe({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,a){return new pe({args:e||R.create([]).rest($.create()),returns:r||$.create(),typeName:f.ZodFunction,...g(a)})}},ae=class extends v{get schema(){return this._def.getter()}_parse(t){let{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}};ae.create=(t,e)=>new ae({getter:t,typeName:f.ZodLazy,...g(e)});var ne=class extends v{_parse(t){if(t.data!==this._def.value){let e=this._getOrReturnCtx(t);return c(e,{received:e.data,code:o.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:t.data}}get value(){return this._def.value}};ne.create=(t,e)=>new ne({value:t,typeName:f.ZodLiteral,...g(e)});function et(t,e){return new oe({values:t,typeName:f.ZodEnum,...g(e)})}var oe=class $e extends v{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),a=this._def.values;return c(r,{expected:_.joinValues(a),received:r.parsedType,code:o.invalid_type}),m}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),a=this._def.values;return c(r,{received:r.data,code:o.invalid_enum_value,options:a}),m}return b(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e){return $e.create(e)}exclude(e){return $e.create(this.options.filter(r=>!e.includes(r)))}};oe.create=et;var ie=class extends v{_parse(t){let e=_.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==l.string&&r.parsedType!==l.number){let a=_.objectValues(e);return c(r,{expected:_.joinValues(a),received:r.parsedType,code:o.invalid_type}),m}if(e.indexOf(t.data)===-1){let a=_.objectValues(e);return c(r,{received:r.data,code:o.invalid_enum_value,options:a}),m}return b(t.data)}get enum(){return this._def.values}};ie.create=(t,e)=>new ie({values:t,typeName:f.ZodNativeEnum,...g(e)});var K=class extends v{unwrap(){return this._def.type}_parse(t){let{ctx:e}=this._processInputParams(t);if(e.parsedType!==l.promise&&e.common.async===!1)return c(e,{code:o.invalid_type,expected:l.promise,received:e.parsedType}),m;let r=e.parsedType===l.promise?e.data:Promise.resolve(e.data);return b(r.then(a=>this._def.type.parseAsync(a,{path:e.path,errorMap:e.common.contextualErrorMap})))}};K.create=(t,e)=>new K({type:t,typeName:f.ZodPromise,...g(e)});var N=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===f.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:e,ctx:r}=this._processInputParams(t),a=this._def.effect||null,n={addIssue:i=>{c(r,i),i.fatal?e.abort():e.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){let i=a.transform(r.data,n);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(i).then(s=>this._def.schema._parseAsync({data:s,path:r.path,parent:r})):this._def.schema._parseSync({data:i,path:r.path,parent:r})}if(a.type==="refinement"){let i=s=>{let d=a.refinement(s,n);if(r.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?m:(s.status==="dirty"&&e.dirty(),i(s.value),{status:e.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?m:(s.status==="dirty"&&e.dirty(),i(s.value).then(()=>({status:e.value,value:s.value}))))}if(a.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!J(i))return i;let s=a.transform(i.value,n);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>J(i)?Promise.resolve(a.transform(i.value,n)).then(s=>({status:e.value,value:s})):i);_.assertNever(a)}};N.create=(t,e,r)=>new N({schema:t,typeName:f.ZodEffects,effect:e,...g(r)});N.createWithPreprocess=(t,e,r)=>new N({schema:e,effect:{type:"preprocess",transform:t},typeName:f.ZodEffects,...g(r)});var S=class extends v{_parse(t){return this._getType(t)===l.undefined?b(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};S.create=(t,e)=>new S({innerType:t,typeName:f.ZodOptional,...g(e)});var M=class extends v{_parse(t){return this._getType(t)===l.null?b(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};M.create=(t,e)=>new M({innerType:t,typeName:f.ZodNullable,...g(e)});var se=class extends v{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return e.parsedType===l.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:e.path,parent:e})}removeDefault(){return this._def.innerType}};se.create=(t,e)=>new se({innerType:t,typeName:f.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});var be=class extends v{_parse(t){let{ctx:e}=this._processInputParams(t),r={...e,common:{...e.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return me(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Z(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Z(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};be.create=(t,e)=>new be({innerType:t,typeName:f.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var xe=class extends v{_parse(t){if(this._getType(t)!==l.nan){let e=this._getOrReturnCtx(t);return c(e,{code:o.invalid_type,expected:l.nan,received:e.parsedType}),m}return{status:"valid",value:t.data}}};xe.create=t=>new xe({typeName:f.ZodNaN,...g(t)});var jt=Symbol("zod_brand"),tt=class extends v{_parse(t){let{ctx:e}=this._processInputParams(t),r=e.data;return this._def.type._parse({data:r,path:e.path,parent:e})}unwrap(){return this._def.type}},Le=class rt extends v{_parse(e){let{status:r,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?m:n.status==="dirty"?(r.dirty(),qe(n.value)):this._def.out._parseAsync({data:n.value,path:a.path,parent:a})})();{let n=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?m:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:a.path,parent:a})}}static create(e,r){return new rt({in:e,out:r,typeName:f.ZodPipeline})}},we=class extends v{_parse(t){let e=this._def.innerType._parse(t);return J(e)&&(e.value=Object.freeze(e.value)),e}};we.create=(t,e)=>new we({innerType:t,typeName:f.ZodReadonly,...g(e)});var at=(t,e={},r)=>t?W.create().superRefine((a,n)=>{var i,s;if(!t(a)){let d=typeof e=="function"?e(a):typeof e=="string"?{message:e}:e,u=(s=(i=d.fatal)!==null&&i!==void 0?i:r)!==null&&s!==void 0?s:!0,h=typeof d=="string"?{message:d}:d;n.addIssue({code:"custom",...h,fatal:u})}}):W.create(),Et={object:k.lazycreate},f;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(f||(f={}));var Pt=(t,e={message:`Input not instance of ${t.name}`})=>at(r=>r instanceof t,e),nt=V.create,it=H.create,It=xe.create,Rt=Y.create,st=G.create,$t=X.create,Lt=ge.create,Mt=Q.create,Dt=ee.create,Ut=W.create,zt=$.create,Ft=j.create,Vt=ye.create,Wt=L.create,Kt=k.create,Bt=k.strictCreate,qt=te.create,Jt=He.create,Ht=re.create,Yt=R.create,Gt=Xe.create,Xt=ve.create,Qt=_e.create,er=Qe.create,tr=ae.create,rr=ne.create,ar=oe.create,nr=ie.create,ir=K.create,We=N.create,sr=S.create,or=M.create,dr=N.createWithPreprocess,ur=Le.create,lr=()=>nt().optional(),cr=()=>it().optional(),pr=()=>st().optional(),hr={string:t=>V.create({...t,coerce:!0}),number:t=>H.create({...t,coerce:!0}),boolean:t=>G.create({...t,coerce:!0}),bigint:t=>Y.create({...t,coerce:!0}),date:t=>X.create({...t,coerce:!0})},fr=m,y=Object.freeze({__proto__:null,defaultErrorMap:q,setErrorMap:vt,getErrorMap:he,makeIssue:fe,EMPTY_PATH:_t,addIssueToContext:c,ParseStatus:w,INVALID:m,DIRTY:qe,OK:b,isAborted:Ae,isDirty:Se,isValid:J,isAsync:me,get util(){return _},get objectUtil(){return Oe},ZodParsedType:l,getParsedType:I,ZodType:v,ZodString:V,ZodNumber:H,ZodBigInt:Y,ZodBoolean:G,ZodDate:X,ZodSymbol:ge,ZodUndefined:Q,ZodNull:ee,ZodAny:W,ZodUnknown:$,ZodNever:j,ZodVoid:ye,ZodArray:L,ZodObject:k,ZodUnion:te,ZodDiscriminatedUnion:He,ZodIntersection:re,ZodTuple:R,ZodRecord:Xe,ZodMap:ve,ZodSet:_e,ZodFunction:Qe,ZodLazy:ae,ZodLiteral:ne,ZodEnum:oe,ZodNativeEnum:ie,ZodPromise:K,ZodEffects:N,ZodTransformer:N,ZodOptional:S,ZodNullable:M,ZodDefault:se,ZodCatch:be,ZodNaN:xe,BRAND:jt,ZodBranded:tt,ZodPipeline:Le,ZodReadonly:we,custom:at,Schema:v,ZodSchema:v,late:Et,get ZodFirstPartyTypeKind(){return f},coerce:hr,any:Ut,array:Wt,bigint:Rt,boolean:st,date:$t,discriminatedUnion:Jt,effect:We,enum:ar,function:er,instanceof:Pt,intersection:Ht,lazy:tr,literal:rr,map:Xt,nan:It,nativeEnum:nr,never:Ft,null:Dt,nullable:or,number:it,object:Kt,oboolean:pr,onumber:cr,optional:sr,ostring:lr,pipeline:ur,preprocess:dr,promise:ir,record:Gt,set:Qt,strictObject:Bt,string:nt,symbol:Lt,transformer:We,tuple:Yt,undefined:Mt,union:qt,unknown:zt,void:Vt,NEVER:fr,ZodIssueCode:o,quotelessJson:yt,ZodError:Z});var mr=y.object({}),gr=y.object({alias:y.object({}).passthrough().default({}).describe("Equivalent to `vite.resolve.alias`.\n\nhttps://vitejs.dev/config/shared-options.html#resolve-alias"),plugins:y.any().array().default([]).describe("Equivalent to `vite.plugins`.\n\nhttps://vitejs.dev/config/shared-options.html#plugins")}),yr=y.object({server:y.number().default(3e3).describe("The port that the dev server should use."),gateway:y.number().default(3001).describe("The port that the api gateway should use.")}),vr=y.object({apps:y.string().array().default([]).describe(`Additional apps to include.
|
|
4
|
-
|
|
5
|
-
Note: additional apps need to be added as devDependencies.`),ports:yr.default({}).describe("Options for ports."),open:y.boolean().default(!1).describe("Whether the dev server should automatically open in your browser or not."),logging:y.boolean().default(!1).describe("Whether the dev server and browser console should output more log information or not.")}),_r=y.object({mode:y.string().default("production").describe("Which mode to use when building the app. [production | development]"),watch:y.boolean().default(!1).describe("Whether the build should start watching and rebuild when files change or not.")}),br=y.object({app:y.string().default("./src/app.ts").describe("The entry file for the app."),manifest:y.string().default("./src/manifest.json").describe("The entry file for the app manifest.")}),de=y.object({vite:gr.default({}).describe("Options related to Vite."),server:vr.default({}).describe("Options related to the dev server."),entries:br.default({}).describe("Options related to the app entry points."),build:_r.default({}).describe("Options related to app build."),experimental:mr.default({}).describe("Experimental options.")}),xr=y.enum(["build","serve"]),wr=y.object({command:xr,mode:y.string()}),kr=y.function().args(wr).returns(de.or(y.promise(de))),wa=y.function().args(y.union([de,kr]));var Tr=y.enum(["necessary","functional","analytics","marketing"]),Zr=y.object({purpose:y.string().describe("Purpose of the storing the value."),category:Tr.describe("Category of the storage value - necessary, functional, analytics or marketing."),lifespan:y.string().describe("Basic description of how long the value will be stored.")}),Nr=y.record(Zr.describe("Key used when writing to the storage.")),Cr=y.object({value:y.string().describe("The localization token default value."),description:y.string().describe("The localization token description.")}),Or=y.object({localization:y.record(Cr.describe("Key used when getting the localized text.")).default({}).describe("Translateable texts used in the app")}),Ar=y.object({name:y.string().describe("URL friendly name of the app."),endpoints:y.string().array().default([]).describe("Endpoints that should be communicated with using the API gateway."),permissions:y.string().array().default([]).describe("Permissions that can be added to user roles."),resources:Or.default({}).describe("Resources used by the app."),storage:Nr.default({}).describe("Cookies, session storage, and local storage values that are used by the app.")}).passthrough();function ot(t,e){let r=Ar.safeParse(t);return r.success?r.data:dt(r.error.format(),e?[e]:[]).join(`
|
|
6
|
-
`)}function dt(t,e=[],r=""){t._errors?.length&&e.push(`${r} - ${t._errors.join(" + ")}`);for(let[a,n]of Object.entries(t))a==="_errors"||!n||typeof n!="object"||Array.isArray(n)||dt(n,e,r?`${r}.${a}`:a);return e}function De(t,e,r=".",a){if(!Me(e))return De(t,{},r,a);let n=Object.assign({},e);for(let i in t){if(i==="__proto__"||i==="constructor")continue;let s=t[i];s!=null&&(a&&a(n,i,s,r)||(Array.isArray(s)&&Array.isArray(n[i])?n[i]=[...s,...n[i]]:Me(s)&&Me(n[i])?n[i]=De(s,n[i],(r?`${r}.`:"")+i.toString(),a):n[i]=s))}return n}function Me(t){if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function Ue(t){return(...e)=>e.reduce((r,a)=>De(r,a,"",t),{})}var ut=Ue(),Na=Ue((t,e,r)=>{if(t[e]!==void 0&&typeof r=="function")return t[e]=r(t[e]),!0}),Ca=Ue((t,e,r)=>{if(Array.isArray(t[e])&&typeof r=="function")return t[e]=r(t[e]),!0});var Sr=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,jr=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Er=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Pr(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){Ir(t);return}return e}function Ir(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function ze(t,e={}){if(typeof t!="string")return t;let r=t.trim();if(t[0]==='"'&&t.at(-1)==='"'&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){let a=r.toLowerCase();if(a==="true")return!0;if(a==="false")return!1;if(a==="undefined")return;if(a==="null")return null;if(a==="nan")return Number.NaN;if(a==="infinity")return Number.POSITIVE_INFINITY;if(a==="-infinity")return Number.NEGATIVE_INFINITY}if(!Er.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(Sr.test(t)||jr.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,Pr)}return JSON.parse(t)}catch(a){if(e.strict)throw a;return t}}import{createServer as Rr}from"node:net";import{networkInterfaces as $r}from"node:os";var Lr=new Set([1,7,9,11,13,15,17,19,20,21,22,23,25,37,42,43,53,69,77,79,87,95,101,102,103,104,109,110,111,113,115,117,119,123,135,137,139,143,161,179,389,427,465,512,513,514,515,526,530,531,532,540,548,554,556,563,587,601,636,989,990,993,995,1719,1720,1723,2049,3659,4045,5060,5061,6e3,6566,6665,6666,6667,6668,6669,6697,10080]);function Mr(t){return Lr.has(t)}function Dr(t){return!Mr(t)}function Ur(t,e){t&&console.log(`[get-port] ${e}`)}function lt(t,e){return new Promise(r=>{let a=Rr();a.unref(),a.on("error",()=>{r(!1)}),a.listen({port:t,host:e},()=>{let{port:n}=a.address();a.close(()=>{r(Dr(n)&&n)})})})}function zr(t){let e=new Set(t);for(let r of Object.values($r()))for(let a of r||[])a.address&&!a.internal&&!a.address.startsWith("fe80::")&&e.add(a.address);return[...e]}function Fr(t){return t?`on host ${JSON.stringify(t)}`:"on any host"}async function Fe(t,e=process.env.HOST,r){if(e||(e=zr([void 0,"0.0.0.0"])),!Array.isArray(e))return lt(t,e);for(let a of e){let n=await lt(t,a);if(n===!1)return t<1024&&r&&Ur(r,`Unable to listen to the priviliged port ${t} ${Fr(a)}`),!1;t===0&&n!==0&&(t=n)}return t}import{existsSync as E,readFileSync as mt}from"node:fs";import{relative as Te,resolve as P}from"node:path";import{loadConfigFromFile as Vr}from"vite";var D=O("yellow"),ke=O("green"),ct=O("red"),pt=O("cyan"),ue=O("bold"),ht=O("underline"),Va=O("italic"),Wa=O("magentaBright"),gt={"arg.build.watch":"Whether the build should start watching and rebuild when files change or not.","arg.config":"The path to the app configuration file.","arg.debug":"Whether to output debug information or not.","arg.entries.app":"The entry file for the app.","arg.entries.manifest":"The entry file for the app manifest.","arg.jwt.app":"Token app name.","arg.jwt.expiration":"Token expiration time compatible with https://npmjs.com/package/ms.","arg.jwt.user.email":"Token user email.","arg.jwt.user.name":"Token user name.","arg.jwt.user.permission":"Token user permission(s).","arg.jwt.user.sub":"Token user object id.","arg.jwt.user.type":"Token user type.","arg.jwt.workspace":"Token workspace name.","arg.mode":"Which mode to use when building the app.","arg.public-key.clean":"Whether to exclude the -----BEGIN PUBLIC KEY----- prefix and -----END PUBLIC KEY----- suffix or not.","arg.public-key.type":"Type of public key.","arg.serve.logging":"Whether the server and browser console should output more log information or not.","arg.serve.open":"Whether the server should automatically open in your browser or not.","arg.serve.ports.gateway":"The port that the gateway should use.","arg.serve.ports.server":"The port that the server should use.","arg.upgrade.next":"Whether or not the CLI should include the 'next' tag when upgrading @telia-ace packages.","changes.upgraded":`Upgraded ${D("'{{pkg}}'")} to ${ke("'{{v}}'")}`,"command.build":"Builds an Alliance app.","command.jwt":"Creates an Alliance JWT.","command.public-key":"Creates a public key used to verify an Alliance JWT.","command.serve":"Starts the Alliance development server.","command.upgrade":"Upgrades Alliance app(s).","errors.invalid-manifest":"Invalid app manifest","errors.no-entry":"Could not find any app and/or manifest entry file at '{{app}}' or '{{manifest}}'","errors.npm-error":"Could not get upgrade information from NPM.","errors.port-busy":"Port {{busy}} is busy","info.gateway-url":`${ue("Gateway:")} ${ht(pt("{{url}}"))}`,"info.header.changes":"Changes","info.header.recommendations":"Recommendations","info.header.warnings":"Warnings","info.next-steps":"Next steps:","info.server-url":`${ue("Server:")} ${ht(pt("{{url}}"))}`,"info.steps.install":`Run ${D("'{{cmd}}'")} to install the changed package versions`,"info.steps.warnings":`Address the ${ct("warnings")} and ${D("recommendations")} detailed above`,"info.stop-server":ue("Press CTRL + C to stop the server."),"info.upgraded":`Upgraded ${D("'{{pkg}}'")} to ${ke("'{{v}}'")}`,"recommendations.upgrade":`Upgrade ${D("'{{pkg}}'")} to ${ke("'{{v}}'")}`,"warnings.change":`Change ${D("'{{property}}'")} from ${ct("'{{current}}'")} to ${ke("'{{new}}'")}`,"warnings.remove":`Remove ${D("'{{property}}'")}{{alt}}`},Ka=Object.keys(gt);function U(t,e={}){return Object.entries(e).reduce((r,[a,n])=>r.replaceAll(`{{${a}}}`,String(n)),gt[t]).trim()}var Ba={type:"string",description:U("arg.config"),required:!1,alias:"c",valueHint:"./alliance.config.ts"},qa={type:"boolean",description:U("arg.debug"),required:!1,default:!1,alias:"d"};function Ja({debug:t,input:e,output:r}){t&&(A.log(ue(Ne("cyan","Input:"))),console.log(JSON.stringify(e,null,2),`
|
|
7
|
-
`),A.log(ue(Ne("cyan","Output:")))),console.log(r,`
|
|
8
|
-
`)}var ft=["./src/app.ts","./src/app.js","./src/app.mts","./src/app.mjs","./src/app.cts","./src/app.cjs"],Wr=["alliance.config.js","alliance.config.mjs","alliance.config.ts","alliance.config.cjs","alliance.config.mts","alliance.config.cts","alliance.config.json"];async function Kr(t,e){let r;if(e?r=P(process.cwd(),e):r=qr(),r&&E(r)){if(r.endsWith(".json"))return ze(mt(r).toString());try{return(await Vr(t,r))?.config||{}}catch(a){A.error(a.message),process.exit(1)}}return{}}function Br(t){let e=P(process.cwd(),t.app);if(t.manifest=P(process.cwd(),t.manifest),!ft.includes(t.app))return t.app=e,t;for(let r of ft){let a=P(process.cwd(),r);if(E(a)){t.app=a;break}}return t}function qr(){let t=Wr.reduce((e,r)=>{if(e.length)return e;let a=P(process.cwd(),r);return E(a)?a:e},"");if(E(t))return t}async function Ha(t,e="",r={}){let a=ut(r,await Kr(t,e));!a.build?.mode&&(a.build?.watch||t.command==="serve")&&(a.build={...a.build,mode:"development"});let n=de.parse(a);return t.command==="serve"&&(await Fe(n.server.ports.server)||(A.error(U("errors.port-busy",{busy:n.server.ports.server})),process.exit(1)),await Fe(n.server.ports.gateway)||(A.error(U("errors.port-busy",{busy:n.server.ports.gateway})),process.exit(1))),{...n,entries:Br(n.entries)}}function Ya(t,e){let r={};if(E(e.entries.manifest)){let a=ze(mt(e.entries.manifest).toString()),n=ot(a,U("errors.invalid-manifest"));typeof n=="string"&&(A.error(n),process.exit(1)),r.ALLIANCE_APP_MANIFEST=n,r.ALLIANCE_APP_NAME=JSON.stringify(n.name)}return t==="build"&&(!E(e.entries.manifest)||!E(e.entries.app))&&(A.error(U("errors.no-entry",{app:Te(process.cwd(),P(e.entries.app)),manifest:Te(process.cwd(),P(e.entries.manifest))})),process.exit(1)),t==="serve"&&(r.ALLIANCE_ENVIRONMENT={logging:e.server.logging}),r}function Ga({entries:t,server:e}){let r=[];E(t.app)&&E(t.manifest)&&r.push({packageName:"entry",appImportPath:t.app,manifestImportPath:t.manifest});for(let a of e.apps)r.push({packageName:a,appImportPath:`${a}/app`,manifestImportPath:`${a}/manifest`});return r.length||(A.error(U("errors.no-entry",{app:Te(process.cwd(),P(t.app)),manifest:Te(process.cwd(),P(t.manifest))})),process.exit(1)),r}export{ze as a,D as b,ke as c,ct as d,pt as e,ue as f,ht as g,Ka as h,U as i,Ba as j,qa as k,Ja as l,Ha as m,Ya as n,Ga as o};
|