@stacksjs/ts-cloud 0.12.11 → 0.12.12

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.
Files changed (139) hide show
  1. package/dist/bin/{chunk-vsd7670h.js → chunk-0b49jjgr.js} +1 -1
  2. package/dist/bin/chunk-0xnnkeb1.js +1 -0
  3. package/dist/bin/{chunk-hwdfky19.js → chunk-227jmf2b.js} +2 -2
  4. package/dist/bin/chunk-2nyyg44g.js +1 -0
  5. package/dist/bin/{chunk-f42gqn6c.js → chunk-2ztr119n.js} +1 -1
  6. package/dist/bin/chunk-43xj5cny.js +1 -0
  7. package/dist/bin/chunk-5w6y9pmz.js +1 -0
  8. package/dist/bin/{chunk-j2cb8we4.js → chunk-5x4rdx8k.js} +1 -1
  9. package/dist/bin/{chunk-yq9vetf8.js → chunk-6zc6a6t3.js} +127 -100
  10. package/dist/bin/chunk-7aagqqr9.js +1 -0
  11. package/dist/bin/{chunk-5gx38418.js → chunk-85qrgshq.js} +1 -1
  12. package/dist/bin/{chunk-tfmx17he.js → chunk-8zk8msx0.js} +1 -1
  13. package/dist/bin/chunk-9j83q0r4.js +1 -0
  14. package/dist/bin/{chunk-ewxf62t8.js → chunk-9nhqbes6.js} +2 -2
  15. package/dist/bin/chunk-a4js49mx.js +1 -0
  16. package/dist/bin/{chunk-b0xtsv8k.js → chunk-a9e0hvwe.js} +3 -3
  17. package/dist/bin/{chunk-vrc7eemq.js → chunk-a9tgxf2h.js} +1 -1
  18. package/dist/bin/chunk-aahrv359.js +1 -0
  19. package/dist/bin/{chunk-zrgd65r8.js → chunk-bfx23be3.js} +1 -1
  20. package/dist/bin/{chunk-0x8szp53.js → chunk-bpps61am.js} +1 -1
  21. package/dist/bin/{chunk-mhrtx0p1.js → chunk-bzth6d1s.js} +1 -1
  22. package/dist/bin/{chunk-2tsg6e8j.js → chunk-ca3taw2m.js} +1 -1
  23. package/dist/bin/{chunk-da49my09.js → chunk-cgzp0328.js} +1 -1
  24. package/dist/bin/{chunk-akwfvn5k.js → chunk-d2aaef9v.js} +1 -1
  25. package/dist/bin/{chunk-ncrnbcsa.js → chunk-e0z2t4mf.js} +2 -2
  26. package/dist/bin/{chunk-bj4ft4qc.js → chunk-e2dnxp8d.js} +2 -2
  27. package/dist/bin/{chunk-fc6r1ack.js → chunk-empfsmdk.js} +1 -1
  28. package/dist/bin/chunk-er3mww4m.js +1 -0
  29. package/dist/bin/{chunk-qr0xck72.js → chunk-fmp5bv0j.js} +1 -1
  30. package/dist/bin/{chunk-vxbnjz78.js → chunk-g3kp5ddx.js} +1 -1
  31. package/dist/bin/{chunk-qa06sft7.js → chunk-grepda40.js} +1 -1
  32. package/dist/bin/{chunk-3f27aa5r.js → chunk-h6xqtypj.js} +2 -2
  33. package/dist/bin/{chunk-9edyzdm0.js → chunk-hwk9ahms.js} +1 -1
  34. package/dist/bin/{chunk-3g80gjw6.js → chunk-jxd3j00s.js} +2 -2
  35. package/dist/bin/{chunk-5rhvcgzt.js → chunk-k1xw3zbm.js} +2 -2
  36. package/dist/bin/{chunk-re15e6p4.js → chunk-m07s5esk.js} +1 -1
  37. package/dist/bin/{chunk-hv3w2qy1.js → chunk-m9r5jype.js} +2 -2
  38. package/dist/bin/{chunk-84703zpq.js → chunk-n20kbxwb.js} +2 -2
  39. package/dist/bin/{chunk-vwqn3yx6.js → chunk-n2fnav53.js} +2 -2
  40. package/dist/bin/{chunk-nc9pp87y.js → chunk-nv211m42.js} +2 -2
  41. package/dist/bin/chunk-psgjy3z4.js +1 -0
  42. package/dist/bin/chunk-qmnr82da.js +1 -0
  43. package/dist/bin/{chunk-8223r1xn.js → chunk-qqpb82ty.js} +2 -2
  44. package/dist/bin/{chunk-9xbsmz1f.js → chunk-rqc8btkj.js} +1 -1
  45. package/dist/bin/chunk-rs85xvt7.js +1 -0
  46. package/dist/bin/{chunk-dep2n31v.js → chunk-t5ngva49.js} +1 -1
  47. package/dist/bin/{chunk-48eb4z0c.js → chunk-t7rcfwqc.js} +1 -1
  48. package/dist/bin/{chunk-ftcjjf76.js → chunk-tjgy10zm.js} +2 -2
  49. package/dist/bin/chunk-v0beqdna.js +1 -0
  50. package/dist/bin/chunk-vf2s3tba.js +1 -0
  51. package/dist/bin/{chunk-kyr5rasx.js → chunk-vzkfjrx2.js} +5 -5
  52. package/dist/bin/{chunk-2pevjm25.js → chunk-wcem4cqb.js} +2 -2
  53. package/dist/bin/chunk-wsh5ervz.js +1 -0
  54. package/dist/bin/chunk-xenhbdmr.js +1 -0
  55. package/dist/bin/chunk-xrdpxwbf.js +1 -0
  56. package/dist/bin/{chunk-a8t3c4qe.js → chunk-y68m9bx7.js} +1 -1
  57. package/dist/bin/cli.js +83 -83
  58. package/dist/bin/dashboard-server.js +1 -1
  59. package/dist/{chunk-0a4tqwm9.js → chunk-ea7tn8nn.js} +1 -1
  60. package/dist/{chunk-fvpkxznh.js → chunk-t8hzekmk.js} +129 -102
  61. package/dist/deploy/index.js +1 -1
  62. package/dist/drivers/index.js +1 -1
  63. package/dist/drivers/shared/compute-deploy.d.ts +0 -12
  64. package/dist/drivers/shared/rpx-gateway.d.ts +124 -4
  65. package/dist/drivers/ssh/bootstrap.d.ts +13 -3
  66. package/dist/drivers/ssh/config.d.ts +11 -3
  67. package/dist/index.js +1 -1
  68. package/dist/ui/404.html +1 -1
  69. package/dist/ui/accept-invitation.html +1 -1
  70. package/dist/ui/access-denied.html +2 -2
  71. package/dist/ui/account/automation.html +5 -5
  72. package/dist/ui/account/security.html +2 -2
  73. package/dist/ui/applications/compose.html +5 -5
  74. package/dist/ui/applications/new.html +2 -2
  75. package/dist/ui/data/backups.html +6 -6
  76. package/dist/ui/data/services.html +6 -6
  77. package/dist/ui/data/volumes.html +6 -6
  78. package/dist/ui/index.html +6 -6
  79. package/dist/ui/infrastructure/topology.html +6 -6
  80. package/dist/ui/integrations.html +2 -2
  81. package/dist/ui/operations/alerts.html +6 -6
  82. package/dist/ui/operations/configuration.html +6 -6
  83. package/dist/ui/operations/jobs.html +6 -6
  84. package/dist/ui/operations/maintenance.html +5 -5
  85. package/dist/ui/operations/observability.html +6 -6
  86. package/dist/ui/operations/previews.html +6 -6
  87. package/dist/ui/operations/queue.html +6 -6
  88. package/dist/ui/operations/regions.html +5 -5
  89. package/dist/ui/operations/releases.html +6 -6
  90. package/dist/ui/operations/spend.html +6 -6
  91. package/dist/ui/operations/workloads.html +6 -6
  92. package/dist/ui/security.html +2 -2
  93. package/dist/ui/server/actions.html +6 -6
  94. package/dist/ui/server/activity.html +1 -1
  95. package/dist/ui/server/capacity.html +6 -6
  96. package/dist/ui/server/database.html +6 -6
  97. package/dist/ui/server/deployments.html +5 -5
  98. package/dist/ui/server/diagnostics.html +2 -2
  99. package/dist/ui/server/firewall.html +5 -5
  100. package/dist/ui/server/fleet.html +6 -6
  101. package/dist/ui/server/logs.html +6 -6
  102. package/dist/ui/server/metrics.html +5 -5
  103. package/dist/ui/server/security.html +2 -2
  104. package/dist/ui/server/services.html +1 -1
  105. package/dist/ui/server/sites.html +6 -6
  106. package/dist/ui/server/ssh-keys.html +6 -6
  107. package/dist/ui/server/team.html +6 -6
  108. package/dist/ui/server/terminal.html +2 -2
  109. package/dist/ui/serverless/alarms.html +6 -6
  110. package/dist/ui/serverless/assets.html +1 -1
  111. package/dist/ui/serverless/cost.html +2 -2
  112. package/dist/ui/serverless/data.html +6 -6
  113. package/dist/ui/serverless/deployments.html +2 -2
  114. package/dist/ui/serverless/firewall.html +2 -2
  115. package/dist/ui/serverless/functions.html +6 -6
  116. package/dist/ui/serverless/logs.html +6 -6
  117. package/dist/ui/serverless/metrics.html +2 -2
  118. package/dist/ui/serverless/queues.html +6 -6
  119. package/dist/ui/serverless/secrets.html +6 -6
  120. package/dist/ui/serverless/traces.html +6 -6
  121. package/dist/ui/serverless.html +6 -6
  122. package/package.json +3 -3
  123. package/dist/bin/chunk-1hggd7yz.js +0 -1
  124. package/dist/bin/chunk-40j9hgzc.js +0 -1
  125. package/dist/bin/chunk-4gqfdr7t.js +0 -1
  126. package/dist/bin/chunk-5jv4cpky.js +0 -1
  127. package/dist/bin/chunk-5kxm5mx7.js +0 -1
  128. package/dist/bin/chunk-aghy01we.js +0 -1
  129. package/dist/bin/chunk-asvz121j.js +0 -1
  130. package/dist/bin/chunk-bcpdj01b.js +0 -1
  131. package/dist/bin/chunk-g76sry03.js +0 -1
  132. package/dist/bin/chunk-j02d6qmn.js +0 -1
  133. package/dist/bin/chunk-kmz8vb77.js +0 -1
  134. package/dist/bin/chunk-py1hyeb2.js +0 -1
  135. package/dist/bin/chunk-r85ahkwq.js +0 -1
  136. package/dist/bin/chunk-t6y3pkm8.js +0 -1
  137. package/dist/bin/chunk-vfcchrby.js +0 -1
  138. package/dist/bin/chunk-vmdh41kp.js +0 -1
  139. package/dist/bin/chunk-w8s8vgdj.js +0 -1
@@ -0,0 +1 @@
1
+ import{oh as a,ph as b,qh as c,rh as d}from"./chunk-bzth6d1s.js";import"./chunk-m07s5esk.js";export{b as AWSClient,c as buildQueryParams,d as detectCredentialSource,a as resolveS3Endpoint};
@@ -41,4 +41,4 @@ fi
41
41
  systemctl enable nftables >/dev/null 2>&1 || true
42
42
  echo "ts-cloud: L3/L4 mitigation active"
43
43
  `}var b=["off","monitor","rate_limit","challenge","lockdown"];function D(e,t=[]){let n=[],s=Math.max(1,e.baselineRequestsPerSecond),a=e.requestsPerSecond/s,l=0,i=(g,v)=>{n.push(v),l=Math.max(l,b.indexOf(g))},c=a>=3;if(c)i("monitor",`Traffic is ${a.toFixed(1)}x the baseline.`);let p=e.topSourceShare>=0.25,u=e.errorRate>=0.25,o=(e.suspiciousAgentShare??0)>=0.5,r=e.uniqueSources>0&&e.requestsPerSecond/e.uniqueSources>=50;if(c&&p)i("rate_limit",`One source accounts for ${(e.topSourceShare*100).toFixed(0)}% of traffic.`);if(c&&r)i("rate_limit","Request rate per unique source is far above what a browser produces.");if(c&&u)i("challenge",`Error rate is ${(e.errorRate*100).toFixed(0)}% under load.`);if(c&&o)i("challenge","Most requests carry no recognisable browser agent.");if(a>=20&&(p||u||o||r))i("lockdown",`Traffic is ${a.toFixed(0)}x the baseline with attack-shaped characteristics.`);if(!c&&e.topSourceShare>=0.6&&e.requestsPerSecond>s)i("rate_limit","A single source dominates traffic without an overall surge.");let d=b[l],m={off:1,monitor:1,rate_limit:0.5,challenge:0.25,lockdown:0.1}[d];return{level:d,reasons:n,rateLimitFactor:m,challengeEnabled:d==="challenge"||d==="lockdown",staticOnly:d==="lockdown",banCandidates:d==="off"||d==="monitor"?[]:f(t)}}function T(e,t){return Math.max(1,Math.floor(e*t.rateLimitFactor))}
44
- export{_ as nf,S as of,k as pf,x as qf,P as rf,C as sf,D as tf,T as uf};
44
+ export{_ as of,S as pf,k as qf,x as rf,P as sf,C as tf,D as uf,T as vf};
@@ -1,2 +1,2 @@
1
- import{oh as d}from"./chunk-mhrtx0p1.js";import{deflateRawSync as y}from"zlib";function m(n,e){let t=typeof e==="string"?Buffer.from(e,"utf-8"):e,i=y(t),r=f(t),s=new Date,g=(s.getHours()<<11|s.getMinutes()<<5|s.getSeconds()>>1)&65535,c=(s.getFullYear()-1980<<9|s.getMonth()+1<<5|s.getDate())&65535,l=Buffer.from(n,"utf-8"),a=Buffer.alloc(30+l.length);a.writeUInt32LE(67324752,0),a.writeUInt16LE(20,4),a.writeUInt16LE(0,6),a.writeUInt16LE(8,8),a.writeUInt16LE(g,10),a.writeUInt16LE(c,12),a.writeUInt32LE(r,14),a.writeUInt32LE(i.length,18),a.writeUInt32LE(t.length,22),a.writeUInt16LE(l.length,26),a.writeUInt16LE(0,28),l.copy(a,30);let o=Buffer.alloc(46+l.length);o.writeUInt32LE(33639248,0),o.writeUInt16LE(20,4),o.writeUInt16LE(20,6),o.writeUInt16LE(0,8),o.writeUInt16LE(8,10),o.writeUInt16LE(g,12),o.writeUInt16LE(c,14),o.writeUInt32LE(r,16),o.writeUInt32LE(i.length,20),o.writeUInt32LE(t.length,24),o.writeUInt16LE(l.length,28),o.writeUInt16LE(0,30),o.writeUInt16LE(0,32),o.writeUInt16LE(0,34),o.writeUInt16LE(0,36),o.writeUInt32LE(0,38),o.writeUInt32LE(0,42),l.copy(o,46);let p=a.length+i.length,h=o.length,u=Buffer.alloc(22);return u.writeUInt32LE(101010256,0),u.writeUInt16LE(0,4),u.writeUInt16LE(0,6),u.writeUInt16LE(1,8),u.writeUInt16LE(1,10),u.writeUInt32LE(h,12),u.writeUInt32LE(p,16),u.writeUInt16LE(0,20),Buffer.concat([a,i,o,u])}function f(n){let e=[];for(let i=0;i<256;i++){let r=i;for(let s=0;s<8;s++)r=r&1?3988292384^r>>>1:r>>>1;e[i]=r}let t=4294967295;for(let i=0;i<n.length;i++)t=e[(t^n[i])&255]^t>>>8;return(t^4294967295)>>>0}class C{client;region;constructor(n="us-east-1",e){this.region=n,this.client=new d(void 0,{profile:e})}async createFunction(n){return await this.client.request({service:"lambda",region:this.region,method:"POST",path:"/2015-03-31/functions",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async getFunction(n){return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2015-03-31/functions/${encodeURIComponent(n)}`,headers:{"Content-Type":"application/json"}})}async updateFunctionCode(n){let{FunctionName:e,...t}=n;return await this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2015-03-31/functions/${encodeURIComponent(e)}/code`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async updateFunctionCodeInline(n,e,t="index.js"){let i=m(t,e);return this.updateFunctionCode({FunctionName:n,ZipFile:i.toString("base64")})}async updateFunctionConfiguration(n){let{FunctionName:e,...t}=n;return await this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2015-03-31/functions/${encodeURIComponent(e)}/configuration`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async deleteFunction(n){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2015-03-31/functions/${encodeURIComponent(n)}`,headers:{"Content-Type":"application/json"}})}async invoke(n){let{FunctionName:e,InvocationType:t="RequestResponse",Payload:i,LogType:r}=n,s={"Content-Type":"application/json","X-Amz-Invocation-Type":t};if(r)s["X-Amz-Log-Type"]=r;let g=i?typeof i==="string"?i:JSON.stringify(i):void 0,c=await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(e)}/invocations`,headers:s,body:g,returnHeaders:!0});return{StatusCode:c.statusCode||200,FunctionError:c.headers?.["x-amz-function-error"],LogResult:c.headers?.["x-amz-log-result"],Payload:typeof c.body==="string"?c.body:JSON.stringify(c.body),ExecutedVersion:c.headers?.["x-amz-executed-version"]}}async listFunctions(n){let e={};if(n?.MaxItems)e.MaxItems=String(n.MaxItems);if(n?.Marker)e.Marker=n.Marker;if(n?.FunctionVersion)e.FunctionVersion=n.FunctionVersion;return await this.client.request({service:"lambda",region:this.region,method:"GET",path:"/2015-03-31/functions",queryParams:Object.keys(e).length>0?e:void 0,headers:{"Content-Type":"application/json"}})}async addPermission(n){let{FunctionName:e,...t}=n;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(e)}/policy`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async removePermission(n,e){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2015-03-31/functions/${encodeURIComponent(n)}/policy/${encodeURIComponent(e)}`,headers:{"Content-Type":"application/json"}})}async publishVersion(n){let{FunctionName:e,...t}=n;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(e)}/versions`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async createAlias(n){let{FunctionName:e,...t}=n;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(e)}/aliases`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async updateAlias(n){let{FunctionName:e,Name:t,...i}=n;return this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2015-03-31/functions/${encodeURIComponent(e)}/aliases/${encodeURIComponent(t)}`,headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}async getAlias(n,e){try{return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2015-03-31/functions/${encodeURIComponent(n)}/aliases/${encodeURIComponent(e)}`})}catch(t){if(/ResourceNotFound/i.test(String(t?.message)))return null;throw t}}async getProvisionedConcurrencyConfig(n,e){try{return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2019-09-30/functions/${encodeURIComponent(n)}/provisioned-concurrency`,queryParams:{Qualifier:e}})}catch(t){if(/ProvisionedConcurrencyConfigNotFound|ResourceNotFound/i.test(String(t?.message)))return null;throw t}}async putProvisionedConcurrencyConfig(n){let{FunctionName:e,Qualifier:t,ProvisionedConcurrentExecutions:i}=n;return this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2019-09-30/functions/${encodeURIComponent(e)}/provisioned-concurrency`,queryParams:{Qualifier:t},headers:{"Content-Type":"application/json"},body:JSON.stringify({ProvisionedConcurrentExecutions:i})})}async getFunctionConcurrency(n){try{return(await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2019-10-31/functions/${encodeURIComponent(n)}/concurrency`}))?.ReservedConcurrentExecutions??null}catch(e){if(/ResourceNotFound|ProvisionedConcurrencyConfigNotFound/i.test(String(e?.message)))return null;throw e}}async putFunctionConcurrency(n,e){await this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2019-10-31/functions/${encodeURIComponent(n)}/concurrency`,headers:{"Content-Type":"application/json"},body:JSON.stringify({ReservedConcurrentExecutions:e})})}async deleteFunctionConcurrency(n){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2019-10-31/functions/${encodeURIComponent(n)}/concurrency`})}async deleteProvisionedConcurrencyConfig(n,e){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2019-09-30/functions/${encodeURIComponent(n)}/provisioned-concurrency`,queryParams:{Qualifier:e}})}async waitForFunctionActive(n,e=60){let t=Date.now(),i=e*1000;while(Date.now()-t<i)try{let r=await this.getFunction(n),s=r.Configuration?.State;if(s==="Active")return r.Configuration;if(s==="Failed")throw Error(`Function ${n} failed: ${r.Configuration?.StateReason}`);await new Promise((g)=>setTimeout(g,2000))}catch(r){if(r.code==="ResourceNotFoundException"){await new Promise((s)=>setTimeout(s,2000));continue}throw r}throw Error(`Timeout waiting for function ${n} to become active`)}async functionExists(n){try{return await this.getFunction(n),!0}catch(e){if(e.code==="ResourceNotFoundException"||e.statusCode===404)return!1;throw e}}async createFunctionUrl(n){let{FunctionName:e,...t}=n;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2021-10-31/functions/${encodeURIComponent(e)}/url`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async getFunctionUrl(n){try{return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2021-10-31/functions/${encodeURIComponent(n)}/url`,headers:{"Content-Type":"application/json"}})}catch(e){if(e.statusCode===404)return null;throw e}}async deleteFunctionUrl(n){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2021-10-31/functions/${encodeURIComponent(n)}/url`,headers:{"Content-Type":"application/json"}})}async createFunctionWithCode(n){let{Code:e,Filename:t="index.js",...i}=n,r=m(t,e);return this.createFunction({...i,Code:{ZipFile:r.toString("base64")}})}async addFunctionUrlPermission(n){return this.addPermission({FunctionName:n,StatementId:"FunctionURLAllowPublicAccess",Action:"lambda:InvokeFunctionUrl",Principal:"*",FunctionUrlAuthType:"NONE"})}async publishLayerVersion(n){let{LayerName:e,...t}=n;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2018-10-31/layers/${encodeURIComponent(e)}/versions`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async listLayerVersions(n,e){let t={};if(e?.CompatibleRuntime)t.CompatibleRuntime=e.CompatibleRuntime;if(e?.CompatibleArchitecture)t.CompatibleArchitecture=e.CompatibleArchitecture;if(e?.MaxItems)t.MaxItems=String(e.MaxItems);if(e?.Marker)t.Marker=e.Marker;return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2018-10-31/layers/${encodeURIComponent(n)}/versions`,queryParams:Object.keys(t).length>0?t:void 0,headers:{"Content-Type":"application/json"}})}async getLayerVersion(n,e){return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2018-10-31/layers/${encodeURIComponent(n)}/versions/${e}`,headers:{"Content-Type":"application/json"}})}async addLayerVersionPermission(n){let{LayerName:e,VersionNumber:t,...i}=n;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2018-10-31/layers/${encodeURIComponent(e)}/versions/${t}/policy`,headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}async deleteLayerVersion(n,e){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2018-10-31/layers/${encodeURIComponent(n)}/versions/${e}`,headers:{"Content-Type":"application/json"}})}}
1
+ import{ph as d}from"./chunk-bzth6d1s.js";import{deflateRawSync as y}from"zlib";function m(n,e){let t=typeof e==="string"?Buffer.from(e,"utf-8"):e,i=y(t),r=f(t),s=new Date,g=(s.getHours()<<11|s.getMinutes()<<5|s.getSeconds()>>1)&65535,c=(s.getFullYear()-1980<<9|s.getMonth()+1<<5|s.getDate())&65535,l=Buffer.from(n,"utf-8"),a=Buffer.alloc(30+l.length);a.writeUInt32LE(67324752,0),a.writeUInt16LE(20,4),a.writeUInt16LE(0,6),a.writeUInt16LE(8,8),a.writeUInt16LE(g,10),a.writeUInt16LE(c,12),a.writeUInt32LE(r,14),a.writeUInt32LE(i.length,18),a.writeUInt32LE(t.length,22),a.writeUInt16LE(l.length,26),a.writeUInt16LE(0,28),l.copy(a,30);let o=Buffer.alloc(46+l.length);o.writeUInt32LE(33639248,0),o.writeUInt16LE(20,4),o.writeUInt16LE(20,6),o.writeUInt16LE(0,8),o.writeUInt16LE(8,10),o.writeUInt16LE(g,12),o.writeUInt16LE(c,14),o.writeUInt32LE(r,16),o.writeUInt32LE(i.length,20),o.writeUInt32LE(t.length,24),o.writeUInt16LE(l.length,28),o.writeUInt16LE(0,30),o.writeUInt16LE(0,32),o.writeUInt16LE(0,34),o.writeUInt16LE(0,36),o.writeUInt32LE(0,38),o.writeUInt32LE(0,42),l.copy(o,46);let p=a.length+i.length,h=o.length,u=Buffer.alloc(22);return u.writeUInt32LE(101010256,0),u.writeUInt16LE(0,4),u.writeUInt16LE(0,6),u.writeUInt16LE(1,8),u.writeUInt16LE(1,10),u.writeUInt32LE(h,12),u.writeUInt32LE(p,16),u.writeUInt16LE(0,20),Buffer.concat([a,i,o,u])}function f(n){let e=[];for(let i=0;i<256;i++){let r=i;for(let s=0;s<8;s++)r=r&1?3988292384^r>>>1:r>>>1;e[i]=r}let t=4294967295;for(let i=0;i<n.length;i++)t=e[(t^n[i])&255]^t>>>8;return(t^4294967295)>>>0}class C{client;region;constructor(n="us-east-1",e){this.region=n,this.client=new d(void 0,{profile:e})}async createFunction(n){return await this.client.request({service:"lambda",region:this.region,method:"POST",path:"/2015-03-31/functions",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}async getFunction(n){return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2015-03-31/functions/${encodeURIComponent(n)}`,headers:{"Content-Type":"application/json"}})}async updateFunctionCode(n){let{FunctionName:e,...t}=n;return await this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2015-03-31/functions/${encodeURIComponent(e)}/code`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async updateFunctionCodeInline(n,e,t="index.js"){let i=m(t,e);return this.updateFunctionCode({FunctionName:n,ZipFile:i.toString("base64")})}async updateFunctionConfiguration(n){let{FunctionName:e,...t}=n;return await this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2015-03-31/functions/${encodeURIComponent(e)}/configuration`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async deleteFunction(n){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2015-03-31/functions/${encodeURIComponent(n)}`,headers:{"Content-Type":"application/json"}})}async invoke(n){let{FunctionName:e,InvocationType:t="RequestResponse",Payload:i,LogType:r}=n,s={"Content-Type":"application/json","X-Amz-Invocation-Type":t};if(r)s["X-Amz-Log-Type"]=r;let g=i?typeof i==="string"?i:JSON.stringify(i):void 0,c=await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(e)}/invocations`,headers:s,body:g,returnHeaders:!0});return{StatusCode:c.statusCode||200,FunctionError:c.headers?.["x-amz-function-error"],LogResult:c.headers?.["x-amz-log-result"],Payload:typeof c.body==="string"?c.body:JSON.stringify(c.body),ExecutedVersion:c.headers?.["x-amz-executed-version"]}}async listFunctions(n){let e={};if(n?.MaxItems)e.MaxItems=String(n.MaxItems);if(n?.Marker)e.Marker=n.Marker;if(n?.FunctionVersion)e.FunctionVersion=n.FunctionVersion;return await this.client.request({service:"lambda",region:this.region,method:"GET",path:"/2015-03-31/functions",queryParams:Object.keys(e).length>0?e:void 0,headers:{"Content-Type":"application/json"}})}async addPermission(n){let{FunctionName:e,...t}=n;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(e)}/policy`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async removePermission(n,e){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2015-03-31/functions/${encodeURIComponent(n)}/policy/${encodeURIComponent(e)}`,headers:{"Content-Type":"application/json"}})}async publishVersion(n){let{FunctionName:e,...t}=n;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(e)}/versions`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async createAlias(n){let{FunctionName:e,...t}=n;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(e)}/aliases`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async updateAlias(n){let{FunctionName:e,Name:t,...i}=n;return this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2015-03-31/functions/${encodeURIComponent(e)}/aliases/${encodeURIComponent(t)}`,headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}async getAlias(n,e){try{return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2015-03-31/functions/${encodeURIComponent(n)}/aliases/${encodeURIComponent(e)}`})}catch(t){if(/ResourceNotFound/i.test(String(t?.message)))return null;throw t}}async getProvisionedConcurrencyConfig(n,e){try{return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2019-09-30/functions/${encodeURIComponent(n)}/provisioned-concurrency`,queryParams:{Qualifier:e}})}catch(t){if(/ProvisionedConcurrencyConfigNotFound|ResourceNotFound/i.test(String(t?.message)))return null;throw t}}async putProvisionedConcurrencyConfig(n){let{FunctionName:e,Qualifier:t,ProvisionedConcurrentExecutions:i}=n;return this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2019-09-30/functions/${encodeURIComponent(e)}/provisioned-concurrency`,queryParams:{Qualifier:t},headers:{"Content-Type":"application/json"},body:JSON.stringify({ProvisionedConcurrentExecutions:i})})}async getFunctionConcurrency(n){try{return(await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2019-10-31/functions/${encodeURIComponent(n)}/concurrency`}))?.ReservedConcurrentExecutions??null}catch(e){if(/ResourceNotFound|ProvisionedConcurrencyConfigNotFound/i.test(String(e?.message)))return null;throw e}}async putFunctionConcurrency(n,e){await this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2019-10-31/functions/${encodeURIComponent(n)}/concurrency`,headers:{"Content-Type":"application/json"},body:JSON.stringify({ReservedConcurrentExecutions:e})})}async deleteFunctionConcurrency(n){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2019-10-31/functions/${encodeURIComponent(n)}/concurrency`})}async deleteProvisionedConcurrencyConfig(n,e){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2019-09-30/functions/${encodeURIComponent(n)}/provisioned-concurrency`,queryParams:{Qualifier:e}})}async waitForFunctionActive(n,e=60){let t=Date.now(),i=e*1000;while(Date.now()-t<i)try{let r=await this.getFunction(n),s=r.Configuration?.State;if(s==="Active")return r.Configuration;if(s==="Failed")throw Error(`Function ${n} failed: ${r.Configuration?.StateReason}`);await new Promise((g)=>setTimeout(g,2000))}catch(r){if(r.code==="ResourceNotFoundException"){await new Promise((s)=>setTimeout(s,2000));continue}throw r}throw Error(`Timeout waiting for function ${n} to become active`)}async functionExists(n){try{return await this.getFunction(n),!0}catch(e){if(e.code==="ResourceNotFoundException"||e.statusCode===404)return!1;throw e}}async createFunctionUrl(n){let{FunctionName:e,...t}=n;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2021-10-31/functions/${encodeURIComponent(e)}/url`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async getFunctionUrl(n){try{return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2021-10-31/functions/${encodeURIComponent(n)}/url`,headers:{"Content-Type":"application/json"}})}catch(e){if(e.statusCode===404)return null;throw e}}async deleteFunctionUrl(n){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2021-10-31/functions/${encodeURIComponent(n)}/url`,headers:{"Content-Type":"application/json"}})}async createFunctionWithCode(n){let{Code:e,Filename:t="index.js",...i}=n,r=m(t,e);return this.createFunction({...i,Code:{ZipFile:r.toString("base64")}})}async addFunctionUrlPermission(n){return this.addPermission({FunctionName:n,StatementId:"FunctionURLAllowPublicAccess",Action:"lambda:InvokeFunctionUrl",Principal:"*",FunctionUrlAuthType:"NONE"})}async publishLayerVersion(n){let{LayerName:e,...t}=n;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2018-10-31/layers/${encodeURIComponent(e)}/versions`,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}async listLayerVersions(n,e){let t={};if(e?.CompatibleRuntime)t.CompatibleRuntime=e.CompatibleRuntime;if(e?.CompatibleArchitecture)t.CompatibleArchitecture=e.CompatibleArchitecture;if(e?.MaxItems)t.MaxItems=String(e.MaxItems);if(e?.Marker)t.Marker=e.Marker;return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2018-10-31/layers/${encodeURIComponent(n)}/versions`,queryParams:Object.keys(t).length>0?t:void 0,headers:{"Content-Type":"application/json"}})}async getLayerVersion(n,e){return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2018-10-31/layers/${encodeURIComponent(n)}/versions/${e}`,headers:{"Content-Type":"application/json"}})}async addLayerVersionPermission(n){let{LayerName:e,VersionNumber:t,...i}=n;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2018-10-31/layers/${encodeURIComponent(e)}/versions/${t}/policy`,headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}async deleteLayerVersion(n,e){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2018-10-31/layers/${encodeURIComponent(n)}/versions/${e}`,headers:{"Content-Type":"application/json"}})}}
2
2
  export{C as _d};
@@ -0,0 +1 @@
1
+ import{Xa as a}from"./chunk-sj5csg49.js";import"./chunk-m07s5esk.js";export{a as encodeDashboardPayload};
@@ -1,4 +1,4 @@
1
- import{md as Z,rd as L,sd as Y,td as _,ud as K}from"./chunk-a8t3c4qe.js";import{wd as U}from"./chunk-48eb4z0c.js";import{ug as W}from"./chunk-3f27aa5r.js";import{zg as M}from"./chunk-hv3w2qy1.js";import{Bg as B}from"./chunk-bj4ft4qc.js";import{Ap as j}from"./chunk-re15e6p4.js";function J(t){let{bucketName:s,domain:l,aliases:e,certificateArn:m,defaultRootObject:i="index.html",errorDocument:r="404.html",passthroughUrls:a=!1,singlePageApp:d=!1,dynamicApp:b=!1,computeOriginDomain:k,computeOriginPort:R=3008,computeOriginId:P="app-compute",retainOnStackDelete:x=!1}=t,A=x?{DeletionPolicy:"Retain",UpdateReplacePolicy:"Retain"}:{},y=b&&!!k,T=y?["GET","HEAD","OPTIONS","PUT","POST","PATCH","DELETE"]:["GET","HEAD"],F=y?["GET","HEAD"]:["GET","HEAD"],N={},O={};N.S3Bucket={Type:"AWS::S3::Bucket",...A,Properties:{BucketName:s,PublicAccessBlockConfiguration:{BlockPublicAcls:!0,BlockPublicPolicy:!1,IgnorePublicAcls:!0,RestrictPublicBuckets:!1},WebsiteConfiguration:{IndexDocument:i,ErrorDocument:r}}},O.BucketName={Description:"S3 Bucket Name",Value:{Ref:"S3Bucket"}},O.BucketArn={Description:"S3 Bucket ARN",Value:{"Fn::GetAtt":["S3Bucket","Arn"]}},N.CloudFrontOAC={Type:"AWS::CloudFront::OriginAccessControl",...A,Properties:{OriginAccessControlConfig:{Name:`OAC-${s}`,Description:`OAC for ${s}`,OriginAccessControlOriginType:"s3",SigningBehavior:"always",SigningProtocol:"sigv4"}}};let D;if(a&&y)D="InstallRootRedirectFunction",N[D]={Type:"AWS::CloudFront::Function",Properties:{Name:{"Fn::Sub":"${AWS::StackName}-install-root-redirect"},AutoPublish:!0,FunctionConfig:{Comment:"Redirect curl pantry.dev | bash (GET /) to /install.sh on S3",Runtime:"cloudfront-js-2.0"},FunctionCode:`function handler(event) {
1
+ import{md as Z,rd as L,sd as Y,td as _,ud as K}from"./chunk-y68m9bx7.js";import{wd as U}from"./chunk-t7rcfwqc.js";import{vg as W}from"./chunk-h6xqtypj.js";import{Ag as M}from"./chunk-m9r5jype.js";import{Cg as B}from"./chunk-e2dnxp8d.js";import{Bp as j}from"./chunk-m07s5esk.js";function J(t){let{bucketName:s,domain:l,aliases:e,certificateArn:m,defaultRootObject:i="index.html",errorDocument:r="404.html",passthroughUrls:a=!1,singlePageApp:d=!1,dynamicApp:b=!1,computeOriginDomain:k,computeOriginPort:R=3008,computeOriginId:P="app-compute",retainOnStackDelete:x=!1}=t,A=x?{DeletionPolicy:"Retain",UpdateReplacePolicy:"Retain"}:{},y=b&&!!k,T=y?["GET","HEAD","OPTIONS","PUT","POST","PATCH","DELETE"]:["GET","HEAD"],F=y?["GET","HEAD"]:["GET","HEAD"],N={},O={};N.S3Bucket={Type:"AWS::S3::Bucket",...A,Properties:{BucketName:s,PublicAccessBlockConfiguration:{BlockPublicAcls:!0,BlockPublicPolicy:!1,IgnorePublicAcls:!0,RestrictPublicBuckets:!1},WebsiteConfiguration:{IndexDocument:i,ErrorDocument:r}}},O.BucketName={Description:"S3 Bucket Name",Value:{Ref:"S3Bucket"}},O.BucketArn={Description:"S3 Bucket ARN",Value:{"Fn::GetAtt":["S3Bucket","Arn"]}},N.CloudFrontOAC={Type:"AWS::CloudFront::OriginAccessControl",...A,Properties:{OriginAccessControlConfig:{Name:`OAC-${s}`,Description:`OAC for ${s}`,OriginAccessControlOriginType:"s3",SigningBehavior:"always",SigningProtocol:"sigv4"}}};let D;if(a&&y)D="InstallRootRedirectFunction",N[D]={Type:"AWS::CloudFront::Function",Properties:{Name:{"Fn::Sub":"${AWS::StackName}-install-root-redirect"},AutoPublish:!0,FunctionConfig:{Comment:"Redirect curl pantry.dev | bash (GET /) to /install.sh on S3",Runtime:"cloudfront-js-2.0"},FunctionCode:`function handler(event) {
2
2
  var request = event.request;
3
3
  if (request.uri === '/' || request.uri === '') {
4
4
  return {
@@ -42,7 +42,7 @@ import{md as Z,rd as L,sd as Y,td as _,ud as K}from"./chunk-a8t3c4qe.js";import{
42
42
  │ │
43
43
  │ Verification typically takes 1-2 business days. │
44
44
  │ After verification, re-run: bunx bunpress deploy │
45
- └─────────────────────────────────────────────────────────────────────────────┘`),{success:!1,stackId:O,stackName:i,bucket:y,message:"CloudFront account verification required. Please contact AWS Support."}}return{success:!1,stackId:O,stackName:i,bucket:y,message:`Stack deployment failed: ${o.message}`}}let u=(await r.describeStacks({stackName:i})).Stacks[0]?.Outputs||[],C=(o)=>u.find((n)=>n.OutputKey===o)?.OutputValue,f=C("DistributionDomain");if(f&&d)console.log(`Creating DNS records via ${d.name}...`),await q(d,e,f);else if(f&&!d)console.log("Skipping DNS record creation (DNS verification was skipped)");return{success:!0,stackId:O,stackName:i,bucket:C("BucketName")||y,distributionId:C("DistributionId"),distributionDomain:f,domain:e,certificateArn:b,message:"Static site infrastructure deployed successfully with external DNS"}}async function q(t,s,l){if(!t){console.log("Skipping DNS record creation (DNS verification was skipped)");return}if(s.split(".").length===2)if(t instanceof Z){console.log(`Creating Route53 alias record for apex domain ${s} -> ${l}`);let i=await t.createCloudFrontAlias({domain:s,name:s,cloudFrontDomainName:l});if(!i.success)console.warn(`Warning: Could not create Route53 alias record: ${i.message}`),console.warn("Please manually create an A-record alias in Route53:"),console.warn(` ${s} -> ${l}`);else console.log(`Created Route53 alias record: ${s} -> ${l}`);let r=`www.${s}`;console.log(`Creating Route53 alias record for ${r} -> ${l}`);let a=await t.createCloudFrontAlias({domain:s,name:r,cloudFrontDomainName:l});if(!a.success)console.warn(`Warning: Could not create www Route53 alias: ${a.message}`),console.warn("Please manually create an A-record alias in Route53:"),console.warn(` ${r} -> ${l}`);else console.log(`Created Route53 alias record: ${r} -> ${l}`)}else{try{let d=await t.listRecords(s,"A");if(d.success)for(let b of d.records){let k=b.name.replace(/\.$/,"");if(k===s||k==="")console.log(`Removing existing root A record (${b.content}) to make room for ALIAS...`),await t.deleteRecord(s,{name:s,type:"A",content:b.content})}}catch(d){console.log(`Note: Could not check for conflicting A records: ${d instanceof Error?d.message:d}`)}console.log(`Creating ALIAS record for apex domain ${s} -> ${l}`);let i=await t.upsertRecord(s,{name:s,type:"ALIAS",content:l,ttl:600});if(!i.success)console.warn(`Warning: Could not create ALIAS record: ${i.message}`),console.warn("Please manually create an ALIAS record in your DNS provider:"),console.warn(` ${s} -> ${l}`);else console.log(`Created ALIAS record: ${s} -> ${l}`);let r=`www.${s}`;console.log(`Creating CNAME record for ${r} -> ${l}`);let a=await t.upsertRecord(s,{name:r,type:"CNAME",content:l,ttl:600});if(!a.success)console.warn(`Warning: Could not create www DNS record: ${a.message}`),console.warn("Please manually create a CNAME record:"),console.warn(` ${r} -> ${l}`);else console.log(`Created CNAME record: ${r} -> ${l}`)}else{console.log(`Creating CNAME record for ${s} -> ${l}`);let i=await t.upsertRecord(s,{name:s,type:"CNAME",content:l,ttl:600});if(!i.success)console.warn(`Warning: Could not create DNS record: ${i.message}`),console.warn("Please manually create a CNAME record:"),console.warn(` ${s} -> ${l}`);else console.log(`Created CNAME record: ${s} -> ${l}`)}}async function le(t){let{sourceDir:s,cleanBucket:l=!1,onProgress:e,...m}=t;e?.("infrastructure","Deploying CloudFormation stack...");let i=await G(m);if(!i.success)return i;if(l){e?.("clean","Cleaning old files from S3...");try{await new B(m.region||"us-east-1").emptyBucket(i.bucket)}catch(b){console.log(`Note: Could not clean bucket: ${b.message}`)}}e?.("upload","Uploading files to S3...");let{uploadStaticFiles:r}=await import("./chunk-vfcchrby.js"),a=await r({sourceDir:s,bucket:i.bucket,region:m.region||"us-east-1",cacheControl:m.cacheControl,onProgress:(b,k,R)=>{e?.("upload",`${b}/${k}: ${R}`)}});if(a.errors.length>0)return{...i,success:!1,message:`Upload errors: ${a.errors.join(", ")}`,filesUploaded:a.uploaded};if(i.distributionId&&a.uploaded>0){e?.("invalidate","Invalidating CloudFront cache...");let{invalidateCache:b}=await import("./chunk-vfcchrby.js");await b(i.distributionId)}e?.("complete","Deployment complete!");let d=a.skipped>0?`Deployed ${a.uploaded} files (${a.skipped} unchanged) with external DNS`:`Deployed ${a.uploaded} files successfully with external DNS`;return{...i,filesUploaded:a.uploaded,filesSkipped:a.skipped,message:d}}function Q(t){let{bucketName:s,domain:l,certificateArn:e,hostedZoneId:m,defaultRootObject:i="index.html",errorDocument:r="404.html"}=t,a={},d={};a.S3Bucket={Type:"AWS::S3::Bucket",Properties:{BucketName:s,PublicAccessBlockConfiguration:{BlockPublicAcls:!0,BlockPublicPolicy:!1,IgnorePublicAcls:!0,RestrictPublicBuckets:!1},WebsiteConfiguration:{IndexDocument:i,ErrorDocument:r}}},d.BucketName={Description:"S3 Bucket Name",Value:{Ref:"S3Bucket"}},d.BucketArn={Description:"S3 Bucket ARN",Value:{"Fn::GetAtt":["S3Bucket","Arn"]}},a.CloudFrontOAC={Type:"AWS::CloudFront::OriginAccessControl",Properties:{OriginAccessControlConfig:{Name:`OAC-${s}`,Description:`OAC for ${s}`,OriginAccessControlOriginType:"s3",SigningBehavior:"always",SigningProtocol:"sigv4"}}},a.UrlRewriteFunction={Type:"AWS::CloudFront::Function",Properties:{Name:{"Fn::Sub":"${AWS::StackName}-url-rewrite"},AutoPublish:!0,FunctionConfig:{Comment:"Append .html extension to URLs without extensions",Runtime:"cloudfront-js-2.0"},FunctionCode:`function handler(event) {
45
+ └─────────────────────────────────────────────────────────────────────────────┘`),{success:!1,stackId:O,stackName:i,bucket:y,message:"CloudFront account verification required. Please contact AWS Support."}}return{success:!1,stackId:O,stackName:i,bucket:y,message:`Stack deployment failed: ${o.message}`}}let u=(await r.describeStacks({stackName:i})).Stacks[0]?.Outputs||[],C=(o)=>u.find((n)=>n.OutputKey===o)?.OutputValue,f=C("DistributionDomain");if(f&&d)console.log(`Creating DNS records via ${d.name}...`),await q(d,e,f);else if(f&&!d)console.log("Skipping DNS record creation (DNS verification was skipped)");return{success:!0,stackId:O,stackName:i,bucket:C("BucketName")||y,distributionId:C("DistributionId"),distributionDomain:f,domain:e,certificateArn:b,message:"Static site infrastructure deployed successfully with external DNS"}}async function q(t,s,l){if(!t){console.log("Skipping DNS record creation (DNS verification was skipped)");return}if(s.split(".").length===2)if(t instanceof Z){console.log(`Creating Route53 alias record for apex domain ${s} -> ${l}`);let i=await t.createCloudFrontAlias({domain:s,name:s,cloudFrontDomainName:l});if(!i.success)console.warn(`Warning: Could not create Route53 alias record: ${i.message}`),console.warn("Please manually create an A-record alias in Route53:"),console.warn(` ${s} -> ${l}`);else console.log(`Created Route53 alias record: ${s} -> ${l}`);let r=`www.${s}`;console.log(`Creating Route53 alias record for ${r} -> ${l}`);let a=await t.createCloudFrontAlias({domain:s,name:r,cloudFrontDomainName:l});if(!a.success)console.warn(`Warning: Could not create www Route53 alias: ${a.message}`),console.warn("Please manually create an A-record alias in Route53:"),console.warn(` ${r} -> ${l}`);else console.log(`Created Route53 alias record: ${r} -> ${l}`)}else{try{let d=await t.listRecords(s,"A");if(d.success)for(let b of d.records){let k=b.name.replace(/\.$/,"");if(k===s||k==="")console.log(`Removing existing root A record (${b.content}) to make room for ALIAS...`),await t.deleteRecord(s,{name:s,type:"A",content:b.content})}}catch(d){console.log(`Note: Could not check for conflicting A records: ${d instanceof Error?d.message:d}`)}console.log(`Creating ALIAS record for apex domain ${s} -> ${l}`);let i=await t.upsertRecord(s,{name:s,type:"ALIAS",content:l,ttl:600});if(!i.success)console.warn(`Warning: Could not create ALIAS record: ${i.message}`),console.warn("Please manually create an ALIAS record in your DNS provider:"),console.warn(` ${s} -> ${l}`);else console.log(`Created ALIAS record: ${s} -> ${l}`);let r=`www.${s}`;console.log(`Creating CNAME record for ${r} -> ${l}`);let a=await t.upsertRecord(s,{name:r,type:"CNAME",content:l,ttl:600});if(!a.success)console.warn(`Warning: Could not create www DNS record: ${a.message}`),console.warn("Please manually create a CNAME record:"),console.warn(` ${r} -> ${l}`);else console.log(`Created CNAME record: ${r} -> ${l}`)}else{console.log(`Creating CNAME record for ${s} -> ${l}`);let i=await t.upsertRecord(s,{name:s,type:"CNAME",content:l,ttl:600});if(!i.success)console.warn(`Warning: Could not create DNS record: ${i.message}`),console.warn("Please manually create a CNAME record:"),console.warn(` ${s} -> ${l}`);else console.log(`Created CNAME record: ${s} -> ${l}`)}}async function le(t){let{sourceDir:s,cleanBucket:l=!1,onProgress:e,...m}=t;e?.("infrastructure","Deploying CloudFormation stack...");let i=await G(m);if(!i.success)return i;if(l){e?.("clean","Cleaning old files from S3...");try{await new B(m.region||"us-east-1").emptyBucket(i.bucket)}catch(b){console.log(`Note: Could not clean bucket: ${b.message}`)}}e?.("upload","Uploading files to S3...");let{uploadStaticFiles:r}=await import("./chunk-v0beqdna.js"),a=await r({sourceDir:s,bucket:i.bucket,region:m.region||"us-east-1",cacheControl:m.cacheControl,onProgress:(b,k,R)=>{e?.("upload",`${b}/${k}: ${R}`)}});if(a.errors.length>0)return{...i,success:!1,message:`Upload errors: ${a.errors.join(", ")}`,filesUploaded:a.uploaded};if(i.distributionId&&a.uploaded>0){e?.("invalidate","Invalidating CloudFront cache...");let{invalidateCache:b}=await import("./chunk-v0beqdna.js");await b(i.distributionId)}e?.("complete","Deployment complete!");let d=a.skipped>0?`Deployed ${a.uploaded} files (${a.skipped} unchanged) with external DNS`:`Deployed ${a.uploaded} files successfully with external DNS`;return{...i,filesUploaded:a.uploaded,filesSkipped:a.skipped,message:d}}function Q(t){let{bucketName:s,domain:l,certificateArn:e,hostedZoneId:m,defaultRootObject:i="index.html",errorDocument:r="404.html"}=t,a={},d={};a.S3Bucket={Type:"AWS::S3::Bucket",Properties:{BucketName:s,PublicAccessBlockConfiguration:{BlockPublicAcls:!0,BlockPublicPolicy:!1,IgnorePublicAcls:!0,RestrictPublicBuckets:!1},WebsiteConfiguration:{IndexDocument:i,ErrorDocument:r}}},d.BucketName={Description:"S3 Bucket Name",Value:{Ref:"S3Bucket"}},d.BucketArn={Description:"S3 Bucket ARN",Value:{"Fn::GetAtt":["S3Bucket","Arn"]}},a.CloudFrontOAC={Type:"AWS::CloudFront::OriginAccessControl",Properties:{OriginAccessControlConfig:{Name:`OAC-${s}`,Description:`OAC for ${s}`,OriginAccessControlOriginType:"s3",SigningBehavior:"always",SigningProtocol:"sigv4"}}},a.UrlRewriteFunction={Type:"AWS::CloudFront::Function",Properties:{Name:{"Fn::Sub":"${AWS::StackName}-url-rewrite"},AutoPublish:!0,FunctionConfig:{Comment:"Append .html extension to URLs without extensions",Runtime:"cloudfront-js-2.0"},FunctionCode:`function handler(event) {
46
46
  const request = event.request;
47
47
  var uri = request.uri;
48
48
 
@@ -0,0 +1 @@
1
+ import{rd as a,sd as b}from"./chunk-y68m9bx7.js";import"./chunk-m9r5jype.js";import"./chunk-bzth6d1s.js";import"./chunk-m07s5esk.js";export{a as ACMClient,b as ACMDnsValidator};
@@ -1,6 +1,6 @@
1
- import{Ap as l,zp as v}from"./chunk-re15e6p4.js";var F={};v(F,{ProgressBar:()=>y,Spinner:()=>x,box:()=>R,checkAwsCli:()=>T,checkAwsCredentials:()=>L,colorize:()=>a,colors:()=>r,confirm:()=>A,error:()=>f,formatBytes:()=>P,formatDuration:()=>M,getAwsAccountId:()=>E,getAwsRegions:()=>k,header:()=>I,info:()=>b,prompt:()=>h,select:()=>C,step:()=>B,success:()=>m,table:()=>S,warn:()=>d,warning:()=>w});var r={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m"};function a(t,e){return`${r[e]}${t}${r.reset}`}function m(t){console.log(`${r.green}✓${r.reset} ${t}`)}function f(t){console.error(`${r.red}✗${r.reset} ${t}`)}function d(t){console.warn(`${r.yellow}⚠${r.reset} ${t}`)}var w=d;function b(t){console.log(`${r.blue}ℹ${r.reset} ${t}`)}function B(t){console.log(`${r.cyan}→${r.reset} ${t}`)}function I(t){console.log(`
1
+ import{Ap as v,Bp as l}from"./chunk-m07s5esk.js";var F={};v(F,{ProgressBar:()=>y,Spinner:()=>x,box:()=>R,checkAwsCli:()=>T,checkAwsCredentials:()=>L,colorize:()=>a,colors:()=>r,confirm:()=>A,error:()=>f,formatBytes:()=>P,formatDuration:()=>M,getAwsAccountId:()=>E,getAwsRegions:()=>k,header:()=>I,info:()=>b,prompt:()=>h,select:()=>C,step:()=>B,success:()=>m,table:()=>S,warn:()=>d,warning:()=>w});var r={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m"};function a(t,e){return`${r[e]}${t}${r.reset}`}function m(t){console.log(`${r.green}✓${r.reset} ${t}`)}function f(t){console.error(`${r.red}✗${r.reset} ${t}`)}function d(t){console.warn(`${r.yellow}⚠${r.reset} ${t}`)}var w=d;function b(t){console.log(`${r.blue}ℹ${r.reset} ${t}`)}function B(t){console.log(`${r.cyan}→${r.reset} ${t}`)}function I(t){console.log(`
2
2
  ${r.bright}${r.cyan}${t}${r.reset}
3
3
  `)}var g=!!(process.env.CI||process.env.GITHUB_ACTIONS||process.env.BUILDKITE||process.env.CIRCLECI||process.env.GITLAB_CI);class x{frames=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];interval=null;currentFrame=0;message;constructor(t){this.message=t}get text(){return this.message}set text(t){if(this.message=t,g&&this.interval)console.log(` ${t}`)}start(){if(g){console.log(` ${this.message}`),this.interval=!0;return}this.interval=setInterval(()=>{process.stdout.write(`\r${r.cyan}${this.frames[this.currentFrame]}${r.reset} ${this.message}`),this.currentFrame=(this.currentFrame+1)%this.frames.length},80)}succeed(t){this.stop(),m(t||this.message)}fail(t){this.stop(),f(t||this.message)}warn(t){this.stop(),w(t||this.message)}stop(){if(this.interval){if(!g)process.stdout.write("\r");if(typeof this.interval==="object")clearInterval(this.interval);this.interval=null}}}class y{total;current=0;width=40;constructor(t){this.total=t}update(t){this.current=t,this.render()}increment(){this.current++,this.render()}render(){let t=Math.floor(this.current/this.total*100),e=Math.floor(this.current/this.total*this.width),n=this.width-e,s=`${"█".repeat(e)}${"░".repeat(n)}`;if(process.stdout.write(`\r${r.cyan}${s}${r.reset} ${t}% (${this.current}/${this.total})`),this.current>=this.total)process.stdout.write(`
4
4
  `)}}async function h(t,e){let s=(await import("node:readline")).createInterface({input:process.stdin,output:process.stdout});return new Promise((i)=>{let o=e?`${r.cyan}?${r.reset} ${t} ${r.gray}(${e})${r.reset}: `:`${r.cyan}?${r.reset} ${t}: `;s.question(o,(c)=>{s.close(),i(c||e||"")})})}async function A(t,e=!1){let n=await h(`${t} (y/n)`,e?"y":"n");return n.toLowerCase()==="y"||n.toLowerCase()==="yes"}async function C(t,e){console.log(`${r.cyan}?${r.reset} ${t}`),e.forEach((i,o)=>{console.log(` ${r.gray}${o+1}.${r.reset} ${i}`)});let n=await h("Select","1"),s=Number.parseInt(n)-1;if(s>=0&&s<e.length)return e[s];return e[0]}function S(t,e){let n=t.map((i,o)=>{let c=Math.max(...e.map((u)=>(u[o]||"").length));return Math.max(i.length,c)}),s=t.map((i,o)=>i.padEnd(n[o])).join(" ");console.log(a(s,"bright")),console.log(a("─".repeat(s.length),"gray")),e.forEach((i)=>{let o=i.map((c,u)=>(c||"").padEnd(n[u])).join(" ");console.log(o)})}function P(t){if(t===0)return"0 B";let e=1024,n=["B","KB","MB","GB","TB"],s=Math.floor(Math.log(t)/Math.log(e));return`${Number.parseFloat((t/e**s).toFixed(2))} ${n[s]}`}function M(t){if(t<1000)return`${t}ms`;let e=Math.floor(t/1000);if(e<60)return`${e}s`;let n=Math.floor(e/60),s=e%60;if(n<60)return`${n}m ${s}s`;let i=Math.floor(n/60),o=n%60;return`${i}h ${o}m`}function R(t,e="cyan"){let n=t.split(`
5
- `),s=Math.max(...n.map((o)=>o.length)),i="─".repeat(s+2);console.log(a(`┌${i}┐`,e)),n.forEach((o)=>{console.log(a(`│ ${o.padEnd(s)} │`,e))}),console.log(a(`└${i}┘`,e))}async function T(){return!0}async function L(){try{let{AWSClient:t}=await import("./chunk-5kxm5mx7.js");return await new t().request({service:"sts",region:"us-east-1",method:"POST",path:"/",body:new URLSearchParams({Action:"GetCallerIdentity",Version:"2011-06-15"}).toString()}),!0}catch{return!1}}async function E(){try{let{AWSClient:t}=await import("./chunk-5kxm5mx7.js"),n=await new t().request({service:"sts",region:"us-east-1",method:"POST",path:"/",body:new URLSearchParams({Action:"GetCallerIdentity",Version:"2011-06-15"}).toString()});return n.Account||n.GetCallerIdentityResult?.Account||null}catch{return null}}async function k(){try{let{AWSClient:t}=await import("./chunk-5kxm5mx7.js"),n=await new t().request({service:"ec2",region:"us-east-1",method:"POST",path:"/",body:new URLSearchParams({Action:"DescribeRegions",Version:"2016-11-15"}).toString()}),s=[];if(n.regionInfo){let i=Array.isArray(n.regionInfo)?n.regionInfo:[n.regionInfo];s.push(...i.map((o)=>o.regionName))}return s.length>0?s:p()}catch{return p()}}function p(){return["us-east-1","us-east-2","us-west-1","us-west-2","eu-west-1","eu-central-1","ap-southeast-1","ap-northeast-1"]}
6
- export{r as Ug,a as Vg,m as Wg,f as Xg,d as Yg,w as Zg,b as _g,B as $g,I as ah,x as bh,h as ch,A as dh,C as eh,S as fh,P as gh,R as hh,T as ih,L as jh,E as kh,k as lh,F as mh};
5
+ `),s=Math.max(...n.map((o)=>o.length)),i="─".repeat(s+2);console.log(a(`┌${i}┐`,e)),n.forEach((o)=>{console.log(a(`│ ${o.padEnd(s)} │`,e))}),console.log(a(`└${i}┘`,e))}async function T(){return!0}async function L(){try{let{AWSClient:t}=await import("./chunk-7aagqqr9.js");return await new t().request({service:"sts",region:"us-east-1",method:"POST",path:"/",body:new URLSearchParams({Action:"GetCallerIdentity",Version:"2011-06-15"}).toString()}),!0}catch{return!1}}async function E(){try{let{AWSClient:t}=await import("./chunk-7aagqqr9.js"),n=await new t().request({service:"sts",region:"us-east-1",method:"POST",path:"/",body:new URLSearchParams({Action:"GetCallerIdentity",Version:"2011-06-15"}).toString()});return n.Account||n.GetCallerIdentityResult?.Account||null}catch{return null}}async function k(){try{let{AWSClient:t}=await import("./chunk-7aagqqr9.js"),n=await new t().request({service:"ec2",region:"us-east-1",method:"POST",path:"/",body:new URLSearchParams({Action:"DescribeRegions",Version:"2016-11-15"}).toString()}),s=[];if(n.regionInfo){let i=Array.isArray(n.regionInfo)?n.regionInfo:[n.regionInfo];s.push(...i.map((o)=>o.regionName))}return s.length>0?s:p()}catch{return p()}}function p(){return["us-east-1","us-east-2","us-west-1","us-west-2","eu-west-1","eu-central-1","ap-southeast-1","ap-northeast-1"]}
6
+ export{r as Vg,a as Wg,m as Xg,f as Yg,d as Zg,w as _g,b as $g,B as ah,I as bh,x as ch,h as dh,A as eh,C as fh,S as gh,P as hh,R as ih,T as jh,L as kh,E as lh,k as mh,F as nh};
@@ -1 +1 @@
1
- import{Cg as a,Dg as b,Eg as c,Fg as d,Gg as e,Hg as f,Ig as g,Jg as h,Kg as i}from"./chunk-nc9pp87y.js";import"./chunk-3g80gjw6.js";import"./chunk-84703zpq.js";import"./chunk-re15e6p4.js";export{e as AwsSecretsManagerConfigurationBackend,f as AwsSsmConfigurationBackend,h as ConfigurationService,a as ConfigurationStore,g as ExternalConfigurationBackend,d as LocalEncryptedConfigurationBackend,b as parseDotenv,c as serializeDotenv,i as synchronizeConfiguredConfiguration};
1
+ import{Dg as a,Eg as b,Fg as c,Gg as d,Hg as e,Ig as f,Jg as g,Kg as h,Lg as i}from"./chunk-nv211m42.js";import"./chunk-jxd3j00s.js";import"./chunk-n20kbxwb.js";import"./chunk-m07s5esk.js";export{e as AwsSecretsManagerConfigurationBackend,f as AwsSsmConfigurationBackend,h as ConfigurationService,a as ConfigurationStore,g as ExternalConfigurationBackend,d as LocalEncryptedConfigurationBackend,b as parseDotenv,c as serializeDotenv,i as synchronizeConfiguredConfiguration};
@@ -0,0 +1 @@
1
+ import{vg as a}from"./chunk-h6xqtypj.js";import"./chunk-bzth6d1s.js";import"./chunk-m07s5esk.js";export{a as CloudFormationClient};
@@ -1 +1 @@
1
- import{Af as f,Bf as g,Cf as h,Df as i,Ef as j,vf as a,wf as b,xf as c,yf as d,zf as e}from"./chunk-ncrnbcsa.js";import"./chunk-84703zpq.js";import"./chunk-re15e6p4.js";export{a as MANAGEMENT_DASHBOARD_SITE,j as buildManagementDashboardArtifact,b as dashboardCredentialsFile,h as ensureManagementDashboard,d as liveStageDir,i as managementDashboardSiteNames,c as resolveDashboardAuth,e as resolveDashboardVersion,g as resolveUiSource,f as stageLiveDashboardRoot};
1
+ import{Af as e,Bf as f,Cf as g,Df as h,Ef as i,Ff as j,wf as a,xf as b,yf as c,zf as d}from"./chunk-e0z2t4mf.js";import"./chunk-n20kbxwb.js";import"./chunk-m07s5esk.js";export{a as MANAGEMENT_DASHBOARD_SITE,j as buildManagementDashboardArtifact,b as dashboardCredentialsFile,h as ensureManagementDashboard,d as liveStageDir,i as managementDashboardSiteNames,c as resolveDashboardAuth,e as resolveDashboardVersion,g as resolveUiSource,f as stageLiveDashboardRoot};
@@ -1,4 +1,4 @@
1
- import{uf as lt}from"./chunk-5gx38418.js";import{Ng as Lr,Pg as _}from"./chunk-3g80gjw6.js";var si=["edge.requests","edge.egress_gb","function.invocations","function.gb_seconds","build.minutes","compute.instance_hours","storage.gb_hours","object.egress_gb","object.requests","database.gb_hours","database.io_requests","telemetry.ingest_gb","image.transformations"],Ve={"edge.requests":{key:"edge.requests",unit:"requests",label:"Edge requests",precision:0},"edge.egress_gb":{key:"edge.egress_gb",unit:"gb",label:"Edge egress",precision:3},"function.invocations":{key:"function.invocations",unit:"invocations",label:"Function invocations",precision:0},"function.gb_seconds":{key:"function.gb_seconds",unit:"gb_seconds",label:"Function compute",precision:2},"build.minutes":{key:"build.minutes",unit:"minutes",label:"Build minutes",precision:2},"compute.instance_hours":{key:"compute.instance_hours",unit:"hours",label:"Instance hours",precision:2},"storage.gb_hours":{key:"storage.gb_hours",unit:"gb_hours",label:"Block storage",precision:2},"object.egress_gb":{key:"object.egress_gb",unit:"gb",label:"Object storage egress",precision:3},"object.requests":{key:"object.requests",unit:"requests",label:"Object storage requests",precision:0},"database.gb_hours":{key:"database.gb_hours",unit:"gb_hours",label:"Database storage",precision:2},"database.io_requests":{key:"database.io_requests",unit:"requests",label:"Database I/O",precision:0},"telemetry.ingest_gb":{key:"telemetry.ingest_gb",unit:"gb",label:"Telemetry ingest",precision:3},"image.transformations":{key:"image.transformations",unit:"count",label:"Image transformations",precision:0}},ai=["notify","block_builds","block_deployments","throttle_requests","suspend_functions","serve_static","suspend_project"],D={notify:0,block_builds:1,block_deployments:2,throttle_requests:3,suspend_functions:4,serve_static:5,suspend_project:6};var ci=1e6;function Vr(e){if(e.tiers&&e.tiers.length>0)return e.tiers;return[{upToQuantity:null,microCentsPerUnit:e.microCentsPerUnit??0}]}function Rt(e,t){if(!(e>0))return 0;let r=[...t].sort((s,a)=>{if(s.upToQuantity===null)return 1;if(a.upToQuantity===null)return-1;return s.upToQuantity-a.upToQuantity}),n=e,o=0,i=0;for(let s of r){if(n<=0)break;let d=(s.upToQuantity===null?1/0:s.upToQuantity)-o;if(d<=0)continue;let c=Math.min(n,d);i+=c*s.microCentsPerUnit,n-=c,o+=c}if(n>0){let s=r.reduce((a,d)=>Math.max(a,d.microCentsPerUnit),0);i+=n*s}return i}function Br(e,t,r,n){let o=e.entries.filter((a)=>a.meter===t);if(o.length===0)return;let i=o.filter((a)=>a.provider===r),s=i.length>0?i:o.filter((a)=>a.provider==="*");return s.find((a)=>a.region===n)??s.find((a)=>a.region==null)}function Be(e,t,r=0){let n=Br(e,t.meter,t.provider,t.region),o=Math.max(0,t.quantity);if(!n)return{meter:t.meter,provider:t.provider??"unknown",region:t.region,quantity:o,includedQuantity:0,billableQuantity:o,costCents:0,unpriced:!0};let i=Math.max(0,n.includedQuantity??0),s=Math.max(0,r-i),a=Math.max(0,i-Math.max(0,r)),d=Math.min(o,a),c=o-d,u=Vr(n),m=Rt(s+c,u)-Rt(s,u);return{meter:t.meter,provider:n.provider,region:n.region??t.region,quantity:o,includedQuantity:d,billableQuantity:c,costCents:m/1e6,unpriced:!1}}function li(e,t){let r=new Map,n=[];for(let o of t){let i=`${o.meter}\x00${o.provider??""}\x00${o.region??""}`,s=r.get(i)??0,a=Be(e,o,s);r.set(i,s+a.quantity),n.push(a)}return{currency:e.currency,totalCents:n.reduce((o,i)=>o+i.costCents,0),lines:n,unpricedMeters:[...new Set(n.filter((o)=>o.unpriced).map((o)=>String(o.meter)))]}}function ui(e){return Math.round(e*100)/100}function mi(e,...t){let r=new Map,n=(i)=>`${i.meter}\x00${i.provider}\x00${i.region??""}`;for(let i of e.entries)r.set(n(i),i);let o=e.currency;for(let i of t){o=i.currency||o;for(let s of i.entries)r.set(n(s),s)}return{currency:o,entries:[...r.values()]}}var B=(e)=>Math.round(e*1e6),N=(e)=>Math.round(e*1e6),Ct={currency:"USD",entries:[{meter:"edge.requests",provider:"aws",microCentsPerUnit:N(0.00075)},{meter:"edge.egress_gb",provider:"aws",includedQuantity:100,tiers:[{upToQuantity:10240,microCentsPerUnit:B(8.5)},{upToQuantity:51200,microCentsPerUnit:B(8)},{upToQuantity:null,microCentsPerUnit:B(6)}]},{meter:"function.invocations",provider:"aws",includedQuantity:1e6,microCentsPerUnit:N(0.002)},{meter:"function.gb_seconds",provider:"aws",includedQuantity:400000,microCentsPerUnit:N(0.00166667)},{meter:"storage.gb_hours",provider:"aws",microCentsPerUnit:N(0.010958904109589041)},{meter:"object.egress_gb",provider:"aws",includedQuantity:100,microCentsPerUnit:B(9)},{meter:"object.requests",provider:"aws",microCentsPerUnit:N(0.000039999999999999996)},{meter:"database.gb_hours",provider:"aws",microCentsPerUnit:N(0.015753424657534248)},{meter:"compute.instance_hours",provider:"aws",microCentsPerUnit:N(4.16)},{meter:"edge.egress_gb",provider:"hetzner",includedQuantity:20480,microCentsPerUnit:B(0.108)},{meter:"object.egress_gb",provider:"hetzner",includedQuantity:1024,microCentsPerUnit:B(0.108)},{meter:"compute.instance_hours",provider:"hetzner",microCentsPerUnit:N(0.95)},{meter:"storage.gb_hours",provider:"hetzner",microCentsPerUnit:N(0.006027397260273972)},{meter:"edge.requests",provider:"hetzner",microCentsPerUnit:0},{meter:"edge.requests",provider:"local",microCentsPerUnit:0},{meter:"edge.egress_gb",provider:"local",microCentsPerUnit:0},{meter:"function.invocations",provider:"local",microCentsPerUnit:0},{meter:"function.gb_seconds",provider:"local",microCentsPerUnit:0},{meter:"build.minutes",provider:"*",includedQuantity:6000,microCentsPerUnit:N(0.8)},{meter:"telemetry.ingest_gb",provider:"*",includedQuantity:5,microCentsPerUnit:B(50)},{meter:"image.transformations",provider:"*",includedQuantity:5000,microCentsPerUnit:N(0.05)}]};var Pt=new Map;function Tt(e){let t=Pt.get(e);if(!t)t=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short",hourCycle:"h23"}),Pt.set(e,t);return t}var zr={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};function Se(e){try{return Tt(e),!0}catch{return!1}}function ze(e,t){let r=Tt(t).formatToParts(e),n=(o)=>r.find((i)=>i.type===o)?.value??"0";return{year:Number(n("year")),month:Number(n("month")),day:Number(n("day")),hour:Number(n("hour")),minute:Number(n("minute")),second:Number(n("second")),weekday:zr[n("weekday")]??0}}function kt(e,t){let r=ze(e,t);return Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second)-Math.floor(e.getTime()/1000)*1000}function W(e,t,r,n,o=0){let i=Date.UTC(t,r-1,n,o),s=new Date(i-kt(new Date(i),e));return new Date(i-kt(s,e))}function Ur(e,t){return new Date(Date.UTC(e,t-1,1)).toLocaleString("en-US",{month:"long",year:"numeric",timeZone:"UTC"})}function z(e,t,r=new Date){let n=Se(t)?t:"UTC",o=ze(r,n),i,s,a;if(e==="daily")i=W(n,o.year,o.month,o.day),s=W(n,o.year,o.month,o.day+1),a=`${o.year}-${String(o.month).padStart(2,"0")}-${String(o.day).padStart(2,"0")}`;else if(e==="weekly"){let u=(o.weekday+6)%7;i=W(n,o.year,o.month,o.day-u),s=W(n,o.year,o.month,o.day-u+7);let m=ze(i,n);a=`week of ${m.year}-${String(m.month).padStart(2,"0")}-${String(m.day).padStart(2,"0")}`}else i=W(n,o.year,o.month,1),s=W(n,o.year,o.month+1,1),a=Ur(o.year,o.month);let d=s.getTime()-i.getTime(),c=Math.max(0,Math.min(d,r.getTime()-i.getTime()));return{start:i.toISOString(),end:s.toISOString(),elapsedMs:c,totalMs:d,label:a}}function gi(e,t,r=new Date){let n=z(e,t,r),o=new Date(new Date(n.start).getTime()-1),i=z(e,t,o);return{...i,elapsedMs:i.totalMs}}function ne(e){let r=(typeof e==="string"?new Date(e):e).getTime();if(!Number.isFinite(r))throw Error("hourBucket requires a valid date");return new Date(Math.floor(r/3600000)*3600000).toISOString()}function hi(e,t,r=9600){let n=Math.floor(new Date(e).getTime()/3600000)*3600000,o=new Date(t).getTime();if(!Number.isFinite(n)||!Number.isFinite(o))throw Error("hourBucketsBetween requires valid dates");let i=[];for(let s=n;s<o&&i.length<r;s+=3600000)i.push(new Date(s).toISOString());return i}import{createHash as Fr}from"node:crypto";var Ie=1073741824,Ot=[{match:"request.count",meter:"edge.requests"},{match:"traffic.requests",meter:"edge.requests"},{match:"http.request",meter:"edge.requests",field:"count"},{match:"traffic.bytes_out",meter:"edge.egress_gb",scale:1/Ie},{match:"storage.egress.day",meter:"object.egress_gb",scale:1/Ie},{match:"storage.egress.month",meter:"object.egress_gb",scale:1/Ie,cumulative:!0},{match:"storage.egress.day_downloads",meter:"object.requests"},{match:"function.invocation",meter:"function.invocations",field:"count"},{match:"function.duration_ms",meter:"function.gb_seconds",scale:0.001},{match:"build.duration_ms",meter:"build.minutes",scale:0.000016666666666666667},{match:"telemetry.ingest_bytes",meter:"telemetry.ingest_gb",scale:1/Ie},{match:"image.transform",meter:"image.transformations",field:"count"}];function Hr(e,t){return e.match.endsWith("*")?t.startsWith(e.match.slice(0,-1)):e.match===t}function Qr(e,t=Ot){return t.find((r)=>!r.match.endsWith("*")&&r.match===e)??t.find((r)=>Hr(r,e))}function Jr(e,t){let r=t.field??"value",n=r==="count"?1:r==="bytesOut"?e.bytesOut:r==="bytesIn"?e.bytesIn:r==="durationMs"?e.durationMs:e.value;if(n==null||!Number.isFinite(n))return;return n*(t.scale??1)}function Wr(e,t){return Fr("sha256").update([t,e.meter,e.organizationId,e.projectId??"",e.environmentId??"",e.resourceId??"",e.timestamp].join("\x00")).digest("hex").slice(0,32)}class Ue{resetToleranceRatio;last=new Map;constructor(e=0.999){this.resetToleranceRatio=e}delta(e,t,r=new Date){if(!Number.isFinite(t)||t<0)return;let n=new Date(r).getTime(),o=this.last.get(e);if(!o)return this.last.set(e,{value:t,at:n}),t>0?t:void 0;if(n<o.at)return;if(t<o.value&&t>=o.value*this.resetToleranceRatio)return;if(this.last.set(e,{value:t,at:n}),t>=o.value){let i=t-o.value;return i>0?i:void 0}return t>0?t:void 0}prune(e){let t=e.getTime(),r=0;for(let[n,o]of this.last)if(o.at<t)this.last.delete(n),r++;return r}get size(){return this.last.size}}function Dt(e,t){let r=e[t];return typeof r==="string"&&r.length>0?r:void 0}function xt(e,t,r={}){let n=r.mappings??Ot,o=r.counters,i=[];for(let s of t){let a=Qr(s.name,n);if(!a)continue;let d=Jr(s,a);if(d==null)continue;if(a.cumulative){if(!o)continue;let u=[s.projectId,s.environmentId??"",s.resourceId??"",s.name,s.source].join("\x00"),m=o.delta(u,d,s.timestamp);if(m==null)continue;d=m}if(!(d>0))continue;let c={organizationId:e,projectId:s.projectId,environmentId:s.environmentId,resourceId:s.resourceId,provider:Dt(s.attributes,"provider")??r.defaultProvider,region:s.region??Dt(s.attributes,"region"),meter:a.meter,quantity:d,timestamp:s.timestamp,attributes:{source:s.source,signal:s.name}};i.push({...c,key:Wr(c,s.id)})}return i}function Nt(e){let t=new Map;for(let r of e){let n=new Date(Math.floor(new Date(r.timestamp).getTime()/3600000)*3600000).toISOString(),o=[r.organizationId,r.projectId??"",r.environmentId??"",r.resourceId??"",r.provider??"",r.region??"",r.meter,n].join("\x00"),i=t.get(o);if(i)i.quantity+=r.quantity;else t.set(o,{...r,timestamp:n})}return[...t.values()]}import{createHash as Kr}from"node:crypto";var oe=(e)=>{if(typeof e!=="string")return{};try{return JSON.parse(e)}catch{return{}}},j=(e)=>typeof e==="string"&&e!==""?e:void 0,_e=(e)=>Number(e)===1,jt=(e)=>e==null?void 0:Number(e);function Mt(e){return{id:String(e.id),organizationId:String(e.organization_id),projectId:j(e.project_id),environmentId:j(e.environment_id),name:String(e.name),period:String(e.period),timezone:String(e.timezone),currency:String(e.currency),softLimitCents:jt(e.soft_limit_cents),hardLimitCents:jt(e.hard_limit_cents),thresholds:oe(e.thresholds),meters:oe(e.meters),graceSeconds:Number(e.grace_seconds),hysteresisPercent:Number(e.hysteresis_percent),dryRun:_e(e.dry_run),enabled:_e(e.enabled),version:Number(e.version),createdAt:String(e.created_at),updatedAt:String(e.updated_at)}}function Fe(e){return{id:String(e.id),budgetId:String(e.budget_id),organizationId:String(e.organization_id),projectId:j(e.project_id),environmentId:j(e.environment_id),action:String(e.action),state:String(e.state),reason:String(e.reason),restore:oe(e.restore),triggeredAtPercent:Number(e.triggered_at_percent),simulated:_e(e.simulated),appliedAt:j(e.applied_at),releasedAt:j(e.released_at),error:j(e.error),createdAt:String(e.created_at),updatedAt:String(e.updated_at)}}function Lt(e){return{id:String(e.id),organizationId:String(e.organization_id),projectId:j(e.project_id),environmentId:j(e.environment_id),signal:String(e.signal),direction:String(e.direction),observed:Number(e.observed),expected:Number(e.expected),score:Number(e.score),deltaPercent:Number(e.delta_percent),severity:String(e.severity),bucketStart:String(e.bucket_start),evidence:oe(e.evidence),acknowledgedAt:j(e.acknowledged_at),createdAt:String(e.created_at)}}function Gr(e){return{organizationId:String(e.organization_id),projectId:String(e.project_id),environmentId:String(e.environment_id),resourceId:String(e.resource_id),provider:String(e.provider),region:String(e.region),meter:String(e.meter),bucketStart:String(e.bucket_start),quantity:Number(e.quantity),costCents:Number(e.cost_cents),sampleCount:Number(e.sample_count),updatedAt:String(e.updated_at)}}function U(e,t,r){return[e,t??"",r??""].join("/")}var Yr=[{atPercent:50,actions:["notify"]},{atPercent:80,actions:["notify"]},{atPercent:100,actions:["notify"],onProjection:!0},{atPercent:100,actions:["notify","block_builds","block_deployments"]},{atPercent:115,actions:["notify","block_builds","block_deployments","throttle_requests"]}];class Zr{controlPlane;options;constructor(e,t={}){this.controlPlane=e;this.options=t}now(){return(this.options.now?.()??new Date).toISOString()}get priceBook(){return this.options.priceBook??Ct}query(e,t=[]){return this.controlPlane.database.query(e).all(...t)}createBudget(e){let t=e.name.trim();if(!t)throw Error("Budgets require a name.");if(e.softLimitCents==null&&e.hardLimitCents==null)throw Error("A budget needs a soft limit, a hard limit, or both.");if(e.softLimitCents!=null&&e.hardLimitCents!=null&&e.softLimitCents>e.hardLimitCents)throw Error("The soft limit must not exceed the hard limit.");let r=e.timezone??"UTC";if(!Se(r))throw Error(`Unknown timezone: ${r}`);let n=(e.thresholds??[...Yr]).filter((s)=>Number.isFinite(s.atPercent)&&s.atPercent>=0);if(e.environmentId&&!e.projectId)throw Error("An environment-scoped budget must also name its project.");let o=crypto.randomUUID(),i=this.now();return this.controlPlane.database.run("INSERT INTO spend_budgets (id,organization_id,project_id,environment_id,name,period,timezone,currency,soft_limit_cents,hard_limit_cents,thresholds,meters,grace_seconds,hysteresis_percent,dry_run,enabled,version,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,1,?,?)",[o,e.organizationId,e.projectId??null,e.environmentId??null,t,e.period,r,e.currency??"USD",e.softLimitCents??null,e.hardLimitCents??null,JSON.stringify(n),JSON.stringify(e.meters??[]),Math.max(0,Math.floor(e.graceSeconds??0)),Math.max(0,e.hysteresisPercent??5),e.dryRun?1:0,e.enabled===!1?0:1,i,i]),this.getBudget(o)}getBudget(e){let t=this.query("SELECT * FROM spend_budgets WHERE id = ?",[e])[0];return t?Mt(t):void 0}listBudgets(e){let t=["organization_id = ?"],r=[e.organizationId];if(e.projectId)t.push("(project_id IS NULL OR project_id = ?)"),r.push(e.projectId);if(e.enabledOnly)t.push("enabled = 1");return this.query(`SELECT * FROM spend_budgets WHERE ${t.join(" AND ")} ORDER BY created_at`,r).map(Mt)}budgetsForScope(e,t,r){return this.listBudgets({organizationId:e,enabledOnly:!0}).filter((n)=>{if(n.projectId&&n.projectId!==t)return!1;if(n.environmentId&&n.environmentId!==r)return!1;return!0}).sort((n,o)=>Number(!!n.projectId)-Number(!!o.projectId)||Number(!!n.environmentId)-Number(!!o.environmentId))}updateBudget(e,t,r){let n=this.getBudget(e);if(!n)throw Error("Budget was not found.");if(r!=null&&r!==n.version)throw Error(`Budget was modified concurrently (expected version ${r}, found ${n.version}).`);let o={...n,...t};if(o.softLimitCents==null&&o.hardLimitCents==null)throw Error("A budget needs a soft limit, a hard limit, or both.");if(o.softLimitCents!=null&&o.hardLimitCents!=null&&o.softLimitCents>o.hardLimitCents)throw Error("The soft limit must not exceed the hard limit.");if(t.timezone&&!Se(t.timezone))throw Error(`Unknown timezone: ${t.timezone}`);return this.controlPlane.database.run("UPDATE spend_budgets SET name=?,period=?,timezone=?,currency=?,soft_limit_cents=?,hard_limit_cents=?,thresholds=?,meters=?,grace_seconds=?,hysteresis_percent=?,dry_run=?,enabled=?,version=version+1,updated_at=? WHERE id=?",[o.name,o.period,o.timezone,o.currency??"USD",o.softLimitCents??null,o.hardLimitCents??null,JSON.stringify(o.thresholds??[]),JSON.stringify(o.meters??[]),Math.max(0,Math.floor(o.graceSeconds??0)),Math.max(0,o.hysteresisPercent??5),o.dryRun?1:0,o.enabled===!1?0:1,this.now(),e]),this.getBudget(e)}deleteBudget(e){return this.controlPlane.database.run("DELETE FROM spend_budgets WHERE id = ?",[e]).changes>0}ingestUsage(e){let t={applied:0,duplicates:0,costCents:0,unpricedMeters:[]},r=new Set,n=this.now();return this.controlPlane.database.transaction((i)=>{for(let s of i){if(!(s.quantity>0)||!Number.isFinite(s.quantity))continue;let a=s.key??this.deltaFallbackKey(s);if(this.controlPlane.database.run("INSERT OR IGNORE INTO spend_usage_receipts (key,organization_id,bucket_start,created_at) VALUES (?,?,?,?)",[a,s.organizationId,ne(s.timestamp),n]).changes===0){t.duplicates++;continue}let c={projectId:s.projectId??"",environmentId:s.environmentId??"",resourceId:s.resourceId??"",provider:s.provider??"",region:s.region??""},u=this.periodQuantity(s),m=Be(this.priceBook,{meter:s.meter,quantity:s.quantity,provider:s.provider,region:s.region},u);if(m.unpriced)r.add(String(s.meter));this.controlPlane.database.run(`INSERT INTO spend_usage (organization_id,project_id,environment_id,resource_id,provider,region,meter,bucket_start,quantity,cost_cents,sample_count,updated_at)
1
+ import{vf as lt}from"./chunk-85qrgshq.js";import{Og as Lr,Qg as _}from"./chunk-jxd3j00s.js";var si=["edge.requests","edge.egress_gb","function.invocations","function.gb_seconds","build.minutes","compute.instance_hours","storage.gb_hours","object.egress_gb","object.requests","database.gb_hours","database.io_requests","telemetry.ingest_gb","image.transformations"],Ve={"edge.requests":{key:"edge.requests",unit:"requests",label:"Edge requests",precision:0},"edge.egress_gb":{key:"edge.egress_gb",unit:"gb",label:"Edge egress",precision:3},"function.invocations":{key:"function.invocations",unit:"invocations",label:"Function invocations",precision:0},"function.gb_seconds":{key:"function.gb_seconds",unit:"gb_seconds",label:"Function compute",precision:2},"build.minutes":{key:"build.minutes",unit:"minutes",label:"Build minutes",precision:2},"compute.instance_hours":{key:"compute.instance_hours",unit:"hours",label:"Instance hours",precision:2},"storage.gb_hours":{key:"storage.gb_hours",unit:"gb_hours",label:"Block storage",precision:2},"object.egress_gb":{key:"object.egress_gb",unit:"gb",label:"Object storage egress",precision:3},"object.requests":{key:"object.requests",unit:"requests",label:"Object storage requests",precision:0},"database.gb_hours":{key:"database.gb_hours",unit:"gb_hours",label:"Database storage",precision:2},"database.io_requests":{key:"database.io_requests",unit:"requests",label:"Database I/O",precision:0},"telemetry.ingest_gb":{key:"telemetry.ingest_gb",unit:"gb",label:"Telemetry ingest",precision:3},"image.transformations":{key:"image.transformations",unit:"count",label:"Image transformations",precision:0}},ai=["notify","block_builds","block_deployments","throttle_requests","suspend_functions","serve_static","suspend_project"],D={notify:0,block_builds:1,block_deployments:2,throttle_requests:3,suspend_functions:4,serve_static:5,suspend_project:6};var ci=1e6;function Vr(e){if(e.tiers&&e.tiers.length>0)return e.tiers;return[{upToQuantity:null,microCentsPerUnit:e.microCentsPerUnit??0}]}function Rt(e,t){if(!(e>0))return 0;let r=[...t].sort((s,a)=>{if(s.upToQuantity===null)return 1;if(a.upToQuantity===null)return-1;return s.upToQuantity-a.upToQuantity}),n=e,o=0,i=0;for(let s of r){if(n<=0)break;let d=(s.upToQuantity===null?1/0:s.upToQuantity)-o;if(d<=0)continue;let c=Math.min(n,d);i+=c*s.microCentsPerUnit,n-=c,o+=c}if(n>0){let s=r.reduce((a,d)=>Math.max(a,d.microCentsPerUnit),0);i+=n*s}return i}function Br(e,t,r,n){let o=e.entries.filter((a)=>a.meter===t);if(o.length===0)return;let i=o.filter((a)=>a.provider===r),s=i.length>0?i:o.filter((a)=>a.provider==="*");return s.find((a)=>a.region===n)??s.find((a)=>a.region==null)}function Be(e,t,r=0){let n=Br(e,t.meter,t.provider,t.region),o=Math.max(0,t.quantity);if(!n)return{meter:t.meter,provider:t.provider??"unknown",region:t.region,quantity:o,includedQuantity:0,billableQuantity:o,costCents:0,unpriced:!0};let i=Math.max(0,n.includedQuantity??0),s=Math.max(0,r-i),a=Math.max(0,i-Math.max(0,r)),d=Math.min(o,a),c=o-d,u=Vr(n),m=Rt(s+c,u)-Rt(s,u);return{meter:t.meter,provider:n.provider,region:n.region??t.region,quantity:o,includedQuantity:d,billableQuantity:c,costCents:m/1e6,unpriced:!1}}function li(e,t){let r=new Map,n=[];for(let o of t){let i=`${o.meter}\x00${o.provider??""}\x00${o.region??""}`,s=r.get(i)??0,a=Be(e,o,s);r.set(i,s+a.quantity),n.push(a)}return{currency:e.currency,totalCents:n.reduce((o,i)=>o+i.costCents,0),lines:n,unpricedMeters:[...new Set(n.filter((o)=>o.unpriced).map((o)=>String(o.meter)))]}}function ui(e){return Math.round(e*100)/100}function mi(e,...t){let r=new Map,n=(i)=>`${i.meter}\x00${i.provider}\x00${i.region??""}`;for(let i of e.entries)r.set(n(i),i);let o=e.currency;for(let i of t){o=i.currency||o;for(let s of i.entries)r.set(n(s),s)}return{currency:o,entries:[...r.values()]}}var B=(e)=>Math.round(e*1e6),N=(e)=>Math.round(e*1e6),Ct={currency:"USD",entries:[{meter:"edge.requests",provider:"aws",microCentsPerUnit:N(0.00075)},{meter:"edge.egress_gb",provider:"aws",includedQuantity:100,tiers:[{upToQuantity:10240,microCentsPerUnit:B(8.5)},{upToQuantity:51200,microCentsPerUnit:B(8)},{upToQuantity:null,microCentsPerUnit:B(6)}]},{meter:"function.invocations",provider:"aws",includedQuantity:1e6,microCentsPerUnit:N(0.002)},{meter:"function.gb_seconds",provider:"aws",includedQuantity:400000,microCentsPerUnit:N(0.00166667)},{meter:"storage.gb_hours",provider:"aws",microCentsPerUnit:N(0.010958904109589041)},{meter:"object.egress_gb",provider:"aws",includedQuantity:100,microCentsPerUnit:B(9)},{meter:"object.requests",provider:"aws",microCentsPerUnit:N(0.000039999999999999996)},{meter:"database.gb_hours",provider:"aws",microCentsPerUnit:N(0.015753424657534248)},{meter:"compute.instance_hours",provider:"aws",microCentsPerUnit:N(4.16)},{meter:"edge.egress_gb",provider:"hetzner",includedQuantity:20480,microCentsPerUnit:B(0.108)},{meter:"object.egress_gb",provider:"hetzner",includedQuantity:1024,microCentsPerUnit:B(0.108)},{meter:"compute.instance_hours",provider:"hetzner",microCentsPerUnit:N(0.95)},{meter:"storage.gb_hours",provider:"hetzner",microCentsPerUnit:N(0.006027397260273972)},{meter:"edge.requests",provider:"hetzner",microCentsPerUnit:0},{meter:"edge.requests",provider:"local",microCentsPerUnit:0},{meter:"edge.egress_gb",provider:"local",microCentsPerUnit:0},{meter:"function.invocations",provider:"local",microCentsPerUnit:0},{meter:"function.gb_seconds",provider:"local",microCentsPerUnit:0},{meter:"build.minutes",provider:"*",includedQuantity:6000,microCentsPerUnit:N(0.8)},{meter:"telemetry.ingest_gb",provider:"*",includedQuantity:5,microCentsPerUnit:B(50)},{meter:"image.transformations",provider:"*",includedQuantity:5000,microCentsPerUnit:N(0.05)}]};var Pt=new Map;function Tt(e){let t=Pt.get(e);if(!t)t=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short",hourCycle:"h23"}),Pt.set(e,t);return t}var zr={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};function Se(e){try{return Tt(e),!0}catch{return!1}}function ze(e,t){let r=Tt(t).formatToParts(e),n=(o)=>r.find((i)=>i.type===o)?.value??"0";return{year:Number(n("year")),month:Number(n("month")),day:Number(n("day")),hour:Number(n("hour")),minute:Number(n("minute")),second:Number(n("second")),weekday:zr[n("weekday")]??0}}function kt(e,t){let r=ze(e,t);return Date.UTC(r.year,r.month-1,r.day,r.hour,r.minute,r.second)-Math.floor(e.getTime()/1000)*1000}function W(e,t,r,n,o=0){let i=Date.UTC(t,r-1,n,o),s=new Date(i-kt(new Date(i),e));return new Date(i-kt(s,e))}function Ur(e,t){return new Date(Date.UTC(e,t-1,1)).toLocaleString("en-US",{month:"long",year:"numeric",timeZone:"UTC"})}function z(e,t,r=new Date){let n=Se(t)?t:"UTC",o=ze(r,n),i,s,a;if(e==="daily")i=W(n,o.year,o.month,o.day),s=W(n,o.year,o.month,o.day+1),a=`${o.year}-${String(o.month).padStart(2,"0")}-${String(o.day).padStart(2,"0")}`;else if(e==="weekly"){let u=(o.weekday+6)%7;i=W(n,o.year,o.month,o.day-u),s=W(n,o.year,o.month,o.day-u+7);let m=ze(i,n);a=`week of ${m.year}-${String(m.month).padStart(2,"0")}-${String(m.day).padStart(2,"0")}`}else i=W(n,o.year,o.month,1),s=W(n,o.year,o.month+1,1),a=Ur(o.year,o.month);let d=s.getTime()-i.getTime(),c=Math.max(0,Math.min(d,r.getTime()-i.getTime()));return{start:i.toISOString(),end:s.toISOString(),elapsedMs:c,totalMs:d,label:a}}function gi(e,t,r=new Date){let n=z(e,t,r),o=new Date(new Date(n.start).getTime()-1),i=z(e,t,o);return{...i,elapsedMs:i.totalMs}}function ne(e){let r=(typeof e==="string"?new Date(e):e).getTime();if(!Number.isFinite(r))throw Error("hourBucket requires a valid date");return new Date(Math.floor(r/3600000)*3600000).toISOString()}function hi(e,t,r=9600){let n=Math.floor(new Date(e).getTime()/3600000)*3600000,o=new Date(t).getTime();if(!Number.isFinite(n)||!Number.isFinite(o))throw Error("hourBucketsBetween requires valid dates");let i=[];for(let s=n;s<o&&i.length<r;s+=3600000)i.push(new Date(s).toISOString());return i}import{createHash as Fr}from"node:crypto";var Ie=1073741824,Ot=[{match:"request.count",meter:"edge.requests"},{match:"traffic.requests",meter:"edge.requests"},{match:"http.request",meter:"edge.requests",field:"count"},{match:"traffic.bytes_out",meter:"edge.egress_gb",scale:1/Ie},{match:"storage.egress.day",meter:"object.egress_gb",scale:1/Ie},{match:"storage.egress.month",meter:"object.egress_gb",scale:1/Ie,cumulative:!0},{match:"storage.egress.day_downloads",meter:"object.requests"},{match:"function.invocation",meter:"function.invocations",field:"count"},{match:"function.duration_ms",meter:"function.gb_seconds",scale:0.001},{match:"build.duration_ms",meter:"build.minutes",scale:0.000016666666666666667},{match:"telemetry.ingest_bytes",meter:"telemetry.ingest_gb",scale:1/Ie},{match:"image.transform",meter:"image.transformations",field:"count"}];function Hr(e,t){return e.match.endsWith("*")?t.startsWith(e.match.slice(0,-1)):e.match===t}function Qr(e,t=Ot){return t.find((r)=>!r.match.endsWith("*")&&r.match===e)??t.find((r)=>Hr(r,e))}function Jr(e,t){let r=t.field??"value",n=r==="count"?1:r==="bytesOut"?e.bytesOut:r==="bytesIn"?e.bytesIn:r==="durationMs"?e.durationMs:e.value;if(n==null||!Number.isFinite(n))return;return n*(t.scale??1)}function Wr(e,t){return Fr("sha256").update([t,e.meter,e.organizationId,e.projectId??"",e.environmentId??"",e.resourceId??"",e.timestamp].join("\x00")).digest("hex").slice(0,32)}class Ue{resetToleranceRatio;last=new Map;constructor(e=0.999){this.resetToleranceRatio=e}delta(e,t,r=new Date){if(!Number.isFinite(t)||t<0)return;let n=new Date(r).getTime(),o=this.last.get(e);if(!o)return this.last.set(e,{value:t,at:n}),t>0?t:void 0;if(n<o.at)return;if(t<o.value&&t>=o.value*this.resetToleranceRatio)return;if(this.last.set(e,{value:t,at:n}),t>=o.value){let i=t-o.value;return i>0?i:void 0}return t>0?t:void 0}prune(e){let t=e.getTime(),r=0;for(let[n,o]of this.last)if(o.at<t)this.last.delete(n),r++;return r}get size(){return this.last.size}}function Dt(e,t){let r=e[t];return typeof r==="string"&&r.length>0?r:void 0}function xt(e,t,r={}){let n=r.mappings??Ot,o=r.counters,i=[];for(let s of t){let a=Qr(s.name,n);if(!a)continue;let d=Jr(s,a);if(d==null)continue;if(a.cumulative){if(!o)continue;let u=[s.projectId,s.environmentId??"",s.resourceId??"",s.name,s.source].join("\x00"),m=o.delta(u,d,s.timestamp);if(m==null)continue;d=m}if(!(d>0))continue;let c={organizationId:e,projectId:s.projectId,environmentId:s.environmentId,resourceId:s.resourceId,provider:Dt(s.attributes,"provider")??r.defaultProvider,region:s.region??Dt(s.attributes,"region"),meter:a.meter,quantity:d,timestamp:s.timestamp,attributes:{source:s.source,signal:s.name}};i.push({...c,key:Wr(c,s.id)})}return i}function Nt(e){let t=new Map;for(let r of e){let n=new Date(Math.floor(new Date(r.timestamp).getTime()/3600000)*3600000).toISOString(),o=[r.organizationId,r.projectId??"",r.environmentId??"",r.resourceId??"",r.provider??"",r.region??"",r.meter,n].join("\x00"),i=t.get(o);if(i)i.quantity+=r.quantity;else t.set(o,{...r,timestamp:n})}return[...t.values()]}import{createHash as Kr}from"node:crypto";var oe=(e)=>{if(typeof e!=="string")return{};try{return JSON.parse(e)}catch{return{}}},j=(e)=>typeof e==="string"&&e!==""?e:void 0,_e=(e)=>Number(e)===1,jt=(e)=>e==null?void 0:Number(e);function Mt(e){return{id:String(e.id),organizationId:String(e.organization_id),projectId:j(e.project_id),environmentId:j(e.environment_id),name:String(e.name),period:String(e.period),timezone:String(e.timezone),currency:String(e.currency),softLimitCents:jt(e.soft_limit_cents),hardLimitCents:jt(e.hard_limit_cents),thresholds:oe(e.thresholds),meters:oe(e.meters),graceSeconds:Number(e.grace_seconds),hysteresisPercent:Number(e.hysteresis_percent),dryRun:_e(e.dry_run),enabled:_e(e.enabled),version:Number(e.version),createdAt:String(e.created_at),updatedAt:String(e.updated_at)}}function Fe(e){return{id:String(e.id),budgetId:String(e.budget_id),organizationId:String(e.organization_id),projectId:j(e.project_id),environmentId:j(e.environment_id),action:String(e.action),state:String(e.state),reason:String(e.reason),restore:oe(e.restore),triggeredAtPercent:Number(e.triggered_at_percent),simulated:_e(e.simulated),appliedAt:j(e.applied_at),releasedAt:j(e.released_at),error:j(e.error),createdAt:String(e.created_at),updatedAt:String(e.updated_at)}}function Lt(e){return{id:String(e.id),organizationId:String(e.organization_id),projectId:j(e.project_id),environmentId:j(e.environment_id),signal:String(e.signal),direction:String(e.direction),observed:Number(e.observed),expected:Number(e.expected),score:Number(e.score),deltaPercent:Number(e.delta_percent),severity:String(e.severity),bucketStart:String(e.bucket_start),evidence:oe(e.evidence),acknowledgedAt:j(e.acknowledged_at),createdAt:String(e.created_at)}}function Gr(e){return{organizationId:String(e.organization_id),projectId:String(e.project_id),environmentId:String(e.environment_id),resourceId:String(e.resource_id),provider:String(e.provider),region:String(e.region),meter:String(e.meter),bucketStart:String(e.bucket_start),quantity:Number(e.quantity),costCents:Number(e.cost_cents),sampleCount:Number(e.sample_count),updatedAt:String(e.updated_at)}}function U(e,t,r){return[e,t??"",r??""].join("/")}var Yr=[{atPercent:50,actions:["notify"]},{atPercent:80,actions:["notify"]},{atPercent:100,actions:["notify"],onProjection:!0},{atPercent:100,actions:["notify","block_builds","block_deployments"]},{atPercent:115,actions:["notify","block_builds","block_deployments","throttle_requests"]}];class Zr{controlPlane;options;constructor(e,t={}){this.controlPlane=e;this.options=t}now(){return(this.options.now?.()??new Date).toISOString()}get priceBook(){return this.options.priceBook??Ct}query(e,t=[]){return this.controlPlane.database.query(e).all(...t)}createBudget(e){let t=e.name.trim();if(!t)throw Error("Budgets require a name.");if(e.softLimitCents==null&&e.hardLimitCents==null)throw Error("A budget needs a soft limit, a hard limit, or both.");if(e.softLimitCents!=null&&e.hardLimitCents!=null&&e.softLimitCents>e.hardLimitCents)throw Error("The soft limit must not exceed the hard limit.");let r=e.timezone??"UTC";if(!Se(r))throw Error(`Unknown timezone: ${r}`);let n=(e.thresholds??[...Yr]).filter((s)=>Number.isFinite(s.atPercent)&&s.atPercent>=0);if(e.environmentId&&!e.projectId)throw Error("An environment-scoped budget must also name its project.");let o=crypto.randomUUID(),i=this.now();return this.controlPlane.database.run("INSERT INTO spend_budgets (id,organization_id,project_id,environment_id,name,period,timezone,currency,soft_limit_cents,hard_limit_cents,thresholds,meters,grace_seconds,hysteresis_percent,dry_run,enabled,version,created_at,updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,1,?,?)",[o,e.organizationId,e.projectId??null,e.environmentId??null,t,e.period,r,e.currency??"USD",e.softLimitCents??null,e.hardLimitCents??null,JSON.stringify(n),JSON.stringify(e.meters??[]),Math.max(0,Math.floor(e.graceSeconds??0)),Math.max(0,e.hysteresisPercent??5),e.dryRun?1:0,e.enabled===!1?0:1,i,i]),this.getBudget(o)}getBudget(e){let t=this.query("SELECT * FROM spend_budgets WHERE id = ?",[e])[0];return t?Mt(t):void 0}listBudgets(e){let t=["organization_id = ?"],r=[e.organizationId];if(e.projectId)t.push("(project_id IS NULL OR project_id = ?)"),r.push(e.projectId);if(e.enabledOnly)t.push("enabled = 1");return this.query(`SELECT * FROM spend_budgets WHERE ${t.join(" AND ")} ORDER BY created_at`,r).map(Mt)}budgetsForScope(e,t,r){return this.listBudgets({organizationId:e,enabledOnly:!0}).filter((n)=>{if(n.projectId&&n.projectId!==t)return!1;if(n.environmentId&&n.environmentId!==r)return!1;return!0}).sort((n,o)=>Number(!!n.projectId)-Number(!!o.projectId)||Number(!!n.environmentId)-Number(!!o.environmentId))}updateBudget(e,t,r){let n=this.getBudget(e);if(!n)throw Error("Budget was not found.");if(r!=null&&r!==n.version)throw Error(`Budget was modified concurrently (expected version ${r}, found ${n.version}).`);let o={...n,...t};if(o.softLimitCents==null&&o.hardLimitCents==null)throw Error("A budget needs a soft limit, a hard limit, or both.");if(o.softLimitCents!=null&&o.hardLimitCents!=null&&o.softLimitCents>o.hardLimitCents)throw Error("The soft limit must not exceed the hard limit.");if(t.timezone&&!Se(t.timezone))throw Error(`Unknown timezone: ${t.timezone}`);return this.controlPlane.database.run("UPDATE spend_budgets SET name=?,period=?,timezone=?,currency=?,soft_limit_cents=?,hard_limit_cents=?,thresholds=?,meters=?,grace_seconds=?,hysteresis_percent=?,dry_run=?,enabled=?,version=version+1,updated_at=? WHERE id=?",[o.name,o.period,o.timezone,o.currency??"USD",o.softLimitCents??null,o.hardLimitCents??null,JSON.stringify(o.thresholds??[]),JSON.stringify(o.meters??[]),Math.max(0,Math.floor(o.graceSeconds??0)),Math.max(0,o.hysteresisPercent??5),o.dryRun?1:0,o.enabled===!1?0:1,this.now(),e]),this.getBudget(e)}deleteBudget(e){return this.controlPlane.database.run("DELETE FROM spend_budgets WHERE id = ?",[e]).changes>0}ingestUsage(e){let t={applied:0,duplicates:0,costCents:0,unpricedMeters:[]},r=new Set,n=this.now();return this.controlPlane.database.transaction((i)=>{for(let s of i){if(!(s.quantity>0)||!Number.isFinite(s.quantity))continue;let a=s.key??this.deltaFallbackKey(s);if(this.controlPlane.database.run("INSERT OR IGNORE INTO spend_usage_receipts (key,organization_id,bucket_start,created_at) VALUES (?,?,?,?)",[a,s.organizationId,ne(s.timestamp),n]).changes===0){t.duplicates++;continue}let c={projectId:s.projectId??"",environmentId:s.environmentId??"",resourceId:s.resourceId??"",provider:s.provider??"",region:s.region??""},u=this.periodQuantity(s),m=Be(this.priceBook,{meter:s.meter,quantity:s.quantity,provider:s.provider,region:s.region},u);if(m.unpriced)r.add(String(s.meter));this.controlPlane.database.run(`INSERT INTO spend_usage (organization_id,project_id,environment_id,resource_id,provider,region,meter,bucket_start,quantity,cost_cents,sample_count,updated_at)
2
2
  VALUES (?,?,?,?,?,?,?,?,?,?,1,?)
3
3
  ON CONFLICT(organization_id,project_id,environment_id,resource_id,provider,region,meter,bucket_start) DO UPDATE SET
4
4
  quantity = quantity + excluded.quantity,
@@ -3,4 +3,4 @@ import*as _ from"node:crypto";import{existsSync as V,readFileSync as Y}from"node
3
3
  `).join(""),l=u.map((E)=>E.toLowerCase()).join(";"),C=[s,A,b,c,l,f].join(`
4
4
  `),y="AWS4-HMAC-SHA256",S=r;if(r==="email")S="ses";let x=`${g}/${i}/${S}/aws4_request`,K=[y,p,x,this.sha256(C)].join(`
5
5
  `),F=this.getSignatureKey(e.secretAccessKey,g,i,S),q=this.hmac(F,K),U=`${y} Credential=${e.accessKeyId}/${x}, SignedHeaders=${l}, Signature=${q}`;return{...m,Authorization:U}}getAmzDate(t){return t.toISOString().replace(/[:-]|\.\d{3}/g,"")}getDateStamp(t){return t.toISOString().slice(0,10).replace(/-/g,"")}uriEncode(t){return encodeURIComponent(t).replace(/[!'()*]/g,(e)=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}sha256(t){return _.createHash("sha256").update(t,"utf8").digest("hex")}hmac(t,e){return _.createHmac("sha256",t).update(e,"utf8").digest("hex")}getSignatureKey(t,e,r,i){let s=_.createHmac("sha256",`AWS4${t}`).update(e).digest(),n=_.createHmac("sha256",s).update(r).digest(),a=_.createHmac("sha256",n).update(i).digest();return _.createHmac("sha256",a).update("aws4_request").digest()}parseXmlResponse(t){try{let e=this.xmlParser.parse(t);if(e.ErrorResponse)throw this.createErrorFromXml(e.ErrorResponse.Error);let r=Object.keys(e);if(r.length===1)return e[r[0]];return e}catch(e){if(e.code||e.statusCode)throw e;return{}}}parseError(t,e,r){let i=Error();if(i.statusCode=e,i.requestId=r.get("x-amzn-requestid")||r.get("x-amz-request-id")||void 0,t.startsWith("<"))try{let s=this.xmlParser.parse(t);if(s.ErrorResponse?.Error){let n=s.ErrorResponse.Error;return i.code=n.Code,i.message=`AWS Error [${n.Code}]: ${n.Message||"Unknown error"}`,i.type=n.Type,i}if(s.Error)return i.code=s.Error.Code,i.message=`AWS Error [${s.Error.Code}]: ${s.Error.Message||"Unknown error"}`,i}catch{}try{let s=JSON.parse(t);if(s.__type||s.code)return i.code=s.__type||s.code,i.message=`AWS Error [${i.code}]: ${s.message||s.Message||"Unknown error"}`,i}catch{}return i.message=`AWS API Error (${e}): ${t}`,i}createErrorFromXml(t){let e=Error();return e.code=t.Code,e.message=`AWS Error [${t.Code}]: ${t.Message||"Unknown error"}`,e.type=t.Type,e}isRetryableError(t){return["RequestTimeout","RequestTimeoutException","PriorRequestNotComplete","ConnectionError","ThrottlingException","Throttling","TooManyRequestsException","ProvisionedThroughputExceededException","RequestLimitExceeded","BandwidthLimitExceeded","SlowDown","ServiceUnavailable","ServiceUnavailableException","InternalError","InternalFailure","InternalServerError","InternalServiceException","TransientError","TransientFailure","IDPCommunicationErrorException","NetworkError","ConnectionRefusedException","EC2ThrottledException","503 Slow Down","500 InternalError"].includes(t)}isRetryableStatusCode(t){return t>=500||t===429}shouldRetry(t){if(t.name==="FetchError"||t.name==="TypeError"||t.code==="ECONNRESET")return!0;if(t.code&&this.isRetryableError(t.code))return!0;if(t.statusCode&&this.isRetryableStatusCode(t.statusCode))return!0;if(t.statusCode&&t.statusCode>=400&&t.statusCode<500&&t.statusCode!==429)return!1;if(t.statusCode)return!1;return!0}calculateRetryDelay(t){let e=this.config.retryDelay??1000,r=30000,i=Math.min(e*2**t,30000),s=Math.random()*0.3*i;return i+s}sleep(t){return new Promise((e)=>setTimeout(e,t))}getFromCache(t){let e=this.cache.get(t);if(!e)return null;if(Date.now()>e.expires)return this.cache.delete(t),null;return e.data}setInCache(t,e,r){this.cache.set(t,{data:e,expires:Date.now()+r})}clearCache(){this.cache.clear()}clearExpiredCache(){let t=Date.now();for(let[e,r]of this.cache.entries())if(t>r.expires)this.cache.delete(e)}}function ie(t){let e={};for(let[r,i]of Object.entries(t)){if(i===void 0||i===null)continue;if(Array.isArray(i))i.forEach((s,n)=>{e[`${r}.${n+1}`]=String(s)});else if(typeof i==="object")for(let[s,n]of Object.entries(i))e[`${r}.${s}`]=String(n);else e[r]=String(i)}return e}function se(){let t=process.env.AWS_ACCESS_KEY_ID,e=process.env.AWS_SECRET_ACCESS_KEY,r=t==="",i=e==="";if(t&&e)return{source:"env",emptyEnvKey:r,emptyEnvSecret:i,description:"environment variables (AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY)"};let s=process.env.AWS_PROFILE||"default",n=process.env.AWS_SHARED_CREDENTIALS_FILE||B(W(),".aws","credentials");if(V(n))return{source:"file",profile:s,emptyEnvKey:r,emptyEnvSecret:i,description:`~/.aws/credentials (profile: ${s})`};return{source:"ec2",emptyEnvKey:r,emptyEnvSecret:i,description:"EC2 instance metadata service (IMDSv2)"}}
6
- export{R as nh,J as oh,ie as ph,se as qh};
6
+ export{R as oh,J as ph,ie as qh,se as rh};
@@ -1 +1 @@
1
- import{Jd as a,Kd as b,Ld as c,Md as d,Nd as e,Od as f,Pd as g,Qd as h,Rd as i,Sd as j,Td as k,Ud as l,Vd as m,Wd as n,Xd as o,Yd as p,Zd as q}from"./chunk-vwqn3yx6.js";import"./chunk-tfmx17he.js";import"./chunk-3f27aa5r.js";import"./chunk-bj4ft4qc.js";import"./chunk-b0xtsv8k.js";import"./chunk-mhrtx0p1.js";import"./chunk-84703zpq.js";import"./chunk-re15e6p4.js";export{e as assertEnvWithinLimit,d as buildFunctionEnv,f as deployServerlessApp,m as getCommandRecord,c as infraEnvFromOutputs,l as listCommandHistory,g as redeployServerlessApp,b as resolveSecrets,a as resolveServerlessFunctions,q as restoreServerlessDatabase,h as rollbackServerlessApp,k as runAndRecordCommand,n as runDbQuery,j as runRemoteCommand,p as scaleServerlessDatabase,o as serverlessInfo,i as setMaintenance};
1
+ import{Jd as a,Kd as b,Ld as c,Md as d,Nd as e,Od as f,Pd as g,Qd as h,Rd as i,Sd as j,Td as k,Ud as l,Vd as m,Wd as n,Xd as o,Yd as p,Zd as q}from"./chunk-n2fnav53.js";import"./chunk-8zk8msx0.js";import"./chunk-h6xqtypj.js";import"./chunk-e2dnxp8d.js";import"./chunk-a9e0hvwe.js";import"./chunk-bzth6d1s.js";import"./chunk-n20kbxwb.js";import"./chunk-m07s5esk.js";export{e as assertEnvWithinLimit,d as buildFunctionEnv,f as deployServerlessApp,m as getCommandRecord,c as infraEnvFromOutputs,l as listCommandHistory,g as redeployServerlessApp,b as resolveSecrets,a as resolveServerlessFunctions,q as restoreServerlessDatabase,h as rollbackServerlessApp,k as runAndRecordCommand,n as runDbQuery,j as runRemoteCommand,p as scaleServerlessDatabase,o as serverlessInfo,i as setMaintenance};
@@ -1 +1 @@
1
- import{$h as K,$i as La,$j as Lb,$k as Lc,$l as Ld,$m as Le,$n as Mf,$o as Mg,Ah as j,Ai as ka,Aj as kb,Ak as kc,Al as kd,Am as ke,An as lf,Ao as lg,Bh as k,Bi as la,Bj as lb,Bk as lc,Bl as ld,Bm as le,Bn as mf,Bo as mg,Ch as l,Ci as ma,Cj as mb,Ck as mc,Cl as md,Cm as me,Cn as nf,Co as ng,Dh as m,Di as na,Dj as nb,Dk as nc,Dl as nd,Dm as ne,Dn as of,Do as og,Eh as n,Ei as oa,Ej as ob,Ek as oc,El as od,Em as oe,En as pf,Eo as pg,Fh as o,Fi as pa,Fj as pb,Fk as pc,Fl as pd,Fm as pe,Fn as qf,Fo as qg,Gh as p,Gi as qa,Gj as qb,Gk as qc,Gl as qd,Gm as qe,Gn as rf,Go as rg,Hh as q,Hi as ra,Hj as rb,Hk as rc,Hl as rd,Hm as re,Hn as sf,Ho as sg,Ih as r,Ii as sa,Ij as sb,Ik as sc,Il as sd,Im as se,In as tf,Io as tg,Jh as s,Ji as ta,Jj as tb,Jk as tc,Jl as td,Jm as te,Jn as uf,Jo as ug,Kh as t,Ki as ua,Kj as ub,Kk as uc,Kl as ud,Km as ue,Kn as vf,Ko as vg,Lh as u,Li as va,Lj as vb,Lk as vc,Ll as vd,Lm as ve,Ln as wf,Lo as wg,Mh as v,Mi as wa,Mj as wb,Mk as wc,Ml as wd,Mm as we,Mn as xf,Mo as xg,Nh as w,Ni as xa,Nj as xb,Nk as xc,Nl as xd,Nm as xe,Nn as yf,No as yg,Oh as x,Oi as ya,Oj as yb,Ok as yc,Ol as yd,Om as ye,On as zf,Oo as zg,Ph as y,Pi as za,Pj as zb,Pk as zc,Pl as zd,Pm as ze,Pn as Af,Po as Ag,Qh as z,Qi as Aa,Qj as Ab,Qk as Ac,Ql as Ad,Qm as Ae,Qn as Bf,Qo as Bg,Rh as A,Ri as Ba,Rj as Bb,Rk as Bc,Rl as Bd,Rm as Be,Rn as Cf,Ro as Cg,Sh as B,Si as Ca,Sj as Cb,Sk as Cc,Sl as Cd,Sm as Ce,Sn as Df,So as Dg,Th as C,Ti as Da,Tj as Db,Tk as Dc,Tl as Dd,Tm as De,Tn as Ef,To as Eg,Uh as D,Ui as Ea,Uj as Eb,Uk as Ec,Ul as Ed,Um as Ee,Un as Ff,Uo as Fg,Vh as E,Vi as Fa,Vj as Fb,Vk as Fc,Vl as Fd,Vm as Fe,Vn as Gf,Vo as Gg,Wh as F,Wi as Ga,Wj as Gb,Wk as Gc,Wl as Gd,Wm as Ge,Wn as Hf,Wo as Hg,Xh as G,Xi as Ha,Xj as Hb,Xk as Hc,Xl as Hd,Xm as He,Xn as If,Xo as Ig,Yh as H,Yi as Ia,Yj as Ib,Yk as Ic,Yl as Id,Ym as Ie,Yn as Jf,Yo as Jg,Zh as I,Zi as Ja,Zj as Jb,Zk as Jc,Zl as Jd,Zm as Je,Zn as Kf,Zo as Kg,_h as J,_i as Ka,_j as Kb,_k as Kc,_l as Kd,_m as Ke,_n as Lf,_o as Lg,ai as L,aj as Ma,ak as Mb,al as Mc,am as Md,an as Me,ao as Nf,ap as Ng,bi as M,bj as Na,bk as Nb,bl as Nc,bm as Nd,bn as Ne,bo as Of,bp as Og,ci as N,cj as Oa,ck as Ob,cl as Oc,cm as Od,cn as Oe,co as Pf,cp as Pg,di as O,dj as Pa,dk as Pb,dl as Pc,dm as Pd,dn as Pe,do as Qf,dp as Qg,ei as P,ej as Qa,ek as Qb,el as Qc,em as Qd,en as Qe,eo as Rf,ep as Rg,fi as Q,fj as Ra,fk as Rb,fl as Rc,fm as Rd,fn as Re,fo as Sf,fp as Sg,gi as R,gj as Sa,gk as Sb,gl as Sc,gm as Sd,gn as Se,go as Tf,gp as Tg,hi as S,hj as Ta,hk as Tb,hl as Tc,hm as Td,hn as Te,ho as Uf,hp as Ug,ii as T,ij as Ua,ik as Ub,il as Uc,im as Ud,in as Ue,io as Vf,ip as Vg,ji as U,jj as Va,jk as Vb,jl as Vc,jm as Vd,jn as Ve,jo as Wf,jp as Wg,ki as V,kj as Wa,kk as Wb,kl as Wc,km as Wd,kn as We,ko as Xf,kp as Xg,li as W,lj as Xa,lk as Xb,ll as Xc,lm as Xd,ln as Xe,lo as Yf,lp as Yg,mi as X,mj as Ya,mk as Yb,ml as Yc,mm as Yd,mn as Ye,mo as Zf,mp as Zg,ni as Y,nj as Za,nk as Zb,nl as Zc,nm as Zd,nn as Ze,no as _f,np as _g,oi as Z,oj as _a,ok as _b,ol as _c,om as _d,on as _e,oo as $f,op as $g,pi as _,pj as $a,pk as $b,pl as $c,pm as $d,pn as $e,po as ag,pp as ah,qi as aa,qj as ab,qk as ac,ql as ad,qm as ae,qn as af,qo as bg,qp as bh,rh as a,ri as ba,rj as bb,rk as bc,rl as bd,rm as be,rn as bf,ro as cg,rp as ch,sh as b,si as ca,sj as cb,sk as cc,sl as cd,sm as ce,sn as cf,so as dg,sp as dh,th as c,ti as da,tj as db,tk as dc,tl as dd,tm as de,tn as df,to as eg,tp as eh,uh as d,ui as ea,uj as eb,uk as ec,ul as ed,um as ee,un as ef,uo as fg,up as fh,vh as e,vi as fa,vj as fb,vk as fc,vl as fd,vm as fe,vn as ff,vo as gg,vp as gh,wh as f,wi as ga,wj as gb,wk as gc,wl as gd,wm as ge,wn as gf,wo as hg,wp as hh,xh as g,xi as ha,xj as hb,xk as hc,xl as hd,xm as he,xn as hf,xo as ig,xp as ih,yh as h,yi as ia,yj as ib,yk as ic,yl as id,ym as ie,yn as jf,yo as jg,yp as jh,zh as i,zi as ja,zj as jb,zk as jc,zl as jd,zm as je,zn as kf,zo as kg}from"./chunk-84703zpq.js";import"./chunk-re15e6p4.js";export{Je as ABTestManager,sa as AI,Tb as AWSAPIError,xe as AWSConfigManager,Ka as AWS_PSEUDO_PARAMETERS,Id as AWS_REGIONS,wa as ApiGateway,Ja as Arn,Ca as AssetHasher,Aa as Auth,te as BackupManager,_f as BatchProcessingManager,Fe as BlueGreenManager,Kf as BounceComplaintHandler,mf as BuildOptimizationManager,da as CDN,wg as CHAIN_HEADER,$d as COMMON_CROSS_ACCOUNT_ROLES,ua as Cache,He as CanaryManager,ff as CertificateManager,Ob as CloudError,La as CloudFormationBuilder,Jb as CloudFormationClient,Nb as CloudFrontClient,ze as CloudTrailManager,vd as CommandHistory,Ha as Communication,ga as Compute,Pb as ConfigurationError,of as ContainerRegistryManager,Qb as CredentialError,Ad as CrossRegionReferenceManager,db as DASHBOARD_ENTRY,eb as DASHBOARD_PORT_BASE,fb as DASHBOARD_PORT_SPAN,cb as DASHBOARD_STATE_DIR,zg as DEFAULT_RECURSION_LIMITS,cc as DEFAULT_SERVICE_LIMITS,q as DEFAULT_STATE_DIR,vg as DEPTH_HEADER,Yf as DLQMonitoringManager,ea as DNS,Gf as DNSSECManager,ta as Database,$e as DatabaseUserManager,Xb as DebugLogger,Z as DependencyGraph,Ba as Deployment,Rb as DeploymentError,ve as DisasterRecoveryManager,ja as Email,Sf as EmailAdvanced,Mf as EmailAnalyticsManager,Tf as EmailHandlers,Qf as EmailTemplateManager,Ub as ErrorCodes,Wf as FIFOQueueManager,gc as FileCache,ia as FileSystem,Ia as Fn,Bd as GlobalResourceManager,Be as GuardDutyManager,qc as HashCache,eh as HealthCheckManager,kf as ImageScanningManager,na as JobLoader,Wg as LARAVEL_SERVERLESS_BUILD_STEPS,wf as LambdaConcurrencyManager,Cf as LambdaDLQManager,yf as LambdaDestinationsManager,sf as LambdaLayersManager,Af as LambdaVPCManager,uf as LambdaVersionsManager,Re as LogsManager,ig as MANAGED_NODE_VERSIONS,kb as MANAGEMENT_DASHBOARD_SITE_PREFIX,xa as Messaging,Pe as MetricsManager,Ve as MigrationManager,Oc as MockCloudFormation,Qc as MockDynamoDB,Pc as MockS3,za as Monitoring,Vd as MultiAccountManager,yd as MultiRegionManager,fd as MultiStepProgress,ha as Network,gh as NetworkSecurityManager,Wd as OrganizationManager,Yg as PHP_DEFAULT_EXCLUDES,ng as PHP_LAYER_EXTENSIONS,Ea as ParameterStore,Ze as PerformanceManager,va as Permissions,la as Phone,Uf as PhoneAdvanced,ka as PhoneHandlers,Sc as PreviewEnvironmentManager,Xc as PreviewNotificationService,ed as ProgressBar,Le as ProgressiveDeploymentManager,L as Pseudo,ma as Queue,ag as QueueManagementManager,o as QueuePresets,Zd as RECOMMENDED_ACCOUNT_STRUCTURES,_d as RECOMMENDED_SCPS,sd as REPL,ud as REPLCommandBuilder,td as REPLContext,xc as RateLimiter,p as RealtimePresets,Cg as RecursionGuard,Ga as Redirects,Cd as RegionPairManager,ca as Registry,Xe as ReplicaManager,ih as ResourceManagementManager,If as Route53ResolverManager,Ef as Route53RoutingManager,Kb as S3Client,Lb as S3Error,qa as SMS,r as STATE_DIR_ENV_VAR,Fa as Search,Da as Secrets,df as SecretsManager,bf as SecretsRotationManager,fa as Security,De as SecurityHubManager,hf as SecurityScanningManager,Of as SenderReputationManager,qf as ServiceMeshManager,ra as Sftp,Vf as SmsAdvanced,pa as SmsHandlers,gd as Spinner,Dd as StackDependencyManager,oa as StacksIntegration,ah as StaticSiteManager,ba as Storage,ch as StorageAdvancedManager,Te as SyntheticsManager,xg as TRACE_HEADER,hd as TaskList,H as TemplateBuilder,hc as TemplateCache,Sb as ValidationError,ya as Workflow,Ne as XRayManager,Ke as abTestManager,_ as analyzeStackDiff,gg as artifactKey,nd as autocomplete,ye as awsConfigManager,ue as backupManager,sc as batch,$f as batchProcessingManager,Ge as blueGreenManager,Lf as bounceComplaintHandler,ug as buildBunRuntimeLayerZip,Ma as buildCloudFormationTemplate,F as buildMailEnv,tg as buildNodeRuntimeLayerZip,nf as buildOptimizationManager,Xg as buildPhpRuntimeLayerZip,Ie as canaryManager,Dc as categorizeChanges,gf as certificateManager,$b as checkIAMPermissions,Kg as checkInvocation,dc as checkServiceQuotas,yc as chunk,k as clearSigningKeyCache,Gc as cloudConfigSchema,Ae as cloudTrailManager,_g as collectPhpAppEntries,qb as composePresets,mg as composeServerlessAppTemplate,pf as containerRegistryManager,Ta as createApiBackendPreset,Rg as createCliHandler,Fb as createCredentialProvider,bb as createDashboardSite,Ya as createDataPipelinePreset,Wb as createError,Ra as createExistingStaticFullStackPreset,Sa as createFullStackAppPreset,Sg as createHandlers,Pg as createHttpHandler,Va as createJamstackPreset,$a as createLaravelPreset,Za as createMLApiPreset,Wa as createMicroservicesPreset,Rc as createMockAWS,Oa as createNodeJsServerPreset,Pa as createNodeJsServerlessPreset,rb as createPreset,d as createPresignedUrl,e as createPresignedUrlAsync,Qg as createQueueHandler,Xa as createRealtimeAppPreset,Mb as createS3Client,ab as createServerlessLaravelPreset,Qa as createServerlessNodePreset,Na as createStaticSitePreset,_a as createTraditionalWebAppPreset,Ua as createWordPressPreset,cg as createZip,Ed as crossRegionReferenceManager,af as databaseUserManager,Ic as defaultLocalConfig,A as deploymentCoexistenceError,gb as deriveManagementDashboardPort,y as detectDeploymentTargets,Zb as detectMisconfigurations,a as detectServiceRegion,Ac as diffTemplates,Zf as dlqMonitoringManager,Hf as dnssecManager,we as drManager,Nf as emailAnalyticsManager,Rf as emailTemplateManager,Ng as eventToRequest,pb as extendPreset,Xf as fifoQueueManager,pc as findChangedFiles,de as formatAccountStructure,ad as formatBytes,aa as formatDiff,bd as formatDuration,pd as formatFlagSuggestions,wd as formatHistory,xd as formatHistoryStats,dd as formatKeyValue,cd as formatList,$c as formatProgressBar,Sd as formatRegion,Td as formatRegionList,jd as formatSuggestion,Zc as formatTable,_c as formatTree,Bb as fromEC2Metadata,Cb as fromECSMetadata,zb as fromEnvironment,Ab as fromSharedCredentials,Db as fromWebIdentity,yg as functionFingerprint,rg as generateAppImageDockerfile,re as generateApprovalConfig,dg as generateBootstrap,Vc as generateCleanupWorkflow,Wc as generateCostReportWorkflow,be as generateCrossAccountRoleCF,oe as generateDeploymentConfig,je as generateDeploymentPipeline,ee as generateDeploymentWorkflow,N as generateLogicalId,ne as generateManualPipeline,ie as generateMatrixWorkflow,pe as generateMultiEnvConfig,ke as generateMultiEnvPipeline,fe as generateMultiEnvWorkflow,ge as generatePRPreviewWorkflow,se as generateParallelConfig,Tg as generatePhpFpmConfig,qg as generatePhpLayerDockerfile,le as generatePreviewPipeline,Uc as generatePreviewWorkflow,M as generateResourceName,qe as generateScheduledConfig,me as generateScheduledPipeline,he as generateScheduledWorkflow,Ib as getAccountId,Kd as getAllRegions,Pd as getClosestRegion,qd as getCommandUsage,ld as getContextualHelp,Eb as getCredentials,Ec as getDeploymentStrategy,Fc as getDiffStats,Bc as getDiffSummary,Vb as getErrorDetails,Jc as getLocalConfig,Mc as getLocalCredentials,Lc as getLocalEndpoint,Nc as getLocalEnvVars,ec as getQuotaUsageSummary,ae as getRecommendedStructure,Jd as getRegion,Ud as getRegionStats,Md as getRegionsByCompliance,Ld as getRegionsByLocation,Nd as getRegionsByPricingTier,ac as getRequiredPermissions,l as getSigningKeyCacheSize,O as getTimestamp,Fd as globalResourceManager,Ce as guardDutyManager,jb as hasManagementDashboardSite,lc as hashBuffer,mc as hashDirectory,jc as hashFile,nc as hashManifest,kc as hashString,fh as healthCheckManager,lf as imageScanningManager,Bg as inspectInvocation,Hg as installRecursionFetch,Fg as invocationContext,kd as isLikelyTypo,Kc as isLocalDevelopment,mb as isManagementDashboardSiteName,m as isNodeCryptoAvailable,t as isStateDirConfigured,x as isStatePath,Od as isValidRegion,n as isWebCryptoAvailable,xf as lambdaConcurrencyManager,Df as lambdaDLQManager,zf as lambdaDestinationsManager,tf as lambdaLayersManager,Bf as lambdaVPCManager,vf as lambdaVersionsManager,Vg as laravelServerlessEnvDefaults,Se as logsManager,C as mailEnabled,E as mailFirewallPorts,f as makeAWSRequest,h as makeAWSRequestAsync,g as makeAWSRequestOnce,lb as managementDashboardSiteName,sb as mergeInfrastructure,Qe as metricsManager,We as migrationManager,Xd as multiAccountManager,zd as multiRegionManager,hh as networkSecurityManager,Yd as organizationManager,$g as packagePhpApp,hg as packageServerlessApp,rc as parallel,tc as parallelMap,uc as parallelWithRetry,Ag as parseChain,j as parseJSONResponse,i as parseXMLResponse,_e as performanceManager,pg as phpLayerBuildStage,og as phpLayerPackages,Ug as phpRuntimeLayerAssets,Tc as previewManager,Yc as previewNotifications,zc as processInChunks,Me as progressiveDeploymentManager,Dg as propagationHeaders,bg as queueManagementManager,oc as quickHash,Eg as recursionBlockedResponse,Gd as regionPairManager,Ye as replicaManager,Cc as requiresReplacement,Jg as resetRecursionRuntime,Mg as resolveApp,B as resolveAppDatabase,G as resolveCloudProvider,Gb as resolveCredentials,hb as resolveDashboardDomain,ib as resolveDashboardDomains,V as resolveDeployBucketName,z as resolveDeploymentMode,D as resolveMailService,ob as resolveManagementDashboardSite,nb as resolveManagementDashboardSites,Q as resolveProjectStackName,lg as resolveQueueNames,kg as resolveQueues,Gg as resolveRecursionConfig,Hb as resolveRegion,W as resolveServerlessAppStackName,X as resolveServerlessArtifactBucketName,Y as resolveServerlessAssetBucketName,jg as resolveServerlessRuntime,T as resolveSiteBucketName,S as resolveSiteResourceName,R as resolveSiteStackName,w as resolveStatePath,U as resolveStorageBucketName,jh as resourceManagementManager,Og as responseToResult,Jf as route53ResolverManager,Ff as route53RoutingManager,eg as runBuildHooks,Zg as runPhpBuildHooks,P as sanitizeName,md as searchCommands,ef as secretsManager,cf as secretsRotationManager,Ee as securityHubManager,jf as securityScanningManager,Pf as senderReputationManager,vc as sequence,rf as serviceMeshManager,s as setStateDir,fg as sha256,Ig as sharedRecursionGuard,sg as sharedRuntimeLoop,b as signRequest,c as signRequestAsync,Hd as stackDependencyManager,u as stateDir,v as statePath,bh as staticSiteManager,dh as storageAdvancedManager,id as suggestCommand,od as suggestFlags,bc as suggestIAMPolicy,fc as suggestQuotaIncrease,Rd as suggestRegionPairs,Qd as suggestRegions,Ue as syntheticsManager,ic as templateCache,ce as validateAccountStructure,Hc as validateAgainstSchema,rd as validateCommand,Yb as validateConfiguration,_b as validateCredentials,K as validateResourceLimits,I as validateTemplate,J as validateTemplateSize,xb as withCDN,wb as withCache,vb as withDatabase,Lg as withInvocation,tb as withMonitoring,yb as withQueue,ub as withSecurity,wc as withTimeout,Oe as xrayManager};
1
+ import{$h as J,$i as Ka,$j as Kb,$k as Kc,$l as Kd,$m as Ke,$n as Lf,$o as Lg,Ah as i,Ai as ja,Aj as jb,Ak as jc,Al as jd,Am as je,An as kf,Ao as kg,Bh as j,Bi as ka,Bj as kb,Bk as kc,Bl as kd,Bm as ke,Bn as lf,Bo as lg,Ch as k,Ci as la,Cj as lb,Ck as lc,Cl as ld,Cm as le,Cn as mf,Co as mg,Dh as l,Di as ma,Dj as mb,Dk as mc,Dl as md,Dm as me,Dn as nf,Do as ng,Eh as m,Ei as na,Ej as nb,Ek as nc,El as nd,Em as ne,En as of,Eo as og,Fh as n,Fi as oa,Fj as ob,Fk as oc,Fl as od,Fm as oe,Fn as pf,Fo as pg,Gh as o,Gi as pa,Gj as pb,Gk as pc,Gl as pd,Gm as pe,Gn as qf,Go as qg,Hh as p,Hi as qa,Hj as qb,Hk as qc,Hl as qd,Hm as qe,Hn as rf,Ho as rg,Ih as q,Ii as ra,Ij as rb,Ik as rc,Il as rd,Im as re,In as sf,Io as sg,Jh as r,Ji as sa,Jj as sb,Jk as sc,Jl as sd,Jm as se,Jn as tf,Jo as tg,Kh as s,Ki as ta,Kj as tb,Kk as tc,Kl as td,Km as te,Kn as uf,Ko as ug,Lh as t,Li as ua,Lj as ub,Lk as uc,Ll as ud,Lm as ue,Ln as vf,Lo as vg,Mh as u,Mi as va,Mj as vb,Mk as vc,Ml as vd,Mm as ve,Mn as wf,Mo as wg,Nh as v,Ni as wa,Nj as wb,Nk as wc,Nl as wd,Nm as we,Nn as xf,No as xg,Oh as w,Oi as xa,Oj as xb,Ok as xc,Ol as xd,Om as xe,On as yf,Oo as yg,Ph as x,Pi as ya,Pj as yb,Pk as yc,Pl as yd,Pm as ye,Pn as zf,Po as zg,Qh as y,Qi as za,Qj as zb,Qk as zc,Ql as zd,Qm as ze,Qn as Af,Qo as Ag,Rh as z,Ri as Aa,Rj as Ab,Rk as Ac,Rl as Ad,Rm as Ae,Rn as Bf,Ro as Bg,Sh as A,Si as Ba,Sj as Bb,Sk as Bc,Sl as Bd,Sm as Be,Sn as Cf,So as Cg,Th as B,Ti as Ca,Tj as Cb,Tk as Cc,Tl as Cd,Tm as Ce,Tn as Df,To as Dg,Uh as C,Ui as Da,Uj as Db,Uk as Dc,Ul as Dd,Um as De,Un as Ef,Uo as Eg,Vh as D,Vi as Ea,Vj as Eb,Vk as Ec,Vl as Ed,Vm as Ee,Vn as Ff,Vo as Fg,Wh as E,Wi as Fa,Wj as Fb,Wk as Fc,Wl as Fd,Wm as Fe,Wn as Gf,Wo as Gg,Xh as F,Xi as Ga,Xj as Gb,Xk as Gc,Xl as Gd,Xm as Ge,Xn as Hf,Xo as Hg,Yh as G,Yi as Ha,Yj as Hb,Yk as Hc,Yl as Hd,Ym as He,Yn as If,Yo as Ig,Zh as H,Zi as Ia,Zj as Ib,Zk as Ic,Zl as Id,Zm as Ie,Zn as Jf,Zo as Jg,_h as I,_i as Ja,_j as Jb,_k as Jc,_l as Jd,_m as Je,_n as Kf,_o as Kg,ai as K,aj as La,ak as Lb,al as Lc,am as Ld,an as Le,ao as Mf,ap as Mg,bi as L,bj as Ma,bk as Mb,bl as Mc,bm as Md,bn as Me,bo as Nf,bp as Ng,ci as M,cj as Na,ck as Nb,cl as Nc,cm as Nd,cn as Ne,co as Of,cp as Og,di as N,dj as Oa,dk as Ob,dl as Oc,dm as Od,dn as Oe,do as Pf,dp as Pg,ei as O,ej as Pa,ek as Pb,el as Pc,em as Pd,en as Pe,eo as Qf,ep as Qg,fi as P,fj as Qa,fk as Qb,fl as Qc,fm as Qd,fn as Qe,fo as Rf,fp as Rg,gi as Q,gj as Ra,gk as Rb,gl as Rc,gm as Rd,gn as Re,go as Sf,gp as Sg,hi as R,hj as Sa,hk as Sb,hl as Sc,hm as Sd,hn as Se,ho as Tf,hp as Tg,ii as S,ij as Ta,ik as Tb,il as Tc,im as Td,in as Te,io as Uf,ip as Ug,ji as T,jj as Ua,jk as Ub,jl as Uc,jm as Ud,jn as Ue,jo as Vf,jp as Vg,ki as U,kj as Va,kk as Vb,kl as Vc,km as Vd,kn as Ve,ko as Wf,kp as Wg,li as V,lj as Wa,lk as Wb,ll as Wc,lm as Wd,ln as We,lo as Xf,lp as Xg,mi as W,mj as Xa,mk as Xb,ml as Xc,mm as Xd,mn as Xe,mo as Yf,mp as Yg,ni as X,nj as Ya,nk as Yb,nl as Yc,nm as Yd,nn as Ye,no as Zf,np as Zg,oi as Y,oj as Za,ok as Zb,ol as Zc,om as Zd,on as Ze,oo as _f,op as _g,pi as Z,pj as _a,pk as _b,pl as _c,pm as _d,pn as _e,po as $f,pp as $g,qi as _,qj as $a,qk as $b,ql as $c,qm as $d,qn as $e,qo as ag,qp as ah,ri as aa,rj as ab,rk as ac,rl as ad,rm as ae,rn as af,ro as bg,rp as bh,sh as a,si as ba,sj as bb,sk as bc,sl as bd,sm as be,sn as bf,so as cg,sp as ch,th as b,ti as ca,tj as cb,tk as cc,tl as cd,tm as ce,tn as cf,to as dg,tp as dh,uh as c,ui as da,uj as db,uk as dc,ul as dd,um as de,un as df,uo as eg,up as eh,vh as d,vi as ea,vj as eb,vk as ec,vl as ed,vm as ee,vn as ef,vo as fg,vp as fh,wh as e,wi as fa,wj as fb,wk as fc,wl as fd,wm as fe,wn as ff,wo as gg,wp as gh,xh as f,xi as ga,xj as gb,xk as gc,xl as gd,xm as ge,xn as gf,xo as hg,xp as hh,yh as g,yi as ha,yj as hb,yk as hc,yl as hd,ym as he,yn as hf,yo as ig,yp as ih,zh as h,zi as ia,zj as ib,zk as ic,zl as id,zm as ie,zn as jf,zo as jg,zp as jh}from"./chunk-n20kbxwb.js";import"./chunk-m07s5esk.js";export{Je as ABTestManager,sa as AI,Tb as AWSAPIError,xe as AWSConfigManager,Ka as AWS_PSEUDO_PARAMETERS,Id as AWS_REGIONS,wa as ApiGateway,Ja as Arn,Ca as AssetHasher,Aa as Auth,te as BackupManager,_f as BatchProcessingManager,Fe as BlueGreenManager,Kf as BounceComplaintHandler,mf as BuildOptimizationManager,da as CDN,wg as CHAIN_HEADER,$d as COMMON_CROSS_ACCOUNT_ROLES,ua as Cache,He as CanaryManager,ff as CertificateManager,Ob as CloudError,La as CloudFormationBuilder,Jb as CloudFormationClient,Nb as CloudFrontClient,ze as CloudTrailManager,vd as CommandHistory,Ha as Communication,ga as Compute,Pb as ConfigurationError,of as ContainerRegistryManager,Qb as CredentialError,Ad as CrossRegionReferenceManager,db as DASHBOARD_ENTRY,eb as DASHBOARD_PORT_BASE,fb as DASHBOARD_PORT_SPAN,cb as DASHBOARD_STATE_DIR,zg as DEFAULT_RECURSION_LIMITS,cc as DEFAULT_SERVICE_LIMITS,q as DEFAULT_STATE_DIR,vg as DEPTH_HEADER,Yf as DLQMonitoringManager,ea as DNS,Gf as DNSSECManager,ta as Database,$e as DatabaseUserManager,Xb as DebugLogger,Z as DependencyGraph,Ba as Deployment,Rb as DeploymentError,ve as DisasterRecoveryManager,ja as Email,Sf as EmailAdvanced,Mf as EmailAnalyticsManager,Tf as EmailHandlers,Qf as EmailTemplateManager,Ub as ErrorCodes,Wf as FIFOQueueManager,gc as FileCache,ia as FileSystem,Ia as Fn,Bd as GlobalResourceManager,Be as GuardDutyManager,qc as HashCache,eh as HealthCheckManager,kf as ImageScanningManager,na as JobLoader,Wg as LARAVEL_SERVERLESS_BUILD_STEPS,wf as LambdaConcurrencyManager,Cf as LambdaDLQManager,yf as LambdaDestinationsManager,sf as LambdaLayersManager,Af as LambdaVPCManager,uf as LambdaVersionsManager,Re as LogsManager,ig as MANAGED_NODE_VERSIONS,kb as MANAGEMENT_DASHBOARD_SITE_PREFIX,xa as Messaging,Pe as MetricsManager,Ve as MigrationManager,Oc as MockCloudFormation,Qc as MockDynamoDB,Pc as MockS3,za as Monitoring,Vd as MultiAccountManager,yd as MultiRegionManager,fd as MultiStepProgress,ha as Network,gh as NetworkSecurityManager,Wd as OrganizationManager,Yg as PHP_DEFAULT_EXCLUDES,ng as PHP_LAYER_EXTENSIONS,Ea as ParameterStore,Ze as PerformanceManager,va as Permissions,la as Phone,Uf as PhoneAdvanced,ka as PhoneHandlers,Sc as PreviewEnvironmentManager,Xc as PreviewNotificationService,ed as ProgressBar,Le as ProgressiveDeploymentManager,L as Pseudo,ma as Queue,ag as QueueManagementManager,o as QueuePresets,Zd as RECOMMENDED_ACCOUNT_STRUCTURES,_d as RECOMMENDED_SCPS,sd as REPL,ud as REPLCommandBuilder,td as REPLContext,xc as RateLimiter,p as RealtimePresets,Cg as RecursionGuard,Ga as Redirects,Cd as RegionPairManager,ca as Registry,Xe as ReplicaManager,ih as ResourceManagementManager,If as Route53ResolverManager,Ef as Route53RoutingManager,Kb as S3Client,Lb as S3Error,qa as SMS,r as STATE_DIR_ENV_VAR,Fa as Search,Da as Secrets,df as SecretsManager,bf as SecretsRotationManager,fa as Security,De as SecurityHubManager,hf as SecurityScanningManager,Of as SenderReputationManager,qf as ServiceMeshManager,ra as Sftp,Vf as SmsAdvanced,pa as SmsHandlers,gd as Spinner,Dd as StackDependencyManager,oa as StacksIntegration,ah as StaticSiteManager,ba as Storage,ch as StorageAdvancedManager,Te as SyntheticsManager,xg as TRACE_HEADER,hd as TaskList,H as TemplateBuilder,hc as TemplateCache,Sb as ValidationError,ya as Workflow,Ne as XRayManager,Ke as abTestManager,_ as analyzeStackDiff,gg as artifactKey,nd as autocomplete,ye as awsConfigManager,ue as backupManager,sc as batch,$f as batchProcessingManager,Ge as blueGreenManager,Lf as bounceComplaintHandler,ug as buildBunRuntimeLayerZip,Ma as buildCloudFormationTemplate,F as buildMailEnv,tg as buildNodeRuntimeLayerZip,nf as buildOptimizationManager,Xg as buildPhpRuntimeLayerZip,Ie as canaryManager,Dc as categorizeChanges,gf as certificateManager,$b as checkIAMPermissions,Kg as checkInvocation,dc as checkServiceQuotas,yc as chunk,k as clearSigningKeyCache,Gc as cloudConfigSchema,Ae as cloudTrailManager,_g as collectPhpAppEntries,qb as composePresets,mg as composeServerlessAppTemplate,pf as containerRegistryManager,Ta as createApiBackendPreset,Rg as createCliHandler,Fb as createCredentialProvider,bb as createDashboardSite,Ya as createDataPipelinePreset,Wb as createError,Ra as createExistingStaticFullStackPreset,Sa as createFullStackAppPreset,Sg as createHandlers,Pg as createHttpHandler,Va as createJamstackPreset,$a as createLaravelPreset,Za as createMLApiPreset,Wa as createMicroservicesPreset,Rc as createMockAWS,Oa as createNodeJsServerPreset,Pa as createNodeJsServerlessPreset,rb as createPreset,d as createPresignedUrl,e as createPresignedUrlAsync,Qg as createQueueHandler,Xa as createRealtimeAppPreset,Mb as createS3Client,ab as createServerlessLaravelPreset,Qa as createServerlessNodePreset,Na as createStaticSitePreset,_a as createTraditionalWebAppPreset,Ua as createWordPressPreset,cg as createZip,Ed as crossRegionReferenceManager,af as databaseUserManager,Ic as defaultLocalConfig,A as deploymentCoexistenceError,gb as deriveManagementDashboardPort,y as detectDeploymentTargets,Zb as detectMisconfigurations,a as detectServiceRegion,Ac as diffTemplates,Zf as dlqMonitoringManager,Hf as dnssecManager,we as drManager,Nf as emailAnalyticsManager,Rf as emailTemplateManager,Ng as eventToRequest,pb as extendPreset,Xf as fifoQueueManager,pc as findChangedFiles,de as formatAccountStructure,ad as formatBytes,aa as formatDiff,bd as formatDuration,pd as formatFlagSuggestions,wd as formatHistory,xd as formatHistoryStats,dd as formatKeyValue,cd as formatList,$c as formatProgressBar,Sd as formatRegion,Td as formatRegionList,jd as formatSuggestion,Zc as formatTable,_c as formatTree,Bb as fromEC2Metadata,Cb as fromECSMetadata,zb as fromEnvironment,Ab as fromSharedCredentials,Db as fromWebIdentity,yg as functionFingerprint,rg as generateAppImageDockerfile,re as generateApprovalConfig,dg as generateBootstrap,Vc as generateCleanupWorkflow,Wc as generateCostReportWorkflow,be as generateCrossAccountRoleCF,oe as generateDeploymentConfig,je as generateDeploymentPipeline,ee as generateDeploymentWorkflow,N as generateLogicalId,ne as generateManualPipeline,ie as generateMatrixWorkflow,pe as generateMultiEnvConfig,ke as generateMultiEnvPipeline,fe as generateMultiEnvWorkflow,ge as generatePRPreviewWorkflow,se as generateParallelConfig,Tg as generatePhpFpmConfig,qg as generatePhpLayerDockerfile,le as generatePreviewPipeline,Uc as generatePreviewWorkflow,M as generateResourceName,qe as generateScheduledConfig,me as generateScheduledPipeline,he as generateScheduledWorkflow,Ib as getAccountId,Kd as getAllRegions,Pd as getClosestRegion,qd as getCommandUsage,ld as getContextualHelp,Eb as getCredentials,Ec as getDeploymentStrategy,Fc as getDiffStats,Bc as getDiffSummary,Vb as getErrorDetails,Jc as getLocalConfig,Mc as getLocalCredentials,Lc as getLocalEndpoint,Nc as getLocalEnvVars,ec as getQuotaUsageSummary,ae as getRecommendedStructure,Jd as getRegion,Ud as getRegionStats,Md as getRegionsByCompliance,Ld as getRegionsByLocation,Nd as getRegionsByPricingTier,ac as getRequiredPermissions,l as getSigningKeyCacheSize,O as getTimestamp,Fd as globalResourceManager,Ce as guardDutyManager,jb as hasManagementDashboardSite,lc as hashBuffer,mc as hashDirectory,jc as hashFile,nc as hashManifest,kc as hashString,fh as healthCheckManager,lf as imageScanningManager,Bg as inspectInvocation,Hg as installRecursionFetch,Fg as invocationContext,kd as isLikelyTypo,Kc as isLocalDevelopment,mb as isManagementDashboardSiteName,m as isNodeCryptoAvailable,t as isStateDirConfigured,x as isStatePath,Od as isValidRegion,n as isWebCryptoAvailable,xf as lambdaConcurrencyManager,Df as lambdaDLQManager,zf as lambdaDestinationsManager,tf as lambdaLayersManager,Bf as lambdaVPCManager,vf as lambdaVersionsManager,Vg as laravelServerlessEnvDefaults,Se as logsManager,C as mailEnabled,E as mailFirewallPorts,f as makeAWSRequest,h as makeAWSRequestAsync,g as makeAWSRequestOnce,lb as managementDashboardSiteName,sb as mergeInfrastructure,Qe as metricsManager,We as migrationManager,Xd as multiAccountManager,zd as multiRegionManager,hh as networkSecurityManager,Yd as organizationManager,$g as packagePhpApp,hg as packageServerlessApp,rc as parallel,tc as parallelMap,uc as parallelWithRetry,Ag as parseChain,j as parseJSONResponse,i as parseXMLResponse,_e as performanceManager,pg as phpLayerBuildStage,og as phpLayerPackages,Ug as phpRuntimeLayerAssets,Tc as previewManager,Yc as previewNotifications,zc as processInChunks,Me as progressiveDeploymentManager,Dg as propagationHeaders,bg as queueManagementManager,oc as quickHash,Eg as recursionBlockedResponse,Gd as regionPairManager,Ye as replicaManager,Cc as requiresReplacement,Jg as resetRecursionRuntime,Mg as resolveApp,B as resolveAppDatabase,G as resolveCloudProvider,Gb as resolveCredentials,hb as resolveDashboardDomain,ib as resolveDashboardDomains,V as resolveDeployBucketName,z as resolveDeploymentMode,D as resolveMailService,ob as resolveManagementDashboardSite,nb as resolveManagementDashboardSites,Q as resolveProjectStackName,lg as resolveQueueNames,kg as resolveQueues,Gg as resolveRecursionConfig,Hb as resolveRegion,W as resolveServerlessAppStackName,X as resolveServerlessArtifactBucketName,Y as resolveServerlessAssetBucketName,jg as resolveServerlessRuntime,T as resolveSiteBucketName,S as resolveSiteResourceName,R as resolveSiteStackName,w as resolveStatePath,U as resolveStorageBucketName,jh as resourceManagementManager,Og as responseToResult,Jf as route53ResolverManager,Ff as route53RoutingManager,eg as runBuildHooks,Zg as runPhpBuildHooks,P as sanitizeName,md as searchCommands,ef as secretsManager,cf as secretsRotationManager,Ee as securityHubManager,jf as securityScanningManager,Pf as senderReputationManager,vc as sequence,rf as serviceMeshManager,s as setStateDir,fg as sha256,Ig as sharedRecursionGuard,sg as sharedRuntimeLoop,b as signRequest,c as signRequestAsync,Hd as stackDependencyManager,u as stateDir,v as statePath,bh as staticSiteManager,dh as storageAdvancedManager,id as suggestCommand,od as suggestFlags,bc as suggestIAMPolicy,fc as suggestQuotaIncrease,Rd as suggestRegionPairs,Qd as suggestRegions,Ue as syntheticsManager,ic as templateCache,ce as validateAccountStructure,Hc as validateAgainstSchema,rd as validateCommand,Yb as validateConfiguration,_b as validateCredentials,K as validateResourceLimits,I as validateTemplate,J as validateTemplateSize,xb as withCDN,wb as withCache,vb as withDatabase,Lg as withInvocation,tb as withMonitoring,yb as withQueue,ub as withSecurity,wc as withTimeout,Oe as xrayManager};
@@ -1 +1 @@
1
- import{of as w}from"./chunk-5gx38418.js";var L="\x00";function k(t,i){if(t==="*"||t==="**")return!0;let e=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"\x01").replace(/\*/g,"[^/]*").replace(/\u0001/g,".*");return new RegExp(`^${e}$`).test(i)}function y(t,i){if(t.startsWith("*.")){let e=t.slice(1);return i.endsWith(e)&&i.length>e.length}return t===i}function d(t,i){if(t.enabled===!1)return!1;if(t.methods?.length&&!t.methods.some((e)=>e.toUpperCase()===i.method.toUpperCase()))return!1;if(t.path&&!k(t.path,i.path))return!1;if(t.host&&!y(t.host,i.host??""))return!1;return!0}function m(t,i){let e=t.key??{source:"ip"},o=e.fallbackToIp!==!1,r;if(e.source==="ip")r=i.ip;else if(e.source==="global")r="global";else if(e.source==="host")r=i.host??"";else if(e.source==="path")r=i.path;else if(e.source==="header")r=e.name?i.headers?.[e.name.toLowerCase()]:void 0;else if(e.source==="cookie")r=e.name?i.cookies?.[e.name]:void 0;if(!r&&e.source!=="global")r=o?i.ip:"__missing__";return`${t.id}\x00${r}`}class A{clock;maxTrackedKeys;buckets=new Map;windows=new Map;rules;constructor(t,i=()=>Date.now(),e=1e5){this.clock=i;this.maxTrackedKeys=e;this.rules=[...t].sort((o,r)=>(o.priority??0)-(r.priority??0))}check(t){let i=this.clock(),e=this.rules.filter((n)=>d(n,t)),o;for(let n of e){let s=this.test(n,t,i);if(s.allowed)continue;if(!o||p(s.action)>p(o.action))o=s}if(o)return o;let r={action:"allow",allowed:!0};for(let n of e){let s=this.consume(n,t,i);if(s.remaining!=null&&(r.remaining??1/0)>s.remaining)r=s}return r}test(t,i,e){let o=m(t,i);if((t.algorithm??"token_bucket")==="token_bucket"){let n=t.burst??t.limit,s=this.buckets.get(o),a=s?Math.min(n,s.tokens+this.refill(t,e-s.updatedAt)):n;if(a>=1)return{action:"allow",allowed:!0};return this.blocked(t,o,0,this.msPerToken(t)*(1-a),e)}let r=(this.windows.get(o)?.hits??[]).filter((n)=>n>e-t.windowMs);if(r.length<t.limit)return{action:"allow",allowed:!0};return this.blocked(t,o,0,r[0]+t.windowMs-e,e)}peek(t){let i=this.clock();for(let e of this.rules){if(!d(e,t))continue;let o=this.test(e,t,i);if(!o.allowed)return o}return{action:"allow",allowed:!0}}msPerToken(t){return t.windowMs/Math.max(1,t.limit)}refill(t,i){return Math.max(0,i)/this.msPerToken(t)}blocked(t,i,e,o,r){let n=t.action??"deny";return{action:n,allowed:n==="allow"||n==="log",ruleId:t.id,limit:t.limit,remaining:e,retryAfterMs:Math.max(0,Math.ceil(o)),resetAt:r+Math.max(0,o),key:i}}consume(t,i,e){let o=m(t,i);if((t.algorithm??"token_bucket")==="token_bucket"){let l=t.burst??t.limit,u=this.buckets.get(o)??{tokens:l,updatedAt:e},c=Math.min(l,u.tokens+this.refill(t,e-u.updatedAt));if(c<1)return this.buckets.set(o,{tokens:c,updatedAt:e}),this.blocked(t,o,0,this.msPerToken(t)*(1-c),e);return this.evictIfNeeded(this.buckets),this.buckets.set(o,{tokens:c-1,updatedAt:e}),{action:"allow",allowed:!0,ruleId:t.id,limit:l,remaining:Math.floor(c-1),resetAt:e+this.msPerToken(t)*(l-(c-1)),key:o}}let n=this.windows.get(o)??{hits:[]},s=e-t.windowMs,a=n.hits.filter((l)=>l>s);if(a.length>=t.limit)return this.windows.set(o,{hits:a}),this.blocked(t,o,0,a[0]+t.windowMs-e,e);return a.push(e),this.evictIfNeeded(this.windows),this.windows.set(o,{hits:a}),{action:"allow",allowed:!0,ruleId:t.id,limit:t.limit,remaining:t.limit-a.length,resetAt:a[0]+t.windowMs,key:o}}evictIfNeeded(t){if(t.size<this.maxTrackedKeys)return;let i=t.size-this.maxTrackedKeys+1,e=0;for(let o of t.keys())if(t.delete(o),++e>=i)break}sweep(){let t=this.clock(),i=0;for(let[e,o]of this.windows){let r=e.split("\x00")[0],n=this.rules.find((s)=>s.id===r);if(!n){this.windows.delete(e),i++;continue}if(o.hits.every((s)=>s<=t-n.windowMs))this.windows.delete(e),i++}for(let[e,o]of this.buckets){let r=e.split("\x00")[0],n=this.rules.find((s)=>s.id===r);if(!n||t-o.updatedAt>n.windowMs*2)this.buckets.delete(e),i++}return i}get trackedKeys(){return this.buckets.size+this.windows.size}}function p(t){return{allow:0,log:1,throttle:2,challenge:3,deny:4}[t]}function I(t){let i={};if(t.limit!=null)i["ratelimit-limit"]=String(t.limit);if(t.remaining!=null)i["ratelimit-remaining"]=String(t.remaining);if(t.resetAt!=null)i["ratelimit-reset"]=String(Math.max(0,Math.ceil((t.resetAt-Date.now())/1000)));if(!t.allowed&&t.retryAfterMs!=null)i["retry-after"]=String(Math.max(1,Math.ceil(t.retryAfterMs/1000)));return i}function C(){return[{id:"global-ip",limit:600,windowMs:60000,burst:100,key:{source:"ip"},action:"deny",priority:100},{id:"api-ip",limit:120,windowMs:60000,burst:30,path:"/api/**",key:{source:"ip"},action:"deny",priority:50},{id:"auth-ip",limit:10,windowMs:60000,algorithm:"sliding_window",path:"/auth/**",methods:["POST"],key:{source:"ip"},action:"challenge",priority:10}]}var h="protection.controls",b=24,x=4,M={ipRules:{allow:[],block:[]}};function f(t,i){if(!t?.enabled)return;return new Date(t.expiresAt).getTime()>i.getTime()?t:void 0}function g(t,i){let e=Number.isFinite(t)?Number(t):i;return Math.min(b,Math.max(0.25,e))}var R=500;class P{controlPlane;options;constructor(t,i={}){this.controlPlane=t;this.options=i}now(){return this.options.now?.()??new Date}read(){let t=this.controlPlane.getSetting(h);if(!t||typeof t!=="object"||Array.isArray(t))return{...M,ipRules:{allow:[],block:[]}};let i=t;return{attackMode:i.attackMode,mitigationPause:i.mitigationPause,ipRules:{allow:Array.isArray(i.ipRules?.allow)?i.ipRules.allow:[],block:Array.isArray(i.ipRules?.block)?i.ipRules.block:[]},updatedAt:i.updatedAt}}write(t){let i={...t,updatedAt:this.now().toISOString()};return this.controlPlane.setSetting(h,i),i}raw(){return this.read()}current(){let t=this.now(),i=this.read();return{attackMode:f(i.attackMode,t),mitigationPause:f(i.mitigationPause,t),ipRules:i.ipRules}}enableAttackMode(t){let i=this.now(),e={enabled:!0,startedAt:i.toISOString(),expiresAt:new Date(i.getTime()+g(t.hours,x)*3600000).toISOString(),reason:t.reason.trim()||"Attack mode enabled by an operator.",actorId:t.actorId};return this.write({...this.read(),attackMode:e}),e}disableAttackMode(){let t=this.read();if(!t.attackMode?.enabled)return!1;return this.write({...t,attackMode:{...t.attackMode,enabled:!1}}),!0}pauseMitigations(t){let i=t.reason.trim();if(!i)throw Error("Pausing mitigations requires a reason: you are liable for the traffic it admits.");let e=this.now(),o={enabled:!0,startedAt:e.toISOString(),expiresAt:new Date(e.getTime()+g(t.hours,b)*3600000).toISOString(),reason:i,actorId:t.actorId};return this.write({...this.read(),mitigationPause:o}),o}resumeMitigations(){let t=this.read();if(!t.mitigationPause?.enabled)return!1;return this.write({...t,mitigationPause:{...t.mitigationPause,enabled:!1}}),!0}addIpRule(t,i){let e=i.trim();if(!w(e))throw Error(`Not a valid IP or CIDR: ${i}`);let o=this.read(),r={...o.ipRules,[t]:[...new Set([...o.ipRules[t],e])]};if(r[t].length>R)throw Error(`At most ${R} ${t} rules are supported.`);let n=t==="allow"?"block":"allow";return r[n]=r[n].filter((s)=>s!==e),this.write({...o,ipRules:r}),r}removeIpRule(t,i){let e=this.read(),o={...e.ipRules,[t]:e.ipRules[t].filter((r)=>r!==i.trim())};return this.write({...e,ipRules:o}),o}}function D(t){if(t.mitigationPause)return{attackMode:!!t.attackMode,mitigationPaused:!0,summary:`Automatic mitigation is paused until ${t.mitigationPause.expiresAt}. All traffic is being served and billed.`,expiresAt:t.mitigationPause.expiresAt};if(t.attackMode)return{attackMode:!0,mitigationPaused:!1,summary:`Attack mode is on until ${t.attackMode.expiresAt}. Every visitor is being challenged.`,expiresAt:t.attackMode.expiresAt};return{attackMode:!1,mitigationPaused:!1,summary:"Protection is in its normal posture."}}function E(t,i){if(i.mitigationPause)return t.map((e)=>({...e,enabled:!1}));if(!i.attackMode)return[...t];return t.map((e)=>({...e,action:e.action==="deny"?"deny":"challenge",burst:Math.max(1,Math.min(e.burst??e.limit,5))}))}function T(t,i){let e=[...new Set([...t.allowlist??[],...i.ipRules.allow])],o=[...new Set([...t.blocklist??[],...i.ipRules.block])];if(i.mitigationPause)return{...t,allowlist:e,blocklist:o,monitorOnly:!0};if(!i.attackMode)return{...t,allowlist:e,blocklist:o};let r=t.thresholds??{};return{...t,allowlist:e,blocklist:o,thresholds:{...r,newConnectionsPerSecond:Math.max(1,Math.floor((r.newConnectionsPerSecond??50)/5)),concurrentPerSource:Math.max(1,Math.floor((r.concurrentPerSource??100)/5))}}}function v(t,i){let e=t?.infrastructure?.compute;if(!e||e.ddos===!1)return t;let o=typeof e.ddos==="object"&&e.ddos!==null?e.ddos:{};return{...t,infrastructure:{...t.infrastructure,compute:{...e,ddos:T(o,i)}}}}export{L as a,k as b,d as c,m as d,A as e,I as f,C as g,h,b as i,x as j,P as k,D as l,E as m,T as n,v as o};
1
+ import{pf as w}from"./chunk-85qrgshq.js";var L="\x00";function k(t,i){if(t==="*"||t==="**")return!0;let e=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"\x01").replace(/\*/g,"[^/]*").replace(/\u0001/g,".*");return new RegExp(`^${e}$`).test(i)}function y(t,i){if(t.startsWith("*.")){let e=t.slice(1);return i.endsWith(e)&&i.length>e.length}return t===i}function d(t,i){if(t.enabled===!1)return!1;if(t.methods?.length&&!t.methods.some((e)=>e.toUpperCase()===i.method.toUpperCase()))return!1;if(t.path&&!k(t.path,i.path))return!1;if(t.host&&!y(t.host,i.host??""))return!1;return!0}function m(t,i){let e=t.key??{source:"ip"},o=e.fallbackToIp!==!1,r;if(e.source==="ip")r=i.ip;else if(e.source==="global")r="global";else if(e.source==="host")r=i.host??"";else if(e.source==="path")r=i.path;else if(e.source==="header")r=e.name?i.headers?.[e.name.toLowerCase()]:void 0;else if(e.source==="cookie")r=e.name?i.cookies?.[e.name]:void 0;if(!r&&e.source!=="global")r=o?i.ip:"__missing__";return`${t.id}\x00${r}`}class A{clock;maxTrackedKeys;buckets=new Map;windows=new Map;rules;constructor(t,i=()=>Date.now(),e=1e5){this.clock=i;this.maxTrackedKeys=e;this.rules=[...t].sort((o,r)=>(o.priority??0)-(r.priority??0))}check(t){let i=this.clock(),e=this.rules.filter((n)=>d(n,t)),o;for(let n of e){let s=this.test(n,t,i);if(s.allowed)continue;if(!o||p(s.action)>p(o.action))o=s}if(o)return o;let r={action:"allow",allowed:!0};for(let n of e){let s=this.consume(n,t,i);if(s.remaining!=null&&(r.remaining??1/0)>s.remaining)r=s}return r}test(t,i,e){let o=m(t,i);if((t.algorithm??"token_bucket")==="token_bucket"){let n=t.burst??t.limit,s=this.buckets.get(o),a=s?Math.min(n,s.tokens+this.refill(t,e-s.updatedAt)):n;if(a>=1)return{action:"allow",allowed:!0};return this.blocked(t,o,0,this.msPerToken(t)*(1-a),e)}let r=(this.windows.get(o)?.hits??[]).filter((n)=>n>e-t.windowMs);if(r.length<t.limit)return{action:"allow",allowed:!0};return this.blocked(t,o,0,r[0]+t.windowMs-e,e)}peek(t){let i=this.clock();for(let e of this.rules){if(!d(e,t))continue;let o=this.test(e,t,i);if(!o.allowed)return o}return{action:"allow",allowed:!0}}msPerToken(t){return t.windowMs/Math.max(1,t.limit)}refill(t,i){return Math.max(0,i)/this.msPerToken(t)}blocked(t,i,e,o,r){let n=t.action??"deny";return{action:n,allowed:n==="allow"||n==="log",ruleId:t.id,limit:t.limit,remaining:e,retryAfterMs:Math.max(0,Math.ceil(o)),resetAt:r+Math.max(0,o),key:i}}consume(t,i,e){let o=m(t,i);if((t.algorithm??"token_bucket")==="token_bucket"){let l=t.burst??t.limit,u=this.buckets.get(o)??{tokens:l,updatedAt:e},c=Math.min(l,u.tokens+this.refill(t,e-u.updatedAt));if(c<1)return this.buckets.set(o,{tokens:c,updatedAt:e}),this.blocked(t,o,0,this.msPerToken(t)*(1-c),e);return this.evictIfNeeded(this.buckets),this.buckets.set(o,{tokens:c-1,updatedAt:e}),{action:"allow",allowed:!0,ruleId:t.id,limit:l,remaining:Math.floor(c-1),resetAt:e+this.msPerToken(t)*(l-(c-1)),key:o}}let n=this.windows.get(o)??{hits:[]},s=e-t.windowMs,a=n.hits.filter((l)=>l>s);if(a.length>=t.limit)return this.windows.set(o,{hits:a}),this.blocked(t,o,0,a[0]+t.windowMs-e,e);return a.push(e),this.evictIfNeeded(this.windows),this.windows.set(o,{hits:a}),{action:"allow",allowed:!0,ruleId:t.id,limit:t.limit,remaining:t.limit-a.length,resetAt:a[0]+t.windowMs,key:o}}evictIfNeeded(t){if(t.size<this.maxTrackedKeys)return;let i=t.size-this.maxTrackedKeys+1,e=0;for(let o of t.keys())if(t.delete(o),++e>=i)break}sweep(){let t=this.clock(),i=0;for(let[e,o]of this.windows){let r=e.split("\x00")[0],n=this.rules.find((s)=>s.id===r);if(!n){this.windows.delete(e),i++;continue}if(o.hits.every((s)=>s<=t-n.windowMs))this.windows.delete(e),i++}for(let[e,o]of this.buckets){let r=e.split("\x00")[0],n=this.rules.find((s)=>s.id===r);if(!n||t-o.updatedAt>n.windowMs*2)this.buckets.delete(e),i++}return i}get trackedKeys(){return this.buckets.size+this.windows.size}}function p(t){return{allow:0,log:1,throttle:2,challenge:3,deny:4}[t]}function I(t){let i={};if(t.limit!=null)i["ratelimit-limit"]=String(t.limit);if(t.remaining!=null)i["ratelimit-remaining"]=String(t.remaining);if(t.resetAt!=null)i["ratelimit-reset"]=String(Math.max(0,Math.ceil((t.resetAt-Date.now())/1000)));if(!t.allowed&&t.retryAfterMs!=null)i["retry-after"]=String(Math.max(1,Math.ceil(t.retryAfterMs/1000)));return i}function C(){return[{id:"global-ip",limit:600,windowMs:60000,burst:100,key:{source:"ip"},action:"deny",priority:100},{id:"api-ip",limit:120,windowMs:60000,burst:30,path:"/api/**",key:{source:"ip"},action:"deny",priority:50},{id:"auth-ip",limit:10,windowMs:60000,algorithm:"sliding_window",path:"/auth/**",methods:["POST"],key:{source:"ip"},action:"challenge",priority:10}]}var h="protection.controls",b=24,x=4,M={ipRules:{allow:[],block:[]}};function f(t,i){if(!t?.enabled)return;return new Date(t.expiresAt).getTime()>i.getTime()?t:void 0}function g(t,i){let e=Number.isFinite(t)?Number(t):i;return Math.min(b,Math.max(0.25,e))}var R=500;class P{controlPlane;options;constructor(t,i={}){this.controlPlane=t;this.options=i}now(){return this.options.now?.()??new Date}read(){let t=this.controlPlane.getSetting(h);if(!t||typeof t!=="object"||Array.isArray(t))return{...M,ipRules:{allow:[],block:[]}};let i=t;return{attackMode:i.attackMode,mitigationPause:i.mitigationPause,ipRules:{allow:Array.isArray(i.ipRules?.allow)?i.ipRules.allow:[],block:Array.isArray(i.ipRules?.block)?i.ipRules.block:[]},updatedAt:i.updatedAt}}write(t){let i={...t,updatedAt:this.now().toISOString()};return this.controlPlane.setSetting(h,i),i}raw(){return this.read()}current(){let t=this.now(),i=this.read();return{attackMode:f(i.attackMode,t),mitigationPause:f(i.mitigationPause,t),ipRules:i.ipRules}}enableAttackMode(t){let i=this.now(),e={enabled:!0,startedAt:i.toISOString(),expiresAt:new Date(i.getTime()+g(t.hours,x)*3600000).toISOString(),reason:t.reason.trim()||"Attack mode enabled by an operator.",actorId:t.actorId};return this.write({...this.read(),attackMode:e}),e}disableAttackMode(){let t=this.read();if(!t.attackMode?.enabled)return!1;return this.write({...t,attackMode:{...t.attackMode,enabled:!1}}),!0}pauseMitigations(t){let i=t.reason.trim();if(!i)throw Error("Pausing mitigations requires a reason: you are liable for the traffic it admits.");let e=this.now(),o={enabled:!0,startedAt:e.toISOString(),expiresAt:new Date(e.getTime()+g(t.hours,b)*3600000).toISOString(),reason:i,actorId:t.actorId};return this.write({...this.read(),mitigationPause:o}),o}resumeMitigations(){let t=this.read();if(!t.mitigationPause?.enabled)return!1;return this.write({...t,mitigationPause:{...t.mitigationPause,enabled:!1}}),!0}addIpRule(t,i){let e=i.trim();if(!w(e))throw Error(`Not a valid IP or CIDR: ${i}`);let o=this.read(),r={...o.ipRules,[t]:[...new Set([...o.ipRules[t],e])]};if(r[t].length>R)throw Error(`At most ${R} ${t} rules are supported.`);let n=t==="allow"?"block":"allow";return r[n]=r[n].filter((s)=>s!==e),this.write({...o,ipRules:r}),r}removeIpRule(t,i){let e=this.read(),o={...e.ipRules,[t]:e.ipRules[t].filter((r)=>r!==i.trim())};return this.write({...e,ipRules:o}),o}}function D(t){if(t.mitigationPause)return{attackMode:!!t.attackMode,mitigationPaused:!0,summary:`Automatic mitigation is paused until ${t.mitigationPause.expiresAt}. All traffic is being served and billed.`,expiresAt:t.mitigationPause.expiresAt};if(t.attackMode)return{attackMode:!0,mitigationPaused:!1,summary:`Attack mode is on until ${t.attackMode.expiresAt}. Every visitor is being challenged.`,expiresAt:t.attackMode.expiresAt};return{attackMode:!1,mitigationPaused:!1,summary:"Protection is in its normal posture."}}function E(t,i){if(i.mitigationPause)return t.map((e)=>({...e,enabled:!1}));if(!i.attackMode)return[...t];return t.map((e)=>({...e,action:e.action==="deny"?"deny":"challenge",burst:Math.max(1,Math.min(e.burst??e.limit,5))}))}function T(t,i){let e=[...new Set([...t.allowlist??[],...i.ipRules.allow])],o=[...new Set([...t.blocklist??[],...i.ipRules.block])];if(i.mitigationPause)return{...t,allowlist:e,blocklist:o,monitorOnly:!0};if(!i.attackMode)return{...t,allowlist:e,blocklist:o};let r=t.thresholds??{};return{...t,allowlist:e,blocklist:o,thresholds:{...r,newConnectionsPerSecond:Math.max(1,Math.floor((r.newConnectionsPerSecond??50)/5)),concurrentPerSource:Math.max(1,Math.floor((r.concurrentPerSource??100)/5))}}}function v(t,i){let e=t?.infrastructure?.compute;if(!e||e.ddos===!1)return t;let o=typeof e.ddos==="object"&&e.ddos!==null?e.ddos:{};return{...t,infrastructure:{...t.infrastructure,compute:{...e,ddos:T(o,i)}}}}export{L as a,k as b,d as c,m as d,A as e,I as f,C as g,h,b as i,x as j,P as k,D as l,E as m,T as n,v as o};
@@ -1,6 +1,6 @@
1
- import{Cj as I,Dj as m,Mh as S,Nh as _,zj as C}from"./chunk-84703zpq.js";import{execSync as O}from"node:child_process";import{randomBytes as P}from"node:crypto";import{chmodSync as B,copyFileSync as F,existsSync as u,mkdirSync as L,readFileSync as T,statSync as J,writeFileSync as b}from"node:fs";import{tmpdir as z}from"node:os";import{basename as V,dirname as y,isAbsolute as k,join as a,resolve as W}from"node:path";import{fileURLToPath as A}from"node:url";function h(e){if(!e||typeof e!=="object")return e;return Object.fromEntries(Object.keys(e).map((r)=>[r,""]))}function E(e){let r=JSON.parse(JSON.stringify(e??{}));if(r.hetzner)delete r.hetzner.apiToken;delete r.aws,delete r.stateDir;for(let t of Object.values(r.sites??{})){if(t?.env)t.env=h(t.env);if(t?.environment)t.environment=h(t.environment)}for(let t of Object.values(r.environments??{}))if(t?.variables)t.variables=h(t.variables);for(let t of Object.values(r.infrastructure?.databases??{}))if(t?.password)t.password="";if(r.infrastructure?.appDatabase?.password)r.infrastructure.appDatabase.password="";if(r.infrastructure?.compute?.database?.password)r.infrastructure.compute.database.password="";if(r.infrastructure?.compute?.managedServices?.vitess?.password)r.infrastructure.compute.managedServices.vitess.password="";return r}function U(e){let r=E(e);return["// Generated by ts-cloud for the management dashboard — do not edit.","//","// This is the project's resolved cloud config, inlined so it needs no","// imports on the box. Credentials are deliberately absent.",`export default ${JSON.stringify(r,null,2)}`,""].join(`
1
+ import{Aj as C,Dj as I,Ej as m,Nh as S,Oh as _}from"./chunk-n20kbxwb.js";import{execSync as O}from"node:child_process";import{randomBytes as P}from"node:crypto";import{chmodSync as B,copyFileSync as F,existsSync as u,mkdirSync as L,readFileSync as T,statSync as J,writeFileSync as b}from"node:fs";import{tmpdir as z}from"node:os";import{basename as V,dirname as y,isAbsolute as k,join as a,resolve as W}from"node:path";import{fileURLToPath as A}from"node:url";function h(e){if(!e||typeof e!=="object")return e;return Object.fromEntries(Object.keys(e).map((r)=>[r,""]))}function E(e){let r=JSON.parse(JSON.stringify(e??{}));if(r.hetzner)delete r.hetzner.apiToken;delete r.aws,delete r.stateDir;for(let t of Object.values(r.sites??{})){if(t?.env)t.env=h(t.env);if(t?.environment)t.environment=h(t.environment)}for(let t of Object.values(r.environments??{}))if(t?.variables)t.variables=h(t.variables);for(let t of Object.values(r.infrastructure?.databases??{}))if(t?.password)t.password="";if(r.infrastructure?.appDatabase?.password)r.infrastructure.appDatabase.password="";if(r.infrastructure?.compute?.database?.password)r.infrastructure.compute.database.password="";if(r.infrastructure?.compute?.managedServices?.vitess?.password)r.infrastructure.compute.managedServices.vitess.password="";return r}function U(e){let r=E(e);return["// Generated by ts-cloud for the management dashboard — do not edit.","//","// This is the project's resolved cloud config, inlined so it needs no","// imports on the box. Credentials are deliberately absent.",`export default ${JSON.stringify(r,null,2)}`,""].join(`
2
2
  `)}var G="dashboard";function M(){return S("dashboard-credentials.json")}function H(){return P(24).toString("base64url")}function q(e,r,t){let s=process.env.TS_CLOUD_UI_PASSWORD?.trim();if(s)return{password:s,source:"env"};if(v(process.env.TS_CLOUD_UI_PUBLIC))return{password:void 0,source:"public"};let n=M(),i=_(e,"dashboard-credentials.json");try{if(u(i)){let o=JSON.parse(T(i,"utf8"));if(o?.password)return{password:o.password,source:"generated"}}}catch{}let d=H();try{L(y(i),{recursive:!0}),b(i,`${JSON.stringify({username:r,password:d,generatedAt:new Date().toISOString()},null,2)}
3
3
  `),B(i,384),t.info(`Management dashboard: generated a password for '${r}' and saved it to ${n} (read it there — it is not printed). Set TS_CLOUD_UI_PASSWORD to pin your own, or TS_CLOUD_UI_PUBLIC=1 to serve without auth.`)}catch(o){t.warn(`Management dashboard: could not persist the generated password (${o?.message??o}). Using it for this deploy only — pass: ${d}
4
4
  This password is now in your deploy log. Set TS_CLOUD_UI_PASSWORD to a value of your own and redeploy once ${n} is writable.`)}return{password:d,source:"generated"}}var R={info:()=>{},warn:()=>{}};function v(e){return e!=null&&e!==""&&e!=="0"&&e.toLowerCase()!=="false"}function K(){return S("dashboard-release")}function j(){let e=y(A(import.meta.url));for(let r of[a(e,"..","..","package.json"),a(e,"..","package.json")])try{let t=JSON.parse(T(r,"utf8"));if(t.name==="@stacksjs/ts-cloud"&&t.version)return`^${t.version}`}catch{}return"latest"}function Q(){return process.env.TS_CLOUD_UI_VERSION?.trim()||j()}function X(e,r,t){if(!e?.project?.slug)return t.warn("Management dashboard: the cloud config has no project slug — skipping the live dashboard."),null;let s=_(r,"dashboard-release");try{L(s,{recursive:!0}),b(a(s,"cloud.config.ts"),U(e));let n=Q();if(n.startsWith("file:")){let d=n.slice(5),o=k(d)?d:W(r,d);if(!u(o)||!J(o).isFile())n=j(),t.warn(`Management dashboard: TS_CLOUD_UI_VERSION points to a missing package file (${o}); using the deploying ts-cloud version ${n} instead.`);else{let c=V(o),l=a(s,c);if(o!==l)F(o,l);n=`file:./${c}`}}let i={name:"ts-cloud-dashboard",private:!0,type:"module",dependencies:{"@stacksjs/ts-cloud":n}};return b(a(s,"package.json"),`${JSON.stringify(i,null,2)}
5
5
  `),K()}catch(n){return t.warn(`Management dashboard: could not stage the live release (${n?.message??n}) — skipping.`),null}}function Y(e){if(u(a(e,"packages","ui","pages"))||u(a(e,"packages","ui","package.json")))return{uiRoot:"packages/ui/dist",build:"cd packages/ui && bun install && bun run build"};let r=y(A(import.meta.url)),t=[a(r,"ui"),a(r,"..","ui"),a(r,"..","..","ui"),a(r,"..","dist","ui")];for(let s of t)if(u(a(s,"index.html"))||u(a(s,"serverless.html")))return{uiRoot:s,build:!1};return null}function de(e,r={}){let t=r.logger??R,s=r.cwd??process.cwd();if(v(process.env.TS_CLOUD_UI_DISABLE))return t.info("Management dashboard: skipped (TS_CLOUD_UI_DISABLE set)."),e;if(e.cloud?.attachTo)return t.info(`Management dashboard: ${e.project.slug} is attached to ${e.cloud.attachTo}; the server owner's dashboard monitors every attached project.`),e;if(C(e))return e;let n=e.environments&&Object.keys(e.environments)[0],i=process.env.TS_CLOUD_UI_DOMAIN?.trim()||void 0,d=Number(process.env.TS_CLOUD_UI_PORT)||void 0,o={...e.sites??{}};if(!v(process.env.TS_CLOUD_UI_STATIC)){let g=X(e,s,t);if(!g)return e;let p=m(e,n??"production",{uiRoot:g,build:!1,domain:i,port:d,live:!0});if(p.length===0)return t.info("Management dashboard: no domain resolved (set TS_CLOUD_UI_DOMAIN or configure a site domain) — skipping."),e;for(let{name:N,site:w}of p)o[N]=w,t.info(`Management dashboard → https://${w.domain} (sign in with your ts-cloud account; the first deploy prints an admin password once)`);return e.sites=o,e}let c=Y(s);if(!c)return t.info("Management dashboard: UI not found (no local ui/ or packaged dist/ui) — skipping auto-deploy."),e;let l=process.env.TS_CLOUD_UI_USERNAME?.trim()||"admin",f=q(s,l,t),D=m(e,n??"production",{uiRoot:c.uiRoot,build:c.build,domain:i,username:l,password:f.password,realm:process.env.TS_CLOUD_UI_REALM?.trim()||void 0,live:!1,port:d});if(D.length===0)return t.info("Management dashboard: no domain resolved (set TS_CLOUD_UI_DOMAIN or configure a site domain) — skipping."),e;let x=f.source==="public"?"NO AUTH — TS_CLOUD_UI_PUBLIC is set (dashboard is publicly reachable)":f.source==="env"?"htpasswd-protected (TS_CLOUD_UI_PASSWORD)":`htpasswd-protected (auto-generated — see ${M()})`;t.warn("Management dashboard: static mode — one shared password, and no per-site collaborators. Unset TS_CLOUD_UI_STATIC for the live dashboard.");for(let{name:g,site:p}of D)o[g]=p,t.info(`Management dashboard → https://${p.domain} (${x})`);return e.sites=o,e}function ue(e){return Object.keys(e.sites??{}).filter(I)}function ce(e,r){if(!e?.root)return null;let t=r.cwd??process.cwd(),s=r.logger??R;try{if(typeof e.build==="string"&&e.build.trim())s.info(`Management dashboard: building UI (${e.build})`),O(e.build,{cwd:t,stdio:"inherit"});let n=k(e.root)?e.root:a(t,e.root);if(!u(n))return s.warn(`Management dashboard: build output not found at ${n} — skipping dashboard artifact.`),null;let i=a(z(),`${r.slug}-${r.siteName??G}-${r.sha}.tar.gz`);return O(`tar czf "${i}" -C "${n}" .`,{stdio:"inherit"}),i}catch(n){return s.warn(`Management dashboard: failed to build artifact — ${n?.message??n}. Skipping dashboard deploy.`),null}}
6
- export{G as vf,M as wf,q as xf,K as yf,Q as zf,X as Af,Y as Bf,de as Cf,ue as Df,ce as Ef};
6
+ export{G as wf,M as xf,q as yf,K as zf,Q as Af,X as Bf,Y as Cf,de as Df,ue as Ef,ce as Ff};
@@ -1,4 +1,4 @@
1
- import{nh as U,oh as L}from"./chunk-mhrtx0p1.js";import{Ap as K}from"./chunk-re15e6p4.js";import*as c from"node:crypto";import{readFileSync as D}from"node:fs";import{readdir as z}from"node:fs/promises";import{join as M}from"node:path";function R(e){if(e){let r=O(e);if(!r)throw Error(`AWS profile '${e}' not found in ~/.aws/credentials`);return r}let t=process.env.AWS_ACCESS_KEY_ID,s=process.env.AWS_SECRET_ACCESS_KEY;if(t&&s)return{accessKeyId:t,secretAccessKey:s,sessionToken:process.env.AWS_SESSION_TOKEN};return O(process.env.AWS_PROFILE||"default")??{accessKeyId:"",secretAccessKey:""}}function O(e){let{existsSync:t,readFileSync:s}=K("node:fs"),{homedir:r}=K("node:os"),{join:n}=K("node:path"),i=process.env.AWS_SHARED_CREDENTIALS_FILE||n(r(),".aws","credentials");if(!t(i))return null;let o=s(i,"utf-8"),a=null,g,l,u;for(let d of o.split(`
1
+ import{oh as U,ph as L}from"./chunk-bzth6d1s.js";import{Bp as K}from"./chunk-m07s5esk.js";import*as c from"node:crypto";import{readFileSync as D}from"node:fs";import{readdir as z}from"node:fs/promises";import{join as M}from"node:path";function R(e){if(e){let r=O(e);if(!r)throw Error(`AWS profile '${e}' not found in ~/.aws/credentials`);return r}let t=process.env.AWS_ACCESS_KEY_ID,s=process.env.AWS_SECRET_ACCESS_KEY;if(t&&s)return{accessKeyId:t,secretAccessKey:s,sessionToken:process.env.AWS_SESSION_TOKEN};return O(process.env.AWS_PROFILE||"default")??{accessKeyId:"",secretAccessKey:""}}function O(e){let{existsSync:t,readFileSync:s}=K("node:fs"),{homedir:r}=K("node:os"),{join:n}=K("node:path"),i=process.env.AWS_SHARED_CREDENTIALS_FILE||n(r(),".aws","credentials");if(!t(i))return null;let o=s(i,"utf-8"),a=null,g,l,u;for(let d of o.split(`
2
2
  `)){let y=d.trim();if(!y||y.startsWith("#")||y.startsWith(";"))continue;let h=y.match(/^\[([^\]]+)\]$/);if(h){if(a===e&&g&&l)return{accessKeyId:g,secretAccessKey:l,sessionToken:u};a=h[1],g=void 0,l=void 0,u=void 0;continue}if(a===e){let[S,...m]=y.split("="),p=m.join("=").trim();switch(S.trim().toLowerCase()){case"aws_access_key_id":g=p;break;case"aws_secret_access_key":l=p;break;case"aws_session_token":u=p;break}}}if(a===e&&g&&l)return{accessKeyId:g,secretAccessKey:l,sessionToken:u};return null}function B(e){let{buffer:t,byteOffset:s,byteLength:r}=e;if(t instanceof ArrayBuffer)return t.slice(s,s+r);let n=new ArrayBuffer(r);return new Uint8Array(n).set(new Uint8Array(e)),n}class V{client;region;explicitProfile;endpoint;endpointProtocol="https";forcePathStyle;explicitCredentials;constructor(e="us-east-1",t,s){let r=typeof e==="string"?s:e,n=typeof e==="string"?e:e.region??"us-east-1",i=typeof e==="string"?t:e.profile,o=r?.endpoint?U({region:n,path:"/",endpoint:r.endpoint}):void 0;this.region=n,this.explicitProfile=i,this.endpoint=o?.host,this.endpointProtocol=o?.protocol??"https",this.forcePathStyle=r?.forcePathStyle,this.explicitCredentials=r?.credentials,this.client=new L(r?.credentials,{profile:i,endpoint:r?.endpoint,forcePathStyle:r?.forcePathStyle})}getCredentials(){if(this.explicitCredentials?.accessKeyId&&this.explicitCredentials.secretAccessKey)return this.explicitCredentials;let e=R(this.explicitProfile);if(e.accessKeyId&&e.secretAccessKey)return e;throw Error("S3 credentials not found. Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY (or pass explicit credentials/profile), or configure ~/.aws/credentials.")}s3BaseHost(){return this.endpoint||`s3.${this.region}.amazonaws.com`}s3VirtualHost(e){return this.forcePathStyle?this.s3BaseHost():`${e}.${this.s3BaseHost()}`}objectPath(e,t){return this.forcePathStyle?`/${e}/${t}`:`/${t}`}objectUrl(e,t){return`${this.endpointProtocol}://${this.s3VirtualHost(e)}${this.objectPath(e,t)}`}async listBuckets(){let e=await this.client.request({service:"s3",region:this.region,method:"GET",path:"/"}),t=[],r=(e?.ListAllMyBucketsResult??e)?.Buckets?.Bucket;if(r){let n=Array.isArray(r)?r:[r];for(let i of n)t.push({Name:i.Name,CreationDate:i.CreationDate})}return{Buckets:t}}async createBucket(e,t){let s={};if(t?.acl)s["x-amz-acl"]=t.acl;let r;if(this.region!=="us-east-1"&&!this.endpoint)r=`<?xml version="1.0" encoding="UTF-8"?>
3
3
  <CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
4
4
  <LocationConstraint>${this.region}</LocationConstraint>
@@ -89,4 +89,4 @@ host:${o}
89
89
  ${t.map((n)=>`<Object><Key>${n.Key}</Key>${n.VersionId?`<VersionId>${n.VersionId}</VersionId>`:""}</Object>`).join(`
90
90
  `)}
91
91
  </Delete>`,r=c.createHash("md5").update(s).digest("base64");await this.client.request({service:"s3",region:this.region,method:"POST",path:`/${e}`,queryParams:{delete:""},body:s,headers:{"Content-Type":"application/xml","Content-MD5":r}})}}
92
- export{R as Ag,V as Bg};
92
+ export{R as Bg,V as Cg};
@@ -1,2 +1,2 @@
1
- import{oh as n}from"./chunk-mhrtx0p1.js";class s{client;region;constructor(t="us-east-1",e){this.region=t,this.client=new n(void 0,{profile:e})}async getCallerIdentity(){let t=await this.client.request({service:"sts",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"Action=GetCallerIdentity&Version=2011-06-15"});if(typeof t==="string"){let r=t.match(/<Account>(\d+)<\/Account>/),i=t.match(/<UserId>([^<]+)<\/UserId>/),c=t.match(/<Arn>([^<]+)<\/Arn>/);return{Account:r?.[1],UserId:i?.[1],Arn:c?.[1]}}let e=t?.GetCallerIdentityResponse?.GetCallerIdentityResult||t?.GetCallerIdentityResult;if(e)return{Account:String(e.Account),UserId:e.UserId,Arn:e.Arn};if(t?.Account)return{Account:String(t.Account),UserId:t.UserId,Arn:t.Arn};return{Account:void 0,UserId:void 0,Arn:void 0}}}
1
+ import{ph as n}from"./chunk-bzth6d1s.js";class s{client;region;constructor(t="us-east-1",e){this.region=t,this.client=new n(void 0,{profile:e})}async getCallerIdentity(){let t=await this.client.request({service:"sts",region:this.region,method:"POST",path:"/",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:"Action=GetCallerIdentity&Version=2011-06-15"});if(typeof t==="string"){let r=t.match(/<Account>(\d+)<\/Account>/),i=t.match(/<UserId>([^<]+)<\/UserId>/),c=t.match(/<Arn>([^<]+)<\/Arn>/);return{Account:r?.[1],UserId:i?.[1],Arn:c?.[1]}}let e=t?.GetCallerIdentityResponse?.GetCallerIdentityResult||t?.GetCallerIdentityResult;if(e)return{Account:String(e.Account),UserId:e.UserId,Arn:e.Arn};if(t?.Account)return{Account:String(t.Account),UserId:t.UserId,Arn:t.Arn};return{Account:void 0,UserId:void 0,Arn:void 0}}}
2
2
  export{s as fd};
@@ -0,0 +1 @@
1
+ import{fd as a}from"./chunk-empfsmdk.js";import"./chunk-bzth6d1s.js";import"./chunk-m07s5esk.js";export{a as STSClient};
@@ -1,3 +1,3 @@
1
- import{Ff as m,Of as l,ag as g,dg as f,eg as d,og as C}from"./chunk-ftcjjf76.js";function R(e){return`'${e.split("'").join("'\\''")}'`}function p(e){let r=e.user||"root",s=e.script.join(`
1
+ import{Gf as m,Pf as l,bg as g,eg as f,fg as d,pg as C}from"./chunk-tjgy10zm.js";function R(e){return`'${e.split("'").join("'\\''")}'`}function p(e){let r=e.user||"root",s=e.script.join(`
2
2
  `),t=r==="root"?'bash -l "$TS_CLOUD_RECIPE"':`runuser -l ${R(r)} -c "bash $TS_CLOUD_RECIPE"`;return["set -uo pipefail",`echo "__TS_CLOUD_RECIPE_BEGIN__ ${e.name} (user=${r})"`,"TS_CLOUD_RECIPE=$(mktemp)",`cat > "$TS_CLOUD_RECIPE" <<'TS_CLOUD_RECIPE_EOF'`,s,"TS_CLOUD_RECIPE_EOF",'chmod +r "$TS_CLOUD_RECIPE"',t,"TS_CLOUD_RC=$?",'rm -f "$TS_CLOUD_RECIPE"',`echo "__TS_CLOUD_RECIPE_END__ ${e.name} exit=$TS_CLOUD_RC"`,"exit $TS_CLOUD_RC"]}var c={info:()=>{},warn:()=>{},error:()=>{},step:()=>{},success:()=>{}};async function i(e){return await e.driver.findComputeTargets({slug:e.slug,environment:e.environment,role:e.role||"app"})}async function y(e,r){let s=e.logger||c,t=await i(e);if(t.length===0)return{success:!1,error:`No '${e.role||"app"}' servers found for ${e.slug}/${e.environment}.`};let n=m(e.slug,r.siteName),u=d(n,r.to||"unused"),o=["set -uo pipefail",...C(u,{...r.to?{to:r.to}:{},unitBase:`${e.slug}-${r.siteName}`}),`(cd ${l} && pantry restart php-fpm) 2>/dev/null || true`,`(cd ${u.current} && eval "$(cd ${l} && pantry env 2>/dev/null)" && php artisan queue:restart) 2>/dev/null || true`];s.step(`Rolling back ${r.siteName}${r.to?` to ${r.to}`:" to the previous release"} on ${t.length} server(s)...`);let a=await e.driver.runRemoteDeploy({targets:t,commands:o,comment:`ts-cloud rollback ${e.slug}/${r.siteName}`,tags:{Project:e.slug,Environment:e.environment,Role:e.role||"app"}});if(!a.success)s.error(`Rollback failed: ${a.error||"unknown error"}`);else s.success(`Rolled back ${r.siteName}.`);return{success:a.success,error:a.error,perInstance:a.perInstance}}async function h(e,r){let s=await i(e);if(s.length===0)return{success:!1,error:`No '${e.role||"app"}' servers found for ${e.slug}/${e.environment}.`};let t=f(m(e.slug,r.siteName)),n=Math.max(1,r.limit??20),u=[`[ -f ${t} ] && tail -n ${n} ${t} || echo "no deploy history for ${r.siteName}"`],o=await e.driver.runRemoteDeploy({targets:s,commands:u,comment:`ts-cloud deploy:history ${e.slug}/${r.siteName}`,tags:{Project:e.slug,Environment:e.environment,Role:e.role||"app"}});return{success:o.success,error:o.error,perInstance:o.perInstance}}async function I(e,r){let s=e.logger||c,t=await i(e);if(t.length===0)return{success:!1,error:`No '${e.role||"app"}' servers found for ${e.slug}/${e.environment}.`};s.step(`Running recipe '${r.name}' as ${r.user||"root"} on ${t.length} server(s)...`);let n=await e.driver.runRemoteDeploy({targets:t,commands:p({name:r.name,script:r.script,user:r.user}),comment:`ts-cloud recipe ${r.name}`,tags:{Project:e.slug,Environment:e.environment,Role:e.role||"app"}});if(!n.success)s.error(`Recipe '${r.name}' failed: ${n.error||"unknown error"}`);else s.success(`Recipe '${r.name}' completed.`);return{success:n.success,error:n.error,perInstance:n.perInstance}}async function P(e,r){let s=e.logger||c;if(!r.database?.name)return{success:!1,error:"No appDatabase configured to restore."};let t=await i(e);if(t.length===0)return{success:!1,error:`No '${e.role||"app"}' servers found for ${e.slug}/${e.environment}.`};s.step(`Restoring database '${r.database.name}'${r.from?` from ${r.from}`:" from the latest backup"} on ${t.length} server(s)...`);let n=await e.driver.runRemoteDeploy({targets:t,commands:g(r.database,{from:r.from}),comment:`ts-cloud db:restore ${e.slug}/${r.database.name}`,tags:{Project:e.slug,Environment:e.environment,Role:e.role||"app"}});if(!n.success)s.error(`Restore failed: ${n.error||"unknown error"}`);else s.success(`Restored ${r.database.name}.`);return{success:n.success,error:n.error,perInstance:n.perInstance}}
3
3
  export{y as xd,h as yd,I as zd,P as Ad};
@@ -1 +1 @@
1
- import{a as y,b as z,c as A,d as B,e as C,f as D,g as E,h as F,i as G,j as H,k as I,l as J,m as K,n as L,o as M}from"./chunk-akwfvn5k.js";import{hf as s,if as t,jf as u,kf as v,lf as w,mf as x}from"./chunk-j2cb8we4.js";import{nf as k,of as l,pf as m,qf as n,rf as o,sf as p,tf as q,uf as r}from"./chunk-5gx38418.js";import{Ko as a,Lo as b,Mo as c,No as d,Oo as e,Po as f,Qo as g,Ro as h,So as i,To as j}from"./chunk-84703zpq.js";import"./chunk-re15e6p4.js";export{b as CHAIN_HEADER,H as DEFAULT_ATTACK_MODE_HOURS,k as DEFAULT_DDOS_THRESHOLDS,e as DEFAULT_RECURSION_LIMITS,a as DEPTH_HEADER,G as MAX_CONTROL_HOURS,F as PROTECTION_SETTING,I as ProtectionControlStore,y as RATE_LIMIT_KEY_SEPARATOR,C as RateLimiter,h as RecursionGuard,c as TRACE_HEADER,L as applyControlsToDdos,K as applyControlsToRateLimits,r as applyMitigationFactor,E as defaultRateLimitRules,J as describePosture,s as escapeSecLang,d as functionFingerprint,z as globMatches,u as globToRegex,g as inspectInvocation,t as isSafePattern,l as isValidCidr,M as mergeControlsIntoConfig,f as parseChain,q as planMitigation,i as propagationHeaders,D as rateLimitHeaders,B as rateLimitKey,j as recursionBlockedResponse,p as renderDdosInstallScript,o as renderNftablesRuleset,n as renderSysctlFile,v as renderWafConfig,w as renderWafInstallScript,A as ruleMatches,m as sysctlHardening,x as wafEventTelemetry};
1
+ import{a as y,b as z,c as A,d as B,e as C,f as D,g as E,h as F,i as G,j as H,k as I,l as J,m as K,n as L,o as M}from"./chunk-d2aaef9v.js";import{if as s,jf as t,kf as u,lf as v,mf as w,nf as x}from"./chunk-5x4rdx8k.js";import{of as k,pf as l,qf as m,rf as n,sf as o,tf as p,uf as q,vf as r}from"./chunk-85qrgshq.js";import{Lo as a,Mo as b,No as c,Oo as d,Po as e,Qo as f,Ro as g,So as h,To as i,Uo as j}from"./chunk-n20kbxwb.js";import"./chunk-m07s5esk.js";export{b as CHAIN_HEADER,H as DEFAULT_ATTACK_MODE_HOURS,k as DEFAULT_DDOS_THRESHOLDS,e as DEFAULT_RECURSION_LIMITS,a as DEPTH_HEADER,G as MAX_CONTROL_HOURS,F as PROTECTION_SETTING,I as ProtectionControlStore,y as RATE_LIMIT_KEY_SEPARATOR,C as RateLimiter,h as RecursionGuard,c as TRACE_HEADER,L as applyControlsToDdos,K as applyControlsToRateLimits,r as applyMitigationFactor,E as defaultRateLimitRules,J as describePosture,s as escapeSecLang,d as functionFingerprint,z as globMatches,u as globToRegex,g as inspectInvocation,t as isSafePattern,l as isValidCidr,M as mergeControlsIntoConfig,f as parseChain,q as planMitigation,i as propagationHeaders,D as rateLimitHeaders,B as rateLimitKey,j as recursionBlockedResponse,p as renderDdosInstallScript,o as renderNftablesRuleset,n as renderSysctlFile,v as renderWafConfig,w as renderWafInstallScript,A as ruleMatches,m as sysctlHardening,x as wafEventTelemetry};
@@ -1 +1 @@
1
- import{$b as z,$c as Aa,Ac as _,Bc as aa,Cb as a,Cc as ba,Db as b,Dc as ca,Eb as c,Ec as da,Fb as d,Fc as ea,Gb as e,Gc as fa,Hb as f,Hc as ga,Ib as g,Ic as ha,Jb as h,Jc as ia,Kb as i,Kc as ja,Lb as j,Lc as ka,Mb as k,Mc as la,Nb as l,Nc as ma,Ob as m,Oc as na,Pb as n,Pc as oa,Qb as o,Qc as pa,Rb as p,Rc as qa,Sb as q,Sc as ra,Tb as r,Tc as sa,Ub as s,Uc as ta,Vb as t,Vc as ua,Wb as u,Wc as va,Xb as v,Xc as wa,Yb as w,Yc as xa,Zb as x,Zc as ya,_b as y,_c as za,ac as A,ad as Ba,bc as B,cc as C,dc as D,dd as Ca,ec as E,ed as Da,fc as F,gc as G,hc as H,ic as I,jc as J,kc as K,lc as L,mc as M,nc as N,oc as O,pc as P,qc as Q,rc as R,sc as S,tc as T,uc as U,vc as V,wc as W,xc as X,yc as Y,zc as Z}from"./chunk-0x8szp53.js";import"./chunk-5gx38418.js";import"./chunk-3g80gjw6.js";import"./chunk-84703zpq.js";import"./chunk-re15e6p4.js";export{Z as AnomalyConfigStore,za as AwsSpendTransport,Aa as ComputeSpendTransport,x as CounterTracker,u as DEFAULT_METER_MAPPINGS,l as DEFAULT_PRICE_BOOK,B as DEFAULT_THRESHOLDS,_ as DETECTABLE_SIGNALS,c as ENFORCEMENT_ACTIONS,K as ENFORCEMENT_DESCRIPTIONS,d as ENFORCEMENT_SEVERITY,ea as FOCUS_VERSION,b as METERS,a as METER_KEYS,e as MICRO_CENTS,G as MIN_PROJECTION_CONFIDENCE,pa as RecordingSpendTransport,X as SENSITIVITY_THRESHOLDS,xa as SPEND_CYCLE_SECONDS,ka as SPEND_GATE_SETTING,ua as SPEND_LEASE_SETTING,ba as SignalSource,ma as SpendCapError,la as SpendGate,va as SpendLoopLease,ta as SpendNotificationRouter,wa as SpendRunner,ia as SpendService,C as SpendStore,qa as URGENT_SPEND_EVENTS,L as USER_VISIBLE_ACTIONS,z as aggregateDeltas,W as anomalyOptionsForSignal,na as assertSpendAllows,q as budgetWindow,Ba as compositeSpendTransport,oa as createEnforcementHandlers,U as detectAnomalies,V as detectLatestAnomaly,I as evaluateBudget,T as ewma,v as findMapping,g as findPriceEntry,ra as formatCents,F as formatTimeToExhaustion,H as governingLimitCents,Ca as handleSpendRequest,s as hourBucket,t as hourBucketsBetween,P as isOperationAllowed,m as isValidTimeZone,da as lookbackHoursForSignal,Q as median,R as medianAbsoluteDeviation,J as mergeDecisions,k as mergePriceBooks,y as meterTelemetry,ca as optionsForSignal,E as percentOfLimit,M as planEnforcement,r as previousBudgetWindow,h as priceUsage,i as priceUsageLines,D as projectSpend,S as robustZScore,j as roundCents,Y as routeMatches,N as runEnforcement,A as scopeKey,aa as signalDefinition,sa as spendNotificationText,Da as spendOpenApiPaths,ya as startSpendLoop,ha as streamFocusJsonl,O as strongestActiveAction,f as tieredMicroCents,ga as toFocusJsonl,fa as toFocusRecords,w as usageDeltaKey,p as utcInstantOfLocal,ja as zeroFill,o as zoneOffsetMs,n as zonedParts};
1
+ import{$b as z,$c as Aa,Ac as _,Bc as aa,Cb as a,Cc as ba,Db as b,Dc as ca,Eb as c,Ec as da,Fb as d,Fc as ea,Gb as e,Gc as fa,Hb as f,Hc as ga,Ib as g,Ic as ha,Jb as h,Jc as ia,Kb as i,Kc as ja,Lb as j,Lc as ka,Mb as k,Mc as la,Nb as l,Nc as ma,Ob as m,Oc as na,Pb as n,Pc as oa,Qb as o,Qc as pa,Rb as p,Rc as qa,Sb as q,Sc as ra,Tb as r,Tc as sa,Ub as s,Uc as ta,Vb as t,Vc as ua,Wb as u,Wc as va,Xb as v,Xc as wa,Yb as w,Yc as xa,Zb as x,Zc as ya,_b as y,_c as za,ac as A,ad as Ba,bc as B,cc as C,dc as D,dd as Ca,ec as E,ed as Da,fc as F,gc as G,hc as H,ic as I,jc as J,kc as K,lc as L,mc as M,nc as N,oc as O,pc as P,qc as Q,rc as R,sc as S,tc as T,uc as U,vc as V,wc as W,xc as X,yc as Y,zc as Z}from"./chunk-bpps61am.js";import"./chunk-85qrgshq.js";import"./chunk-jxd3j00s.js";import"./chunk-n20kbxwb.js";import"./chunk-m07s5esk.js";export{Z as AnomalyConfigStore,za as AwsSpendTransport,Aa as ComputeSpendTransport,x as CounterTracker,u as DEFAULT_METER_MAPPINGS,l as DEFAULT_PRICE_BOOK,B as DEFAULT_THRESHOLDS,_ as DETECTABLE_SIGNALS,c as ENFORCEMENT_ACTIONS,K as ENFORCEMENT_DESCRIPTIONS,d as ENFORCEMENT_SEVERITY,ea as FOCUS_VERSION,b as METERS,a as METER_KEYS,e as MICRO_CENTS,G as MIN_PROJECTION_CONFIDENCE,pa as RecordingSpendTransport,X as SENSITIVITY_THRESHOLDS,xa as SPEND_CYCLE_SECONDS,ka as SPEND_GATE_SETTING,ua as SPEND_LEASE_SETTING,ba as SignalSource,ma as SpendCapError,la as SpendGate,va as SpendLoopLease,ta as SpendNotificationRouter,wa as SpendRunner,ia as SpendService,C as SpendStore,qa as URGENT_SPEND_EVENTS,L as USER_VISIBLE_ACTIONS,z as aggregateDeltas,W as anomalyOptionsForSignal,na as assertSpendAllows,q as budgetWindow,Ba as compositeSpendTransport,oa as createEnforcementHandlers,U as detectAnomalies,V as detectLatestAnomaly,I as evaluateBudget,T as ewma,v as findMapping,g as findPriceEntry,ra as formatCents,F as formatTimeToExhaustion,H as governingLimitCents,Ca as handleSpendRequest,s as hourBucket,t as hourBucketsBetween,P as isOperationAllowed,m as isValidTimeZone,da as lookbackHoursForSignal,Q as median,R as medianAbsoluteDeviation,J as mergeDecisions,k as mergePriceBooks,y as meterTelemetry,ca as optionsForSignal,E as percentOfLimit,M as planEnforcement,r as previousBudgetWindow,h as priceUsage,i as priceUsageLines,D as projectSpend,S as robustZScore,j as roundCents,Y as routeMatches,N as runEnforcement,A as scopeKey,aa as signalDefinition,sa as spendNotificationText,Da as spendOpenApiPaths,ya as startSpendLoop,ha as streamFocusJsonl,O as strongestActiveAction,f as tieredMicroCents,ga as toFocusJsonl,fa as toFocusRecords,w as usageDeltaKey,p as utcInstantOfLocal,ja as zeroFill,o as zoneOffsetMs,n as zonedParts};