@sst-community/sst 4.21.1 → 5.0.0-alpha.2

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 (832) hide show
  1. package/README.md +86 -52
  2. package/package.json +35 -11
  3. package/platform/js/chunks/chunk-HIZZCEDS.js +328 -0
  4. package/platform/js/chunks/chunk-HIZZCEDS.js.map +6 -0
  5. package/platform/js/chunks/chunk-KOKHGKJ2.js +639 -0
  6. package/platform/js/chunks/chunk-KOKHGKJ2.js.map +6 -0
  7. package/platform/js/chunks/chunk-MR4XM5XA.js +473 -0
  8. package/platform/js/chunks/chunk-MR4XM5XA.js.map +6 -0
  9. package/platform/js/chunks/chunk-ONNI4XNK.js +367 -0
  10. package/platform/js/chunks/chunk-ONNI4XNK.js.map +6 -0
  11. package/platform/js/chunks/chunk-VIFHC73J.js +108 -0
  12. package/platform/js/chunks/chunk-VIFHC73J.js.map +6 -0
  13. package/platform/js/chunks/chunk-WJ6BVA46.js +10 -0
  14. package/platform/js/chunks/chunk-WJ6BVA46.js.map +6 -0
  15. package/platform/js/chunks/component-32FCLIRK.js +26 -0
  16. package/platform/js/chunks/component-32FCLIRK.js.map +6 -0
  17. package/platform/js/chunks/config-CRGKEDQW.js +10 -0
  18. package/platform/js/chunks/config-CRGKEDQW.js.map +6 -0
  19. package/platform/js/chunks/link-OJ3RNGQ3.js +9 -0
  20. package/platform/js/chunks/link-OJ3RNGQ3.js.map +6 -0
  21. package/platform/js/components/aws/index.js +35399 -0
  22. package/platform/js/components/aws/index.js.map +6 -0
  23. package/platform/js/components/cloudflare/index.js +3246 -0
  24. package/platform/js/components/cloudflare/index.js.map +6 -0
  25. package/platform/js/components/core.js +114 -0
  26. package/platform/js/components/core.js.map +6 -0
  27. package/platform/js/components/vercel/index.js +120 -0
  28. package/platform/js/components/vercel/index.js.map +6 -0
  29. package/platform/js/testing/index.js +569 -0
  30. package/platform/js/testing/index.js.map +6 -0
  31. package/platform/package.json +25 -0
  32. package/platform/src/ast/add.mjs +190 -0
  33. package/platform/src/auto/run.ts +109 -0
  34. package/platform/src/components/README.md +652 -0
  35. package/platform/src/components/args.ts +133 -0
  36. package/platform/src/components/aws/alb.ts +577 -0
  37. package/platform/src/components/aws/analog.ts +462 -0
  38. package/platform/src/components/aws/apigateway-websocket-route.ts +206 -0
  39. package/platform/src/components/aws/apigateway-websocket.ts +894 -0
  40. package/platform/src/components/aws/apigatewayv1-api-key.ts +90 -0
  41. package/platform/src/components/aws/apigatewayv1-authorizer.ts +178 -0
  42. package/platform/src/components/aws/apigatewayv1-base-route.ts +78 -0
  43. package/platform/src/components/aws/apigatewayv1-integration-route.ts +92 -0
  44. package/platform/src/components/aws/apigatewayv1-lambda-route.ts +152 -0
  45. package/platform/src/components/aws/apigatewayv1-usage-plan.ts +109 -0
  46. package/platform/src/components/aws/apigatewayv1.ts +1691 -0
  47. package/platform/src/components/aws/apigatewayv2-authorizer.ts +199 -0
  48. package/platform/src/components/aws/apigatewayv2-base-route.ts +69 -0
  49. package/platform/src/components/aws/apigatewayv2-lambda-route.ts +141 -0
  50. package/platform/src/components/aws/apigatewayv2-private-route.ts +101 -0
  51. package/platform/src/components/aws/apigatewayv2-url-route.ts +90 -0
  52. package/platform/src/components/aws/apigatewayv2.ts +1439 -0
  53. package/platform/src/components/aws/app-sync-data-source.ts +264 -0
  54. package/platform/src/components/aws/app-sync-function.ts +79 -0
  55. package/platform/src/components/aws/app-sync-resolver.ts +110 -0
  56. package/platform/src/components/aws/app-sync.ts +849 -0
  57. package/platform/src/components/aws/astro.ts +580 -0
  58. package/platform/src/components/aws/aurora.ts +1356 -0
  59. package/platform/src/components/aws/auth-v1.ts +69 -0
  60. package/platform/src/components/aws/auth.ts +417 -0
  61. package/platform/src/components/aws/bucket-lambda-subscriber.ts +162 -0
  62. package/platform/src/components/aws/bucket-notification.ts +254 -0
  63. package/platform/src/components/aws/bucket-queue-subscriber.ts +122 -0
  64. package/platform/src/components/aws/bucket-topic-subscriber.ts +144 -0
  65. package/platform/src/components/aws/bucket.ts +2046 -0
  66. package/platform/src/components/aws/bus-base-subscriber.ts +52 -0
  67. package/platform/src/components/aws/bus-lambda-subscriber.ts +125 -0
  68. package/platform/src/components/aws/bus-queue-subscriber.ts +88 -0
  69. package/platform/src/components/aws/bus.ts +630 -0
  70. package/platform/src/components/aws/cdn.ts +561 -0
  71. package/platform/src/components/aws/cluster-v1.ts +932 -0
  72. package/platform/src/components/aws/cluster.ts +584 -0
  73. package/platform/src/components/aws/cognito-identity-pool.ts +433 -0
  74. package/platform/src/components/aws/cognito-identity-provider.ts +96 -0
  75. package/platform/src/components/aws/cognito-user-pool-client.ts +114 -0
  76. package/platform/src/components/aws/cognito-user-pool.ts +1089 -0
  77. package/platform/src/components/aws/cron-v2.ts +555 -0
  78. package/platform/src/components/aws/cron.ts +435 -0
  79. package/platform/src/components/aws/dns-validated-certificate.ts +108 -0
  80. package/platform/src/components/aws/dns.ts +221 -0
  81. package/platform/src/components/aws/dsql.ts +741 -0
  82. package/platform/src/components/aws/dynamo-lambda-subscriber.ts +124 -0
  83. package/platform/src/components/aws/dynamo.ts +929 -0
  84. package/platform/src/components/aws/efs.ts +410 -0
  85. package/platform/src/components/aws/email.ts +673 -0
  86. package/platform/src/components/aws/fargate.ts +1279 -0
  87. package/platform/src/components/aws/function.ts +3280 -0
  88. package/platform/src/components/aws/helpers/apigateway-account.ts +78 -0
  89. package/platform/src/components/aws/helpers/apigatewayv2-domain.ts +144 -0
  90. package/platform/src/components/aws/helpers/arn.ts +182 -0
  91. package/platform/src/components/aws/helpers/bootstrap.ts +16 -0
  92. package/platform/src/components/aws/helpers/client.ts +76 -0
  93. package/platform/src/components/aws/helpers/container-builder.ts +33 -0
  94. package/platform/src/components/aws/helpers/custom-domain.ts +128 -0
  95. package/platform/src/components/aws/helpers/event-source.ts +41 -0
  96. package/platform/src/components/aws/helpers/fargate.ts +727 -0
  97. package/platform/src/components/aws/helpers/function-builder.ts +133 -0
  98. package/platform/src/components/aws/helpers/function-code.ts +224 -0
  99. package/platform/src/components/aws/helpers/function-part.ts +212 -0
  100. package/platform/src/components/aws/helpers/function-permission.ts +29 -0
  101. package/platform/src/components/aws/helpers/load-balancer-args.ts +88 -0
  102. package/platform/src/components/aws/helpers/load-balancer.ts +17 -0
  103. package/platform/src/components/aws/helpers/provider.ts +36 -0
  104. package/platform/src/components/aws/helpers/queue-policy.ts +33 -0
  105. package/platform/src/components/aws/helpers/rds.ts +212 -0
  106. package/platform/src/components/aws/helpers/site-builder.ts +41 -0
  107. package/platform/src/components/aws/helpers/subscriber.ts +23 -0
  108. package/platform/src/components/aws/helpers/vpc.ts +27 -0
  109. package/platform/src/components/aws/https-redirect.ts +216 -0
  110. package/platform/src/components/aws/iam-edit.ts +50 -0
  111. package/platform/src/components/aws/index.ts +61 -0
  112. package/platform/src/components/aws/kinesis-stream-lambda-subscriber.ts +122 -0
  113. package/platform/src/components/aws/kinesis-stream.ts +416 -0
  114. package/platform/src/components/aws/linkable.ts +32 -0
  115. package/platform/src/components/aws/logging.ts +25 -0
  116. package/platform/src/components/aws/microvm.ts +988 -0
  117. package/platform/src/components/aws/mysql.ts +1050 -0
  118. package/platform/src/components/aws/nextjs.ts +1052 -0
  119. package/platform/src/components/aws/nuxt.ts +527 -0
  120. package/platform/src/components/aws/open-search.ts +603 -0
  121. package/platform/src/components/aws/opencontrol.ts +235 -0
  122. package/platform/src/components/aws/permission.ts +80 -0
  123. package/platform/src/components/aws/postgres-v1.ts +537 -0
  124. package/platform/src/components/aws/postgres.ts +1074 -0
  125. package/platform/src/components/aws/providers/bucket-files.ts +32 -0
  126. package/platform/src/components/aws/providers/distribution-deployment-waiter.ts +27 -0
  127. package/platform/src/components/aws/providers/distribution-invalidation.ts +24 -0
  128. package/platform/src/components/aws/providers/function-environment-update.ts +46 -0
  129. package/platform/src/components/aws/providers/hosted-zone-lookup.ts +25 -0
  130. package/platform/src/components/aws/providers/kv-keys.ts +15 -0
  131. package/platform/src/components/aws/providers/kv-routes-update.ts +24 -0
  132. package/platform/src/components/aws/providers/microvm-image-prune.ts +48 -0
  133. package/platform/src/components/aws/providers/origin-access-control.ts +21 -0
  134. package/platform/src/components/aws/providers/rds-role-lookup.ts +21 -0
  135. package/platform/src/components/aws/providers/vector-table.ts +25 -0
  136. package/platform/src/components/aws/queue-lambda-subscriber.ts +135 -0
  137. package/platform/src/components/aws/queue.ts +712 -0
  138. package/platform/src/components/aws/react.ts +510 -0
  139. package/platform/src/components/aws/realtime-lambda-subscriber.ts +129 -0
  140. package/platform/src/components/aws/realtime.ts +345 -0
  141. package/platform/src/components/aws/redis-v1.ts +595 -0
  142. package/platform/src/components/aws/redis.ts +1078 -0
  143. package/platform/src/components/aws/remix.ts +576 -0
  144. package/platform/src/components/aws/router-base-route.ts +83 -0
  145. package/platform/src/components/aws/router-bucket-route.ts +63 -0
  146. package/platform/src/components/aws/router-url-route.ts +75 -0
  147. package/platform/src/components/aws/router.ts +3294 -0
  148. package/platform/src/components/aws/service-v1.ts +876 -0
  149. package/platform/src/components/aws/service.ts +2994 -0
  150. package/platform/src/components/aws/sns-topic-lambda-subscriber.ts +127 -0
  151. package/platform/src/components/aws/sns-topic-queue-subscriber.ts +105 -0
  152. package/platform/src/components/aws/sns-topic.ts +700 -0
  153. package/platform/src/components/aws/solid-start.ts +467 -0
  154. package/platform/src/components/aws/ssr-site.ts +2204 -0
  155. package/platform/src/components/aws/static-site.ts +1389 -0
  156. package/platform/src/components/aws/step-functions/choice.ts +123 -0
  157. package/platform/src/components/aws/step-functions/fail.ts +69 -0
  158. package/platform/src/components/aws/step-functions/map.ts +264 -0
  159. package/platform/src/components/aws/step-functions/parallel.ts +170 -0
  160. package/platform/src/components/aws/step-functions/pass.ts +48 -0
  161. package/platform/src/components/aws/step-functions/state.ts +376 -0
  162. package/platform/src/components/aws/step-functions/succeed.ts +31 -0
  163. package/platform/src/components/aws/step-functions/task.ts +538 -0
  164. package/platform/src/components/aws/step-functions/wait.ts +105 -0
  165. package/platform/src/components/aws/step-functions.ts +804 -0
  166. package/platform/src/components/aws/svelte-kit.ts +563 -0
  167. package/platform/src/components/aws/takeover/alb.ts +9 -0
  168. package/platform/src/components/aws/takeover/apigatewayv2.ts +43 -0
  169. package/platform/src/components/aws/takeover/app-sync.ts +45 -0
  170. package/platform/src/components/aws/takeover/aurora.ts +19 -0
  171. package/platform/src/components/aws/takeover/bucket.ts +94 -0
  172. package/platform/src/components/aws/takeover/bus.ts +43 -0
  173. package/platform/src/components/aws/takeover/cognito-user-pool.ts +21 -0
  174. package/platform/src/components/aws/takeover/cron-v2.ts +9 -0
  175. package/platform/src/components/aws/takeover/dsql.ts +12 -0
  176. package/platform/src/components/aws/takeover/dynamo.ts +31 -0
  177. package/platform/src/components/aws/takeover/efs.ts +9 -0
  178. package/platform/src/components/aws/takeover/function.ts +21 -0
  179. package/platform/src/components/aws/takeover/helpers.ts +26 -0
  180. package/platform/src/components/aws/takeover/index.ts +27 -0
  181. package/platform/src/components/aws/takeover/mysql.ts +17 -0
  182. package/platform/src/components/aws/takeover/postgres.ts +17 -0
  183. package/platform/src/components/aws/takeover/queue.ts +21 -0
  184. package/platform/src/components/aws/takeover/redis.ts +10 -0
  185. package/platform/src/components/aws/takeover/service.ts +22 -0
  186. package/platform/src/components/aws/takeover/sns-topic.ts +27 -0
  187. package/platform/src/components/aws/takeover/task.ts +13 -0
  188. package/platform/src/components/aws/tan-stack-start.ts +479 -0
  189. package/platform/src/components/aws/task.ts +571 -0
  190. package/platform/src/components/aws/v5/alb.ts +310 -0
  191. package/platform/src/components/aws/v5/apigatewayv2.ts +845 -0
  192. package/platform/src/components/aws/v5/app-sync.ts +673 -0
  193. package/platform/src/components/aws/v5/aurora.ts +855 -0
  194. package/platform/src/components/aws/v5/bucket.ts +1001 -0
  195. package/platform/src/components/aws/v5/bus.ts +321 -0
  196. package/platform/src/components/aws/v5/cluster.ts +230 -0
  197. package/platform/src/components/aws/v5/cognito-user-pool-client.ts +100 -0
  198. package/platform/src/components/aws/v5/cognito-user-pool.ts +693 -0
  199. package/platform/src/components/aws/v5/cron-v2.ts +316 -0
  200. package/platform/src/components/aws/v5/dsql.ts +665 -0
  201. package/platform/src/components/aws/v5/dynamo.ts +477 -0
  202. package/platform/src/components/aws/v5/efs.ts +311 -0
  203. package/platform/src/components/aws/v5/function.ts +1546 -0
  204. package/platform/src/components/aws/v5/index.ts +26 -0
  205. package/platform/src/components/aws/v5/mysql.ts +604 -0
  206. package/platform/src/components/aws/v5/postgres.ts +612 -0
  207. package/platform/src/components/aws/v5/queue.ts +271 -0
  208. package/platform/src/components/aws/v5/redis.ts +550 -0
  209. package/platform/src/components/aws/v5/service.ts +2209 -0
  210. package/platform/src/components/aws/v5/sns-topic.ts +284 -0
  211. package/platform/src/components/aws/v5/task.ts +549 -0
  212. package/platform/src/components/aws/vector.ts +316 -0
  213. package/platform/src/components/aws/vpc-v1.ts +580 -0
  214. package/platform/src/components/aws/vpc.ts +1641 -0
  215. package/platform/src/components/aws/workflow.ts +421 -0
  216. package/platform/src/components/base/base-site.ts +101 -0
  217. package/platform/src/components/base/base-ssr-site.ts +120 -0
  218. package/platform/src/components/base/base-static-site.ts +314 -0
  219. package/platform/src/components/cloudflare/account-id.ts +1 -0
  220. package/platform/src/components/cloudflare/ai.ts +77 -0
  221. package/platform/src/components/cloudflare/astro.ts +355 -0
  222. package/platform/src/components/cloudflare/auth.ts +69 -0
  223. package/platform/src/components/cloudflare/binding.ts +132 -0
  224. package/platform/src/components/cloudflare/bucket.ts +142 -0
  225. package/platform/src/components/cloudflare/cron.ts +207 -0
  226. package/platform/src/components/cloudflare/d1.ts +230 -0
  227. package/platform/src/components/cloudflare/dns.ts +253 -0
  228. package/platform/src/components/cloudflare/durable-object.ts +144 -0
  229. package/platform/src/components/cloudflare/experimental/index.ts +3 -0
  230. package/platform/src/components/cloudflare/experimental/solid-start.ts +288 -0
  231. package/platform/src/components/cloudflare/experimental/static-site.ts +4 -0
  232. package/platform/src/components/cloudflare/helpers/compatibility.ts +44 -0
  233. package/platform/src/components/cloudflare/helpers/fetch.ts +81 -0
  234. package/platform/src/components/cloudflare/helpers/validation.ts +74 -0
  235. package/platform/src/components/cloudflare/helpers/worker-builder.ts +57 -0
  236. package/platform/src/components/cloudflare/helpers/wrangler.ts +222 -0
  237. package/platform/src/components/cloudflare/hyperdrive.ts +402 -0
  238. package/platform/src/components/cloudflare/index.ts +25 -0
  239. package/platform/src/components/cloudflare/kv.ts +218 -0
  240. package/platform/src/components/cloudflare/providers/dns-record.ts +43 -0
  241. package/platform/src/components/cloudflare/providers/kv-data.ts +107 -0
  242. package/platform/src/components/cloudflare/providers/worker-assets.ts +41 -0
  243. package/platform/src/components/cloudflare/providers/worker-placement.ts +93 -0
  244. package/platform/src/components/cloudflare/providers/worker-script.ts +47 -0
  245. package/platform/src/components/cloudflare/providers/worker-url.ts +109 -0
  246. package/platform/src/components/cloudflare/providers/zone-lookup.ts +85 -0
  247. package/platform/src/components/cloudflare/queue-worker-subscriber.ts +192 -0
  248. package/platform/src/components/cloudflare/queue.ts +310 -0
  249. package/platform/src/components/cloudflare/rate-limit.ts +178 -0
  250. package/platform/src/components/cloudflare/react-router.ts +322 -0
  251. package/platform/src/components/cloudflare/ssr-site.ts +293 -0
  252. package/platform/src/components/cloudflare/static-site-v2.ts +428 -0
  253. package/platform/src/components/cloudflare/static-site.ts +470 -0
  254. package/platform/src/components/cloudflare/tan-stack-start.ts +408 -0
  255. package/platform/src/components/cloudflare/worker.ts +1080 -0
  256. package/platform/src/components/cloudflare/workflow.ts +319 -0
  257. package/platform/src/components/component.ts +242 -0
  258. package/platform/src/components/core.ts +43 -0
  259. package/platform/src/components/cpu.ts +10 -0
  260. package/platform/src/components/dns.ts +82 -0
  261. package/platform/src/components/duration.ts +67 -0
  262. package/platform/src/components/error.ts +5 -0
  263. package/platform/src/components/esbuild.ts +15 -0
  264. package/platform/src/components/experimental/dev-command.ts +127 -0
  265. package/platform/src/components/experimental/index.ts +1 -0
  266. package/platform/src/components/groups.ts +9 -0
  267. package/platform/src/components/index.ts +9 -0
  268. package/platform/src/components/input.ts +2 -0
  269. package/platform/src/components/link.ts +201 -0
  270. package/platform/src/components/linkable.ts +360 -0
  271. package/platform/src/components/naming-rules.ts +299 -0
  272. package/platform/src/components/naming.ts +189 -0
  273. package/platform/src/components/parts-component.ts +662 -0
  274. package/platform/src/components/parts.ts +299 -0
  275. package/platform/src/components/path.ts +5 -0
  276. package/platform/src/components/rpc/rpc.ts +110 -0
  277. package/platform/src/components/secret.ts +159 -0
  278. package/platform/src/components/size.ts +28 -0
  279. package/platform/src/components/takeover.ts +131 -0
  280. package/platform/src/components/transform.ts +107 -0
  281. package/platform/src/components/vercel/account-id.ts +1 -0
  282. package/platform/src/components/vercel/dns.ts +171 -0
  283. package/platform/src/components/vercel/index.ts +2 -0
  284. package/platform/src/components/vercel/providers/dns-record.ts +34 -0
  285. package/platform/src/config.ts +1463 -0
  286. package/platform/src/global-aliases.d.ts +37 -0
  287. package/platform/src/global.d.ts +374 -0
  288. package/platform/src/internal.d.ts +18 -0
  289. package/platform/src/runtime/worker/unenv.d.ts +14 -0
  290. package/platform/src/runtime/worker/unenv.mjs +26 -0
  291. package/platform/src/shim/run.js +25 -0
  292. package/platform/src/testing/global.ts +83 -0
  293. package/platform/src/testing/index.ts +103 -0
  294. package/platform/src/testing/mock.ts +646 -0
  295. package/platform/src/testing/vitest.ts +36 -0
  296. package/platform/src/util/compare-semver.ts +23 -0
  297. package/platform/src/util/fs.ts +49 -0
  298. package/platform/src/util/lazy.ts +12 -0
  299. package/platform/src/util/minify.ts +10 -0
  300. package/platform/src/util/package.ts +29 -0
  301. package/platform/src/util/semaphore.ts +29 -0
  302. package/platform/src/util/warn.ts +7 -0
  303. package/platform/types/auto/run.d.ts +9 -0
  304. package/platform/types/auto/run.d.ts.map +1 -0
  305. package/platform/types/components/args.d.ts +77 -0
  306. package/platform/types/components/args.d.ts.map +1 -0
  307. package/platform/types/components/aws/alb.d.ts +283 -0
  308. package/platform/types/components/aws/alb.d.ts.map +1 -0
  309. package/platform/types/components/aws/analog.d.ts +408 -0
  310. package/platform/types/components/aws/analog.d.ts.map +1 -0
  311. package/platform/types/components/aws/apigateway-websocket-route.d.ts +74 -0
  312. package/platform/types/components/aws/apigateway-websocket-route.d.ts.map +1 -0
  313. package/platform/types/components/aws/apigateway-websocket.d.ts +560 -0
  314. package/platform/types/components/aws/apigateway-websocket.d.ts.map +1 -0
  315. package/platform/types/components/aws/apigatewayv1-api-key.d.ts +48 -0
  316. package/platform/types/components/aws/apigatewayv1-api-key.d.ts.map +1 -0
  317. package/platform/types/components/aws/apigatewayv1-authorizer.d.ts +55 -0
  318. package/platform/types/components/aws/apigatewayv1-authorizer.d.ts.map +1 -0
  319. package/platform/types/components/aws/apigatewayv1-base-route.d.ts +36 -0
  320. package/platform/types/components/aws/apigatewayv1-base-route.d.ts.map +1 -0
  321. package/platform/types/components/aws/apigatewayv1-integration-route.d.ts +39 -0
  322. package/platform/types/components/aws/apigatewayv1-integration-route.d.ts.map +1 -0
  323. package/platform/types/components/aws/apigatewayv1-lambda-route.d.ts +53 -0
  324. package/platform/types/components/aws/apigatewayv1-lambda-route.d.ts.map +1 -0
  325. package/platform/types/components/aws/apigatewayv1-usage-plan.d.ts +53 -0
  326. package/platform/types/components/aws/apigatewayv1-usage-plan.d.ts.map +1 -0
  327. package/platform/types/components/aws/apigatewayv1.d.ts +1028 -0
  328. package/platform/types/components/aws/apigatewayv1.d.ts.map +1 -0
  329. package/platform/types/components/aws/apigatewayv2-authorizer.d.ts +54 -0
  330. package/platform/types/components/aws/apigatewayv2-authorizer.d.ts.map +1 -0
  331. package/platform/types/components/aws/apigatewayv2-base-route.d.ts +28 -0
  332. package/platform/types/components/aws/apigatewayv2-base-route.d.ts.map +1 -0
  333. package/platform/types/components/aws/apigatewayv2-lambda-route.d.ts +59 -0
  334. package/platform/types/components/aws/apigatewayv2-lambda-route.d.ts.map +1 -0
  335. package/platform/types/components/aws/apigatewayv2-private-route.d.ts +54 -0
  336. package/platform/types/components/aws/apigatewayv2-private-route.d.ts.map +1 -0
  337. package/platform/types/components/aws/apigatewayv2-url-route.d.ts +44 -0
  338. package/platform/types/components/aws/apigatewayv2-url-route.d.ts.map +1 -0
  339. package/platform/types/components/aws/apigatewayv2.d.ts +955 -0
  340. package/platform/types/components/aws/apigatewayv2.d.ts.map +1 -0
  341. package/platform/types/components/aws/app-sync-data-source.d.ts +52 -0
  342. package/platform/types/components/aws/app-sync-data-source.d.ts.map +1 -0
  343. package/platform/types/components/aws/app-sync-function.d.ts +33 -0
  344. package/platform/types/components/aws/app-sync-function.d.ts.map +1 -0
  345. package/platform/types/components/aws/app-sync-resolver.d.ts +41 -0
  346. package/platform/types/components/aws/app-sync-resolver.d.ts.map +1 -0
  347. package/platform/types/components/aws/app-sync.d.ts +638 -0
  348. package/platform/types/components/aws/app-sync.d.ts.map +1 -0
  349. package/platform/types/components/aws/astro.d.ts +409 -0
  350. package/platform/types/components/aws/astro.d.ts.map +1 -0
  351. package/platform/types/components/aws/aurora.d.ts +720 -0
  352. package/platform/types/components/aws/aurora.d.ts.map +1 -0
  353. package/platform/types/components/aws/auth-v1.d.ts +26 -0
  354. package/platform/types/components/aws/auth-v1.d.ts.map +1 -0
  355. package/platform/types/components/aws/auth.d.ts +295 -0
  356. package/platform/types/components/aws/auth.d.ts.map +1 -0
  357. package/platform/types/components/aws/bucket-lambda-subscriber.d.ts +61 -0
  358. package/platform/types/components/aws/bucket-lambda-subscriber.d.ts.map +1 -0
  359. package/platform/types/components/aws/bucket-notification.d.ts +47 -0
  360. package/platform/types/components/aws/bucket-notification.d.ts.map +1 -0
  361. package/platform/types/components/aws/bucket-queue-subscriber.d.ts +55 -0
  362. package/platform/types/components/aws/bucket-queue-subscriber.d.ts.map +1 -0
  363. package/platform/types/components/aws/bucket-topic-subscriber.d.ts +55 -0
  364. package/platform/types/components/aws/bucket-topic-subscriber.d.ts.map +1 -0
  365. package/platform/types/components/aws/bucket.d.ts +1356 -0
  366. package/platform/types/components/aws/bucket.d.ts.map +1 -0
  367. package/platform/types/components/aws/bus-base-subscriber.d.ts +20 -0
  368. package/platform/types/components/aws/bus-base-subscriber.d.ts.map +1 -0
  369. package/platform/types/components/aws/bus-lambda-subscriber.d.ts +50 -0
  370. package/platform/types/components/aws/bus-lambda-subscriber.d.ts.map +1 -0
  371. package/platform/types/components/aws/bus-queue-subscriber.d.ts +44 -0
  372. package/platform/types/components/aws/bus-queue-subscriber.d.ts.map +1 -0
  373. package/platform/types/components/aws/bus.d.ts +447 -0
  374. package/platform/types/components/aws/bus.d.ts.map +1 -0
  375. package/platform/types/components/aws/cdn.d.ts +310 -0
  376. package/platform/types/components/aws/cdn.d.ts.map +1 -0
  377. package/platform/types/components/aws/cluster-v1.d.ts +885 -0
  378. package/platform/types/components/aws/cluster-v1.d.ts.map +1 -0
  379. package/platform/types/components/aws/cluster.d.ts +364 -0
  380. package/platform/types/components/aws/cluster.d.ts.map +1 -0
  381. package/platform/types/components/aws/cognito-identity-pool.d.ts +199 -0
  382. package/platform/types/components/aws/cognito-identity-pool.d.ts.map +1 -0
  383. package/platform/types/components/aws/cognito-identity-provider.d.ts +38 -0
  384. package/platform/types/components/aws/cognito-identity-provider.d.ts.map +1 -0
  385. package/platform/types/components/aws/cognito-user-pool-client.d.ts +50 -0
  386. package/platform/types/components/aws/cognito-user-pool-client.d.ts.map +1 -0
  387. package/platform/types/components/aws/cognito-user-pool.d.ts +703 -0
  388. package/platform/types/components/aws/cognito-user-pool.d.ts.map +1 -0
  389. package/platform/types/components/aws/cron-v2.d.ts +325 -0
  390. package/platform/types/components/aws/cron-v2.d.ts.map +1 -0
  391. package/platform/types/components/aws/cron.d.ts +259 -0
  392. package/platform/types/components/aws/cron.d.ts.map +1 -0
  393. package/platform/types/components/aws/dns-validated-certificate.d.ts +27 -0
  394. package/platform/types/components/aws/dns-validated-certificate.d.ts.map +1 -0
  395. package/platform/types/components/aws/dns.d.ts +94 -0
  396. package/platform/types/components/aws/dns.d.ts.map +1 -0
  397. package/platform/types/components/aws/dsql.d.ts +369 -0
  398. package/platform/types/components/aws/dsql.d.ts.map +1 -0
  399. package/platform/types/components/aws/dynamo-lambda-subscriber.d.ts +55 -0
  400. package/platform/types/components/aws/dynamo-lambda-subscriber.d.ts.map +1 -0
  401. package/platform/types/components/aws/dynamo.d.ts +628 -0
  402. package/platform/types/components/aws/dynamo.d.ts.map +1 -0
  403. package/platform/types/components/aws/efs.d.ts +217 -0
  404. package/platform/types/components/aws/efs.d.ts.map +1 -0
  405. package/platform/types/components/aws/email.d.ts +370 -0
  406. package/platform/types/components/aws/email.d.ts.map +1 -0
  407. package/platform/types/components/aws/fargate.d.ts +894 -0
  408. package/platform/types/components/aws/fargate.d.ts.map +1 -0
  409. package/platform/types/components/aws/function.d.ts +1780 -0
  410. package/platform/types/components/aws/function.d.ts.map +1 -0
  411. package/platform/types/components/aws/helpers/apigateway-account.d.ts +3 -0
  412. package/platform/types/components/aws/helpers/apigateway-account.d.ts.map +1 -0
  413. package/platform/types/components/aws/helpers/apigatewayv2-domain.d.ts +144 -0
  414. package/platform/types/components/aws/helpers/apigatewayv2-domain.d.ts.map +1 -0
  415. package/platform/types/components/aws/helpers/arn.d.ts +51 -0
  416. package/platform/types/components/aws/helpers/arn.d.ts.map +1 -0
  417. package/platform/types/components/aws/helpers/bootstrap.d.ts +13 -0
  418. package/platform/types/components/aws/helpers/bootstrap.d.ts.map +1 -0
  419. package/platform/types/components/aws/helpers/client.d.ts +7 -0
  420. package/platform/types/components/aws/helpers/client.d.ts.map +1 -0
  421. package/platform/types/components/aws/helpers/container-builder.d.ts +4 -0
  422. package/platform/types/components/aws/helpers/container-builder.d.ts.map +1 -0
  423. package/platform/types/components/aws/helpers/custom-domain.d.ts +111 -0
  424. package/platform/types/components/aws/helpers/custom-domain.d.ts.map +1 -0
  425. package/platform/types/components/aws/helpers/event-source.d.ts +26 -0
  426. package/platform/types/components/aws/helpers/event-source.d.ts.map +1 -0
  427. package/platform/types/components/aws/helpers/fargate.d.ts +225 -0
  428. package/platform/types/components/aws/helpers/fargate.d.ts.map +1 -0
  429. package/platform/types/components/aws/helpers/function-builder.d.ts +14 -0
  430. package/platform/types/components/aws/helpers/function-builder.d.ts.map +1 -0
  431. package/platform/types/components/aws/helpers/function-code.d.ts +80 -0
  432. package/platform/types/components/aws/helpers/function-code.d.ts.map +1 -0
  433. package/platform/types/components/aws/helpers/function-part.d.ts +61 -0
  434. package/platform/types/components/aws/helpers/function-part.d.ts.map +1 -0
  435. package/platform/types/components/aws/helpers/function-permission.d.ts +17 -0
  436. package/platform/types/components/aws/helpers/function-permission.d.ts.map +1 -0
  437. package/platform/types/components/aws/helpers/load-balancer-args.d.ts +40 -0
  438. package/platform/types/components/aws/helpers/load-balancer-args.d.ts.map +1 -0
  439. package/platform/types/components/aws/helpers/load-balancer.d.ts +9 -0
  440. package/platform/types/components/aws/helpers/load-balancer.d.ts.map +1 -0
  441. package/platform/types/components/aws/helpers/provider.d.ts +3 -0
  442. package/platform/types/components/aws/helpers/provider.d.ts.map +1 -0
  443. package/platform/types/components/aws/helpers/queue-policy.d.ts +11 -0
  444. package/platform/types/components/aws/helpers/queue-policy.d.ts.map +1 -0
  445. package/platform/types/components/aws/helpers/rds.d.ts +98 -0
  446. package/platform/types/components/aws/helpers/rds.d.ts.map +1 -0
  447. package/platform/types/components/aws/helpers/site-builder.d.ts +4 -0
  448. package/platform/types/components/aws/helpers/site-builder.d.ts.map +1 -0
  449. package/platform/types/components/aws/helpers/subscriber.d.ts +6 -0
  450. package/platform/types/components/aws/helpers/subscriber.d.ts.map +1 -0
  451. package/platform/types/components/aws/helpers/vpc.d.ts +14 -0
  452. package/platform/types/components/aws/helpers/vpc.d.ts.map +1 -0
  453. package/platform/types/components/aws/https-redirect.d.ts +38 -0
  454. package/platform/types/components/aws/https-redirect.d.ts.map +1 -0
  455. package/platform/types/components/aws/iam-edit.d.ts +39 -0
  456. package/platform/types/components/aws/iam-edit.d.ts.map +1 -0
  457. package/platform/types/components/aws/index.d.ts +56 -0
  458. package/platform/types/components/aws/index.d.ts.map +1 -0
  459. package/platform/types/components/aws/kinesis-stream-lambda-subscriber.d.ts +49 -0
  460. package/platform/types/components/aws/kinesis-stream-lambda-subscriber.d.ts.map +1 -0
  461. package/platform/types/components/aws/kinesis-stream.d.ts +254 -0
  462. package/platform/types/components/aws/kinesis-stream.d.ts.map +1 -0
  463. package/platform/types/components/aws/linkable.d.ts +17 -0
  464. package/platform/types/components/aws/linkable.d.ts.map +1 -0
  465. package/platform/types/components/aws/logging.d.ts +26 -0
  466. package/platform/types/components/aws/logging.d.ts.map +1 -0
  467. package/platform/types/components/aws/microvm.d.ts +439 -0
  468. package/platform/types/components/aws/microvm.d.ts.map +1 -0
  469. package/platform/types/components/aws/mysql.d.ts +528 -0
  470. package/platform/types/components/aws/mysql.d.ts.map +1 -0
  471. package/platform/types/components/aws/nextjs.d.ts +534 -0
  472. package/platform/types/components/aws/nextjs.d.ts.map +1 -0
  473. package/platform/types/components/aws/nuxt.d.ts +480 -0
  474. package/platform/types/components/aws/nuxt.d.ts.map +1 -0
  475. package/platform/types/components/aws/open-search.d.ts +306 -0
  476. package/platform/types/components/aws/open-search.d.ts.map +1 -0
  477. package/platform/types/components/aws/opencontrol.d.ts +169 -0
  478. package/platform/types/components/aws/opencontrol.d.ts.map +1 -0
  479. package/platform/types/components/aws/permission.d.ts +80 -0
  480. package/platform/types/components/aws/permission.d.ts.map +1 -0
  481. package/platform/types/components/aws/postgres-v1.d.ts +328 -0
  482. package/platform/types/components/aws/postgres-v1.d.ts.map +1 -0
  483. package/platform/types/components/aws/postgres.d.ts +529 -0
  484. package/platform/types/components/aws/postgres.d.ts.map +1 -0
  485. package/platform/types/components/aws/providers/bucket-files.d.ts +18 -0
  486. package/platform/types/components/aws/providers/bucket-files.d.ts.map +1 -0
  487. package/platform/types/components/aws/providers/distribution-deployment-waiter.d.ts +13 -0
  488. package/platform/types/components/aws/providers/distribution-deployment-waiter.d.ts.map +1 -0
  489. package/platform/types/components/aws/providers/distribution-invalidation.d.ts +11 -0
  490. package/platform/types/components/aws/providers/distribution-invalidation.d.ts.map +1 -0
  491. package/platform/types/components/aws/providers/function-environment-update.d.ts +33 -0
  492. package/platform/types/components/aws/providers/function-environment-update.d.ts.map +1 -0
  493. package/platform/types/components/aws/providers/hosted-zone-lookup.d.ts +11 -0
  494. package/platform/types/components/aws/providers/hosted-zone-lookup.d.ts.map +1 -0
  495. package/platform/types/components/aws/providers/kv-keys.d.ts +11 -0
  496. package/platform/types/components/aws/providers/kv-keys.d.ts.map +1 -0
  497. package/platform/types/components/aws/providers/kv-routes-update.d.ts +11 -0
  498. package/platform/types/components/aws/providers/kv-routes-update.d.ts.map +1 -0
  499. package/platform/types/components/aws/providers/microvm-image-prune.d.ts +35 -0
  500. package/platform/types/components/aws/providers/microvm-image-prune.d.ts.map +1 -0
  501. package/platform/types/components/aws/providers/origin-access-control.d.ts +8 -0
  502. package/platform/types/components/aws/providers/origin-access-control.d.ts.map +1 -0
  503. package/platform/types/components/aws/providers/rds-role-lookup.d.ts +8 -0
  504. package/platform/types/components/aws/providers/rds-role-lookup.d.ts.map +1 -0
  505. package/platform/types/components/aws/providers/vector-table.d.ts +12 -0
  506. package/platform/types/components/aws/providers/vector-table.d.ts.map +1 -0
  507. package/platform/types/components/aws/queue-lambda-subscriber.d.ts +53 -0
  508. package/platform/types/components/aws/queue-lambda-subscriber.d.ts.map +1 -0
  509. package/platform/types/components/aws/queue.d.ts +494 -0
  510. package/platform/types/components/aws/queue.d.ts.map +1 -0
  511. package/platform/types/components/aws/react.d.ts +407 -0
  512. package/platform/types/components/aws/react.d.ts.map +1 -0
  513. package/platform/types/components/aws/realtime-lambda-subscriber.d.ts +53 -0
  514. package/platform/types/components/aws/realtime-lambda-subscriber.d.ts.map +1 -0
  515. package/platform/types/components/aws/realtime.d.ts +237 -0
  516. package/platform/types/components/aws/realtime.d.ts.map +1 -0
  517. package/platform/types/components/aws/redis-v1.d.ts +348 -0
  518. package/platform/types/components/aws/redis-v1.d.ts.map +1 -0
  519. package/platform/types/components/aws/redis.d.ts +545 -0
  520. package/platform/types/components/aws/redis.d.ts.map +1 -0
  521. package/platform/types/components/aws/remix.d.ts +408 -0
  522. package/platform/types/components/aws/remix.d.ts.map +1 -0
  523. package/platform/types/components/aws/router-base-route.d.ts +28 -0
  524. package/platform/types/components/aws/router-base-route.d.ts.map +1 -0
  525. package/platform/types/components/aws/router-bucket-route.d.ts +29 -0
  526. package/platform/types/components/aws/router-bucket-route.d.ts.map +1 -0
  527. package/platform/types/components/aws/router-url-route.d.ts +28 -0
  528. package/platform/types/components/aws/router-url-route.d.ts.map +1 -0
  529. package/platform/types/components/aws/router.d.ts +1767 -0
  530. package/platform/types/components/aws/router.d.ts.map +1 -0
  531. package/platform/types/components/aws/service-v1.d.ts +78 -0
  532. package/platform/types/components/aws/service-v1.d.ts.map +1 -0
  533. package/platform/types/components/aws/service.d.ts +1756 -0
  534. package/platform/types/components/aws/service.d.ts.map +1 -0
  535. package/platform/types/components/aws/sns-topic-lambda-subscriber.d.ts +53 -0
  536. package/platform/types/components/aws/sns-topic-lambda-subscriber.d.ts.map +1 -0
  537. package/platform/types/components/aws/sns-topic-queue-subscriber.d.ts +55 -0
  538. package/platform/types/components/aws/sns-topic-queue-subscriber.d.ts.map +1 -0
  539. package/platform/types/components/aws/sns-topic.d.ts +394 -0
  540. package/platform/types/components/aws/sns-topic.d.ts.map +1 -0
  541. package/platform/types/components/aws/solid-start.d.ts +399 -0
  542. package/platform/types/components/aws/solid-start.d.ts.map +1 -0
  543. package/platform/types/components/aws/ssr-site.d.ts +895 -0
  544. package/platform/types/components/aws/ssr-site.d.ts.map +1 -0
  545. package/platform/types/components/aws/static-site.d.ts +744 -0
  546. package/platform/types/components/aws/static-site.d.ts.map +1 -0
  547. package/platform/types/components/aws/step-functions/choice.d.ts +73 -0
  548. package/platform/types/components/aws/step-functions/choice.d.ts.map +1 -0
  549. package/platform/types/components/aws/step-functions/fail.d.ts +63 -0
  550. package/platform/types/components/aws/step-functions/fail.d.ts.map +1 -0
  551. package/platform/types/components/aws/step-functions/map.d.ts +236 -0
  552. package/platform/types/components/aws/step-functions/map.d.ts.map +1 -0
  553. package/platform/types/components/aws/step-functions/parallel.d.ts +127 -0
  554. package/platform/types/components/aws/step-functions/parallel.d.ts.map +1 -0
  555. package/platform/types/components/aws/step-functions/pass.d.ts +39 -0
  556. package/platform/types/components/aws/step-functions/pass.d.ts.map +1 -0
  557. package/platform/types/components/aws/step-functions/state.d.ts +231 -0
  558. package/platform/types/components/aws/step-functions/state.d.ts.map +1 -0
  559. package/platform/types/components/aws/step-functions/succeed.d.ts +26 -0
  560. package/platform/types/components/aws/step-functions/succeed.d.ts.map +1 -0
  561. package/platform/types/components/aws/step-functions/task.d.ts +485 -0
  562. package/platform/types/components/aws/step-functions/task.d.ts.map +1 -0
  563. package/platform/types/components/aws/step-functions/wait.d.ts +91 -0
  564. package/platform/types/components/aws/step-functions/wait.d.ts.map +1 -0
  565. package/platform/types/components/aws/step-functions.d.ts +478 -0
  566. package/platform/types/components/aws/step-functions.d.ts.map +1 -0
  567. package/platform/types/components/aws/svelte-kit.d.ts +456 -0
  568. package/platform/types/components/aws/svelte-kit.d.ts.map +1 -0
  569. package/platform/types/components/aws/takeover/alb.d.ts +2 -0
  570. package/platform/types/components/aws/takeover/alb.d.ts.map +1 -0
  571. package/platform/types/components/aws/takeover/apigatewayv2.d.ts +2 -0
  572. package/platform/types/components/aws/takeover/apigatewayv2.d.ts.map +1 -0
  573. package/platform/types/components/aws/takeover/app-sync.d.ts +2 -0
  574. package/platform/types/components/aws/takeover/app-sync.d.ts.map +1 -0
  575. package/platform/types/components/aws/takeover/aurora.d.ts +2 -0
  576. package/platform/types/components/aws/takeover/aurora.d.ts.map +1 -0
  577. package/platform/types/components/aws/takeover/bucket.d.ts +2 -0
  578. package/platform/types/components/aws/takeover/bucket.d.ts.map +1 -0
  579. package/platform/types/components/aws/takeover/bus.d.ts +2 -0
  580. package/platform/types/components/aws/takeover/bus.d.ts.map +1 -0
  581. package/platform/types/components/aws/takeover/cognito-user-pool.d.ts +2 -0
  582. package/platform/types/components/aws/takeover/cognito-user-pool.d.ts.map +1 -0
  583. package/platform/types/components/aws/takeover/cron-v2.d.ts +2 -0
  584. package/platform/types/components/aws/takeover/cron-v2.d.ts.map +1 -0
  585. package/platform/types/components/aws/takeover/dsql.d.ts +2 -0
  586. package/platform/types/components/aws/takeover/dsql.d.ts.map +1 -0
  587. package/platform/types/components/aws/takeover/dynamo.d.ts +2 -0
  588. package/platform/types/components/aws/takeover/dynamo.d.ts.map +1 -0
  589. package/platform/types/components/aws/takeover/efs.d.ts +2 -0
  590. package/platform/types/components/aws/takeover/efs.d.ts.map +1 -0
  591. package/platform/types/components/aws/takeover/function.d.ts +2 -0
  592. package/platform/types/components/aws/takeover/function.d.ts.map +1 -0
  593. package/platform/types/components/aws/takeover/helpers.d.ts +16 -0
  594. package/platform/types/components/aws/takeover/helpers.d.ts.map +1 -0
  595. package/platform/types/components/aws/takeover/index.d.ts +28 -0
  596. package/platform/types/components/aws/takeover/index.d.ts.map +1 -0
  597. package/platform/types/components/aws/takeover/mysql.d.ts +2 -0
  598. package/platform/types/components/aws/takeover/mysql.d.ts.map +1 -0
  599. package/platform/types/components/aws/takeover/postgres.d.ts +2 -0
  600. package/platform/types/components/aws/takeover/postgres.d.ts.map +1 -0
  601. package/platform/types/components/aws/takeover/queue.d.ts +2 -0
  602. package/platform/types/components/aws/takeover/queue.d.ts.map +1 -0
  603. package/platform/types/components/aws/takeover/redis.d.ts +2 -0
  604. package/platform/types/components/aws/takeover/redis.d.ts.map +1 -0
  605. package/platform/types/components/aws/takeover/service.d.ts +2 -0
  606. package/platform/types/components/aws/takeover/service.d.ts.map +1 -0
  607. package/platform/types/components/aws/takeover/sns-topic.d.ts +2 -0
  608. package/platform/types/components/aws/takeover/sns-topic.d.ts.map +1 -0
  609. package/platform/types/components/aws/takeover/task.d.ts +2 -0
  610. package/platform/types/components/aws/takeover/task.d.ts.map +1 -0
  611. package/platform/types/components/aws/tan-stack-start.d.ts +359 -0
  612. package/platform/types/components/aws/tan-stack-start.d.ts.map +1 -0
  613. package/platform/types/components/aws/task.d.ts +342 -0
  614. package/platform/types/components/aws/task.d.ts.map +1 -0
  615. package/platform/types/components/aws/v5/alb.d.ts +177 -0
  616. package/platform/types/components/aws/v5/alb.d.ts.map +1 -0
  617. package/platform/types/components/aws/v5/apigatewayv2.d.ts +482 -0
  618. package/platform/types/components/aws/v5/apigatewayv2.d.ts.map +1 -0
  619. package/platform/types/components/aws/v5/app-sync.d.ts +424 -0
  620. package/platform/types/components/aws/v5/app-sync.d.ts.map +1 -0
  621. package/platform/types/components/aws/v5/aurora.d.ts +459 -0
  622. package/platform/types/components/aws/v5/aurora.d.ts.map +1 -0
  623. package/platform/types/components/aws/v5/bucket.d.ts +578 -0
  624. package/platform/types/components/aws/v5/bucket.d.ts.map +1 -0
  625. package/platform/types/components/aws/v5/bus.d.ts +255 -0
  626. package/platform/types/components/aws/v5/bus.d.ts.map +1 -0
  627. package/platform/types/components/aws/v5/cluster.d.ts +167 -0
  628. package/platform/types/components/aws/v5/cluster.d.ts.map +1 -0
  629. package/platform/types/components/aws/v5/cognito-user-pool-client.d.ts +69 -0
  630. package/platform/types/components/aws/v5/cognito-user-pool-client.d.ts.map +1 -0
  631. package/platform/types/components/aws/v5/cognito-user-pool.d.ts +396 -0
  632. package/platform/types/components/aws/v5/cognito-user-pool.d.ts.map +1 -0
  633. package/platform/types/components/aws/v5/cron-v2.d.ts +206 -0
  634. package/platform/types/components/aws/v5/cron-v2.d.ts.map +1 -0
  635. package/platform/types/components/aws/v5/dsql.d.ts +453 -0
  636. package/platform/types/components/aws/v5/dsql.d.ts.map +1 -0
  637. package/platform/types/components/aws/v5/dynamo.d.ts +328 -0
  638. package/platform/types/components/aws/v5/dynamo.d.ts.map +1 -0
  639. package/platform/types/components/aws/v5/efs.d.ts +178 -0
  640. package/platform/types/components/aws/v5/efs.d.ts.map +1 -0
  641. package/platform/types/components/aws/v5/function.d.ts +586 -0
  642. package/platform/types/components/aws/v5/function.d.ts.map +1 -0
  643. package/platform/types/components/aws/v5/index.d.ts +27 -0
  644. package/platform/types/components/aws/v5/index.d.ts.map +1 -0
  645. package/platform/types/components/aws/v5/mysql.d.ts +347 -0
  646. package/platform/types/components/aws/v5/mysql.d.ts.map +1 -0
  647. package/platform/types/components/aws/v5/postgres.d.ts +348 -0
  648. package/platform/types/components/aws/v5/postgres.d.ts.map +1 -0
  649. package/platform/types/components/aws/v5/queue.d.ts +190 -0
  650. package/platform/types/components/aws/v5/queue.d.ts.map +1 -0
  651. package/platform/types/components/aws/v5/redis.d.ts +214 -0
  652. package/platform/types/components/aws/v5/redis.d.ts.map +1 -0
  653. package/platform/types/components/aws/v5/service.d.ts +1347 -0
  654. package/platform/types/components/aws/v5/service.d.ts.map +1 -0
  655. package/platform/types/components/aws/v5/sns-topic.d.ts +226 -0
  656. package/platform/types/components/aws/v5/sns-topic.d.ts.map +1 -0
  657. package/platform/types/components/aws/v5/task.d.ts +346 -0
  658. package/platform/types/components/aws/v5/task.d.ts.map +1 -0
  659. package/platform/types/components/aws/vector.d.ts +163 -0
  660. package/platform/types/components/aws/vector.d.ts.map +1 -0
  661. package/platform/types/components/aws/vpc-v1.d.ts +208 -0
  662. package/platform/types/components/aws/vpc-v1.d.ts.map +1 -0
  663. package/platform/types/components/aws/vpc.d.ts +491 -0
  664. package/platform/types/components/aws/vpc.d.ts.map +1 -0
  665. package/platform/types/components/aws/workflow.d.ts +331 -0
  666. package/platform/types/components/aws/workflow.d.ts.map +1 -0
  667. package/platform/types/components/base/base-site.d.ts +53 -0
  668. package/platform/types/components/base/base-site.d.ts.map +1 -0
  669. package/platform/types/components/base/base-ssr-site.d.ts +13 -0
  670. package/platform/types/components/base/base-ssr-site.d.ts.map +1 -0
  671. package/platform/types/components/base/base-static-site.d.ts +199 -0
  672. package/platform/types/components/base/base-static-site.d.ts.map +1 -0
  673. package/platform/types/components/cloudflare/account-id.d.ts +2 -0
  674. package/platform/types/components/cloudflare/account-id.d.ts.map +1 -0
  675. package/platform/types/components/cloudflare/ai.d.ts +68 -0
  676. package/platform/types/components/cloudflare/ai.d.ts.map +1 -0
  677. package/platform/types/components/cloudflare/astro.d.ts +249 -0
  678. package/platform/types/components/cloudflare/astro.d.ts.map +1 -0
  679. package/platform/types/components/cloudflare/auth.d.ts +22 -0
  680. package/platform/types/components/cloudflare/auth.d.ts.map +1 -0
  681. package/platform/types/components/cloudflare/binding.d.ts +109 -0
  682. package/platform/types/components/cloudflare/binding.d.ts.map +1 -0
  683. package/platform/types/components/cloudflare/bucket.d.ts +98 -0
  684. package/platform/types/components/cloudflare/bucket.d.ts.map +1 -0
  685. package/platform/types/components/cloudflare/cron.d.ts +151 -0
  686. package/platform/types/components/cloudflare/cron.d.ts.map +1 -0
  687. package/platform/types/components/cloudflare/d1.d.ts +142 -0
  688. package/platform/types/components/cloudflare/d1.d.ts.map +1 -0
  689. package/platform/types/components/cloudflare/dns.d.ts +100 -0
  690. package/platform/types/components/cloudflare/dns.d.ts.map +1 -0
  691. package/platform/types/components/cloudflare/durable-object.d.ts +125 -0
  692. package/platform/types/components/cloudflare/durable-object.d.ts.map +1 -0
  693. package/platform/types/components/cloudflare/experimental/index.d.ts +4 -0
  694. package/platform/types/components/cloudflare/experimental/index.d.ts.map +1 -0
  695. package/platform/types/components/cloudflare/experimental/solid-start.d.ts +219 -0
  696. package/platform/types/components/cloudflare/experimental/solid-start.d.ts.map +1 -0
  697. package/platform/types/components/cloudflare/experimental/static-site.d.ts +3 -0
  698. package/platform/types/components/cloudflare/experimental/static-site.d.ts.map +1 -0
  699. package/platform/types/components/cloudflare/helpers/compatibility.d.ts +21 -0
  700. package/platform/types/components/cloudflare/helpers/compatibility.d.ts.map +1 -0
  701. package/platform/types/components/cloudflare/helpers/fetch.d.ts +19 -0
  702. package/platform/types/components/cloudflare/helpers/fetch.d.ts.map +1 -0
  703. package/platform/types/components/cloudflare/helpers/validation.d.ts +15 -0
  704. package/platform/types/components/cloudflare/helpers/validation.d.ts.map +1 -0
  705. package/platform/types/components/cloudflare/helpers/worker-builder.d.ts +10 -0
  706. package/platform/types/components/cloudflare/helpers/worker-builder.d.ts.map +1 -0
  707. package/platform/types/components/cloudflare/helpers/wrangler.d.ts +31 -0
  708. package/platform/types/components/cloudflare/helpers/wrangler.d.ts.map +1 -0
  709. package/platform/types/components/cloudflare/hyperdrive.d.ts +302 -0
  710. package/platform/types/components/cloudflare/hyperdrive.d.ts.map +1 -0
  711. package/platform/types/components/cloudflare/index.d.ts +25 -0
  712. package/platform/types/components/cloudflare/index.d.ts.map +1 -0
  713. package/platform/types/components/cloudflare/kv.d.ts +140 -0
  714. package/platform/types/components/cloudflare/kv.d.ts.map +1 -0
  715. package/platform/types/components/cloudflare/providers/dns-record.d.ts +21 -0
  716. package/platform/types/components/cloudflare/providers/dns-record.d.ts.map +1 -0
  717. package/platform/types/components/cloudflare/providers/kv-data.d.ts +23 -0
  718. package/platform/types/components/cloudflare/providers/kv-data.d.ts.map +1 -0
  719. package/platform/types/components/cloudflare/providers/worker-assets.d.ts +19 -0
  720. package/platform/types/components/cloudflare/providers/worker-assets.d.ts.map +1 -0
  721. package/platform/types/components/cloudflare/providers/worker-placement.d.ts +27 -0
  722. package/platform/types/components/cloudflare/providers/worker-placement.d.ts.map +1 -0
  723. package/platform/types/components/cloudflare/providers/worker-script.d.ts +23 -0
  724. package/platform/types/components/cloudflare/providers/worker-script.d.ts.map +1 -0
  725. package/platform/types/components/cloudflare/providers/worker-url.d.ts +24 -0
  726. package/platform/types/components/cloudflare/providers/worker-url.d.ts.map +1 -0
  727. package/platform/types/components/cloudflare/providers/zone-lookup.d.ts +22 -0
  728. package/platform/types/components/cloudflare/providers/zone-lookup.d.ts.map +1 -0
  729. package/platform/types/components/cloudflare/queue-worker-subscriber.d.ts +122 -0
  730. package/platform/types/components/cloudflare/queue-worker-subscriber.d.ts.map +1 -0
  731. package/platform/types/components/cloudflare/queue.d.ts +235 -0
  732. package/platform/types/components/cloudflare/queue.d.ts.map +1 -0
  733. package/platform/types/components/cloudflare/rate-limit.d.ts +117 -0
  734. package/platform/types/components/cloudflare/rate-limit.d.ts.map +1 -0
  735. package/platform/types/components/cloudflare/react-router.d.ts +262 -0
  736. package/platform/types/components/cloudflare/react-router.d.ts.map +1 -0
  737. package/platform/types/components/cloudflare/ssr-site.d.ts +60 -0
  738. package/platform/types/components/cloudflare/ssr-site.d.ts.map +1 -0
  739. package/platform/types/components/cloudflare/static-site-v2.d.ts +302 -0
  740. package/platform/types/components/cloudflare/static-site-v2.d.ts.map +1 -0
  741. package/platform/types/components/cloudflare/static-site.d.ts +270 -0
  742. package/platform/types/components/cloudflare/static-site.d.ts.map +1 -0
  743. package/platform/types/components/cloudflare/tan-stack-start.d.ts +259 -0
  744. package/platform/types/components/cloudflare/tan-stack-start.d.ts.map +1 -0
  745. package/platform/types/components/cloudflare/worker.d.ts +483 -0
  746. package/platform/types/components/cloudflare/worker.d.ts.map +1 -0
  747. package/platform/types/components/cloudflare/workflow.d.ts +248 -0
  748. package/platform/types/components/cloudflare/workflow.d.ts.map +1 -0
  749. package/platform/types/components/component.d.ts +67 -0
  750. package/platform/types/components/component.d.ts.map +1 -0
  751. package/platform/types/components/core.d.ts +16 -0
  752. package/platform/types/components/core.d.ts.map +1 -0
  753. package/platform/types/components/cpu.d.ts +3 -0
  754. package/platform/types/components/cpu.d.ts.map +1 -0
  755. package/platform/types/components/dns.d.ts +63 -0
  756. package/platform/types/components/dns.d.ts.map +1 -0
  757. package/platform/types/components/duration.d.ts +9 -0
  758. package/platform/types/components/duration.d.ts.map +1 -0
  759. package/platform/types/components/error.d.ts +4 -0
  760. package/platform/types/components/error.d.ts.map +1 -0
  761. package/platform/types/components/esbuild.d.ts +3 -0
  762. package/platform/types/components/esbuild.d.ts.map +1 -0
  763. package/platform/types/components/experimental/dev-command.d.ts +99 -0
  764. package/platform/types/components/experimental/dev-command.d.ts.map +1 -0
  765. package/platform/types/components/experimental/index.d.ts +2 -0
  766. package/platform/types/components/experimental/index.d.ts.map +1 -0
  767. package/platform/types/components/groups.d.ts +6 -0
  768. package/platform/types/components/groups.d.ts.map +1 -0
  769. package/platform/types/components/index.d.ts +5 -0
  770. package/platform/types/components/index.d.ts.map +1 -0
  771. package/platform/types/components/input.d.ts +3 -0
  772. package/platform/types/components/input.d.ts.map +1 -0
  773. package/platform/types/components/link.d.ts +41 -0
  774. package/platform/types/components/link.d.ts.map +1 -0
  775. package/platform/types/components/linkable.d.ts +301 -0
  776. package/platform/types/components/linkable.d.ts.map +1 -0
  777. package/platform/types/components/naming-rules.d.ts +32 -0
  778. package/platform/types/components/naming-rules.d.ts.map +1 -0
  779. package/platform/types/components/naming.d.ts +21 -0
  780. package/platform/types/components/naming.d.ts.map +1 -0
  781. package/platform/types/components/parts-component.d.ts +242 -0
  782. package/platform/types/components/parts-component.d.ts.map +1 -0
  783. package/platform/types/components/parts.d.ts +194 -0
  784. package/platform/types/components/parts.d.ts.map +1 -0
  785. package/platform/types/components/path.d.ts +2 -0
  786. package/platform/types/components/path.d.ts.map +1 -0
  787. package/platform/types/components/rpc/rpc.d.ts +19 -0
  788. package/platform/types/components/rpc/rpc.d.ts.map +1 -0
  789. package/platform/types/components/secret.d.ts +123 -0
  790. package/platform/types/components/secret.d.ts.map +1 -0
  791. package/platform/types/components/size.d.ts +5 -0
  792. package/platform/types/components/size.d.ts.map +1 -0
  793. package/platform/types/components/takeover.d.ts +88 -0
  794. package/platform/types/components/takeover.d.ts.map +1 -0
  795. package/platform/types/components/transform.d.ts +34 -0
  796. package/platform/types/components/transform.d.ts.map +1 -0
  797. package/platform/types/components/vercel/account-id.d.ts +2 -0
  798. package/platform/types/components/vercel/account-id.d.ts.map +1 -0
  799. package/platform/types/components/vercel/dns.d.ts +73 -0
  800. package/platform/types/components/vercel/dns.d.ts.map +1 -0
  801. package/platform/types/components/vercel/index.d.ts +3 -0
  802. package/platform/types/components/vercel/index.d.ts.map +1 -0
  803. package/platform/types/components/vercel/providers/dns-record.d.ts +15 -0
  804. package/platform/types/components/vercel/providers/dns-record.d.ts.map +1 -0
  805. package/platform/types/config.d.ts +1440 -0
  806. package/platform/types/config.d.ts.map +1 -0
  807. package/platform/types/global-aliases.d.ts +37 -0
  808. package/platform/types/global.d.ts +374 -0
  809. package/platform/types/internal.d.ts +18 -0
  810. package/platform/types/runtime/worker/unenv.d.ts +14 -0
  811. package/platform/types/testing/global.d.ts +11 -0
  812. package/platform/types/testing/global.d.ts.map +1 -0
  813. package/platform/types/testing/index.d.ts +80 -0
  814. package/platform/types/testing/index.d.ts.map +1 -0
  815. package/platform/types/testing/mock.d.ts +136 -0
  816. package/platform/types/testing/mock.d.ts.map +1 -0
  817. package/platform/types/testing/vitest.d.ts +19 -0
  818. package/platform/types/testing/vitest.d.ts.map +1 -0
  819. package/platform/types/util/compare-semver.d.ts +4 -0
  820. package/platform/types/util/compare-semver.d.ts.map +1 -0
  821. package/platform/types/util/fs.d.ts +5 -0
  822. package/platform/types/util/fs.d.ts.map +1 -0
  823. package/platform/types/util/lazy.d.ts +2 -0
  824. package/platform/types/util/lazy.d.ts.map +1 -0
  825. package/platform/types/util/minify.d.ts +2 -0
  826. package/platform/types/util/minify.d.ts.map +1 -0
  827. package/platform/types/util/package.d.ts +10 -0
  828. package/platform/types/util/package.d.ts.map +1 -0
  829. package/platform/types/util/semaphore.d.ts +9 -0
  830. package/platform/types/util/semaphore.d.ts.map +1 -0
  831. package/platform/types/util/warn.d.ts +2 -0
  832. package/platform/types/util/warn.d.ts.map +1 -0
@@ -0,0 +1,2046 @@
1
+ import {
2
+ ComponentResourceOptions,
3
+ output,
4
+ interpolate,
5
+ all,
6
+ Output,
7
+ } from "@pulumi/pulumi";
8
+ import { hashStringToPrettyString, logicalName } from "../naming";
9
+ import { Component, Prettify, Transform, transform } from "../component";
10
+ import { Link } from "../link";
11
+ import type { Input } from "../input";
12
+ import { Function, FunctionArgs, FunctionArn } from "./function.js";
13
+ import { Workflow } from "./workflow.js";
14
+ import { Duration, DurationDays, toSeconds } from "../duration";
15
+ import { VisibleError } from "../error";
16
+ import { parseBucketArn } from "./helpers/arn";
17
+ import { BucketLambdaSubscriber } from "./bucket-lambda-subscriber";
18
+ import {
19
+ cloudwatch,
20
+ getCallerIdentityOutput,
21
+ getPartitionOutput,
22
+ iam,
23
+ s3,
24
+ } from "@pulumi/aws";
25
+ import { permission } from "./permission";
26
+ import { BucketQueueSubscriber } from "./bucket-queue-subscriber";
27
+ import { BucketTopicSubscriber } from "./bucket-topic-subscriber";
28
+ import { Queue } from "./queue";
29
+ import { SnsTopic } from "./sns-topic";
30
+ import { BucketNotification } from "./bucket-notification";
31
+ import { BusLambdaSubscriber } from "./bus-lambda-subscriber";
32
+ import type { BusSubscriberArgs } from "./bus";
33
+
34
+ interface BucketCorsArgs {
35
+ /**
36
+ * The HTTP headers that origins can include in requests to the bucket.
37
+ * @default `["*"]`
38
+ * @example
39
+ * ```js
40
+ * {
41
+ * cors: {
42
+ * allowHeaders: ["date", "keep-alive", "x-custom-header"]
43
+ * }
44
+ * }
45
+ * ```
46
+ */
47
+ allowHeaders?: Input<Input<string>[]>;
48
+ /**
49
+ * The origins that can access the bucket.
50
+ * @default `["*"]`
51
+ * @example
52
+ * ```js
53
+ * {
54
+ * cors: {
55
+ * allowOrigins: ["https://www.example.com", "http://localhost:60905"]
56
+ * }
57
+ * }
58
+ * ```
59
+ * Or the wildcard for all origins.
60
+ * ```js
61
+ * {
62
+ * cors: {
63
+ * allowOrigins: ["*"]
64
+ * }
65
+ * }
66
+ * ```
67
+ */
68
+ allowOrigins?: Input<Input<string>[]>;
69
+ /**
70
+ * The HTTP methods that are allowed when calling the bucket.
71
+ * @default `["DELETE" | "GET" | "HEAD" | "POST" | "PUT"]`
72
+ * @example
73
+ * ```js
74
+ * {
75
+ * cors: {
76
+ * allowMethods: ["GET", "POST", "DELETE"]
77
+ * }
78
+ * }
79
+ * ```
80
+ */
81
+ allowMethods?: Input<Input<"DELETE" | "GET" | "HEAD" | "POST" | "PUT">[]>;
82
+ /**
83
+ * The HTTP headers you want to expose to an origin that calls the bucket.
84
+ * @default `["ETag"]`
85
+ * @example
86
+ * ```js
87
+ * {
88
+ * cors: {
89
+ * exposeHeaders: ["date", "keep-alive", "x-custom-header"]
90
+ * }
91
+ * }
92
+ * ```
93
+ */
94
+ exposeHeaders?: Input<Input<string>[]>;
95
+ /**
96
+ * The maximum amount of time the browser can cache results of a preflight request. By
97
+ * default the browser doesn't cache the results. The maximum value is `86400 seconds` or `1 day`.
98
+ * @default `"0 seconds"`
99
+ * @example
100
+ * ```js
101
+ * {
102
+ * cors: {
103
+ * maxAge: "1 day"
104
+ * }
105
+ * }
106
+ * ```
107
+ */
108
+ maxAge?: Input<Duration>;
109
+ }
110
+
111
+ interface BucketLifecycleArgs {
112
+ /**
113
+ * The unique identifier for the lifecycle rule.
114
+ *
115
+ * This ID must be unique across all lifecycle rules in the bucket and cannot exceed 255 characters.
116
+ * Whitespace-only values are not allowed.
117
+ *
118
+ * If not provided, SST will generate a unique ID based on the bucket component name and rule index.
119
+ *
120
+ * @example
121
+ * Use stable IDs to ensure rule identity is preserved when reordering rules.
122
+ * ```js
123
+ * {
124
+ * id: "expire-tmp-files",
125
+ * prefix: "/tmp",
126
+ * expiresIn: "7 days"
127
+ * }
128
+ * ```
129
+ */
130
+ id?: Input<string>;
131
+ /**
132
+ * An S3 object key prefix that the lifecycle rule applies to.
133
+ * @example
134
+ * Applies to all the objects in the `images/` folder.
135
+ * ```js
136
+ * {
137
+ * prefix: "images/"
138
+ * }
139
+ * ```
140
+ */
141
+ prefix?: Input<string>;
142
+ /**
143
+ * Whether the lifecycle rule is enabled.
144
+ * @example
145
+ * ```js
146
+ * {
147
+ * enabled: true
148
+ * }
149
+ * ```
150
+ * @default `true`
151
+ */
152
+ enabled?: Input<boolean>;
153
+ /**
154
+ * Days after which the objects in the bucket should expire.
155
+ * @example
156
+ * ```js
157
+ * {
158
+ * expiresIn: "30 days"
159
+ * }
160
+ * ```
161
+ */
162
+ expiresIn?: Input<DurationDays>;
163
+ /**
164
+ * Date after which the objects in the bucket should expire. Defaults to midnight UTC time.
165
+ * @example
166
+ * ```js
167
+ * {
168
+ * expiresAt: "2023-08-22"
169
+ * }
170
+ * ```
171
+ */
172
+ expiresAt?: Input<string>;
173
+ }
174
+
175
+ export interface BucketArgs {
176
+ /**
177
+ * Enable public read access for all the files in the bucket.
178
+ *
179
+ * :::tip
180
+ * You don't need to enable this if you're using CloudFront to serve files from the bucket.
181
+ * :::
182
+ *
183
+ * Should only be turned on if you want to host public files directly from the bucket.
184
+ * @deprecated Use `access` instead.
185
+ * @default `false`
186
+ * @example
187
+ * ```js
188
+ * {
189
+ * public: true
190
+ * }
191
+ * ```
192
+ */
193
+ public?: Input<boolean>;
194
+ /**
195
+ * Enable public read access for all the files in the bucket. By default, no access is
196
+ * granted.
197
+ *
198
+ * :::tip
199
+ * If you are using the `Router` to serve files from this bucket, you need to allow
200
+ * `cloudfront` access the bucket.
201
+ * :::
202
+ *
203
+ * This adds a statement to the bucket policy that either allows `public` access or just
204
+ * `cloudfront` access. With `cloudfront`, only CloudFront distributions in the same AWS
205
+ * account can read the bucket.
206
+ *
207
+ * @example
208
+ * ```js
209
+ * {
210
+ * access: "public"
211
+ * }
212
+ * ```
213
+ *
214
+ * To let the distributions of another AWS account read a `cloudfront` bucket, add a
215
+ * statement with the `policy` option. In the GovCloud and China partitions, start the ARN
216
+ * with `arn:aws-us-gov:` or `arn:aws-cn:` instead of `arn:aws:`.
217
+ *
218
+ * ```js
219
+ * {
220
+ * access: "cloudfront",
221
+ * policy: [
222
+ * {
223
+ * effect: "allow",
224
+ * principals: [{ type: "service", identifiers: ["cloudfront.amazonaws.com"] }],
225
+ * actions: ["s3:GetObject"],
226
+ * paths: ["*"],
227
+ * conditions: [
228
+ * {
229
+ * test: "StringLike",
230
+ * variable: "aws:SourceArn",
231
+ * values: ["arn:aws:cloudfront::OTHER_ACCOUNT_ID:distribution/*"]
232
+ * }
233
+ * ]
234
+ * }
235
+ * ]
236
+ * }
237
+ * ```
238
+ */
239
+ access?: Input<"public" | "cloudfront">;
240
+ /**
241
+ * Configure the policy for the bucket.
242
+ *
243
+ * @example
244
+ * Restrict Access to Specific IP Addresses
245
+ *
246
+ * ```js
247
+ * {
248
+ * policy: [{
249
+ * actions: ["s3:*"],
250
+ * principals: "*",
251
+ * conditions: [
252
+ * {
253
+ * test: "IpAddress",
254
+ * variable: "aws:SourceIp",
255
+ * values: ["10.0.0.0/16"]
256
+ * }
257
+ * ]
258
+ * }]
259
+ * }
260
+ * ```
261
+ *
262
+ * Allow Specific IAM User Access
263
+ *
264
+ * ```js
265
+ * {
266
+ * policy: [{
267
+ * actions: ["s3:*"],
268
+ * principals: [{
269
+ * type: "aws",
270
+ * identifiers: ["arn:aws:iam::123456789012:user/specific-user"]
271
+ * }],
272
+ * }]
273
+ * }
274
+ * ```
275
+ *
276
+ * Cross-Account Access
277
+ *
278
+ * ```js
279
+ * {
280
+ * policy: [{
281
+ * actions: ["s3:GetObject", "s3:ListBucket"],
282
+ * principals: [{
283
+ * type: "aws",
284
+ * identifiers: ["123456789012"]
285
+ * }],
286
+ * }]
287
+ * }
288
+ * ```
289
+ */
290
+ policy?: Input<
291
+ Input<{
292
+ /**
293
+ * Configures whether the permission is allowed or denied.
294
+ * @default `"allow"`
295
+ * @example
296
+ * ```ts
297
+ * {
298
+ * effect: "deny"
299
+ * }
300
+ * ```
301
+ */
302
+ effect?: Input<"allow" | "deny">;
303
+ /**
304
+ * The [IAM actions](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html#actions_table) that can be performed.
305
+ * @example
306
+ * ```js
307
+ * {
308
+ * actions: ["s3:*"]
309
+ * }
310
+ * ```
311
+ */
312
+ actions: Input<Input<string>[]>;
313
+ /**
314
+ * The principals that can perform the actions.
315
+ * @example
316
+ * Allow anyone to perform the actions.
317
+ *
318
+ * ```js
319
+ * {
320
+ * principals: "*"
321
+ * }
322
+ * ```
323
+ *
324
+ * Allow anyone within an AWS account.
325
+ *
326
+ * ```js
327
+ * {
328
+ * principals: [{ type: "aws", identifiers: ["123456789012"] }]
329
+ * }
330
+ * ```
331
+ *
332
+ * Allow specific IAM roles.
333
+ * ```js
334
+ * {
335
+ * principals: [{
336
+ * type: "aws",
337
+ * identifiers: [
338
+ * "arn:aws:iam::123456789012:role/MyRole",
339
+ * "arn:aws:iam::123456789012:role/MyOtherRole"
340
+ * ]
341
+ * }]
342
+ * }
343
+ * ```
344
+ *
345
+ * Allow AWS CloudFront.
346
+ * ```js
347
+ * {
348
+ * principals: [{ type: "service", identifiers: ["cloudfront.amazonaws.com"] }]
349
+ * }
350
+ * ```
351
+ *
352
+ * Allow OIDC federated users.
353
+ * ```js
354
+ * {
355
+ * principals: [{
356
+ * type: "federated",
357
+ * identifiers: ["accounts.google.com"]
358
+ * }]
359
+ * }
360
+ * ```
361
+ *
362
+ * Allow SAML federated users.
363
+ * ```js
364
+ * {
365
+ * principals: [{
366
+ * type: "federated",
367
+ * identifiers: ["arn:aws:iam::123456789012:saml-provider/provider-name"]
368
+ * }]
369
+ * }
370
+ * ```
371
+ *
372
+ * Allow Canonical User IDs.
373
+ * ```js
374
+ * {
375
+ * principals: [{
376
+ * type: "canonical",
377
+ * identifiers: ["79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be"]
378
+ * }]
379
+ * }
380
+ * ```
381
+ *
382
+ * Allow specific IAM users.
383
+ *
384
+ */
385
+ principals: Input<
386
+ | "*"
387
+ | Input<{
388
+ type: Input<"aws" | "service" | "federated" | "canonical">;
389
+ identifiers: Input<Input<string>[]>;
390
+ }>[]
391
+ >;
392
+ /**
393
+ * Configure specific conditions for when the policy is in effect.
394
+ * @example
395
+ * ```js
396
+ * {
397
+ * conditions: [
398
+ * {
399
+ * test: "StringEquals",
400
+ * variable: "s3:x-amz-server-side-encryption",
401
+ * values: ["AES256"]
402
+ * }
403
+ * ]
404
+ * }
405
+ * ```
406
+ */
407
+ conditions?: Input<
408
+ Input<{
409
+ /**
410
+ * Name of the [IAM condition operator](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html) to evaluate.
411
+ */
412
+ test: Input<string>;
413
+ /**
414
+ * Name of a [Context Variable](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html#AvailableKeys) to apply the condition to. Context variables may either be standard AWS variables starting with `aws:` or service-specific variables prefixed with the service name.
415
+ */
416
+ variable: Input<string>;
417
+ /**
418
+ * The values to evaluate the condition against. If multiple values are provided, the condition matches if at least one of them applies. That is, AWS evaluates multiple values as though using an "OR" boolean operation.
419
+ */
420
+ values: Input<Input<string>[]>;
421
+ }>[]
422
+ >;
423
+ /**
424
+ * The S3 file paths that the policy is applied to. The paths are specified using
425
+ * the [S3 path format](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-prefixes.html).
426
+ * The bucket arn will be prepended to the paths when constructing the policy.
427
+ * @default `["", "*"]`
428
+ * @example
429
+ * Apply the policy to the bucket itself.
430
+ * ```js
431
+ * {
432
+ * paths: [""]
433
+ * }
434
+ * ```
435
+ *
436
+ * Apply to all files in the bucket.
437
+ * ```js
438
+ * {
439
+ * paths: ["*"]
440
+ * }
441
+ * ```
442
+ *
443
+ * Apply to all files in the `images/` folder.
444
+ * ```js
445
+ * {
446
+ * paths: ["images/*"]
447
+ * }
448
+ * ```
449
+ */
450
+ paths?: Input<Input<string>[]>;
451
+ }>[]
452
+ >;
453
+ /**
454
+ * Enforce HTTPS for all requests to the bucket.
455
+ *
456
+ * By default, the bucket policy will automatically block any HTTP requests.
457
+ * This is done using the `aws:SecureTransport` condition key.
458
+ *
459
+ * @default true
460
+ * @example
461
+ * ```js
462
+ * {
463
+ * enforceHttps: false
464
+ * }
465
+ * ```
466
+ */
467
+ enforceHttps?: Input<boolean>;
468
+ /**
469
+ * The CORS configuration for the bucket. Defaults to `true`, which is the same as:
470
+ *
471
+ * ```js
472
+ * {
473
+ * cors: {
474
+ * allowHeaders: ["*"],
475
+ * allowOrigins: ["*"],
476
+ * allowMethods: ["DELETE", "GET", "HEAD", "POST", "PUT"],
477
+ * exposeHeaders: ["ETag"],
478
+ * maxAge: "0 seconds"
479
+ * }
480
+ * }
481
+ * ```
482
+ *
483
+ * @default `true`
484
+ */
485
+ cors?: Input<false | Prettify<BucketCorsArgs>>;
486
+ /**
487
+ * The lifecycle configuration for the bucket.
488
+ * @example
489
+ * Delete objects in the "/tmp" directory after 30 days.
490
+ * ```js
491
+ * {
492
+ * lifecycle: [
493
+ * {
494
+ * prefix: "/tmp",
495
+ * expiresIn: "30 days"
496
+ * }
497
+ * ]
498
+ * }
499
+ * ```
500
+ *
501
+ * Use stable IDs to preserve rule identity when reordering.
502
+ * ```js
503
+ * {
504
+ * lifecycle: [
505
+ * {
506
+ * id: "expire-tmp-files",
507
+ * prefix: "/tmp",
508
+ * expiresIn: "7 days"
509
+ * },
510
+ * {
511
+ * id: "archive-old-logs",
512
+ * prefix: "/logs",
513
+ * expiresIn: "90 days"
514
+ * }
515
+ * ]
516
+ * }
517
+ * ```
518
+ */
519
+ lifecycle?: Input<Input<Prettify<BucketLifecycleArgs>>[]>;
520
+ /**
521
+ * Enable versioning for the bucket.
522
+ *
523
+ * Bucket versioning enables you to store multiple versions of an object, protecting
524
+ * against accidental deletion or overwriting.
525
+ *
526
+ * @default `false`
527
+ * @example
528
+ * ```js
529
+ * {
530
+ * versioning: true
531
+ * }
532
+ * ```
533
+ */
534
+ versioning?: Input<boolean>;
535
+ /**
536
+ * [Transform](/docs/components#transform) how this component creates its underlying
537
+ * resources.
538
+ */
539
+ transform?: {
540
+ /**
541
+ * Transform the S3 Bucket resource.
542
+ */
543
+ bucket?: Transform<s3.BucketArgs>;
544
+ /**
545
+ * Transform the S3 Bucket CORS configuration resource.
546
+ */
547
+ cors?: Transform<s3.BucketCorsConfigurationArgs>;
548
+ /**
549
+ * Transform the S3 Bucket Policy resource.
550
+ */
551
+ policy?: Transform<s3.BucketPolicyArgs>;
552
+ /**
553
+ * Transform the S3 Bucket versioning resource.
554
+ */
555
+ versioning?: Transform<s3.BucketVersioningArgs>;
556
+ /**
557
+ * Transform the S3 Bucket lifecycle resource.
558
+ * */
559
+ lifecycle?: Transform<s3.BucketLifecycleConfigurationArgs>;
560
+ /**
561
+ * Transform the public access block resource that's attached to the Bucket.
562
+ *
563
+ * Returns `false` if the public access block resource should not be created.
564
+ */
565
+ publicAccessBlock?: Transform<s3.BucketPublicAccessBlockArgs> | false;
566
+ };
567
+ }
568
+
569
+ export interface BucketNotificationsArgs {
570
+ /**
571
+ * Enable EventBridge notifications for this bucket. This publishes every S3 event of
572
+ * the bucket to the account's default EventBridge bus. It doesn't send them anywhere
573
+ * by itself: add rules with [`Bucket.subscribeEventBridge`](#static-subscribeeventbridge),
574
+ * or your own rules on the default bus, to react to them.
575
+ *
576
+ * S3 keeps a single notification configuration for each bucket. To use EventBridge
577
+ * together with the queue, topic and function `notifications` below, set it in the
578
+ * same `notify` call. Calling `notify` again would replace what was set before, so
579
+ * it isn't allowed.
580
+ *
581
+ * Set it to `false` to turn EventBridge notifications off.
582
+ *
583
+ * @default `false`
584
+ * @example
585
+ * ```js
586
+ * {
587
+ * eventBridge: true,
588
+ * notifications: [
589
+ * {
590
+ * name: "MySubscriber",
591
+ * queue: myQueue
592
+ * }
593
+ * ]
594
+ * }
595
+ * ```
596
+ */
597
+ eventBridge?: Input<boolean>;
598
+ /**
599
+ * A list of subscribers that'll be notified when events happen in the bucket. Leave
600
+ * it out if the bucket only uses `eventBridge`.
601
+ */
602
+ notifications?: Input<
603
+ Input<{
604
+ /**
605
+ * The name of the subscriber.
606
+ */
607
+ name: Input<string>;
608
+ /**
609
+ * The function that'll be notified.
610
+ *
611
+ * @example
612
+ * ```js
613
+ * {
614
+ * name: "MySubscriber",
615
+ * function: "src/subscriber.handler"
616
+ * }
617
+ * ```
618
+ *
619
+ * Customize the subscriber function. The `link` ensures the subscriber can access the
620
+ * bucket through the [SDK](/docs/reference/sdk/).
621
+ *
622
+ * ```js
623
+ * {
624
+ * name: "MySubscriber",
625
+ * function: {
626
+ * handler: "src/subscriber.handler",
627
+ * timeout: "60 seconds",
628
+ * link: [bucket]
629
+ * }
630
+ * }
631
+ * ```
632
+ *
633
+ * Or pass in the ARN of an existing Lambda function.
634
+ *
635
+ * ```js
636
+ * {
637
+ * name: "MySubscriber",
638
+ * function: "arn:aws:lambda:us-east-1:123456789012:function:my-function"
639
+ * }
640
+ * ```
641
+ */
642
+ function?: Input<string | FunctionArgs | FunctionArn>;
643
+ /**
644
+ * The Queue that'll be notified.
645
+ *
646
+ * @example
647
+ * For example, let's say you have a queue.
648
+ *
649
+ * ```js title="sst.config.ts"
650
+ * const myQueue = new sst.aws.Queue("MyQueue");
651
+ * ```
652
+ *
653
+ * You can subscribe to this bucket with it.
654
+ *
655
+ * ```js
656
+ * {
657
+ * name: "MySubscriber",
658
+ * queue: myQueue
659
+ * }
660
+ * ```
661
+ *
662
+ * Or pass in the ARN of an existing SQS queue.
663
+ *
664
+ * ```js
665
+ * {
666
+ * name: "MySubscriber",
667
+ * queue: "arn:aws:sqs:us-east-1:123456789012:my-queue"
668
+ * }
669
+ * ```
670
+ */
671
+ queue?: Input<string | Queue>;
672
+ /**
673
+ * The SNS topic that'll be notified.
674
+ *
675
+ * @example
676
+ * For example, let's say you have a topic.
677
+ *
678
+ * ```js title="sst.config.ts"
679
+ * const myTopic = new sst.aws.SnsTopic("MyTopic");
680
+ * ```
681
+ *
682
+ * You can subscribe to this bucket with it.
683
+ *
684
+ * ```js
685
+ * {
686
+ * name: "MySubscriber",
687
+ * topic: myTopic
688
+ * }
689
+ * ```
690
+ *
691
+ * Or pass in the ARN of an existing SNS topic.
692
+ *
693
+ * ```js
694
+ * {
695
+ * name: "MySubscriber",
696
+ * topic: "arn:aws:sns:us-east-1:123456789012:my-topic"
697
+ * }
698
+ * ```
699
+ */
700
+ topic?: Input<string | SnsTopic>;
701
+ /**
702
+ * A list of S3 event types that'll trigger a notification.
703
+ * @default All S3 events
704
+ * @example
705
+ * ```js
706
+ * {
707
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
708
+ * }
709
+ * ```
710
+ */
711
+ events?: Input<
712
+ Input<
713
+ | "s3:ObjectCreated:*"
714
+ | "s3:ObjectCreated:Put"
715
+ | "s3:ObjectCreated:Post"
716
+ | "s3:ObjectCreated:Copy"
717
+ | "s3:ObjectCreated:CompleteMultipartUpload"
718
+ | "s3:ObjectRemoved:*"
719
+ | "s3:ObjectRemoved:Delete"
720
+ | "s3:ObjectRemoved:DeleteMarkerCreated"
721
+ | "s3:ObjectRestore:*"
722
+ | "s3:ObjectRestore:Post"
723
+ | "s3:ObjectRestore:Completed"
724
+ | "s3:ObjectRestore:Delete"
725
+ | "s3:ReducedRedundancyLostObject"
726
+ | "s3:Replication:*"
727
+ | "s3:Replication:OperationFailedReplication"
728
+ | "s3:Replication:OperationMissedThreshold"
729
+ | "s3:Replication:OperationReplicatedAfterThreshold"
730
+ | "s3:Replication:OperationNotTracked"
731
+ | "s3:LifecycleExpiration:*"
732
+ | "s3:LifecycleExpiration:Delete"
733
+ | "s3:LifecycleExpiration:DeleteMarkerCreated"
734
+ | "s3:LifecycleTransition"
735
+ | "s3:IntelligentTiering"
736
+ | "s3:ObjectTagging:*"
737
+ | "s3:ObjectTagging:Put"
738
+ | "s3:ObjectTagging:Delete"
739
+ | "s3:ObjectAcl:Put"
740
+ >[]
741
+ >;
742
+ /**
743
+ * An S3 object key prefix that will trigger a notification.
744
+ * @example
745
+ * To be notified for all the objects in the `images/` folder.
746
+ * ```js
747
+ * {
748
+ * filterPrefix: "images/"
749
+ * }
750
+ * ```
751
+ */
752
+ filterPrefix?: Input<string>;
753
+ /**
754
+ * An S3 object key suffix that will trigger the notification.
755
+ * @example
756
+ * To be notified for all the objects with the `.jpg` suffix.
757
+ * ```js
758
+ * {
759
+ * filterSuffix: ".jpg"
760
+ * }
761
+ * ```
762
+ */
763
+ filterSuffix?: Input<string>;
764
+ }>[]
765
+ >;
766
+ /**
767
+ * [Transform](/docs/components#transform) how this notification creates its underlying
768
+ * resources.
769
+ */
770
+ transform?: {
771
+ /**
772
+ * Transform the S3 Bucket Notification resource.
773
+ */
774
+ notification?: Transform<s3.BucketNotificationArgs>;
775
+ };
776
+ }
777
+
778
+ export interface BucketEventBridgeSubscriberArgs
779
+ extends Omit<BusSubscriberArgs, "pattern"> {
780
+ /**
781
+ * Filter the S3 events that'll be processed by the subscriber. The `source` and
782
+ * bucket name are automatically added to the EventBridge pattern.
783
+ */
784
+ pattern?: Input<{
785
+ /**
786
+ * A list of `detail-type` values to match against. These are the names of the S3
787
+ * events: `Object Created`, `Object Deleted`, `Object Restore Initiated`,
788
+ * `Object Restore Completed`, `Object Restore Expired`, `Object Tags Added`,
789
+ * `Object Tags Deleted`, `Object ACL Updated`, `Object Storage Class Changed`,
790
+ * `Object Access Tier Changed` and `Async Copy Completion`. Leave it out to match
791
+ * all of them.
792
+ *
793
+ * @example
794
+ * ```js
795
+ * {
796
+ * detailType: ["Object Created"]
797
+ * }
798
+ * ```
799
+ */
800
+ detailType?: Input<
801
+ Input<
802
+ | "Object Created"
803
+ | "Object Deleted"
804
+ | "Object Restore Initiated"
805
+ | "Object Restore Completed"
806
+ | "Object Restore Expired"
807
+ | "Object Tags Added"
808
+ | "Object Tags Deleted"
809
+ | "Object ACL Updated"
810
+ | "Object Storage Class Changed"
811
+ | "Object Access Tier Changed"
812
+ | "Async Copy Completion"
813
+ | string
814
+ >[]
815
+ >;
816
+ /**
817
+ * An object of `detail` values to match.
818
+ *
819
+ * @example
820
+ * ```js
821
+ * {
822
+ * detail: {
823
+ * object: {
824
+ * key: [{ prefix: "images/" }]
825
+ * }
826
+ * }
827
+ * }
828
+ * ```
829
+ */
830
+ detail?: Record<string, any>;
831
+ }>;
832
+ }
833
+
834
+ /**
835
+ * @internal
836
+ */
837
+ export interface BucketSubscriberArgs {
838
+ /**
839
+ * A list of S3 event types that'll trigger the notification.
840
+ * @default All S3 events
841
+ * @example
842
+ * ```js
843
+ * {
844
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
845
+ * }
846
+ * ```
847
+ */
848
+ events?: Input<
849
+ Input<
850
+ | "s3:ObjectCreated:*"
851
+ | "s3:ObjectCreated:Put"
852
+ | "s3:ObjectCreated:Post"
853
+ | "s3:ObjectCreated:Copy"
854
+ | "s3:ObjectCreated:CompleteMultipartUpload"
855
+ | "s3:ObjectRemoved:*"
856
+ | "s3:ObjectRemoved:Delete"
857
+ | "s3:ObjectRemoved:DeleteMarkerCreated"
858
+ | "s3:ObjectRestore:*"
859
+ | "s3:ObjectRestore:Post"
860
+ | "s3:ObjectRestore:Completed"
861
+ | "s3:ObjectRestore:Delete"
862
+ | "s3:ReducedRedundancyLostObject"
863
+ | "s3:Replication:*"
864
+ | "s3:Replication:OperationFailedReplication"
865
+ | "s3:Replication:OperationMissedThreshold"
866
+ | "s3:Replication:OperationReplicatedAfterThreshold"
867
+ | "s3:Replication:OperationNotTracked"
868
+ | "s3:LifecycleExpiration:*"
869
+ | "s3:LifecycleExpiration:Delete"
870
+ | "s3:LifecycleExpiration:DeleteMarkerCreated"
871
+ | "s3:LifecycleTransition"
872
+ | "s3:IntelligentTiering"
873
+ | "s3:ObjectTagging:*"
874
+ | "s3:ObjectTagging:Put"
875
+ | "s3:ObjectTagging:Delete"
876
+ | "s3:ObjectAcl:Put"
877
+ >[]
878
+ >;
879
+ /**
880
+ * An S3 object key prefix that will trigger the notification.
881
+ * @example
882
+ * To filter for all the objects in the `images/` folder.
883
+ * ```js
884
+ * {
885
+ * filterPrefix: "images/"
886
+ * }
887
+ * ```
888
+ */
889
+ filterPrefix?: Input<string>;
890
+ /**
891
+ * An S3 object key suffix that will trigger the notification.
892
+ * @example
893
+ * To filter for all the objects with the `.jpg` suffix.
894
+ * ```js
895
+ * {
896
+ * filterSuffix: ".jpg"
897
+ * }
898
+ * ```
899
+ */
900
+ filterSuffix?: Input<string>;
901
+ /**
902
+ * [Transform](/docs/components#transform) how this notification creates its underlying
903
+ * resources.
904
+ */
905
+ transform?: {
906
+ /**
907
+ * Transform the S3 Bucket Notification resource.
908
+ */
909
+ notification?: Transform<s3.BucketNotificationArgs>;
910
+ };
911
+ }
912
+
913
+ interface BucketRef {
914
+ ref: boolean;
915
+ bucket: s3.Bucket;
916
+ }
917
+
918
+ /**
919
+ * The `Bucket` component lets you add an [AWS S3 Bucket](https://aws.amazon.com/s3/) to
920
+ * your app.
921
+ *
922
+ * @example
923
+ *
924
+ * #### Minimal example
925
+ *
926
+ * ```ts title="sst.config.ts"
927
+ * const bucket = new sst.aws.Bucket("MyBucket");
928
+ * ```
929
+ *
930
+ * #### Public read access
931
+ *
932
+ * Enable `public` read access for all the files in the bucket. Useful for hosting public files.
933
+ *
934
+ * ```ts title="sst.config.ts"
935
+ * new sst.aws.Bucket("MyBucket", {
936
+ * access: "public"
937
+ * });
938
+ * ```
939
+ *
940
+ * #### Add a subscriber
941
+ *
942
+ * ```ts title="sst.config.ts"
943
+ * bucket.notify({
944
+ * notifications: [
945
+ * {
946
+ * name: "MySubscriber",
947
+ * function: "src/subscriber.handler"
948
+ * }
949
+ * ]
950
+ * });
951
+ * ```
952
+ *
953
+ * #### Link the bucket to a resource
954
+ *
955
+ * You can link the bucket to other resources, like a function or your Next.js app.
956
+ *
957
+ * ```ts title="sst.config.ts"
958
+ * new sst.aws.Nextjs("MyWeb", {
959
+ * link: [bucket]
960
+ * });
961
+ * ```
962
+ *
963
+ * Once linked, you can generate a pre-signed URL to upload files in your app.
964
+ *
965
+ * ```ts title="app/page.tsx" {1,7}
966
+ * import { Resource } from "sst";
967
+ * import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
968
+ * import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
969
+ *
970
+ * const command = new PutObjectCommand({
971
+ * Key: "file.txt",
972
+ * Bucket: Resource.MyBucket.name
973
+ * });
974
+ * await getSignedUrl(new S3Client({}), command);
975
+ * ```
976
+ */
977
+ export class Bucket extends Component implements Link.Linkable {
978
+ private constructorName: string;
979
+ private constructorOpts: ComponentResourceOptions;
980
+ private isSubscribed: boolean = false;
981
+ private bucket: Output<s3.Bucket>;
982
+
983
+ constructor(
984
+ name: string,
985
+ args: BucketArgs = {},
986
+ opts: ComponentResourceOptions = {},
987
+ ) {
988
+ super(__pulumiType, name, args, opts);
989
+ this.constructorName = name;
990
+ this.constructorOpts = opts;
991
+
992
+ if (args && "ref" in args) {
993
+ const ref = args as BucketRef;
994
+ this.bucket = output(ref.bucket);
995
+ return;
996
+ }
997
+
998
+ const parent = this;
999
+ // Looked up once, and only for a bucket that needs them (access "cloudfront").
1000
+ let cloudfrontScope: Output<string> | undefined;
1001
+ const getCloudfrontScope = () =>
1002
+ (cloudfrontScope ??= interpolate`arn:${getPartitionOutput({}, opts).partition}:cloudfront::${getCallerIdentityOutput({}, opts).accountId}:distribution/*`);
1003
+ const access = normalizeAccess();
1004
+ const enforceHttps = output(args.enforceHttps ?? true);
1005
+ const policyArgs = normalizePolicy();
1006
+
1007
+ const bucket = createBucket();
1008
+ createVersioning();
1009
+ const publicAccessBlock = createPublicAccess();
1010
+ const policy = createBucketPolicy();
1011
+ createCorsRule();
1012
+ createLifecycle();
1013
+
1014
+ // Ensure the policy is created when the bucket is used in another component
1015
+ // (ie. bucket.name). Also, a bucket can only have one policy. We want to ensure
1016
+ // the policy created here is created first. And SST will throw an error if
1017
+ // another policy is created after this one.
1018
+ this.bucket = policy.apply(() => bucket);
1019
+
1020
+ function normalizeAccess() {
1021
+ return all([args.public, args.access]).apply(([pub, access]) =>
1022
+ pub === true ? "public" : access,
1023
+ );
1024
+ }
1025
+
1026
+ function normalizePolicy() {
1027
+ return output(args.policy ?? []).apply((policy) =>
1028
+ policy.map((p) => ({
1029
+ ...p,
1030
+ effect:
1031
+ p.effect && p.effect.charAt(0).toUpperCase() + p.effect.slice(1),
1032
+ principals:
1033
+ p.principals === "*"
1034
+ ? [{ type: "*", identifiers: ["*"] }]
1035
+ : p.principals.map((i) => ({
1036
+ ...i,
1037
+ type: {
1038
+ aws: "AWS",
1039
+ service: "Service",
1040
+ federated: "Federated",
1041
+ canonical: "Canonical",
1042
+ }[i.type],
1043
+ })),
1044
+ paths: p.paths
1045
+ ? p.paths.map((path) => path.replace(/^\//, ""))
1046
+ : ["", "*"],
1047
+ })),
1048
+ );
1049
+ }
1050
+
1051
+ function createBucket() {
1052
+ return new s3.Bucket(
1053
+ ...transform(
1054
+ args.transform?.bucket,
1055
+ `${name}Bucket`,
1056
+ {
1057
+ forceDestroy: true,
1058
+ },
1059
+ { parent },
1060
+ ),
1061
+ );
1062
+ }
1063
+
1064
+ function createVersioning() {
1065
+ return output(args.versioning).apply((versioning) => {
1066
+ if (!versioning) return;
1067
+
1068
+ return new s3.BucketVersioning(
1069
+ ...transform(
1070
+ args.transform?.versioning,
1071
+ `${name}Versioning`,
1072
+ {
1073
+ bucket: bucket.bucket,
1074
+ versioningConfiguration: {
1075
+ status: "Enabled",
1076
+ },
1077
+ },
1078
+ { parent },
1079
+ ),
1080
+ );
1081
+ });
1082
+ }
1083
+
1084
+ function createLifecycle() {
1085
+ return output(args.lifecycle).apply((lifecycleRules) => {
1086
+ if (!lifecycleRules || lifecycleRules.length === 0) return;
1087
+
1088
+ const seenIds = new Map<string, number>();
1089
+
1090
+ const resolvedIds = lifecycleRules.map((rule, index) => {
1091
+ const rawId = rule.id ?? `${name}LifecycleRule${index}`;
1092
+ const resolvedId = rawId.trim();
1093
+
1094
+ if (resolvedId.length === 0) {
1095
+ throw new VisibleError(
1096
+ `Lifecycle rule at index ${index} has an empty or whitespace-only "id". Please provide a valid id or omit it to use the auto-generated id.`,
1097
+ );
1098
+ }
1099
+
1100
+ if (resolvedId.length > 255) {
1101
+ throw new VisibleError(
1102
+ `Lifecycle rule at index ${index} has an "id" that is ${resolvedId.length} characters long. AWS S3 lifecycle rule IDs cannot exceed 255 characters.`,
1103
+ );
1104
+ }
1105
+
1106
+ const existingIndex = seenIds.get(resolvedId);
1107
+ if (existingIndex !== undefined) {
1108
+ throw new VisibleError(
1109
+ `Lifecycle rule "id" values must be unique. The id "${resolvedId}" is used by rules at indexes ${existingIndex} and ${index}.`,
1110
+ );
1111
+ }
1112
+ seenIds.set(resolvedId, index);
1113
+
1114
+ return resolvedId;
1115
+ });
1116
+
1117
+ return new s3.BucketLifecycleConfiguration(
1118
+ ...transform(
1119
+ args.transform?.lifecycle,
1120
+ `${name}Lifecycle`,
1121
+ {
1122
+ bucket: bucket.bucket,
1123
+ rules: lifecycleRules.map((rule, index) => ({
1124
+ id: resolvedIds[index],
1125
+ status: rule.enabled !== false ? "Enabled" : "Disabled",
1126
+ expiration:
1127
+ rule.expiresIn || rule.expiresAt
1128
+ ? {
1129
+ days: rule.expiresIn
1130
+ ? toSeconds(rule.expiresIn) / 86400
1131
+ : undefined,
1132
+ date: rule.expiresAt
1133
+ ? `${rule.expiresAt}T00:00:00Z`
1134
+ : undefined,
1135
+ }
1136
+ : undefined,
1137
+ filter: rule.prefix ? { prefix: rule.prefix } : undefined,
1138
+ })),
1139
+ },
1140
+ { parent },
1141
+ ),
1142
+ );
1143
+ });
1144
+ }
1145
+
1146
+ function createPublicAccess() {
1147
+ if (args.transform?.publicAccessBlock === false) return;
1148
+
1149
+ return new s3.BucketPublicAccessBlock(
1150
+ ...transform(
1151
+ args.transform?.publicAccessBlock,
1152
+ `${name}PublicAccessBlock`,
1153
+ {
1154
+ bucket: bucket.bucket,
1155
+ blockPublicAcls: true,
1156
+ blockPublicPolicy: access.apply((v) => v !== "public"),
1157
+ ignorePublicAcls: true,
1158
+ restrictPublicBuckets: access.apply((v) => v !== "public"),
1159
+ },
1160
+ { parent },
1161
+ ),
1162
+ );
1163
+ }
1164
+
1165
+ function createBucketPolicy() {
1166
+ return all([access, enforceHttps, policyArgs]).apply(
1167
+ ([access, enforceHttps, policyArgs]) => {
1168
+ const statements = [];
1169
+ if (access) {
1170
+ statements.push({
1171
+ principals: [
1172
+ access === "public"
1173
+ ? { type: "*", identifiers: ["*"] }
1174
+ : {
1175
+ type: "Service",
1176
+ identifiers: ["cloudfront.amazonaws.com"],
1177
+ },
1178
+ ],
1179
+ actions: ["s3:GetObject"],
1180
+ resources: [interpolate`${bucket.arn}/*`],
1181
+ // Without a condition, a distribution in any AWS account could
1182
+ // read the bucket through its own Origin Access Control.
1183
+ conditions:
1184
+ access === "public"
1185
+ ? undefined
1186
+ : [
1187
+ {
1188
+ test: "StringLike",
1189
+ variable: "aws:SourceArn",
1190
+ values: [getCloudfrontScope()],
1191
+ },
1192
+ ],
1193
+ });
1194
+ }
1195
+ if (enforceHttps) {
1196
+ statements.push({
1197
+ effect: "Deny",
1198
+ principals: [{ type: "*", identifiers: ["*"] }],
1199
+ actions: ["s3:*"],
1200
+ resources: [bucket.arn, interpolate`${bucket.arn}/*`],
1201
+ conditions: [
1202
+ {
1203
+ test: "Bool",
1204
+ variable: "aws:SecureTransport",
1205
+ values: ["false"],
1206
+ },
1207
+ ],
1208
+ });
1209
+ }
1210
+ statements.push(
1211
+ ...policyArgs.map((policy) => ({
1212
+ effect: policy.effect,
1213
+ principals: policy.principals,
1214
+ actions: policy.actions,
1215
+ conditions: policy.conditions,
1216
+ resources: policy.paths.map((path) =>
1217
+ path === "" ? bucket.arn : interpolate`${bucket.arn}/${path}`,
1218
+ ),
1219
+ })),
1220
+ );
1221
+
1222
+ return new s3.BucketPolicy(
1223
+ ...transform(
1224
+ args.transform?.policy,
1225
+ `${name}Policy`,
1226
+ {
1227
+ bucket: bucket.bucket,
1228
+ policy: iam.getPolicyDocumentOutput({ statements }).json,
1229
+ },
1230
+ {
1231
+ parent,
1232
+ dependsOn: publicAccessBlock,
1233
+ },
1234
+ ),
1235
+ );
1236
+ },
1237
+ );
1238
+ }
1239
+
1240
+ function createCorsRule() {
1241
+ return output(args.cors).apply((cors) => {
1242
+ if (cors === false) return;
1243
+
1244
+ return new s3.BucketCorsConfiguration(
1245
+ ...transform(
1246
+ args.transform?.cors,
1247
+ `${name}Cors`,
1248
+ {
1249
+ bucket: bucket.bucket,
1250
+ corsRules: [
1251
+ {
1252
+ allowedHeaders: cors?.allowHeaders ?? ["*"],
1253
+ allowedMethods: cors?.allowMethods ?? [
1254
+ "DELETE",
1255
+ "GET",
1256
+ "HEAD",
1257
+ "POST",
1258
+ "PUT",
1259
+ ],
1260
+ allowedOrigins: cors?.allowOrigins ?? ["*"],
1261
+ exposeHeaders: cors?.exposeHeaders ?? ["ETag"],
1262
+ maxAgeSeconds: toSeconds(cors?.maxAge ?? "0 seconds"),
1263
+ },
1264
+ ],
1265
+ },
1266
+ { parent },
1267
+ ),
1268
+ );
1269
+ });
1270
+ }
1271
+ }
1272
+
1273
+ /**
1274
+ * The generated name of the S3 Bucket.
1275
+ */
1276
+ public get name() {
1277
+ return this.bucket.bucket;
1278
+ }
1279
+
1280
+ /**
1281
+ * The domain name of the bucket. Has the format `${bucketName}.s3.amazonaws.com`.
1282
+ */
1283
+ public get domain() {
1284
+ return this.bucket.bucketDomainName;
1285
+ }
1286
+
1287
+ /**
1288
+ * The ARN of the S3 Bucket.
1289
+ */
1290
+ public get arn() {
1291
+ return this.bucket.arn;
1292
+ }
1293
+
1294
+ /**
1295
+ * The underlying [resources](/docs/components/#nodes) this component creates.
1296
+ */
1297
+ public get nodes() {
1298
+ return {
1299
+ /**
1300
+ * The Amazon S3 bucket.
1301
+ */
1302
+ bucket: this.bucket,
1303
+ };
1304
+ }
1305
+
1306
+ /**
1307
+ * Reference an existing bucket with the given bucket name. This is useful when you
1308
+ * create a bucket in one stage and want to share it in another stage. It avoids having to
1309
+ * create a new bucket in the other stage.
1310
+ *
1311
+ * :::tip
1312
+ * You can use the `static get` method to share buckets across stages.
1313
+ * :::
1314
+ *
1315
+ * @param name The name of the component.
1316
+ * @param bucketName The name of the existing S3 Bucket.
1317
+ * @param opts Resource options.
1318
+ *
1319
+ * @example
1320
+ * Imagine you create a bucket in the `dev` stage. And in your personal stage `frank`,
1321
+ * instead of creating a new bucket, you want to share the bucket from `dev`.
1322
+ *
1323
+ * ```ts title="sst.config.ts"
1324
+ * const bucket = $app.stage === "frank"
1325
+ * ? sst.aws.Bucket.get("MyBucket", "app-dev-mybucket-12345678")
1326
+ * : new sst.aws.Bucket("MyBucket");
1327
+ * ```
1328
+ *
1329
+ * Here `app-dev-mybucket-12345678` is the auto-generated bucket name for the bucket created
1330
+ * in the `dev` stage. You can find this by outputting the bucket name in the `dev` stage.
1331
+ *
1332
+ * ```ts title="sst.config.ts"
1333
+ * return {
1334
+ * bucket: bucket.name
1335
+ * };
1336
+ * ```
1337
+ */
1338
+ public static get(
1339
+ name: string,
1340
+ bucketName: string,
1341
+ opts?: ComponentResourceOptions,
1342
+ ) {
1343
+ return new Bucket(name, {
1344
+ ref: true,
1345
+ bucket: s3.Bucket.get(`${name}Bucket`, bucketName, undefined, opts),
1346
+ } as BucketArgs);
1347
+ }
1348
+
1349
+ /**
1350
+ * Subscribe to event notifications from this bucket. You can subscribe to these
1351
+ * notifications with a function, a queue, or a topic.
1352
+ *
1353
+ * @param args The config for the event notifications.
1354
+ *
1355
+ * @example
1356
+ *
1357
+ * For exmaple, to notify a function:
1358
+ *
1359
+ * ```js title="sst.config.ts" {5}
1360
+ * bucket.notify({
1361
+ * notifications: [
1362
+ * {
1363
+ * name: "MySubscriber",
1364
+ * function: "src/subscriber.handler"
1365
+ * }
1366
+ * ]
1367
+ * });
1368
+ * ```
1369
+ *
1370
+ * Or let's say you have a queue.
1371
+ *
1372
+ * ```js title="sst.config.ts"
1373
+ * const myQueue = new sst.aws.Queue("MyQueue");
1374
+ * ```
1375
+ *
1376
+ * You can notify it by passing in the queue.
1377
+ *
1378
+ * ```js title="sst.config.ts" {5}
1379
+ * bucket.notify({
1380
+ * notifications: [
1381
+ * {
1382
+ * name: "MySubscriber",
1383
+ * queue: myQueue
1384
+ * }
1385
+ * ]
1386
+ * });
1387
+ * ```
1388
+ *
1389
+ * Or let's say you have a topic.
1390
+ *
1391
+ * ```js title="sst.config.ts"
1392
+ * const myTopic = new sst.aws.SnsTopic("MyTopic");
1393
+ * ```
1394
+ *
1395
+ * You can notify it by passing in the topic.
1396
+ *
1397
+ * ```js title="sst.config.ts" {5}
1398
+ * bucket.notify({
1399
+ * notifications: [
1400
+ * {
1401
+ * name: "MySubscriber",
1402
+ * topic: myTopic
1403
+ * }
1404
+ * ]
1405
+ * });
1406
+ * ```
1407
+ *
1408
+ * Or enable EventBridge notifications for this bucket. This publishes S3 events
1409
+ * to the account's default EventBridge bus.
1410
+ *
1411
+ * ```js title="sst.config.ts"
1412
+ * bucket.notify({
1413
+ * eventBridge: true
1414
+ * });
1415
+ * ```
1416
+ *
1417
+ * You can also set it to only send notifications for specific S3 events.
1418
+ *
1419
+ * ```js {6}
1420
+ * bucket.notify({
1421
+ * notifications: [
1422
+ * {
1423
+ * name: "MySubscriber",
1424
+ * function: "src/subscriber.handler",
1425
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
1426
+ * }
1427
+ * ]
1428
+ * });
1429
+ * ```
1430
+ *
1431
+ * And you can add filters to be only notified from specific files in the bucket.
1432
+ *
1433
+ * ```js {6}
1434
+ * bucket.notify({
1435
+ * notifications: [
1436
+ * {
1437
+ * name: "MySubscriber",
1438
+ * function: "src/subscriber.handler",
1439
+ * filterPrefix: "images/"
1440
+ * }
1441
+ * ]
1442
+ * });
1443
+ * ```
1444
+ */
1445
+ public notify(args: BucketNotificationsArgs) {
1446
+ if (this.isSubscribed) {
1447
+ throw new VisibleError(
1448
+ `Cannot call "notify" on the "${this.constructorName}" bucket multiple times. Calling it again will override previous notifications.`,
1449
+ );
1450
+ }
1451
+ if (!args.eventBridge && !args.notifications) {
1452
+ throw new VisibleError(
1453
+ `Cannot call "notify" on the "${this.constructorName}" bucket without notifications or EventBridge enabled.`,
1454
+ );
1455
+ }
1456
+ this.isSubscribed = true;
1457
+ const name = this.constructorName;
1458
+ const opts = this.constructorOpts;
1459
+
1460
+ return new BucketNotification(
1461
+ `${name}Notifications`,
1462
+ {
1463
+ bucket: { name: this.bucket.bucket, arn: this.bucket.arn },
1464
+ ...args,
1465
+ },
1466
+ opts,
1467
+ );
1468
+ }
1469
+
1470
+ /**
1471
+ * Subscribe to S3 EventBridge notifications from a bucket with a function. The bucket
1472
+ * is given by name, so it can be one that SST doesn't manage.
1473
+ *
1474
+ * This creates an EventBridge rule on the account's default bus, and a target for
1475
+ * it, only. The rule matches the events of that one bucket. The bucket has to publish
1476
+ * to EventBridge for it to receive anything: for a bucket in your app, that's
1477
+ * `notify({ eventBridge: true })`; for any other bucket, turn it on there.
1478
+ *
1479
+ * @param name The name of the subscription.
1480
+ * @param bucketName The name of the S3 bucket to subscribe to.
1481
+ * @param subscriber The function that'll be notified.
1482
+ * @param args Configure the subscription.
1483
+ *
1484
+ * @example
1485
+ * ```js title="sst.config.ts"
1486
+ * sst.aws.Bucket.subscribeEventBridge("Uploads", "my-bucket", "src/subscriber.handler", {
1487
+ * pattern: {
1488
+ * detailType: ["Object Created"],
1489
+ * detail: {
1490
+ * object: {
1491
+ * key: [{ prefix: "uploads/" }]
1492
+ * }
1493
+ * }
1494
+ * }
1495
+ * });
1496
+ * ```
1497
+ */
1498
+ public static subscribeEventBridge(
1499
+ name: string,
1500
+ bucketName: Input<string>,
1501
+ subscriber: Input<
1502
+ string | Workflow | Function | FunctionArgs | FunctionArn
1503
+ >,
1504
+ args: BucketEventBridgeSubscriberArgs = {},
1505
+ ) {
1506
+ return all([bucketName, args]).apply(([bucketName, args]) => {
1507
+ const bucket = logicalName(bucketName);
1508
+ const bus = cloudwatch.EventBus.get(
1509
+ `${bucket}EventBridgeSubscriber${name}DefaultBus`,
1510
+ "default",
1511
+ );
1512
+ const pattern = output(args.pattern ?? {}).apply((pattern) => {
1513
+ const detail = pattern.detail ?? {};
1514
+
1515
+ return {
1516
+ source: ["aws.s3"],
1517
+ detailType: pattern.detailType,
1518
+ detail: {
1519
+ ...detail,
1520
+ bucket: {
1521
+ ...(detail.bucket ?? {}),
1522
+ name: [bucketName],
1523
+ },
1524
+ },
1525
+ };
1526
+ });
1527
+
1528
+ return new BusLambdaSubscriber(`${bucket}EventBridgeSubscriber${name}`, {
1529
+ bus: { name: bus.name, arn: bus.arn },
1530
+ subscriber,
1531
+ ...args,
1532
+ pattern,
1533
+ });
1534
+ });
1535
+ }
1536
+
1537
+ /**
1538
+ * Subscribe to events from this bucket.
1539
+ *
1540
+ * @deprecated The `notify` function is now the recommended way to subscribe to events
1541
+ * from this bucket. It allows you to configure multiple subscribers at once. To migrate,
1542
+ * remove the current subscriber, deploy the changes, and then add the subscriber
1543
+ * back using the new `notify` function.
1544
+ *
1545
+ * @param subscriber The function that'll be notified.
1546
+ * @param args Configure the subscription.
1547
+ *
1548
+ * @example
1549
+ *
1550
+ * ```js title="sst.config.ts"
1551
+ * bucket.subscribe("src/subscriber.handler");
1552
+ * ```
1553
+ *
1554
+ * Subscribe to specific S3 events. The `link` ensures the subscriber can access the bucket.
1555
+ *
1556
+ * ```js title="sst.config.ts" "link: [bucket]"
1557
+ * bucket.subscribe({
1558
+ * handler: "src/subscriber.handler",
1559
+ * link: [bucket]
1560
+ * }, {
1561
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
1562
+ * });
1563
+ * ```
1564
+ *
1565
+ * Subscribe to specific S3 events from a specific folder.
1566
+ *
1567
+ * ```js title="sst.config.ts" {2}
1568
+ * bucket.subscribe("src/subscriber.handler", {
1569
+ * filterPrefix: "images/",
1570
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
1571
+ * });
1572
+ * ```
1573
+ *
1574
+ * Customize the subscriber function.
1575
+ *
1576
+ * ```js title="sst.config.ts"
1577
+ * bucket.subscribe({
1578
+ * handler: "src/subscriber.handler",
1579
+ * timeout: "60 seconds",
1580
+ * });
1581
+ * ```
1582
+ *
1583
+ * Or pass in the ARN of an existing Lambda function.
1584
+ *
1585
+ * ```js title="sst.config.ts"
1586
+ * bucket.subscribe("arn:aws:lambda:us-east-1:123456789012:function:my-function");
1587
+ * ```
1588
+ */
1589
+ public subscribe(
1590
+ subscriber: Input<string | FunctionArgs | FunctionArn>,
1591
+ args?: BucketSubscriberArgs,
1592
+ ) {
1593
+ this.ensureNotSubscribed();
1594
+ return Bucket._subscribeFunction(
1595
+ this.constructorName,
1596
+ this.bucket.bucket,
1597
+ this.bucket.arn,
1598
+ subscriber,
1599
+ args,
1600
+ { provider: this.constructorOpts.provider },
1601
+ );
1602
+ }
1603
+
1604
+ /**
1605
+ * Subscribe to events of an S3 bucket that was not created in your app.
1606
+ *
1607
+ * @deprecated The `notify` function is now the recommended way to subscribe to events
1608
+ * from this bucket. It allows you to configure multiple subscribers at once. To migrate,
1609
+ * remove the current subscriber, deploy the changes, and then add the subscriber
1610
+ * back using the new `notify` function.
1611
+ *
1612
+ * @param bucketArn The ARN of the S3 bucket to subscribe to.
1613
+ * @param subscriber The function that'll be notified.
1614
+ * @param args Configure the subscription.
1615
+ *
1616
+ * @example
1617
+ *
1618
+ * For example, let's say you have an existing S3 bucket with the following ARN.
1619
+ *
1620
+ * ```js title="sst.config.ts"
1621
+ * const bucketArn = "arn:aws:s3:::my-bucket";
1622
+ * ```
1623
+ *
1624
+ * You can subscribe to it by passing in the ARN.
1625
+ *
1626
+ * ```js title="sst.config.ts"
1627
+ * sst.aws.Bucket.subscribe(bucketArn, "src/subscriber.handler");
1628
+ * ```
1629
+ *
1630
+ * Subscribe to specific S3 events.
1631
+ *
1632
+ * ```js title="sst.config.ts"
1633
+ * sst.aws.Bucket.subscribe(bucketArn, "src/subscriber.handler", {
1634
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
1635
+ * });
1636
+ * ```
1637
+ *
1638
+ * Subscribe to specific S3 events from a specific folder.
1639
+ *
1640
+ * ```js title="sst.config.ts" {2}
1641
+ * sst.aws.Bucket.subscribe(bucketArn, "src/subscriber.handler", {
1642
+ * filterPrefix: "images/",
1643
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
1644
+ * });
1645
+ * ```
1646
+ *
1647
+ * Customize the subscriber function.
1648
+ *
1649
+ * ```js title="sst.config.ts"
1650
+ * sst.aws.Bucket.subscribe(bucketArn, {
1651
+ * handler: "src/subscriber.handler",
1652
+ * timeout: "60 seconds",
1653
+ * });
1654
+ * ```
1655
+ */
1656
+ public static subscribe(
1657
+ bucketArn: Input<string>,
1658
+ subscriber: Input<string | FunctionArgs | FunctionArn>,
1659
+ args?: BucketSubscriberArgs,
1660
+ ) {
1661
+ return output(bucketArn).apply((bucketArn) => {
1662
+ const bucketName = parseBucketArn(bucketArn).bucketName;
1663
+ return this._subscribeFunction(
1664
+ bucketName,
1665
+ bucketName,
1666
+ bucketArn,
1667
+ subscriber,
1668
+ args,
1669
+ );
1670
+ });
1671
+ }
1672
+
1673
+ private static _subscribeFunction(
1674
+ name: string,
1675
+ bucketName: Input<string>,
1676
+ bucketArn: Input<string>,
1677
+ subscriber: Input<string | FunctionArgs | FunctionArn>,
1678
+ args: BucketSubscriberArgs = {},
1679
+ opts: ComponentResourceOptions = {},
1680
+ ) {
1681
+ return all([bucketArn, subscriber, args]).apply(
1682
+ ([bucketArn, subscriber, args]) => {
1683
+ const subscriberId = this.buildSubscriberId(
1684
+ bucketArn,
1685
+ typeof subscriber === "string" ? subscriber : subscriber.handler,
1686
+ );
1687
+
1688
+ return new BucketLambdaSubscriber(
1689
+ `${name}Subscriber${subscriberId}`,
1690
+ {
1691
+ bucket: { name: bucketName, arn: bucketArn },
1692
+ subscriber,
1693
+ subscriberId,
1694
+ ...args,
1695
+ },
1696
+ opts,
1697
+ );
1698
+ },
1699
+ );
1700
+ }
1701
+
1702
+ /**
1703
+ * Subscribe to events from this bucket with an SQS Queue.
1704
+ *
1705
+ * @deprecated The `notify` function is now the recommended way to subscribe to events
1706
+ * from this bucket. It allows you to configure multiple subscribers at once. To migrate,
1707
+ * remove the current subscriber, deploy the changes, and then add the subscriber
1708
+ * back using the new `notify` function.
1709
+ *
1710
+ * @param queueArn The ARN of the queue that'll be notified.
1711
+ * @param args Configure the subscription.
1712
+ *
1713
+ * @example
1714
+ *
1715
+ * For example, let's say you have a queue.
1716
+ *
1717
+ * ```js title="sst.config.ts"
1718
+ * const queue = new sst.aws.Queue("MyQueue");
1719
+ * ```
1720
+ *
1721
+ * You can subscribe to this bucket with it.
1722
+ *
1723
+ * ```js title="sst.config.ts"
1724
+ * bucket.subscribe(queue.arn);
1725
+ * ```
1726
+ *
1727
+ * Subscribe to specific S3 events.
1728
+ *
1729
+ * ```js title="sst.config.ts"
1730
+ * bucket.subscribe(queue.arn, {
1731
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
1732
+ * });
1733
+ * ```
1734
+ *
1735
+ * Subscribe to specific S3 events from a specific folder.
1736
+ *
1737
+ * ```js title="sst.config.ts" {2}
1738
+ * bucket.subscribe(queue.arn, {
1739
+ * filterPrefix: "images/",
1740
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
1741
+ * });
1742
+ * ```
1743
+ */
1744
+ public subscribeQueue(
1745
+ queueArn: Input<string>,
1746
+ args: BucketSubscriberArgs = {},
1747
+ ) {
1748
+ this.ensureNotSubscribed();
1749
+ return Bucket._subscribeQueue(
1750
+ this.constructorName,
1751
+ this.bucket.bucket,
1752
+ this.arn,
1753
+ queueArn,
1754
+ args,
1755
+ { provider: this.constructorOpts.provider },
1756
+ );
1757
+ }
1758
+
1759
+ /**
1760
+ * Subscribe to events of an S3 bucket that was not created in your app with an SQS Queue.
1761
+ *
1762
+ * @deprecated The `notify` function is now the recommended way to subscribe to events
1763
+ * from this bucket. It allows you to configure multiple subscribers at once. To migrate,
1764
+ * remove the current subscriber, deploy the changes, and then add the subscriber
1765
+ * back using the new `notify` function.
1766
+ *
1767
+ * @param bucketArn The ARN of the S3 bucket to subscribe to.
1768
+ * @param queueArn The ARN of the queue that'll be notified.
1769
+ * @param args Configure the subscription.
1770
+ *
1771
+ * @example
1772
+ *
1773
+ * For example, let's say you have an existing S3 bucket and SQS queue with the following ARNs.
1774
+ *
1775
+ * ```js title="sst.config.ts"
1776
+ * const bucketArn = "arn:aws:s3:::my-bucket";
1777
+ * const queueArn = "arn:aws:sqs:us-east-1:123456789012:MyQueue";
1778
+ * ```
1779
+ *
1780
+ * You can subscribe to the bucket with the queue.
1781
+ *
1782
+ * ```js title="sst.config.ts"
1783
+ * sst.aws.Bucket.subscribeQueue(bucketArn, queueArn);
1784
+ * ```
1785
+ *
1786
+ * Subscribe to specific S3 events.
1787
+ *
1788
+ * ```js title="sst.config.ts"
1789
+ * sst.aws.Bucket.subscribeQueue(bucketArn, queueArn, {
1790
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
1791
+ * });
1792
+ * ```
1793
+ *
1794
+ * Subscribe to specific S3 events from a specific folder.
1795
+ *
1796
+ * ```js title="sst.config.ts" {2}
1797
+ * sst.aws.Bucket.subscribeQueue(bucketArn, queueArn, {
1798
+ * filterPrefix: "images/",
1799
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
1800
+ * });
1801
+ * ```
1802
+ */
1803
+ public static subscribeQueue(
1804
+ bucketArn: Input<string>,
1805
+ queueArn: Input<string>,
1806
+ args?: BucketSubscriberArgs,
1807
+ ) {
1808
+ return output(bucketArn).apply((bucketArn) => {
1809
+ const bucketName = parseBucketArn(bucketArn).bucketName;
1810
+ return this._subscribeQueue(
1811
+ bucketName,
1812
+ bucketName,
1813
+ bucketArn,
1814
+ queueArn,
1815
+ args,
1816
+ );
1817
+ });
1818
+ }
1819
+
1820
+ private static _subscribeQueue(
1821
+ name: string,
1822
+ bucketName: Input<string>,
1823
+ bucketArn: Input<string>,
1824
+ queueArn: Input<string>,
1825
+ args: BucketSubscriberArgs = {},
1826
+ opts: ComponentResourceOptions = {},
1827
+ ) {
1828
+ return all([bucketArn, queueArn, args]).apply(
1829
+ ([bucketArn, queueArn, args]) => {
1830
+ const subscriberId = this.buildSubscriberId(bucketArn, queueArn);
1831
+
1832
+ return new BucketQueueSubscriber(
1833
+ `${name}Subscriber${subscriberId}`,
1834
+ {
1835
+ bucket: { name: bucketName, arn: bucketArn },
1836
+ queue: queueArn,
1837
+ subscriberId,
1838
+ ...args,
1839
+ },
1840
+ opts,
1841
+ );
1842
+ },
1843
+ );
1844
+ }
1845
+
1846
+ /**
1847
+ * Subscribe to events from this bucket with an SNS Topic.
1848
+ *
1849
+ * @deprecated The `notify` function is now the recommended way to subscribe to events
1850
+ * from this bucket. It allows you to configure multiple subscribers at once. To migrate,
1851
+ * remove the current subscriber, deploy the changes, and then add the subscriber
1852
+ * back using the new `notify` function.
1853
+ *
1854
+ * @param topicArn The ARN of the topic that'll be notified.
1855
+ * @param args Configure the subscription.
1856
+ *
1857
+ * @example
1858
+ *
1859
+ * For example, let's say you have a topic.
1860
+ *
1861
+ * ```js title="sst.config.ts"
1862
+ * const topic = new sst.aws.SnsTopic("MyTopic");
1863
+ * ```
1864
+ *
1865
+ * You can subscribe to this bucket with it.
1866
+ *
1867
+ * ```js title="sst.config.ts"
1868
+ * bucket.subscribe(topic.arn);
1869
+ * ```
1870
+ *
1871
+ * Subscribe to specific S3 events.
1872
+ *
1873
+ * ```js title="sst.config.ts"
1874
+ * bucket.subscribe(topic.arn, {
1875
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
1876
+ * });
1877
+ * ```
1878
+ *
1879
+ * Subscribe to specific S3 events from a specific folder.
1880
+ *
1881
+ * ```js title="sst.config.ts" {2}
1882
+ * bucket.subscribe(topic.arn, {
1883
+ * filterPrefix: "images/",
1884
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
1885
+ * });
1886
+ * ```
1887
+ */
1888
+ public subscribeTopic(
1889
+ topicArn: Input<string>,
1890
+ args: BucketSubscriberArgs = {},
1891
+ ) {
1892
+ this.ensureNotSubscribed();
1893
+ return Bucket._subscribeTopic(
1894
+ this.constructorName,
1895
+ this.bucket.bucket,
1896
+ this.arn,
1897
+ topicArn,
1898
+ args,
1899
+ { provider: this.constructorOpts.provider },
1900
+ );
1901
+ }
1902
+
1903
+ /**
1904
+ * Subscribe to events of an S3 bucket that was not created in your app with an SNS Topic.
1905
+ *
1906
+ * @deprecated The `notify` function is now the recommended way to subscribe to events
1907
+ * from this bucket. It allows you to configure multiple subscribers at once. To migrate,
1908
+ * remove the current subscriber, deploy the changes, and then add the subscriber
1909
+ * back using the new `notify` function.
1910
+ *
1911
+ * @param bucketArn The ARN of the S3 bucket to subscribe to.
1912
+ * @param topicArn The ARN of the topic that'll be notified.
1913
+ * @param args Configure the subscription.
1914
+ *
1915
+ * @example
1916
+ *
1917
+ * For example, let's say you have an existing S3 bucket and SNS topic with the following ARNs.
1918
+ *
1919
+ * ```js title="sst.config.ts"
1920
+ * const bucketArn = "arn:aws:s3:::my-bucket";
1921
+ * const topicArn = "arn:aws:sns:us-east-1:123456789012:MyTopic";
1922
+ * ```
1923
+ *
1924
+ * You can subscribe to the bucket with the topic.
1925
+ *
1926
+ * ```js title="sst.config.ts"
1927
+ * sst.aws.Bucket.subscribe(bucketArn, topicArn);
1928
+ * ```
1929
+ *
1930
+ * Subscribe to specific S3 events.
1931
+ *
1932
+ * ```js title="sst.config.ts"
1933
+ * sst.aws.Bucket.subscribe(bucketArn, topicArn, {
1934
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
1935
+ * });
1936
+ * ```
1937
+ *
1938
+ * Subscribe to specific S3 events from a specific folder.
1939
+ *
1940
+ * ```js title="sst.config.ts" {2}
1941
+ * sst.aws.Bucket.subscribe(bucketArn, topicArn, {
1942
+ * filterPrefix: "images/",
1943
+ * events: ["s3:ObjectCreated:*", "s3:ObjectRemoved:*"]
1944
+ * });
1945
+ * ```
1946
+ */
1947
+ public static subscribeTopic(
1948
+ bucketArn: Input<string>,
1949
+ topicArn: Input<string>,
1950
+ args?: BucketSubscriberArgs,
1951
+ ) {
1952
+ return output(bucketArn).apply((bucketArn) => {
1953
+ const bucketName = parseBucketArn(bucketArn).bucketName;
1954
+ return this._subscribeTopic(
1955
+ bucketName,
1956
+ bucketName,
1957
+ bucketArn,
1958
+ topicArn,
1959
+ args,
1960
+ );
1961
+ });
1962
+ }
1963
+
1964
+ private static _subscribeTopic(
1965
+ name: string,
1966
+ bucketName: Input<string>,
1967
+ bucketArn: Input<string>,
1968
+ topicArn: Input<string>,
1969
+ args: BucketSubscriberArgs = {},
1970
+ opts: ComponentResourceOptions = {},
1971
+ ) {
1972
+ return all([bucketArn, topicArn, args]).apply(
1973
+ ([bucketArn, topicArn, args]) => {
1974
+ const subscriberId = this.buildSubscriberId(bucketArn, topicArn);
1975
+
1976
+ return new BucketTopicSubscriber(
1977
+ `${name}Subscriber${subscriberId}`,
1978
+ {
1979
+ bucket: { name: bucketName, arn: bucketArn },
1980
+ topic: topicArn,
1981
+ subscriberId,
1982
+ ...args,
1983
+ },
1984
+ opts,
1985
+ );
1986
+ },
1987
+ );
1988
+ }
1989
+
1990
+ private static buildSubscriberId(bucketArn: string, _discriminator: string) {
1991
+ return logicalName(
1992
+ hashStringToPrettyString(
1993
+ [
1994
+ bucketArn,
1995
+ // Temporarily only allowing one subscriber per bucket because of the
1996
+ // AWS/Terraform issue that appending/removing a notification deletes
1997
+ // all existing notifications.
1998
+ //
1999
+ // A solution would be to implement a dynamic provider. On create,
2000
+ // get existing notifications then append. And on delete, get existing
2001
+ // notifications then remove from the list.
2002
+ //
2003
+ // https://github.com/hashicorp/terraform-provider-aws/issues/501
2004
+ //
2005
+ // Commenting out the lines below to ensure the id never changes.
2006
+ // Because on id change, the removal of notification happens after
2007
+ // the creation of notification. And the newly created notification
2008
+ // gets removed.
2009
+
2010
+ //...events,
2011
+ //args.filterPrefix ?? "",
2012
+ //args.filterSuffix ?? "",
2013
+ //discriminator,
2014
+ ].join(""),
2015
+ 6,
2016
+ ),
2017
+ );
2018
+ }
2019
+
2020
+ private ensureNotSubscribed() {
2021
+ if (this.isSubscribed)
2022
+ throw new VisibleError(
2023
+ `Cannot subscribe to the "${this.constructorName}" bucket multiple times. An S3 bucket can only have one subscriber.`,
2024
+ );
2025
+ this.isSubscribed = true;
2026
+ }
2027
+
2028
+ /** @internal */
2029
+ public getSSTLink() {
2030
+ return {
2031
+ properties: {
2032
+ name: this.name,
2033
+ },
2034
+ include: [
2035
+ permission({
2036
+ actions: ["s3:*"],
2037
+ resources: [this.arn, interpolate`${this.arn}/*`],
2038
+ }),
2039
+ ],
2040
+ };
2041
+ }
2042
+ }
2043
+
2044
+ const __pulumiType = "sst:aws:Bucket";
2045
+ // @ts-expect-error
2046
+ Bucket.__pulumiType = __pulumiType;