fjall 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/.bundled +3 -3
- package/bin/.metafile.json +4 -4
- package/bin/assets/generators/account/generator.js +1 -1
- package/bin/assets/generators/application/generator.js +1 -1
- package/bin/assets/generators/cdn/generator.js +2 -2
- package/bin/assets/generators/compute/generator.js +2 -2
- package/bin/assets/generators/compute/service/generator.js +29 -29
- package/bin/assets/generators/database/generator.js +2 -2
- package/bin/assets/generators/database/proxy/generator.js +1 -1
- package/bin/assets/generators/domain/generator.js +1 -1
- package/bin/assets/generators/network/generator.js +2 -2
- package/bin/assets/generators/organisation/generator.js +1 -1
- package/bin/assets/generators/shared/files/package.json +2 -2
- package/bin/assets/generators/storage/s3/generator.js +2 -2
- package/bin/assets/generators/tunnel/generator.js +2 -2
- package/bin/fjall.bundle.js +3 -3
- package/package.json +3 -3
|
@@ -163,7 +163,7 @@ Filtered results for: ${this.inputValue?this.inputValue:pr.gray("Enter something
|
|
|
163
163
|
|
|
164
164
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let c=a[1];if(t===a[0]){o(a);continue}if(e.external){let l=e.external.registry.get(a[0])?.id;if(t!==a[0]&&l){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(c.cycle){o(a);continue}if(c.count>1&&e.reused==="ref"){o(a);continue}}}function Ir(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=c=>{let u=e.seen.get(c);if(u.ref===null)return;let l=u.def??u.schema,m={...l},p=u.ref;if(u.ref=null,p){i(p);let v=e.seen.get(p),A=v.schema;if(A.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(A)):Object.assign(l,A),Object.assign(l,m),c._zod.parent===p)for(let z in l)z==="$ref"||z==="allOf"||z in m||delete l[z];if(A.$ref&&v.def)for(let z in l)z==="$ref"||z==="allOf"||z in v.def&&JSON.stringify(l[z])===JSON.stringify(v.def[z])&&delete l[z]}let g=c._zod.parent;if(g&&g!==p){i(g);let v=e.seen.get(g);if(v?.schema.$ref&&(l.$ref=v.schema.$ref,v.def))for(let A in l)A==="$ref"||A==="allOf"||A in v.def&&JSON.stringify(l[A])===JSON.stringify(v.def[A])&&delete l[A]}e.override({zodSchema:c,jsonSchema:l,path:u.path??[]})};for(let c of[...e.seen.entries()].reverse())i(c[0]);let r={};if(e.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");r.$id=e.external.uri(c)}Object.assign(r,n.def??n.schema);let o=e.metadataRegistry.get(t)?.id;o!==void 0&&r.id===o&&delete r.id;let a=e.external?.defs??{};for(let c of e.seen.entries()){let u=c[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,a[u.defId]=u.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?r.$defs=a:r.definitions=a);try{let c=JSON.parse(JSON.stringify(r));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:ni(t,"input",e.processors),output:ni(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function je(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return je(i.element,n);if(i.type==="set")return je(i.valueType,n);if(i.type==="lazy")return je(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return je(i.innerType,n);if(i.type==="intersection")return je(i.left,n)||je(i.right,n);if(i.type==="record"||i.type==="map")return je(i.keyType,n)||je(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:je(i.in,n)||je(i.out,n);if(i.type==="object"){for(let r in i.shape)if(je(i.shape[r],n))return!0;return!1}if(i.type==="union"){for(let r of i.options)if(je(r,n))return!0;return!1}if(i.type==="tuple"){for(let r of i.items)if(je(r,n))return!0;return!!(i.rest&&je(i.rest,n))}return!1}var gf=(e,t={})=>n=>{let i=xr({...n,processors:t});return Z(e,i),Ar(i,e),Ir(i,e)},ni=(e,t,n={})=>i=>{let{libraryOptions:r,target:o}=i??{},a=xr({...r??{},target:o,io:t,processors:n});return Z(e,a),Ar(a,e),Ir(a,e)};var l1={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},hf=(e,t,n,i)=>{let r=n;r.type="string";let{minimum:o,maximum:a,format:c,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof o=="number"&&(r.minLength=o),typeof a=="number"&&(r.maxLength=a),c&&(r.format=l1[c]??c,r.format===""&&delete r.format,c==="time"&&delete r.format),l&&(r.contentEncoding=l),u&&u.size>0){let m=[...u];m.length===1?r.pattern=m[0].source:m.length>1&&(r.allOf=[...m.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},vf=(e,t,n,i)=>{let r=n,{minimum:o,maximum:a,format:c,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:m}=e._zod.bag;typeof c=="string"&&c.includes("int")?r.type="integer":r.type="number";let p=typeof m=="number"&&m>=(o??Number.NEGATIVE_INFINITY),g=typeof l=="number"&&l<=(a??Number.POSITIVE_INFINITY),v=t.target==="draft-04"||t.target==="openapi-3.0";p?v?(r.minimum=m,r.exclusiveMinimum=!0):r.exclusiveMinimum=m:typeof o=="number"&&(r.minimum=o),g?v?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l:typeof a=="number"&&(r.maximum=a),typeof u=="number"&&(r.multipleOf=u)},bf=(e,t,n,i)=>{n.type="boolean"},yf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Sf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},_f=(e,t,n,i)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Ef=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},xf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Af=(e,t,n,i)=>{n.not={}},If=(e,t,n,i)=>{},$f=(e,t,n,i)=>{},Tf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Rf=(e,t,n,i)=>{let r=e._zod.def,o=oo(r.entries);o.every(a=>typeof a=="number")&&(n.type="number"),o.every(a=>typeof a=="string")&&(n.type="string"),n.enum=o},Cf=(e,t,n,i)=>{let r=e._zod.def,o=[];for(let a of r.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){let a=o[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else o.every(a=>typeof a=="number")&&(n.type="number"),o.every(a=>typeof a=="string")&&(n.type="string"),o.every(a=>typeof a=="boolean")&&(n.type="boolean"),o.every(a=>a===null)&&(n.type="null"),n.enum=o},Pf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Nf=(e,t,n,i)=>{let r=n,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=o.source},wf=(e,t,n,i)=>{let r=n,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:c,mime:u}=e._zod.bag;a!==void 0&&(o.minLength=a),c!==void 0&&(o.maxLength=c),u?u.length===1?(o.contentMediaType=u[0],Object.assign(r,o)):(Object.assign(r,o),r.anyOf=u.map(l=>({contentMediaType:l}))):Object.assign(r,o)},kf=(e,t,n,i)=>{n.type="boolean"},Of=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Df=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Mf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},jf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},zf=(e,t,n,i)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Lf=(e,t,n,i)=>{let r=n,o=e._zod.def,{minimum:a,maximum:c}=e._zod.bag;typeof a=="number"&&(r.minItems=a),typeof c=="number"&&(r.maxItems=c),r.type="array",r.items=Z(o.element,t,{...i,path:[...i.path,"items"]})},Uf=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="object",r.properties={};let a=o.shape;for(let l in a)r.properties[l]=Z(a[l],t,{...i,path:[...i.path,"properties",l]});let c=new Set(Object.keys(a)),u=new Set([...c].filter(l=>{let m=o.shape[l]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));u.size>0&&(r.required=Array.from(u)),o.catchall?._zod.def.type==="never"?r.additionalProperties=!1:o.catchall?o.catchall&&(r.additionalProperties=Z(o.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(r.additionalProperties=!1)},fc=(e,t,n,i)=>{let r=e._zod.def,o=r.inclusive===!1,a=r.options.map((c,u)=>Z(c,t,{...i,path:[...i.path,o?"oneOf":"anyOf",u]}));o?n.oneOf=a:n.anyOf=a},Ff=(e,t,n,i)=>{let r=e._zod.def,o=Z(r.left,t,{...i,path:[...i.path,"allOf",0]}),a=Z(r.right,t,{...i,path:[...i.path,"allOf",1]}),c=l=>"allOf"in l&&Object.keys(l).length===1,u=[...c(o)?o.allOf:[o],...c(a)?a.allOf:[a]];n.allOf=u},Bf=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=o.items.map((g,v)=>Z(g,t,{...i,path:[...i.path,a,v]})),l=o.rest?Z(o.rest,t,{...i,path:[...i.path,c,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(r.prefixItems=u,l&&(r.items=l)):t.target==="openapi-3.0"?(r.items={anyOf:u},l&&r.items.anyOf.push(l),r.minItems=u.length,l||(r.maxItems=u.length)):(r.items=u,l&&(r.additionalItems=l));let{minimum:m,maximum:p}=e._zod.bag;typeof m=="number"&&(r.minItems=m),typeof p=="number"&&(r.maxItems=p)},Vf=(e,t,n,i)=>{let r=n,o=e._zod.def;r.type="object";let a=o.keyType,u=a._zod.bag?.patterns;if(o.mode==="loose"&&u&&u.size>0){let m=Z(o.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});r.patternProperties={};for(let p of u)r.patternProperties[p.source]=m}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(r.propertyNames=Z(o.keyType,t,{...i,path:[...i.path,"propertyNames"]})),r.additionalProperties=Z(o.valueType,t,{...i,path:[...i.path,"additionalProperties"]});let l=a._zod.values;if(l){let m=[...l].filter(p=>typeof p=="string"||typeof p=="number");m.length>0&&(r.required=m)}},Zf=(e,t,n,i)=>{let r=e._zod.def,o=Z(r.innerType,t,i),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=r.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},Gf=(e,t,n,i)=>{let r=e._zod.def;Z(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},Wf=(e,t,n,i)=>{let r=e._zod.def;Z(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue))},Hf=(e,t,n,i)=>{let r=e._zod.def;Z(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)))},qf=(e,t,n,i)=>{let r=e._zod.def;Z(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType;let a;try{a=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Kf=(e,t,n,i)=>{let r=e._zod.def,o=r.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?o?r.out:r.in:r.out;Z(a,t,i);let c=t.seen.get(e);c.ref=a},Yf=(e,t,n,i)=>{let r=e._zod.def;Z(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType,n.readOnly=!0},Xf=(e,t,n,i)=>{let r=e._zod.def;Z(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},gc=(e,t,n,i)=>{let r=e._zod.def;Z(r.innerType,t,i);let o=t.seen.get(e);o.ref=r.innerType},Jf=(e,t,n,i)=>{let r=e._zod.innerType;Z(r,t,i);let o=t.seen.get(e);o.ref=r},pc={string:hf,number:vf,boolean:bf,bigint:yf,symbol:Sf,null:_f,undefined:Ef,void:xf,never:Af,any:If,unknown:$f,date:Tf,enum:Rf,literal:Cf,nan:Pf,template_literal:Nf,file:wf,success:kf,custom:Of,function:Df,transform:Mf,map:jf,set:zf,array:Lf,object:Uf,union:fc,intersection:Ff,tuple:Bf,record:Vf,nullable:Zf,nonoptional:Gf,default:Wf,prefault:Hf,catch:qf,pipe:Kf,readonly:Yf,promise:Xf,optional:gc,lazy:Jf};function hc(e,t){if("_idmap"in e){let i=e,r=xr({...t,processors:pc}),o={};for(let u of i._idmap.entries()){let[l,m]=u;Z(m,r)}let a={},c={registry:i,uri:t?.uri,defs:o};r.external=c;for(let u of i._idmap.entries()){let[l,m]=u;Ar(r,m),a[l]=Ir(r,m)}if(Object.keys(o).length>0){let u=r.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[u]:o}}return{schemas:a}}let n=xr({...t,processors:pc});return Z(e,n),Ar(n,e),Ir(n,e)}var vc=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=xr({processors:pc,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return Z(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),Ar(this.ctx,t);let i=Ir(this.ctx,t),{"~standard":r,...o}=i;return o}};var xE={};var Ao={};$t(Ao,{ZodAny:()=>Eg,ZodArray:()=>$g,ZodBase64:()=>zc,ZodBase64URL:()=>Lc,ZodBigInt:()=>di,ZodBigIntFormat:()=>Bc,ZodBoolean:()=>li,ZodCIDRv4:()=>Mc,ZodCIDRv6:()=>jc,ZodCUID:()=>Cc,ZodCUID2:()=>Pc,ZodCatch:()=>qg,ZodCodec:()=>Mo,ZodCustom:()=>jo,ZodCustomStringFormat:()=>ci,ZodDate:()=>No,ZodDefault:()=>Bg,ZodDiscriminatedUnion:()=>Rg,ZodE164:()=>Uc,ZodEmail:()=>$c,ZodEmoji:()=>Tc,ZodEnum:()=>ai,ZodExactOptional:()=>Lg,ZodFile:()=>jg,ZodFunction:()=>ih,ZodGUID:()=>$o,ZodIPv4:()=>Oc,ZodIPv6:()=>Dc,ZodIntersection:()=>Cg,ZodJWT:()=>Fc,ZodKSUID:()=>kc,ZodLazy:()=>th,ZodLiteral:()=>Mg,ZodMAC:()=>gg,ZodMap:()=>Og,ZodNaN:()=>Yg,ZodNanoID:()=>Rc,ZodNever:()=>Ag,ZodNonOptional:()=>qc,ZodNull:()=>Sg,ZodNullable:()=>Fg,ZodNumber:()=>ui,ZodNumberFormat:()=>Qr,ZodObject:()=>ko,ZodOptional:()=>Hc,ZodPipe:()=>Do,ZodPrefault:()=>Zg,ZodPreprocess:()=>Xg,ZodPromise:()=>nh,ZodReadonly:()=>Jg,ZodRecord:()=>oi,ZodSet:()=>Dg,ZodString:()=>si,ZodStringFormat:()=>K,ZodSuccess:()=>Hg,ZodSymbol:()=>bg,ZodTemplateLiteral:()=>eh,ZodTransform:()=>zg,ZodTuple:()=>Ng,ZodType:()=>w,ZodULID:()=>Nc,ZodURL:()=>Po,ZodUUID:()=>wt,ZodUndefined:()=>yg,ZodUnion:()=>Oo,ZodUnknown:()=>xg,ZodVoid:()=>Ig,ZodXID:()=>wc,ZodXor:()=>Tg,_ZodString:()=>Ic,_default:()=>Vg,_function:()=>wx,any:()=>ux,array:()=>wo,base64:()=>WE,base64url:()=>HE,bigint:()=>ix,boolean:()=>vg,catch:()=>Kg,check:()=>kx,cidrv4:()=>ZE,cidrv6:()=>GE,codec:()=>Rx,cuid:()=>ME,cuid2:()=>jE,custom:()=>Ox,date:()=>dx,describe:()=>Dx,discriminatedUnion:()=>vx,e164:()=>qE,email:()=>$E,emoji:()=>OE,enum:()=>Gc,exactOptional:()=>Ug,file:()=>Ax,float32:()=>ex,float64:()=>tx,function:()=>wx,guid:()=>TE,hash:()=>QE,hex:()=>JE,hostname:()=>XE,httpUrl:()=>kE,instanceof:()=>jx,int:()=>xc,int32:()=>rx,int64:()=>ox,intersection:()=>Pg,invertCodec:()=>Cx,ipv4:()=>FE,ipv6:()=>VE,json:()=>Lx,jwt:()=>KE,keyof:()=>mx,ksuid:()=>UE,lazy:()=>rh,literal:()=>xx,looseObject:()=>gx,looseRecord:()=>yx,mac:()=>BE,map:()=>Sx,meta:()=>Mx,nan:()=>Tx,nanoid:()=>DE,nativeEnum:()=>Ex,never:()=>Vc,nonoptional:()=>Wg,null:()=>_g,nullable:()=>Ro,nullish:()=>Ix,number:()=>hg,object:()=>px,optional:()=>To,partialRecord:()=>bx,pipe:()=>Ac,prefault:()=>Gg,preprocess:()=>Ux,promise:()=>Nx,readonly:()=>Qg,record:()=>kg,refine:()=>oh,set:()=>_x,strictObject:()=>fx,string:()=>Io,stringFormat:()=>YE,stringbool:()=>zx,success:()=>$x,superRefine:()=>ah,symbol:()=>sx,templateLiteral:()=>Px,transform:()=>Wc,tuple:()=>wg,uint32:()=>nx,uint64:()=>ax,ulid:()=>zE,undefined:()=>cx,union:()=>Zc,unknown:()=>Jr,url:()=>wE,uuid:()=>RE,uuidv4:()=>CE,uuidv6:()=>PE,uuidv7:()=>NE,void:()=>lx,xid:()=>LE,xor:()=>hx});var bc={};$t(bc,{endsWith:()=>Kn,gt:()=>Pt,gte:()=>Me,includes:()=>Hn,length:()=>Xr,lowercase:()=>Gn,lt:()=>Ct,lte:()=>Qe,maxLength:()=>Yr,maxSize:()=>Er,mime:()=>Yn,minLength:()=>Xt,minSize:()=>Nt,multipleOf:()=>_r,negative:()=>uc,nonnegative:()=>dc,nonpositive:()=>lc,normalize:()=>Xn,overwrite:()=>yt,positive:()=>cc,property:()=>mc,regex:()=>Zn,size:()=>Kr,slugify:()=>ti,startsWith:()=>qn,toLowerCase:()=>Qn,toUpperCase:()=>ei,trim:()=>Jn,uppercase:()=>Wn});var ii={};$t(ii,{ZodISODate:()=>Sc,ZodISODateTime:()=>yc,ZodISODuration:()=>Ec,ZodISOTime:()=>_c,date:()=>eg,datetime:()=>Qf,duration:()=>rg,time:()=>tg});var yc=f("ZodISODateTime",(e,t)=>{Cm.init(e,t),K.init(e,t)});function Qf(e){return kp(yc,e)}var Sc=f("ZodISODate",(e,t)=>{Pm.init(e,t),K.init(e,t)});function eg(e){return Op(Sc,e)}var _c=f("ZodISOTime",(e,t)=>{Nm.init(e,t),K.init(e,t)});function tg(e){return Dp(_c,e)}var Ec=f("ZodISODuration",(e,t)=>{wm.init(e,t),K.init(e,t)});function rg(e){return Mp(Ec,e)}var AE=(e,t)=>{lo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>po(e,n)},flatten:{value:n=>mo(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Dn,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Dn,2)}},isEmpty:{get(){return e.issues.length===0}}})},m1=f("ZodError",AE),Ze=f("ZodError",AE,{Parent:Error});var ng=zn(Ze),ig=Ln(Ze),og=Un(Ze),ag=Fn(Ze),sg=hs(Ze),cg=vs(Ze),ug=bs(Ze),lg=ys(Ze),dg=Ss(Ze),mg=_s(Ze),pg=Es(Ze),fg=xs(Ze);var IE=new WeakMap;function Co(e,t,n){let i=Object.getPrototypeOf(e),r=IE.get(i);if(r||(r=new Set,IE.set(i,r)),!r.has(t)){r.add(t);for(let o in n){let a=n[o];Object.defineProperty(i,o,{configurable:!0,enumerable:!1,get(){let c=a.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}var w=f("ZodType",(e,t)=>(N.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ni(e,"input"),output:ni(e,"output")}}),e.toJSONSchema=gf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,i)=>ng(e,n,i,{callee:e.parse}),e.safeParse=(n,i)=>og(e,n,i),e.parseAsync=async(n,i)=>ig(e,n,i,{callee:e.parseAsync}),e.safeParseAsync=async(n,i)=>ag(e,n,i),e.spa=e.safeParseAsync,e.encode=(n,i)=>sg(e,n,i),e.decode=(n,i)=>cg(e,n,i),e.encodeAsync=async(n,i)=>ug(e,n,i),e.decodeAsync=async(n,i)=>lg(e,n,i),e.safeEncode=(n,i)=>dg(e,n,i),e.safeDecode=(n,i)=>mg(e,n,i),e.safeEncodeAsync=async(n,i)=>pg(e,n,i),e.safeDecodeAsync=async(n,i)=>fg(e,n,i),Co(e,"ZodType",{check(...n){let i=this.def;return this.clone(_.mergeDefs(i,{checks:[...i.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,i){return Oe(this,n,i)},brand(){return this},register(n,i){return n.add(this,i),this},refine(n,i){return this.check(oh(n,i))},superRefine(n,i){return this.check(ah(n,i))},overwrite(n){return this.check(yt(n))},optional(){return To(this)},exactOptional(){return Ug(this)},nullable(){return Ro(this)},nullish(){return To(Ro(this))},nonoptional(n){return Wg(this,n)},array(){return wo(this)},or(n){return Zc([this,n])},and(n){return Pg(this,n)},transform(n){return Ac(this,Wc(n))},default(n){return Vg(this,n)},prefault(n){return Gg(this,n)},catch(n){return Kg(this,n)},pipe(n){return Ac(this,n)},readonly(){return Qg(this)},describe(n){let i=this.clone();return _e.add(i,{description:n}),i},meta(...n){if(n.length===0)return _e.get(this);let i=this.clone();return _e.add(i,n[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return _e.get(e)?.description},configurable:!0}),e)),Ic=f("_ZodString",(e,t)=>{qr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(i,r,o)=>hf(e,i,r,o);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Co(e,"_ZodString",{regex(...i){return this.check(Zn(...i))},includes(...i){return this.check(Hn(...i))},startsWith(...i){return this.check(qn(...i))},endsWith(...i){return this.check(Kn(...i))},min(...i){return this.check(Xt(...i))},max(...i){return this.check(Yr(...i))},length(...i){return this.check(Xr(...i))},nonempty(...i){return this.check(Xt(1,...i))},lowercase(i){return this.check(Gn(i))},uppercase(i){return this.check(Wn(i))},trim(){return this.check(Jn())},normalize(...i){return this.check(Xn(...i))},toLowerCase(){return this.check(Qn())},toUpperCase(){return this.check(ei())},slugify(){return this.check(ti())}})}),si=f("ZodString",(e,t)=>{qr.init(e,t),Ic.init(e,t),e.email=n=>e.check(Bs($c,n)),e.url=n=>e.check(xo(Po,n)),e.jwt=n=>e.check(sc(Fc,n)),e.emoji=n=>e.check(Hs(Tc,n)),e.guid=n=>e.check(Eo($o,n)),e.uuid=n=>e.check(Vs(wt,n)),e.uuidv4=n=>e.check(Zs(wt,n)),e.uuidv6=n=>e.check(Gs(wt,n)),e.uuidv7=n=>e.check(Ws(wt,n)),e.nanoid=n=>e.check(qs(Rc,n)),e.guid=n=>e.check(Eo($o,n)),e.cuid=n=>e.check(Ks(Cc,n)),e.cuid2=n=>e.check(Ys(Pc,n)),e.ulid=n=>e.check(Xs(Nc,n)),e.base64=n=>e.check(ic(zc,n)),e.base64url=n=>e.check(oc(Lc,n)),e.xid=n=>e.check(Js(wc,n)),e.ksuid=n=>e.check(Qs(kc,n)),e.ipv4=n=>e.check(ec(Oc,n)),e.ipv6=n=>e.check(tc(Dc,n)),e.cidrv4=n=>e.check(rc(Mc,n)),e.cidrv6=n=>e.check(nc(jc,n)),e.e164=n=>e.check(ac(Uc,n)),e.datetime=n=>e.check(Qf(n)),e.date=n=>e.check(eg(n)),e.time=n=>e.check(tg(n)),e.duration=n=>e.check(rg(n))});function Io(e){return Cp(si,e)}var K=f("ZodStringFormat",(e,t)=>{q.init(e,t),Ic.init(e,t)}),$c=f("ZodEmail",(e,t)=>{Sm.init(e,t),K.init(e,t)});function $E(e){return Bs($c,e)}var $o=f("ZodGUID",(e,t)=>{bm.init(e,t),K.init(e,t)});function TE(e){return Eo($o,e)}var wt=f("ZodUUID",(e,t)=>{ym.init(e,t),K.init(e,t)});function RE(e){return Vs(wt,e)}function CE(e){return Zs(wt,e)}function PE(e){return Gs(wt,e)}function NE(e){return Ws(wt,e)}var Po=f("ZodURL",(e,t)=>{_m.init(e,t),K.init(e,t)});function wE(e){return xo(Po,e)}function kE(e){return xo(Po,{protocol:Je.httpProtocol,hostname:Je.domain,..._.normalizeParams(e)})}var Tc=f("ZodEmoji",(e,t)=>{Em.init(e,t),K.init(e,t)});function OE(e){return Hs(Tc,e)}var Rc=f("ZodNanoID",(e,t)=>{xm.init(e,t),K.init(e,t)});function DE(e){return qs(Rc,e)}var Cc=f("ZodCUID",(e,t)=>{Am.init(e,t),K.init(e,t)});function ME(e){return Ks(Cc,e)}var Pc=f("ZodCUID2",(e,t)=>{Im.init(e,t),K.init(e,t)});function jE(e){return Ys(Pc,e)}var Nc=f("ZodULID",(e,t)=>{$m.init(e,t),K.init(e,t)});function zE(e){return Xs(Nc,e)}var wc=f("ZodXID",(e,t)=>{Tm.init(e,t),K.init(e,t)});function LE(e){return Js(wc,e)}var kc=f("ZodKSUID",(e,t)=>{Rm.init(e,t),K.init(e,t)});function UE(e){return Qs(kc,e)}var Oc=f("ZodIPv4",(e,t)=>{km.init(e,t),K.init(e,t)});function FE(e){return ec(Oc,e)}var gg=f("ZodMAC",(e,t)=>{Dm.init(e,t),K.init(e,t)});function BE(e){return Np(gg,e)}var Dc=f("ZodIPv6",(e,t)=>{Om.init(e,t),K.init(e,t)});function VE(e){return tc(Dc,e)}var Mc=f("ZodCIDRv4",(e,t)=>{Mm.init(e,t),K.init(e,t)});function ZE(e){return rc(Mc,e)}var jc=f("ZodCIDRv6",(e,t)=>{jm.init(e,t),K.init(e,t)});function GE(e){return nc(jc,e)}var zc=f("ZodBase64",(e,t)=>{Lm.init(e,t),K.init(e,t)});function WE(e){return ic(zc,e)}var Lc=f("ZodBase64URL",(e,t)=>{Um.init(e,t),K.init(e,t)});function HE(e){return oc(Lc,e)}var Uc=f("ZodE164",(e,t)=>{Fm.init(e,t),K.init(e,t)});function qE(e){return ac(Uc,e)}var Fc=f("ZodJWT",(e,t)=>{Bm.init(e,t),K.init(e,t)});function KE(e){return sc(Fc,e)}var ci=f("ZodCustomStringFormat",(e,t)=>{Vm.init(e,t),K.init(e,t)});function YE(e,t,n={}){return ri(ci,e,t,n)}function XE(e){return ri(ci,"hostname",Je.hostname,e)}function JE(e){return ri(ci,"hex",Je.hex,e)}function QE(e,t){let n=t?.enc??"hex",i=`${e}_${n}`,r=Je[i];if(!r)throw new Error(`Unrecognized hash format: ${i}`);return ri(ci,i,r,t)}var ui=f("ZodNumber",(e,t)=>{ws.init(e,t),w.init(e,t),e._zod.processJSONSchema=(i,r,o)=>vf(e,i,r,o),Co(e,"ZodNumber",{gt(i,r){return this.check(Pt(i,r))},gte(i,r){return this.check(Me(i,r))},min(i,r){return this.check(Me(i,r))},lt(i,r){return this.check(Ct(i,r))},lte(i,r){return this.check(Qe(i,r))},max(i,r){return this.check(Qe(i,r))},int(i){return this.check(xc(i))},safe(i){return this.check(xc(i))},positive(i){return this.check(Pt(0,i))},nonnegative(i){return this.check(Me(0,i))},negative(i){return this.check(Ct(0,i))},nonpositive(i){return this.check(Qe(0,i))},multipleOf(i,r){return this.check(_r(i,r))},step(i,r){return this.check(_r(i,r))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function hg(e){return jp(ui,e)}var Qr=f("ZodNumberFormat",(e,t)=>{Zm.init(e,t),ui.init(e,t)});function xc(e){return Lp(Qr,e)}function ex(e){return Up(Qr,e)}function tx(e){return Fp(Qr,e)}function rx(e){return Bp(Qr,e)}function nx(e){return Vp(Qr,e)}var li=f("ZodBoolean",(e,t)=>{vo.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>bf(e,n,i,r)});function vg(e){return Zp(li,e)}var di=f("ZodBigInt",(e,t)=>{ks.init(e,t),w.init(e,t),e._zod.processJSONSchema=(i,r,o)=>yf(e,i,r,o),e.gte=(i,r)=>e.check(Me(i,r)),e.min=(i,r)=>e.check(Me(i,r)),e.gt=(i,r)=>e.check(Pt(i,r)),e.gte=(i,r)=>e.check(Me(i,r)),e.min=(i,r)=>e.check(Me(i,r)),e.lt=(i,r)=>e.check(Ct(i,r)),e.lte=(i,r)=>e.check(Qe(i,r)),e.max=(i,r)=>e.check(Qe(i,r)),e.positive=i=>e.check(Pt(BigInt(0),i)),e.negative=i=>e.check(Ct(BigInt(0),i)),e.nonpositive=i=>e.check(Qe(BigInt(0),i)),e.nonnegative=i=>e.check(Me(BigInt(0),i)),e.multipleOf=(i,r)=>e.check(_r(i,r));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function ix(e){return Wp(di,e)}var Bc=f("ZodBigIntFormat",(e,t)=>{Gm.init(e,t),di.init(e,t)});function ox(e){return qp(Bc,e)}function ax(e){return Kp(Bc,e)}var bg=f("ZodSymbol",(e,t)=>{Wm.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Sf(e,n,i,r)});function sx(e){return Yp(bg,e)}var yg=f("ZodUndefined",(e,t)=>{Hm.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ef(e,n,i,r)});function cx(e){return Xp(yg,e)}var Sg=f("ZodNull",(e,t)=>{qm.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>_f(e,n,i,r)});function _g(e){return Jp(Sg,e)}var Eg=f("ZodAny",(e,t)=>{Km.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>If(e,n,i,r)});function ux(){return Qp(Eg)}var xg=f("ZodUnknown",(e,t)=>{Ym.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>$f(e,n,i,r)});function Jr(){return ef(xg)}var Ag=f("ZodNever",(e,t)=>{Xm.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Af(e,n,i,r)});function Vc(e){return tf(Ag,e)}var Ig=f("ZodVoid",(e,t)=>{Jm.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>xf(e,n,i,r)});function lx(e){return rf(Ig,e)}var No=f("ZodDate",(e,t)=>{Qm.init(e,t),w.init(e,t),e._zod.processJSONSchema=(i,r,o)=>Tf(e,i,r,o),e.min=(i,r)=>e.check(Me(i,r)),e.max=(i,r)=>e.check(Qe(i,r));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function dx(e){return nf(No,e)}var $g=f("ZodArray",(e,t)=>{ep.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Lf(e,n,i,r),e.element=t.element,Co(e,"ZodArray",{min(n,i){return this.check(Xt(n,i))},nonempty(n){return this.check(Xt(1,n))},max(n,i){return this.check(Yr(n,i))},length(n,i){return this.check(Xr(n,i))},unwrap(){return this.element}})});function wo(e,t){return sf($g,e,t)}function mx(e){let t=e._zod.def.shape;return Gc(Object.keys(t))}var ko=f("ZodObject",(e,t)=>{tp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Uf(e,n,i,r),_.defineLazy(e,"shape",()=>t.shape),Co(e,"ZodObject",{keyof(){return Gc(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Jr()})},loose(){return this.clone({...this._zod.def,catchall:Jr()})},strict(){return this.clone({...this._zod.def,catchall:Vc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return _.extend(this,n)},safeExtend(n){return _.safeExtend(this,n)},merge(n){return _.merge(this,n)},pick(n){return _.pick(this,n)},omit(n){return _.omit(this,n)},partial(...n){return _.partial(Hc,this,n[0])},required(...n){return _.required(qc,this,n[0])}})});function px(e,t){let n={type:"object",shape:e??{},..._.normalizeParams(t)};return new ko(n)}function fx(e,t){return new ko({type:"object",shape:e,catchall:Vc(),..._.normalizeParams(t)})}function gx(e,t){return new ko({type:"object",shape:e,catchall:Jr(),..._.normalizeParams(t)})}var Oo=f("ZodUnion",(e,t)=>{bo.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>fc(e,n,i,r),e.options=t.options});function Zc(e,t){return new Oo({type:"union",options:e,..._.normalizeParams(t)})}var Tg=f("ZodXor",(e,t)=>{Oo.init(e,t),rp.init(e,t),e._zod.processJSONSchema=(n,i,r)=>fc(e,n,i,r),e.options=t.options});function hx(e,t){return new Tg({type:"union",options:e,inclusive:!1,..._.normalizeParams(t)})}var Rg=f("ZodDiscriminatedUnion",(e,t)=>{Oo.init(e,t),np.init(e,t)});function vx(e,t,n){return new Rg({type:"union",options:t,discriminator:e,..._.normalizeParams(n)})}var Cg=f("ZodIntersection",(e,t)=>{ip.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Ff(e,n,i,r)});function Pg(e,t){return new Cg({type:"intersection",left:e,right:t})}var Ng=f("ZodTuple",(e,t)=>{Os.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Bf(e,n,i,r),e.rest=n=>e.clone({...e._zod.def,rest:n})});function wg(e,t,n){let i=t instanceof N,r=i?n:t,o=i?t:null;return new Ng({type:"tuple",items:e,rest:o,..._.normalizeParams(r)})}var oi=f("ZodRecord",(e,t)=>{op.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Vf(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType});function kg(e,t,n){return!t||!t._zod?new oi({type:"record",keyType:Io(),valueType:e,..._.normalizeParams(t)}):new oi({type:"record",keyType:e,valueType:t,..._.normalizeParams(n)})}function bx(e,t,n){let i=Oe(e);return i._zod.values=void 0,new oi({type:"record",keyType:i,valueType:t,..._.normalizeParams(n)})}function yx(e,t,n){return new oi({type:"record",keyType:e,valueType:t,mode:"loose",..._.normalizeParams(n)})}var Og=f("ZodMap",(e,t)=>{ap.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>jf(e,n,i,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(Nt(...n)),e.nonempty=n=>e.check(Nt(1,n)),e.max=(...n)=>e.check(Er(...n)),e.size=(...n)=>e.check(Kr(...n))});function Sx(e,t,n){return new Og({type:"map",keyType:e,valueType:t,..._.normalizeParams(n)})}var Dg=f("ZodSet",(e,t)=>{sp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>zf(e,n,i,r),e.min=(...n)=>e.check(Nt(...n)),e.nonempty=n=>e.check(Nt(1,n)),e.max=(...n)=>e.check(Er(...n)),e.size=(...n)=>e.check(Kr(...n))});function _x(e,t){return new Dg({type:"set",valueType:e,..._.normalizeParams(t)})}var ai=f("ZodEnum",(e,t)=>{cp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(i,r,o)=>Rf(e,i,r,o),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(i,r)=>{let o={};for(let a of i)if(n.has(a))o[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ai({...t,checks:[],..._.normalizeParams(r),entries:o})},e.exclude=(i,r)=>{let o={...t.entries};for(let a of i)if(n.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new ai({...t,checks:[],..._.normalizeParams(r),entries:o})}});function Gc(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new ai({type:"enum",entries:n,..._.normalizeParams(t)})}function Ex(e,t){return new ai({type:"enum",entries:e,..._.normalizeParams(t)})}var Mg=f("ZodLiteral",(e,t)=>{up.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Cf(e,n,i,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function xx(e,t){return new Mg({type:"literal",values:Array.isArray(e)?e:[e],..._.normalizeParams(t)})}var jg=f("ZodFile",(e,t)=>{lp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>wf(e,n,i,r),e.min=(n,i)=>e.check(Nt(n,i)),e.max=(n,i)=>e.check(Er(n,i)),e.mime=(n,i)=>e.check(Yn(Array.isArray(n)?n:[n],i))});function Ax(e){return cf(jg,e)}var zg=f("ZodTransform",(e,t)=>{dp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Mf(e,n,i,r),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new hr(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(_.issue(o,n.value,t));else{let a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(_.issue(a))}};let r=t.transform(n.value,n);return r instanceof Promise?r.then(o=>(n.value=o,n.fallback=!0,n)):(n.value=r,n.fallback=!0,n)}});function Wc(e){return new zg({type:"transform",transform:e})}var Hc=f("ZodOptional",(e,t)=>{Ds.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>gc(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function To(e){return new Hc({type:"optional",innerType:e})}var Lg=f("ZodExactOptional",(e,t)=>{mp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>gc(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Ug(e){return new Lg({type:"optional",innerType:e})}var Fg=f("ZodNullable",(e,t)=>{pp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Zf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Ro(e){return new Fg({type:"nullable",innerType:e})}function Ix(e){return To(Ro(e))}var Bg=f("ZodDefault",(e,t)=>{fp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Wf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Vg(e,t){return new Bg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():_.shallowClone(t)}})}var Zg=f("ZodPrefault",(e,t)=>{gp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Hf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Gg(e,t){return new Zg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():_.shallowClone(t)}})}var qc=f("ZodNonOptional",(e,t)=>{hp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Gf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Wg(e,t){return new qc({type:"nonoptional",innerType:e,..._.normalizeParams(t)})}var Hg=f("ZodSuccess",(e,t)=>{vp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>kf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function $x(e){return new Hg({type:"success",innerType:e})}var qg=f("ZodCatch",(e,t)=>{bp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>qf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Kg(e,t){return new qg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Yg=f("ZodNaN",(e,t)=>{yp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Pf(e,n,i,r)});function Tx(e){return af(Yg,e)}var Do=f("ZodPipe",(e,t)=>{Ms.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Kf(e,n,i,r),e.in=t.in,e.out=t.out});function Ac(e,t){return new Do({type:"pipe",in:e,out:t})}var Mo=f("ZodCodec",(e,t)=>{Do.init(e,t),yo.init(e,t)});function Rx(e,t,n){return new Mo({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function Cx(e){let t=e._zod.def;return new Mo({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Xg=f("ZodPreprocess",(e,t)=>{Do.init(e,t),Sp.init(e,t)}),Jg=f("ZodReadonly",(e,t)=>{_p.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Yf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Qg(e){return new Jg({type:"readonly",innerType:e})}var eh=f("ZodTemplateLiteral",(e,t)=>{Ep.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Nf(e,n,i,r)});function Px(e,t){return new eh({type:"template_literal",parts:e,..._.normalizeParams(t)})}var th=f("ZodLazy",(e,t)=>{Ip.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Jf(e,n,i,r),e.unwrap=()=>e._zod.def.getter()});function rh(e){return new th({type:"lazy",getter:e})}var nh=f("ZodPromise",(e,t)=>{Ap.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Xf(e,n,i,r),e.unwrap=()=>e._zod.def.innerType});function Nx(e){return new nh({type:"promise",innerType:e})}var ih=f("ZodFunction",(e,t)=>{xp.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Df(e,n,i,r)});function wx(e){return new ih({type:"function",input:Array.isArray(e?.input)?wg(e?.input):e?.input??wo(Jr()),output:e?.output??Jr()})}var jo=f("ZodCustom",(e,t)=>{$p.init(e,t),w.init(e,t),e._zod.processJSONSchema=(n,i,r)=>Of(e,n,i,r)});function kx(e){let t=new X({check:"custom"});return t._zod.check=e,t}function Ox(e,t){return uf(jo,e??(()=>!0),t)}function oh(e,t={}){return lf(jo,e,t)}function ah(e,t){return df(e,t)}var Dx=mf,Mx=pf;function jx(e,t={}){let n=new jo({type:"custom",check:"custom",fn:i=>i instanceof e,abort:!0,..._.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=i=>{i.value instanceof e||i.issues.push({code:"invalid_type",expected:e.name,input:i.value,inst:n,path:[...n._zod.def.path??[]]})},n}var zx=(...e)=>ff({Codec:Mo,Boolean:li,String:si},...e);function Lx(e){let t=rh(()=>Zc([Io(e),hg(),vg(),_g(),wo(t),kg(Io(),t)]));return t}function Ux(e,t){return new Xg({type:"pipe",in:Wc(e),out:t})}var f1={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function g1(e){se({customError:e})}function h1(){return se().customError}var sh;sh||(sh={});var x={...Ao,...bc,iso:ii},v1=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function b1(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function y1(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let i=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===i){let r=n[1];if(!r||!t.defs[r])throw new Error(`Reference not found: ${e}`);return t.defs[r]}throw new Error(`Reference not found: ${e}`)}function Fx(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return x.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let r=e.$ref;if(t.refs.has(r))return t.refs.get(r);if(t.processing.has(r))return x.lazy(()=>{if(!t.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return t.refs.get(r)});t.processing.add(r);let o=y1(r,t),a=Te(o,t);return t.refs.set(r,a),t.processing.delete(r),a}if(e.enum!==void 0){let r=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&r.length===1&&r[0]===null)return x.null();if(r.length===0)return x.never();if(r.length===1)return x.literal(r[0]);if(r.every(a=>typeof a=="string"))return x.enum(r);let o=r.map(a=>x.literal(a));return o.length<2?o[0]:x.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return x.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(o=>{let a={...e,type:o};return Fx(a,t)});return r.length===0?x.never():r.length===1?r[0]:x.union(r)}if(!n)return x.any();let i;switch(n){case"string":{let r=x.string();if(e.format){let o=e.format;o==="email"?r=r.check(x.email()):o==="uri"||o==="uri-reference"?r=r.check(x.url()):o==="uuid"||o==="guid"?r=r.check(x.uuid()):o==="date-time"?r=r.check(x.iso.datetime()):o==="date"?r=r.check(x.iso.date()):o==="time"?r=r.check(x.iso.time()):o==="duration"?r=r.check(x.iso.duration()):o==="ipv4"?r=r.check(x.ipv4()):o==="ipv6"?r=r.check(x.ipv6()):o==="mac"?r=r.check(x.mac()):o==="cidr"?r=r.check(x.cidrv4()):o==="cidr-v6"?r=r.check(x.cidrv6()):o==="base64"?r=r.check(x.base64()):o==="base64url"?r=r.check(x.base64url()):o==="e164"?r=r.check(x.e164()):o==="jwt"?r=r.check(x.jwt()):o==="emoji"?r=r.check(x.emoji()):o==="nanoid"?r=r.check(x.nanoid()):o==="cuid"?r=r.check(x.cuid()):o==="cuid2"?r=r.check(x.cuid2()):o==="ulid"?r=r.check(x.ulid()):o==="xid"?r=r.check(x.xid()):o==="ksuid"&&(r=r.check(x.ksuid()))}typeof e.minLength=="number"&&(r=r.min(e.minLength)),typeof e.maxLength=="number"&&(r=r.max(e.maxLength)),e.pattern&&(r=r.regex(new RegExp(e.pattern))),i=r;break}case"number":case"integer":{let r=n==="integer"?x.number().int():x.number();typeof e.minimum=="number"&&(r=r.min(e.minimum)),typeof e.maximum=="number"&&(r=r.max(e.maximum)),typeof e.exclusiveMinimum=="number"?r=r.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(r=r.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?r=r.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(r=r.lt(e.maximum)),typeof e.multipleOf=="number"&&(r=r.multipleOf(e.multipleOf)),i=r;break}case"boolean":{i=x.boolean();break}case"null":{i=x.null();break}case"object":{let r={},o=e.properties||{},a=new Set(e.required||[]);for(let[u,l]of Object.entries(o)){let m=Te(l,t);r[u]=a.has(u)?m:m.optional()}if(e.propertyNames){let u=Te(e.propertyNames,t),l=e.additionalProperties&&typeof e.additionalProperties=="object"?Te(e.additionalProperties,t):x.any();if(Object.keys(r).length===0){i=x.record(u,l);break}let m=x.object(r).passthrough(),p=x.looseRecord(u,l);i=x.intersection(m,p);break}if(e.patternProperties){let u=e.patternProperties,l=Object.keys(u),m=[];for(let g of l){let v=Te(u[g],t),A=x.string().regex(new RegExp(g));m.push(x.looseRecord(A,v))}let p=[];if(Object.keys(r).length>0&&p.push(x.object(r).passthrough()),p.push(...m),p.length===0)i=x.object({}).passthrough();else if(p.length===1)i=p[0];else{let g=x.intersection(p[0],p[1]);for(let v=2;v<p.length;v++)g=x.intersection(g,p[v]);i=g}break}let c=x.object(r);e.additionalProperties===!1?i=c.strict():typeof e.additionalProperties=="object"?i=c.catchall(Te(e.additionalProperties,t)):i=c.passthrough();break}case"array":{let r=e.prefixItems,o=e.items;if(r&&Array.isArray(r)){let a=r.map(u=>Te(u,t)),c=o&&typeof o=="object"&&!Array.isArray(o)?Te(o,t):void 0;c?i=x.tuple(a).rest(c):i=x.tuple(a),typeof e.minItems=="number"&&(i=i.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(x.maxLength(e.maxItems)))}else if(Array.isArray(o)){let a=o.map(u=>Te(u,t)),c=e.additionalItems&&typeof e.additionalItems=="object"?Te(e.additionalItems,t):void 0;c?i=x.tuple(a).rest(c):i=x.tuple(a),typeof e.minItems=="number"&&(i=i.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(i=i.check(x.maxLength(e.maxItems)))}else if(o!==void 0){let a=Te(o,t),c=x.array(a);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),i=c}else i=x.array(x.any());break}default:throw new Error(`Unsupported type: ${n}`)}return i}function Te(e,t){if(typeof e=="boolean")return e?x.any():x.never();let n=Fx(e,t),i=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let c=e.anyOf.map(l=>Te(l,t)),u=x.union(c);n=i?x.intersection(n,u):u}if(e.oneOf&&Array.isArray(e.oneOf)){let c=e.oneOf.map(l=>Te(l,t)),u=x.xor(c);n=i?x.intersection(n,u):u}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=i?n:x.any();else{let c=i?n:Te(e.allOf[0],t),u=i?0:1;for(let l=u;l<e.allOf.length;l++)c=x.intersection(c,Te(e.allOf[l],t));n=c}e.nullable===!0&&t.version==="openapi-3.0"&&(n=x.nullable(n)),e.readOnly===!0&&(n=x.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let r={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let c of o)c in e&&(r[c]=e[c]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let c of a)c in e&&(r[c]=e[c]);for(let c of Object.keys(e))v1.has(c)||(r[c]=e[c]);return Object.keys(r).length>0&&t.registry.add(n,r),e.description&&(n=n.describe(e.description)),n}function Bx(e,t){if(typeof e=="boolean")return e?x.any():x.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let i=b1(n,t?.defaultTarget),r=n.$defs||n.definitions||{},o={version:i,defs:r,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??_e};return Te(n,o)}var ch={};$t(ch,{bigint:()=>x1,boolean:()=>E1,date:()=>A1,number:()=>_1,string:()=>S1});function S1(e){return Pp(si,e)}function _1(e){return zp(ui,e)}function E1(e){return Gp(li,e)}function x1(e){return Hp(di,e)}function A1(e){return of(No,e)}se(js());var I1=Object.defineProperty,en=(e,t)=>I1(e,"name",{value:t,configurable:!0}),uh=["production","staging","development","platform","compliance"],Vx={production:"Production",staging:"Staging",development:"Development",platform:"Platform",compliance:"Compliance"},$1=new Set(uh);function Kc(e){return $1.has(e)}en(Kc,"isAccountStage");var Lo={ROOT:"root",PLATFORM:"platform"},T1=[...uh,Lo.ROOT];function Zx(e){return Kc(e)?Vx[e]:e.charAt(0).toUpperCase()+e.slice(1)}en(Zx,"getEnvironmentLabel");var lh=["organisation","platform","account"],R1=s.enum(lh),zo={ORGANISATION:"organisation",PLATFORM:"platform",ACCOUNT:"account"},C1={[zo.ORGANISATION]:!0,[zo.PLATFORM]:!0,[zo.ACCOUNT]:!0},P1=new Set(Object.keys(C1));function Gx(e){return P1.has(e)}en(Gx,"isAccountTier");var Wx=lh.filter(e=>e!==zo.ACCOUNT),N1=new Set(Wx);function Hx(e){return N1.has(e)}en(Hx,"isGovernanceTier");function dh(e){return e===Lo.ROOT?"organisation":e===Lo.PLATFORM?"platform":"account"}en(dh,"environmentToTier");function qx(e){return e==null||e===""||e===Lo.ROOT?null:Kc(e)?e:null}en(qx,"stageFromWireEnvironment");function Uo(e){return e.tier??dh(e.environment)}en(Uo,"accountTier");var w1=Object.defineProperty,Fo=(e,t)=>w1(e,"name",{value:t,configurable:!0});var Kx=Object.freeze({"AWS::IAM::Role":"security","AWS::IAM::Policy":"security","AWS::IAM::OIDCProvider":"security","AWS::EC2::SecurityGroup":"security","AWS::KMS::Key":"security","AWS::KMS::Alias":"security","AWS::EC2::VPC":"network","AWS::EC2::Subnet":"network","AWS::EC2::InternetGateway":"network","AWS::EC2::NatGateway":"network","AWS::EC2::RouteTable":"network","AWS::EC2::Route":"network","AWS::EC2::VPCGatewayAttachment":"network","AWS::EC2::SubnetRouteTableAssociation":"network","AWS::EC2::EIP":"network","AWS::ECS::Cluster":"compute","AWS::ECS::Service":"compute","AWS::ECS::TaskDefinition":"compute","AWS::Lambda::Function":"compute","AWS::ElasticLoadBalancingV2::LoadBalancer":"compute","AWS::ElasticLoadBalancingV2::TargetGroup":"compute","AWS::ElasticLoadBalancingV2::Listener":"compute","AWS::ElasticLoadBalancingV2::ListenerRule":"compute","AWS::RDS::DBInstance":"database","AWS::RDS::DBCluster":"database","AWS::SecretsManager::Secret":"database","AWS::S3::Bucket":"storage","AWS::S3::BucketPolicy":"storage","AWS::CloudTrail::Trail":"monitoring","AWS::CloudWatch::Alarm":"monitoring","AWS::Logs::LogGroup":"monitoring","AWS::Events::EventBus":"events","AWS::Events::Rule":"events","AWS::ECR::Repository":"registry","AWS::CodeBuild::Project":"registry","AWS::Route53::RecordSet":"dns","AWS::CertificateManager::Certificate":"dns","AWS::CloudFront::Distribution":"dns","AWS::Backup::BackupVault":"backup","AWS::Backup::BackupPlan":"backup","AWS::Backup::BackupSelection":"backup","AWS::SSO::PermissionSet":"identity","AWS::SSO::Assignment":"identity","AWS::Organizations::Account":"identity","AWS::CDK::Metadata":"compute","AWS::CloudFormation::CustomResource":"compute","AWS::CloudFormation::WaitCondition":"compute","AWS::CloudFormation::WaitConditionHandle":"compute"}),mh=new Set;function Yx(e){if(!e)return"compute";if(e.startsWith("Custom::"))return Kx[e]??"compute";let t=Kx[e];return t||mh.add(e),t??"compute"}Fo(Yx,"categoriseResource");function k1(){return new Set(mh)}Fo(k1,"getUnmappedResourceTypes");function O1(){mh.clear()}Fo(O1,"clearUnmappedResourceTypes");var D1=Object.freeze({"AWS::EC2::NatGateway":120,"AWS::RDS::DBInstance":300,"AWS::RDS::DBCluster":300,"AWS::CloudFront::Distribution":300,"AWS::ECS::Service":180,"AWS::ElasticLoadBalancingV2::LoadBalancer":60,"AWS::EC2::SecurityGroup":10,"AWS::IAM::Role":15,"AWS::IAM::Policy":15,"AWS::IAM::OIDCProvider":10,"AWS::S3::Bucket":10,"AWS::S3::BucketPolicy":5,"AWS::Lambda::Function":30,"AWS::EC2::VPC":15,"AWS::EC2::Subnet":15,"AWS::EC2::InternetGateway":10,"AWS::EC2::RouteTable":5,"AWS::EC2::Route":5,"AWS::EC2::VPCGatewayAttachment":10,"AWS::EC2::SubnetRouteTableAssociation":5,"AWS::EC2::EIP":10,"AWS::ECS::Cluster":15,"AWS::ECS::TaskDefinition":10,"AWS::ElasticLoadBalancingV2::TargetGroup":10,"AWS::ElasticLoadBalancingV2::Listener":10,"AWS::ElasticLoadBalancingV2::ListenerRule":5,"AWS::SecretsManager::Secret":10,"AWS::Logs::LogGroup":5,"AWS::CloudWatch::Alarm":10,"AWS::CloudTrail::Trail":15,"AWS::Events::EventBus":5,"AWS::Events::Rule":5,"AWS::ECR::Repository":10,"AWS::Route53::RecordSet":30,"AWS::CertificateManager::Certificate":60,"AWS::KMS::Key":15,"AWS::KMS::Alias":5,"AWS::Backup::BackupVault":10,"AWS::Backup::BackupPlan":10,"AWS::Backup::BackupSelection":10,"AWS::SSO::PermissionSet":15,"AWS::SSO::Assignment":10,"AWS::Organizations::Account":60}),M1=30;function Xx(e){return D1[e]??M1}Fo(Xx,"getExpectedDuration");var j1=Object.freeze({"AWS::Lambda::Function":"Lambda Function","AWS::IAM::Role":"IAM Role","AWS::IAM::Policy":"IAM Policy","AWS::S3::Bucket":"S3 Bucket","AWS::DynamoDB::Table":"DynamoDB Table","AWS::EC2::Instance":"EC2 Instance","AWS::EC2::SecurityGroup":"Security Group","AWS::EC2::VPC":"VPC","AWS::EC2::Subnet":"Subnet","AWS::EC2::InternetGateway":"Internet Gateway","AWS::EC2::RouteTable":"Route Table","AWS::EC2::Route":"Route","AWS::ECS::Cluster":"ECS Cluster","AWS::ECS::Service":"ECS Service","AWS::ECS::TaskDefinition":"Task Definition","AWS::ElasticLoadBalancingV2::LoadBalancer":"Load Balancer","AWS::ElasticLoadBalancingV2::TargetGroup":"Target Group","AWS::ElasticLoadBalancingV2::Listener":"Listener","AWS::CloudFormation::Stack":"CloudFormation Stack","AWS::CDK::Metadata":"CDK Metadata","Custom::CDKBucketDeployment":"Bucket Deployment","AWS::SSM::Parameter":"SSM Parameter","AWS::CloudWatch::Alarm":"CloudWatch Alarm","AWS::Logs::LogGroup":"Log Group","AWS::ApiGateway::RestApi":"API Gateway","AWS::ApiGateway::Deployment":"API Deployment","AWS::ApiGateway::Stage":"API Stage","AWS::ApiGateway::Method":"API Method","AWS::ApiGateway::Resource":"API Resource","AWS::CloudFront::Distribution":"CloudFront Distribution","AWS::Route53::RecordSet":"Route53 Record","AWS::RDS::DBInstance":"RDS Instance","AWS::RDS::DBCluster":"RDS Cluster","AWS::SQS::Queue":"SQS Queue","AWS::SNS::Topic":"SNS Topic","AWS::Events::Rule":"EventBridge Rule","AWS::StepFunctions::StateMachine":"Step Function","AWS::EC2::NatGateway":"NAT Gateway","AWS::EC2::EIP":"Elastic IP","AWS::EC2::VPCGatewayAttachment":"Gateway Attachment","AWS::EC2::SubnetRouteTableAssociation":"Route Association","AWS::CloudTrail::Trail":"CloudTrail","AWS::IAM::OIDCProvider":"OIDC Provider","AWS::Events::EventBus":"Event Bus","AWS::Backup::BackupVault":"Backup Vault","AWS::Backup::BackupPlan":"Backup Plan","AWS::Backup::BackupSelection":"Backup Selection","AWS::SecretsManager::Secret":"Secret","AWS::KMS::Key":"KMS Key","AWS::KMS::Alias":"KMS Alias","AWS::ECR::Repository":"ECR Repository","AWS::CertificateManager::Certificate":"Certificate","AWS::ElasticLoadBalancingV2::ListenerRule":"Listener Rule","AWS::EC2::IPAM":"IPAM","AWS::EC2::IPAMPool":"IPAM Pool","AWS::EC2::IPAMPoolCidr":"IPAM Pool CIDR","Custom::ram":"RAM","Custom::ipamDelegateAdmin":"IPAM Delegate Admin","Custom::CostAllocationTags":"Cost Allocation Tags","Custom::ActivateOrganisationsAccess":"Activate Organisations Access","Custom::Organizations_TagResource":"Organisations Tag Resource","AWS::CloudFormation::CustomResource":"Custom Resource","AWS::CloudFormation::WaitCondition":"Wait Condition","AWS::CloudFormation::WaitConditionHandle":"Wait Condition Handle","AWS::SSO::PermissionSet":"SSO Permission Set","AWS::SSO::Assignment":"SSO Assignment","AWS::Organizations::Account":"Organisations Account","AWS::S3::BucketPolicy":"S3 Bucket Policy","AWS::CodeBuild::Project":"CodeBuild Project"});function Jx(e){return j1[e]||e.split("::").pop()||e}Fo(Jx,"getFriendlyResourceType");var z1=Object.defineProperty,L1=(e,t)=>z1(e,"name",{value:t,configurable:!0}),U1={"github.com":"github","gitlab.com":"gitlab","bitbucket.org":"bitbucket"},F1=/^https?:\/\/([^/]+)\/(.+?)\/([^/.]+?)(?:\.git)?$/,B1=/^git@([^:]+):(.+?)\/([^/.]+?)(?:\.git)?$/,V1=/^ssh:\/\/[^@]+@([^:/]+)(?::\d+)?\/(.+?)\/([^/.]+?)(?:\.git)?$/;function Qx(e){if(!e)return null;let t=e.replace(/^(https?:\/\/)[^@]+@/,"$1"),n=t.match(F1)??t.match(B1)??e.match(V1);if(!n)return null;let[,i,r,o]=n;return!i||!r||!o?null:{provider:U1[i]??"other",owner:r,repo:o,host:i}}L1(Qx,"parseGitRemoteUrl");var ph=["read","write","deploy","secrets:read","secrets:write","destroy","admin","applications:read","applications:deploy","deploy:oidc:mint","deploy:governance"],eA={read:"user",write:"user",deploy:"user","secrets:read":"user","secrets:write":"user",destroy:"user",admin:"admin","applications:read":"user","applications:deploy":"user","deploy:oidc:mint":"machine","deploy:governance":"machine"},Z1=ph.filter(e=>eA[e]==="machine");var G1=ph.filter(e=>eA[e]==="user");var W1=Object.defineProperty,mi=(e,t)=>W1(e,"name",{value:t,configurable:!0}),Xc=/^[a-zA-Z_][a-zA-Z0-9._-]*$/,fh="Secret name must start with a letter or underscore and contain only letters, numbers, underscores, hyphens, or periods",Bo=/^[a-zA-Z][a-zA-Z0-9._-]*$/,Jc="Must start with a letter and contain only letters, numbers, periods, hyphens, or underscores";var Yc=s.string().regex(Bo,Jc),tA=s.object({app:Yc.describe("Application name"),cluster:Yc.optional().describe("Cluster name"),service:Yc.optional().describe("Service name"),lambda:Yc.optional().describe("Lambda function name")}).strict().refine(e=>!(e.service&&!e.cluster),{message:"Cluster is required when service is specified"}).refine(e=>!(e.lambda&&(e.cluster||e.service)),{message:"Lambda is mutually exclusive with cluster and service"}).refine(e=>e.cluster!=="lambda",{message:'The cluster name "lambda" is reserved for lambda-scoped parameter paths'});function gh(e){let t=[e.app];return e.lambda?t.push("lambda",e.lambda):(e.cluster&&t.push(e.cluster),e.service&&e.cluster&&t.push(e.service)),t}mi(gh,"buildNamespaceParts");function hh(e,t){let n=gh(e);return t&&n.push(t),"/"+n.join("/")}mi(hh,"buildParameterPath");function vh(e){let t=e.split("/").filter(Boolean);if(t.length<2)return null;let n=t[t.length-1]??"",i={app:t[0]??""};return t.length>=4&&t[1]==="lambda"?i.lambda=t[2]:t.length>=3&&(i.cluster=t[1],t.length>=4&&(i.service=t[2])),{namespace:i,name:n}}mi(vh,"parseParameterPath");function rA(e){let t=vh(e);return t?tA.safeParse(t.namespace).success&&hh(t.namespace,t.name)===e:!1}mi(rA,"isManageablePath");function nA(e){let t={};for(let n of e.split(`
|
|
165
165
|
`)){let i=n.trim();if(!i||i.startsWith("#"))continue;let r=i.replace(/^export\s+/,""),o=r.indexOf("=");if(o===-1)continue;let a=r.slice(0,o).trim();if(!Xc.test(a))continue;let c=r.slice(o+1);c.length>=2&&c.startsWith('"')&&c.endsWith('"')?t[a]=c.slice(1,-1).replace(/\\([\\"$`nr])/g,(u,l)=>l==="n"?`
|
|
166
|
-
`:l==="r"?"\r":l):c.length>=2&&c.startsWith("'")&&c.endsWith("'")?t[a]=c.slice(1,-1):t[a]=c}return t}mi(nA,"parseDotEnv");function iA(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\$/g,"\\$").replace(/`/g,"\\`").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}mi(iA,"escapeDotEnvValue");var oA=s.object({awsAccountId:s.string(),accountName:s.string().nullable(),status:s.string(),role:s.string(),roleArn:s.string(),environment:s.string().optional(),connectedAt:s.string()}),H1=s.object({accounts:s.array(oA)});var q1=Object.defineProperty,tn=(e,t)=>q1(e,"name",{value:t,configurable:!0});function bh(e){let t=[e.primaryRegion,...e.secondaryRegions??[],e.disasterRecoveryRegion].filter(n=>n!==void 0);return[...new Set(t)]}tn(bh,"deriveRegionsFromOrgConfig");function yh(e){return e.environment??Uo(e)}tn(yh,"environmentOrTier");function Sh(e,t){return`${e.toLowerCase()}-${wn(t)}`}tn(Sh,"generateTargetName");function _h(e,t){let n=[];for(let i of e){if(Uo(i)==="organisation")continue;let r=yh(i);for(let o of t)n.push({name:Sh(i.name,o),accountName:i.name,accountId:i.id,environment:r,region:o})}return n.sort((i,r)=>{let o=i.environment.localeCompare(r.environment);if(o!==0)return o;let a=i.accountName.localeCompare(r.accountName);return a!==0?a:i.region.localeCompare(r.region)})}tn(_h,"deriveTargets");function aA(e){return _h(e.providerAccounts,bh(e))}tn(aA,"deriveAllTargets");function K1(e,t){if(t.length===0)return e;let n=new Set([e.primaryRegion,e.disasterRecoveryRegion].filter(Boolean)),i=t.filter(r=>!n.has(r));return{...e,secondaryRegions:i.length>0?i:void 0}}tn(K1,"mergeSecondaryRegions");function sA(e,t){return e.find(n=>n.name===t)}tn(sA,"findTarget");var Y1=Object.defineProperty,X1=(e,t)=>Y1(e,"name",{value:t,configurable:!0});function cA(e,t){if(t!==void 0){if(t.trim()==="")throw new Error("buildAppConfigPath: container must be a non-empty string");return`${t}/fjall/${e}`}return`fjall/${e}`}X1(cA,"buildAppConfigPath");var J1=Object.defineProperty,pi=(e,t)=>J1(e,"name",{value:t,configurable:!0}),Eh="infrastructure.ts",xh="fjall";function uA(e,t){let n=t?.excludedPathPrefixes,i=t?.excludedPathSegments,r=[];for(let o of e){if(!Ah(o.path)||n&&dA(o.path,n)||i&&mA(o.path,i))continue;let a=Ih(o.path);a!==null&&r.push({configPath:lA(o.path),boundaryPath:a})}return r}pi(uA,"findInfrastructurePaths");function Ah(e){return e===Eh||e.endsWith(`/${Eh}`)}pi(Ah,"isInfrastructureFile");function Ih(e){let t=e.split("/");for(let n=0;n<t.length-1;n++)if(t[n]===xh)return t.slice(0,n+1).join("/");return null}pi(Ih,"findBoundaryPath");function lA(e){return e.slice(0,-`/${Eh}`.length)}pi(lA,"toConfigDir");function dA(e,t){for(let n of t)if(e.startsWith(n))return!0;return!1}pi(dA,"hasExcludedPrefix");function mA(e,t){let n=e.split("/");for(let i=0;i<n.length-1;i++)if(t.has(n[i]))return!0;return!1}pi(mA,"hasExcludedSegment");var Q1=Object.defineProperty,$h=(e,t)=>Q1(e,"name",{value:t,configurable:!0});function pA(e){if(e.length===0)return null;let t=[];for(let i of e){let r=fA(i.boundaryPath);if(r===null)return null;t.push(r)}let n=gA(t);return n.length===0?null:n.join("/")}$h(pA,"inferContainerFromCandidates");function fA(e){let t=e.split("/").filter(i=>i.length>0);if(t.length===0||t[t.length-1]!==xh)return null;let n=t.slice(0,t.length-1);return n.length===0?null:n}$h(fA,"extractContainer");function gA(e){if(e.length===0)return[];let[t,...n]=e,i=[];for(let r=0;r<t.length;r+=1){let o=t[r];for(let a of n)if(a[r]!==o)return i;i.push(o)}return i}$h(gA,"longestCommonPrefix");var eM=Object.defineProperty,hA=(e,t)=>eM(e,"name",{value:t,configurable:!0}),vA=["fjall","organisation","platform","account","domain"];function bA(e){return vA.includes(e.toLowerCase())}hA(bA,"isReservedAppName");var yA="-cache";function SA(e){return Tt(e).endsWith(yA)}hA(SA,"hasReservedAppNameSuffix");var tM=Object.defineProperty,Th=(e,t)=>tM(e,"name",{value:t,configurable:!0});function EA(e){return{success:!0,data:e}}Th(EA,"success");function Vo(e){return{success:!1,error:e}}Th(Vo,"failure");var _A="sha256:",Qc=12,rM=new RegExp(`-sha-[0-9a-f]{${Qc}}$`);function xA(e,t,n){if(!e.startsWith(_A))return Vo(new Error(`expected sha256:... digest, got ${e.slice(0,32)}`));let i=e.slice(_A.length);if(i.length<Qc)return Vo(new Error(`digest hex payload too short (need >=${Qc} chars, got ${i.length})`));let r=t.trim();if(r==="")return Vo(new Error("serviceName must be a non-empty string"));let o;if(n!==void 0){let u=n.trim();if(u==="")return Vo(new Error("target, when supplied, must be a non-empty string; omit the argument instead"));o=u.toLowerCase()}let a=i.slice(0,Qc).toLowerCase(),c=o!==void 0?`${r.toLowerCase()}-${o}`:r.toLowerCase();return EA(`${c}-sha-${a}`)}Th(xA,"deriveContentHashTag");var nM=Object.defineProperty,iM=(e,t)=>nM(e,"name",{value:t,configurable:!0}),AA=["full","code-only","rollback","restart"],oM=s.enum(AA),IA=/^[a-zA-Z0-9._-]+$/,$A=s.string().min(1).max(128).regex(IA),TA=s.object({serviceName:s.string().min(1),imageTag:$A,imageDigest:s.string().min(1).optional(),imageUri:s.string().min(1),ecrRepositoryArn:s.string().min(1).optional(),taskDefinitionArn:s.string().min(1).optional(),previousTaskDefinitionArn:s.string().min(1).optional(),functionArn:s.string().min(1).optional(),publishedVersion:s.string().min(1).optional()}).strict(),aM=s.array(TA);function RA(e,t){return`${e}${t}`}iM(RA,"artefactOutputKey");var sM=Object.defineProperty,CA=(e,t)=>sM(e,"name",{value:t,configurable:!0}),kt=["payload","nextjs","staticsite"],Rh=new Set(kt);function Ch(e){return typeof e=="string"&&Rh.has(e)}CA(Ch,"isPatternType");var fi={payload:{label:"Payload CMS",constructIdSuffix:"Payload",artefact:"opennext-lambda",stackPlacement:"compute",deployable:!0},nextjs:{label:"Next.js",constructIdSuffix:"Nextjs",artefact:"opennext-lambda",stackPlacement:"compute",deployable:!1},staticsite:{label:"Static site",constructIdSuffix:"StaticSite",artefact:"static-assets",stackPlacement:"cdn",deployable:!0}},PA=kt.filter(e=>fi[e].deployable),Ph=kt.filter(e=>fi[e].artefact==="opennext-lambda"),cM=new Set(Ph);function Nh(e){return e!=null&&cM.has(e)}CA(Nh,"isOpenNextPatternType");var Zo=["multipage","spa"];var uM=Object.defineProperty,wh=(e,t)=>uM(e,"name",{value:t,configurable:!0}),NA="noreply";function wA(e){return`${NA}@${e}`}wh(wA,"defaultFormsFromAddress");function kA(e){return`https://${e}`}wh(kA,"defaultFormsCorsOrigin");function eu(e,t){let n=e.split("@");if(n.length!==2)return!1;let[i,r]=n;return i===void 0||i===""||r===void 0?!1:r.toLowerCase()===t.toLowerCase()}wh(eu,"isAddressAtDomain");var OA=2;var lM=s.object({devDomain:s.string().min(1),hostedZoneId:s.string().min(1).optional(),parentDomain:s.string().min(1).optional(),parentDelegationRoleArn:s.string().min(1).optional()}).strict().superRefine((e,t)=>{if(e.hostedZoneId!==void 0){e.parentDomain!==void 0&&t.addIssue({code:"custom",path:["parentDomain"],message:"hostedZoneId (adopt mode) is mutually exclusive with parentDomain \u2014 the adopted zone was already delegated; omit parentDomain"}),e.parentDelegationRoleArn!==void 0&&t.addIssue({code:"custom",path:["parentDelegationRoleArn"],message:"hostedZoneId (adopt mode) is mutually exclusive with parentDelegationRoleArn \u2014 the adopted zone was already delegated; omit parentDelegationRoleArn"});return}e.parentDelegationRoleArn!==void 0&&e.parentDomain===void 0&&t.addIssue({code:"custom",path:["parentDomain"],message:"parentDelegationRoleArn requires parentDomain \u2014 set parentDomain to the parent zone the DelegationRole belongs to"}),e.parentDomain!==void 0&&!e.devDomain.endsWith(`.${e.parentDomain}`)&&t.addIssue({code:"custom",path:["parentDomain"],message:"parentDomain must be a proper DNS suffix of devDomain \u2014 devDomain must end with `.<parentDomain>`"})}),DA={appId:s.string().min(1),appKebab:s.string().min(1),engineVersion:s.string().min(1).optional(),adoptSlotEcr:s.boolean().optional(),phase:s.enum(["zone","full"]).optional(),domain:lM.optional()},dM=s.object(DA).strict(),mM=s.object({...DA,version:s.literal(OA),appName:s.string().min(1)}).strict().refine(e=>e.appName===`fjall-dev-${e.appKebab}`,{message:"appName must equal `fjall-dev-${appKebab}` (single-source identity)",path:["appName"]});import{existsSync as TI,mkdirSync as Qj,statSync as ez,appendFileSync as tz}from"fs";import{join as RI}from"path";import{join as uv}from"path";var fM=Object.defineProperty,MA=(e,t)=>fM(e,"name",{value:t,configurable:!0});function jA(e){return e.mode==="cli"}MA(jA,"isCLIMode");function zA(e){return e.mode==="ink"}MA(zA,"isInkMode");var LA=(e=0)=>t=>`\x1B[${t+e}m`,UA=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,FA=(e=0)=>(t,n,i)=>`\x1B[${38+e};2;${t};${n};${i}m`,re={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Z3=Object.keys(re.modifier),gM=Object.keys(re.color),hM=Object.keys(re.bgColor),G3=[...gM,...hM];function vM(){let e=new Map;for(let[t,n]of Object.entries(re)){for(let[i,r]of Object.entries(n))re[i]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},n[i]=re[i],e.set(r[0],r[1]);Object.defineProperty(re,t,{value:n,enumerable:!1})}return Object.defineProperty(re,"codes",{value:e,enumerable:!1}),re.color.close="\x1B[39m",re.bgColor.close="\x1B[49m",re.color.ansi=LA(),re.color.ansi256=UA(),re.color.ansi16m=FA(),re.bgColor.ansi=LA(10),re.bgColor.ansi256=UA(10),re.bgColor.ansi16m=FA(10),Object.defineProperties(re,{rgbToAnsi256:{value(t,n,i){return t===n&&n===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},enumerable:!1},hexToRgb:{value(t){let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!n)return[0,0,0];let[i]=n;i.length===3&&(i=[...i].map(o=>o+o).join(""));let r=Number.parseInt(i,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:t=>re.rgbToAnsi256(...re.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let n,i,r;if(t>=232)n=((t-232)*10+8)/255,i=n,r=n;else{t-=16;let c=t%36;n=Math.floor(t/36)/5,i=Math.floor(c/6)/5,r=c%6/5}let o=Math.max(n,i,r)*2;if(o===0)return 30;let a=30+(Math.round(r)<<2|Math.round(i)<<1|Math.round(n));return o===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(t,n,i)=>re.ansi256ToAnsi(re.rgbToAnsi256(t,n,i)),enumerable:!1},hexToAnsi:{value:t=>re.ansi256ToAnsi(re.hexToAnsi256(t)),enumerable:!1}}),re}var bM=vM(),St=bM;import kh from"node:process";import yM from"node:os";import BA from"node:tty";function at(e,t=globalThis.Deno?globalThis.Deno.args:kh.argv){let n=e.startsWith("-")?"":e.length===1?"-":"--",i=t.indexOf(n+e),r=t.indexOf("--");return i!==-1&&(r===-1||i<r)}var{env:ne}=kh,tu;at("no-color")||at("no-colors")||at("color=false")||at("color=never")?tu=0:(at("color")||at("colors")||at("color=true")||at("color=always"))&&(tu=1);function SM(){if("FORCE_COLOR"in ne)return ne.FORCE_COLOR==="true"?1:ne.FORCE_COLOR==="false"?0:ne.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(ne.FORCE_COLOR,10),3)}function _M(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function EM(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let i=SM();i!==void 0&&(tu=i);let r=n?tu:i;if(r===0)return 0;if(n){if(at("color=16m")||at("color=full")||at("color=truecolor"))return 3;if(at("color=256"))return 2}if("TF_BUILD"in ne&&"AGENT_NAME"in ne)return 1;if(e&&!t&&r===void 0)return 0;let o=r||0;if(ne.TERM==="dumb")return o;if(kh.platform==="win32"){let a=yM.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in ne)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in ne)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in ne)||ne.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in ne)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ne.TEAMCITY_VERSION)?1:0;if(ne.COLORTERM==="truecolor"||ne.TERM==="xterm-kitty"||ne.TERM==="xterm-ghostty"||ne.TERM==="wezterm")return 3;if("TERM_PROGRAM"in ne){let a=Number.parseInt((ne.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ne.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ne.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ne.TERM)||"COLORTERM"in ne?1:o}function VA(e,t={}){let n=EM(e,{streamIsTTY:e&&e.isTTY,...t});return _M(n)}var xM={stdout:VA({isTTY:BA.isatty(1)}),stderr:VA({isTTY:BA.isatty(2)})},ZA=xM;function GA(e,t,n){let i=e.indexOf(t);if(i===-1)return e;let r=t.length,o=0,a="";do a+=e.slice(o,i)+t+n,o=i+r,i=e.indexOf(t,o);while(i!==-1);return a+=e.slice(o),a}function WA(e,t,n,i){let r=0,o="";do{let a=e[i-1]==="\r";o+=e.slice(r,a?i-1:i)+t+(a?`\r
|
|
166
|
+
`:l==="r"?"\r":l):c.length>=2&&c.startsWith("'")&&c.endsWith("'")?t[a]=c.slice(1,-1):t[a]=c}return t}mi(nA,"parseDotEnv");function iA(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\$/g,"\\$").replace(/`/g,"\\`").replace(/\n/g,"\\n").replace(/\r/g,"\\r")}mi(iA,"escapeDotEnvValue");var oA=s.object({awsAccountId:s.string(),accountName:s.string().nullable(),status:s.string(),role:s.string(),roleArn:s.string(),environment:s.string().optional(),connectedAt:s.string()}),H1=s.object({accounts:s.array(oA)});var q1=Object.defineProperty,tn=(e,t)=>q1(e,"name",{value:t,configurable:!0});function bh(e){let t=[e.primaryRegion,...e.secondaryRegions??[],e.disasterRecoveryRegion].filter(n=>n!==void 0);return[...new Set(t)]}tn(bh,"deriveRegionsFromOrgConfig");function yh(e){return e.environment??Uo(e)}tn(yh,"environmentOrTier");function Sh(e,t){return`${e.toLowerCase()}-${wn(t)}`}tn(Sh,"generateTargetName");function _h(e,t){let n=[];for(let i of e){if(Uo(i)==="organisation")continue;let r=yh(i);for(let o of t)n.push({name:Sh(i.name,o),accountName:i.name,accountId:i.id,environment:r,region:o})}return n.sort((i,r)=>{let o=i.environment.localeCompare(r.environment);if(o!==0)return o;let a=i.accountName.localeCompare(r.accountName);return a!==0?a:i.region.localeCompare(r.region)})}tn(_h,"deriveTargets");function aA(e){return _h(e.providerAccounts,bh(e))}tn(aA,"deriveAllTargets");function K1(e,t){if(t.length===0)return e;let n=new Set([e.primaryRegion,e.disasterRecoveryRegion].filter(Boolean)),i=t.filter(r=>!n.has(r));return{...e,secondaryRegions:i.length>0?i:void 0}}tn(K1,"mergeSecondaryRegions");function sA(e,t){return e.find(n=>n.name===t)}tn(sA,"findTarget");var Y1=Object.defineProperty,X1=(e,t)=>Y1(e,"name",{value:t,configurable:!0});function cA(e,t){if(t!==void 0){if(t.trim()==="")throw new Error("buildAppConfigPath: container must be a non-empty string");return`${t}/fjall/${e}`}return`fjall/${e}`}X1(cA,"buildAppConfigPath");var J1=Object.defineProperty,pi=(e,t)=>J1(e,"name",{value:t,configurable:!0}),Eh="infrastructure.ts",xh="fjall";function uA(e,t){let n=t?.excludedPathPrefixes,i=t?.excludedPathSegments,r=[];for(let o of e){if(!Ah(o.path)||n&&dA(o.path,n)||i&&mA(o.path,i))continue;let a=Ih(o.path);a!==null&&r.push({configPath:lA(o.path),boundaryPath:a})}return r}pi(uA,"findInfrastructurePaths");function Ah(e){return e===Eh||e.endsWith(`/${Eh}`)}pi(Ah,"isInfrastructureFile");function Ih(e){let t=e.split("/");for(let n=0;n<t.length-1;n++)if(t[n]===xh)return t.slice(0,n+1).join("/");return null}pi(Ih,"findBoundaryPath");function lA(e){return e.slice(0,-`/${Eh}`.length)}pi(lA,"toConfigDir");function dA(e,t){for(let n of t)if(e.startsWith(n))return!0;return!1}pi(dA,"hasExcludedPrefix");function mA(e,t){let n=e.split("/");for(let i=0;i<n.length-1;i++)if(t.has(n[i]))return!0;return!1}pi(mA,"hasExcludedSegment");var Q1=Object.defineProperty,$h=(e,t)=>Q1(e,"name",{value:t,configurable:!0});function pA(e){if(e.length===0)return null;let t=[];for(let i of e){let r=fA(i.boundaryPath);if(r===null)return null;t.push(r)}let n=gA(t);return n.length===0?null:n.join("/")}$h(pA,"inferContainerFromCandidates");function fA(e){let t=e.split("/").filter(i=>i.length>0);if(t.length===0||t[t.length-1]!==xh)return null;let n=t.slice(0,t.length-1);return n.length===0?null:n}$h(fA,"extractContainer");function gA(e){if(e.length===0)return[];let[t,...n]=e,i=[];for(let r=0;r<t.length;r+=1){let o=t[r];for(let a of n)if(a[r]!==o)return i;i.push(o)}return i}$h(gA,"longestCommonPrefix");var eM=Object.defineProperty,hA=(e,t)=>eM(e,"name",{value:t,configurable:!0}),vA=["fjall","organisation","platform","account","domain"];function bA(e){return vA.includes(e.toLowerCase())}hA(bA,"isReservedAppName");var yA="-cache";function SA(e){return Tt(e).endsWith(yA)}hA(SA,"hasReservedAppNameSuffix");var tM=Object.defineProperty,Th=(e,t)=>tM(e,"name",{value:t,configurable:!0});function EA(e){return{success:!0,data:e}}Th(EA,"success");function Vo(e){return{success:!1,error:e}}Th(Vo,"failure");var _A="sha256:",Qc=12,rM=new RegExp(`-sha-[0-9a-f]{${Qc}}$`);function xA(e,t,n){if(!e.startsWith(_A))return Vo(new Error(`expected sha256:... digest, got ${e.slice(0,32)}`));let i=e.slice(_A.length);if(i.length<Qc)return Vo(new Error(`digest hex payload too short (need >=${Qc} chars, got ${i.length})`));let r=t.trim();if(r==="")return Vo(new Error("serviceName must be a non-empty string"));let o;if(n!==void 0){let u=n.trim();if(u==="")return Vo(new Error("target, when supplied, must be a non-empty string; omit the argument instead"));o=u.toLowerCase()}let a=i.slice(0,Qc).toLowerCase(),c=o!==void 0?`${r.toLowerCase()}-${o}`:r.toLowerCase();return EA(`${c}-sha-${a}`)}Th(xA,"deriveContentHashTag");var nM=Object.defineProperty,iM=(e,t)=>nM(e,"name",{value:t,configurable:!0}),AA=["full","code-only","rollback","restart"],oM=s.enum(AA),IA=/^[a-zA-Z0-9._-]+$/,$A=s.string().min(1).max(128).regex(IA),TA=s.object({serviceName:s.string().min(1),imageTag:$A,imageDigest:s.string().min(1).optional(),imageUri:s.string().min(1),ecrRepositoryArn:s.string().min(1).optional(),taskDefinitionArn:s.string().min(1).optional(),previousTaskDefinitionArn:s.string().min(1).optional(),functionArn:s.string().min(1).optional(),publishedVersion:s.string().min(1).optional()}).strict(),aM=s.array(TA);function RA(e,t){return`${e}${t}`}iM(RA,"artefactOutputKey");var sM=Object.defineProperty,CA=(e,t)=>sM(e,"name",{value:t,configurable:!0}),kt=["payload","nextjs","staticsite"],Rh=new Set(kt);function Ch(e){return typeof e=="string"&&Rh.has(e)}CA(Ch,"isPatternType");var fi={payload:{label:"Payload CMS",constructIdSuffix:"Payload",artefact:"opennext-lambda",stackPlacement:"compute",deployable:!0},nextjs:{label:"Next.js",constructIdSuffix:"Nextjs",artefact:"opennext-lambda",stackPlacement:"compute",deployable:!1},staticsite:{label:"Static site",constructIdSuffix:"StaticSite",artefact:"static-assets",stackPlacement:"cdn",deployable:!0}},PA=kt.filter(e=>fi[e].deployable),Ph=kt.filter(e=>fi[e].artefact==="opennext-lambda"),cM=new Set(Ph);function Nh(e){return e!=null&&cM.has(e)}CA(Nh,"isOpenNextPatternType");var Zo=["multipage","spa"];var uM=Object.defineProperty,wh=(e,t)=>uM(e,"name",{value:t,configurable:!0}),NA="noreply";function wA(e){return`${NA}@${e}`}wh(wA,"defaultFormsFromAddress");function kA(e){return`https://${e}`}wh(kA,"defaultFormsCorsOrigin");function eu(e,t){let n=e.split("@");if(n.length!==2)return!1;let[i,r]=n;return i===void 0||i===""||r===void 0?!1:r.toLowerCase()===t.toLowerCase()}wh(eu,"isAddressAtDomain");var OA=2;var lM=s.object({devDomain:s.string().min(1),hostedZoneId:s.string().min(1).optional(),parentDomain:s.string().min(1).optional(),parentDelegationRoleArn:s.string().min(1).optional()}).strict().superRefine((e,t)=>{if(e.hostedZoneId!==void 0){e.parentDomain!==void 0&&t.addIssue({code:"custom",path:["parentDomain"],message:"hostedZoneId (adopt mode) is mutually exclusive with parentDomain \u2014 the adopted zone was already delegated; omit parentDomain"}),e.parentDelegationRoleArn!==void 0&&t.addIssue({code:"custom",path:["parentDelegationRoleArn"],message:"hostedZoneId (adopt mode) is mutually exclusive with parentDelegationRoleArn \u2014 the adopted zone was already delegated; omit parentDelegationRoleArn"});return}e.parentDelegationRoleArn!==void 0&&e.parentDomain===void 0&&t.addIssue({code:"custom",path:["parentDomain"],message:"parentDelegationRoleArn requires parentDomain \u2014 set parentDomain to the parent zone the DelegationRole belongs to"}),e.parentDomain!==void 0&&!e.devDomain.endsWith(`.${e.parentDomain}`)&&t.addIssue({code:"custom",path:["parentDomain"],message:"parentDomain must be a proper DNS suffix of devDomain \u2014 devDomain must end with `.<parentDomain>`"})}),DA={appId:s.string().min(1),appKebab:s.string().min(1),engineVersion:s.string().min(1).optional(),adoptSlotEcr:s.boolean().optional(),adoptCacheEcr:s.boolean().optional(),phase:s.enum(["zone","full"]).optional(),domain:lM.optional()},dM=s.object(DA).strict(),mM=s.object({...DA,version:s.literal(OA),appName:s.string().min(1)}).strict().refine(e=>e.appName===`fjall-dev-${e.appKebab}`,{message:"appName must equal `fjall-dev-${appKebab}` (single-source identity)",path:["appName"]});import{existsSync as TI,mkdirSync as Qj,statSync as ez,appendFileSync as tz}from"fs";import{join as RI}from"path";import{join as uv}from"path";var fM=Object.defineProperty,MA=(e,t)=>fM(e,"name",{value:t,configurable:!0});function jA(e){return e.mode==="cli"}MA(jA,"isCLIMode");function zA(e){return e.mode==="ink"}MA(zA,"isInkMode");var LA=(e=0)=>t=>`\x1B[${t+e}m`,UA=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,FA=(e=0)=>(t,n,i)=>`\x1B[${38+e};2;${t};${n};${i}m`,re={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},Z3=Object.keys(re.modifier),gM=Object.keys(re.color),hM=Object.keys(re.bgColor),G3=[...gM,...hM];function vM(){let e=new Map;for(let[t,n]of Object.entries(re)){for(let[i,r]of Object.entries(n))re[i]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},n[i]=re[i],e.set(r[0],r[1]);Object.defineProperty(re,t,{value:n,enumerable:!1})}return Object.defineProperty(re,"codes",{value:e,enumerable:!1}),re.color.close="\x1B[39m",re.bgColor.close="\x1B[49m",re.color.ansi=LA(),re.color.ansi256=UA(),re.color.ansi16m=FA(),re.bgColor.ansi=LA(10),re.bgColor.ansi256=UA(10),re.bgColor.ansi16m=FA(10),Object.defineProperties(re,{rgbToAnsi256:{value(t,n,i){return t===n&&n===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},enumerable:!1},hexToRgb:{value(t){let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!n)return[0,0,0];let[i]=n;i.length===3&&(i=[...i].map(o=>o+o).join(""));let r=Number.parseInt(i,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:t=>re.rgbToAnsi256(...re.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let n,i,r;if(t>=232)n=((t-232)*10+8)/255,i=n,r=n;else{t-=16;let c=t%36;n=Math.floor(t/36)/5,i=Math.floor(c/6)/5,r=c%6/5}let o=Math.max(n,i,r)*2;if(o===0)return 30;let a=30+(Math.round(r)<<2|Math.round(i)<<1|Math.round(n));return o===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(t,n,i)=>re.ansi256ToAnsi(re.rgbToAnsi256(t,n,i)),enumerable:!1},hexToAnsi:{value:t=>re.ansi256ToAnsi(re.hexToAnsi256(t)),enumerable:!1}}),re}var bM=vM(),St=bM;import kh from"node:process";import yM from"node:os";import BA from"node:tty";function at(e,t=globalThis.Deno?globalThis.Deno.args:kh.argv){let n=e.startsWith("-")?"":e.length===1?"-":"--",i=t.indexOf(n+e),r=t.indexOf("--");return i!==-1&&(r===-1||i<r)}var{env:ne}=kh,tu;at("no-color")||at("no-colors")||at("color=false")||at("color=never")?tu=0:(at("color")||at("colors")||at("color=true")||at("color=always"))&&(tu=1);function SM(){if("FORCE_COLOR"in ne)return ne.FORCE_COLOR==="true"?1:ne.FORCE_COLOR==="false"?0:ne.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(ne.FORCE_COLOR,10),3)}function _M(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function EM(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let i=SM();i!==void 0&&(tu=i);let r=n?tu:i;if(r===0)return 0;if(n){if(at("color=16m")||at("color=full")||at("color=truecolor"))return 3;if(at("color=256"))return 2}if("TF_BUILD"in ne&&"AGENT_NAME"in ne)return 1;if(e&&!t&&r===void 0)return 0;let o=r||0;if(ne.TERM==="dumb")return o;if(kh.platform==="win32"){let a=yM.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in ne)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in ne)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in ne)||ne.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in ne)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ne.TEAMCITY_VERSION)?1:0;if(ne.COLORTERM==="truecolor"||ne.TERM==="xterm-kitty"||ne.TERM==="xterm-ghostty"||ne.TERM==="wezterm")return 3;if("TERM_PROGRAM"in ne){let a=Number.parseInt((ne.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ne.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ne.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ne.TERM)||"COLORTERM"in ne?1:o}function VA(e,t={}){let n=EM(e,{streamIsTTY:e&&e.isTTY,...t});return _M(n)}var xM={stdout:VA({isTTY:BA.isatty(1)}),stderr:VA({isTTY:BA.isatty(2)})},ZA=xM;function GA(e,t,n){let i=e.indexOf(t);if(i===-1)return e;let r=t.length,o=0,a="";do a+=e.slice(o,i)+t+n,o=i+r,i=e.indexOf(t,o);while(i!==-1);return a+=e.slice(o),a}function WA(e,t,n,i){let r=0,o="";do{let a=e[i-1]==="\r";o+=e.slice(r,a?i-1:i)+t+(a?`\r
|
|
167
167
|
`:`
|
|
168
168
|
`)+n,r=i+1,i=e.indexOf(`
|
|
169
169
|
`,r)}while(i!==-1);return o+=e.slice(r),o}var{stdout:HA,stderr:qA}=ZA,Oh=Symbol("GENERATOR"),gi=Symbol("STYLER"),Go=Symbol("IS_EMPTY"),KA=["ansi","ansi","ansi256","ansi16m"],hi=Object.create(null),AM=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let n=HA?HA.level:0;e.level=t.level===void 0?n:t.level};var IM=e=>{let t=(...n)=>n.join(" ");return AM(t,e),Object.setPrototypeOf(t,Wo.prototype),t};function Wo(e){return IM(e)}Object.setPrototypeOf(Wo.prototype,Function.prototype);for(let[e,t]of Object.entries(St))hi[e]={get(){let n=ru(this,Mh(t.open,t.close,this[gi]),this[Go]);return Object.defineProperty(this,e,{value:n}),n}};hi.visible={get(){let e=ru(this,this[gi],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var Dh=(e,t,n,...i)=>e==="rgb"?t==="ansi16m"?St[n].ansi16m(...i):t==="ansi256"?St[n].ansi256(St.rgbToAnsi256(...i)):St[n].ansi(St.rgbToAnsi(...i)):e==="hex"?Dh("rgb",t,n,...St.hexToRgb(...i)):St[n][e](...i),$M=["rgb","hex","ansi256"];for(let e of $M){hi[e]={get(){let{level:n}=this;return function(...i){let r=Mh(Dh(e,KA[n],"color",...i),St.color.close,this[gi]);return ru(this,r,this[Go])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);hi[t]={get(){let{level:n}=this;return function(...i){let r=Mh(Dh(e,KA[n],"bgColor",...i),St.bgColor.close,this[gi]);return ru(this,r,this[Go])}}}}var TM=Object.defineProperties(()=>{},{...hi,level:{enumerable:!0,get(){return this[Oh].level},set(e){this[Oh].level=e}}}),Mh=(e,t,n)=>{let i,r;return n===void 0?(i=e,r=t):(i=n.openAll+e,r=t+n.closeAll),{open:e,close:t,openAll:i,closeAll:r,parent:n}},ru=(e,t,n)=>{let i=(...r)=>RM(i,r.length===1?""+r[0]:r.join(" "));return Object.setPrototypeOf(i,TM),i[Oh]=e,i[gi]=t,i[Go]=n,i},RM=(e,t)=>{if(e.level<=0||!t)return e[Go]?"":t;let n=e[gi];if(n===void 0)return t;let{openAll:i,closeAll:r}=n;if(t.includes("\x1B"))for(;n!==void 0;)t=GA(t,n.close,n.open),n=n.parent;let o=t.indexOf(`
|
|
@@ -184,7 +184,7 @@ ${Ee.hex("#D9622E").bold(`--- ${e} ---`)}`),F&&F.start())}Ge($j,"step");function
|
|
|
184
184
|
`);return{buffer:[],stream:r}}flush(){let t=this.flushBuffer(this.buffer,this.mainLogStream,this.mainLogPath);this.buffer=t.buffer,this.mainLogStream=t.stream;let n=this.flushBuffer(this.debugBuffer,this.debugLogStream,this.debugLogPath);this.debugBuffer=n.buffer,this.debugLogStream=n.stream}close(){this.isClosing=!0,this.flush(),this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null),this.mainLogStream&&(this.mainLogStream.end(),this.mainLogStream=null),this.debugLogStream&&(this.debugLogStream.end(),this.debugLogStream=null),this.buffer=[],this.debugBuffer=[],this.initialised=!1,this.isClosing=!1}async closeAndFlush(){this.isClosing=!0,this.flush(),this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null);let t=[];this.mainLogStream&&(t.push(this.mainLogStream),this.mainLogStream=null),this.debugLogStream&&(t.push(this.debugLogStream),this.debugLogStream=null),this.buffer=[],this.debugBuffer=[],this.initialised=!1,await Promise.all(t.map(n=>new Promise(i=>{n.end(()=>i())}))),this.isClosing=!1}};import{createWriteStream as Wj,existsSync as Hj,mkdirSync as qj}from"fs";import{join as $I}from"path";var an={trace:0,debug:1,info:2,warn:3,error:4},We={MAX_FILE_SIZE:10*1024*1024,MAX_FILES:5,MAX_BUFFER_SIZE:100,FLUSH_INTERVAL_MS:500,LOG_FILENAME:"fjall.jsonl",DEBUG_LOG_FILENAME:"fjall-debug.jsonl"};import{join as Bj}from"path";import{homedir as Vj}from"os";var Uj=Object.defineProperty,Fj=(e,t)=>Uj(e,"name",{value:t,configurable:!0});function $r(){let e=process.env.FJALL_LOG_DIR;return e!==void 0&&e!==""?e:Bj(Vj(),".fjall","logs")}Fj($r,"getDefaultLogDir");var Zj=Object.defineProperty,Gj=(e,t)=>Zj(e,"name",{value:t,configurable:!0}),ta=class{static{Gj(this,"DeploymentLoggerImpl")}mainLogger;appName;operationType;logStream=null;logPath;deploymentId;buffer=[];flushInterval=null;isClosing=!1;maxBufferSize=We.MAX_BUFFER_SIZE;constructor(t,n,i){this.mainLogger=t,this.appName=n,this.operationType=i,this.deploymentId=`${i}-${Date.now()}`;let r=$r(),o=$I(r,"deployments",n);Hj(o)||qj(o,{recursive:!0});let a=new Date().toISOString().replace(/[:.]/g,"-"),c=`${i}-${a}.jsonl`;this.logPath=$I(o,c);try{this.logStream=Wj(this.logPath,{flags:"a"}),this.flushInterval=setInterval(()=>this.flush(),We.FLUSH_INTERVAL_MS),this.info("DeploymentLogger","Deployment logging initialised",{appName:n,operationType:i,deploymentId:this.deploymentId,logPath:this.logPath})}catch{}}log(t,n,i,r,o,a){if(this.isClosing)return;let c={timestamp:new Date().toISOString(),level:t,component:n,message:i,correlationId:this.deploymentId,...r&&Object.keys(r).length>0&&{data:r},...o&&{stackName:o},...a&&{phase:a}};this.buffer.push(c),this.mainLogger.logWithCorrelation(t,n,i,this.deploymentId,r,o,a),this.buffer.length>=this.maxBufferSize&&this.flush()}flush(){if(!(this.buffer.length===0||!this.logStream)){for(let t of this.buffer)this.logStream.write(JSON.stringify(t)+`
|
|
185
185
|
`);this.buffer=[]}}info(t,n,i){this.log("info",t,n,i)}warn(t,n,i){this.log("warn",t,n,i)}error(t,n,i){this.log("error",t,n,i)}debug(t,n,i){this.log("debug",t,n,i)}stackEvent(t,n,i,r){this.log("info","StackDeployment",i,r,t,n)}dockerEvent(t,n){this.log("info","DockerOperation",t,{percentage:n})}ecsEvent(t,n,i){this.log("info","ECSDeployment",t,{percentage:n,taskCount:i})}close(){this.isClosing=!0,this.flush(),this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null),this.logStream&&(this.logStream.end(),this.logStream=null),this.buffer=[],this.isClosing=!1}getLogPath(){return this.logPath}getDeploymentId(){return this.deploymentId}};var Kj=Object.defineProperty,Yj=(e,t)=>Kj(e,"name",{value:t,configurable:!0}),Su=class e{static{Yj(this,"Logger")}static instance=null;config;debugEnabled;traceEnabled;minLevel;fileWriter;mainLogPath;debugLogPath;constructor(){let t=$r(),n=uv(t,"debug"),i=this.parseEnvInt("FJALL_LOG_MAX_SIZE",We.MAX_FILE_SIZE),r=this.parseEnvInt("FJALL_LOG_MAX_FILES",We.MAX_FILES);this.config={logDir:t,debugLogDir:n,maxFileSize:i,maxFiles:r,maxBufferSize:We.MAX_BUFFER_SIZE,flushIntervalMs:We.FLUSH_INTERVAL_MS},this.mainLogPath=uv(t,We.LOG_FILENAME),this.debugLogPath=uv(n,We.DEBUG_LOG_FILENAME),this.debugEnabled=process.env.FJALL_DEBUG==="true"||process.env.FJALL_TRACE==="true"||process.argv.includes("--verbose")||process.argv.includes("-v"),this.traceEnabled=process.env.FJALL_TRACE==="true";let o=process.env.FJALL_LOG_LEVEL?.toLowerCase();o&&o in an?this.minLevel=o:this.traceEnabled?this.minLevel="trace":this.debugEnabled?this.minLevel="debug":this.minLevel="info",this.fileWriter=new yu(this.config,this.mainLogPath,this.debugLogPath,this.debugEnabled)}parseEnvInt(t,n){let i=process.env[t];if(i){let r=parseInt(i,10);if(!isNaN(r)&&r>0)return r}return n}static getInstance(){return e.instance||(e.instance=new e),e.instance}shouldLog(t){return an[t]>=an[this.minLevel]}createEntry(t,n,i,r,o,a,c){return{timestamp:new Date().toISOString(),level:t,component:n,message:i,...o&&{correlationId:o},...r&&Object.keys(r).length>0&&{data:r},...a&&{stackName:a},...c&&{phase:c}}}log(t,n,i,r,o,a,c){if(!this.shouldLog(t))return;let u=this.createEntry(t,n,i,r,o,a,c),l=t==="debug"||t==="trace";this.fileWriter.write(u,l),this.writeConsole(u)}writeConsole(t){if(he.shouldSuppressOutput||he.isNonInteractive){this.debugEnabled&&this.writeDebugMirror(t);return}let n=this.getConsolePrefix(t.level),i=`[${t.component}]`,r=`${n} ${i} ${t.message}`;t.level==="error"?console.error(r):t.level==="warn"?console.warn(r):console.log(r)}writeDebugMirror(t){let n=this.getConsolePrefix(t.level),i=`[${t.component}]`,r="";if(t.data&&Object.keys(t.data).length>0)try{r=` ${JSON.stringify(t.data)}`}catch{r=" [unserialisable data]"}let o=`${n} ${i} ${t.message}${r}`;process.stderr.write(`${On(o)}
|
|
186
186
|
`)}getConsolePrefix(t){switch(t){case"error":return"[ERROR]";case"warn":return"[WARN]";case"info":return"[INFO]";case"debug":return"[DEBUG]";case"trace":return"[TRACE]"}}error(t,n,i){this.log("error",t,n,i)}warn(t,n,i){this.log("warn",t,n,i)}info(t,n,i){this.log("info",t,n,i)}debug(t,n,i){this.log("debug",t,n,i)}trace(t,n,i){this.log("trace",t,n,i)}isDebugEnabled(){return this.debugEnabled}isTraceEnabled(){return this.traceEnabled}enableDebug(){this.debugEnabled=!0,an[this.minLevel]>an.debug&&(this.minLevel="debug"),this.fileWriter.setDebugEnabled(!0),this.fileWriter.isInitialised&&this.fileWriter.initialiseDebugStream()}withCorrelation(t){return new bi(this,t)}forDeployment(t,n="deploy"){return new ta(this,t,n)}close(){this.fileWriter.close()}async flushAndClose(){await this.fileWriter.closeAndFlush()}getLogPath(){return this.mainLogPath}getDebugLogPath(){return this.debugLogPath}getLogDir(){return this.config.logDir}logWithCorrelation(t,n,i,r,o,a,c){this.log(t,n,i,o,r,a,c)}static reset(){e.instance&&(e.instance.close(),e.instance=null)}};var Xj=Object.defineProperty,Jj=(e,t)=>Xj(e,"name",{value:t,configurable:!0}),bu=Su.getInstance();function rz(e){let t=$r(),n=RI(t,"debug"),i=RI(n,We.DEBUG_LOG_FILENAME);try{TI(n)||Qj(n,{recursive:!0}),TI(i)&&ez(i).size>We.MAX_FILE_SIZE&&new yi({maxFiles:We.MAX_FILES}).rotate(i);let r={timestamp:new Date().toISOString(),level:"debug",component:"Emergency",message:e};tz(i,JSON.stringify(r)+`
|
|
187
|
-
`)}catch{}}Jj(rz,"writeDebugSync");var nz=Object.defineProperty,Si=(e,t)=>nz(e,"name",{value:t,configurable:!0});function lv(e){return e.success===!0}Si(lv,"isSuccess");function dv(e){return e.success===!1}Si(dv,"isFailure");function P(e){return{success:!0,data:e}}Si(P,"success");function $(e){return{success:!1,error:e}}Si($,"failure");async function mv(e){try{let t=await e();return P(t)}catch(t){return $(vt(t))}}Si(mv,"tryAsync");function pv(e){try{let t=e();return P(t)}catch(t){return $(vt(t))}}Si(pv,"trySync");var iz=Object.defineProperty,oz=(e,t)=>iz(e,"name",{value:t,configurable:!0}),CI=/^[a-zA-Z][a-zA-Z0-9-]*$/,az=Bo.source.replace(/^\^|\$$/g,""),L=Object.freeze({IDENTIFIER:CI,NEW_APP_NAME:/^[a-z][a-z0-9-]*$/,RESOURCE_NAME:/^[a-zA-Z][a-zA-Z0-9]*$/,ECS_SERVICE_NAME:CI,BUCKET_NAME:/^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z][a-z0-9]*$/,DATABASE_NAME:/^[a-zA-Z][a-zA-Z0-9_]*$/,RESOURCE_TYPE:/^[a-z]+(:[a-z]+)?$/,SSM_PATH:new RegExp(`^(?:/${az})+$`),SECRET_NAME:Xc,SSM_COMPONENT:Bo,EMAIL:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,DOCKER_IMAGE:/^[a-z0-9][a-z0-9._-]*[a-z0-9](:[a-z0-9._-]+)?$/,DOMAIN:/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i,HTTP_ORIGIN:/^https?:\/\/[a-z0-9.-]+(:\d+)?$/i,PASCAL_CASE:/^[A-Z][A-Za-z0-9]*$/,AWS_ACCOUNT_ID:/^\d{12}$/,VPC_ID:/^vpc-[a-z0-9]+$/,ROLE_ARN:/^arn:aws[a-zA-Z-]*:iam::\d{12}:role\/.+$/,CIDR:/^((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\/(3[0-2]|[12]?\d)$/,SCHEDULE_EXPRESSION:/^(rate\(1 (?:minute|hour|day)\)|rate\((?:[2-9]|[1-9]\d+) (?:minutes|hours|days)\)|cron\([^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+\))$/,LAMBDA_RUNTIME_IDENTIFIER:/^[A-Za-z0-9._-]+$/,ENV_VAR_NAME:/^[A-Za-z_][A-Za-z0-9_]*$/});function fv(e){let t=/^rate\((\d+) (minute|minutes|hour|hours|day|days)\)$/.exec(e);if(!t)return;let n=t[1],i=t[2];if(n===void 0||i===void 0)return;let r=parseInt(n,10);if(!Number.isFinite(r)||r<1)return;let o=i==="minute"||i==="hour"||i==="day";if(!(o&&r!==1)&&!(!o&&r===1))return i==="minute"||i==="minutes"?{everyMs:r*6e4}:i==="hour"||i==="hours"?{everyMs:r*60*6e4}:{everyMs:r*24*60*6e4}}oz(fv,"parseRateExpression");var d=Object.freeze({IDENTIFIER:"Must start with a letter, contain only letters, numbers, and hyphens",NEW_APP_NAME:"Must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens",IDENTIFIER_MIN_LENGTH:"Must be at least 2 characters",IDENTIFIER_NO_TRAILING_HYPHEN:"Must not end with a hyphen",IDENTIFIER_NO_CONSECUTIVE_HYPHENS:"Must not contain consecutive hyphens",RESOURCE_NAME:"Must start with a letter and contain only letters and numbers (PascalCase recommended)",ECS_SERVICE_NAME:"Service name must start with a letter and contain only letters, numbers, and hyphens",BUCKET_NAME:"Bucket name must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens",DATABASE_NAME:"Database name must start with a letter and contain only letters, numbers, and underscores",RESOURCE_TYPE:"Resource type must be in format 'category' or 'category:type'",SSM_PATH:"SSM path must start with / and contain valid namespace segments (e.g., /myapp/ApiCluster/service)",SECRET_NAME:fh,SSM_COMPONENT:Jc,EMAIL:"Please enter a valid email address",DOMAIN:"Please enter a valid domain (e.g., cms.example.com)",DOCKER_IMAGE:"Invalid Docker image name format",REQUIRED:{APP_NAME:"Application name is required",RESOURCE_NAME:"Resource name is required",BUCKET_NAME:"Bucket name is required",SERVICE_NAME:"Service name is required",NETWORK_NAME:"Network name is required",DATABASE_NAME:"Database name is required",ORGANISATION_NAME:"Organisation name is required",EMAIL:"Email is required",NAME:"Name is required",USERNAME:"Username is required",CONTAINER_NAME:"Container name is required",GROUP:"Group is required",PATTERN_NAME:"Pattern name is required",SOURCE:"Source directory is required",BUILD_COMMAND:"Build command is required",OUTPUT_DIR:"Output directory is required",FORMS_TO:"Forms recipient address is required",ROUTING_PATH:"Routing path is required",RESOURCE_REFERENCE:"Resource reference is required",RESOURCE_TYPE:"Resource type is required",VARIANT:"Variant is required",SUBTYPE:"Subtype is required",DEPLOY_TARGET:"Deploy target is required",DESTROY_TARGET:"Destroy target is required"},MAX_LENGTH:{APP_NAME:"Application name must be 50 characters or less",RESOURCE_NAME:"Resource name must be 63 characters or less",BUCKET_NAME:"Bucket name must be 63 characters or less",SERVICE_NAME:"Service name must be 255 characters or less",NETWORK_NAME:"Network name must be 50 characters or less",DATABASE_NAME:"Database name must be 63 characters or less",ORGANISATION_NAME:"Organisation name must be 50 characters or less"},PORT:{INTEGER:"Port must be an integer",MIN:"Port must be at least 1",MAX:"Port cannot exceed 65535"},USERNAME:{MAX_LENGTH:"Username cannot exceed 63 characters"},LAMBDA:{MEMORY:{INTEGER:"Lambda memory must be an integer",MIN:"Memory must be at least 128 MB",MAX:"Memory cannot exceed 10240 MB",MULTIPLE:"Memory must be 128 MB or a multiple of 64 MB"},TIMEOUT:{INTEGER:"Timeout must be an integer",MIN:"Timeout must be at least 1 second",MAX:"Timeout cannot exceed 900 seconds"},RUNTIME:"Lambda runtime must contain only letters, digits, dots, underscores, or dashes (e.g. 'NODEJS_20_X' or 'nodejs20.x')"},ENV_VAR_NAME:"Environment variable names must start with a letter or underscore and contain only letters, digits, and underscores",PRIORITY:{INTEGER:"Priority must be an integer",MIN:"Priority must be at least 1",MAX:"Priority cannot exceed 50000"},CAPACITY:{MIN:{INTEGER:"Minimum capacity must be an integer",MIN_0:"Minimum capacity must be at least 0",MIN_1:"Minimum capacity must be at least 1",MAX:"Minimum capacity cannot exceed 100"},MAX:{INTEGER:"Maximum capacity must be an integer",MIN_0:"Maximum capacity must be at least 0",MIN_1:"Maximum capacity must be at least 1",MAX:"Maximum capacity cannot exceed 100"},DESIRED:{INTEGER:"Desired count must be an integer",MIN:"Desired count must be at least 0",MAX:"Desired count cannot exceed 100"},WARM_POOL_REQUIRED:"minCapacity 0 requires a warmPool \u2014 without it, new tasks wait 60-90s for a cold instance launch",WARM_POOL:{MIN_SIZE:{INTEGER:"Warm pool minSize must be an integer",MIN:"Warm pool minSize must be at least 0",MAX:"Warm pool minSize cannot exceed 100"},MIN_SIZE_EXCEEDS_MAX_CAPACITY:"warmPool.minSize cannot exceed maxCapacity \u2014 the warm pool cannot hold more instances than the ASG allows"}},MEMORY_LIMIT:{INTEGER:"Memory limit must be an integer",MIN_512:"Memory limit must be at least 512 MiB",MIN_128:"Memory limit must be at least 128 MiB",MAX:"Memory limit cannot exceed 30720 MiB"},DATABASE:{PORT:{INTEGER:"Database port must be an integer",MIN:"Database port must be at least 1024",MAX:"Database port cannot exceed 65535"},NAME:{REQUIRED:"Database name is required",MAX_LENGTH:"Database name must be 63 characters or less"}},BACKUP_RETENTION:{INTEGER:"Backup retention must be an integer",MIN:"Backup retention must be at least 1 day",MAX:"Backup retention cannot exceed 35 days"},SQS:{VISIBILITY_TIMEOUT:{INTEGER:"Visibility timeout must be an integer",MIN:"Visibility timeout must be at least 0 seconds",MAX:"Visibility timeout cannot exceed 43200 seconds (12 hours)"},RETENTION_PERIOD:{INTEGER:"Retention period must be an integer",MIN:"Retention period must be at least 60 seconds",MAX:"Retention period cannot exceed 1209600 seconds (14 days)"}},READER:{COUNT:{INTEGER:"Reader count must be an integer",MIN:"Reader count must be at least 0",MAX:"Reader count cannot exceed 15"}},IDENTIFIER_SUFFIX:{REQUIRED:"Identifier suffix is required when specified",MAX_LENGTH:"Identifier suffix cannot exceed 50 characters"},ROTATION:{INTEGER:"Rotation days must be an integer",MIN:"Rotation interval must be at least 1 day",MAX:"Rotation interval cannot exceed 365 days"},MAX_CONNECTIONS:{INTEGER:"Max connections must be an integer",MIN:"Max connections must be at least 1",MAX:"Max connections cannot exceed 100"},MONITORING_INTERVAL:{INTEGER:"Monitoring interval must be an integer",MIN:"Monitoring interval must be at least 0",MAX:"Monitoring interval cannot exceed 60 seconds",VALUES:"Monitoring interval must be 0, 1, 5, 10, 15, 30, or 60 seconds"},RETENTION_DAYS:{INTEGER:"Retention days must be an integer",MIN:"Retention days must be at least 1",MAX:"Retention days cannot exceed 365"},BATCH_SIZE:{INTEGER:"Batch size must be an integer",MIN:"Batch size must be at least 1",MAX:"Batch size cannot exceed 10000"},SERVICE:{UNIQUE_WITHIN_CLUSTER:"Service names must be unique within a cluster",MIN_REQUIRED:"At least one service is required",ROUTING_REQUIRED:"Multiple services with ports require routing config (path or host)"},PROXY_CONFIG:{MAX_IDLE_CONNECTIONS:{INTEGER:"Max idle connections must be an integer",MIN:"Max idle connections must be at least 0",MAX:"Max idle connections cannot exceed 100"},BORROW_TIMEOUT:{INTEGER:"Connection borrow timeout must be an integer",MIN:"Connection borrow timeout must be at least 1 second",MAX:"Connection borrow timeout cannot exceed 3600 seconds"}},MAX_AZS:{INTEGER:"Max AZs must be an integer",MIN:"Max AZs must be at least 1",MAX:"Max AZs cannot exceed 3"},BATCHING_WINDOW:{INTEGER:"Max batching window must be an integer",MIN:"Max batching window must be at least 0",MAX:"Max batching window cannot exceed 300 seconds"},HEALTH_CHECK:{INTERVAL:{INTEGER:"Health check interval must be an integer",MIN:"Health check interval must be at least 5 seconds",MAX:"Health check interval cannot exceed 300 seconds"},TIMEOUT:{INTEGER:"Health check timeout must be an integer",MIN:"Health check timeout must be at least 2 seconds",MAX:"Health check timeout cannot exceed 60 seconds"},RETRIES:{INTEGER:"Health check retries must be an integer",MIN:"Health check retries must be at least 1",MAX:"Health check retries cannot exceed 10"},START_PERIOD:{INTEGER:"Health check start period must be an integer",MIN:"Health check start period must be at least 0 seconds",MAX:"Health check start period cannot exceed 300 seconds"}},EPHEMERAL_STORAGE:{INTEGER:"Ephemeral storage size must be an integer",MIN:"Ephemeral storage size must be at least 512 MB",MAX:"Ephemeral storage size cannot exceed 10240 MB"},MAX_MESSAGE_SIZE:{INTEGER:"Max message size must be an integer",MIN:"Max message size must be at least 1024 bytes",MAX:"Max message size cannot exceed 262144 bytes (256 KB)"},CAPACITY_CONSTRAINT:{MIN_LTE_MAX:"minCapacity must be less than or equal to maxCapacity"},DIRECT_ACCESS:{NO_DOMAIN:"directAccess cannot be used with domain (no ALB for HTTPS)",NO_LOAD_BALANCER:"directAccess cannot be used with loadBalancer (mutually exclusive)"},GLOBAL_AURORA:{PRIMARY_REGION_REQUIRED:"primaryRegion is required for GlobalAurora databases"},NAT_GATEWAY:{INTEGER:"NAT gateway count must be an integer",MIN:"NAT gateway count must be at least 0",MAX:"NAT gateway count cannot exceed 3"},CIDR_MASK:{INTEGER:"CIDR mask must be an integer",MIN:"CIDR mask must be at least 16",MAX:"CIDR mask cannot exceed 28"},CPU:{INTEGER:"CPU must be an integer",MIN:"CPU must be at least 256 units",MAX:"CPU cannot exceed 4096 units"},KMS:{KEY_REQUIRED:"KMS key ARN is required when using KMS encryption"},READER_INSTANCES:{MAX:"Cannot have more than 15 reader instances",COUNT_OR_INSTANCES:"Cannot specify both 'count' and 'instances' - use one or the other"},GENERATOR_CAPACITY:{MIN:{MIN:"Minimum capacity must be at least 1",MAX:"Minimum capacity cannot exceed 1000"},MAX:{MIN:"Maximum capacity must be at least 1",MAX:"Maximum capacity cannot exceed 1000"}},INSTANCE_TYPE:"Unknown instance type. Common types include: t4g.micro, t4g.small, m5.large",ARCHITECTURE_MISMATCH:"Architecture mismatch between instance type and AMI",ALLOCATED_STORAGE:{INTEGER:"Allocated storage must be an integer",MIN:"Allocated storage must be at least 20 GB",MAX:"Allocated storage cannot exceed 65536 GB"},DLQ:{MAX_RECEIVE_COUNT:{INTEGER:"Max receive count must be an integer",MIN:"Max receive count must be at least 1",MAX:"Max receive count cannot exceed 1000"}},ALARM:{PERCENTAGE:{MIN:"Threshold must be at least 1%",MAX:"Threshold must be at most 100%"},FREE_STORAGE_GIB:{MIN:"Free storage threshold must be at least 1 GiB"}},REGION:"Invalid AWS region",PASCAL_CASE:"Resource name must start with an uppercase letter and contain only alphanumerics (PascalCase).",IMAGE_DOCKER_MUTEX:"image and docker are mutually exclusive",AWS_ACCOUNT_ID:"AWS account id must be exactly 12 digits (no hyphens)",VPC_ID:"VPC id must look like vpc-abc12345",ROLE_ARN:"Role ARN must have the form arn:aws:iam::<account-id>:role/<name>",CIDR:"CIDR must be in dotted-quad/prefix-length form (e.g. 10.0.0.0/16)",VPC_PEER:{MIN_REQUESTER_ACCOUNTS:"At least one requester account id is required",REGION_REQUIRED:"Peer region is required when specified",ROUTE_TABLE_ID_REQUIRED:"Route table id must not be empty"},SCHEDULE_EXPRESSION:"Schedule expression must be 'rate(N minute|minutes|hour|hours|day|days)' with N>=1, or 'cron(<6-field AWS expression>)'"});var sz=Object.defineProperty,st=(e,t)=>sz(e,"name",{value:t,configurable:!0}),cz=["us-east-2","us-west-2","us-east-1","eu-west-1","eu-central-1","ap-southeast-1"],uz=Object.freeze(cz.flatMap(e=>{let t=Nn(e);return t?[t]:[]})),gv=Object.freeze(["us-east-2","us-west-2","us-east-1","eu-west-1","ap-southeast-1"]);function _u(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}st(_u,"parseRegionList");function hv(e){return Kt.includes(e)}st(hv,"isValidRegion");function vv(e){return/^[a-z]{2}-[a-z]+-[1-9]$/.test(e)}st(vv,"isValidRegionFormat");function bv(e){if(!e)return gv.slice(0,3);let t=e.toLowerCase().split("-"),n=t[0],i=t.length>1?t[1]:"",r=[];return n&&i&&(r=Kt.filter(o=>o.startsWith(`${n}-${i}`))),r.length===0&&n&&(r=Kt.filter(o=>o.startsWith(`${n}-`))),r.length>0?r.slice(0,3):gv.slice(0,3)}st(bv,"getSuggestions");function yv(e){if(hv(e))return!0;let t=bv(e);return vv(e)?`Unknown region. Try: ${t.join(", ")}`:`Invalid format. Try: ${t.join(", ")}`}st(yv,"validateRegion");function PI(e){if(!e||e.trim()==="")return!0;let t=_u(e);for(let n of t){let i=yv(n);if(i!==!0)return i}return!0}st(PI,"validateRegionList");function Sv(e,t){return e.filter(n=>n!==t)}st(Sv,"filterDuplicateRegions");function _v(e){return{label:e.city,value:e.code,description:e.optIn?`${e.code} \u2014 opt-in required`:e.code}}st(_v,"toRegionOption");function NI(){return it.map(_v)}st(NI,"getRegionOptions");function wI(e){return it.filter(t=>t.code!==e).map(_v)}st(wI,"getRegionOptionsExcluding");function kI(e){let t=it.find(n=>n.code===e);return t?t.city:e}st(kI,"getRegionName");function OI(e){return t=>{let n=_u(t);return Sv(n,e)}}st(OI,"createRegionFormatter");var Eu="4.0.0";var xu=["Aurora","Instance","GlobalAurora","ClickHouse"],_i=["FARGATE","FARGATE_SPOT","EC2"],_t=["standard","resilient","enterprise"],Au=["tinkerer","lightweight","standard","resilient","enterprise"],Ev="custom",ra=[...Au,Ev];var lz=Object.defineProperty,dz=(e,t)=>lz(e,"name",{value:t,configurable:!0}),a5=Object.freeze({RESOURCE_SUFFIXES:Object.freeze({storage:"Storage",database:"Database",cluster:"Cluster",function:"Function",instance:"Instance",compute:"Compute"})}),na=["ecs","lambda","ec2"],Ei=Object.freeze({ECS:"ecs",LAMBDA:"lambda",EC2:"ec2"}),Iu=["code","container"],ia=Object.freeze({CODE:"code",CONTAINER:"container"}),$u=["ARM_64","X86_64"],DI="ARM_64",oa=["NONE","AWS_IAM"],Tu=["public","internal"],Ru=["CPU","MEMORY"],Cu=["ARM","STANDARD"],xv=["Instance","Aurora"],xi=["postgresql","mysql"],MI=["foundation","compliance","hardened"];var Pu=["t3.nano","t3.micro","t3.small","t3.medium","t3.large","t3.xlarge","t3.2xlarge","t3a.nano","t3a.micro","t3a.small","t3a.medium","t3a.large","t3a.xlarge","t3a.2xlarge","t4g.nano","t4g.micro","t4g.small","t4g.medium","t4g.large","t4g.xlarge","t4g.2xlarge","c5.large","c5.xlarge","c5.2xlarge","c5.4xlarge","c5.9xlarge","c5.12xlarge","c5.18xlarge","c5.24xlarge","c5a.large","c5a.xlarge","c5a.2xlarge","c5a.4xlarge","c5a.8xlarge","c5a.12xlarge","c5a.16xlarge","c5a.24xlarge","c6g.medium","c6g.large","c6g.xlarge","c6g.2xlarge","c6g.4xlarge","c6g.8xlarge","c6g.12xlarge","c6g.16xlarge","r5.large","r5.xlarge","r5.2xlarge","r5.4xlarge","r5.8xlarge","r5.12xlarge","r5.16xlarge","r5.24xlarge","r5a.large","r5a.xlarge","r5a.2xlarge","r5a.4xlarge","r5a.8xlarge","r5a.12xlarge","r5a.16xlarge","r5a.24xlarge","r6g.medium","r6g.large","r6g.xlarge","r6g.2xlarge","r6g.4xlarge","r6g.8xlarge","r6g.12xlarge","r6g.16xlarge","i3.large","i3.xlarge","i3.2xlarge","i3.4xlarge","i3.8xlarge","i3.16xlarge","p3.2xlarge","p3.8xlarge","p3.16xlarge","g4dn.xlarge","g4dn.2xlarge","g4dn.4xlarge","g4dn.8xlarge","g4dn.12xlarge","g4dn.16xlarge","m5.large","m5.xlarge","m5.2xlarge","m5.4xlarge","m5.8xlarge","m5.12xlarge","m5.16xlarge","m5.24xlarge","m5a.large","m5a.xlarge","m5a.2xlarge","m5a.4xlarge","m5a.8xlarge","m5a.12xlarge","m5a.16xlarge","m5a.24xlarge"],jI=[0,1,5,10,15,30,60];function ct(e,t){return e.includes(t)}dz(ct,"constIncludes");var zI=1,LI=65535,d5=Object.freeze({postgresql:5432,mysql:3306}),UI=128,FI=10240,Nu=1,wu=900,Av=1,Iv=1e3,Ai=100,BI=100;var VI=3e3;var ZI=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],GI=["standard","assets","upload","website"],Ii=["AES256","KMS"];var mz=Object.defineProperty,aa=(e,t)=>mz(e,"name",{value:t,configurable:!0}),He=aa(e=>s.union([s.literal(!1),e]),"optionalOrDisabled"),sn={check:aa(e=>e.minCapacity!==void 0&&e.maxCapacity!==void 0?e.minCapacity<=e.maxCapacity:!0,"check"),params:{message:d.CAPACITY_CONSTRAINT.MIN_LTE_MAX,path:["maxCapacity"]}},sa=aa(e=>s.number().int(d.MEMORY_LIMIT.INTEGER).min(e,e===128?d.MEMORY_LIMIT.MIN_128:d.MEMORY_LIMIT.MIN_512).max(30720,d.MEMORY_LIMIT.MAX),"memoryLimitMiBSchema"),V=s.string().min(1,d.REQUIRED.RESOURCE_NAME).max(63,d.MAX_LENGTH.RESOURCE_NAME).regex(L.RESOURCE_NAME,d.RESOURCE_NAME),HI=s.string().min(1,d.REQUIRED.BUCKET_NAME).max(63,d.MAX_LENGTH.BUCKET_NAME).regex(L.BUCKET_NAME,d.BUCKET_NAME),qI=s.string().min(1,d.REQUIRED.DATABASE_NAME).max(63,d.MAX_LENGTH.DATABASE_NAME).regex(L.DATABASE_NAME,d.DATABASE_NAME);function ku(e,t=L.IDENTIFIER,n=d.IDENTIFIER){return s.string().min(2,d.IDENTIFIER_MIN_LENGTH).max(50,e).regex(t,n).refine(i=>!i.endsWith("-"),{message:d.IDENTIFIER_NO_TRAILING_HYPHEN}).refine(i=>!i.includes("--"),{message:d.IDENTIFIER_NO_CONSECUTIVE_HYPHENS})}aa(ku,"identifierSchema");var ve=ku(d.MAX_LENGTH.APP_NAME),b5=ku(d.MAX_LENGTH.APP_NAME,L.NEW_APP_NAME,d.NEW_APP_NAME),cn=s.number().int(d.PORT.INTEGER).min(zI,d.PORT.MIN).max(LI,d.PORT.MAX),Re=s.object({key:s.string(),sourceText:s.string()}).strict(),pz=s.object({__identifier:s.string()}).strict(),fz=s.object({__expression:s.string()}).strict(),gz=s.object({__call:s.string()}).strict(),hz=s.union([pz,fz,gz]),vz=s.union([s.string(),s.number(),s.boolean(),hz]),$i=s.record(s.string().regex(L.ENV_VAR_NAME,d.ENV_VAR_NAME),vz),bz=s.object({id:s.string(),name:s.string().optional(),arn:s.string().optional(),field:s.string().optional()}).strict().refine(e=>e.name!==void 0!=(e.arn!==void 0),{message:"secretsImport requires exactly one of `name` or `arn`."}),KI=s.record(s.string(),bz),y5=s.record(s.string(),s.unknown()),$v=s.enum(ra).describe(`Application type must be one of: ${ra.join(", ")}`),Tv=s.enum(kt).describe(`OpenNext deployment pattern: ${kt.join(", ")}`),yz=s.enum(["before-imports","after-imports","after-app-init","after-tags","after-resource","end-of-file"]),Sz=s.enum(["import","app-init","tags","database","compute","storage","network","messaging","cdn","pattern","vpc-peer","vpc-peer-accepter","cross-plan-connection","custom"]),YI=s.object({sourceText:s.string(),position:yz,afterManagedResource:s.object({type:Sz,name:s.string().optional()}).strict().optional(),originalLine:s.number().int().optional(),leadingComments:s.array(s.string()).optional(),orphaned:s.boolean().optional(),orphanedComment:s.string().optional()}).strict(),XI=s.union([s.object({tier:s.enum(_t)}).strict(),s.literal(!1)]),JI=s.union([s.object({instanceType:s.string().optional()}).strict(),s.literal(!1)]),_z=ku(d.MAX_LENGTH.ORGANISATION_NAME),Ez=s.string().regex(L.EMAIL,d.EMAIL),WI=s.string().refine(e=>Kt.includes(e),{message:d.REGION}),S5=s.object({name:_z,email:Ez,accountName:s.string().optional(),primaryRegion:WI.optional().default(Pn),secondaryRegions:s.array(WI).optional(),security:s.enum(MI).optional(),force:s.boolean().optional()}).strict();function ca(e){return e.issues.map(t=>`${t.path.length>0?`${t.path.join(".")}: `:""}${t.message}`).join(`
|
|
187
|
+
`)}catch{}}Jj(rz,"writeDebugSync");var nz=Object.defineProperty,Si=(e,t)=>nz(e,"name",{value:t,configurable:!0});function lv(e){return e.success===!0}Si(lv,"isSuccess");function dv(e){return e.success===!1}Si(dv,"isFailure");function P(e){return{success:!0,data:e}}Si(P,"success");function $(e){return{success:!1,error:e}}Si($,"failure");async function mv(e){try{let t=await e();return P(t)}catch(t){return $(vt(t))}}Si(mv,"tryAsync");function pv(e){try{let t=e();return P(t)}catch(t){return $(vt(t))}}Si(pv,"trySync");var iz=Object.defineProperty,oz=(e,t)=>iz(e,"name",{value:t,configurable:!0}),CI=/^[a-zA-Z][a-zA-Z0-9-]*$/,az=Bo.source.replace(/^\^|\$$/g,""),L=Object.freeze({IDENTIFIER:CI,NEW_APP_NAME:/^[a-z][a-z0-9-]*$/,RESOURCE_NAME:/^[a-zA-Z][a-zA-Z0-9]*$/,ECS_SERVICE_NAME:CI,BUCKET_NAME:/^[a-z][a-z0-9-]*[a-z0-9]$|^[a-z][a-z0-9]*$/,DATABASE_NAME:/^[a-zA-Z][a-zA-Z0-9_]*$/,RESOURCE_TYPE:/^[a-z]+(:[a-z]+)?$/,SSM_PATH:new RegExp(`^(?:/${az})+$`),SECRET_NAME:Xc,SSM_COMPONENT:Bo,EMAIL:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,DOCKER_IMAGE:/^[a-z0-9][a-z0-9._-]*[a-z0-9](:[a-z0-9._-]+)?$/,DOMAIN:/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i,HTTP_ORIGIN:/^https?:\/\/[a-z0-9.-]+(:\d+)?$/i,PASCAL_CASE:/^[A-Z][A-Za-z0-9]*$/,AWS_ACCOUNT_ID:/^\d{12}$/,VPC_ID:/^vpc-[a-z0-9]+$/,ROLE_ARN:/^arn:aws[a-zA-Z-]*:iam::\d{12}:role\/.+$/,CIDR:/^((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\/(3[0-2]|[12]?\d)$/,SCHEDULE_EXPRESSION:/^(rate\(1 (?:minute|hour|day)\)|rate\((?:[2-9]|[1-9]\d+) (?:minutes|hours|days)\)|cron\([^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+ [^\s()]+\))$/,LAMBDA_RUNTIME_IDENTIFIER:/^[A-Za-z0-9._-]+$/,ENV_VAR_NAME:/^[A-Za-z_][A-Za-z0-9_]*$/});function fv(e){let t=/^rate\((\d+) (minute|minutes|hour|hours|day|days)\)$/.exec(e);if(!t)return;let n=t[1],i=t[2];if(n===void 0||i===void 0)return;let r=parseInt(n,10);if(!Number.isFinite(r)||r<1)return;let o=i==="minute"||i==="hour"||i==="day";if(!(o&&r!==1)&&!(!o&&r===1))return i==="minute"||i==="minutes"?{everyMs:r*6e4}:i==="hour"||i==="hours"?{everyMs:r*60*6e4}:{everyMs:r*24*60*6e4}}oz(fv,"parseRateExpression");var d=Object.freeze({IDENTIFIER:"Must start with a letter, contain only letters, numbers, and hyphens",NEW_APP_NAME:"Must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens",IDENTIFIER_MIN_LENGTH:"Must be at least 2 characters",IDENTIFIER_NO_TRAILING_HYPHEN:"Must not end with a hyphen",IDENTIFIER_NO_CONSECUTIVE_HYPHENS:"Must not contain consecutive hyphens",RESOURCE_NAME:"Must start with a letter and contain only letters and numbers (PascalCase recommended)",ECS_SERVICE_NAME:"Service name must start with a letter and contain only letters, numbers, and hyphens",BUCKET_NAME:"Bucket name must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens",DATABASE_NAME:"Database name must start with a letter and contain only letters, numbers, and underscores",RESOURCE_TYPE:"Resource type must be in format 'category' or 'category:type'",SSM_PATH:"SSM path must start with / and contain valid namespace segments (e.g., /myapp/ApiCluster/service)",SECRET_NAME:fh,SSM_COMPONENT:Jc,EMAIL:"Please enter a valid email address",DOMAIN:"Please enter a valid domain (e.g., cms.example.com)",DOCKER_IMAGE:"Invalid Docker image name format",REQUIRED:{APP_NAME:"Application name is required",RESOURCE_NAME:"Resource name is required",BUCKET_NAME:"Bucket name is required",SERVICE_NAME:"Service name is required",NETWORK_NAME:"Network name is required",DATABASE_NAME:"Database name is required",ORGANISATION_NAME:"Organisation name is required",EMAIL:"Email is required",NAME:"Name is required",USERNAME:"Username is required",CONTAINER_NAME:"Container name is required",GROUP:"Group is required",PATTERN_NAME:"Pattern name is required",SOURCE:"Source directory is required",BUILD_COMMAND:"Build command is required",OUTPUT_DIR:"Output directory is required",FORMS_TO:"Forms recipient address is required",ROUTING_PATH:"Routing path is required",RESOURCE_REFERENCE:"Resource reference is required",RESOURCE_TYPE:"Resource type is required",VARIANT:"Variant is required",SUBTYPE:"Subtype is required",DEPLOY_TARGET:"Deploy target is required",DESTROY_TARGET:"Destroy target is required"},MAX_LENGTH:{APP_NAME:"Application name must be 50 characters or less",RESOURCE_NAME:"Resource name must be 63 characters or less",BUCKET_NAME:"Bucket name must be 63 characters or less",SERVICE_NAME:"Service name must be 255 characters or less",NETWORK_NAME:"Network name must be 50 characters or less",DATABASE_NAME:"Database name must be 63 characters or less",ORGANISATION_NAME:"Organisation name must be 50 characters or less"},PORT:{INTEGER:"Port must be an integer",MIN:"Port must be at least 1",MAX:"Port cannot exceed 65535"},USERNAME:{MAX_LENGTH:"Username cannot exceed 63 characters"},LAMBDA:{MEMORY:{INTEGER:"Lambda memory must be an integer",MIN:"Memory must be at least 128 MB",MAX:"Memory cannot exceed 10240 MB",MULTIPLE:"Memory must be 128 MB or a multiple of 64 MB"},TIMEOUT:{INTEGER:"Timeout must be an integer",MIN:"Timeout must be at least 1 second",MAX:"Timeout cannot exceed 900 seconds"},RUNTIME:"Lambda runtime must contain only letters, digits, dots, underscores, or dashes (e.g. 'NODEJS_20_X' or 'nodejs20.x')"},ENV_VAR_NAME:"Environment variable names must start with a letter or underscore and contain only letters, digits, and underscores",PRIORITY:{INTEGER:"Priority must be an integer",MIN:"Priority must be at least 1",MAX:"Priority cannot exceed 50000"},CAPACITY:{MIN:{INTEGER:"Minimum capacity must be an integer",MIN_0:"Minimum capacity must be at least 0",MIN_1:"Minimum capacity must be at least 1",MAX:"Minimum capacity cannot exceed 100"},MAX:{INTEGER:"Maximum capacity must be an integer",MIN_0:"Maximum capacity must be at least 0",MIN_1:"Maximum capacity must be at least 1",MAX:"Maximum capacity cannot exceed 100"},DESIRED:{INTEGER:"Desired count must be an integer",MIN:"Desired count must be at least 0",MAX:"Desired count cannot exceed 100"},WARM_POOL_REQUIRED:"minCapacity 0 requires a warmPool \u2014 without it, new tasks wait 60-90s for a cold instance launch",WARM_POOL:{MIN_SIZE:{INTEGER:"Warm pool minSize must be an integer",MIN:"Warm pool minSize must be at least 0",MAX:"Warm pool minSize cannot exceed 100"},MIN_SIZE_EXCEEDS_MAX_CAPACITY:"warmPool.minSize cannot exceed maxCapacity \u2014 the warm pool cannot hold more instances than the ASG allows"}},MEMORY_LIMIT:{INTEGER:"Memory limit must be an integer",MIN_512:"Memory limit must be at least 512 MiB",MIN_128:"Memory limit must be at least 128 MiB",MAX:"Memory limit cannot exceed 30720 MiB"},DATABASE:{PORT:{INTEGER:"Database port must be an integer",MIN:"Database port must be at least 1024",MAX:"Database port cannot exceed 65535"},NAME:{REQUIRED:"Database name is required",MAX_LENGTH:"Database name must be 63 characters or less"}},BACKUP_RETENTION:{INTEGER:"Backup retention must be an integer",MIN:"Backup retention must be at least 1 day",MAX:"Backup retention cannot exceed 35 days"},SQS:{VISIBILITY_TIMEOUT:{INTEGER:"Visibility timeout must be an integer",MIN:"Visibility timeout must be at least 0 seconds",MAX:"Visibility timeout cannot exceed 43200 seconds (12 hours)"},RETENTION_PERIOD:{INTEGER:"Retention period must be an integer",MIN:"Retention period must be at least 60 seconds",MAX:"Retention period cannot exceed 1209600 seconds (14 days)"}},READER:{COUNT:{INTEGER:"Reader count must be an integer",MIN:"Reader count must be at least 0",MAX:"Reader count cannot exceed 15"}},IDENTIFIER_SUFFIX:{REQUIRED:"Identifier suffix is required when specified",MAX_LENGTH:"Identifier suffix cannot exceed 50 characters"},ROTATION:{INTEGER:"Rotation days must be an integer",MIN:"Rotation interval must be at least 1 day",MAX:"Rotation interval cannot exceed 365 days"},MAX_CONNECTIONS:{INTEGER:"Max connections must be an integer",MIN:"Max connections must be at least 1",MAX:"Max connections cannot exceed 100"},MONITORING_INTERVAL:{INTEGER:"Monitoring interval must be an integer",MIN:"Monitoring interval must be at least 0",MAX:"Monitoring interval cannot exceed 60 seconds",VALUES:"Monitoring interval must be 0, 1, 5, 10, 15, 30, or 60 seconds"},RETENTION_DAYS:{INTEGER:"Retention days must be an integer",MIN:"Retention days must be at least 1",MAX:"Retention days cannot exceed 365"},BATCH_SIZE:{INTEGER:"Batch size must be an integer",MIN:"Batch size must be at least 1",MAX:"Batch size cannot exceed 10000"},SERVICE:{UNIQUE_WITHIN_CLUSTER:"Service names must be unique within a cluster",MIN_REQUIRED:"At least one service is required",ROUTING_REQUIRED:"Multiple services with ports require routing config (path or host)"},PROXY_CONFIG:{MAX_IDLE_CONNECTIONS:{INTEGER:"Max idle connections must be an integer",MIN:"Max idle connections must be at least 0",MAX:"Max idle connections cannot exceed 100"},BORROW_TIMEOUT:{INTEGER:"Connection borrow timeout must be an integer",MIN:"Connection borrow timeout must be at least 1 second",MAX:"Connection borrow timeout cannot exceed 3600 seconds"}},MAX_AZS:{INTEGER:"Max AZs must be an integer",MIN:"Max AZs must be at least 1",MAX:"Max AZs cannot exceed 3"},BATCHING_WINDOW:{INTEGER:"Max batching window must be an integer",MIN:"Max batching window must be at least 0",MAX:"Max batching window cannot exceed 300 seconds"},HEALTH_CHECK:{INTERVAL:{INTEGER:"Health check interval must be an integer",MIN:"Health check interval must be at least 5 seconds",MAX:"Health check interval cannot exceed 300 seconds"},TIMEOUT:{INTEGER:"Health check timeout must be an integer",MIN:"Health check timeout must be at least 2 seconds",MAX:"Health check timeout cannot exceed 60 seconds"},RETRIES:{INTEGER:"Health check retries must be an integer",MIN:"Health check retries must be at least 1",MAX:"Health check retries cannot exceed 10"},START_PERIOD:{INTEGER:"Health check start period must be an integer",MIN:"Health check start period must be at least 0 seconds",MAX:"Health check start period cannot exceed 300 seconds"}},EPHEMERAL_STORAGE:{INTEGER:"Ephemeral storage size must be an integer",MIN:"Ephemeral storage size must be at least 512 MB",MAX:"Ephemeral storage size cannot exceed 10240 MB"},MAX_MESSAGE_SIZE:{INTEGER:"Max message size must be an integer",MIN:"Max message size must be at least 1024 bytes",MAX:"Max message size cannot exceed 262144 bytes (256 KB)"},CAPACITY_CONSTRAINT:{MIN_LTE_MAX:"minCapacity must be less than or equal to maxCapacity"},DIRECT_ACCESS:{NO_DOMAIN:"directAccess cannot be used with domain (no ALB for HTTPS)",NO_LOAD_BALANCER:"directAccess cannot be used with loadBalancer (mutually exclusive)"},GLOBAL_AURORA:{PRIMARY_REGION_REQUIRED:"primaryRegion is required for GlobalAurora databases"},NAT_GATEWAY:{INTEGER:"NAT gateway count must be an integer",MIN:"NAT gateway count must be at least 0",MAX:"NAT gateway count cannot exceed 3"},CIDR_MASK:{INTEGER:"CIDR mask must be an integer",MIN:"CIDR mask must be at least 16",MAX:"CIDR mask cannot exceed 28"},CPU:{INTEGER:"CPU must be an integer",MIN:"CPU must be at least 256 units",MAX:"CPU cannot exceed 4096 units"},KMS:{KEY_REQUIRED:"KMS key ARN is required when using KMS encryption"},READER_INSTANCES:{MAX:"Cannot have more than 15 reader instances",COUNT_OR_INSTANCES:"Cannot specify both 'count' and 'instances' - use one or the other"},GENERATOR_CAPACITY:{MIN:{MIN:"Minimum capacity must be at least 1",MAX:"Minimum capacity cannot exceed 1000"},MAX:{MIN:"Maximum capacity must be at least 1",MAX:"Maximum capacity cannot exceed 1000"}},INSTANCE_TYPE:"Unknown instance type. Common types include: t4g.micro, t4g.small, m5.large",ARCHITECTURE_MISMATCH:"Architecture mismatch between instance type and AMI",ALLOCATED_STORAGE:{INTEGER:"Allocated storage must be an integer",MIN:"Allocated storage must be at least 20 GB",MAX:"Allocated storage cannot exceed 65536 GB"},DLQ:{MAX_RECEIVE_COUNT:{INTEGER:"Max receive count must be an integer",MIN:"Max receive count must be at least 1",MAX:"Max receive count cannot exceed 1000"}},ALARM:{PERCENTAGE:{MIN:"Threshold must be at least 1%",MAX:"Threshold must be at most 100%"},FREE_STORAGE_GIB:{MIN:"Free storage threshold must be at least 1 GiB"}},REGION:"Invalid AWS region",PASCAL_CASE:"Resource name must start with an uppercase letter and contain only alphanumerics (PascalCase).",IMAGE_DOCKER_MUTEX:"image and docker are mutually exclusive",AWS_ACCOUNT_ID:"AWS account id must be exactly 12 digits (no hyphens)",VPC_ID:"VPC id must look like vpc-abc12345",ROLE_ARN:"Role ARN must have the form arn:aws:iam::<account-id>:role/<name>",CIDR:"CIDR must be in dotted-quad/prefix-length form (e.g. 10.0.0.0/16)",VPC_PEER:{MIN_REQUESTER_ACCOUNTS:"At least one requester account id is required",REGION_REQUIRED:"Peer region is required when specified",ROUTE_TABLE_ID_REQUIRED:"Route table id must not be empty"},SCHEDULE_EXPRESSION:"Schedule expression must be 'rate(N minute|minutes|hour|hours|day|days)' with N>=1, or 'cron(<6-field AWS expression>)'"});var sz=Object.defineProperty,st=(e,t)=>sz(e,"name",{value:t,configurable:!0}),cz=["us-east-2","us-west-2","us-east-1","eu-west-1","eu-central-1","ap-southeast-1"],uz=Object.freeze(cz.flatMap(e=>{let t=Nn(e);return t?[t]:[]})),gv=Object.freeze(["us-east-2","us-west-2","us-east-1","eu-west-1","ap-southeast-1"]);function _u(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}st(_u,"parseRegionList");function hv(e){return Kt.includes(e)}st(hv,"isValidRegion");function vv(e){return/^[a-z]{2}-[a-z]+-[1-9]$/.test(e)}st(vv,"isValidRegionFormat");function bv(e){if(!e)return gv.slice(0,3);let t=e.toLowerCase().split("-"),n=t[0],i=t.length>1?t[1]:"",r=[];return n&&i&&(r=Kt.filter(o=>o.startsWith(`${n}-${i}`))),r.length===0&&n&&(r=Kt.filter(o=>o.startsWith(`${n}-`))),r.length>0?r.slice(0,3):gv.slice(0,3)}st(bv,"getSuggestions");function yv(e){if(hv(e))return!0;let t=bv(e);return vv(e)?`Unknown region. Try: ${t.join(", ")}`:`Invalid format. Try: ${t.join(", ")}`}st(yv,"validateRegion");function PI(e){if(!e||e.trim()==="")return!0;let t=_u(e);for(let n of t){let i=yv(n);if(i!==!0)return i}return!0}st(PI,"validateRegionList");function Sv(e,t){return e.filter(n=>n!==t)}st(Sv,"filterDuplicateRegions");function _v(e){return{label:e.city,value:e.code,description:e.optIn?`${e.code} \u2014 opt-in required`:e.code}}st(_v,"toRegionOption");function NI(){return it.map(_v)}st(NI,"getRegionOptions");function wI(e){return it.filter(t=>t.code!==e).map(_v)}st(wI,"getRegionOptionsExcluding");function kI(e){let t=it.find(n=>n.code===e);return t?t.city:e}st(kI,"getRegionName");function OI(e){return t=>{let n=_u(t);return Sv(n,e)}}st(OI,"createRegionFormatter");var Eu="4.1.0";var xu=["Aurora","Instance","GlobalAurora","ClickHouse"],_i=["FARGATE","FARGATE_SPOT","EC2"],_t=["standard","resilient","enterprise"],Au=["tinkerer","lightweight","standard","resilient","enterprise"],Ev="custom",ra=[...Au,Ev];var lz=Object.defineProperty,dz=(e,t)=>lz(e,"name",{value:t,configurable:!0}),a5=Object.freeze({RESOURCE_SUFFIXES:Object.freeze({storage:"Storage",database:"Database",cluster:"Cluster",function:"Function",instance:"Instance",compute:"Compute"})}),na=["ecs","lambda","ec2"],Ei=Object.freeze({ECS:"ecs",LAMBDA:"lambda",EC2:"ec2"}),Iu=["code","container"],ia=Object.freeze({CODE:"code",CONTAINER:"container"}),$u=["ARM_64","X86_64"],DI="ARM_64",oa=["NONE","AWS_IAM"],Tu=["public","internal"],Ru=["CPU","MEMORY"],Cu=["ARM","STANDARD"],xv=["Instance","Aurora"],xi=["postgresql","mysql"],MI=["foundation","compliance","hardened"];var Pu=["t3.nano","t3.micro","t3.small","t3.medium","t3.large","t3.xlarge","t3.2xlarge","t3a.nano","t3a.micro","t3a.small","t3a.medium","t3a.large","t3a.xlarge","t3a.2xlarge","t4g.nano","t4g.micro","t4g.small","t4g.medium","t4g.large","t4g.xlarge","t4g.2xlarge","c5.large","c5.xlarge","c5.2xlarge","c5.4xlarge","c5.9xlarge","c5.12xlarge","c5.18xlarge","c5.24xlarge","c5a.large","c5a.xlarge","c5a.2xlarge","c5a.4xlarge","c5a.8xlarge","c5a.12xlarge","c5a.16xlarge","c5a.24xlarge","c6g.medium","c6g.large","c6g.xlarge","c6g.2xlarge","c6g.4xlarge","c6g.8xlarge","c6g.12xlarge","c6g.16xlarge","r5.large","r5.xlarge","r5.2xlarge","r5.4xlarge","r5.8xlarge","r5.12xlarge","r5.16xlarge","r5.24xlarge","r5a.large","r5a.xlarge","r5a.2xlarge","r5a.4xlarge","r5a.8xlarge","r5a.12xlarge","r5a.16xlarge","r5a.24xlarge","r6g.medium","r6g.large","r6g.xlarge","r6g.2xlarge","r6g.4xlarge","r6g.8xlarge","r6g.12xlarge","r6g.16xlarge","i3.large","i3.xlarge","i3.2xlarge","i3.4xlarge","i3.8xlarge","i3.16xlarge","p3.2xlarge","p3.8xlarge","p3.16xlarge","g4dn.xlarge","g4dn.2xlarge","g4dn.4xlarge","g4dn.8xlarge","g4dn.12xlarge","g4dn.16xlarge","m5.large","m5.xlarge","m5.2xlarge","m5.4xlarge","m5.8xlarge","m5.12xlarge","m5.16xlarge","m5.24xlarge","m5a.large","m5a.xlarge","m5a.2xlarge","m5a.4xlarge","m5a.8xlarge","m5a.12xlarge","m5a.16xlarge","m5a.24xlarge"],jI=[0,1,5,10,15,30,60];function ct(e,t){return e.includes(t)}dz(ct,"constIncludes");var zI=1,LI=65535,d5=Object.freeze({postgresql:5432,mysql:3306}),UI=128,FI=10240,Nu=1,wu=900,Av=1,Iv=1e3,Ai=100,BI=100;var VI=3e3;var ZI=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"],GI=["standard","assets","upload","website"],Ii=["AES256","KMS"];var mz=Object.defineProperty,aa=(e,t)=>mz(e,"name",{value:t,configurable:!0}),He=aa(e=>s.union([s.literal(!1),e]),"optionalOrDisabled"),sn={check:aa(e=>e.minCapacity!==void 0&&e.maxCapacity!==void 0?e.minCapacity<=e.maxCapacity:!0,"check"),params:{message:d.CAPACITY_CONSTRAINT.MIN_LTE_MAX,path:["maxCapacity"]}},sa=aa(e=>s.number().int(d.MEMORY_LIMIT.INTEGER).min(e,e===128?d.MEMORY_LIMIT.MIN_128:d.MEMORY_LIMIT.MIN_512).max(30720,d.MEMORY_LIMIT.MAX),"memoryLimitMiBSchema"),V=s.string().min(1,d.REQUIRED.RESOURCE_NAME).max(63,d.MAX_LENGTH.RESOURCE_NAME).regex(L.RESOURCE_NAME,d.RESOURCE_NAME),HI=s.string().min(1,d.REQUIRED.BUCKET_NAME).max(63,d.MAX_LENGTH.BUCKET_NAME).regex(L.BUCKET_NAME,d.BUCKET_NAME),qI=s.string().min(1,d.REQUIRED.DATABASE_NAME).max(63,d.MAX_LENGTH.DATABASE_NAME).regex(L.DATABASE_NAME,d.DATABASE_NAME);function ku(e,t=L.IDENTIFIER,n=d.IDENTIFIER){return s.string().min(2,d.IDENTIFIER_MIN_LENGTH).max(50,e).regex(t,n).refine(i=>!i.endsWith("-"),{message:d.IDENTIFIER_NO_TRAILING_HYPHEN}).refine(i=>!i.includes("--"),{message:d.IDENTIFIER_NO_CONSECUTIVE_HYPHENS})}aa(ku,"identifierSchema");var ve=ku(d.MAX_LENGTH.APP_NAME),b5=ku(d.MAX_LENGTH.APP_NAME,L.NEW_APP_NAME,d.NEW_APP_NAME),cn=s.number().int(d.PORT.INTEGER).min(zI,d.PORT.MIN).max(LI,d.PORT.MAX),Re=s.object({key:s.string(),sourceText:s.string()}).strict(),pz=s.object({__identifier:s.string()}).strict(),fz=s.object({__expression:s.string()}).strict(),gz=s.object({__call:s.string()}).strict(),hz=s.union([pz,fz,gz]),vz=s.union([s.string(),s.number(),s.boolean(),hz]),$i=s.record(s.string().regex(L.ENV_VAR_NAME,d.ENV_VAR_NAME),vz),bz=s.object({id:s.string(),name:s.string().optional(),arn:s.string().optional(),field:s.string().optional()}).strict().refine(e=>e.name!==void 0!=(e.arn!==void 0),{message:"secretsImport requires exactly one of `name` or `arn`."}),KI=s.record(s.string(),bz),y5=s.record(s.string(),s.unknown()),$v=s.enum(ra).describe(`Application type must be one of: ${ra.join(", ")}`),Tv=s.enum(kt).describe(`OpenNext deployment pattern: ${kt.join(", ")}`),yz=s.enum(["before-imports","after-imports","after-app-init","after-tags","after-resource","end-of-file"]),Sz=s.enum(["import","app-init","tags","database","compute","storage","network","messaging","cdn","pattern","vpc-peer","vpc-peer-accepter","cross-plan-connection","custom"]),YI=s.object({sourceText:s.string(),position:yz,afterManagedResource:s.object({type:Sz,name:s.string().optional()}).strict().optional(),originalLine:s.number().int().optional(),leadingComments:s.array(s.string()).optional(),orphaned:s.boolean().optional(),orphanedComment:s.string().optional()}).strict(),XI=s.union([s.object({tier:s.enum(_t)}).strict(),s.literal(!1)]),JI=s.union([s.object({instanceType:s.string().optional()}).strict(),s.literal(!1)]),_z=ku(d.MAX_LENGTH.ORGANISATION_NAME),Ez=s.string().regex(L.EMAIL,d.EMAIL),WI=s.string().refine(e=>Kt.includes(e),{message:d.REGION}),S5=s.object({name:_z,email:Ez,accountName:s.string().optional(),primaryRegion:WI.optional().default(Pn),secondaryRegions:s.array(WI).optional(),security:s.enum(MI).optional(),force:s.boolean().optional()}).strict();function ca(e){return e.issues.map(t=>`${t.path.length>0?`${t.path.join(".")}: `:""}${t.message}`).join(`
|
|
188
188
|
`)}aa(ca,"getZodErrorMessage");var Ti=s.number().min(1,d.ALARM.PERCENTAGE.MIN).max(100,d.ALARM.PERCENTAGE.MAX),xz=s.number().min(1,d.ALARM.FREE_STORAGE_GIB.MIN),QI=s.union([s.literal(!1),s.object({cpuThreshold:Ti.optional(),memoryThreshold:Ti.optional(),runningTasksMinimum:s.number().int().min(0).optional(),http5xxThreshold:Ti.optional()}).strict()]),e$=s.union([s.literal(!1),s.object({cpuThreshold:Ti.optional(),freeStorageThresholdGiB:xz.optional(),connectionsThreshold:s.number().int().min(1).optional()}).strict()]),t$=s.union([s.literal(!1),s.object({errorRateThreshold:Ti.optional(),durationThresholdPercent:Ti.optional()}).strict()]);var Qt=s.number().int(d.BACKUP_RETENTION.INTEGER).min(1,d.BACKUP_RETENTION.MIN).max(35,d.BACKUP_RETENTION.MAX),ua=s.number().int(d.MONITORING_INTERVAL.INTEGER).refine(e=>ct(jI,e),{message:d.MONITORING_INTERVAL.VALUES}),Du=s.number().int(d.DATABASE.PORT.INTEGER).min(1024,d.DATABASE.PORT.MIN).max(65535,d.DATABASE.PORT.MAX),Az=s.enum(xu).describe(`Database type must be one of: ${xu.join(", ")}`),Iz=s.object({maxConnections:s.number().int(d.MAX_CONNECTIONS.INTEGER).min(1,d.MAX_CONNECTIONS.MIN).max(100,d.MAX_CONNECTIONS.MAX).optional(),maxIdleConnections:s.number().int(d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER).min(0,d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN).max(100,d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX).optional(),connectionBorrowTimeout:s.number().int(d.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER).min(1,d.PROXY_CONFIG.BORROW_TIMEOUT.MIN).max(3600,d.PROXY_CONFIG.BORROW_TIMEOUT.MAX).optional(),requireTLS:s.boolean().optional()}).strict().describe("RDS Proxy configuration"),$z=s.object({instanceType:s.string().optional(),availabilityZone:s.string().optional()}).strict().describe("Read replica configuration"),Tz=s.object({automaticallyAfterDays:s.number().int(d.ROTATION.INTEGER).min(1,d.ROTATION.MIN).max(365,d.ROTATION.MAX).optional()}).strict().describe("Secret rotation configuration"),Mu=s.object({username:s.string().min(1,d.REQUIRED.USERNAME).max(63,d.USERNAME.MAX_LENGTH).optional(),secretRotation:Tz.optional()}).strict().describe("Database credentials configuration"),ju=He(Iz),zu=He($z),Rz=s.object({scaleWithWriter:s.boolean().optional(),enableDatabaseInsights:s.boolean().optional(),identifierSuffix:s.string().min(1,d.IDENTIFIER_SUFFIX.REQUIRED).max(50,d.IDENTIFIER_SUFFIX.MAX_LENGTH).optional(),availabilityZone:s.string().optional()}).strict().describe("Configuration for a single Aurora reader instance"),la=s.object({enableDatabaseInsights:s.boolean().optional(),identifierSuffix:s.string().min(1,d.IDENTIFIER_SUFFIX.REQUIRED).max(50,d.IDENTIFIER_SUFFIX.MAX_LENGTH).optional(),availabilityZone:s.string().optional()}).strict().describe("Configuration for Aurora writer instance"),Cz=s.object({count:s.number().int(d.READER.COUNT.INTEGER).min(0,d.READER.COUNT.MIN).max(15,d.READER.COUNT.MAX).optional(),instances:s.array(Rz).max(15,d.READER_INSTANCES.MAX).optional(),defaultEnableDatabaseInsights:s.boolean().optional()}).strict().refine(e=>!(e.count!==void 0&&e.instances!==void 0),{message:d.READER_INSTANCES.COUNT_OR_INSTANCES,path:["count"]}).describe("Aurora readers configuration"),da=He(Cz),Pz=s.object({awsManaged:s.literal(!0)}).strict(),Nz=s.object({useCMK:s.literal(!0)}).strict(),r$=s.union([Pz,Nz]),wz=s.object({mode:s.enum(["standard","advanced"]).optional(),encryptionKey:r$.optional()}).strict().describe("Database Insights configuration"),Lu=He(wz),Uu=s.object({storageKey:r$.optional()}).strict().describe("Encryption configuration (DESTRUCTIVE to change storageKey)"),n$=s.object({name:V,type:Az,databaseName:s.string().min(1,d.REQUIRED.DATABASE_NAME),instanceType:s.string().optional(),allocatedStorage:s.number().optional(),multiAz:s.boolean().optional(),publiclyAccessible:s.boolean().optional(),databaseInsights:Lu.optional(),port:Du.optional(),deletionProtection:s.boolean().optional(),proxy:ju.optional(),credentials:Mu.optional(),readReplica:zu.optional(),encryption:Uu.optional(),writer:la.optional(),readers:da.optional(),backupRetention:Qt.optional(),preferredMaintenanceWindow:s.string().optional(),monitoringInterval:ua.optional(),primaryRegion:s.string().optional(),secondaryRegions:s.array(s.string()).optional(),globalClusterIdentifier:s.string().optional(),enableGlobalWriteForwarding:s.boolean().optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional(),databaseEngine:s.enum(xi).optional(),engineExpression:s.string().optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional(),alarms:e$.optional()}).strict(),Fu=s.object({appName:ve,nameProvidedByFlag:s.boolean().optional(),databaseName:s.string().min(1,d.REQUIRED.DATABASE_NAME).max(63,d.MAX_LENGTH.DATABASE_NAME).regex(L.DATABASE_NAME,d.DATABASE_NAME),resourceName:V.optional(),connectionConfig:s.object({connectToCompute:s.array(s.string()).optional(),connectToServices:s.array(s.string()).optional()}).strict().optional(),databaseInsights:Lu.optional(),port:Du.optional(),proxy:ju.optional(),credentials:Mu.optional(),encryption:Uu.optional(),deletionProtection:s.boolean().optional()}).strict(),i$={databaseType:s.literal("Instance"),instanceType:s.string().optional(),multiAz:s.boolean().optional(),readReplica:zu.optional(),publiclyAccessible:s.boolean().optional(),backupRetention:Qt.optional(),allocatedStorage:s.number().optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional()},o$={databaseType:s.literal("Aurora"),writer:la.optional(),readers:da.optional(),backupRetention:Qt.optional(),preferredMaintenanceWindow:s.string().optional(),monitoringInterval:ua.optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional()},a$={databaseType:s.literal("GlobalAurora"),primaryRegion:s.string().min(1,d.GLOBAL_AURORA.PRIMARY_REGION_REQUIRED),secondaryRegions:s.array(s.string()).optional(),globalClusterIdentifier:s.string().optional(),enableGlobalWriteForwarding:s.boolean().optional(),writer:la.optional(),readers:da.optional(),backupRetention:Qt.optional(),preferredMaintenanceWindow:s.string().optional(),monitoringInterval:ua.optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional()},s$=s.object({appName:ve,nameProvidedByFlag:s.boolean().optional(),databaseName:s.string().min(1,d.REQUIRED.DATABASE_NAME).max(63,d.MAX_LENGTH.DATABASE_NAME).regex(L.DATABASE_NAME,d.DATABASE_NAME),resourceName:V.optional(),connectionConfig:s.object({connectToCompute:s.array(s.string()).optional(),connectToServices:s.array(s.string()).optional()}).strict().optional()}).strict(),c$={databaseType:s.literal("ClickHouse"),instanceType:s.string().optional(),coldTier:s.union([s.object({mode:s.literal("s3")}).strict(),s.literal(!1)]).optional(),optimiseSchedule:s.union([s.string(),s.literal(!1)]).optional(),backupSchedule:s.union([s.string(),s.literal(!1)]).optional(),backupRetentionDays:Qt.optional()},kz=Fu.extend(i$).strict(),Oz=Fu.extend(o$).strict(),Dz=Fu.extend(a$).strict(),Mz=s$.extend(c$).strict(),P5=s.discriminatedUnion("databaseType",[kz,Oz,Dz,Mz]),Rv=Fu.extend({resourceName:V}).strict(),jz=Rv.extend(i$).strict(),zz=Rv.extend(o$).strict(),Lz=Rv.extend(a$).strict(),Uz=s$.extend({resourceName:V}).strict(),Fz=Uz.extend(c$).strict(),N5=s.discriminatedUnion("databaseType",[jz,zz,Lz,Fz]),w5=s.object({appName:ve,databaseName:s.string().min(1,d.REQUIRED.DATABASE_NAME),maxConnections:s.number().int(d.MAX_CONNECTIONS.INTEGER).min(1,d.MAX_CONNECTIONS.MIN).max(100,d.MAX_CONNECTIONS.MAX).optional(),maxIdleConnections:s.number().int(d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.INTEGER).min(0,d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MIN).max(100,d.PROXY_CONFIG.MAX_IDLE_CONNECTIONS.MAX).optional(),connectionBorrowTimeout:s.number().int(d.PROXY_CONFIG.BORROW_TIMEOUT.INTEGER).min(1,d.PROXY_CONFIG.BORROW_TIMEOUT.MIN).max(3600,d.PROXY_CONFIG.BORROW_TIMEOUT.MAX).optional(),requireTLS:s.boolean().optional(),nameProvidedByFlag:s.boolean().optional()}).strict(),Bz=["S","N","B"],Ou=s.object({name:s.string(),type:s.enum(Bz)}).strict(),u$=s.object({name:V,partitionKey:Ou,sortKey:Ou.optional(),globalSecondaryIndexes:s.array(s.object({indexName:s.string(),partitionKey:Ou,sortKey:Ou.optional()}).strict()).optional(),ttlAttribute:s.string().optional(),stream:s.boolean().optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict(),Vz=s.object({mode:s.literal("s3")}).strict(),l$=s.object({name:V,type:s.literal("ClickHouse"),databaseName:qI,instanceType:s.string().optional(),coldTier:s.union([Vz,s.literal(!1)]).optional(),optimiseSchedule:s.union([s.string(),s.literal(!1)]).optional(),backupSchedule:s.union([s.string(),s.literal(!1)]).optional(),backupRetentionDays:Qt.optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict();var Zz=s.object({count:s.number().int(d.NAT_GATEWAY.INTEGER).min(0,d.NAT_GATEWAY.MIN).max(3,d.NAT_GATEWAY.MAX).optional()}).strict().describe("NAT gateway configuration"),d$=He(Zz),Cv=s.enum(["cloudwatch","s3"]),Gz=s.object({destination:Cv.optional(),retentionDays:s.number().int(d.RETENTION_DAYS.INTEGER).min(1,d.RETENTION_DAYS.MIN).max(365,d.RETENTION_DAYS.MAX).optional(),trafficType:s.enum(["ALL","ACCEPT","REJECT"]).optional()}).strict().describe("VPC flow log configuration"),m$=He(Gz),Wz=s.object({s3:s.boolean().optional(),dynamodb:s.boolean().optional()}).strict().describe("Gateway VPC endpoints (FREE)"),Hz=He(Wz),qz=s.object({ecr:s.boolean().optional(),secretsManager:s.boolean().optional(),kms:s.boolean().optional(),cloudwatchLogs:s.boolean().optional(),ssm:s.boolean().optional(),sts:s.boolean().optional()}).strict().describe("Interface VPC endpoints (cost per hour)"),Kz=He(qz),Yz=s.object({gateway:Hz.optional(),interface:Kz.optional()}).strict().describe("VPC endpoints configuration"),p$=He(Yz),Bu=s.object({maxAzs:s.number().int(d.MAX_AZS.INTEGER).min(1,d.MAX_AZS.MIN).max(3,d.MAX_AZS.MAX).optional(),natGateways:d$.optional(),flowLogs:m$.optional(),vpcEndpoints:p$.optional(),cidrMask:s.number().int(d.CIDR_MASK.INTEGER).min(16,d.CIDR_MASK.MIN).max(28,d.CIDR_MASK.MAX).optional()}).strict(),f$=s.string().min(1,d.REQUIRED.NETWORK_NAME).max(50,d.MAX_LENGTH.NETWORK_NAME).regex(L.RESOURCE_NAME,d.RESOURCE_NAME),g$=Bu.extend({name:f$}).strict(),h$=He(Bu),j5=s.object({appName:ve,networkName:f$.optional(),maxAzs:s.number().int(d.MAX_AZS.INTEGER).min(1,d.MAX_AZS.MIN).max(3,d.MAX_AZS.MAX).optional(),natGateways:d$.optional(),flowLogs:m$.optional(),vpcEndpoints:p$.optional()}).strict(),Xz=L.CIDR,Pv=s.string().regex(Xz,d.CIDR),Jz=s.object({kind:s.literal("database"),resource:s.string().min(1,d.REQUIRED.RESOURCE_REFERENCE),name:V,allowedFromCidrs:s.array(Pv),access:s.enum(["read","write","readWrite"]).optional()}).strict(),Qz=s.object({kind:s.literal("ecsService"),resource:s.string().min(1,d.REQUIRED.RESOURCE_REFERENCE),serviceName:s.string().min(1,d.REQUIRED.SERVICE_NAME),name:V,allowedFromCidrs:s.array(Pv),port:cn.optional()}).strict(),eL=s.discriminatedUnion("kind",[Jz,Qz]),z5=s.object({name:V,peerAppName:s.string().min(1,d.REQUIRED.APP_NAME),peerAccountId:s.string().regex(L.AWS_ACCOUNT_ID,d.AWS_ACCOUNT_ID),peerRegion:s.string().min(1,d.VPC_PEER.REGION_REQUIRED).optional(),peerVpcId:s.string().regex(L.VPC_ID,d.VPC_ID).optional(),peerVpcCidr:Pv.optional(),peerRoleArn:s.string().regex(L.ROLE_ARN,d.ROLE_ARN).optional(),peerRouteTableIds:s.array(s.string().min(1,d.VPC_PEER.ROUTE_TABLE_ID_REQUIRED)).optional(),localVpcName:s.string().min(1,d.REQUIRED.NETWORK_NAME).optional(),enableDnsResolution:s.boolean().optional()}).strict(),L5=s.object({name:V,requesterAccountIds:s.array(s.string().regex(L.AWS_ACCOUNT_ID,d.AWS_ACCOUNT_ID)).min(1,d.VPC_PEER.MIN_REQUESTER_ACCOUNTS),localVpcName:s.string().min(1,d.REQUIRED.NETWORK_NAME).optional(),publishToSsm:s.boolean().optional(),exposedResources:s.array(eL).optional()}).strict();var Vu=["storage","cdn","compute"],tL=s.object({sid:s.string().optional(),effect:s.enum(["Allow","Deny"]),principals:s.array(s.string()),actions:s.array(s.string()),resources:s.array(s.string()).optional(),conditions:s.record(s.string(),s.record(s.string(),s.union([s.string(),s.array(s.string())]))).optional()}).strict(),v$=s.object({name:V,bucketName:s.string().optional(),publicReadAccess:s.boolean().optional(),websiteHosting:s.object({indexDocument:s.string(),errorDocument:s.string().optional()}).strict().optional(),backupVaultTier:s.enum(_t).optional(),versioned:s.boolean().optional(),encryption:s.enum(Ii).optional(),kmsKeyArn:s.string().optional(),cors:s.array(s.object({allowedOrigins:s.array(s.string()),allowedMethods:s.array(s.string()),allowedHeaders:s.array(s.string()).optional(),exposedHeaders:s.array(s.string()).optional(),maxAge:s.number().optional()}).strict()).optional(),deployment:s.object({source:s.string(),prune:s.boolean().optional(),cacheControl:s.object({maxAge:s.number().optional(),immutable:s.boolean().optional()}).strict().optional()}).strict().optional(),retain:s.boolean().optional(),resourcePolicyStatements:s.array(tL).optional(),stackPlacement:s.enum(Vu).optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:d.KMS.KEY_REQUIRED}),b$=s.object({appName:ve,bucketName:HI,nameProvidedByFlag:s.boolean().optional(),storagePreset:s.enum(GI).optional(),publicReadAccess:s.boolean().optional(),websiteHosting:s.object({indexDocument:s.string(),errorDocument:s.string().optional()}).strict().optional(),backupVaultTier:s.enum(_t).optional(),versioned:s.boolean().optional(),encryption:s.enum(Ii).optional(),kmsKeyArn:s.string().optional(),cors:s.array(s.object({allowedOrigins:s.array(s.string()),allowedMethods:s.array(s.string()),allowedHeaders:s.array(s.string()).optional(),exposedHeaders:s.array(s.string()).optional(),maxAge:s.number().optional()}).strict()).optional(),connectionConfig:s.object({connectToCompute:s.array(s.string()).optional(),connectToServices:s.array(s.string()).optional()}).strict().optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:d.KMS.KEY_REQUIRED,path:["kmsKeyArn"]});var Nv=s.enum(["DESTROY","RETAIN"]),y$=s.object({name:V,queueType:s.enum(["standard","fifo"]).default("standard"),visibilityTimeout:s.number().int(d.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,d.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,d.SQS.VISIBILITY_TIMEOUT.MAX).optional(),retentionPeriod:s.number().int(d.SQS.RETENTION_PERIOD.INTEGER).min(60,d.SQS.RETENTION_PERIOD.MIN).max(1209600,d.SQS.RETENTION_PERIOD.MAX).optional(),contentBasedDeduplication:s.boolean().optional(),removalPolicy:Nv.optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict();var S$=s.object({type:s.literal("basic-auth"),username:s.string().min(1),password:s.string().min(1)}).strict(),_$=s.object({name:V,defaultOriginRef:s.string(),behaviours:s.array(s.object({pathPattern:s.string(),originRef:s.string(),cachePolicy:s.enum(["CACHING_OPTIMIZED","CACHING_DISABLED"]).optional()}).strict()).optional(),customDomain:s.string().optional(),certificateArn:s.string().optional(),accessGate:s.union([s.literal(!1),S$]).optional(),extraProperties:s.array(Re).optional()}).strict(),J5=s.object({appName:s.string(),name:V.optional(),defaultOriginRef:s.string(),behaviours:s.array(s.object({pathPattern:s.string(),originRef:s.string(),cachePolicy:s.enum(["CACHING_OPTIMIZED","CACHING_DISABLED"]).optional()}).strict()).optional(),customDomain:s.string().optional(),certificateArn:s.string().optional(),accessGate:s.union([s.literal(!1),S$]).optional(),nameProvidedByFlag:s.boolean().optional()}).strict();var rL=Object.defineProperty,wv=(e,t)=>rL(e,"name",{value:t,configurable:!0}),nL=new Set(["t4g","c6g","c6gd","c6gn","c7g","c7gd","c7gn","r6g","r6gd","r7g","r7gd","m6g","m6gd","m7g","m7gd","a1","x2gd","im4gn","is4gen","i4g","hpc7g"]);function Ri(e){let t=e.split(".")[0]??"";return nL.has(t)?"ARM":"STANDARD"}wv(Ri,"getArchitectureForInstanceType");function Zu(e,t){let n=Ri(e);return n!==t?{valid:!1,message:`Instance type '${e}' requires ${n} architecture, but '${t}' AMI was specified. Use a ${n==="ARM"?"Graviton instance (t4g, c6g, r6g, m6g, etc.)":"Intel/AMD instance (t3, c5, r5, m5, etc.)"} instead.`}:{valid:!0}}wv(Zu,"validateArchitectureMatch");function E$(e,t){return Ri(e)===t}wv(E$,"isArchitectureCompatible");var iL=Object.defineProperty,Gu=(e,t)=>iL(e,"name",{value:t,configurable:!0});var oL=1,aL=/^[A-Za-z0-9_.-]+$/,sL=s.object({id:s.string().min(1,"buildSecret id cannot be empty").regex(aL,"buildSecret id may contain only letters, digits, '_', '.', and '-' (no comma, '=', or whitespace, which would break the buildx --secret argv)"),ssm:s.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:s.object({name:s.string().min(1,"secret name cannot be empty").optional(),arn:s.string().min(1,"secret arn cannot be empty").optional(),field:s.string().min(1,"secret field cannot be empty").optional()}).strict().refine(e=>e.name===void 0!=(e.arn===void 0),"secretsManager requires exactly one of name or arn").optional(),env:s.string().min(1,"env variable name cannot be empty").optional()}).strict().superRefine((e,t)=>{[e.ssm,e.secretsManager,e.env].filter(n=>n!==void 0).length!==1&&t.addIssue({code:s.ZodIssueCode.custom,message:"buildSecret requires exactly one source (ssm, secretsManager, or env)"})}),cL=s.union([s.string(),s.object({ssm:s.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:s.object({name:s.string().min(1,"secret name cannot be empty").optional(),arn:s.string().min(1,"secret arn cannot be empty").optional(),field:s.string().min(1,"secret field cannot be empty").optional()}).strict().refine(e=>e.name===void 0!=(e.arn===void 0),"secretsManager requires exactly one of name or arn").optional(),env:s.string().min(1,"env variable name cannot be empty").optional(),acknowledgePublic:s.boolean().optional()}).strict().superRefine((e,t)=>{[e.ssm,e.secretsManager,e.env].filter(n=>n!==void 0).length!==1&&t.addIssue({code:s.ZodIssueCode.custom,message:"buildArg value requires exactly one source (ssm, secretsManager, or env)"})})]),Ot=s.object({path:s.string(),context:s.string().min(1,"context cannot be empty").optional(),target:s.string().min(1,"target cannot be empty").optional(),buildArgs:s.record(s.string(),cL).optional(),buildSecrets:s.array(sL).optional()}).strict(),nH=Ot.partial();function uL(e,t){if(t===void 0)return e;let n=t.context??e.context,i=t.target??e.target,r=t.buildArgs??e.buildArgs,o=t.buildSecrets??e.buildSecrets;return{path:t.path??e.path,...n!==void 0&&{context:n},...i!==void 0&&{target:i},...r!==void 0&&{buildArgs:r},...o!==void 0&&{buildSecrets:o}}}Gu(uL,"mergeDockerBuild");function kv(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Gu(kv,"isRecord");function x$(e){if(!kv(e)||typeof e.path!="string"||e.path.length===0)return;let t=typeof e.context=="string"&&e.context.length>0?e.context:void 0,n=typeof e.target=="string"&&e.target.length>0?e.target:void 0,i=kv(e.buildArgs)&&Object.keys(e.buildArgs).length>0?e.buildArgs:void 0,r=Array.isArray(e.buildSecrets)&&e.buildSecrets.length>0?e.buildSecrets:void 0,o={path:e.path,...t!==void 0&&{context:t},...n!==void 0&&{target:n},...i!==void 0&&{buildArgs:i},...r!==void 0&&{buildSecrets:r}},a=Ot.safeParse(o);return a.success?a.data:void 0}Gu(x$,"normaliseDockerBuild");function lL(e){if(e===void 0)return;let t=x$(e);return t===void 0?void 0:JSON.stringify(t)}Gu(lL,"dockerBuildFingerprint");var dL=s.object({name:s.string(),clusterName:s.string().optional(),docker:Ot.optional(),containerPort:s.number().optional(),secrets:s.array(s.string()).optional(),ssmSecretsPath:s.string().optional(),importedSecretNames:s.array(s.string()).optional()}).strict(),mL=s.object({type:s.enum(kt),name:s.string(),source:s.string()}).strict(),pL=s.object({repositoryName:s.string()}).strict(),fL=["x86_64","arm64"],gL=s.object({name:s.string(),secrets:s.array(s.string()).optional(),ssmSecretsPath:s.string().optional(),importedSecretNames:s.array(s.string()).optional(),docker:Ot.optional(),imageKey:s.string().optional(),architecture:s.enum(fL).optional()}).strict(),hL=s.object({templateHash:s.string(),synthTimestamp:s.string()}).strict(),vL=s.object({constructPath:s.string().max(512),group:s.string().max(128),resourceType:s.string().max(256)}).strict(),iH=s.object({version:s.literal(oL),generatedAt:s.string(),appName:s.string(),services:s.array(dL),lambdas:s.array(gL),pattern:mL.optional(),ecr:pL.optional(),stacks:s.record(s.string(),hL),resourceMap:s.record(s.string(),vL).optional()}).strict();var bL=Object.defineProperty,yL=(e,t)=>bL(e,"name",{value:t,configurable:!0});function I$(e){return!(e.image!==void 0&&e.docker!==void 0)}yL(I$,"imageDockerMutexCheck");var $$=s.number().int(d.CAPACITY.MIN.INTEGER).min(Av,d.GENERATOR_CAPACITY.MIN.MIN).max(Iv,d.GENERATOR_CAPACITY.MIN.MAX),T$=s.number().int(d.CAPACITY.MAX.INTEGER).min(Av,d.GENERATOR_CAPACITY.MAX.MIN).max(Iv,d.GENERATOR_CAPACITY.MAX.MAX),Ci=s.number().int(d.LAMBDA.MEMORY.INTEGER).min(UI,d.LAMBDA.MEMORY.MIN).max(FI,d.LAMBDA.MEMORY.MAX).refine(e=>e===128||e%64===0,d.LAMBDA.MEMORY.MULTIPLE),R$=s.string().regex(L.LAMBDA_RUNTIME_IDENTIFIER,d.LAMBDA.RUNTIME),Ov=s.number().int(d.CPU.INTEGER).min(256,d.CPU.MIN).max(4096,d.CPU.MAX),Hu=s.number().int(d.CAPACITY.DESIRED.INTEGER).min(0,d.CAPACITY.DESIRED.MIN).max(Ai,d.CAPACITY.DESIRED.MAX),ma=s.object({connectToDatabase:s.array(s.string()).optional()}).strict(),SL=s.object({minSize:s.number().int(d.CAPACITY.WARM_POOL.MIN_SIZE.INTEGER).min(0,d.CAPACITY.WARM_POOL.MIN_SIZE.MIN).max(BI,d.CAPACITY.WARM_POOL.MIN_SIZE.MAX).optional(),reuseOnScaleIn:s.boolean().optional()}).strict(),Dv=s.object({instanceType:s.string().optional(),amiHardwareType:s.enum(Cu).optional(),minCapacity:s.number().int(d.CAPACITY.MIN.INTEGER).min(0,d.CAPACITY.MIN.MIN_0).max(Ai,d.CAPACITY.MIN.MAX).optional(),maxCapacity:s.number().int(d.CAPACITY.MAX.INTEGER).min(1,d.CAPACITY.MAX.MIN_1).max(Ai,d.CAPACITY.MAX.MAX).optional(),memoryLimitMiB:sa(128).optional(),warmPool:SL.optional(),extraProperties:s.array(Re).optional()}).strict().superRefine((e,t)=>{if(!e.instanceType||!e.amiHardwareType)return;let n=Zu(e.instanceType,e.amiHardwareType);n.valid||t.addIssue({code:"custom",message:n.message??d.ARCHITECTURE_MISMATCH,path:["instanceType"]})}).superRefine((e,t)=>{e.minCapacity===0&&!e.warmPool&&t.addIssue({code:"custom",message:d.CAPACITY.WARM_POOL_REQUIRED,path:["minCapacity"]}),e.warmPool?.minSize!==void 0&&e.maxCapacity!==void 0&&e.warmPool.minSize>e.maxCapacity&&t.addIssue({code:"custom",message:d.CAPACITY.WARM_POOL.MIN_SIZE_EXCEEDS_MAX_CAPACITY,path:["warmPool","minSize"]})}),_L=s.enum(na).describe(`Compute type must be one of: ${na.join(", ")}`),Mv=s.enum(_i).describe(`ECS capacity provider must be one of: ${_i.join(", ")}`),jv=s.string().refine(e=>ct(Pu,e),{message:d.INSTANCE_TYPE}),C$=s.object({sourceType:s.enum(["sqs","dynamodb","eventbridge"]),sourceRef:s.string().describe("Name of the source resource"),batchSize:s.number().int(d.BATCH_SIZE.INTEGER).min(1,d.BATCH_SIZE.MIN).max(1e4,d.BATCH_SIZE.MAX).optional(),startingPosition:s.enum(["TRIM_HORIZON","LATEST"]).optional(),maxBatchingWindow:s.number().int(d.BATCHING_WINDOW.INTEGER).min(0,d.BATCHING_WINDOW.MIN).max(300,d.BATCHING_WINDOW.MAX).optional(),reportBatchItemFailures:s.boolean().optional()}).strict(),EL=s.object({name:s.string().min(1,d.REQUIRED.CONTAINER_NAME).optional(),image:s.string().optional(),port:cn.optional(),environment:$i.optional(),secretsImport:KI.optional(),command:s.array(s.string()).optional(),entryPoint:s.array(s.string()).optional(),essential:s.boolean().optional(),healthCheck:s.object({command:s.array(s.string()),interval:s.number().int(d.HEALTH_CHECK.INTERVAL.INTEGER).min(5,d.HEALTH_CHECK.INTERVAL.MIN).max(300,d.HEALTH_CHECK.INTERVAL.MAX).optional(),timeout:s.number().int(d.HEALTH_CHECK.TIMEOUT.INTEGER).min(2,d.HEALTH_CHECK.TIMEOUT.MIN).max(60,d.HEALTH_CHECK.TIMEOUT.MAX).optional(),retries:s.number().int(d.HEALTH_CHECK.RETRIES.INTEGER).min(1,d.HEALTH_CHECK.RETRIES.MIN).max(10,d.HEALTH_CHECK.RETRIES.MAX).optional(),startPeriod:s.number().int(d.HEALTH_CHECK.START_PERIOD.INTEGER).min(0,d.HEALTH_CHECK.START_PERIOD.MIN).max(300,d.HEALTH_CHECK.START_PERIOD.MAX).optional()}).strict().optional(),ssmSecrets:s.array(s.string().regex(L.SECRET_NAME,d.SECRET_NAME)).optional(),extraProperties:s.array(Re).optional()}).strict(),P$=s.string().min(1,d.REQUIRED.SERVICE_NAME).max(255,d.MAX_LENGTH.SERVICE_NAME).regex(L.ECS_SERVICE_NAME,d.ECS_SERVICE_NAME),N$=s.object({domain:s.string().optional(),loadBalancer:s.union([s.literal(!1),s.enum(Tu)]).optional(),directAccess:s.boolean().optional(),extraProperties:s.array(Re).optional()}).strict().refine(e=>!(e.directAccess&&e.domain),{message:d.DIRECT_ACCESS.NO_DOMAIN,path:["directAccess"]}).refine(e=>!(e.directAccess&&typeof e.loadBalancer=="string"),{message:d.DIRECT_ACCESS.NO_LOAD_BALANCER}).describe("Cluster-level configuration"),Wu=s.object({path:s.string().optional(),host:s.string().optional(),priority:s.number().int(d.PRIORITY.INTEGER).min(1,d.PRIORITY.MIN).max(5e4,d.PRIORITY.MAX).optional(),healthCheckPath:s.string().optional()}).strict().describe("Path/host-based routing configuration"),xL=s.object({desiredCount:Hu.optional(),minCapacity:s.number().int(d.CAPACITY.MIN.INTEGER).min(0,d.CAPACITY.MIN.MIN_0).max(Ai,d.CAPACITY.MIN.MAX).optional(),maxCapacity:s.number().int(d.CAPACITY.MAX.INTEGER).min(1,d.CAPACITY.MAX.MIN_1).max(Ai,d.CAPACITY.MAX.MAX).optional(),scalingType:s.enum(Ru).optional()}).strict().refine(sn.check,sn.params).describe("ECS service scaling configuration"),w$=s.object({name:P$,docker:Ot.optional(),needsDatabaseConnection:s.boolean().optional(),needsStorageConnection:s.boolean().optional(),needsMessagingConnection:s.boolean().optional(),image:s.string().optional(),containers:s.array(EL).optional(),routing:s.union([Wu,s.array(Wu).min(1)]).optional(),cpu:Ov.optional(),memoryLimitMiB:sa(512).optional(),desiredCount:Hu.optional(),scaling:He(xL).optional(),capacityProvider:Mv,ec2Config:Dv.optional(),ssmSecretsPath:s.string().regex(L.SSM_PATH,d.SSM_PATH).optional(),extraProperties:s.array(Re).optional(),alarms:QI.optional()}).strict().superRefine((e,t)=>{I$(e)||t.addIssue({code:"custom",path:["docker"],message:d.IMAGE_DOCKER_MUTEX})}).describe("Configuration for a service in an ECS cluster"),k$=s.object({name:V,type:_L,needsConnection:s.boolean(),connectedDatabase:s.array(s.string()).optional(),connectedStorage:s.array(s.string()).optional(),connectedMessaging:s.array(s.string()).optional(),cluster:N$.optional(),services:s.array(w$).optional(),docker:Ot.partial().optional(),deployment:s.enum(Iu).optional(),codePath:s.string().optional(),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(Nu,d.LAMBDA.TIMEOUT.MIN).max(wu,d.LAMBDA.TIMEOUT.MAX).optional(),memory:Ci.optional(),handler:s.string().optional(),runtime:R$.optional(),environment:$i.optional(),secrets:$i.optional(),eventSources:s.array(C$).optional(),functionUrl:s.object({authType:s.enum(oa)}).strict().optional(),description:s.string().optional(),scheduleExpression:s.string().optional(),architecture:s.enum($u).optional(),ephemeralStorageSize:s.number().int(d.EPHEMERAL_STORAGE.INTEGER).min(512,d.EPHEMERAL_STORAGE.MIN).max(10240,d.EPHEMERAL_STORAGE.MAX).optional(),functionName:s.string().optional(),ssmSecrets:s.array(s.string()).optional(),ssmSecretsPath:s.string().optional(),alarms:t$.optional(),instanceType:jv.optional(),enableSSH:s.boolean().optional(),keyName:s.string().optional(),userData:s.string().optional(),securityGroups:s.array(s.string()).optional(),variableName:s.string().optional(),extraProperties:s.array(Re).optional()}).strict().superRefine((e,t)=>{if(e.type==="ecs"&&e.services)for(let n=0;n<e.services.length;n++){let i=e.services[n];i?.ec2Config?.instanceType&&!i.ec2Config.amiHardwareType&&Ri(i.ec2Config.instanceType)!=="ARM"&&t.addIssue({code:"custom",message:`Service '${i.name??n}' uses instance type '${i.ec2Config.instanceType}' (x86), which requires Docker images built for linux/amd64. The default build targets linux/arm64 (Graviton). Use a Graviton instance type (t4g, c6g, r6g, m6g, etc.) or set amiHardwareType: "STANDARD" to acknowledge x86.`,path:["services",n,"ec2Config","instanceType"]})}e.type==="lambda"&&e.deployment==="container"&&e.architecture==="X86_64"&&t.addIssue({code:"custom",message:"Lambda architecture 'X86_64' requires Docker images built for linux/amd64, but the default build targets linux/arm64. Use 'ARM_64' for Graviton Lambdas (recommended) or ensure your build pipeline targets linux/amd64.",path:["architecture"]})}),pH=s.object({appName:ve,clusterName:V,containerPort:cn,nameProvidedByFlag:s.boolean().optional(),ecrRepository:s.string().optional(),capacityProvider:Mv.optional(),useAppEcr:s.boolean().optional(),desiredCount:Hu.optional(),cpu:Ov.optional(),memoryLimitMiB:sa(512).optional(),minCapacity:$$.optional(),maxCapacity:T$.optional(),ec2Config:Dv.optional(),connectionConfig:ma.optional()}).strict().refine(sn.check,sn.params),fH=s.object({appName:ve,functionName:V,nameProvidedByFlag:s.boolean().optional(),lambdaType:s.enum(["basic","web","custom"]).optional(),ecrRepository:s.string().optional(),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(Nu,d.LAMBDA.TIMEOUT.MIN).max(wu,d.LAMBDA.TIMEOUT.MAX).optional(),memory:Ci.optional(),enableFunctionUrl:s.boolean().optional(),description:s.string().optional(),enableCors:s.boolean().optional(),corsOrigins:s.string().optional(),corsHeaders:s.string().optional(),corsMethods:s.array(s.enum(ZI)).optional(),corsCredentials:s.boolean().optional(),connectionConfig:ma.optional()}).strict(),gH=s.object({appName:ve,instanceName:V,nameProvidedByFlag:s.boolean().optional(),instanceType:jv.optional(),enableSSH:s.boolean().optional(),minCapacity:$$.optional(),maxCapacity:T$.optional(),connectionConfig:ma.optional()}).strict().refine(sn.check,sn.params),hH=s.object({appName:ve,clusterName:V,serviceName:P$,capacityProvider:Mv,containerPort:cn.optional(),cpu:Ov.optional(),memoryLimitMiB:sa(512).optional(),desiredCount:Hu.optional(),ec2Config:Dv.optional(),routing:s.union([Wu,s.array(Wu).min(1)]).optional(),docker:Ot.partial().optional(),nameProvidedByFlag:s.boolean().optional(),connectionConfig:ma.optional()}).strict(),zv=s.object({appName:ve,computeName:V,nameProvidedByFlag:s.boolean().optional(),connectionConfig:ma.optional()}).strict(),AL=zv.extend({type:s.literal("ecs"),cluster:N$.optional(),services:s.array(w$).min(1,d.SERVICE.MIN_REQUIRED),docker:Ot.partial().optional()}).strict().refine(e=>{let t=e.services.filter(n=>n.containers?.some(i=>i.port));return t.length>1?t.every(n=>(Array.isArray(n.routing)?n.routing:n.routing?[n.routing]:[]).some(i=>i.path||i.host)):!0},{message:d.SERVICE.ROUTING_REQUIRED}).refine(e=>{let t=e.services.map(n=>n.name);return new Set(t).size===t.length},{message:d.SERVICE.UNIQUE_WITHIN_CLUSTER}),IL=zv.extend({type:s.literal("lambda"),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(Nu,d.LAMBDA.TIMEOUT.MIN).max(wu,d.LAMBDA.TIMEOUT.MAX).optional(),memory:Ci.optional(),handler:s.string().optional(),runtime:R$.optional(),environment:$i.optional(),secrets:$i.optional(),description:s.string().optional(),functionUrl:s.union([s.object({authType:s.enum(oa).optional()}).strict(),s.literal(!1)]).optional(),eventSources:s.array(C$).optional()}).strict(),$L=zv.extend({type:s.literal("ec2"),instanceType:jv.optional(),enableSSH:s.boolean().optional(),keyName:s.string().optional(),userData:s.string().optional(),securityGroups:s.array(s.string()).optional()}).strict(),vH=s.discriminatedUnion("type",[AL,IL,$L]),A$=s.object({path:s.string().min(1,d.REQUIRED.ROUTING_PATH),priority:s.number().int(d.PRIORITY.INTEGER).min(1,d.PRIORITY.MIN).max(5e4,d.PRIORITY.MAX).optional()}).strict(),O$=s.object({name:s.string().min(1,d.REQUIRED.SERVICE_NAME).max(255,d.MAX_LENGTH.SERVICE_NAME).regex(L.RESOURCE_NAME,d.RESOURCE_NAME),serviceType:s.enum(["web","worker"]).optional(),docker:Ot.partial().optional(),containerPort:cn.optional(),needsDatabaseConnection:s.boolean().optional(),routing:s.union([A$,s.array(A$).min(1)]).optional()}).strict().superRefine((e,t)=>{e.serviceType==="worker"&&(e.containerPort!==void 0&&t.addIssue({code:"custom",path:["containerPort"],message:"Worker services are not reachable inbound; remove containerPort."}),e.routing!==void 0&&t.addIssue({code:"custom",path:["routing"],message:"Worker services have no ALB route; remove routing."}))}),bH=s.object({appName:ve,instanceType:s.string().optional()}).strict();var Lv=s.object({memorySize:Ci.optional(),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(1,d.LAMBDA.TIMEOUT.MIN).max(900,d.LAMBDA.TIMEOUT.MAX).optional(),ephemeralStorageSize:s.number().int(d.EPHEMERAL_STORAGE.INTEGER).min(512,d.EPHEMERAL_STORAGE.MIN).max(10240,d.EPHEMERAL_STORAGE.MAX).optional()}).strict(),D$=s.object({type:s.enum(xv).optional(),databaseName:s.string().optional(),databaseEngine:s.enum(xi).optional(),deletionProtection:s.boolean().optional(),backupRetention:Qt.optional(),port:Du.optional(),publiclyAccessible:s.boolean().optional(),allowedIpCidr:s.string().optional(),instanceType:s.string().optional(),allocatedStorage:s.number().int(d.ALLOCATED_STORAGE.INTEGER).min(20,d.ALLOCATED_STORAGE.MIN).max(65536,d.ALLOCATED_STORAGE.MAX).optional(),multiAz:s.boolean().optional(),readReplica:zu.optional(),writer:la.optional(),readers:da.optional(),allowVpcAccess:s.boolean().optional(),monitoringInterval:ua.optional(),preferredMaintenanceWindow:s.string().optional(),databaseInsights:Lu.optional(),proxy:ju.optional(),credentials:Mu.optional(),encryption:Uu.optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional()}).strict(),M$=s.object({server:Lv.optional(),imageOptimisation:Lv.optional(),revalidation:Lv.optional()}).strict(),Uv=s.object({versioned:s.boolean().optional()}).strict(),j$=s.object({assets:Uv.optional(),cache:Uv.optional(),media:Uv.optional()}).strict(),TL=s.object({visibilityTimeout:s.number().int(d.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,d.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,d.SQS.VISIBILITY_TIMEOUT.MAX).optional(),messageRetentionPeriod:s.number().int(d.SQS.RETENTION_PERIOD.INTEGER).min(60,d.SQS.RETENTION_PERIOD.MIN).max(1209600,d.SQS.RETENTION_PERIOD.MAX).optional(),maxMessageSize:s.number().int(d.MAX_MESSAGE_SIZE.INTEGER).min(1024,d.MAX_MESSAGE_SIZE.MIN).max(262144,d.MAX_MESSAGE_SIZE.MAX).optional(),deadLetterQueue:s.union([s.literal(!1),s.object({enabled:s.boolean().optional(),maxReceiveCount:s.number().int(d.DLQ.MAX_RECEIVE_COUNT.INTEGER).min(1,d.DLQ.MAX_RECEIVE_COUNT.MIN).max(1e3,d.DLQ.MAX_RECEIVE_COUNT.MAX).optional()}).strict()]).optional()}).strict(),z$=s.object({revalidationQueue:TL.optional()}).strict(),L$=s.object({domainNames:s.array(s.string()).optional(),certificateArn:s.string().optional()}).strict(),U$=s.record(s.string().regex(L.ENV_VAR_NAME,d.ENV_VAR_NAME),s.string()).optional(),RL=s.object({type:s.literal("payload"),name:s.string().min(1,d.REQUIRED.PATTERN_NAME),domain:s.string().optional(),database:D$.optional(),compute:M$.optional(),storage:j$.optional(),messaging:z$.optional(),cdn:L$.optional(),environment:U$}).strict(),CL=s.object({type:s.literal("nextjs"),name:s.string().min(1,d.REQUIRED.PATTERN_NAME),domain:s.string().optional(),database:D$.optional(),compute:M$.optional(),storage:j$.optional(),messaging:z$.optional(),cdn:L$.optional(),environment:U$}).strict(),Fv=s.enum(Zo),PL=s.object({command:s.string().min(1,d.REQUIRED.BUILD_COMMAND),outputDir:s.string().min(1,d.REQUIRED.OUTPUT_DIR)}).strict(),NL=s.object({headers:s.boolean().optional(),contentSecurityPolicy:s.string().optional()}).strict(),wL=s.object({to:s.string().min(1,d.REQUIRED.FORMS_TO).regex(L.EMAIL,d.EMAIL),from:s.string().regex(L.EMAIL,d.EMAIL).optional(),corsOrigin:s.string().regex(L.HTTP_ORIGIN,"corsOrigin must be an exact origin such as https://example.com (no path, no trailing slash)").optional(),maxConcurrency:s.number().int().min(1).max(100).optional()}).strict(),kL=s.object({behaviours:s.array(s.unknown()).optional()}).strict(),Bv=s.object({type:s.literal("staticsite"),name:s.string().min(1,d.REQUIRED.PATTERN_NAME),source:s.string().min(1,d.REQUIRED.SOURCE),build:PL,routing:Fv.optional(),security:NL.optional(),domain:s.string().optional(),forms:wL.optional(),cdn:kL.optional()}).strict().superRefine((e,t)=>{if(e.forms===void 0)return;let n=e.domain;if(n===void 0||n===""){t.addIssue({code:"custom",path:["domain"],message:"A domain is required when forms are enabled: SES sends only from a verified identity, and the site's domain is the identity the pattern verifies"});return}let i=e.forms.from;i!==void 0&&!eu(i,n)&&t.addIssue({code:"custom",path:["forms","from"],message:`forms.from must be an address at ${n} (the verified SES identity) \u2014 for example noreply@${n}. Use forms.to for the recipient.`})}),pa=s.discriminatedUnion("type",[RL,CL,Bv]),F$=s.enum(["lightweight","standard","resilient","custom"]),B$=s.object({type:s.enum(xv),instanceType:s.string().optional(),backupRetention:Qt.optional(),deletionProtection:s.boolean().optional(),encryption:s.union([s.object({useCMK:s.literal(!0)}).strict(),s.literal(!1)]).optional()}).strict(),V$=s.object({memorySize:Ci.optional(),timeout:s.number().int(d.LAMBDA.TIMEOUT.INTEGER).min(1,d.LAMBDA.TIMEOUT.MIN).max(900,d.LAMBDA.TIMEOUT.MAX).optional()}).strict();var Z$=s.object({appName:ve,type:$v,pattern:Tv.optional(),patternConfig:pa.optional(),owner:s.string().optional(),tags:s.record(s.string(),s.string()).optional(),vpcId:s.string().optional(),network:Bu.optional(),backup:XI.optional(),tunnel:JI.optional(),additionalNetworks:s.array(g$).optional(),database:s.array(n$),s3:s.array(v$),compute:s.array(k$),dynamodb:s.array(u$).optional(),clickhouse:s.array(l$).optional(),sqs:s.array(y$).optional(),cdn:_$.optional(),customCodeBlocks:s.array(YI).optional(),additionalManagedImports:s.array(s.object({moduleSpecifier:s.string(),namedImports:s.array(s.string()),defaultImport:s.string().optional()}).strict()).optional()}).strict(),zH=s.object({name:ve,type:$v,pattern:Tv.optional(),patternTier:F$.optional(),patternDomain:s.string().optional(),source:s.string().min(1,d.REQUIRED.SOURCE).optional(),buildCommand:s.string().min(1,d.REQUIRED.BUILD_COMMAND).optional(),outputDir:s.string().min(1,d.REQUIRED.OUTPUT_DIR).optional(),routing:Fv.optional(),formsTo:s.string().min(1,d.REQUIRED.FORMS_TO).regex(L.EMAIL,d.EMAIL).optional(),corsOrigin:s.string().regex(L.HTTP_ORIGIN,"corsOrigin must be an exact origin such as https://example.com (no path, no trailing slash)").optional(),customDatabase:B$.optional(),customCompute:V$.optional(),region:s.string().optional(),owner:s.string().optional(),includeDatabase:s.boolean().optional(),databaseName:s.string().min(1,d.DATABASE.NAME.REQUIRED).max(63,d.DATABASE.NAME.MAX_LENGTH).optional(),vpcId:s.string().optional(),network:h$.optional(),services:s.array(O$).optional(),snapshotIdentifier:s.string().optional(),snapshotUsername:s.string().optional()}).strict().superRefine((e,t)=>{e.formsTo!==void 0&&(e.patternDomain!==void 0&&e.patternDomain!==""||t.addIssue({code:"custom",path:["patternDomain"],message:"A domain is required when forms are enabled: SES sends only from a verified identity, and the site's domain is the identity the pattern verifies"}))}),LH=s.object({name:V,localResource:s.string().min(1),remoteApp:s.string().min(1),remoteResource:s.string().min(1),permission:s.enum(["read","write","read-write"]),remoteArn:s.string().optional()}).strict();var OL=["fjall-managed","external","external-manual"],ZH=s.enum(OL);var G$=s.object({givenName:s.string().min(1),familyName:s.string().min(1),displayName:s.string().min(1).optional(),expires:s.string().min(1).optional()}).strict(),W$=s.object({name:s.string().min(1),path:s.string().min(1).optional()}).strict(),DL=s.union([s.object({managedPolicyArn:s.string().min(1)}).strict(),s.object({customerManagedPolicy:W$}).strict()]),ML=s.object({managedPolicies:s.array(s.string().min(1)).optional(),inlinePolicy:s.record(s.string(),s.unknown()).optional(),customerManagedPolicies:s.array(W$).optional(),permissionsBoundary:DL.optional(),sessionDuration:s.string().min(1).optional(),description:s.string().optional(),accounts:s.union([s.array(s.string().min(1)),s.literal("all")]).optional(),includeManagementAccount:s.boolean().optional(),groups:s.array(s.string().min(1)).optional()}).strict(),jL=s.object({description:s.string().optional()}).strict(),qu=s.string().regex(L.EMAIL,d.EMAIL),Vv={groups:s.record(s.string(),jL).optional(),permissionSets:s.record(s.string(),ML).optional(),memberships:s.record(s.string(),s.array(qu)).optional(),resolutionVersion:s.number().int().min(1).optional(),defaultPermissionSets:s.boolean().optional()},zL=s.discriminatedUnion("source",[s.object({...Vv,source:s.literal("fjall-managed"),users:s.record(qu,G$)}).strict(),s.object({...Vv,source:s.literal("external")}).strict(),s.object({...Vv,source:s.literal("external-manual"),users:s.record(qu,G$).optional()}).strict()]),GH=s.object({name:V,type:s.literal("organisation").optional(),organisationName:s.string().min(1).optional(),orgEmail:qu.optional(),accounts:s.unknown().optional(),accountIds:s.record(s.string(),s.string()).optional(),identityCentre:s.union([zL,s.literal(!1)]).optional(),allowedRegions:s.array(s.string().min(1)).optional()}).strict();var LL=Object.defineProperty,UL=(e,t)=>LL(e,"name",{value:t,configurable:!0}),FL=[1,3,5,7,14,30,60,90,120,150,180,365,400,545,731,1827,3653],BL=s.object({buildkiteQueue:s.string().min(1,"buildkiteQueue cannot be empty").max(100).regex(/^[a-zA-Z0-9-_]+$/,"buildkiteQueue must be alphanumeric with hyphens/underscores"),buildkiteOrgSlug:s.string().min(1,"buildkiteOrgSlug cannot be empty").max(100).regex(/^[a-z0-9-]+$/,"buildkiteOrgSlug must be a lowercase Buildkite organisation slug"),agentTokenSsmParameterName:s.string().min(2).regex(/^\//,"agentTokenSsmParameterName must be a full path (leading /)").optional(),agentTokenKmsKeyArn:s.string().min(1).optional(),fjallApiKeySsmParameterName:s.string().min(2).regex(/^\//,"fjallApiKeySsmParameterName must be a full path (leading /)").optional(),instanceType:s.string().min(1).default("c8g.xlarge"),agentVolumeSizeGib:s.number().int().min(20).max(1e3).default(250),agentMinInstances:s.number().int().min(0).default(0),agentMaxInstances:s.number().int().min(1).default(2),agentsPerInstance:s.number().int().min(1).default(1),spotCapacityPercentage:s.number().int().min(0).max(100).default(0),scaleInIdlePeriodSeconds:s.number().int().min(60).default(600),disconnectAfterUptimeSeconds:s.number().int().min(3600).default(86400),maxInstanceLifetimeDays:s.number().int().min(1).max(365).default(7),terminateInstanceAfterJob:s.boolean().default(!1),purgeBuildsOnDiskFull:s.boolean().default(!0),terminateInstanceOnDiskFull:s.boolean().default(!1),logRetentionDays:s.number().int().min(1).default(30),agentLogRetentionDays:s.literal(FL).default(7),buildkiteAgentRelease:s.enum(["stable","beta","edge"]).default("stable"),buildkiteAgentTags:s.string().default(""),buildkiteAgentTimestampLines:s.boolean().default(!1),buildkiteAgentExperiments:s.string().default(""),buildkiteAgentTracingBackend:s.enum(["","datadog","opentelemetry"]).default(""),buildkiteAgentCancelGracePeriodSeconds:s.number().int().min(10).default(60),enableSecretsPlugin:s.boolean().default(!0),enableEcrPlugin:s.boolean().default(!1),enableDockerLoginPlugin:s.boolean().default(!1),enableDockerUserNamespaceRemap:s.boolean().default(!0),enableDockerExperimental:s.boolean().default(!1),dockerNetworkingProtocol:s.enum(["ipv4","dualstack"]).default("ipv4"),enableInstanceStorage:s.boolean().default(!1),mountTmpfsAtTmp:s.boolean().default(!0),buildkiteAgentEnableGitMirrors:s.boolean().default(!1),bootstrapScriptUrl:s.string().default(""),agentEnvFileUrl:s.string().default(""),scalerEventSchedulePeriod:s.string().min(1).default("1 minute"),scalerMinPollInterval:s.string().min(1).default("10s"),scaleOutFactor:s.string().min(1).default("1.0"),scaleOutWaitingForJobs:s.boolean().default(!1),rolePermissionsBoundaryArn:s.string().min(1).optional(),alarmSnsTopicArn:s.string().min(1).optional(),applicationId:s.string().min(1).optional(),costAllocationEnvironment:s.string().min(1).optional(),costAllocationOwner:s.string().min(1).optional()}).strict(),VL=BL.refine(e=>e.agentMinInstances<=e.agentMaxInstances,{message:"agentMinInstances must be <= agentMaxInstances"});function ZL(e){let t=VL.safeParse(e);if(!t.success){let n=t.error.issues.map(i=>` - ${i.path.join(".")||"(root)"}: ${i.message}`).join(`
|
|
189
189
|
`);throw new Error(`Buildkite: invalid props:
|
|
190
190
|
${n}`)}return t.data}UL(ZL,"validateBuildkiteProps");var GL=Object.defineProperty,WL=(e,t)=>GL(e,"name",{value:t,configurable:!0});function HL(e){return`FjallDeployBoundary${e}`}WL(HL,"deployBoundaryName");var Zv={Sid:"FjallInheritAdministratorAccess",Effect:"Allow",Action:"*",Resource:"*"},H$=[{Sid:"FjallDenyOrgAndAccountEscape",Effect:"Deny",Action:["organizations:LeaveOrganization","account:CloseAccount"],Resource:"*"},{Sid:"FjallDenyDisableAuditLogging",Effect:"Deny",Action:["cloudtrail:StopLogging"],Resource:"*"},{Sid:"FjallDenyBoundarySelfEscape",Effect:"Deny",Action:["iam:DeleteRolePermissionsBoundary"],Resource:"*"},{Sid:"FjallDenyDisableKmsKey",Effect:"Deny",Action:["kms:DisableKey"],Resource:"*"}],q$=[...H$,{Sid:"FjallDenyStandingHumanCredentials",Effect:"Deny",Action:["iam:CreateUser","iam:CreateLoginProfile","iam:CreateAccessKey","iam:CreateAccountAlias"],Resource:"*"},{Sid:"FjallDenyDisableConfigRecorder",Effect:"Deny",Action:["config:StopConfigurationRecorder"],Resource:"*"}],qL=[...q$,{Sid:"FjallDenyAccountPasswordPolicyTamper",Effect:"Deny",Action:["iam:UpdateAccountPasswordPolicy","iam:DeleteAccountPasswordPolicy"],Resource:"*"},{Sid:"FjallDenyDisableDefaultEbsEncryption",Effect:"Deny",Action:["ec2:DisableEbsEncryptionByDefault"],Resource:"*"}],sq={foundation:[Zv,...H$],compliance:[Zv,...q$],hardened:[Zv,...qL]};var KL=Object.defineProperty,ze=(e,t)=>KL(e,"name",{value:t,configurable:!0});var Gv="sts.amazonaws.com";function YL(e){return`FjallDevDeploy${e}`}ze(YL,"devDeployRoleName");function XL(e){return`FjallDevProvisioner${e}`}ze(XL,"devProvisionerRoleName");function JL(e){return`FjallDevSyncWriter${e}`}ze(JL,"devSyncWriterRoleName");var QL="FjallDevBoundary";function K$(e){return`arn:aws:iam::${e}:policy/${QL}`}ze(K$,"devBoundaryPolicyArn");function Y$(e){return`org:${e}:dev-provisioner`}ze(Y$,"devProvisionerSubject");function X$(e){return`org:${e}:dev-sync`}ze(X$,"devSyncSubject");function eU(e){let{fjallOrgId:t,providerArn:n,issuerDomain:i}=e,r={[`${i}:aud`]:Gv};return[{Sid:"FjallMachineSubject",Effect:"Allow",Principal:{Federated:n},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{...r,[`${i}:sub`]:`org:${t}:*`}}},{Sid:"FjallUserSubjects",Effect:"Allow",Principal:{Federated:n},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:r,StringLike:{[`${i}:sub`]:`org:${t}:user:*`}}},{Sid:"FjallServiceSubjects",Effect:"Allow",Principal:{Federated:n},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{...r,[`${i}:sub`]:[`org:${t}:discovery`,`org:${t}:connection`,`org:${t}:org-setup`,`org:${t}:dev-substrate-setup`]}}}]}ze(eU,"buildNarrowedDeployTrustStatements");function tU(e){let{fjallOrgId:t,providerArn:n,issuerDomain:i,accountId:r}=e;return[{Sid:"FjallDevSubjectsThisAccount",Effect:"Allow",Principal:{Federated:n},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{[`${i}:aud`]:Gv},StringLike:{[`${i}:sub`]:`org:${t}:dev:${r}:*`}}}]}ze(tU,"buildDevDeployTrustStatements");function Wv(e){let{providerArn:t,issuerDomain:n,sid:i,subject:r}=e;return[{Sid:i,Effect:"Allow",Principal:{Federated:t},Action:"sts:AssumeRoleWithWebIdentity",Condition:{StringEquals:{[`${n}:aud`]:Gv,[`${n}:sub`]:r}}}]}ze(Wv,"buildServiceSubjectTrustStatements");function rU(e){return Wv({...e,sid:"FjallDevProvisionerSubject",subject:Y$(e.fjallOrgId)})}ze(rU,"buildDevProvisionerTrustStatements");function nU(e){return Wv({...e,sid:"FjallDevSyncSubject",subject:X$(e.fjallOrgId)})}ze(nU,"buildDevSyncWriterTrustStatements");function iU({accountId:e}){return[{Sid:"FjallDevEcsTaggedMutations",Effect:"Allow",Action:["ecs:UpdateService","ecs:DeleteService","ecs:RunTask","ecs:StopTask"],Resource:`arn:aws:ecs:*:${e}:*`,Condition:{StringEquals:{"aws:ResourceTag/fjall:dev":"true"}}},{Sid:"FjallDevEcsTaggedCreates",Effect:"Allow",Action:["ecs:RegisterTaskDefinition","ecs:CreateService"],Resource:"*",Condition:{StringEquals:{"aws:RequestTag/fjall:dev":"true"}}},{Sid:"FjallDevEcsTagOnCreate",Effect:"Allow",Action:["ecs:TagResource"],Resource:`arn:aws:ecs:*:${e}:*`,Condition:{StringEquals:{"ecs:CreateAction":["RegisterTaskDefinition","CreateService","RunTask"]}}},{Sid:"FjallDevEcsReads",Effect:"Allow",Action:["ecs:Describe*","ecs:List*"],Resource:"*"},{Sid:"FjallDevEcsDeregisterTaskDefinition",Effect:"Allow",Action:["ecs:DeregisterTaskDefinition"],Resource:`arn:aws:ecs:*:${e}:task-definition/fjall-dev-*`},{Sid:"FjallDevElbTaggedMutations",Effect:"Allow",Action:["elasticloadbalancing:ModifyRule","elasticloadbalancing:DeleteRule","elasticloadbalancing:ModifyTargetGroup","elasticloadbalancing:ModifyTargetGroupAttributes","elasticloadbalancing:DeleteTargetGroup","elasticloadbalancing:RegisterTargets","elasticloadbalancing:DeregisterTargets"],Resource:`arn:aws:elasticloadbalancing:*:${e}:*`,Condition:{StringEquals:{"aws:ResourceTag/fjall:dev":"true"}}},{Sid:"FjallDevElbTaggedCreates",Effect:"Allow",Action:["elasticloadbalancing:CreateTargetGroup","elasticloadbalancing:CreateRule"],Resource:`arn:aws:elasticloadbalancing:*:${e}:*`,Condition:{StringEquals:{"aws:RequestTag/fjall:dev":"true"}}},{Sid:"FjallDevElbTagOnCreate",Effect:"Allow",Action:["elasticloadbalancing:AddTags"],Resource:`arn:aws:elasticloadbalancing:*:${e}:*`,Condition:{StringEquals:{"elasticloadbalancing:CreateAction":["CreateTargetGroup","CreateRule"]}}},{Sid:"FjallDevElbReads",Effect:"Allow",Action:["elasticloadbalancing:Describe*"],Resource:"*"},{Sid:"FjallDevSsmDevTree",Effect:"Allow",Action:["ssm:GetParameter*","ssm:PutParameter","ssm:AddTagsToResource"],Resource:`arn:aws:ssm:*:${e}:parameter/fjall/dev/*`},{Sid:"FjallDevLogsMutations",Effect:"Allow",Action:["logs:PutRetentionPolicy","logs:DeleteLogGroup"],Resource:`arn:aws:logs:*:${e}:log-group:/fjall/dev/*`},{Sid:"FjallDevLogsTaggedCreate",Effect:"Allow",Action:["logs:CreateLogGroup","logs:TagResource"],Resource:`arn:aws:logs:*:${e}:log-group:/fjall/dev/*`,Condition:{StringEquals:{"aws:RequestTag/fjall:dev":"true"}}},{Sid:"FjallDevLogsRead",Effect:"Allow",Action:["logs:GetLogEvents","logs:DescribeLogStreams","logs:FilterLogEvents"],Resource:`arn:aws:logs:*:${e}:log-group:/fjall/dev/*`},{Sid:"FjallDevLogsDescribeGroups",Effect:"Allow",Action:["logs:DescribeLogGroups"],Resource:"*"},{Sid:"FjallDevKmsViaDevAlias",Effect:"Allow",Action:["kms:Encrypt","kms:Decrypt","kms:GenerateDataKey"],Resource:`arn:aws:kms:*:${e}:key/*`,Condition:{"ForAnyValue:StringLike":{"kms:ResourceAliases":"alias/fjall-dev-*"}}},{Sid:"FjallDevKmsSsmSecureString",Effect:"Allow",Action:["kms:Encrypt","kms:Decrypt","kms:GenerateDataKey"],Resource:`arn:aws:kms:*:${e}:key/*`,Condition:{StringLike:{"kms:ViaService":"ssm.*.amazonaws.com"}}},{Sid:"FjallDevEcrAuthToken",Effect:"Allow",Action:["ecr:GetAuthorizationToken"],Resource:"*"},{Sid:"FjallDevEcrPushPull",Effect:"Allow",Action:["ecr:PutImage","ecr:InitiateLayerUpload","ecr:UploadLayerPart","ecr:CompleteLayerUpload","ecr:BatchCheckLayerAvailability","ecr:BatchGetImage","ecr:GetDownloadUrlForLayer","ecr:DescribeImages"],Resource:`arn:aws:ecr:*:${e}:repository/*`},{Sid:"FjallDevPassDevPathRoles",Effect:"Allow",Action:["iam:PassRole"],Resource:`arn:aws:iam::${e}:role/fjall/dev/*`}]}ze(iU,"buildDevDeployPolicyStatements");function oU({accountId:e}){return[{Sid:"FjallDevProvisionerBoundedRoleWrites",Effect:"Allow",Action:["iam:CreateRole","iam:PutRolePolicy","iam:AttachRolePolicy"],Resource:`arn:aws:iam::${e}:role/fjall/dev/*`,Condition:{StringEquals:{"iam:PermissionsBoundary":K$(e)}}},{Sid:"FjallDevProvisionerPathRoleOps",Effect:"Allow",Action:["iam:DeleteRole","iam:DeleteRolePolicy","iam:DetachRolePolicy","iam:ListRolePolicies","iam:TagRole"],Resource:`arn:aws:iam::${e}:role/fjall/dev/*`},{Sid:"FjallDevProvisionerListRoles",Effect:"Allow",Action:["iam:ListRoles"],Resource:"*"},{Sid:"FjallDevProvisionerDevMasterSecrets",Effect:"Allow",Action:["secretsmanager:GetSecretValue"],Resource:`arn:aws:secretsmanager:*:${e}:secret:fjall-dev-*`},{Sid:"FjallDevProvisionerKmsDecryptViaSecretsManager",Effect:"Allow",Action:["kms:Decrypt"],Resource:`arn:aws:kms:*:${e}:key/*`,Condition:{StringLike:{"kms:ViaService":"secretsmanager.*.amazonaws.com"}}},{Sid:"FjallDevProvisionerDataApi",Effect:"Allow",Action:["rds-data:ExecuteStatement","rds-data:BatchExecuteStatement","rds-data:BeginTransaction","rds-data:CommitTransaction","rds-data:RollbackTransaction"],Resource:`arn:aws:rds:*:${e}:cluster:fjall-dev-*`},{Sid:"FjallDevProvisionerMetrics",Effect:"Allow",Action:["cloudwatch:GetMetricData"],Resource:"*"},{Sid:"FjallDevProvisionerOrphanDiscovery",Effect:"Allow",Action:["tag:GetResources"],Resource:"*"},{Sid:"FjallDevProvisionerSsmTeardown",Effect:"Allow",Action:["ssm:DeleteParameter*"],Resource:`arn:aws:ssm:*:${e}:parameter/fjall/dev/*`},{Sid:"FjallDevProvisionerLogsTeardown",Effect:"Allow",Action:["logs:DeleteLogGroup"],Resource:`arn:aws:logs:*:${e}:log-group:/fjall/dev/*`},{Sid:"FjallDevProvisionerTaggedTeardown",Effect:"Allow",Action:["ecs:UpdateService","ecs:StopTask","ecs:DeleteService","elasticloadbalancing:DeleteRule","elasticloadbalancing:DeleteTargetGroup","elasticloadbalancing:DeregisterTargets"],Resource:[`arn:aws:ecs:*:${e}:*`,`arn:aws:elasticloadbalancing:*:${e}:*`],Condition:{StringEquals:{"aws:ResourceTag/fjall:dev":"true"}}},{Sid:"FjallDevProvisionerTeardownReads",Effect:"Allow",Action:["ecs:Describe*","elasticloadbalancing:Describe*"],Resource:"*"},{Sid:"FjallDevProvisionerImageJanitor",Effect:"Allow",Action:["ecr:ListImages","ecr:DescribeImages","ecr:BatchDeleteImage"],Resource:`arn:aws:ecr:*:${e}:repository/*`},{Sid:"FjallDevProvisionerSsmReadAll",Effect:"Allow",Action:["ssm:GetParameter*"],Resource:`arn:aws:ssm:*:${e}:parameter/*`},{Sid:"FjallDevProvisionerKmsDecryptViaSsm",Effect:"Allow",Action:["kms:Decrypt"],Resource:`arn:aws:kms:*:${e}:key/*`,Condition:{StringLike:{"kms:ViaService":"ssm.*.amazonaws.com"}}}]}ze(oU,"buildDevProvisionerPolicyStatements");function aU({accountId:e}){return[{Sid:"FjallDevSyncPrefixReadWrite",Effect:"Allow",Action:["s3:GetObject","s3:PutObject"],Resource:`arn:aws:s3:::fjall-dev-sync-${e}-*/*`,Condition:{StringEquals:{"aws:ResourceAccount":e}}}]}ze(aU,"buildDevSyncWriterPolicyStatements");function sU({accountId:e}){return[{Sid:"FjallDevBoundarySsmDevRead",Effect:"Allow",Action:["ssm:GetParameter*"],Resource:`arn:aws:ssm:*:${e}:parameter/fjall/dev/*`},{Sid:"FjallDevBoundaryKmsDecryptDevAlias",Effect:"Allow",Action:["kms:Decrypt"],Resource:`arn:aws:kms:*:${e}:key/*`,Condition:{"ForAnyValue:StringLike":{"kms:ResourceAliases":"alias/fjall-dev-*"}}},{Sid:"FjallDevBoundarySyncPrefixReadWrite",Effect:"Allow",Action:["s3:GetObject","s3:PutObject"],Resource:`arn:aws:s3:::fjall-dev-sync-${e}-*/*`,Condition:{StringEquals:{"aws:ResourceAccount":e}}},{Sid:"FjallDevBoundarySlotLogs",Effect:"Allow",Action:["logs:CreateLogStream","logs:PutLogEvents"],Resource:`arn:aws:logs:*:${e}:log-group:/fjall/dev/*`},{Sid:"FjallDevBoundarySyncQueue",Effect:"Allow",Action:["sqs:ReceiveMessage","sqs:DeleteMessage","sqs:GetQueueUrl"],Resource:`arn:aws:sqs:*:${e}:fjall-dev-sync-${e}-*`}]}ze(sU,"buildDevBoundaryStatements");var cU=Object.defineProperty,Et=(e,t)=>cU(e,"name",{value:t,configurable:!0});function T(e){return JSON.stringify(e)}Et(T,"escapeStringLiteral");function un(e){return e.map(T).join(", ")}Et(un,"formatStringArray");var uU="import:SharedAlarmTopicArn";function ln(e=" "){return`
|