@stacksjs/ts-cloud 0.9.3 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/dist/aws/index.js +1 -269
  2. package/dist/bin/chunk-08c0pzkb.js +1 -0
  3. package/dist/bin/chunk-12210qvj.js +1 -0
  4. package/dist/bin/chunk-1v6bt68w.js +6 -0
  5. package/dist/bin/chunk-35ttwn26.js +70 -0
  6. package/dist/bin/chunk-3r3be05z.js +1 -0
  7. package/dist/bin/chunk-41yqpdv7.js +2 -0
  8. package/dist/bin/chunk-5rv31chh.js +1 -0
  9. package/dist/bin/chunk-6eat8ezk.js +2 -0
  10. package/dist/bin/chunk-6gktf2m2.js +1 -0
  11. package/dist/bin/chunk-6zjy949y.js +141 -0
  12. package/dist/bin/chunk-7wzdaqh6.js +2 -0
  13. package/dist/bin/chunk-80ar3aty.js +1 -0
  14. package/dist/bin/chunk-8rwhsp5b.js +2 -0
  15. package/dist/bin/chunk-936vp7dx.js +44 -0
  16. package/dist/bin/chunk-9px3rg4a.js +4 -0
  17. package/dist/bin/chunk-anm3ae6z.js +7364 -0
  18. package/dist/bin/{chunk-ynjvbphf.js → chunk-axvr7dwa.js} +6 -6
  19. package/dist/bin/chunk-b0hj9m5e.js +2 -0
  20. package/dist/bin/{chunk-mh0kdzqp.js → chunk-b2ymh8k0.js} +1 -1
  21. package/dist/bin/chunk-b35989e3.js +50 -0
  22. package/dist/bin/chunk-c2b6nk0q.js +37 -0
  23. package/dist/bin/chunk-ckxpgwxw.js +3 -0
  24. package/dist/bin/chunk-d6zzgvtn.js +92 -0
  25. package/dist/bin/chunk-da8zpf82.js +1 -0
  26. package/dist/bin/chunk-ddmjjstg.js +1 -0
  27. package/dist/bin/chunk-dhhz4zyj.js +1 -0
  28. package/dist/bin/chunk-dj9a67c3.js +9 -0
  29. package/dist/bin/chunk-ds1z880f.js +1 -0
  30. package/dist/bin/chunk-dvkj4k6h.js +111 -0
  31. package/dist/bin/chunk-eh40fpvj.js +1 -0
  32. package/dist/bin/chunk-ey9fagrr.js +6 -0
  33. package/dist/bin/chunk-ezftw2q4.js +1 -0
  34. package/dist/bin/chunk-g6a4n3rh.js +1 -0
  35. package/dist/bin/chunk-g90nqfgv.js +585 -0
  36. package/dist/bin/chunk-gs40j75w.js +1 -0
  37. package/dist/bin/chunk-jjjts1vt.js +1 -0
  38. package/dist/bin/{chunk-ry030a6b.js → chunk-jnsbzqzz.js} +30 -30
  39. package/dist/bin/chunk-jnx4jgw8.js +1 -0
  40. package/dist/bin/chunk-jt1tndm2.js +3 -0
  41. package/dist/bin/chunk-kybdb0ws.js +2 -0
  42. package/dist/bin/chunk-m3nqw76h.js +3 -0
  43. package/dist/bin/chunk-mn6j22zn.js +6 -0
  44. package/dist/bin/chunk-nb0yjkv5.js +2 -0
  45. package/dist/bin/chunk-pjpa4x52.js +2 -0
  46. package/dist/bin/chunk-pkgkfe6s.js +2 -0
  47. package/dist/bin/chunk-pnz5hk8n.js +60 -0
  48. package/dist/bin/chunk-q46zr2tv.js +1 -0
  49. package/dist/bin/chunk-qtdngvs8.js +1 -0
  50. package/dist/bin/chunk-sbejksrh.js +2 -0
  51. package/dist/bin/chunk-svyd4v6c.js +34 -0
  52. package/dist/bin/chunk-tna7ay8d.js +1 -0
  53. package/dist/bin/chunk-tp4c2mv1.js +1 -0
  54. package/dist/bin/chunk-w5d6tr2x.js +1 -0
  55. package/dist/bin/chunk-wewcjam5.js +1 -0
  56. package/dist/bin/chunk-xv4bscrm.js +1 -0
  57. package/dist/bin/chunk-y9eyc5pw.js +1 -0
  58. package/dist/bin/chunk-y9f8649w.js +512 -0
  59. package/dist/bin/cli.js +428 -418
  60. package/dist/bin/dashboard-server.js +1 -1
  61. package/dist/chunk-06jk7ba9.js +7355 -0
  62. package/dist/chunk-0e16qt6k.js +5 -0
  63. package/dist/chunk-13hxhzaz.js +34 -0
  64. package/dist/chunk-2p89vt3b.js +2 -0
  65. package/dist/chunk-77t2ctwn.js +2 -0
  66. package/dist/chunk-88z37ey4.js +114 -0
  67. package/dist/chunk-8c4715hz.js +2 -0
  68. package/dist/chunk-9a22225r.js +60 -0
  69. package/dist/chunk-as6by62d.js +1 -0
  70. package/dist/chunk-cd0zpxhf.js +44 -0
  71. package/dist/chunk-cp54a0qn.js +6 -0
  72. package/dist/chunk-d67xbk4v.js +141 -0
  73. package/dist/chunk-dckz9xve.js +2 -0
  74. package/dist/chunk-e1666vjv.js +2 -0
  75. package/dist/chunk-hhdx5k96.js +442 -0
  76. package/dist/chunk-kv2ztkp4.js +1617 -0
  77. package/dist/chunk-nrz6zypg.js +1 -0
  78. package/dist/chunk-q816js1y.js +1 -0
  79. package/dist/chunk-qh9ep11z.js +704 -0
  80. package/dist/chunk-rg720cqg.js +1 -0
  81. package/dist/chunk-snak8s7m.js +92 -0
  82. package/dist/chunk-vq737g82.js +1 -0
  83. package/dist/chunk-xd6w0c11.js +50 -0
  84. package/dist/chunk-xtwjt370.js +37 -0
  85. package/dist/chunk-y26yh5zp.js +1 -0
  86. package/dist/chunk-zmxffmmq.js +4 -0
  87. package/dist/deploy/attach-credentials.d.ts +4 -8
  88. package/dist/deploy/index.js +1 -168
  89. package/dist/dns/cloudflare.d.ts +27 -0
  90. package/dist/dns/godaddy.d.ts +18 -1
  91. package/dist/dns/index.d.ts +2 -0
  92. package/dist/dns/index.js +1 -41
  93. package/dist/dns/zone-migration.d.ts +92 -0
  94. package/dist/dns/zone-migration.test.d.ts +1 -0
  95. package/dist/drivers/hetzner/driver.d.ts +8 -1
  96. package/dist/drivers/index.js +1 -154
  97. package/dist/drivers/shared/compute-provision.d.ts +14 -2
  98. package/dist/drivers/shared/db-provision.d.ts +3 -2
  99. package/dist/drivers/shared/mail-provision.d.ts +116 -0
  100. package/dist/drivers/shared/mail-provision.test.d.ts +1 -0
  101. package/dist/drivers/shared/managed-services-probe.d.ts +47 -0
  102. package/dist/drivers/shared/managed-services-probe.test.d.ts +1 -0
  103. package/dist/drivers/shared/package-manager.d.ts +1 -0
  104. package/dist/drivers/shared/remote-failure.d.ts +21 -0
  105. package/dist/drivers/shared/remote-failure.test.d.ts +1 -0
  106. package/dist/drivers/shared/sqlite-shared-path.d.ts +50 -0
  107. package/dist/drivers/shared/sqlite-shared-path.test.d.ts +1 -0
  108. package/dist/index.d.ts +2 -0
  109. package/dist/index.js +100 -6129
  110. package/dist/operations/plan.d.ts +136 -0
  111. package/dist/operations/plan.test.d.ts +1 -0
  112. package/dist/operations/server-rename.d.ts +84 -0
  113. package/dist/operations/server-rename.test.d.ts +1 -0
  114. package/dist/operations/site-move.d.ts +263 -0
  115. package/dist/operations/site-move.test.d.ts +1 -0
  116. package/dist/protection/index.js +1 -89
  117. package/dist/push/index.js +1 -509
  118. package/dist/spend/index.js +1 -173
  119. package/dist/ui/404.html +1 -1
  120. package/dist/ui/accept-invitation.html +1 -1
  121. package/dist/ui/access-denied.html +1 -1
  122. package/dist/ui/account/automation.html +5 -5
  123. package/dist/ui/account/security.html +2 -2
  124. package/dist/ui/applications/compose.html +6 -6
  125. package/dist/ui/applications/new.html +2 -2
  126. package/dist/ui/data/backups.html +80 -80
  127. package/dist/ui/data/services.html +78 -78
  128. package/dist/ui/data/volumes.html +50 -50
  129. package/dist/ui/index.html +50 -50
  130. package/dist/ui/infrastructure/topology.html +118 -118
  131. package/dist/ui/integrations.html +1 -1
  132. package/dist/ui/operations/alerts.html +47 -47
  133. package/dist/ui/operations/configuration.html +5 -5
  134. package/dist/ui/operations/jobs.html +76 -76
  135. package/dist/ui/operations/maintenance.html +6 -6
  136. package/dist/ui/operations/observability.html +82 -82
  137. package/dist/ui/operations/previews.html +5 -5
  138. package/dist/ui/operations/queue.html +6 -6
  139. package/dist/ui/operations/regions.html +6 -6
  140. package/dist/ui/operations/releases.html +6 -6
  141. package/dist/ui/operations/spend.html +54 -54
  142. package/dist/ui/operations/workloads.html +104 -104
  143. package/dist/ui/security.html +2 -2
  144. package/dist/ui/server/actions.html +56 -56
  145. package/dist/ui/server/activity.html +1 -1
  146. package/dist/ui/server/capacity.html +6 -6
  147. package/dist/ui/server/database.html +106 -106
  148. package/dist/ui/server/deployments.html +50 -50
  149. package/dist/ui/server/diagnostics.html +2 -2
  150. package/dist/ui/server/firewall.html +76 -76
  151. package/dist/ui/server/fleet.html +34 -34
  152. package/dist/ui/server/logs.html +24 -24
  153. package/dist/ui/server/metrics.html +112 -112
  154. package/dist/ui/server/security.html +1 -1
  155. package/dist/ui/server/services.html +27 -27
  156. package/dist/ui/server/sites.html +120 -120
  157. package/dist/ui/server/ssh-keys.html +51 -51
  158. package/dist/ui/server/team.html +144 -144
  159. package/dist/ui/server/terminal.html +15 -15
  160. package/dist/ui/serverless/alarms.html +52 -52
  161. package/dist/ui/serverless/assets.html +27 -27
  162. package/dist/ui/serverless/cost.html +2 -2
  163. package/dist/ui/serverless/data.html +36 -36
  164. package/dist/ui/serverless/deployments.html +27 -27
  165. package/dist/ui/serverless/firewall.html +1 -1
  166. package/dist/ui/serverless/functions.html +40 -40
  167. package/dist/ui/serverless/logs.html +24 -24
  168. package/dist/ui/serverless/metrics.html +2 -2
  169. package/dist/ui/serverless/queues.html +47 -47
  170. package/dist/ui/serverless/secrets.html +52 -52
  171. package/dist/ui/serverless/traces.html +6 -6
  172. package/dist/ui/serverless.html +54 -54
  173. package/dist/ui-src/src/charts.ts +17499 -12662
  174. package/dist/ui-src/src/topology.ts +2 -2
  175. package/package.json +3 -3
  176. package/dist/bin/chunk-09nwf2gy.js +0 -34
  177. package/dist/bin/chunk-14cwr6eh.js +0 -70
  178. package/dist/bin/chunk-271gk1n2.js +0 -6
  179. package/dist/bin/chunk-38pq971s.js +0 -2
  180. package/dist/bin/chunk-3gykfyq4.js +0 -37
  181. package/dist/bin/chunk-3r4fb59r.js +0 -3
  182. package/dist/bin/chunk-41x17hw1.js +0 -1
  183. package/dist/bin/chunk-4vrqm9h0.js +0 -2
  184. package/dist/bin/chunk-57y1zxbf.js +0 -3
  185. package/dist/bin/chunk-598yf4bs.js +0 -1
  186. package/dist/bin/chunk-8v7ddyvf.js +0 -1
  187. package/dist/bin/chunk-92mea34a.js +0 -1
  188. package/dist/bin/chunk-9pvsff8g.js +0 -1
  189. package/dist/bin/chunk-9v39615t.js +0 -1
  190. package/dist/bin/chunk-avm7tnwe.js +0 -1
  191. package/dist/bin/chunk-ax9mr6wm.js +0 -44
  192. package/dist/bin/chunk-axhnkn5g.js +0 -2
  193. package/dist/bin/chunk-b5gd39s8.js +0 -512
  194. package/dist/bin/chunk-b9qbp8j1.js +0 -1
  195. package/dist/bin/chunk-bz828v8q.js +0 -3
  196. package/dist/bin/chunk-c1vcdgvr.js +0 -1
  197. package/dist/bin/chunk-ctd2vg9w.js +0 -2
  198. package/dist/bin/chunk-dbgffky8.js +0 -1
  199. package/dist/bin/chunk-dwr30vbv.js +0 -1
  200. package/dist/bin/chunk-e3xrwh9z.js +0 -1
  201. package/dist/bin/chunk-fhc6ntvd.js +0 -2
  202. package/dist/bin/chunk-fpm59y25.js +0 -6
  203. package/dist/bin/chunk-fvbxvq6b.js +0 -1
  204. package/dist/bin/chunk-fy8j3y8p.js +0 -92
  205. package/dist/bin/chunk-fz21b57w.js +0 -1
  206. package/dist/bin/chunk-gavvf0pg.js +0 -141
  207. package/dist/bin/chunk-ggn7ax8p.js +0 -4
  208. package/dist/bin/chunk-gpe2prkm.js +0 -1
  209. package/dist/bin/chunk-gqf6jsmy.js +0 -1
  210. package/dist/bin/chunk-h5pa5men.js +0 -2
  211. package/dist/bin/chunk-hm08xdxf.js +0 -2
  212. package/dist/bin/chunk-hzgz13nf.js +0 -1
  213. package/dist/bin/chunk-hzqw8xm5.js +0 -111
  214. package/dist/bin/chunk-j703btc5.js +0 -50
  215. package/dist/bin/chunk-jpjamjey.js +0 -6935
  216. package/dist/bin/chunk-m2zwtapr.js +0 -1
  217. package/dist/bin/chunk-m669wtgr.js +0 -1
  218. package/dist/bin/chunk-mr0atd2s.js +0 -2
  219. package/dist/bin/chunk-ngcyftm2.js +0 -1
  220. package/dist/bin/chunk-p66ptpmr.js +0 -2
  221. package/dist/bin/chunk-p8q9bq9g.js +0 -1
  222. package/dist/bin/chunk-r3kv0vm9.js +0 -6
  223. package/dist/bin/chunk-r9hjwcj9.js +0 -6
  224. package/dist/bin/chunk-rtczra13.js +0 -1
  225. package/dist/bin/chunk-rytk89az.js +0 -60
  226. package/dist/bin/chunk-sgyffpgm.js +0 -581
  227. package/dist/bin/chunk-vek8a0w6.js +0 -1
  228. package/dist/bin/chunk-waayf9ay.js +0 -2
  229. package/dist/bin/chunk-yv9sth30.js +0 -1
  230. package/dist/chunk-01d86gt1.js +0 -1324
  231. package/dist/chunk-050r7ycy.js +0 -46516
  232. package/dist/chunk-1c8dbv57.js +0 -7278
  233. package/dist/chunk-29rse4p1.js +0 -12203
  234. package/dist/chunk-32e7ya18.js +0 -642
  235. package/dist/chunk-4cjrg98a.js +0 -597
  236. package/dist/chunk-50jpda9q.js +0 -371
  237. package/dist/chunk-6a1t7fnq.js +0 -12121
  238. package/dist/chunk-728jvrr0.js +0 -1701
  239. package/dist/chunk-7m60qnc8.js +0 -1762
  240. package/dist/chunk-aa2dkn7b.js +0 -205
  241. package/dist/chunk-d48vtdj4.js +0 -433
  242. package/dist/chunk-f55nkpvb.js +0 -8
  243. package/dist/chunk-fgk8cqew.js +0 -152
  244. package/dist/chunk-he9a874b.js +0 -769
  245. package/dist/chunk-k2yyatfw.js +0 -10
  246. package/dist/chunk-k4px0bnv.js +0 -23
  247. package/dist/chunk-nsgqsmrh.js +0 -1779
  248. package/dist/chunk-q0st3se8.js +0 -42033
  249. package/dist/chunk-qr803fye.js +0 -2122
  250. package/dist/chunk-rds0sy87.js +0 -1771
  251. package/dist/chunk-ttz2ra5j.js +0 -12
  252. package/dist/chunk-v0bahtg2.js +0 -4
  253. package/dist/chunk-va2yd85b.js +0 -200
  254. package/dist/chunk-x9s0cqfx.js +0 -13
  255. package/dist/chunk-zqtpg06c.js +0 -1752
@@ -1 +0,0 @@
1
- import{qg as a}from"./chunk-waayf9ay.js";import"./chunk-mr0atd2s.js";import"./chunk-271gk1n2.js";import"./chunk-fpm59y25.js";import"./chunk-jpjamjey.js";import"./chunk-mh0kdzqp.js";export{a as buildAndPushServerlessImage};
@@ -1 +0,0 @@
1
- import{Uf as a}from"./chunk-h5pa5men.js";import"./chunk-fpm59y25.js";import"./chunk-mh0kdzqp.js";export{a as CloudFormationClient};
@@ -1,2 +0,0 @@
1
- import{Og as w}from"./chunk-fpm59y25.js";class x{client;region;constructor(b="us-east-1",j){this.region=b,this.client=new w(void 0,{profile:j})}async createRepository(b){let j={repositoryName:b.repositoryName};if(b.imageTagMutability)j.imageTagMutability=b.imageTagMutability;if(b.imageScanningConfiguration)j.imageScanningConfiguration=b.imageScanningConfiguration;if(b.encryptionConfiguration)j.encryptionConfiguration=b.encryptionConfiguration;if(b.tags&&b.tags.length>0)j.tags=b.tags;let q=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.CreateRepository","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(j)});return{repository:q.repository?this.parseRepository(q.repository):void 0}}async describeRepositories(b){let j={};if(b?.repositoryNames&&b.repositoryNames.length>0)j.repositoryNames=b.repositoryNames;if(b?.registryId)j.registryId=b.registryId;if(b?.maxResults)j.maxResults=b.maxResults;if(b?.nextToken)j.nextToken=b.nextToken;let q=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.DescribeRepositories","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(j)});return{repositories:q.repositories?.map((v)=>this.parseRepository(v)),nextToken:q.nextToken}}async getAuthorizationToken(b){let j={};if(b&&b.length>0)j.registryIds=b;return{authorizationData:(await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.GetAuthorizationToken","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(j)})).authorizationData?.map((v)=>({authorizationToken:v.authorizationToken,expiresAt:v.expiresAt,proxyEndpoint:v.proxyEndpoint}))}}async deleteRepository(b){let j={repositoryName:b.repositoryName};if(b.registryId)j.registryId=b.registryId;if(b.force!==void 0)j.force=b.force;let q=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.DeleteRepository","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(j)});return{repository:q.repository?this.parseRepository(q.repository):void 0}}async describeImages(b){let j={repositoryName:b.repositoryName};if(b.registryId)j.registryId=b.registryId;if(b.imageIds&&b.imageIds.length>0)j.imageIds=b.imageIds;if(b.filter)j.filter=b.filter;if(b.maxResults)j.maxResults=b.maxResults;if(b.nextToken)j.nextToken=b.nextToken;let q=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.DescribeImages","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(j)});return{imageDetails:q.imageDetails?.map((v)=>this.parseImageDetail(v)),nextToken:q.nextToken}}async batchDeleteImage(b){let j={repositoryName:b.repositoryName,imageIds:b.imageIds};if(b.registryId)j.registryId=b.registryId;let q=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.BatchDeleteImage","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(j)});return{imageIds:q.imageIds,failures:q.failures}}async putLifecyclePolicy(b){let j={repositoryName:b.repositoryName,lifecyclePolicyText:b.lifecyclePolicyText};if(b.registryId)j.registryId=b.registryId;let q=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.PutLifecyclePolicy","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(j)});return{registryId:q.registryId,repositoryName:q.repositoryName,lifecyclePolicyText:q.lifecyclePolicyText}}async getLifecyclePolicy(b){let j={repositoryName:b.repositoryName};if(b.registryId)j.registryId=b.registryId;let q=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.GetLifecyclePolicy","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(j)});return{registryId:q.registryId,repositoryName:q.repositoryName,lifecyclePolicyText:q.lifecyclePolicyText,lastEvaluatedAt:q.lastEvaluatedAt}}async setRepositoryPolicy(b){let j={repositoryName:b.repositoryName,policyText:b.policyText};if(b.registryId)j.registryId=b.registryId;if(b.force!==void 0)j.force=b.force;let q=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.SetRepositoryPolicy","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(j)});return{registryId:q.registryId,repositoryName:q.repositoryName,policyText:q.policyText}}async getRepositoryPolicy(b){let j={repositoryName:b.repositoryName};if(b.registryId)j.registryId=b.registryId;let q=await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.GetRepositoryPolicy","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(j)});return{registryId:q.registryId,repositoryName:q.repositoryName,policyText:q.policyText}}async tagResource(b){let j={resourceArn:b.resourceArn,tags:b.tags};await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.TagResource","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(j)})}async listTagsForResource(b){let j={resourceArn:b};return{tags:(await this.client.request({service:"ecr",region:this.region,method:"POST",path:"/",headers:{"X-Amz-Target":"AmazonEC2ContainerRegistry_V20150921.ListTagsForResource","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify(j)})).tags}}createLifecyclePolicyText(b){return JSON.stringify({rules:b.map((j)=>({rulePriority:j.rulePriority,description:j.description,selection:j.selection,action:j.action}))})}async getDockerLoginCommand(){let b=await this.getAuthorizationToken();if(!b.authorizationData?.[0])throw Error("Failed to get authorization token");let j=b.authorizationData[0],q=j.authorizationToken||"",v=j.proxyEndpoint||"";return`echo "${Buffer.from(q,"base64").toString("utf8").split(":")[1]}" | docker login --username AWS --password-stdin ${v}`}getRegistryUri(b){return`${b}.dkr.ecr.${this.region}.amazonaws.com`}parseRepository(b){return{repositoryArn:b.repositoryArn,registryId:b.registryId,repositoryName:b.repositoryName,repositoryUri:b.repositoryUri,createdAt:b.createdAt,imageTagMutability:b.imageTagMutability,imageScanningConfiguration:b.imageScanningConfiguration,encryptionConfiguration:b.encryptionConfiguration}}parseImageDetail(b){return{registryId:b.registryId,repositoryName:b.repositoryName,imageDigest:b.imageDigest,imageTags:b.imageTags,imageSizeInBytes:b.imageSizeInBytes,imagePushedAt:b.imagePushedAt,imageScanStatus:b.imageScanStatus,imageScanFindingsSummary:b.imageScanFindingsSummary}}}
2
- export{x as rg};
@@ -1 +0,0 @@
1
- import{p as a,q as b,r as c,s as d,t as e,u as f}from"./chunk-rytk89az.js";import"./chunk-ctd2vg9w.js";import"./chunk-gavvf0pg.js";import"./chunk-h5pa5men.js";import"./chunk-j703btc5.js";import"./chunk-fy8j3y8p.js";import"./chunk-fpm59y25.js";import"./chunk-mh0kdzqp.js";export{c as uploadStaticFiles,d as invalidateCache,a as generateStaticSiteTemplate,f as deployStaticSiteFull,b as deployStaticSite,e as deleteStaticSite};
@@ -1,2 +0,0 @@
1
- import{Og as V}from"./chunk-fpm59y25.js";import{deflateRawSync as Z}from"zlib";function Q(G,k){let J=typeof k==="string"?Buffer.from(k,"utf-8"):k,K=Z(J),U=E(J),Y=new Date,M=(Y.getHours()<<11|Y.getMinutes()<<5|Y.getSeconds()>>1)&65535,$=(Y.getFullYear()-1980<<9|Y.getMonth()+1<<5|Y.getDate())&65535,O=Buffer.from(G,"utf-8"),_=Buffer.alloc(30+O.length);_.writeUInt32LE(67324752,0),_.writeUInt16LE(20,4),_.writeUInt16LE(0,6),_.writeUInt16LE(8,8),_.writeUInt16LE(M,10),_.writeUInt16LE($,12),_.writeUInt32LE(U,14),_.writeUInt32LE(K.length,18),_.writeUInt32LE(J.length,22),_.writeUInt16LE(O.length,26),_.writeUInt16LE(0,28),O.copy(_,30);let X=Buffer.alloc(46+O.length);X.writeUInt32LE(33639248,0),X.writeUInt16LE(20,4),X.writeUInt16LE(20,6),X.writeUInt16LE(0,8),X.writeUInt16LE(8,10),X.writeUInt16LE(M,12),X.writeUInt16LE($,14),X.writeUInt32LE(U,16),X.writeUInt32LE(K.length,20),X.writeUInt32LE(J.length,24),X.writeUInt16LE(O.length,28),X.writeUInt16LE(0,30),X.writeUInt16LE(0,32),X.writeUInt16LE(0,34),X.writeUInt16LE(0,36),X.writeUInt32LE(0,38),X.writeUInt32LE(0,42),O.copy(X,46);let h=_.length+K.length,j=X.length,A=Buffer.alloc(22);return A.writeUInt32LE(101010256,0),A.writeUInt16LE(0,4),A.writeUInt16LE(0,6),A.writeUInt16LE(1,8),A.writeUInt16LE(1,10),A.writeUInt32LE(j,12),A.writeUInt32LE(h,16),A.writeUInt16LE(0,20),Buffer.concat([_,K,X,A])}function E(G){let k=[];for(let K=0;K<256;K++){let U=K;for(let Y=0;Y<8;Y++)U=U&1?3988292384^U>>>1:U>>>1;k[K]=U}let J=4294967295;for(let K=0;K<G.length;K++)J=k[(J^G[K])&255]^J>>>8;return(J^4294967295)>>>0}class I{client;region;constructor(G="us-east-1",k){this.region=G,this.client=new V(void 0,{profile:k})}async createFunction(G){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(G)})}async getFunction(G){return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2015-03-31/functions/${encodeURIComponent(G)}`,headers:{"Content-Type":"application/json"}})}async updateFunctionCode(G){let{FunctionName:k,...J}=G;return await this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2015-03-31/functions/${encodeURIComponent(k)}/code`,headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}async updateFunctionCodeInline(G,k,J="index.js"){let K=Q(J,k);return this.updateFunctionCode({FunctionName:G,ZipFile:K.toString("base64")})}async updateFunctionConfiguration(G){let{FunctionName:k,...J}=G;return await this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2015-03-31/functions/${encodeURIComponent(k)}/configuration`,headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}async deleteFunction(G){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2015-03-31/functions/${encodeURIComponent(G)}`,headers:{"Content-Type":"application/json"}})}async invoke(G){let{FunctionName:k,InvocationType:J="RequestResponse",Payload:K,LogType:U}=G,Y={"Content-Type":"application/json","X-Amz-Invocation-Type":J};if(U)Y["X-Amz-Log-Type"]=U;let M=K?typeof K==="string"?K:JSON.stringify(K):void 0,$=await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(k)}/invocations`,headers:Y,body:M,returnHeaders:!0});return{StatusCode:$.statusCode||200,FunctionError:$.headers?.["x-amz-function-error"],LogResult:$.headers?.["x-amz-log-result"],Payload:typeof $.body==="string"?$.body:JSON.stringify($.body),ExecutedVersion:$.headers?.["x-amz-executed-version"]}}async listFunctions(G){let k={};if(G?.MaxItems)k.MaxItems=String(G.MaxItems);if(G?.Marker)k.Marker=G.Marker;if(G?.FunctionVersion)k.FunctionVersion=G.FunctionVersion;return await this.client.request({service:"lambda",region:this.region,method:"GET",path:"/2015-03-31/functions",queryParams:Object.keys(k).length>0?k:void 0,headers:{"Content-Type":"application/json"}})}async addPermission(G){let{FunctionName:k,...J}=G;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(k)}/policy`,headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}async removePermission(G,k){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2015-03-31/functions/${encodeURIComponent(G)}/policy/${encodeURIComponent(k)}`,headers:{"Content-Type":"application/json"}})}async publishVersion(G){let{FunctionName:k,...J}=G;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(k)}/versions`,headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}async createAlias(G){let{FunctionName:k,...J}=G;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2015-03-31/functions/${encodeURIComponent(k)}/aliases`,headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}async updateAlias(G){let{FunctionName:k,Name:J,...K}=G;return this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2015-03-31/functions/${encodeURIComponent(k)}/aliases/${encodeURIComponent(J)}`,headers:{"Content-Type":"application/json"},body:JSON.stringify(K)})}async getAlias(G,k){try{return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2015-03-31/functions/${encodeURIComponent(G)}/aliases/${encodeURIComponent(k)}`})}catch(J){if(/ResourceNotFound/i.test(String(J?.message)))return null;throw J}}async getProvisionedConcurrencyConfig(G,k){try{return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2019-09-30/functions/${encodeURIComponent(G)}/provisioned-concurrency`,queryParams:{Qualifier:k}})}catch(J){if(/ProvisionedConcurrencyConfigNotFound|ResourceNotFound/i.test(String(J?.message)))return null;throw J}}async putProvisionedConcurrencyConfig(G){let{FunctionName:k,Qualifier:J,ProvisionedConcurrentExecutions:K}=G;return this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2019-09-30/functions/${encodeURIComponent(k)}/provisioned-concurrency`,queryParams:{Qualifier:J},headers:{"Content-Type":"application/json"},body:JSON.stringify({ProvisionedConcurrentExecutions:K})})}async getFunctionConcurrency(G){try{return(await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2019-10-31/functions/${encodeURIComponent(G)}/concurrency`}))?.ReservedConcurrentExecutions??null}catch(k){if(/ResourceNotFound|ProvisionedConcurrencyConfigNotFound/i.test(String(k?.message)))return null;throw k}}async putFunctionConcurrency(G,k){await this.client.request({service:"lambda",region:this.region,method:"PUT",path:`/2019-10-31/functions/${encodeURIComponent(G)}/concurrency`,headers:{"Content-Type":"application/json"},body:JSON.stringify({ReservedConcurrentExecutions:k})})}async deleteFunctionConcurrency(G){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2019-10-31/functions/${encodeURIComponent(G)}/concurrency`})}async deleteProvisionedConcurrencyConfig(G,k){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2019-09-30/functions/${encodeURIComponent(G)}/provisioned-concurrency`,queryParams:{Qualifier:k}})}async waitForFunctionActive(G,k=60){let J=Date.now(),K=k*1000;while(Date.now()-J<K)try{let U=await this.getFunction(G),Y=U.Configuration?.State;if(Y==="Active")return U.Configuration;if(Y==="Failed")throw Error(`Function ${G} failed: ${U.Configuration?.StateReason}`);await new Promise((M)=>setTimeout(M,2000))}catch(U){if(U.code==="ResourceNotFoundException"){await new Promise((Y)=>setTimeout(Y,2000));continue}throw U}throw Error(`Timeout waiting for function ${G} to become active`)}async functionExists(G){try{return await this.getFunction(G),!0}catch(k){if(k.code==="ResourceNotFoundException"||k.statusCode===404)return!1;throw k}}async createFunctionUrl(G){let{FunctionName:k,...J}=G;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2021-10-31/functions/${encodeURIComponent(k)}/url`,headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}async getFunctionUrl(G){try{return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2021-10-31/functions/${encodeURIComponent(G)}/url`,headers:{"Content-Type":"application/json"}})}catch(k){if(k.statusCode===404)return null;throw k}}async deleteFunctionUrl(G){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2021-10-31/functions/${encodeURIComponent(G)}/url`,headers:{"Content-Type":"application/json"}})}async createFunctionWithCode(G){let{Code:k,Filename:J="index.js",...K}=G,U=Q(J,k);return this.createFunction({...K,Code:{ZipFile:U.toString("base64")}})}async addFunctionUrlPermission(G){return this.addPermission({FunctionName:G,StatementId:"FunctionURLAllowPublicAccess",Action:"lambda:InvokeFunctionUrl",Principal:"*",FunctionUrlAuthType:"NONE"})}async publishLayerVersion(G){let{LayerName:k,...J}=G;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2018-10-31/layers/${encodeURIComponent(k)}/versions`,headers:{"Content-Type":"application/json"},body:JSON.stringify(J)})}async listLayerVersions(G,k){let J={};if(k?.CompatibleRuntime)J.CompatibleRuntime=k.CompatibleRuntime;if(k?.CompatibleArchitecture)J.CompatibleArchitecture=k.CompatibleArchitecture;if(k?.MaxItems)J.MaxItems=String(k.MaxItems);if(k?.Marker)J.Marker=k.Marker;return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2018-10-31/layers/${encodeURIComponent(G)}/versions`,queryParams:Object.keys(J).length>0?J:void 0,headers:{"Content-Type":"application/json"}})}async getLayerVersion(G,k){return await this.client.request({service:"lambda",region:this.region,method:"GET",path:`/2018-10-31/layers/${encodeURIComponent(G)}/versions/${k}`,headers:{"Content-Type":"application/json"}})}async addLayerVersionPermission(G){let{LayerName:k,VersionNumber:J,...K}=G;return await this.client.request({service:"lambda",region:this.region,method:"POST",path:`/2018-10-31/layers/${encodeURIComponent(k)}/versions/${J}/policy`,headers:{"Content-Type":"application/json"},body:JSON.stringify(K)})}async deleteLayerVersion(G,k){await this.client.request({service:"lambda",region:this.region,method:"DELETE",path:`/2018-10-31/layers/${encodeURIComponent(G)}/versions/${k}`,headers:{"Content-Type":"application/json"}})}}
2
- export{I as Rd};
@@ -1 +0,0 @@
1
- import{$g as k,$h as ka,$i as kb,$j as kc,$k as kd,$l as ke,$m as lf,$n as lg,Ah as L,Ai as La,Aj as Lb,Ak as Lc,Al as Ld,Am as Le,An as Mf,Ao as Mg,Bh as M,Bi as Ma,Bj as Mb,Bk as Mc,Bl as Md,Bm as Me,Bn as Nf,Bo as Ng,Ch as N,Ci as Na,Cj as Nb,Ck as Nc,Cl as Nd,Cm as Ne,Cn as Of,Co as Og,Dh as O,Di as Oa,Dj as Ob,Dk as Oc,Dl as Od,Dm as Oe,Dn as Pf,Do as Pg,Eh as P,Ei as Pa,Ej as Pb,Ek as Pc,El as Pd,Em as Pe,En as Qf,Eo as Qg,Fh as Q,Fi as Qa,Fj as Qb,Fk as Qc,Fl as Qd,Fm as Qe,Fn as Rf,Fo as Rg,Gh as R,Gi as Ra,Gj as Rb,Gk as Rc,Gl as Rd,Gm as Re,Gn as Sf,Go as Sg,Hh as S,Hi as Sa,Hj as Sb,Hk as Sc,Hl as Sd,Hm as Se,Hn as Tf,Ho as Tg,Ih as T,Ii as Ta,Ij as Tb,Ik as Tc,Il as Td,Im as Te,In as Uf,Io as Ug,Jh as U,Ji as Ua,Jj as Ub,Jk as Uc,Jl as Ud,Jm as Ue,Jn as Vf,Jo as Vg,Kh as V,Ki as Va,Kj as Vb,Kk as Vc,Kl as Vd,Km as Ve,Kn as Wf,Ko as Wg,Lh as W,Li as Wa,Lj as Wb,Lk as Wc,Ll as Wd,Lm as We,Ln as Xf,Lo as Xg,Mh as X,Mi as Xa,Mj as Xb,Mk as Xc,Ml as Xd,Mm as Xe,Mn as Yf,Mo as Yg,Nh as Y,Ni as Ya,Nj as Yb,Nk as Yc,Nl as Yd,Nm as Ye,Nn as Zf,No as Zg,Oh as Z,Oi as Za,Oj as Zb,Ok as Zc,Ol as Zd,Om as Ze,On as _f,Oo as _g,Ph as _,Pi as _a,Pj as _b,Pk as _c,Pl as _d,Pm as _e,Pn as $f,Po as $g,Qh as $,Qi as $a,Qj as $b,Qk as $c,Ql as $d,Qm as $e,Qn as ag,Qo as ah,Rg as a,Rh as aa,Ri as ab,Rj as ac,Rk as ad,Rl as ae,Rm as af,Rn as bg,Ro as bh,Sg as b,Sh as ba,Si as bb,Sj as bc,Sk as bd,Sl as be,Sm as bf,Sn as cg,So as ch,Tg as c,Th as ca,Ti as cb,Tj as cc,Tk as cd,Tl as ce,Tm as cf,Tn as dg,To as dh,Ug as d,Uh as da,Ui as db,Uj as dc,Uk as dd,Ul as de,Um as df,Un as eg,Vg as e,Vh as ea,Vi as eb,Vj as ec,Vk as ed,Vl as ee,Vm as ef,Vn as fg,Wg as f,Wh as fa,Wi as fb,Wj as fc,Wk as fd,Wl as fe,Wm as ff,Wn as gg,Xg as g,Xh as ga,Xi as gb,Xj as gc,Xk as gd,Xl as ge,Xm as gf,Xn as hg,Yg as h,Yh as ha,Yi as hb,Yj as hc,Yk as hd,Yl as he,Ym as hf,Yn as ig,Zg as i,Zh as ia,Zi as ib,Zj as ic,Zk as id,Zl as ie,Zm as jf,Zn as jg,_g as j,_h as ja,_i as jb,_j as jc,_k as jd,_l as je,_m as kf,_n as kg,ah as l,ai as la,aj as lb,ak as lc,al as ld,am as le,an as mf,ao as mg,bh as m,bi as ma,bj as mb,bk as mc,bl as md,bm as me,bn as nf,bo as ng,ch as n,ci as na,cj as nb,ck as nc,cl as nd,cm as ne,cn as of,co as og,dh as o,di as oa,dj as ob,dk as oc,dl as od,dm as oe,dn as pf,do as pg,eh as p,ei as pa,ej as pb,ek as pc,el as pd,em as pe,en as qf,eo as qg,fh as q,fi as qa,fj as qb,fk as qc,fl as qd,fm as qe,fn as rf,fo as rg,gh as r,gi as ra,gj as rb,gk as rc,gl as rd,gm as re,gn as sf,go as sg,hh as s,hi as sa,hj as sb,hk as sc,hl as sd,hm as se,hn as tf,ho as tg,ih as t,ii as ta,ij as tb,ik as tc,il as td,im as te,in as uf,io as ug,jh as u,ji as ua,jj as ub,jk as uc,jl as ud,jm as ue,jn as vf,jo as vg,kh as v,ki as va,kj as vb,kk as vc,kl as vd,km as ve,kn as wf,ko as wg,lh as w,li as wa,lj as wb,lk as wc,ll as wd,lm as we,ln as xf,lo as xg,mh as x,mi as xa,mj as xb,mk as xc,ml as xd,mm as xe,mn as yf,mo as yg,nh as y,ni as ya,nj as yb,nk as yc,nl as yd,nm as ye,nn as zf,no as zg,oh as z,oi as za,oj as zb,ok as zc,ol as zd,om as ze,on as Af,oo as Ag,ph as A,pi as Aa,pj as Ab,pk as Ac,pl as Ad,pm as Ae,pn as Bf,po as Bg,qh as B,qi as Ba,qj as Bb,qk as Bc,ql as Bd,qm as Be,qn as Cf,qo as Cg,rh as C,ri as Ca,rj as Cb,rk as Cc,rl as Cd,rm as Ce,rn as Df,ro as Dg,sh as D,si as Da,sj as Db,sk as Dc,sl as Dd,sm as De,sn as Ef,so as Eg,th as E,ti as Ea,tj as Eb,tk as Ec,tl as Ed,tm as Ee,tn as Ff,to as Fg,uh as F,ui as Fa,uj as Fb,uk as Fc,ul as Fd,um as Fe,un as Gf,uo as Gg,vh as G,vi as Ga,vj as Gb,vk as Gc,vl as Gd,vm as Ge,vn as Hf,vo as Hg,wh as H,wi as Ha,wj as Hb,wk as Hc,wl as Hd,wm as He,wn as If,wo as Ig,xh as I,xi as Ia,xj as Ib,xk as Ic,xl as Id,xm as Ie,xn as Jf,xo as Jg,yh as J,yi as Ja,yj as Jb,yk as Jc,yl as Jd,ym as Je,yn as Kf,yo as Kg,zh as K,zi as Ka,zj as Kb,zk as Kc,zl as Kd,zm as Ke,zn as Lf,zo as Lg}from"./chunk-jpjamjey.js";import"./chunk-mh0kdzqp.js";export{Ie as xrayManager,qc as withTimeout,ob as withSecurity,sb as withQueue,nb as withMonitoring,Fg as withInvocation,pb as withDatabase,qb as withCache,rb as withCDN,E as validateTemplateSize,D as validateTemplate,F as validateResourceLimits,Ub as validateCredentials,Sb as validateConfiguration,ld as validateCommand,Bc as validateAgainstSchema,Yd as validateAccountStructure,cc as templateCache,Oe as syntheticsManager,Kd as suggestRegions,Ld as suggestRegionPairs,$b as suggestQuotaIncrease,Xb as suggestIAMPolicy,id as suggestFlags,cd as suggestCommand,Zg as storageAdvancedManager,Xg as staticSiteManager,u as statePath,t as stateDir,Bd as stackDependencyManager,c as signRequestAsync,b as signRequest,mg as sharedRuntimeLoop,Cg as sharedRecursionGuard,$f as sha256,s as setStateDir,lf as serviceMeshManager,pc as sequence,Jf as senderReputationManager,cf as securityScanningManager,ye as securityHubManager,Ye as secretsRotationManager,_e as secretsManager,gd as searchCommands,K as sanitizeName,Tg as runPhpBuildHooks,_f as runBuildHooks,zf as route53RoutingManager,Df as route53ResolverManager,Ig as responseToResult,dh as resourceManagementManager,P as resolveStorageBucketName,v as resolveStatePath,M as resolveSiteStackName,N as resolveSiteResourceName,O as resolveSiteBucketName,dg as resolveServerlessRuntime,T as resolveServerlessAssetBucketName,S as resolveServerlessArtifactBucketName,R as resolveServerlessAppStackName,Bb as resolveRegion,Ag as resolveRecursionConfig,eg as resolveQueues,fg as resolveQueueNames,L as resolveProjectStackName,hb as resolveManagementDashboardSites,ib as resolveManagementDashboardSite,y as resolveDeploymentMode,Q as resolveDeployBucketName,cb as resolveDashboardDomains,bb as resolveDashboardDomain,Ab as resolveCredentials,B as resolveCloudProvider,A as resolveAppDatabase,Gg as resolveApp,Dg as resetRecursionRuntime,wc as requiresReplacement,Se as replicaManager,Ad as regionPairManager,yg as recursionBlockedResponse,ic as quickHash,Xf as queueManagementManager,xg as propagationHeaders,Ge as progressiveDeploymentManager,tc as processInChunks,Sc as previewNotifications,Nc as previewManager,Og as phpRuntimeLayerAssets,ig as phpLayerPackages,jg as phpLayerBuildStage,Ue as performanceManager,i as parseXMLResponse,j as parseJSONResponse,ug as parseChain,oc as parallelWithRetry,nc as parallelMap,lc as parallel,bg as packageServerlessApp,Vg as packagePhpApp,Sd as organizationManager,bh as networkSecurityManager,td as multiRegionManager,Rd as multiAccountManager,Qe as migrationManager,Ke as metricsManager,mb as mergeInfrastructure,fb as managementDashboardSiteName,g as makeAWSRequestOnce,h as makeAWSRequestAsync,f as makeAWSRequest,Me as logsManager,Pg as laravelServerlessEnvDefaults,pf as lambdaVersionsManager,vf as lambdaVPCManager,nf as lambdaLayersManager,tf as lambdaDestinationsManager,xf as lambdaDLQManager,rf as lambdaConcurrencyManager,n as isWebCryptoAvailable,Id as isValidRegion,w as isStatePath,m as isNodeCryptoAvailable,gb as isManagementDashboardSiteName,Ec as isLocalDevelopment,ed as isLikelyTypo,zg as invocationContext,Bg as installRecursionFetch,vg as inspectInvocation,ef as imageScanningManager,$g as healthCheckManager,ec as hashString,hc as hashManifest,dc as hashFile,gc as hashDirectory,fc as hashBuffer,db as hasManagementDashboardSite,we as guardDutyManager,zd as globalResourceManager,J as getTimestamp,l as getSigningKeyCacheSize,Wb as getRequiredPermissions,Hd as getRegionsByPricingTier,Fd as getRegionsByLocation,Gd as getRegionsByCompliance,Od as getRegionStats,Dd as getRegion,Wd as getRecommendedStructure,_b as getQuotaUsageSummary,Hc as getLocalEnvVars,Fc as getLocalEndpoint,Gc as getLocalCredentials,Dc as getLocalConfig,Pb as getErrorDetails,vc as getDiffSummary,zc as getDiffStats,yc as getDeploymentStrategy,yb as getCredentials,fd as getContextualHelp,kd as getCommandUsage,Jd as getClosestRegion,Ed as getAllRegions,Cb as getAccountId,be as generateScheduledWorkflow,ge as generateScheduledPipeline,ke as generateScheduledConfig,H as generateResourceName,Oc as generatePreviewWorkflow,fe as generatePreviewPipeline,kg as generatePhpLayerDockerfile,Ng as generatePhpFpmConfig,me as generateParallelConfig,ae as generatePRPreviewWorkflow,$d as generateMultiEnvWorkflow,ee as generateMultiEnvPipeline,je as generateMultiEnvConfig,ce as generateMatrixWorkflow,he as generateManualPipeline,I as generateLogicalId,_d as generateDeploymentWorkflow,de as generateDeploymentPipeline,ie as generateDeploymentConfig,Xd as generateCrossAccountRoleCF,Qc as generateCostReportWorkflow,Pc as generateCleanupWorkflow,Zf as generateBootstrap,le as generateApprovalConfig,lg as generateAppImageDockerfile,sg as functionFingerprint,xb as fromWebIdentity,ub as fromSharedCredentials,tb as fromEnvironment,wb as fromECSMetadata,vb as fromEC2Metadata,Uc as formatTree,Tc as formatTable,dd as formatSuggestion,Nd as formatRegionList,Md as formatRegion,Vc as formatProgressBar,Yc as formatList,Zc as formatKeyValue,rd as formatHistoryStats,qd as formatHistory,jd as formatFlagSuggestions,Xc as formatDuration,W as formatDiff,Wc as formatBytes,Zd as formatAccountStructure,jc as findChangedFiles,Rf as fifoQueueManager,jb as extendPreset,Hg as eventToRequest,Lf as emailTemplateManager,Hf as emailAnalyticsManager,qe as drManager,Bf as dnssecManager,Tf as dlqMonitoringManager,uc as diffTemplates,a as detectServiceRegion,Tb as detectMisconfigurations,x as detectDeploymentTargets,ab as deriveManagementDashboardPort,z as deploymentCoexistenceError,Cc as defaultLocalConfig,We as databaseUserManager,yd as crossRegionReferenceManager,Yf as createZip,Oa as createWordPressPreset,Ua as createTraditionalWebAppPreset,Ha as createStaticSitePreset,Ka as createServerlessNodePreset,Wa as createServerlessLaravelPreset,Gb as createS3Client,Ra as createRealtimeAppPreset,Kg as createQueueHandler,e as createPresignedUrlAsync,d as createPresignedUrl,lb as createPreset,Ja as createNodeJsServerlessPreset,Ia as createNodeJsServerPreset,Lc as createMockAWS,Qa as createMicroservicesPreset,Ta as createMLApiPreset,Va as createLaravelPreset,Pa as createJamstackPreset,Jg as createHttpHandler,Mg as createHandlers,Ma as createFullStackAppPreset,La as createExistingStaticFullStackPreset,Qb as createError,Sa as createDataPipelinePreset,Xa as createDashboardSite,zb as createCredentialProvider,Lg as createCliHandler,Na as createApiBackendPreset,jf as containerRegistryManager,gg as composeServerlessAppTemplate,kb as composePresets,Ug as collectPhpAppEntries,ue as cloudTrailManager,Ac as cloudConfigSchema,k as clearSigningKeyCache,sc as chunk,Zb as checkServiceQuotas,Eg as checkInvocation,Vb as checkIAMPermissions,af as certificateManager,xc as categorizeChanges,Ce as canaryManager,Rg as buildPhpRuntimeLayerZip,gf as buildOptimizationManager,ng as buildNodeRuntimeLayerZip,Ga as buildCloudFormationTemplate,og as buildBunRuntimeLayerZip,Ff as bounceComplaintHandler,Ae as blueGreenManager,Vf as batchProcessingManager,mc as batch,oe as backupManager,se as awsConfigManager,hd as autocomplete,ag as artifactKey,V as analyzeStackDiff,Ee as abTestManager,He as XRayManager,sa as Workflow,Mb as ValidationError,bc as TemplateCache,C as TemplateBuilder,bd as TaskList,rg as TRACE_HEADER,Ne as SyntheticsManager,Yg as StorageAdvancedManager,X as Storage,Wg as StaticSiteManager,ia as StacksIntegration,xd as StackDependencyManager,ad as Spinner,ja as SmsHandlers,Pf as SmsAdvanced,la as Sftp,kf as ServiceMeshManager,If as SenderReputationManager,bf as SecurityScanningManager,xe as SecurityHubManager,$ as Security,Xe as SecretsRotationManager,Ze as SecretsManager,xa as Secrets,za as Search,r as STATE_DIR_ENV_VAR,ka as SMS,Fb as S3Error,Eb as S3Client,yf as Route53RoutingManager,Cf as Route53ResolverManager,ch as ResourceManagementManager,Re as ReplicaManager,Y as Registry,wd as RegionPairManager,Aa as Redirects,wg as RecursionGuard,p as RealtimePresets,rc as RateLimiter,nd as REPLContext,od as REPLCommandBuilder,md as REPL,Ud as RECOMMENDED_SCPS,Td as RECOMMENDED_ACCOUNT_STRUCTURES,o as QueuePresets,Wf as QueueManagementManager,ga as Queue,G as Pseudo,Fe as ProgressiveDeploymentManager,_c as ProgressBar,Rc as PreviewNotificationService,Mc as PreviewEnvironmentManager,ea as PhoneHandlers,Of as PhoneAdvanced,fa as Phone,pa as Permissions,Te as PerformanceManager,ya as ParameterStore,hg as PHP_LAYER_EXTENSIONS,Sg as PHP_DEFAULT_EXCLUDES,Qd as OrganizationManager,ah as NetworkSecurityManager,ba as Network,$c as MultiStepProgress,sd as MultiRegionManager,Pd as MultiAccountManager,ta as Monitoring,Jc as MockS3,Kc as MockDynamoDB,Ic as MockCloudFormation,Pe as MigrationManager,Je as MetricsManager,ra as Messaging,eb as MANAGEMENT_DASHBOARD_SITE_PREFIX,cg as MANAGED_NODE_VERSIONS,Le as LogsManager,of as LambdaVersionsManager,uf as LambdaVPCManager,mf as LambdaLayersManager,sf as LambdaDestinationsManager,wf as LambdaDLQManager,qf as LambdaConcurrencyManager,Qg as LARAVEL_SERVERLESS_BUILD_STEPS,ha as JobLoader,df as ImageScanningManager,_g as HealthCheckManager,kc as HashCache,ve as GuardDutyManager,vd as GlobalResourceManager,Ca as Fn,ca as FileSystem,ac as FileCache,Qf as FIFOQueueManager,Ob as ErrorCodes,Kf as EmailTemplateManager,Nf as EmailHandlers,Gf as EmailAnalyticsManager,Mf as EmailAdvanced,da as Email,pe as DisasterRecoveryManager,Lb as DeploymentError,va as Deployment,U as DependencyGraph,Rb as DebugLogger,Ve as DatabaseUserManager,na as Database,Af as DNSSECManager,_ as DNS,Sf as DLQMonitoringManager,pg as DEPTH_HEADER,q as DEFAULT_STATE_DIR,Yb as DEFAULT_SERVICE_LIMITS,tg as DEFAULT_RECURSION_LIMITS,Ya as DASHBOARD_STATE_DIR,$a as DASHBOARD_PORT_SPAN,_a as DASHBOARD_PORT_BASE,Za as DASHBOARD_ENTRY,ud as CrossRegionReferenceManager,Kb as CredentialError,hf as ContainerRegistryManager,Jb as ConfigurationError,aa as Compute,Ba as Communication,pd as CommandHistory,te as CloudTrailManager,Hb as CloudFrontClient,Db as CloudFormationClient,Fa as CloudFormationBuilder,Ib as CloudError,$e as CertificateManager,Be as CanaryManager,oa as Cache,Vd as COMMON_CROSS_ACCOUNT_ROLES,qg as CHAIN_HEADER,Z as CDN,ff as BuildOptimizationManager,Ef as BounceComplaintHandler,ze as BlueGreenManager,Uf as BatchProcessingManager,ne as BackupManager,ua as Auth,wa as AssetHasher,Da as Arn,qa as ApiGateway,Cd as AWS_REGIONS,Ea as AWS_PSEUDO_PARAMETERS,re as AWSConfigManager,Nb as AWSAPIError,ma as AI,De as ABTestManager};
@@ -1,6 +0,0 @@
1
- import{Ui as P,Xi as F,Yi as _,jh as L,kh as T}from"./chunk-jpjamjey.js";import{execSync as R}from"node:child_process";import{randomBytes as p}from"node:crypto";import{chmodSync as u,copyFileSync as h,existsSync as G,mkdirSync as x,readFileSync as D,statSync as f,writeFileSync as B}from"node:fs";import{tmpdir as l}from"node:os";import{basename as d,dirname as U,isAbsolute as j,join as Z,resolve as g}from"node:path";import{fileURLToPath as k}from"node:url";function I(J){if(!J||typeof J!=="object")return J;return Object.fromEntries(Object.keys(J).map((K)=>[K,""]))}function y(J){let K=JSON.parse(JSON.stringify(J??{}));if(K.hetzner)delete K.hetzner.apiToken;delete K.aws,delete K.stateDir;for(let Q of Object.values(K.sites??{})){if(Q?.env)Q.env=I(Q.env);if(Q?.environment)Q.environment=I(Q.environment)}for(let Q of Object.values(K.environments??{}))if(Q?.variables)Q.variables=I(Q.variables);for(let Q of Object.values(K.infrastructure?.databases??{}))if(Q?.password)Q.password="";if(K.infrastructure?.appDatabase?.password)K.infrastructure.appDatabase.password="";if(K.infrastructure?.compute?.database?.password)K.infrastructure.compute.database.password="";if(K.infrastructure?.compute?.managedServices?.vitess?.password)K.infrastructure.compute.managedServices.vitess.password="";return K}function A(J){let K=y(J);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(K,null,2)}`,""].join(`
2
- `)}var c="dashboard";function w(){return L("dashboard-credentials.json")}function a(){return p(24).toString("base64url")}function t(J,K,Q){let X=process.env.TS_CLOUD_UI_PASSWORD?.trim();if(X)return{password:X,source:"env"};if(N(process.env.TS_CLOUD_UI_PUBLIC))return{password:void 0,source:"public"};let W=w(),$=T(J,"dashboard-credentials.json");try{if(G($)){let Y=JSON.parse(D($,"utf8"));if(Y?.password)return{password:Y.password,source:"generated"}}}catch{}let z=a();try{x(U($),{recursive:!0}),B($,`${JSON.stringify({username:K,password:z,generatedAt:new Date().toISOString()},null,2)}
3
- `),u($,384),Q.info(`Management dashboard: generated a password for '${K}' and saved it to ${W} (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(Y){Q.warn(`Management dashboard: could not persist the generated password (${Y?.message??Y}). Using it for this deploy only — pass: ${z}
4
- This password is now in your deploy log. Set TS_CLOUD_UI_PASSWORD to a value of your own and redeploy once ${W} is writable.`)}return{password:z,source:"generated"}}var S={info:()=>{},warn:()=>{}};function N(J){return J!=null&&J!==""&&J!=="0"&&J.toLowerCase()!=="false"}function r(){return L("dashboard-release")}function v(){let J=U(k(import.meta.url));for(let K of[Z(J,"..","..","package.json"),Z(J,"..","package.json")])try{let Q=JSON.parse(D(K,"utf8"));if(Q.name==="@stacksjs/ts-cloud"&&Q.version)return`^${Q.version}`}catch{}return"latest"}function s(){return process.env.TS_CLOUD_UI_VERSION?.trim()||v()}function n(J,K,Q){if(!J?.project?.slug)return Q.warn("Management dashboard: the cloud config has no project slug — skipping the live dashboard."),null;let X=T(K,"dashboard-release");try{x(X,{recursive:!0}),B(Z(X,"cloud.config.ts"),A(J));let W=s();if(W.startsWith("file:")){let z=W.slice(5),Y=j(z)?z:g(K,z);if(!G(Y)||!f(Y).isFile())W=v(),Q.warn(`Management dashboard: TS_CLOUD_UI_VERSION points to a missing package file (${Y}); using the deploying ts-cloud version ${W} instead.`);else{let H=d(Y),O=Z(X,H);if(Y!==O)h(Y,O);W=`file:./${H}`}}let $={name:"ts-cloud-dashboard",private:!0,type:"module",dependencies:{"@stacksjs/ts-cloud":W}};return B(Z(X,"package.json"),`${JSON.stringify($,null,2)}
5
- `),r()}catch(W){return Q.warn(`Management dashboard: could not stage the live release (${W?.message??W}) — skipping.`),null}}function i(J){if(G(Z(J,"packages","ui","pages"))||G(Z(J,"packages","ui","package.json")))return{uiRoot:"packages/ui/dist",build:"cd packages/ui && bun install && bun run build"};let K=U(k(import.meta.url)),Q=[Z(K,"ui"),Z(K,"..","ui"),Z(K,"..","..","ui"),Z(K,"..","dist","ui")];for(let X of Q)if(G(Z(X,"index.html"))||G(Z(X,"serverless.html")))return{uiRoot:X,build:!1};return null}function $J(J,K={}){let Q=K.logger??S,X=K.cwd??process.cwd();if(N(process.env.TS_CLOUD_UI_DISABLE))return Q.info("Management dashboard: skipped (TS_CLOUD_UI_DISABLE set)."),J;if(J.cloud?.attachTo)return Q.info(`Management dashboard: ${J.project.slug} is attached to ${J.cloud.attachTo}; the server owner's dashboard monitors every attached project.`),J;if(P(J))return J;let W=J.environments&&Object.keys(J.environments)[0],$=process.env.TS_CLOUD_UI_DOMAIN?.trim()||void 0,z=Number(process.env.TS_CLOUD_UI_PORT)||void 0,Y={...J.sites??{}};if(!N(process.env.TS_CLOUD_UI_STATIC)){let C=n(J,X,Q);if(!C)return J;let q=_(J,W??"production",{uiRoot:C,build:!1,domain:$,port:z,live:!0});if(q.length===0)return Q.info("Management dashboard: no domain resolved (set TS_CLOUD_UI_DOMAIN or configure a site domain) — skipping."),J;for(let{name:b,site:V}of q)Y[b]=V,Q.info(`Management dashboard → https://${V.domain} (sign in with your ts-cloud account; the first deploy prints an admin password once)`);return J.sites=Y,J}let H=i(X);if(!H)return Q.info("Management dashboard: UI not found (no local ui/ or packaged dist/ui) — skipping auto-deploy."),J;let O=process.env.TS_CLOUD_UI_USERNAME?.trim()||"admin",E=t(X,O,Q),M=_(J,W??"production",{uiRoot:H.uiRoot,build:H.build,domain:$,username:O,password:E.password,realm:process.env.TS_CLOUD_UI_REALM?.trim()||void 0,live:!1,port:z});if(M.length===0)return Q.info("Management dashboard: no domain resolved (set TS_CLOUD_UI_DOMAIN or configure a site domain) — skipping."),J;let m=E.source==="public"?"NO AUTH — TS_CLOUD_UI_PUBLIC is set (dashboard is publicly reachable)":E.source==="env"?"htpasswd-protected (TS_CLOUD_UI_PASSWORD)":`htpasswd-protected (auto-generated — see ${w()})`;Q.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:C,site:q}of M)Y[C]=q,Q.info(`Management dashboard → https://${q.domain} (${m})`);return J.sites=Y,J}function zJ(J){return Object.keys(J.sites??{}).filter(F)}function GJ(J,K){if(!J?.root)return null;let Q=K.cwd??process.cwd(),X=K.logger??S;try{if(typeof J.build==="string"&&J.build.trim())X.info(`Management dashboard: building UI (${J.build})`),R(J.build,{cwd:Q,stdio:"inherit"});let W=j(J.root)?J.root:Z(Q,J.root);if(!G(W))return X.warn(`Management dashboard: build output not found at ${W} — skipping dashboard artifact.`),null;let $=Z(l(),`${K.slug}-${K.siteName??c}-${K.sha}.tar.gz`);return R(`tar czf "${$}" -C "${W}" .`,{stdio:"inherit"}),$}catch(W){return X.warn(`Management dashboard: failed to build artifact — ${W?.message??W}. Skipping dashboard deploy.`),null}}
6
- export{c as Ye,w as Ze,t as _e,r as $e,s as af,n as bf,i as cf,$J as df,zJ as ef,GJ as ff};
@@ -1,6 +0,0 @@
1
- import{nh as o,oh as n}from"./chunk-jpjamjey.js";function dj(j,Z){return`/var/www/${j}-${Z}`}var Hj=new Set(["laravel","php","statamic","wordpress"]);function i(j){return j.type!=null&&Hj.has(j.type)}function Yj(j){let Z=j.proxyTo;if(Z==null)return[];return(Array.isArray(Z)?Z:[Z]).map((z)=>String(z).trim()).filter((z)=>z.length>0)}function Fj(j){return Yj(j).length>0}function t(j){if(j.deploy)return j.deploy;if(i(j))return"server";if(j.start)return"server";return"bucket"}function f(j){if(j.redirect)return"redirect";if(Fj(j))return"proxy";if(i(j))return"server-php";if(t(j)==="bucket")return"bucket";return j.start?"server-app":"server-static"}function wj(j){return j.infrastructure?.compute!=null||Boolean(j.cloud?.attachTo?.trim())}function pj(j,Z={}){let $=[],z=[],Q=j.sites||{},W=wj(j),q=n(j);if(q)$.push(q);let H=new Map;for(let[K,X]of Object.entries(Q)){if(!X)continue;let F=t(X),L=f(X);if(L==="redirect"){if(!X.domain)$.push(`Site '${K}' is a redirect site but has no \`domain\` to redirect from.`);if(!(typeof X.redirect==="string"?X.redirect:X.redirect?.to))$.push(`Site '${K}' is a redirect site but has no redirect target (\`redirect\` / \`redirect.to\`).`);if(!W)$.push(`Site '${K}' is a redirect site but no \`infrastructure.compute\` is configured to host the gateway that serves the redirect.`);let J=[];if(X.start)J.push("start");if(X.root)J.push("root");if(X.proxyTo)J.push("proxyTo");if(J.length>0)z.push(`Site '${K}' is a redirect site but also sets ${J.join(", ")}. These are ignored.`);continue}if(L==="proxy"){if(!X.domain)$.push(`Site '${K}' is a proxy site but has no \`domain\` to route from.`);if(!W)$.push(`Site '${K}' is a proxy site but no \`infrastructure.compute\` is configured to host the gateway that forwards it.`);let M=[];if(X.start)M.push("start");if(X.root)M.push("root");if(typeof X.port==="number")M.push("port");if(X.build)M.push("build");if(X.preStart&&X.preStart.length>0)M.push("preStart");if(M.length>0)z.push(`Site '${K}' sets \`proxyTo\`, so ts-cloud ships and supervises nothing for it. ${M.join(", ")} ${M.length===1?"is":"are"} ignored — remove ${M.length===1?"it":"them"}, or drop \`proxyTo\` to let ts-cloud own the service.`);continue}if(F==="server"&&!X.start&&!X.root){$.push(`Site '${K}' sets deploy:'server' but declares neither \`start\` (dynamic app) nor \`root\` (static site to serve). Add one.`);continue}if(L==="server-php"){if(!W)$.push(`Site '${K}' is a PHP site (type:'${X.type}') but no \`infrastructure.compute\` is configured. Add a server (infrastructure.compute) with PHP provisioning.`);if(!X.repository?.url)$.push(`Site '${K}' is a PHP site (type:'${X.type}') but has no \`repository.url\` to clone. PHP sites deploy via git.`)}else if(L==="server-app"){if(!W)$.push(`Site '${K}' deploys to a server (deploy:'server'${X.deploy?"":" inferred from `start`"}) but no \`infrastructure.compute\` is configured. Set deploy:'bucket' or add a server (infrastructure.compute).`);if(typeof X.port==="number"){let M=Z.occupiedPorts?.get(X.port);if(M)$.push(`Site '${K}' wants port ${X.port}, which project '${M}' already serves on this box. Attached projects share one port namespace. Give '${K}' a free port, or let the attach allocate one.`);let J=H.get(X.port);if(J)$.push(`Sites '${J}' and '${K}' both use port ${X.port}. Server apps sharing a box must use distinct ports.`);else H.set(X.port,K)}}else if(L==="server-static"){if(!X.root)$.push(`Site '${K}' is a server static site (deploy:'server', no \`start\`) but has no \`root\` directory to serve.`);if(!W)$.push(`Site '${K}' deploys to a server (deploy:'server') but no \`infrastructure.compute\` is configured. Set deploy:'bucket' or add a server (infrastructure.compute).`)}else{if(!X.root)$.push(`Site '${K}' deploys to a bucket but has no \`root\` directory to upload.`);let M=[];if(X.start)M.push("start");if(typeof X.port==="number")M.push("port");if(X.preStart&&X.preStart.length>0)M.push("preStart");if(M.length>0)z.push(`Site '${K}' deploys to a bucket but sets server-only field(s): ${M.join(", ")}. These are ignored. Set deploy:'server' to use them.`)}}return{errors:$,warnings:z}}function rj(j){let Z=f(j);return Z!=="bucket"&&Z!=="redirect"&&Z!=="proxy"}function oj(j){return f(j)==="bucket"}function nj(j,Z){if(o(j)==="serverless")return!0;let $=Object.entries(j.sites??{}).filter(([,Q])=>Q!=null),z=Z?$.filter(([Q])=>Q===Z):$;if(z.length===0)return!0;return!z.every(([,Q])=>{let W=f(Q);return W==="redirect"||W==="proxy"})}var s={php:"php.net",nginx:"nginx.org",composer:"getcomposer.org",mysql:"mysql.com",mariadb:"mariadb.com/server",postgres:"postgresql.org",vitess:"vitess.io",etcd:"etcd.io",redis:"redis.io",memcached:"memcached.org",meilisearch:"meilisearch.com",git:"git-scm.com",certbot:"certbot.eff.org",bun:"bun.sh",node:"nodejs.org",deno:"deno.land"};var y="/opt/pantry";function v(j){return`'${j.split("'").join("'\\''")}'`}function tj(j={}){return["export DEBIAN_FRONTEND=noninteractive","export PANTRY_SERVICE_SCOPE=system","export PANTRY_INSTALL_DIR=/usr/local/bin",j.version?`export PANTRY_VERSION=${v(j.version)}`:'export PANTRY_VERSION="${PANTRY_VERSION:-latest}"',"command -v curl >/dev/null 2>&1 || (apt-get update -y && apt-get install -y curl ca-certificates)","command -v unzip >/dev/null 2>&1 || (apt-get update -y && apt-get install -y unzip)",'OS=$(uname -s | tr \'[:upper:]\' \'[:lower:]\'); ARCH=$(uname -m); case "$ARCH" in x86_64|amd64) ARCH=x64 ;; arm64|aarch64) ARCH=arm64 ;; esac; ZIP="pantry-${OS}-${ARCH}.zip"; if [ "${PANTRY_VERSION:-latest}" = latest ]; then REL=\'latest/download\'; else REL="download/v${PANTRY_VERSION}"; fi; TMP=$(mktemp -d); curl -fsSL -o "${TMP}/${ZIP}" "https://github.com/pantry-pm/pantry/releases/${REL}/${ZIP}"; unzip -o "${TMP}/${ZIP}" -d /usr/local/bin; chmod +x /usr/local/bin/pantry; rm -rf "${TMP}"','export PATH="/usr/local/bin:$PATH"',"mkdir -p /opt/pantry"]}function T(){return'eval "$(cd /opt/pantry && pantry env 2>/dev/null)" || true'}function m(j){if(j.length===0)return[];return[`(cd /opt/pantry && pantry install ${[...new Set(j)].map(v).join(" ")})`]}function a(j){return[...new Set(j)].flatMap((Z)=>[`(cd /opt/pantry && pantry start ${v(Z)})`,`(cd /opt/pantry && pantry enable ${v(Z)})`])}var w=`${y}/pantry/.bin`,h=15306,b=15991,E=15999,e=16101,P=2379,B="/var/lib/vitess",g=100;function Bj(j){return j===!0||typeof j==="object"&&j!==null}function Dj(j){return typeof j==="object"&&j!==null?j:{}}function G(j){return`'${String(j).split("'").join("'\\''")}'`}function Lj(j){let $=[j.version?`vitess.io@${j.version}`:"vitess.io"];if(j.mode!=="combo"&&!j.etcdEndpoint)$.push("etcd.io");return $.push("mysql.com@8.0.43"),$}var Y="vitess",Nj=`${w}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`,zj="/usr/local/lib/vitess",l=new Map;function u(j){return`${zj}/${j}.sh`}function O(j,Z){return l.set(j,Cj(Z)),`/bin/sh ${u(j)}`}function jj(){let j=[`mkdir -p ${zj}`];for(let[Z,$]of l)j.push(`cat > ${u(Z)} <<'TS_CLOUD_VITESS_LAUNCHER_EOF'`,$,"TS_CLOUD_VITESS_LAUNCHER_EOF",`chmod 0755 ${u(Z)}`);return j}function Cj(j){return["#!/bin/sh","set -e",`cd ${y}`,`PANTRY_ENV="$(pantry env 2>/dev/null | grep -E '^(export [A-Za-z_]|[A-Za-z_][A-Za-z0-9_]*=)' || true)"`,'if [ -n "$PANTRY_ENV" ]; then eval "$PANTRY_ENV"; fi',`VT_MYSQL_ROOT="$(dirname "$(dirname "$(readlink -f ${w}/mysqld 2>/dev/null)")")"`,`VTROOT="$(dirname "$(dirname "$(readlink -f ${w}/mysqlctld 2>/dev/null)")")"`,"export VT_MYSQL_ROOT VTROOT",'LD_LIBRARY_PATH="$VT_MYSQL_ROOT/lib:$VTROOT/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"',"export LD_LIBRARY_PATH",`exec ${j.join(" ")}`].join(`
2
- `)}function V(j){let Z=["[Unit]",`Description=${j.description}`,`After=network.target${j.after?.length?` ${j.after.join(" ")}`:""}`];if(j.requires?.length)Z.push(`Requires=${j.requires.join(" ")}`);return Z.push("","[Service]","Type=simple",`User=${Y}`,`Group=${Y}`,`Environment="PATH=${Nj}"`,`Environment="VTDATAROOT=${B}"`,...Object.entries(j.environment??{}).map(([$,z])=>`Environment="${$}=${z}"`),...(j.execStartPre??[]).map(($)=>`ExecStartPre=${$}`),`ExecStart=${j.execStart}`,"Restart=always","RestartSec=5","LimitNOFILE=65535","","[Install]","WantedBy=multi-user.target"),Z.join(`
3
- `)}function Zj(j,Z){return[`cat > /etc/systemd/system/${j}.service <<'TS_CLOUD_VITESS_UNIT_EOF'`,Z,"TS_CLOUD_VITESS_UNIT_EOF"]}function Oj(j){let Z=j.cell??"zone1",$=j.vtgatePort??h,Q=`${((j.keyspaces?.length)?j.keyspaces:[{name:"app"}]).map((W)=>{let q=(W.sharded?["-80","80-"]:["0"]).map((H)=>`shards:{name:"${H}"}`).join(" ");return`keyspaces:{name:"${W.name}" ${q}}`}).join(" ")} cells:"${Z}"`;return V({description:"Vitess (vtcombo, single-process development stack)",execStart:O("vtcombo",[`${w}/vtcombo`,`--cell ${Z}`,`--proto-topo ${G(Q)}`,`--mysql-server-port ${$}`,"--mysql-server-bind-address 127.0.0.1","--mysql-auth-server-impl none","--start-mysql",`--port ${b}`,`--grpc-port ${E}`])})}function Vj(){return V({description:"etcd (Vitess topology store)",execStart:O("etcd",[`${w}/etcd`,`--data-dir ${B}/etcd`,`--listen-client-urls http://127.0.0.1:${P}`,`--advertise-client-urls http://127.0.0.1:${P}`]),execStartPre:[`+/bin/mkdir -p ${B}/etcd`,`+/bin/chown ${Y}:${Y} ${B}/etcd`]})}function c(j){return["--topo-implementation etcd2",`--topo-global-server-address ${j.etcdEndpoint??`http://127.0.0.1:${P}`}`,"--topo-global-root /vitess/global"]}function Uj(j){let Z=!j.etcdEndpoint;return V({description:"Vitess vtctld (control plane)",after:Z?["vitess-etcd.service"]:[],requires:Z?["vitess-etcd.service"]:[],execStart:O("vtctld",[`${w}/vtctld`,...c(j),`--cell ${j.cell??"zone1"}`,"--service-map grpc-vtctl,grpc-vtctld",`--grpc-port ${E}`,`--port ${E+1}`])})}function Aj(j,Z,$){let z=j.cell??"zone1";return V({description:`Vitess vttablet (${Z}/${$})`,after:["vitess-vtctld.service","vitess-mysqlctld.service"],requires:["vitess-mysqlctld.service"],execStart:O("vttablet",[`${w}/vttablet`,...c(j),`--tablet-path ${z}-${String(g).padStart(10,"0")}`,`--init-keyspace ${Z}`,`--init-shard ${$}`,"--init-tablet-type replica",`--service-map ${G("grpc-queryservice,grpc-tabletmanager,grpc-updatestream")}`,`--port ${e}`,`--grpc-port ${e+1}`,`--db-port ${j.mysqlPort??3306}`,`--mycnf-mysql-port ${j.mysqlPort??3306}`])})}function kj(j){return V({description:"Vitess mysqlctld (managed mysqld)",execStart:O("mysqlctld",[`${w}/mysqlctld`,`--tablet-uid ${g}`,`--mysql-port ${j.mysqlPort??3306}`,'--init-db-sql-file "$VTROOT/config/init_db.sql"',"--wait-time 2m"]),execStartPre:[`+/bin/mkdir -p ${B}`,`+/bin/chown ${Y}:${Y} ${B}`]})}var Wj="/etc/vitess/auth.json",A="/var/lib/vitess/vtgate-auth.sha256";function Rj(j){let Z=j.username??"vitess",$=j.password??"";return["mkdir -p /etc/vitess",'VTESS_AUTH_TMP="$(mktemp)"',`cat > "$VTESS_AUTH_TMP" <<'TS_CLOUD_VITESS_AUTH_EOF'`,JSON.stringify({[Z]:[{Password:$,UserData:Z}]}),"TS_CLOUD_VITESS_AUTH_EOF",`VTESS_VTGATE_AUTH_SHA="$(sha256sum "$VTESS_AUTH_TMP" | awk '{print $1}')"`,"VTESS_VTGATE_AUTH_CHANGED=1",`if [ -f ${A} ] && [ "$(cat ${A})" = "$VTESS_VTGATE_AUTH_SHA" ]; then VTESS_VTGATE_AUTH_CHANGED=0; fi`,`install -o ${Y} -g ${Y} -m 0600 "$VTESS_AUTH_TMP" ${Wj}`,'rm -f "$VTESS_AUTH_TMP"']}function Ij(j){let Z=j.cell??"zone1";return V({description:"Vitess vtgate (query router)",after:["vitess-vtctld.service"],execStart:O("vtgate",[`${w}/vtgate`,...c(j),`--cell ${Z}`,`--cells-to-watch ${Z}`,"--tablet-types-to-wait PRIMARY,REPLICA",`--service-map ${G("grpc-vtgateservice")}`,`--mysql-server-port ${j.vtgatePort??h}`,`--mysql-server-bind-address ${j.bindAddress??"127.0.0.1"}`,"--mysql-auth-server-impl static",`--mysql-auth-server-static-file ${Wj}`,`--port ${b}`,`--grpc-port ${b+1}`])})}function fj(j){let Z=j.cell??"zone1",$=j.etcdEndpoint??`http://127.0.0.1:${P}`,z=`${w}/vtctldclient --server 127.0.0.1:${E}`,Q=[`for i in $(seq 1 30); do ${z} GetCellInfoNames >/dev/null 2>&1 && break; sleep 2; done`,`if ! ${z} GetCellInfoNames 2>/dev/null | grep -qx ${G(Z)}; then`,` ${z} AddCellInfo --root ${G(`/vitess/${Z}`)} --server-address ${G($)} ${G(Z)}`,"fi"];for(let W of j.keyspaces??[]){let q=W.sharded?" --sharded":"";Q.push(`if ! ${z} GetKeyspace ${G(W.name)} >/dev/null 2>&1; then`,` ${z} CreateKeyspace${q} ${G(W.name)}`,"fi");let H=`${Z}-${String(g).padStart(10,"0")}`;for(let K of W.sharded?["-80","80-"]:["0"]){let X=`${W.name}/${K}`;Q.push("for i in $(seq 1 90); do",` if ${z} GetShard ${G(X)} 2>/dev/null | grep -q '"is_primary_serving": *true'; then break; fi`,` ${z} PlannedReparentShard ${G(X)} --new-primary ${G(H)} >/dev/null 2>&1 && break`,` ${z} InitShardPrimary --force ${G(X)} ${G(H)} >/dev/null 2>&1 && break`," sleep 2","done",`if ! ${z} GetShard ${G(X)} 2>/dev/null | grep -q '"is_primary_serving": *true'; then`,` echo "no primary could be elected for ${X}" >&2; exit 1`,"fi")}Q.push(`${z} RebuildKeyspaceGraph ${G(W.name)} >/dev/null`)}return Q}function $j(j){let Z=j.vtgatePort??h;return["for i in $(seq 1 60); do",` if (cd ${y} && eval "$(pantry env 2>/dev/null)"; MYSQL_PWD=${G(j.password??"")} ${w}/mysql -h 127.0.0.1 -P ${Z} -u ${G(j.username??"vitess")} --connect-timeout=2 -e 'SHOW KEYSPACES') >/dev/null 2>&1; then`,` echo "vtgate is serving on ${Z}"; exit 0`," fi"," sleep 2","done",`echo "vtgate did not become ready on port ${Z}" >&2`,"exit 1"]}function Xj(j){if(!Bj(j))return[];let Z=Dj(j),$=Z.mode==="combo";l.clear();let z=[...m(Lj(Z)),`VT_MYSQL_LIB="$(dirname "$(dirname "$(readlink -f ${w}/mysqld)")")/lib"`,'if [ -d "$VT_MYSQL_LIB" ]; then',` printf '%s\\n' "$VT_MYSQL_LIB" > /etc/ld.so.conf.d/vitess-mysql.conf`," ldconfig","else",' echo "mysqld library directory not found under $VT_MYSQL_LIB" >&2; exit 1',"fi",`id -u ${Y} >/dev/null 2>&1 || useradd --system --home-dir ${B} --shell /usr/sbin/nologin ${Y}`,`mkdir -p ${B}`,`chown -R ${Y}:${Y} ${B}`];if($)return z.push(...Zj("vitess-vtcombo",Oj(Z)),...jj(),"systemctl daemon-reload","systemctl enable --now vitess-vtcombo.service",...$j(Z)),z;z.push(...Rj(Z));let Q=[];if(!Z.etcdEndpoint)Q.push(["vitess-etcd",Vj()]);Q.push(["vitess-vtctld",Uj(Z)],["vitess-mysqlctld",kj(Z)],["vitess-vtgate",Ij(Z)]);for(let W of Z.keyspaces??[])for(let q of W.sharded?["-80","80-"]:["0"])Q.push([`vitess-vttablet-${W.name}-${q.replace(/-/g,"x")}`,Aj(Z,W.name,q)]);for(let[W,q]of Q)z.push(...Zj(W,q));z.push(...jj()),z.push("systemctl daemon-reload");for(let[W]of Q)z.push(`systemctl enable --now ${W}.service`);return z.push(`if [ "$VTESS_VTGATE_AUTH_CHANGED" = 1 ]; then systemctl restart vitess-vtgate.service; printf '%s\\n' "$VTESS_VTGATE_AUTH_SHA" > ${A}; chown ${Y}:${Y} ${A}; chmod 0600 ${A}; fi`,...fj(Z),...$j(Z)),z}var vj=new Set(["singlestore","vitess"]);function Jj(j){if(j?.engine&&vj.has(j.engine))return!1;return!j?.host||j.host==="127.0.0.1"||j.host==="localhost"}function d(j,Z="psql"){let $=j?.port??5432;if(Jj(j))return`${Z} -p ${$} -U postgres`;let z=j?.username||"postgres";return`${j?.password?`PGPASSWORD='${j.password.replace(/'/g,"'\\''")}' `:""}${Z} -h ${j.host} -p ${$} -U ${z} -w`}function D(j){return j===!0||typeof j==="object"&&j!=null}function yj(j){let Z=[],$=[];if(D(j.mysql))Z.push(typeof j.mysql==="object"&&j.mysql.version?`mysql.com@${j.mysql.version}`:"mysql.com@8.0.43"),$.push("mysql");else if(D(j.mariadb))Z.push(s.mariadb),$.push("mariadb");if(D(j.postgres))Z.push("postgresql.org"),$.push("postgres");if(D(j.redis))Z.push("redis.io"),$.push("redis");if(D(j.memcached))Z.push("memcached.org"),$.push("memcached");if(D(j.meilisearch))Z.push("meilisearch.com"),$.push("meilisearch");return{packages:Z,services:$}}function $Z(j={},Z={}){let $=yj(j),z=Xj(j.vitess);if($.packages.length===0)return z;return[...m($.packages),...a($.services),...z]}function zZ(j,Z={}){if(!j?.name)return[];if(!Jj(j))return[];let $=j.name,z=j.username||$,Q=j.password||"",W=D(Z.postgres)||j.engine==="postgres",q=D(Z.mariadb)||j.engine==="mariadb",H=D(Z.mysql)||j.engine==="mysql";if(W&&!H&&!q){let J=(x)=>`"${x.replace(/"/g,'""')}"`,C=(x)=>`'${x.replace(/'/g,"''")}'`,U=(x,I)=>["DO $$ BEGIN",` IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = ${C(x)}) THEN`,` CREATE ROLE ${J(x)} LOGIN PASSWORD ${C(I)};`," ELSE",` ALTER ROLE ${J(x)} LOGIN PASSWORD ${C(I)};`," END IF;","END $$;"],k=(x)=>{let I=x.databases&&x.databases.length>0?x.databases:[$],_=[];for(let S of I)if(x.access==="readonly")_.push(`GRANT CONNECT ON DATABASE ${J(S)} TO ${J(x.username)};`,`\\connect ${J(S)}`,`GRANT USAGE ON SCHEMA public TO ${J(x.username)};`,`GRANT SELECT ON ALL TABLES IN SCHEMA public TO ${J(x.username)};`,`ALTER DEFAULT PRIVILEGES FOR ROLE ${J(z)} IN SCHEMA public GRANT SELECT ON TABLES TO ${J(x.username)};`,"\\connect postgres");else _.push(`GRANT ALL PRIVILEGES ON DATABASE ${J(S)} TO ${J(x.username)};`);return _},R=j.users||[],Gj=j.port??5432;return[T(),`for i in $(seq 1 30); do pg_isready -p ${Gj} -q && break; sleep 2; done`,`${d(j)} <<'TS_CLOUD_PG_EOF'`,...U(z,Q),`SELECT 'CREATE DATABASE ${J($)} OWNER ${J(z)}' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = ${C($)})\\gexec`,...R.flatMap((x)=>[...U(x.username,x.password),...k(x)]),"TS_CLOUD_PG_EOF"]}let K=q?"/var/lib/pantry/mariadb/mariadbd.sock":"/var/lib/pantry/mysql/mysqld.sock",X=(J)=>J.replace(/`/g,"``"),F=(J)=>J.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),L=(J)=>{let C=J.databases&&J.databases.length>0?J.databases:[$],U=J.access==="readonly"?"SELECT":"ALL PRIVILEGES",k=[`CREATE USER IF NOT EXISTS '${F(J.username)}'@'%' IDENTIFIED BY '${F(J.password)}';`,`CREATE USER IF NOT EXISTS '${F(J.username)}'@'localhost' IDENTIFIED BY '${F(J.password)}';`,`ALTER USER '${F(J.username)}'@'%' IDENTIFIED BY '${F(J.password)}';`,`ALTER USER '${F(J.username)}'@'localhost' IDENTIFIED BY '${F(J.password)}';`];for(let R of C)k.push(`GRANT ${U} ON \`${X(R)}\`.* TO '${F(J.username)}'@'%';`,`GRANT ${U} ON \`${X(R)}\`.* TO '${F(J.username)}'@'localhost';`);return k},M=j.users||[];return[T(),`for i in $(seq 1 30); do mysqladmin --socket=${K} -u root ping 2>/dev/null | grep -q alive && break; sleep 2; done`,`mysql --socket=${K} -u root <<'TS_CLOUD_SQL_EOF'`,`CREATE DATABASE IF NOT EXISTS \`${X($)}\` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;`,...L({username:z,password:Q}),...M.flatMap(L),"FLUSH PRIVILEGES;","TS_CLOUD_SQL_EOF"]}function WZ(j){if(!j?.name)return{};let Z=j.engine==="singlestore",$=j.engine==="vitess",z=j.engine==="postgres"?"pgsql":Z?"singlestore":$?"vitess":"mysql",Q=j.port??(j.engine==="postgres"?5432:$?15306:3306),W={DB_CONNECTION:z,DB_HOST:j.host||"127.0.0.1",DB_PORT:String(Q),DB_DATABASE:j.name};if(j.username)W.DB_USERNAME=j.username;if(j.password)W.DB_PASSWORD=j.password;if((Z||$)&&j.ssl!==!1)W.DB_SSL="true";return W}var r="/var/backups/ts-cloud",mj="/etc/ts-cloud/backups.config.ts",Qj="/etc/cron.d/ts-cloud-backups",p="/usr/local/bin/ts-cloud-backup.sh";function Ej(j){if(!j.name)return null;let Z=j.host||"127.0.0.1",$=j.engine==="postgres",z=$?"postgresql":"mysql",Q=j.port??($?5432:3306),W=(q)=>q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");return[" {",` type: '${z}',`,` name: '${W(j.name)}',`," connection: {",` hostname: '${W(Z)}',`,` port: ${Q},`,` database: '${W(j.name)}',`,` username: '${W(j.username||j.name)}',`,` password: '${W(j.password||"")}',`," ssl: false,"," },"," includeSchema: true,"," includeData: true,"," },"].join(`
4
- `)}function Pj(j,Z){let $=j?Ej(j):null,z=Z.bucket?[" destinations: ["," {"," type: 's3',",` bucket: '${Z.bucket}',`," prefix: 'db-backups',",...Z.endpoint?[` endpoint: '${Z.endpoint}',`]:[]," optional: false,"," },"," ],"]:[];return["import type { BackupConfig } from 'ts-backups'","","const config: BackupConfig = {"," verbose: true,",` outputPath: '${r}',`," retention: {",` count: ${Z.retentionCount??5},`,` maxAge: ${Z.retentionDays??30},`," },"," databases: [",...$?[$]:[]," ],",...z,"}","","export default config",""].join(`
5
- `)}function QZ(j){let{database:Z,backups:$}=j;if(!$.enabled)return[];let z=$.schedule||"0 2 * * *",Q=Pj(Z,$);return["export DEBIAN_FRONTEND=noninteractive",`mkdir -p /etc/ts-cloud ${r}`,"command -v bun >/dev/null 2>&1 || (curl -fsSL https://bun.sh/install | bash && ln -sf /root/.bun/bin/bun /usr/local/bin/bun)","bun add -g ts-backups || true",`cat > ${mj} <<'TS_CLOUD_BACKUP_CFG_EOF'`,Q.replace(/\n$/,""),"TS_CLOUD_BACKUP_CFG_EOF",`cat > ${p} <<'TS_CLOUD_BACKUP_RUN_EOF'`,"#!/bin/bash","set -uo pipefail",'export PATH="/root/.bun/bin:/usr/local/bin:$PATH"','notify() { [ -x /usr/local/bin/ts-cloud-notify ] && /usr/local/bin/ts-cloud-notify "$1" || true; }',"cd /etc/ts-cloud",'if ! ts-backups backup --config /etc/ts-cloud/backups.config.ts; then notify "❌ ts-cloud backup failed"; exit 1; fi',"TS_CLOUD_BACKUP_RUN_EOF",`chmod +x ${p}`,`cat > ${Qj} <<'TS_CLOUD_BACKUP_CRON_EOF'`,`${z} root ${p} >> /var/log/ts-cloud-backup.log 2>&1`,"TS_CLOUD_BACKUP_CRON_EOF",`chmod 644 ${Qj}`]}function _j(j){return j==="mariadb"?"/var/lib/pantry/mariadb/mariadbd.sock":"/var/lib/pantry/mysql/mysqld.sock"}function qZ(j,Z={}){if(!j?.name)return[];let $=j.name,z=j.engine==="postgres",Q=Z.from?`TS_CLOUD_DUMP="${Z.from}"`:`TS_CLOUD_DUMP="$(find ${r} -type f -name '*${$}*.sql' -o -type f -name '*${$}*.sql.gz' 2>/dev/null | xargs -r ls -1t 2>/dev/null | head -1)"`,W=z?`${d(j)} -d "${$}"`:`mysql --socket=${_j(j.engine)} -u root "${$}"`;return["set -uo pipefail",'eval "$(cd /opt/pantry && pantry env 2>/dev/null)" || true',Q,'[ -n "$TS_CLOUD_DUMP" ] && [ -f "$TS_CLOUD_DUMP" ] || { echo "no backup dump found to restore" >&2; exit 1; }','echo "[ts-cloud] restoring '+$+' from $TS_CLOUD_DUMP"',`case "$TS_CLOUD_DUMP" in *.gz) gunzip -c "$TS_CLOUD_DUMP" ;; *) cat "$TS_CLOUD_DUMP" ;; esac | ${W}`,'echo "restore complete"']}var Kj=["storage",".env"],MZ=4;function N(j){return`${j.replace(/\/+$/,"")}/.ts-cloud`}function Sj(j){return`${N(j)}/deploy-history.log`}function Tj(j,Z){return`${N(j)}/deploys/${Z}.log`}function Mj(j){return`${N(j)}/shared-paths`}function xZ(j,Z){let $=j.replace(/\/+$/,"");return{base:$,releases:`${$}/releases`,shared:`${$}/shared`,current:`${$}/current`,release:`${$}/releases/${Z}`}}function bj(j){let Z=j.split("/").pop()||j;if(Z===".env"||Z.startsWith(".env."))return!0;return/\.[a-z0-9]+$/i.test(Z)}function uj(j){return typeof j==="string"?j:j.path}function GZ(j){let Z=new Map;for(let $ of j)Z.set(uj($),$);return[...Z.values()]}function xj(j,Z){if(typeof Z==="string")return{path:Z,target:`${j.shared}/${Z}`,seed:!0};return{path:Z.path,target:Z.target??`${j.shared}/${Z.path}`,seed:Z.seed!==!1}}function hj(j){return["ts_cloud_adopt_shared() {",' TS_CLOUD_SP="$1"',' TS_CLOUD_DST="$2"',` TS_CLOUD_SRC="${j.current}/$TS_CLOUD_SP"`,' if [ -e "$TS_CLOUD_DST" ]; then return 0; fi',' if [ -L "$TS_CLOUD_SRC" ] || [ ! -e "$TS_CLOUD_SRC" ]; then return 0; fi',' mkdir -p "$(dirname "$TS_CLOUD_DST")"',' cp -a "$TS_CLOUD_SRC" "$TS_CLOUD_DST"'," for TS_CLOUD_SIDECAR in -wal -shm; do",' if [ -f "$TS_CLOUD_SRC$TS_CLOUD_SIDECAR" ]; then cp -a "$TS_CLOUD_SRC$TS_CLOUD_SIDECAR" "$TS_CLOUD_DST$TS_CLOUD_SIDECAR"; fi'," done",' echo "[ts-cloud] adopted $TS_CLOUD_SP from the live release into shared/ — it now survives deploys"'," return 0","}"]}function HZ(j,Z=Kj){let $=[`mkdir -p ${j.releases} ${j.shared}`,...hj(j)],z=Z.map((W)=>xj(j,W));for(let{path:W,target:q,seed:H}of z){if(!H)continue;if($.push(`ts_cloud_adopt_shared '${W}' '${q}'`),bj(W))$.push(`mkdir -p "$(dirname ${q})"`,`touch ${q}`);else if(W==="storage")$.push(`mkdir -p ${q}/app/public`,`mkdir -p ${q}/framework/cache/data`,`mkdir -p ${q}/framework/sessions`,`mkdir -p ${q}/framework/testing`,`mkdir -p ${q}/framework/views`,`mkdir -p ${q}/logs`);else $.push(`mkdir -p ${q}`)}let Q=Mj(j.base);return $.push(`mkdir -p ${N(j.base)}`,`cat > ${Q} <<'TS_CLOUD_SHARED_PATHS_EOF'`,...z.map((W)=>`${W.path} ${W.target}`),"TS_CLOUD_SHARED_PATHS_EOF"),$}function YZ(j,Z=900){let $=`${N(j.base)}/deploy.lock`;return[`mkdir -p "$(dirname ${$})"`,`exec 9>${$}`,`flock -w ${Z} 9 || { echo "[ts-cloud] another deploy of this site has held the lock for ${Z}s — refusing to race it" >&2; exit 1; }`]}function FZ(j){let Z=`${j.release}.incoming`;return[`rm -rf ${Z}`,`mkdir -p ${Z}`,...gj(j),'if [ "$TS_CLOUD_IS_LIVE" = "yes" ]; then',` TS_CLOUD_STAGED=${Z}`,"else",` rm -rf ${j.release}`,` mkdir -p ${j.release}`,` rmdir ${Z}`,` TS_CLOUD_STAGED=${j.release}`,"fi"]}function wZ(j){let Z=`TS_CLOUD_TRAP_LIVE="$(readlink -f ${j.current} 2>/dev/null || true)"`,$=`TS_CLOUD_TRAP_TARGET="$(readlink -f ${j.release} 2>/dev/null || echo ${j.release})"`;return`trap '${`if [ $? -ne 0 ]; then ${Z}; ${$}; [ "$TS_CLOUD_TRAP_LIVE" = "$TS_CLOUD_TRAP_TARGET" ] || rm -rf ${j.release}; fi`}' EXIT`}function gj(j){return[`TS_CLOUD_LIVE_PATH="$(readlink -f ${j.current} 2>/dev/null || true)"`,`TS_CLOUD_RELEASE_PATH="$(readlink -f ${j.release} 2>/dev/null || echo ${j.release})"`,'if [ -n "$TS_CLOUD_LIVE_PATH" ] && [ "$TS_CLOUD_LIVE_PATH" = "$TS_CLOUD_RELEASE_PATH" ]; then TS_CLOUD_IS_LIVE=yes; else TS_CLOUD_IS_LIVE=no; fi']}function BZ(j){let Z=`${j.release}.incoming`;return[`if [ "$TS_CLOUD_STAGED" = "${Z}" ]; then`,` rm -rf ${j.release}.previous`,` mv ${j.release} ${j.release}.previous`,` mv ${Z} ${j.release}`,` rm -rf ${j.release}.previous`,"fi"]}function DZ(j,Z=Kj){let $=[];for(let z of Z){let{path:Q,target:W,seed:q}=xj(j,z),H=`${j.release}/${Q}`,K=[`rm -rf ${H}`,`mkdir -p "$(dirname ${H})"`,`ln -sfn ${W} ${H}`];if(q){$.push(...K);continue}$.push(`if [ -e ${W} ]; then`,...K.map((X)=>` ${X}`),"fi")}return $}function qj(j,Z){let $=Mj(j.base);return[`if [ -f ${$} ]; then`,' while IFS="\t" read -r TS_CLOUD_SP TS_CLOUD_TGT; do',' [ -n "$TS_CLOUD_SP" ] || continue',` [ -n "$TS_CLOUD_TGT" ] || TS_CLOUD_TGT="${j.shared}/$TS_CLOUD_SP"`,' [ -e "$TS_CLOUD_TGT" ] || continue',` rm -rf ${Z}/"$TS_CLOUD_SP"`,` mkdir -p "$(dirname ${Z}/"$TS_CLOUD_SP")"`,` ln -sfn "$TS_CLOUD_TGT" ${Z}/"$TS_CLOUD_SP"`,` done < ${$}`,"fi"]}function LZ(j){return[`ln -sfn ${j.release} ${j.current}.tmp`,`mv -Tf ${j.current}.tmp ${j.current}`]}function NZ(j,Z={}){let $=Z.to?[`[ -d ${j.releases}/${Z.to} ] || { echo "rollback target ${j.releases}/${Z.to} not found" >&2; exit 1; }`,...qj(j,`${j.releases}/${Z.to}`),`ln -sfn ${j.releases}/${Z.to} ${j.current}.tmp`,`mv -Tf ${j.current}.tmp ${j.current}`]:[`TS_CLOUD_CURRENT=$(readlink -f ${j.current} 2>/dev/null || true)`,`TS_CLOUD_PREV=$(ls -1dt ${j.releases}/*/ 2>/dev/null | sed 's#/$##' | while read -r r; do [ "$(readlink -f "$r")" != "$TS_CLOUD_CURRENT" ] && { echo "$r"; break; }; done)`,'[ -n "$TS_CLOUD_PREV" ] || { echo "no previous release to roll back to" >&2; exit 1; }',...qj(j,'"$TS_CLOUD_PREV"'),`ln -sfn "$TS_CLOUD_PREV" ${j.current}.tmp`,`mv -Tf ${j.current}.tmp ${j.current}`,'echo "rolled back to $TS_CLOUD_PREV"'];if(!Z.unitBase)return $;let z=Z.unitBase;return[...$,`TS_CLOUD_RB_ID=$(basename "$(readlink -f ${j.current})")`,`if [ -f /etc/systemd/system/${z}@.service ]; then systemctl start "${z}@\${TS_CLOUD_RB_ID}.service"; sleep 2; systemctl is-active --quiet "${z}@\${TS_CLOUD_RB_ID}.service" || { echo "rolled-back release failed to start" >&2; exit 1; }; systemctl enable "${z}@\${TS_CLOUD_RB_ID}.service" 2>/dev/null || true; systemctl list-units --plain --no-legend --type=service "${z}@*.service" 2>/dev/null | awk '{print $1}' | { grep -v "^${z}@\${TS_CLOUD_RB_ID}.service$" || true; } | while read -r TS_CLOUD_U; do systemctl stop "$TS_CLOUD_U" 2>/dev/null || true; systemctl disable "$TS_CLOUD_U" 2>/dev/null || true; done; elif [ -f /etc/systemd/system/${z}.service ]; then systemctl restart ${z}.service; fi`]}function CZ(j,Z=4){let $=Math.max(1,Z);return[`TS_CLOUD_CURRENT=$(readlink -f ${j.current} 2>/dev/null || true)`,`ls -1dt ${j.releases}/*/ 2>/dev/null | sed 's#/$##' | tail -n +${$+1} | while read -r TS_CLOUD_OLD; do`,' [ "$(readlink -f "$TS_CLOUD_OLD")" = "$TS_CLOUD_CURRENT" ] || rm -rf "$TS_CLOUD_OLD"',"done"]}function lj(j){return`${N(j)}/owner`}function OZ(j,Z){let $=lj(j);return[`if [ -f "${$}" ]; then`,` TS_CLOUD_OWNER=$(cat "${$}")`,` if [ "$TS_CLOUD_OWNER" != "${Z}" ]; then`,` echo "[ts-cloud] REFUSING deploy: ${j} belongs to project '$TS_CLOUD_OWNER', not '${Z}'. Another project on this box derives the same site key — give one of them a distinct site name/domain, or remove ${$} to transfer ownership." >&2`," exit 1"," fi","else",` mkdir -p "$(dirname "${$}")"`,` printf '%s\\n' "${Z}" > "${$}"`,"fi"]}function VZ(j,Z){let $=N(j),z=Tj(j,Z.releaseId),Q=Sj(j),W=Math.max(1,Z.keepLogs??20),q=Z.commit||"",H=Z.branch||"";return[`mkdir -p ${$}/deploys`,`exec > >(tee -a ${z}) 2>&1`,`echo "[ts-cloud] deploy ${Z.releaseId} commit=${q} branch=${H} starting $(date -u +%Y-%m-%dT%H:%M:%SZ)"`,"ts_cloud_record_deploy() {"," TS_CLOUD_RC=$?",' if [ "$TS_CLOUD_RC" -eq 0 ]; then TS_CLOUD_ST=success; else TS_CLOUD_ST=failed; fi',` printf '%s\\t%s\\t%s\\t%s\\trc=%s\\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "${Z.releaseId}" "${q}" "$TS_CLOUD_ST" "$TS_CLOUD_RC" >> ${Q}`,"}","trap ts_cloud_record_deploy EXIT",`ls -1t ${$}/deploys/*.log 2>/dev/null | tail -n +${W+1} | while read -r TS_CLOUD_OLDLOG; do rm -f "$TS_CLOUD_OLDLOG"; done`]}
6
- export{dj as gf,i as hf,Yj as if,f as jf,wj as kf,pj as lf,rj as mf,oj as nf,nj as of,y as pf,tj as qf,T as rf,m as sf,a as tf,Xj as uf,d as vf,$Z as wf,zZ as xf,WZ as yf,p as zf,QZ as Af,qZ as Bf,Kj as Cf,MZ as Df,Sj as Ef,xZ as Ff,GZ as Gf,HZ as Hf,YZ as If,FZ as Jf,wZ as Kf,BZ as Lf,DZ as Mf,LZ as Nf,NZ as Of,CZ as Pf,OZ as Qf,VZ as Rf};
@@ -1 +0,0 @@
1
- import{xd as a}from"./chunk-57y1zxbf.js";import"./chunk-4vrqm9h0.js";import"./chunk-3r4fb59r.js";import"./chunk-p66ptpmr.js";import"./chunk-axhnkn5g.js";import"./chunk-h5pa5men.js";import"./chunk-fy8j3y8p.js";import"./chunk-271gk1n2.js";import"./chunk-fpm59y25.js";import"./chunk-jpjamjey.js";import"./chunk-mh0kdzqp.js";export{a as resolveDashboardData};
@@ -1,60 +0,0 @@
1
- import{hd as c,id as f,jd as a,kd as r,ld as s}from"./chunk-ctd2vg9w.js";import{nd as p}from"./chunk-gavvf0pg.js";import{Uf as l}from"./chunk-h5pa5men.js";import{Zf as D}from"./chunk-j703btc5.js";import{$f as w}from"./chunk-fy8j3y8p.js";import{Vo as m}from"./chunk-mh0kdzqp.js";function n(G){let{bucketName:Q,domain:z,aliases:q,certificateArn:F,defaultRootObject:J="index.html",errorDocument:_="404.html",passthroughUrls:$=!1,singlePageApp:W=!1,dynamicApp:j=!1,computeOriginDomain:S,computeOriginPort:B=3008,computeOriginId:x="app-compute",retainOnStackDelete:C=!1}=G,M=C?{DeletionPolicy:"Retain",UpdateReplacePolicy:"Retain"}:{},y=j&&!!S,R=y?["GET","HEAD","OPTIONS","PUT","POST","PATCH","DELETE"]:["GET","HEAD"],N=y?["GET","HEAD"]:["GET","HEAD"],I={},h={};I.S3Bucket={Type:"AWS::S3::Bucket",...M,Properties:{BucketName:Q,PublicAccessBlockConfiguration:{BlockPublicAcls:!0,BlockPublicPolicy:!1,IgnorePublicAcls:!0,RestrictPublicBuckets:!1},WebsiteConfiguration:{IndexDocument:J,ErrorDocument:_}}},h.BucketName={Description:"S3 Bucket Name",Value:{Ref:"S3Bucket"}},h.BucketArn={Description:"S3 Bucket ARN",Value:{"Fn::GetAtt":["S3Bucket","Arn"]}},I.CloudFrontOAC={Type:"AWS::CloudFront::OriginAccessControl",...M,Properties:{OriginAccessControlConfig:{Name:`OAC-${Q}`,Description:`OAC for ${Q}`,OriginAccessControlOriginType:"s3",SigningBehavior:"always",SigningProtocol:"sigv4"}}};let E;if($&&y)E="InstallRootRedirectFunction",I[E]={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
- var request = event.request;
3
- if (request.uri === '/' || request.uri === '') {
4
- return {
5
- statusCode: 302,
6
- statusDescription: 'Found',
7
- headers: {
8
- location: { value: 'https://' + request.headers.host.value + '/install.sh' }
9
- }
10
- };
11
- }
12
- return request;
13
- }`}};if(!$)I.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) {
14
- const request = event.request;
15
- var uri = request.uri;
16
-
17
- // If URI ends with /, serve index.html
18
- if (uri.endsWith('/')) {
19
- request.uri = uri + 'index.html';
20
- }
21
- // If URI doesn't have an extension, append .html
22
- else if (!uri.includes('.')) {
23
- request.uri = uri + '.html';
24
- }
25
-
26
- return request;
27
- }`}};let O={Id:`S3-${Q}`,DomainName:{"Fn::GetAtt":["S3Bucket","RegionalDomainName"]},S3OriginConfig:{OriginAccessIdentity:""},OriginAccessControlId:{"Fn::GetAtt":["CloudFrontOAC","Id"]}},K=y?{Id:x,DomainName:S,CustomOriginConfig:{HTTPPort:B,HTTPSPort:443,OriginProtocolPolicy:"http-only",OriginSSLProtocols:["TLSv1.2"]}}:null,Z=y?x:`S3-${Q}`,U={Enabled:!0,DefaultRootObject:J,HttpVersion:"http2and3",IPV6Enabled:!0,PriceClass:"PriceClass_100",Origins:K?[K,O]:[O],DefaultCacheBehavior:{TargetOriginId:Z,ViewerProtocolPolicy:"redirect-to-https",AllowedMethods:R,CachedMethods:N,Compress:!0,...y?{CachePolicyId:"4135ea2d-6df8-44a3-9df3-4b5a84be39ad",OriginRequestPolicyId:"b689b0a8-53d0-40ab-baf2-68738e2966ac",...$&&E?{FunctionAssociations:[{EventType:"viewer-request",FunctionARN:{"Fn::GetAtt":[E,"FunctionARN"]}}]}:{}}:{CachePolicyId:"658327ea-f89d-4fab-a63d-7e88639e58f6",...!$&&{FunctionAssociations:[{EventType:"viewer-request",FunctionARN:{"Fn::GetAtt":["UrlRewriteFunction","FunctionARN"]}}]}}},...y&&$?{CacheBehaviors:[{PathPattern:"/install.sh",TargetOriginId:`S3-${Q}`,ViewerProtocolPolicy:"redirect-to-https",AllowedMethods:["GET","HEAD","OPTIONS"],CachedMethods:["GET","HEAD","OPTIONS"],Compress:!0,CachePolicyId:"658327ea-f89d-4fab-a63d-7e88639e58f6"}]}:{},CustomErrorResponses:W?[{ErrorCode:403,ResponseCode:200,ResponsePagePath:`/${J}`,ErrorCachingMinTTL:300},{ErrorCode:404,ResponseCode:200,ResponsePagePath:`/${J}`,ErrorCachingMinTTL:300}]:[{ErrorCode:403,ResponseCode:404,ResponsePagePath:`/${_}`,ErrorCachingMinTTL:300},{ErrorCode:404,ResponseCode:404,ResponsePagePath:`/${_}`,ErrorCachingMinTTL:300}]};if(z&&F)U.Aliases=q&&q.length>0?q:[z],U.ViewerCertificate={AcmCertificateArn:F,SslSupportMethod:"sni-only",MinimumProtocolVersion:"TLSv1.2_2021"};else U.ViewerCertificate={CloudFrontDefaultCertificate:!0};return I.CloudFrontDistribution={Type:"AWS::CloudFront::Distribution",...M,DependsOn:["S3Bucket","CloudFrontOAC",...$&&y&&E?[E]:[],...!$?["UrlRewriteFunction"]:[]],Properties:{DistributionConfig:U}},h.DistributionId={Description:"CloudFront Distribution ID",Value:{Ref:"CloudFrontDistribution"}},h.DistributionDomain={Description:"CloudFront Distribution Domain",Value:{"Fn::GetAtt":["CloudFrontDistribution","DomainName"]}},I.S3BucketPolicy={Type:"AWS::S3::BucketPolicy",...M,DependsOn:["S3Bucket","CloudFrontDistribution"],Properties:{Bucket:{Ref:"S3Bucket"},PolicyDocument:{Version:"2012-10-17",Statement:[{Sid:"AllowCloudFrontServicePrincipal",Effect:"Allow",Principal:{Service:"cloudfront.amazonaws.com"},Action:"s3:GetObject",Resource:{"Fn::Sub":"arn:aws:s3:::${S3Bucket}/*"},Condition:{StringEquals:{"AWS:SourceArn":{"Fn::Sub":"arn:aws:cloudfront::${AWS::AccountId}:distribution/${CloudFrontDistribution}"}}}}]}}},h.SiteUrl={Description:"Site URL",Value:z?`https://${z}`:{"Fn::Sub":"https://${CloudFrontDistribution.DomainName}"}},{AWSTemplateFormatVersion:"2010-09-09",Description:`Static site infrastructure for ${z||Q} (External DNS)`,Resources:I,Outputs:h}}async function d(G){let Q=G.region||"us-east-1",z="us-east-1",q=G.domain,F=G.bucket||q.replace(/\./g,"-"),J=G.stackName||`${G.siteName}-static-site`,_=new l("us-east-1"),$=new f("us-east-1"),W=null;if(!G.skipDnsVerification){W=s(G.dnsProvider),console.log(`Verifying DNS provider can manage ${q}...`);let X=await W.listRecords(q);if(!X.success){let Y=X.message||"unknown error — check API credentials and domain ownership";return{success:!1,stackName:J,bucket:F,message:`DNS provider '${W.name}' cannot manage domain ${q}: ${Y}`}}console.log(`DNS provider '${W.name}' verified for ${q}`)}else console.log(`Skipping DNS verification for ${q}`);let j=G.certificateArn,x=q.split(".").length===2?`www.${q}`:void 0;if(!j){console.log(`Checking for existing SSL certificate for ${q}...`);let X=await $.findCertificateByDomain(q),Y=!1;if(X&&X.Status==="ISSUED"){if(x&&X.SubjectAlternativeNames)Y=X.SubjectAlternativeNames.includes(x)||X.SubjectAlternativeNames.some((V)=>V===`*.${q}`);else Y=!0;if(Y)j=X.CertificateArn,console.log(`Found existing certificate with www coverage: ${j}`);else console.log(`Existing certificate doesn't cover ${x}, requesting new one...`)}if(!j){if(!W)return{success:!1,stackName:J,bucket:F,message:`No DNS provider available to validate SSL certificate for ${q}. Provide a certificateArn or enable DNS verification.`};console.log(`Requesting new SSL certificate for ${q}${x?` (including ${x})`:""}...`);let T=await new r(W,"us-east-1").findOrCreateCertificate({domainName:q,subjectAlternativeNames:x?[x]:void 0,waitForValidation:!0,maxWaitMinutes:10});if(T.status!=="issued")return{success:!1,stackName:J,bucket:F,message:`SSL certificate validation failed. Status: ${T.status}`};j=T.certificateArn,console.log(`Certificate issued: ${j}`)}}let C=!1,M;try{let X=await _.describeStacks({stackName:J});if(X.Stacks.length>0){let Y=X.Stacks[0],V=Y.StackStatus;if(V==="DELETE_IN_PROGRESS")console.log("Previous stack is still being deleted, waiting..."),await _.waitForStack(J,"stack-delete-complete"),C=!1;else if(V==="DELETE_COMPLETE")C=!1;else C=!0,M=(Y.Outputs||[]).find((H)=>H.OutputKey==="BucketName")?.OutputValue}}catch(X){if(X.message?.includes("does not exist")||X.code==="ValidationError")C=!1;else throw X}let y=M||F;if(!C){let X=new w(Q),Y=new p,V=!1;if(q)try{console.log(`Checking for existing CloudFront distributions with alias ${q}...`);let T=await Y.listDistributions();for(let H of T){let L=[];if(H.Aliases?.Items){if(Array.isArray(H.Aliases.Items))L=H.Aliases.Items;else if(typeof H.Aliases.Items==="object"){let v=H.Aliases.Items.CNAME;if(typeof v==="string")L=[v];else if(Array.isArray(v))L=v}}if(L.includes(q)){V=!0,console.log(`Found existing CloudFront distribution ${H.Id} with alias ${q}`),console.log("Reusing existing infrastructure for updates...");let A=(await Y.getDistributionConfig(H.Id)).DistributionConfig?.Origins?.Items,b;if(A){let P=[];if(Array.isArray(A))P=A;else if(A.Origin)P=Array.isArray(A.Origin)?A.Origin:[A.Origin];else P=[A];for(let g of P){let k=(g.DomainName||"").match(/^([^.]+)\.s3[\.-]/);if(k){b=k[1];break}}}if(b)return console.log(`Using existing S3 bucket: ${b}`),{success:!0,stackName:`existing-${H.Id}`,bucket:b,distributionId:H.Id,distributionDomain:H.DomainName,domain:q,certificateArn:j,message:"Using existing CloudFront distribution",_existingInfrastructure:!0}}}}catch{}if(!V)try{if((await X.headBucket(F)).exists){console.log(`Found orphaned S3 bucket ${F}, cleaning up...`);try{let H=X.emptyBucket(F).then(()=>X.deleteBucket(F)),L=new Promise((v,A)=>setTimeout(()=>A(Error("Bucket cleanup timeout")),30000));await Promise.race([H,L]),console.log(`Deleted orphaned S3 bucket ${F}`)}catch(H){console.log(`Note: Could not clean up S3 bucket: ${H.message}`);let L=Date.now().toString(36);y=`${F}-${L}`,console.log(`Using alternative bucket name: ${y}`)}}}catch{}}let N=n({bucketName:y,domain:q,aliases:x?[q,x]:[q],certificateArn:j,defaultRootObject:G.defaultRootObject,errorDocument:G.errorDocument,passthroughUrls:G.passthroughUrls,singlePageApp:G.singlePageApp,dynamicApp:G.dynamicApp,computeOriginDomain:G.computeOriginDomain,computeOriginPort:G.computeOriginPort,computeOriginId:G.computeOriginId}),I=Object.entries(G.tags||{}).map(([X,Y])=>({Key:X,Value:Y}));if(I.push({Key:"ManagedBy",Value:"ts-cloud"}),I.push({Key:"Application",Value:G.siteName}),W)I.push({Key:"DnsProvider",Value:W.name});let h,E=!1;if(C){E=!0,console.log(`Updating CloudFormation stack: ${J}`);try{h=(await _.updateStack({stackName:J,templateBody:JSON.stringify(N),capabilities:["CAPABILITY_IAM"],tags:I})).StackId,console.log(`Update initiated, stack ID: ${h}`)}catch(X){if(X.message?.includes("No updates are to be performed")){let Y=await _.describeStacks({stackName:J});h=Y.Stacks[0].StackId;let V=Y.Stacks[0]?.Outputs||[],T=(L)=>V.find((v)=>v.OutputKey===L)?.OutputValue,H=T("DistributionDomain");if(H)await u(W,q,H);return{success:!0,stackId:h,stackName:J,bucket:T("BucketName")||y,distributionId:T("DistributionId"),distributionDomain:H,domain:q,certificateArn:j,message:"Static site infrastructure is already up to date"}}else throw X}}else console.log(`Creating CloudFormation stack: ${J}`),console.log(`Bucket name: ${y}`),console.log(`Domain: ${q}`),console.log(`Certificate ARN: ${j}`),h=(await _.createStack({stackName:J,templateBody:JSON.stringify(N),capabilities:["CAPABILITY_IAM"],tags:I,onFailure:"DELETE"})).StackId,console.log(`Create initiated, stack ID: ${h}`);console.log(`Waiting for stack to reach ${E?"stack-update-complete":"stack-create-complete"}...`);try{await _.waitForStack(J,E?"stack-update-complete":"stack-create-complete"),console.log("Stack operation completed successfully!")}catch(X){if(X.message?.includes("must be verified")||X.message?.includes("Access denied for operation")){console.log("CloudFront account verification required - checking for existing infrastructure...");try{let V=new p,T=await V.listDistributions();for(let H of T){let L=[];if(H.Aliases?.Items){if(Array.isArray(H.Aliases.Items))L=H.Aliases.Items;else if(typeof H.Aliases.Items==="object"){let v=H.Aliases.Items.CNAME;if(typeof v==="string")L=[v];else if(Array.isArray(v))L=v}}if(L.includes(q)){console.log(`Found existing CloudFront distribution ${H.Id} with alias ${q}`),console.log("Using existing infrastructure despite account verification requirement...");let A=(await V.getDistributionConfig(H.Id)).DistributionConfig?.Origins?.Items,b;if(A){let P=[];if(Array.isArray(A))P=A;else if(A.Origin)P=Array.isArray(A.Origin)?A.Origin:[A.Origin];else P=[A];for(let g of P){let k=(g.DomainName||"").match(/^([^.]+)\.s3[\.-]/);if(k){b=k[1];break}}}if(b){console.log(`Using existing S3 bucket: ${b}`);let P=H.DomainName;if(P)await u(W,q,P);return{success:!0,stackName:`existing-${H.Id}`,bucket:b,distributionId:H.Id,distributionDomain:H.DomainName,domain:q,certificateArn:j,message:"Using existing CloudFront distribution (account verification pending for new distributions)"}}}}}catch{}return console.log(`
28
- ┌─────────────────────────────────────────────────────────────────────────────┐
29
- │ AWS ACCOUNT VERIFICATION REQUIRED │
30
- ├─────────────────────────────────────────────────────────────────────────────┤
31
- │ Your AWS account must be verified before you can create CloudFront │
32
- │ distributions. This is a one-time requirement for new AWS accounts. │
33
- │ │
34
- │ To verify your account: │
35
- │ │
36
- │ 1. Go to: https://console.aws.amazon.com/support/home#/ │
37
- │ 2. Click "Create case" │
38
- │ 3. Select "Service limit increase" │
39
- │ 4. For Service: Select "CloudFront" │
40
- │ 5. For Request: "Please verify my account for CloudFront access" │
41
- │ 6. Submit the case │
42
- │ │
43
- │ Verification typically takes 1-2 business days. │
44
- │ After verification, re-run: bunx bunpress deploy │
45
- └─────────────────────────────────────────────────────────────────────────────┘`),{success:!1,stackId:h,stackName:J,bucket:y,message:"CloudFront account verification required. Please contact AWS Support."}}return{success:!1,stackId:h,stackName:J,bucket:y,message:`Stack deployment failed: ${X.message}`}}let K=(await _.describeStacks({stackName:J})).Stacks[0]?.Outputs||[],Z=(X)=>K.find((Y)=>Y.OutputKey===X)?.OutputValue,U=Z("DistributionDomain");if(U&&W)console.log(`Creating DNS records via ${W.name}...`),await u(W,q,U);else if(U&&!W)console.log("Skipping DNS record creation (DNS verification was skipped)");return{success:!0,stackId:h,stackName:J,bucket:Z("BucketName")||y,distributionId:Z("DistributionId"),distributionDomain:U,domain:q,certificateArn:j,message:"Static site infrastructure deployed successfully with external DNS"}}async function u(G,Q,z){if(!G){console.log("Skipping DNS record creation (DNS verification was skipped)");return}if(Q.split(".").length===2)if(G instanceof c){console.log(`Creating Route53 alias record for apex domain ${Q} -> ${z}`);let J=await G.createCloudFrontAlias({domain:Q,name:Q,cloudFrontDomainName:z});if(!J.success)console.warn(`Warning: Could not create Route53 alias record: ${J.message}`),console.warn("Please manually create an A-record alias in Route53:"),console.warn(` ${Q} -> ${z}`);else console.log(`Created Route53 alias record: ${Q} -> ${z}`);let _=`www.${Q}`;console.log(`Creating Route53 alias record for ${_} -> ${z}`);let $=await G.createCloudFrontAlias({domain:Q,name:_,cloudFrontDomainName:z});if(!$.success)console.warn(`Warning: Could not create www Route53 alias: ${$.message}`),console.warn("Please manually create an A-record alias in Route53:"),console.warn(` ${_} -> ${z}`);else console.log(`Created Route53 alias record: ${_} -> ${z}`)}else{try{let W=await G.listRecords(Q,"A");if(W.success)for(let j of W.records){let S=j.name.replace(/\.$/,"");if(S===Q||S==="")console.log(`Removing existing root A record (${j.content}) to make room for ALIAS...`),await G.deleteRecord(Q,{name:Q,type:"A",content:j.content})}}catch(W){console.log(`Note: Could not check for conflicting A records: ${W instanceof Error?W.message:W}`)}console.log(`Creating ALIAS record for apex domain ${Q} -> ${z}`);let J=await G.upsertRecord(Q,{name:Q,type:"ALIAS",content:z,ttl:600});if(!J.success)console.warn(`Warning: Could not create ALIAS record: ${J.message}`),console.warn("Please manually create an ALIAS record in your DNS provider:"),console.warn(` ${Q} -> ${z}`);else console.log(`Created ALIAS record: ${Q} -> ${z}`);let _=`www.${Q}`;console.log(`Creating CNAME record for ${_} -> ${z}`);let $=await G.upsertRecord(Q,{name:_,type:"CNAME",content:z,ttl:600});if(!$.success)console.warn(`Warning: Could not create www DNS record: ${$.message}`),console.warn("Please manually create a CNAME record:"),console.warn(` ${_} -> ${z}`);else console.log(`Created CNAME record: ${_} -> ${z}`)}else{console.log(`Creating CNAME record for ${Q} -> ${z}`);let J=await G.upsertRecord(Q,{name:Q,type:"CNAME",content:z,ttl:600});if(!J.success)console.warn(`Warning: Could not create DNS record: ${J.message}`),console.warn("Please manually create a CNAME record:"),console.warn(` ${Q} -> ${z}`);else console.log(`Created CNAME record: ${Q} -> ${z}`)}}async function Hq(G){let{sourceDir:Q,cleanBucket:z=!1,onProgress:q,...F}=G;q?.("infrastructure","Deploying CloudFormation stack...");let J=await d(F);if(!J.success)return J;if(z){q?.("clean","Cleaning old files from S3...");try{await new w(F.region||"us-east-1").emptyBucket(J.bucket)}catch(j){console.log(`Note: Could not clean bucket: ${j.message}`)}}q?.("upload","Uploading files to S3...");let{uploadStaticFiles:_}=await import("./chunk-ngcyftm2.js"),$=await _({sourceDir:Q,bucket:J.bucket,region:F.region||"us-east-1",cacheControl:F.cacheControl,onProgress:(j,S,B)=>{q?.("upload",`${j}/${S}: ${B}`)}});if($.errors.length>0)return{...J,success:!1,message:`Upload errors: ${$.errors.join(", ")}`,filesUploaded:$.uploaded};if(J.distributionId&&$.uploaded>0){q?.("invalidate","Invalidating CloudFront cache...");let{invalidateCache:j}=await import("./chunk-ngcyftm2.js");await j(J.distributionId)}q?.("complete","Deployment complete!");let W=$.skipped>0?`Deployed ${$.uploaded} files (${$.skipped} unchanged) with external DNS`:`Deployed ${$.uploaded} files successfully with external DNS`;return{...J,filesUploaded:$.uploaded,filesSkipped:$.skipped,message:W}}function t(G){let{bucketName:Q,domain:z,certificateArn:q,hostedZoneId:F,defaultRootObject:J="index.html",errorDocument:_="404.html"}=G,$={},W={};$.S3Bucket={Type:"AWS::S3::Bucket",Properties:{BucketName:Q,PublicAccessBlockConfiguration:{BlockPublicAcls:!0,BlockPublicPolicy:!1,IgnorePublicAcls:!0,RestrictPublicBuckets:!1},WebsiteConfiguration:{IndexDocument:J,ErrorDocument:_}}},W.BucketName={Description:"S3 Bucket Name",Value:{Ref:"S3Bucket"}},W.BucketArn={Description:"S3 Bucket ARN",Value:{"Fn::GetAtt":["S3Bucket","Arn"]}},$.CloudFrontOAC={Type:"AWS::CloudFront::OriginAccessControl",Properties:{OriginAccessControlConfig:{Name:`OAC-${Q}`,Description:`OAC for ${Q}`,OriginAccessControlOriginType:"s3",SigningBehavior:"always",SigningProtocol:"sigv4"}}},$.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
- const request = event.request;
47
- var uri = request.uri;
48
-
49
- // If URI ends with /, serve index.html
50
- if (uri.endsWith('/')) {
51
- request.uri = uri + 'index.html';
52
- }
53
- // If URI doesn't have an extension, append .html
54
- else if (!uri.includes('.')) {
55
- request.uri = uri + '.html';
56
- }
57
-
58
- return request;
59
- }`}};let j={Enabled:!0,DefaultRootObject:J,HttpVersion:"http2and3",IPV6Enabled:!0,PriceClass:"PriceClass_100",Origins:[{Id:`S3-${Q}`,DomainName:{"Fn::GetAtt":["S3Bucket","RegionalDomainName"]},S3OriginConfig:{OriginAccessIdentity:""},OriginAccessControlId:{"Fn::GetAtt":["CloudFrontOAC","Id"]}}],DefaultCacheBehavior:{TargetOriginId:`S3-${Q}`,ViewerProtocolPolicy:"redirect-to-https",AllowedMethods:["GET","HEAD"],CachedMethods:["GET","HEAD"],Compress:!0,CachePolicyId:"658327ea-f89d-4fab-a63d-7e88639e58f6",FunctionAssociations:[{EventType:"viewer-request",FunctionARN:{"Fn::GetAtt":["UrlRewriteFunction","FunctionARN"]}}]},CustomErrorResponses:[{ErrorCode:403,ResponseCode:200,ResponsePagePath:`/${J}`,ErrorCachingMinTTL:300},{ErrorCode:404,ResponseCode:404,ResponsePagePath:`/${_}`,ErrorCachingMinTTL:300}]};if(z&&q)j.Aliases=[z],j.ViewerCertificate={AcmCertificateArn:q,SslSupportMethod:"sni-only",MinimumProtocolVersion:"TLSv1.2_2021"};else j.ViewerCertificate={CloudFrontDefaultCertificate:!0};if($.CloudFrontDistribution={Type:"AWS::CloudFront::Distribution",DependsOn:["S3Bucket","CloudFrontOAC","UrlRewriteFunction"],Properties:{DistributionConfig:j}},W.DistributionId={Description:"CloudFront Distribution ID",Value:{Ref:"CloudFrontDistribution"}},W.DistributionDomain={Description:"CloudFront Distribution Domain",Value:{"Fn::GetAtt":["CloudFrontDistribution","DomainName"]}},$.S3BucketPolicy={Type:"AWS::S3::BucketPolicy",DependsOn:["S3Bucket","CloudFrontDistribution"],Properties:{Bucket:{Ref:"S3Bucket"},PolicyDocument:{Version:"2012-10-17",Statement:[{Sid:"AllowCloudFrontServicePrincipal",Effect:"Allow",Principal:{Service:"cloudfront.amazonaws.com"},Action:"s3:GetObject",Resource:{"Fn::Sub":"arn:aws:s3:::${S3Bucket}/*"},Condition:{StringEquals:{"AWS:SourceArn":{"Fn::Sub":"arn:aws:cloudfront::${AWS::AccountId}:distribution/${CloudFrontDistribution}"}}}}]}}},z&&F)$.DNSRecord={Type:"AWS::Route53::RecordSet",DependsOn:"CloudFrontDistribution",Properties:{HostedZoneId:F,Name:z,Type:"A",AliasTarget:{DNSName:{"Fn::GetAtt":["CloudFrontDistribution","DomainName"]},HostedZoneId:"Z2FDTNDATAQYW2",EvaluateTargetHealth:!1}}},$.DNSRecordIPv6={Type:"AWS::Route53::RecordSet",DependsOn:"CloudFrontDistribution",Properties:{HostedZoneId:F,Name:z,Type:"AAAA",AliasTarget:{DNSName:{"Fn::GetAtt":["CloudFrontDistribution","DomainName"]},HostedZoneId:"Z2FDTNDATAQYW2",EvaluateTargetHealth:!1}}},W.SiteUrl={Description:"Site URL",Value:{"Fn::Sub":"https://${DNSRecord}"}};return{AWSTemplateFormatVersion:"2010-09-09",Description:`Static site infrastructure for ${z||Q}`,Resources:$,Outputs:W}}async function o(G){if(G.dnsProvider&&G.dnsProvider.provider!=="route53"){let K=G.domain||(G.subdomain&&G.baseDomain?`${G.subdomain}.${G.baseDomain}`:void 0);if(!K)return{success:!1,stackName:G.stackName||`${G.siteName}-static-site`,bucket:G.bucket||`${G.siteName}-${Date.now()}`,message:"Domain is required when using external DNS provider"};return d({siteName:G.siteName,region:G.region,domain:K,bucket:G.bucket,certificateArn:G.certificateArn,stackName:G.stackName,defaultRootObject:G.defaultRootObject,errorDocument:G.errorDocument,cacheControl:G.cacheControl,tags:G.tags,dnsProvider:G.dnsProvider})}let Q=G.region||"us-east-1",z="us-east-1",q;if(G.domain)q=G.domain;else if(G.subdomain&&G.baseDomain)q=`${G.subdomain}.${G.baseDomain}`;let F=G.bucket||(q?q.replace(/\./g,"-"):`${G.siteName}-${Date.now()}`),J=G.stackName||`${G.siteName}-static-site`,_=new l(z),$=new D,W=new f("us-east-1"),j=new a("us-east-1"),S=G.hostedZoneId,B=G.certificateArn;if(q&&!S){let K=await $.findHostedZoneForDomain(q);if(K)S=K.Id.replace("/hostedzone/","");else return{success:!1,stackName:J,bucket:F,message:`No Route53 hosted zone found for ${G.baseDomain||q}. Please create one first.`}}if(q&&!B&&S){let K=await W.findCertificateByDomain(q);if(K&&K.Status==="ISSUED")B=K.CertificateArn;else B=(await j.requestAndValidate({domainName:q,hostedZoneId:S,waitForValidation:!0,maxWaitMinutes:10})).certificateArn}let x=!1,C;try{let K=await _.describeStacks({stackName:J});if(K.Stacks.length>0){let Z=K.Stacks[0],U=Z.StackStatus;if(U==="DELETE_IN_PROGRESS")console.log("Previous stack is still being deleted, waiting..."),await _.waitForStack(J,"stack-delete-complete"),x=!1;else if(U==="DELETE_COMPLETE")x=!1;else x=!0,C=(Z.Outputs||[]).find((Y)=>Y.OutputKey==="BucketName")?.OutputValue}}catch(K){if(K.message?.includes("does not exist")||K.code==="ValidationError")x=!1;else throw K}let M=C||F;if(!x){let K=new w(Q),Z=new p,U=!1;if(q){try{console.log(`Checking for existing CloudFront distribution for ${q}...`);let X=await Z.listDistributions();for(let Y of X){let V=[];if(Y.Aliases?.Items){if(Array.isArray(Y.Aliases.Items))V=Y.Aliases.Items;else if(typeof Y.Aliases.Items==="object"){let T=Y.Aliases.Items.CNAME;if(typeof T==="string")V=[T];else if(Array.isArray(T))V=T}}if(V.includes(q)){U=!0,console.log(`Found existing CloudFront distribution ${Y.Id} for ${q}`);let H=(await Z.getDistributionConfig(Y.Id)).DistributionConfig?.Origins?.Items,L;if(H){let v=[];if(Array.isArray(H))v=H;else if(H.Origin)v=Array.isArray(H.Origin)?H.Origin:[H.Origin];else v=[H];for(let A of v){let P=(A.DomainName||"").match(/^([^.]+)\.s3[\.-]/);if(P){L=P[1];break}}}if(L){let v=q.replace(/\./g,"-");if(!L.startsWith(v)&&!L.includes(G.siteName)){console.log(`Warning: Found distribution with mismatched bucket ${L}, skipping...`);continue}if(console.log(`Using existing S3 bucket: ${L}`),S&&Y.DomainName)try{console.log(`Ensuring Route53 records exist for ${q}...`),await $.createAliasRecord({HostedZoneId:S,Name:q,Type:"A",TargetHostedZoneId:D.CloudFrontHostedZoneId,TargetDNSName:Y.DomainName,EvaluateTargetHealth:!1}),await $.createAliasRecord({HostedZoneId:S,Name:q,Type:"AAAA",TargetHostedZoneId:D.CloudFrontHostedZoneId,TargetDNSName:Y.DomainName,EvaluateTargetHealth:!1}),console.log(`Route53 records ensured for ${q}`)}catch(A){console.log(`Note: Could not update Route53 records: ${A.message}`)}return{success:!0,stackName:`existing-${Y.Id}`,bucket:L,distributionId:Y.Id,distributionDomain:Y.DomainName,domain:q,certificateArn:B,message:"Using existing CloudFront distribution"}}}}}catch{}if(S)try{let Y=(await $.listResourceRecordSets({HostedZoneId:S})).ResourceRecordSets||[];for(let V of Y)if(V.Name===`${q}.`&&(V.Type==="A"||V.Type==="AAAA")){if(V.AliasTarget){console.log(`Found orphaned Route53 ${V.Type} record for ${q}, cleaning up...`);try{await $.deleteRecord({HostedZoneId:S,RecordSet:V}),console.log(`Deleted orphaned Route53 ${V.Type} record for ${q}`)}catch(T){console.log(`Note: Could not delete Route53 record: ${T.message}`)}}}}catch{}}if(!U)try{if((await K.headBucket(F)).exists){console.log(`Found orphaned S3 bucket ${F}, cleaning up...`);try{let Y=K.emptyBucket(F).then(()=>K.deleteBucket(F)),V=new Promise((T,H)=>setTimeout(()=>H(Error("Bucket cleanup timeout")),30000));await Promise.race([Y,V]),console.log(`Deleted orphaned S3 bucket ${F}`)}catch(Y){console.log(`Note: Could not clean up S3 bucket: ${Y.message}`);let V=Date.now().toString(36);M=`${F}-${V}`,console.log(`Using alternative bucket name: ${M}`)}}}catch{}}let y=t({bucketName:M,domain:q,certificateArn:B,hostedZoneId:S,defaultRootObject:G.defaultRootObject,errorDocument:G.errorDocument}),R=Object.entries(G.tags||{}).map(([K,Z])=>({Key:K,Value:Z}));R.push({Key:"ManagedBy",Value:"ts-cloud"}),R.push({Key:"Application",Value:G.siteName});let N,I=!1;if(x){I=!0,console.log(`Updating CloudFormation stack: ${J}`),console.log(`Using existing bucket: ${M}`),console.log(`Domain: ${q||"not specified"}`),console.log(`Certificate ARN: ${B||"not specified"}`);try{N=(await _.updateStack({stackName:J,templateBody:JSON.stringify(y),capabilities:["CAPABILITY_IAM"],tags:R})).StackId,console.log(`Update initiated, stack ID: ${N}`)}catch(K){if(K.message?.includes("No updates are to be performed")){let Z=await _.describeStacks({stackName:J});N=Z.Stacks[0].StackId;let U=Z.Stacks[0]?.Outputs||[],X=(Y)=>U.find((V)=>V.OutputKey===Y)?.OutputValue;return{success:!0,stackId:N,stackName:J,bucket:X("BucketName")||M,distributionId:X("DistributionId"),distributionDomain:X("DistributionDomain"),domain:q,certificateArn:B,message:"Static site infrastructure is already up to date"}}else throw K}}else console.log(`Creating CloudFormation stack: ${J}`),console.log(`Bucket name: ${M}`),console.log(`Domain: ${q||"not specified"}`),console.log(`Certificate ARN: ${B||"not specified"}`),console.log("Stack does not exist, creating..."),N=(await _.createStack({stackName:J,templateBody:JSON.stringify(y),capabilities:["CAPABILITY_IAM"],tags:R,onFailure:"DELETE"})).StackId,console.log(`Create initiated, stack ID: ${N}`);console.log(`Waiting for stack to reach ${I?"stack-update-complete":"stack-create-complete"}...`);try{await _.waitForStack(J,I?"stack-update-complete":"stack-create-complete"),console.log("Stack operation completed successfully!")}catch(K){if(K.message?.includes("must be verified")||K.message?.includes("Access denied for operation")||K.message?.includes("failed")){console.log("CloudFormation deployment failed, trying direct API creation...");let Z=new p;if(q)try{let U=await Z.listDistributions();for(let X of U){let Y=[];if(X.Aliases?.Items){if(Array.isArray(X.Aliases.Items))Y=X.Aliases.Items;else if(typeof X.Aliases.Items==="object"){let V=X.Aliases.Items.CNAME;if(typeof V==="string")Y=[V];else if(Array.isArray(V))Y=V}}if(Y.includes(q)){console.log(`Found existing CloudFront distribution ${X.Id} with alias ${q}`);let T=(await Z.getDistributionConfig(X.Id)).DistributionConfig?.Origins?.Items,H;if(T){let L=[];if(Array.isArray(T))L=T;else if(T.Origin)L=Array.isArray(T.Origin)?T.Origin:[T.Origin];else L=[T];for(let v of L){let b=(v.DomainName||"").match(/^([^.]+)\.s3[\.-]/);if(b){H=b[1];break}}}if(H)return console.log(`Using existing S3 bucket: ${H}`),{success:!0,stackName:`existing-${X.Id}`,bucket:H,distributionId:X.Id,distributionDomain:X.DomainName,domain:q,certificateArn:B,message:"Using existing CloudFront distribution (account verification pending for new distributions)"}}}}catch{}console.log("No existing infrastructure found, creating via direct API calls...");try{let U=new w(Q);if((await U.headBucket(M)).exists)console.log(`Using existing S3 bucket: ${M}`);else console.log(`Creating S3 bucket: ${M}...`),await U.createBucket(M);await U.putBucketWebsite(M,{IndexDocument:G.defaultRootObject||"index.html",ErrorDocument:G.errorDocument||"404.html"}),await U.putPublicAccessBlock(M,{BlockPublicAcls:!0,IgnorePublicAcls:!0,BlockPublicPolicy:!1,RestrictPublicBuckets:!1}),console.log(`S3 bucket ${M} configured`);let Y=`OAC-${M}`;console.log(`Creating Origin Access Control: ${Y}...`);let V=await Z.findOrCreateOriginAccessControl(Y);console.log(`Origin Access Control ${V.Id} ready`),console.log("Creating CloudFront distribution...");let T=await Z.createDistributionForS3({bucketName:M,bucketRegion:Q,originAccessControlId:V.Id,aliases:q?[q]:[],certificateArn:B,defaultRootObject:G.defaultRootObject||"index.html",comment:`Distribution for ${q||M}`});console.log(`CloudFront distribution ${T.Id} created`),console.log("Updating S3 bucket policy...");let H=p.getS3BucketPolicyForCloudFront(M,T.ARN);if(await U.putBucketPolicy(M,H),console.log("S3 bucket policy updated"),q&&S){console.log(`Creating Route53 records for ${q}...`);try{await $.createAliasRecord({HostedZoneId:S,Name:q,Type:"A",TargetHostedZoneId:D.CloudFrontHostedZoneId,TargetDNSName:T.DomainName,EvaluateTargetHealth:!1}),await $.createAliasRecord({HostedZoneId:S,Name:q,Type:"AAAA",TargetHostedZoneId:D.CloudFrontHostedZoneId,TargetDNSName:T.DomainName,EvaluateTargetHealth:!1}),console.log(`Route53 records created for ${q}`)}catch(L){console.log(`Note: Could not create Route53 records: ${L.message}`)}}return{success:!0,stackName:`direct-${T.Id}`,bucket:M,distributionId:T.Id,distributionDomain:T.DomainName,domain:q,certificateArn:B,message:"Static site infrastructure created via direct API calls"}}catch(U){return console.log(`Direct API creation failed: ${U.message}`),{success:!1,stackId:N,stackName:J,bucket:M,message:`Deployment failed: ${U.message}`}}}return{success:!1,stackId:N,stackName:J,bucket:M,message:`Stack deployment failed: ${K.message}`}}let E=(await _.describeStacks({stackName:J})).Stacks[0]?.Outputs||[],O=(K)=>E.find((Z)=>Z.OutputKey===K)?.OutputValue;return{success:!0,stackId:N,stackName:J,bucket:O("BucketName")||M,distributionId:O("DistributionId"),distributionDomain:O("DistributionDomain"),domain:q,certificateArn:B,message:"Static site infrastructure deployed successfully"}}async function i(G){let{sourceDir:Q,bucket:z,region:q,cacheControl:F="max-age=31536000, public",onProgress:J}=G,_=new w(q),{readdir:$}=await import("node:fs/promises"),{join:W,relative:j}=await import("node:path"),{createHash:S}=await import("node:crypto");async function B(E){let O=[],K=await $(E,{withFileTypes:!0});for(let Z of K){let U=W(E,Z.name);if(Z.isDirectory())O.push(...await B(U));else O.push(U)}return O}function x(E){let O=E.split(".").pop()?.toLowerCase();return{html:"text/html; charset=utf-8",css:"text/css; charset=utf-8",js:"application/javascript; charset=utf-8",json:"application/json; charset=utf-8",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",svg:"image/svg+xml",ico:"image/x-icon",webp:"image/webp",woff:"font/woff",woff2:"font/woff2",ttf:"font/ttf",xml:"application/xml",txt:"text/plain; charset=utf-8",sh:"text/plain; charset=utf-8",bash:"text/plain; charset=utf-8",ps1:"text/plain; charset=utf-8"}[O||""]||"application/octet-stream"}function C(E){return S("md5").update(E).digest("hex")}async function M(){let E=new Map,O;do{let K=await _.listObjects({bucket:z,maxKeys:1000,continuationToken:O});for(let Z of K.objects){let U=Z.ETag?.replace(/"/g,"")||"";E.set(Z.Key,U)}O=K.nextContinuationToken}while(O);return E}let y=await B(Q),R=[],N=0,I=0,h=await M();for(let E of y){let O=j(Q,E),K=x(E),Z=E.endsWith(".html")?"max-age=3600, public":F;try{let U=Buffer.from(await Bun.file(E).arrayBuffer()),X=C(U),Y=h.get(O);if(Y&&Y===X){I++,J?.(N+I,y.length,O);continue}await _.putObject({bucket:z,key:O,body:U,contentType:K,cacheControl:Z}),N++,J?.(N+I,y.length,O)}catch(U){R.push(`Failed to upload ${O}: ${U.message}`)}}return{uploaded:N,skipped:I,errors:R}}async function qq(G){return{invalidationId:(await new p().invalidateAll(G)).Id}}async function jq(G,Q="us-east-1"){let z=new l(Q);try{let _=((await z.describeStacks({stackName:G})).Stacks[0]?.Outputs||[]).find(($)=>$.OutputKey==="BucketName")?.OutputValue;if(_)await new w(Q).emptyBucket(_)}catch{}await z.deleteStack(G);let q=await z.waitForStackComplete(G,60,1e4);return{success:q.success||q.status==="DELETE_COMPLETE",message:q.success?"Static site deleted successfully":`Deletion failed: ${q.status}`}}async function Mq(G){let{sourceDir:Q,cleanBucket:z=!1,onProgress:q,...F}=G;q?.("infrastructure","Deploying CloudFormation stack...");let J=await o(F);if(!J.success)return J;if(z){q?.("clean","Cleaning old files from S3...");try{await new w(F.region||"us-east-1").emptyBucket(J.bucket)}catch(W){console.log(`Note: Could not clean bucket: ${W.message}`)}}q?.("upload","Uploading files to S3...");let _=await i({sourceDir:Q,bucket:J.bucket,region:F.region||"us-east-1",cacheControl:F.cacheControl,onProgress:(W,j,S)=>{q?.("upload",`${W}/${j}: ${S}`)}});if(_.errors.length>0)return{...J,success:!1,message:`Upload errors: ${_.errors.join(", ")}`,filesUploaded:_.uploaded};if(J.distributionId&&_.uploaded>0)q?.("invalidate","Invalidating CloudFront cache..."),await qq(J.distributionId);q?.("complete","Deployment complete!");let $=_.skipped>0?`Deployed ${_.uploaded} files (${_.skipped} unchanged)`:`Deployed ${_.uploaded} files successfully`;return{...J,filesUploaded:_.uploaded,filesSkipped:_.skipped,message:$}}
60
- export{t as p,o as q,i as r,qq as s,jq as t,Mq as u,Hq as v};