@sst-community/sst 4.20.0 → 5.0.0-alpha.1

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 +92 -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-ONNI4XNK.js +367 -0
  8. package/platform/js/chunks/chunk-ONNI4XNK.js.map +6 -0
  9. package/platform/js/chunks/chunk-VIFHC73J.js +108 -0
  10. package/platform/js/chunks/chunk-VIFHC73J.js.map +6 -0
  11. package/platform/js/chunks/chunk-WJ6BVA46.js +10 -0
  12. package/platform/js/chunks/chunk-WJ6BVA46.js.map +6 -0
  13. package/platform/js/chunks/chunk-ZOXXXME5.js +472 -0
  14. package/platform/js/chunks/chunk-ZOXXXME5.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-DMGMTLNB.js +10 -0
  18. package/platform/js/chunks/config-DMGMTLNB.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 +35362 -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 +3227 -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 +202 -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 +1047 -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 +3281 -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 +1527 -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 +1460 -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 +1755 -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 +525 -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 +1754 -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 +582 -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 +241 -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 +1437 -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,3227 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { toPosix } from "../path.js";
4
+ import crypto from "crypto";
5
+ import archiver from "archiver";
6
+ import type { Loader } from "esbuild";
7
+ import type { EsbuildOptions } from "../esbuild.js";
8
+ import { glob } from "glob";
9
+ import {
10
+ all,
11
+ asset,
12
+ ComponentResourceOptions,
13
+ interpolate,
14
+ Output,
15
+ output,
16
+ secret,
17
+ unsecret,
18
+ rootStackResource,
19
+ } from "@pulumi/pulumi";
20
+ import { bootstrap } from "./helpers/bootstrap.js";
21
+ import {
22
+ Duration,
23
+ DurationDays,
24
+ DurationMinutes,
25
+ toDays,
26
+ toSeconds,
27
+ } from "../duration.js";
28
+ import { Size, toMBs } from "../size.js";
29
+ import { Component, Prettify, Transform, transform } from "../component.js";
30
+ import { Link } from "../link.js";
31
+ import { VisibleError } from "../error.js";
32
+ import type { Input } from "../input.js";
33
+ import { logicalName, physicalName } from "../naming.js";
34
+ import { RETENTION } from "./logging.js";
35
+ import {
36
+ cloudwatch,
37
+ ecr,
38
+ getCallerIdentityOutput,
39
+ getPartitionOutput,
40
+ getRegionOutput,
41
+ iam,
42
+ lambda,
43
+ s3,
44
+ types,
45
+ } from "@pulumi/aws";
46
+ import { Permission, permission } from "./permission.js";
47
+ import { Vpc } from "./vpc.js";
48
+ import { Image } from "@pulumi/docker-build";
49
+ import { rpc } from "../rpc/rpc.js";
50
+ import { parseRoleArn, splitQualifiedFunctionArn } from "./helpers/arn.js";
51
+ import { RandomBytes } from "@pulumi/random";
52
+ import { lazy } from "../../util/lazy.js";
53
+ import { Efs } from "./efs.js";
54
+ import { FunctionEnvironmentUpdate } from "./providers/function-environment-update.js";
55
+ import { warnOnce } from "../../util/warn.js";
56
+ import {
57
+ normalizeRouteArgs,
58
+ RouterRouteArgs,
59
+ RouterRouteArgsDeprecated,
60
+ } from "./router.js";
61
+ import { KvRoutesUpdate } from "./providers/kv-routes-update.js";
62
+ import { KvKeys } from "./providers/kv-keys.js";
63
+
64
+ /**
65
+ * Helper type to define function ARN type
66
+ */
67
+ export type FunctionArn = `arn:${string}` & {};
68
+
69
+ export type FunctionPermissionArgs = {
70
+ /**
71
+ * Configures whether the permission is allowed or denied.
72
+ * @default `"allow"`
73
+ * @example
74
+ * ```ts
75
+ * {
76
+ * effect: "deny"
77
+ * }
78
+ * ```
79
+ */
80
+ effect?: "allow" | "deny";
81
+ /**
82
+ * The [IAM actions](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html#actions_table) that can be performed.
83
+ * @example
84
+ * ```js
85
+ * {
86
+ * actions: ["s3:*"]
87
+ * }
88
+ * ```
89
+ */
90
+ actions: string[];
91
+ /**
92
+ * The resourcess specified using the [IAM ARN format](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html).
93
+ * @example
94
+ * ```js
95
+ * {
96
+ * resources: ["arn:aws:s3:::my-bucket/*"]
97
+ * }
98
+ * ```
99
+ */
100
+ resources: Input<Input<string>[]>;
101
+ /**
102
+ * Configure specific conditions for when the policy is in effect.
103
+ *
104
+ * @example
105
+ * ```js
106
+ * {
107
+ * conditions: [
108
+ * {
109
+ * test: "StringEquals",
110
+ * variable: "s3:x-amz-server-side-encryption",
111
+ * values: ["AES256"]
112
+ * },
113
+ * {
114
+ * test: "IpAddress",
115
+ * variable: "aws:SourceIp",
116
+ * values: ["10.0.0.0/16"]
117
+ * }
118
+ * ]
119
+ * }
120
+ * ```
121
+ */
122
+ conditions?: Input<
123
+ Input<{
124
+ /**
125
+ * Name of the [IAM condition operator](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html) to evaluate.
126
+ */
127
+ test: Input<string>;
128
+ /**
129
+ * 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.
130
+ */
131
+ variable: Input<string>;
132
+ /**
133
+ * 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.
134
+ */
135
+ values: Input<Input<string>[]>;
136
+ }>[]
137
+ >;
138
+ };
139
+
140
+ interface FunctionUrlCorsArgs {
141
+ /**
142
+ * Allow cookies or other credentials in requests to the function URL.
143
+ * @default `false`
144
+ * @example
145
+ * ```js
146
+ * {
147
+ * url: {
148
+ * cors: {
149
+ * allowCredentials: true
150
+ * }
151
+ * }
152
+ * }
153
+ * ```
154
+ */
155
+ allowCredentials?: Input<boolean>;
156
+ /**
157
+ * The HTTP headers that origins can include in requests to the function URL.
158
+ * @default `["*"]`
159
+ * @example
160
+ * ```js
161
+ * {
162
+ * url: {
163
+ * cors: {
164
+ * allowHeaders: ["date", "keep-alive", "x-custom-header"]
165
+ * }
166
+ * }
167
+ * }
168
+ * ```
169
+ */
170
+ allowHeaders?: Input<Input<string>[]>;
171
+ /**
172
+ * The origins that can access the function URL.
173
+ * @default `["*"]`
174
+ * @example
175
+ * ```js
176
+ * {
177
+ * url: {
178
+ * cors: {
179
+ * allowOrigins: ["https://www.example.com", "http://localhost:60905"]
180
+ * }
181
+ * }
182
+ * }
183
+ * ```
184
+ * Or the wildcard for all origins.
185
+ * ```js
186
+ * {
187
+ * url: {
188
+ * cors: {
189
+ * allowOrigins: ["*"]
190
+ * }
191
+ * }
192
+ * }
193
+ * ```
194
+ */
195
+ allowOrigins?: Input<Input<string>[]>;
196
+ /**
197
+ * The HTTP methods that are allowed when calling the function URL.
198
+ * @default `["*"]`
199
+ * @example
200
+ * ```js
201
+ * {
202
+ * url: {
203
+ * cors: {
204
+ * allowMethods: ["GET", "POST", "DELETE"]
205
+ * }
206
+ * }
207
+ * }
208
+ * ```
209
+ * Or the wildcard for all methods.
210
+ * ```js
211
+ * {
212
+ * url: {
213
+ * cors: {
214
+ * allowMethods: ["*"]
215
+ * }
216
+ * }
217
+ * }
218
+ * ```
219
+ */
220
+ allowMethods?: Input<
221
+ Input<
222
+ "*" | "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT"
223
+ >[]
224
+ >;
225
+ /**
226
+ * The HTTP headers you want to expose in your function to an origin that calls the function URL.
227
+ * @default `[]`
228
+ * @example
229
+ * ```js
230
+ * {
231
+ * url: {
232
+ * cors: {
233
+ * exposeHeaders: ["date", "keep-alive", "x-custom-header"]
234
+ * }
235
+ * }
236
+ * }
237
+ * ```
238
+ */
239
+ exposeHeaders?: Input<Input<string>[]>;
240
+ /**
241
+ * The maximum amount of time the browser can cache results of a preflight request. By
242
+ * default the browser doesn't cache the results. The maximum value is `86400 seconds` or `1 day`.
243
+ * @default `"0 seconds"`
244
+ * @example
245
+ * ```js
246
+ * {
247
+ * url: {
248
+ * cors: {
249
+ * maxAge: "1 day"
250
+ * }
251
+ * }
252
+ * }
253
+ * ```
254
+ */
255
+ maxAge?: Input<Duration>;
256
+ }
257
+
258
+ export interface FunctionArgs {
259
+ /**
260
+ * Disable running this function [Live](/docs/live/) in `sst dev`.
261
+ * @deprecated Use `dev` instead.
262
+ * @default `true`
263
+ * @example
264
+ * ```js
265
+ * {
266
+ * live: false
267
+ * }
268
+ * ```
269
+ */
270
+ live?: Input<false>;
271
+ /**
272
+ * Disable running this function [_Live_](/docs/live/) in `sst dev`.
273
+ *
274
+ * By default, the functions in your app are run locally in `sst dev`. To do this, a _stub_
275
+ * version of your function is deployed, instead of the real function.
276
+ *
277
+ * :::note
278
+ * In `sst dev` a _stub_ version of your function is deployed.
279
+ * :::
280
+ *
281
+ * In `sst dev` the role that SST creates for the function also trusts the root of your AWS
282
+ * account, so you can assume it from your machine. A deployed role trusts only Lambda. If
283
+ * you run `sst dev` on a stage that is also deployed, the account root is added back to
284
+ * the role until the next `sst deploy`, so each switch updates the role.
285
+ *
286
+ * This shows under the **Functions** tab in the multiplexer sidebar where your invocations
287
+ * are logged. You can turn this off by setting `dev` to `false`.
288
+ *
289
+ * Read more about [Live](/docs/live/) and [`sst dev`](/docs/reference/cli/#dev).
290
+ *
291
+ * @default `true`
292
+ * @example
293
+ * ```js
294
+ * {
295
+ * dev: false
296
+ * }
297
+ * ```
298
+ */
299
+ dev?: Input<false>;
300
+ /**
301
+ * Configure the maximum number of retry attempts for this function when invoked
302
+ * asynchronously.
303
+ *
304
+ * This only affects asynchronous invocations of the function, ie. when subscribed to
305
+ * Topics, EventBuses, or Buckets. And not when directly invoking the function.
306
+ *
307
+ * Valid values are between 0 and 2.
308
+ *
309
+ * @default `2`
310
+ * @example
311
+ * ```js
312
+ * {
313
+ * retries: 0
314
+ * }
315
+ * ```
316
+ */
317
+ retries?: Input<number>;
318
+ /**
319
+ * The name for the function.
320
+ *
321
+ * By default, the name is generated from the app name, stage name, and component name. This
322
+ * is displayed in the AWS Console for this function.
323
+ *
324
+ * :::caution
325
+ * To avoid the name from thrashing, you want to make sure that it includes the app and stage
326
+ * name.
327
+ * :::
328
+ *
329
+ * If you are going to set the name, you need to make sure:
330
+ * 1. It's unique across your app.
331
+ * 2. Uses the app and stage name, so it doesn't thrash when you deploy to different stages.
332
+ *
333
+ * Also, changing the name after your've deployed it once will create a new function and delete
334
+ * the old one.
335
+ *
336
+ * @example
337
+ * ```js
338
+ * {
339
+ * name: `${$app.name}-${$app.stage}-my-function`
340
+ * }
341
+ * ```
342
+ */
343
+ name?: Input<string>;
344
+ /**
345
+ * A description for the function. This is displayed in the AWS Console.
346
+ * @example
347
+ * ```js
348
+ * {
349
+ * description: "Handler function for my nightly cron job."
350
+ * }
351
+ * ```
352
+ */
353
+ description?: Input<string>;
354
+ /**
355
+ * The language runtime for the function.
356
+ *
357
+ * Node.js and Golang are officially supported. While, Python and Rust are
358
+ * community supported. Support for other runtimes are on the roadmap.
359
+ *
360
+ * @default `"nodejs24.x"`
361
+ *
362
+ * @example
363
+ * ```js
364
+ * {
365
+ * runtime: "nodejs24.x"
366
+ * }
367
+ * ```
368
+ */
369
+ runtime?: Input<
370
+ | "nodejs18.x"
371
+ | "nodejs20.x"
372
+ | "nodejs22.x"
373
+ | "nodejs24.x"
374
+ | "go"
375
+ | "rust"
376
+ | "provided.al2"
377
+ | "provided.al2023"
378
+ | "python3.9"
379
+ | "python3.10"
380
+ | "python3.11"
381
+ | "python3.12"
382
+ | "python3.13"
383
+ | "python3.14"
384
+ >;
385
+ /**
386
+ * Path to the source code directory for the function. By default, the handler is
387
+ * bundled with [esbuild](https://esbuild.github.io/). Use `bundle` to skip bundling.
388
+ *
389
+ * :::caution
390
+ * Use `bundle` only when you want to bundle the function yourself.
391
+ * :::
392
+ *
393
+ * If the `bundle` option is specified, the `handler` needs to be in the root of the bundle.
394
+ *
395
+ * :::note
396
+ * SST writes the linked resources of each function to `.sst/<function name>/resource.enc`
397
+ * inside the bundle directory, so functions that share a bundle don't overwrite each
398
+ * other. Each function's zip only includes its own folder from `.sst`. Don't keep your
399
+ * own files in a `.sst` folder or a `resource.enc` file at the root of the bundle, they are
400
+ * left out of the zip.
401
+ * :::
402
+ *
403
+ * @example
404
+ *
405
+ * Here, the entire `packages/functions/src` directory is zipped, except for the
406
+ * `.sst` folders of other functions and any `resource.enc` at the root. And the handler is
407
+ * in the `src` directory.
408
+ *
409
+ * ```js
410
+ * {
411
+ * bundle: "packages/functions/src",
412
+ * handler: "index.handler"
413
+ * }
414
+ * ```
415
+ */
416
+ bundle?: Input<string>;
417
+ /**
418
+ * Path to the handler for the function.
419
+ *
420
+ * - For Node.js this is in the format `{path}/{file}.{method}`.
421
+ * - For Python this is also `{path}/{file}.{method}`.
422
+ * - For Golang this is `{path}` to the Go module.
423
+ * - For Rust this is `{path}` to the Rust crate.
424
+ *
425
+ * @example
426
+ *
427
+ * ##### Node.js
428
+ *
429
+ * For example with Node.js you might have.
430
+ *
431
+ * ```js
432
+ * {
433
+ * handler: "packages/functions/src/main.handler"
434
+ * }
435
+ * ```
436
+ *
437
+ * Where `packages/functions/src` is the path. And `main` is the file, where you might have
438
+ * a `main.ts` or `main.js`. And `handler` is the method exported in that file.
439
+ *
440
+ * :::note
441
+ * You don't need to specify the file extension.
442
+ * :::
443
+ *
444
+ * If `bundle` is specified, the handler needs to be in the root of the bundle directory.
445
+ *
446
+ * ```js
447
+ * {
448
+ * bundle: "packages/functions/src",
449
+ * handler: "index.handler"
450
+ * }
451
+ * ```
452
+ *
453
+ * ##### Python
454
+ *
455
+ * SST uses [uv](https://docs.astral.sh/uv/) to package the function.
456
+ * You need to have it installed.
457
+ *
458
+ * :::note
459
+ * You need uv installed for Python functions.
460
+ * :::
461
+ *
462
+ * Your handler must live in a [uv workspace](https://docs.astral.sh/uv/concepts/projects/workspaces/)
463
+ * with a `pyproject.toml`. Match the Python version to your Lambda runtime.
464
+ *
465
+ * ```toml title="pyproject.toml"
466
+ * [project]
467
+ * name = "my-project"
468
+ * requires-python = "==3.11.*"
469
+ * ```
470
+ *
471
+ * Install your packages before starting `sst dev`:
472
+ *
473
+ * ```bash
474
+ * uv sync --all-packages
475
+ * ```
476
+ *
477
+ * Use absolute imports within your package.
478
+ *
479
+ * ```python
480
+ * from mypackage.utils import helper
481
+ * ```
482
+ *
483
+ * Avoid relative imports — they can fail in Lambda. Make sure package directories have `__init__.py`.
484
+ *
485
+ * Access static files relative to `__file__`.
486
+ *
487
+ * ```python
488
+ * from pathlib import Path
489
+ * config = Path(__file__).parent / "config.json"
490
+ * ```
491
+ *
492
+ * For large dependencies like numpy or pandas, deploy as a container. See [`python.container`](#python-container).
493
+ *
494
+ * For common project layouts, check out the [Python examples](https://github.com/sst/sst/tree/dev/examples/python-layouts).
495
+ *
496
+ * ##### Golang
497
+ *
498
+ * For Golang the handler looks like.
499
+ *
500
+ * ```js
501
+ * {
502
+ * handler: "packages/functions/go/some_module"
503
+ * }
504
+ * ```
505
+ *
506
+ * Where `packages/functions/go/some_module` is the path to the Go module. This
507
+ * includes the name of the module in your `go.mod`. So in this case your `go.mod`
508
+ * might be in `packages/functions/go` and `some_module` is the name of the
509
+ * module.
510
+ *
511
+ * You can refer to [this example of deploying a Go function](/docs/examples/#aws-lambda-go).
512
+ *
513
+ * ##### Rust
514
+ *
515
+ * For Rust, the handler looks like.
516
+ *
517
+ * ```js
518
+ * {
519
+ * handler: "crates/api"
520
+ * }
521
+ * ```
522
+ *
523
+ * Where `crates/api` is the path to the Rust crate. This means there is a
524
+ * `Cargo.toml` file in `crates/api`, and the main() function handles the lambda.
525
+ */
526
+ handler: Input<string>;
527
+ /**
528
+ * The maximum amount of time the function can run. The minimum timeout is 1 second and the maximum is 900 seconds or 15 minutes.
529
+ *
530
+ * :::note
531
+ * If a function is connected to another service, the request will time out based on the service's limits.
532
+ * :::
533
+ *
534
+ * While the maximum timeout is 15 minutes, if a function is connected to other
535
+ * services, it'll time out based on those limits.
536
+ *
537
+ * - API Gateway has a timeout of 30 seconds. So even if the function has a
538
+ * timeout of 15 minutes, the API request will time out after 30 seconds.
539
+ * - CloudFront has a default timeout of 60 seconds. You can have this limit
540
+ * increased by [contacting AWS Support](https://console.aws.amazon.com/support/home#/case/create?issueType=service-limit-increase).
541
+ *
542
+ * @default `"20 seconds"`
543
+ * @example
544
+ * ```js
545
+ * {
546
+ * timeout: "900 seconds"
547
+ * }
548
+ * ```
549
+ */
550
+ timeout?: Input<DurationMinutes>;
551
+ /**
552
+ * The amount of memory allocated for the function. Takes values between 128 MB
553
+ * and 10240 MB in 1 MB increments. The amount of memory affects the amount of
554
+ * virtual CPU available to the function.
555
+ *
556
+ * :::tip
557
+ * While functions with less memory are cheaper, larger functions can process faster.
558
+ * And might end up being more [cost effective](https://docs.aws.amazon.com/lambda/latest/operatorguide/computing-power.html).
559
+ * :::
560
+ *
561
+ * @default `"1024 MB"`
562
+ * @example
563
+ * ```js
564
+ * {
565
+ * memory: "10240 MB"
566
+ * }
567
+ * ```
568
+ */
569
+ memory?: Input<Size>;
570
+ /**
571
+ * The amount of ephemeral storage allocated for the function. This sets the ephemeral
572
+ * storage of the lambda function (/tmp). Must be between "512 MB" and "10240 MB" ("10 GB")
573
+ * in 1 MB increments.
574
+ *
575
+ * @default `"512 MB"`
576
+ * @example
577
+ * ```js
578
+ * {
579
+ * storage: "5 GB"
580
+ * }
581
+ * ```
582
+ */
583
+ storage?: Input<Size>;
584
+ /**
585
+ * Key-value pairs of values that are set as [Lambda environment variables](https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html).
586
+ * The keys need to:
587
+ * - Start with a letter
588
+ * - Be at least 2 characters long
589
+ * - Contain only letters, numbers, or underscores
590
+ *
591
+ * They can be accessed in your function using `process.env.<key>`.
592
+ *
593
+ * :::note
594
+ * The total size of the environment variables cannot exceed 4 KB.
595
+ * :::
596
+ *
597
+ * @example
598
+ *
599
+ * ```js
600
+ * {
601
+ * environment: {
602
+ * DEBUG: "true"
603
+ * }
604
+ * }
605
+ * ```
606
+ */
607
+ environment?: Input<Record<string, Input<string>>>;
608
+ /**
609
+ * Permissions and the resources that the function needs to access. These permissions are
610
+ * used to create the function's IAM role.
611
+ *
612
+ * :::tip
613
+ * If you `link` the function to a resource, the permissions to access it are
614
+ * automatically added.
615
+ * :::
616
+ *
617
+ * @example
618
+ * Allow the function to read and write to an S3 bucket called `my-bucket`.
619
+ * ```js
620
+ * {
621
+ * permissions: [
622
+ * {
623
+ * actions: ["s3:GetObject", "s3:PutObject"],
624
+ * resources: ["arn:aws:s3:::my-bucket/*"]
625
+ * }
626
+ * ]
627
+ * }
628
+ * ```
629
+ *
630
+ * Allow the function to perform all actions on an S3 bucket called `my-bucket`.
631
+ *
632
+ * ```js
633
+ * {
634
+ * permissions: [
635
+ * {
636
+ * actions: ["s3:*"],
637
+ * resources: ["arn:aws:s3:::my-bucket/*"]
638
+ * }
639
+ * ]
640
+ * }
641
+ * ```
642
+ *
643
+ * Granting the function permissions to access all resources.
644
+ *
645
+ * ```js
646
+ * {
647
+ * permissions: [
648
+ * {
649
+ * actions: ["*"],
650
+ * resources: ["*"]
651
+ * }
652
+ * ]
653
+ * }
654
+ * ```
655
+ */
656
+ permissions?: Input<Prettify<FunctionPermissionArgs>[]>;
657
+ /**
658
+ * Policies to attach to the function. These policies will be added to the
659
+ * function's IAM role.
660
+ *
661
+ * Attaching policies lets you grant a set of predefined permissions to the
662
+ * function without having to specify the permissions in the `permissions` prop.
663
+ *
664
+ * @example
665
+ * For example, allow the function to have read-only access to all resources.
666
+ * ```js
667
+ * {
668
+ * policies: ["arn:aws:iam::aws:policy/ReadOnlyAccess"]
669
+ * }
670
+ * ```
671
+ */
672
+ policies?: Input<string[]>;
673
+ /**
674
+ * [Link resources](/docs/linking/) to your function. This will:
675
+ *
676
+ * 1. Grant the permissions needed to access the resources.
677
+ * 2. Allow you to access it in your function using the [SDK](/docs/reference/sdk/).
678
+ *
679
+ * @example
680
+ *
681
+ * Takes a list of components to link to the function.
682
+ *
683
+ * ```js
684
+ * {
685
+ * link: [bucket, stripeKey]
686
+ * }
687
+ * ```
688
+ */
689
+ link?: Input<any[]>;
690
+ /**
691
+ * Enable streaming for the function.
692
+ *
693
+ * Streaming is supported with both Function URLs and API Gateway REST API (V1). It is
694
+ * not supported with API Gateway HTTP API (V2).
695
+ *
696
+ * You'll also need to [wrap your handler](https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html) with `awslambda.streamifyResponse` to enable streaming.
697
+ *
698
+ * Check out the [AWS Lambda streaming example](/docs/examples/#aws-lambda-streaming) for more
699
+ * details.
700
+ *
701
+ * @default `false`
702
+ * @example
703
+ * ```js
704
+ * {
705
+ * streaming: true
706
+ * }
707
+ * ```
708
+ */
709
+ streaming?: Input<boolean>;
710
+ /**
711
+ * @internal
712
+ */
713
+ injections?: Input<string[]>;
714
+ /**
715
+ * Configure the function logs in CloudWatch. Or pass in `false` to disable writing logs.
716
+ * @default `{retention: "1 month", format: "text"}`
717
+ * @example
718
+ * ```js
719
+ * {
720
+ * logging: false
721
+ * }
722
+ * ```
723
+ * When set to `false`, the function is not given permissions to write to CloudWatch.
724
+ * Logs.
725
+ */
726
+ logging?: Input<
727
+ | false
728
+ | {
729
+ /**
730
+ * The duration the function logs are kept in CloudWatch.
731
+ *
732
+ * Not application when an existing log group is provided.
733
+ *
734
+ * @default `1 month`
735
+ * @example
736
+ * ```js
737
+ * {
738
+ * logging: {
739
+ * retention: "forever"
740
+ * }
741
+ * }
742
+ * ```
743
+ */
744
+ retention?: Input<keyof typeof RETENTION>;
745
+ /**
746
+ * Assigns the given CloudWatch log group name to the function. This allows you to pass in a previously created log group.
747
+ *
748
+ * By default, the function creates a new log group when it's created.
749
+ *
750
+ * @default Creates a log group
751
+ * @example
752
+ * ```js
753
+ * {
754
+ * logging: {
755
+ * logGroup: "/existing/log-group"
756
+ * }
757
+ * }
758
+ * ```
759
+ */
760
+ logGroup?: Input<string>;
761
+ /**
762
+ * The [log format](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs-advanced.html)
763
+ * of the Lambda function.
764
+ * @default `"text"`
765
+ * @example
766
+ * ```js
767
+ * {
768
+ * logging: {
769
+ * format: "json"
770
+ * }
771
+ * }
772
+ * ```
773
+ */
774
+ format?: Input<"text" | "json">;
775
+ }
776
+ >;
777
+ /**
778
+ * The [architecture](https://docs.aws.amazon.com/lambda/latest/dg/foundation-arch.html)
779
+ * of the Lambda function.
780
+ *
781
+ * @default `"x86_64"`
782
+ * @example
783
+ * ```js
784
+ * {
785
+ * architecture: "arm64"
786
+ * }
787
+ * ```
788
+ */
789
+ architecture?: Input<"x86_64" | "arm64">;
790
+ /**
791
+ * Assigns the given IAM role ARN to the function. This allows you to pass in a previously created role.
792
+ *
793
+ * :::caution
794
+ * When you pass in a role, the function will not update it if you add `permissions` or `link` resources.
795
+ * :::
796
+ *
797
+ * By default, the function creates a new IAM role when it's created. It'll update this role if you add `permissions` or `link` resources.
798
+ *
799
+ * However, if you pass in a role, you'll need to update it manually if you add `permissions` or `link` resources.
800
+ *
801
+ * @default Creates a new role
802
+ * @example
803
+ * ```js
804
+ * {
805
+ * role: "arn:aws:iam::123456789012:role/my-role"
806
+ * }
807
+ * ```
808
+ */
809
+ role?: Input<string>;
810
+ /**
811
+ * Enable [Lambda function URLs](https://docs.aws.amazon.com/lambda/latest/dg/lambda-urls.html).
812
+ * These are dedicated endpoints for your Lambda functions.
813
+ * @default `false`
814
+ * @example
815
+ * Enable it with the default options.
816
+ * ```js
817
+ * {
818
+ * url: true
819
+ * }
820
+ * ```
821
+ *
822
+ * Configure the authorization and CORS settings for the endpoint.
823
+ * ```js
824
+ * {
825
+ * url: {
826
+ * authorization: "iam",
827
+ * cors: {
828
+ * allowOrigins: ['https://example.com']
829
+ * }
830
+ * }
831
+ * }
832
+ * ```
833
+ */
834
+ url?: Input<
835
+ | boolean
836
+ | {
837
+ /**
838
+ * @deprecated The `url.router` prop is now the recommended way to serve your
839
+ * function URL through a `Router` component.
840
+ */
841
+ route?: Prettify<RouterRouteArgsDeprecated>;
842
+ /**
843
+ * Serve your function URL through a `Router` instead of a standalone Function URL.
844
+ *
845
+ * By default, this component creates a direct function URL endpoint. But you might
846
+ * want to serve it through the distribution of your `Router` as a:
847
+ *
848
+ * - A path like `/api/users`
849
+ * - A subdomain like `api.example.com`
850
+ * - Or a combined pattern like `dev.example.com/api`
851
+ *
852
+ * @example
853
+ *
854
+ * To serve your function **from a path**, you'll need to configure the root domain
855
+ * in your `Router` component.
856
+ *
857
+ * ```ts title="sst.config.ts" {2}
858
+ * const router = new sst.aws.Router("Router", {
859
+ * domain: "example.com"
860
+ * });
861
+ * ```
862
+ *
863
+ * Now set the `router` and the `path` in the `url` prop.
864
+ *
865
+ * ```ts {4,5}
866
+ * {
867
+ * url: {
868
+ * router: {
869
+ * instance: router,
870
+ * path: "/api/users"
871
+ * }
872
+ * }
873
+ * }
874
+ * ```
875
+ *
876
+ * To serve your function **from a subdomain**, you'll need to configure the
877
+ * domain in your `Router` component to match both the root and the subdomain.
878
+ *
879
+ * ```ts title="sst.config.ts" {3,4}
880
+ * const router = new sst.aws.Router("Router", {
881
+ * domain: {
882
+ * name: "example.com",
883
+ * aliases: ["*.example.com"]
884
+ * }
885
+ * });
886
+ * ```
887
+ *
888
+ * Now set the `domain` in the `router` prop.
889
+ *
890
+ * ```ts {5}
891
+ * {
892
+ * url: {
893
+ * router: {
894
+ * instance: router,
895
+ * domain: "api.example.com"
896
+ * }
897
+ * }
898
+ * }
899
+ * ```
900
+ *
901
+ * Finally, to serve your function **from a combined pattern** like
902
+ * `dev.example.com/api`, you'll need to configure the domain in your `Router` to
903
+ * match the subdomain.
904
+ *
905
+ * ```ts title="sst.config.ts" {3,4}
906
+ * const router = new sst.aws.Router("Router", {
907
+ * domain: {
908
+ * name: "example.com",
909
+ * aliases: ["*.example.com"]
910
+ * }
911
+ * });
912
+ * ```
913
+ *
914
+ * And set the `domain` and the `path`.
915
+ *
916
+ * ```ts {5,6}
917
+ * {
918
+ * url: {
919
+ * router: {
920
+ * instance: router,
921
+ * domain: "dev.example.com",
922
+ * path: "/api/users"
923
+ * }
924
+ * }
925
+ * }
926
+ * ```
927
+ */
928
+ router?: Prettify<RouterRouteArgs>;
929
+ /**
930
+ * The authorization used for the function URL. Supports [IAM authorization](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html).
931
+ * @default `"none"`
932
+ * @example
933
+ * ```js
934
+ * {
935
+ * url: {
936
+ * authorization: "iam"
937
+ * }
938
+ * }
939
+ * ```
940
+ */
941
+ authorization?: Input<"none" | "iam">;
942
+ /**
943
+ * Customize the CORS (Cross-origin resource sharing) settings for the function URL.
944
+ * @default `true`
945
+ * @example
946
+ * Disable CORS.
947
+ * ```js
948
+ * {
949
+ * url: {
950
+ * cors: false
951
+ * }
952
+ * }
953
+ * ```
954
+ * Only enable the `GET` and `POST` methods for `https://example.com`.
955
+ * ```js
956
+ * {
957
+ * url: {
958
+ * cors: {
959
+ * allowMethods: ["GET", "POST"],
960
+ * allowOrigins: ["https://example.com"]
961
+ * }
962
+ * }
963
+ * }
964
+ * ```
965
+ */
966
+ cors?: Input<boolean | Prettify<FunctionUrlCorsArgs>>;
967
+ }
968
+ >;
969
+ /**
970
+ * Configure how your function is bundled.
971
+ *
972
+ * By default, SST will bundle your function
973
+ * code using [esbuild](https://esbuild.github.io/). This tree shakes your code to
974
+ * only include what's used; reducing the size of your function package and improving
975
+ * cold starts.
976
+ */
977
+ nodejs?: Input<{
978
+ /**
979
+ * @internal
980
+ * Point to a file that exports a list of esbuild plugins to use.
981
+ *
982
+ * @example
983
+ * ```js
984
+ * {
985
+ * nodejs: {
986
+ * plugins: "./plugins.mjs"
987
+ * }
988
+ * }
989
+ * ```
990
+ *
991
+ * The path is relative to the location of the `sst.config.ts`.
992
+ *
993
+ * ```js title="plugins.mjs"
994
+ * import { somePlugin } from "some-plugin";
995
+ *
996
+ * export default [
997
+ * somePlugin()
998
+ * ];
999
+ * ```
1000
+ *
1001
+ * You'll also need to install the npm package of the plugin.
1002
+ */
1003
+ plugins?: Input<string>;
1004
+ /**
1005
+ * Configure additional esbuild loaders for other file extensions. This is useful
1006
+ * when your code is importing non-JS files like `.png`, `.css`, etc.
1007
+ *
1008
+ * @example
1009
+ * ```js
1010
+ * {
1011
+ * nodejs: {
1012
+ * loader: {
1013
+ * ".png": "file"
1014
+ * }
1015
+ * }
1016
+ * }
1017
+ * ```
1018
+ */
1019
+ loader?: Input<Record<string, Loader>>;
1020
+ /**
1021
+ * Dependencies that need to be excluded from the function package.
1022
+ *
1023
+ * Certain npm packages cannot be bundled using esbuild. This allows you to exclude them
1024
+ * from the bundle. Instead they'll be moved into a `node_modules/` directory in the
1025
+ * function package.
1026
+ *
1027
+ * :::tip
1028
+ * If esbuild is giving you an error about a package, try adding it to `install`.
1029
+ * :::
1030
+ *
1031
+ * This will allow your functions to be able to use these dependencies when deployed. They
1032
+ * just won't be tree shaken.
1033
+ *
1034
+ * :::caution
1035
+ * If you don't specify a version, the package still needs to be in your `package.json`.
1036
+ * :::
1037
+ *
1038
+ * Esbuild will ignore them while traversing the imports in your code. So these are the
1039
+ * **package names as seen in the imports**. It also works on packages that are not directly
1040
+ * imported by your code.
1041
+ *
1042
+ * @example
1043
+ * ```js
1044
+ * {
1045
+ * nodejs: {
1046
+ * install: { pg: "8.13.1" }
1047
+ * }
1048
+ * }
1049
+ * ```
1050
+ *
1051
+ * Passing `["packageName"]` is the same as passing `{ packageName: "*" }`.
1052
+ */
1053
+ install?: Input<string[] | Record<string, string>>;
1054
+ /**
1055
+ * Use this to insert a string at the beginning of the generated JS file.
1056
+ *
1057
+ * @example
1058
+ * ```js
1059
+ * {
1060
+ * nodejs: {
1061
+ * banner: "console.log('Function starting')"
1062
+ * }
1063
+ * }
1064
+ * ```
1065
+ */
1066
+ banner?: Input<string>;
1067
+ /**
1068
+ * This allows you to customize esbuild config that is used.
1069
+ *
1070
+ * :::tip
1071
+ * Check out the _JS tab_ in the code snippets in the esbuild docs for the
1072
+ * [`BuildOptions`](https://esbuild.github.io/api/#build).
1073
+ * :::
1074
+ */
1075
+ esbuild?: Input<EsbuildOptions>;
1076
+ /**
1077
+ * Disable if the function code is minified when bundled.
1078
+ *
1079
+ * @default `true`
1080
+ *
1081
+ * @example
1082
+ * ```js
1083
+ * {
1084
+ * nodejs: {
1085
+ * minify: false
1086
+ * }
1087
+ * }
1088
+ * ```
1089
+ */
1090
+ minify?: Input<boolean>;
1091
+ /**
1092
+ * Configure the format of the generated JS code; ESM or CommonJS.
1093
+ *
1094
+ * @default `"esm"`
1095
+ *
1096
+ * @example
1097
+ * ```js
1098
+ * {
1099
+ * nodejs: {
1100
+ * format: "cjs"
1101
+ * }
1102
+ * }
1103
+ * ```
1104
+ */
1105
+ format?: Input<"cjs" | "esm">;
1106
+ /**
1107
+ * Configure if source maps are added to the function bundle when **deployed**. Since they
1108
+ * increase payload size and potentially cold starts, they are not added by default.
1109
+ * However, they are always generated during `sst dev`.
1110
+ *
1111
+ * :::tip[SST Console]
1112
+ * For the [Console](/docs/console/), source maps are always generated and uploaded
1113
+ * to your bootstrap bucket. These are then downloaded and used to display
1114
+ * Issues in the console.
1115
+ * :::
1116
+ *
1117
+ * @default `false`
1118
+ *
1119
+ * @example
1120
+ * ```js
1121
+ * {
1122
+ * nodejs: {
1123
+ * sourcemap: true
1124
+ * }
1125
+ * }
1126
+ * ```
1127
+ */
1128
+ sourcemap?: Input<boolean>;
1129
+ /**
1130
+ * If enabled, modules that are dynamically imported will be bundled in their own files
1131
+ * with common dependencies placed in shared chunks. This can help reduce cold starts
1132
+ * as your function grows in size.
1133
+ *
1134
+ * @default `false`
1135
+ *
1136
+ * @example
1137
+ * ```js
1138
+ * {
1139
+ * nodejs: {
1140
+ * splitting: true
1141
+ * }
1142
+ * }
1143
+ * ```
1144
+ */
1145
+ splitting?: Input<boolean>;
1146
+ }>;
1147
+ /**
1148
+ * Configure how your Python function is packaged.
1149
+ */
1150
+ python?: Input<{
1151
+ /**
1152
+ * Set this to `true` if you want to deploy this function as a container image.
1153
+ * There are a couple of reasons why you might want to do this.
1154
+ *
1155
+ * 1. The Lambda package size has an unzipped limit of 250MB. Whereas the
1156
+ * container image size has a limit of 10GB.
1157
+ * 2. Even if you are below the 250MB limit, larger Lambda function packages
1158
+ * have longer cold starts when compared to container image.
1159
+ * 3. You might want to use a custom Dockerfile to handle complex builds.
1160
+ *
1161
+ * @default `false`
1162
+ * @example
1163
+ * ```ts
1164
+ * {
1165
+ * python: {
1166
+ * container: true
1167
+ * }
1168
+ * }
1169
+ * ```
1170
+ *
1171
+ * When you run `sst deploy`, it uses a built-in Dockerfile. It also needs
1172
+ * the Docker daemon to be running.
1173
+ *
1174
+ * :::note
1175
+ * This needs the Docker daemon to be running.
1176
+ * :::
1177
+ *
1178
+ * To use a custom Dockerfile, add one to the rooot of the uv workspace
1179
+ * of the function.
1180
+ *
1181
+ *
1182
+ * ```txt {5}
1183
+ * ├── sst.config.ts
1184
+ * ├── pyproject.toml
1185
+ * └── function
1186
+ * ├── pyproject.toml
1187
+ * ├── Dockerfile
1188
+ * └── src
1189
+ * └── function
1190
+ * └── api.py
1191
+ * ```
1192
+ *
1193
+ * You can refer to [this example of using a container image](/docs/examples/#aws-lambda-python-container).
1194
+ */
1195
+ container?: Input<
1196
+ | boolean
1197
+ | {
1198
+ /**
1199
+ * Controls whether Docker build cache is enabled.
1200
+ * @default `true`
1201
+ * @example
1202
+ * Disable Docker build caching, useful for environments like Localstack where
1203
+ * ECR cache export is not supported.
1204
+ * ```js
1205
+ * {
1206
+ * python: {
1207
+ * container: {
1208
+ * cache: false
1209
+ * }
1210
+ * }
1211
+ * }
1212
+ * ```
1213
+ */
1214
+ cache?: Input<boolean>;
1215
+ }
1216
+ >;
1217
+ }>;
1218
+ /**
1219
+ * Add additional files to copy into the function package. Takes a list of objects
1220
+ * with `from` and `to` paths. These will be copied over before the function package
1221
+ * is zipped up.
1222
+ *
1223
+ * @example
1224
+ *
1225
+ * Copying over a single file from the `src` directory to the `src/` directory of the
1226
+ * function package.
1227
+ *
1228
+ * ```js
1229
+ * {
1230
+ * copyFiles: [{ from: "src/index.js" }]
1231
+ * }
1232
+ * ```
1233
+ *
1234
+ * Copying over a single file from the `src` directory to the `core/src` directory in
1235
+ * the function package.
1236
+ *
1237
+ * ```js
1238
+ * {
1239
+ * copyFiles: [{ from: "src/index.js", to: "core/src/index.js" }]
1240
+ * }
1241
+ * ```
1242
+ *
1243
+ * Copying over a couple of files.
1244
+ *
1245
+ * ```js
1246
+ * {
1247
+ * copyFiles: [
1248
+ * { from: "src/this.js", to: "core/src/this.js" },
1249
+ * { from: "src/that.js", to: "core/src/that.js" }
1250
+ * ]
1251
+ * }
1252
+ * ```
1253
+ */
1254
+ copyFiles?: Input<
1255
+ {
1256
+ /**
1257
+ * Source path relative to the `sst.config.ts`.
1258
+ */
1259
+ from: Input<string>;
1260
+ /**
1261
+ * Destination path relative to function root in the package. By default, it
1262
+ * creates the same directory structure as the `from` path and copies the file.
1263
+ *
1264
+ * @default The `from` path in the function package
1265
+ */
1266
+ to?: Input<string>;
1267
+ }[]
1268
+ >;
1269
+ /**
1270
+ * Configure the concurrency settings for the function.
1271
+ *
1272
+ * @default No concurrency settings set
1273
+ * @example
1274
+ * ```js
1275
+ * {
1276
+ * concurrency: {
1277
+ * provisioned: 10,
1278
+ * reserved: 50
1279
+ * }
1280
+ * }
1281
+ * ```
1282
+ */
1283
+ concurrency?: Input<{
1284
+ /**
1285
+ * Provisioned concurrency ensures a specific number of Lambda instances are always
1286
+ * ready to handle requests, reducing cold start times. Enabling this will incur
1287
+ * extra charges.
1288
+ *
1289
+ * :::note
1290
+ * Enabling provisioned concurrency will incur extra charges.
1291
+ * :::
1292
+ *
1293
+ * Note that `versioning` needs to be enabled for provisioned concurrency.
1294
+ *
1295
+ * @default No provisioned concurrency
1296
+ * @example
1297
+ * ```js
1298
+ * {
1299
+ * concurrency: {
1300
+ * provisioned: 10
1301
+ * }
1302
+ * }
1303
+ * ```
1304
+ */
1305
+ provisioned?: Input<number>;
1306
+ /**
1307
+ * Reserved concurrency limits the maximum number of concurrent executions for a
1308
+ * function, ensuring critical functions always have capacity. It does not incur
1309
+ * extra charges.
1310
+ *
1311
+ * :::note
1312
+ * Setting this to `0` will disable the function from being triggered.
1313
+ * :::
1314
+ *
1315
+ * @default No reserved concurrency
1316
+ * @example
1317
+ * ```js
1318
+ * {
1319
+ * concurrency: {
1320
+ * reserved: 50
1321
+ * }
1322
+ * }
1323
+ * ```
1324
+ */
1325
+ reserved?: Input<number>;
1326
+ }>;
1327
+ /**
1328
+ * Enable versioning for the function.
1329
+ *
1330
+ * :::note
1331
+ * Durable functions enable this by default.
1332
+ * :::
1333
+ *
1334
+ * @default `false`
1335
+ * @example
1336
+ * ```js
1337
+ * {
1338
+ * versioning: true
1339
+ * }
1340
+ * ```
1341
+ */
1342
+ versioning?: Input<boolean>;
1343
+ /**
1344
+ * A list of Lambda layer ARNs to add to the function.
1345
+ *
1346
+ * :::note
1347
+ * Layers are only added when the function is deployed.
1348
+ * :::
1349
+ *
1350
+ * These are only added when the function is deployed. In `sst dev`, your functions are run
1351
+ * locally, so the layers are not used. Instead you should use a local version of what's
1352
+ * in the layer.
1353
+ *
1354
+ * @example
1355
+ * ```js
1356
+ * {
1357
+ * layers: ["arn:aws:lambda:us-east-1:123456789012:layer:my-layer:1"]
1358
+ * }
1359
+ * ```
1360
+ */
1361
+ layers?: Input<Input<string>[]>;
1362
+ /**
1363
+ * Mount an EFS file system to the function.
1364
+ *
1365
+ * @example
1366
+ * Create an EFS file system.
1367
+ *
1368
+ * ```ts title="sst.config.ts"
1369
+ * const vpc = new sst.aws.Vpc("MyVpc");
1370
+ * const fileSystem = new sst.aws.Efs("MyFileSystem", { vpc });
1371
+ * ```
1372
+ *
1373
+ * And pass it in.
1374
+ *
1375
+ * ```js
1376
+ * {
1377
+ * volume: {
1378
+ * efs: fileSystem
1379
+ * }
1380
+ * }
1381
+ * ```
1382
+ *
1383
+ * By default, the file system will be mounted to `/mnt/efs`. You can change this by
1384
+ * passing in the `path` property.
1385
+ *
1386
+ * ```js
1387
+ * {
1388
+ * volume: {
1389
+ * efs: fileSystem,
1390
+ * path: "/mnt/my-files"
1391
+ * }
1392
+ * }
1393
+ * ```
1394
+ *
1395
+ * To use an existing EFS, you can pass in an EFS access point ARN.
1396
+ *
1397
+ * ```js
1398
+ * {
1399
+ * volume: {
1400
+ * efs: "arn:aws:elasticfilesystem:us-east-1:123456789012:access-point/fsap-12345678",
1401
+ * }
1402
+ * }
1403
+ * ```
1404
+ */
1405
+ volume?: Input<{
1406
+ /**
1407
+ * The EFS file system to mount. Or an EFS access point ARN.
1408
+ */
1409
+ efs: Input<Efs | string>;
1410
+ /**
1411
+ * The path to mount the volume.
1412
+ * @default `"/mnt/efs"`
1413
+ */
1414
+ path?: Input<string>;
1415
+ }>;
1416
+ /**
1417
+ * A list of tags to add to the function.
1418
+ *
1419
+ * @example
1420
+ * ```js
1421
+ * {
1422
+ * tags: {
1423
+ * "my-tag": "my-value"
1424
+ * }
1425
+ * }
1426
+ * ```
1427
+ */
1428
+ tags?: Input<Record<string, Input<string>>>;
1429
+ /**
1430
+ * Configure the function to connect to private subnets in a virtual private cloud or VPC. This allows your function to access private resources.
1431
+ *
1432
+ * @example
1433
+ * Create a `Vpc` component.
1434
+ *
1435
+ * ```js title="sst.config.ts"
1436
+ * const myVpc = new sst.aws.Vpc("MyVpc");
1437
+ * ```
1438
+ *
1439
+ * Or reference an existing VPC.
1440
+ *
1441
+ * ```js title="sst.config.ts"
1442
+ * const myVpc = sst.aws.Vpc.get("MyVpc", "vpc-12345678901234567");
1443
+ * ```
1444
+ *
1445
+ * And pass it in.
1446
+ *
1447
+ * ```js
1448
+ * {
1449
+ * vpc: myVpc
1450
+ * }
1451
+ * ```
1452
+ */
1453
+ vpc?:
1454
+ | Vpc
1455
+ | Input<{
1456
+ /**
1457
+ * A list of VPC security group IDs.
1458
+ */
1459
+ securityGroups: Input<Input<string>[]>;
1460
+ /**
1461
+ * A list of VPC subnet IDs.
1462
+ */
1463
+ privateSubnets: Input<Input<string>[]>;
1464
+ /**
1465
+ * A list of VPC subnet IDs.
1466
+ * @deprecated Use `privateSubnets` instead.
1467
+ */
1468
+ subnets?: Input<Input<string>[]>;
1469
+ }>;
1470
+
1471
+ /**
1472
+ * Hook into the Lambda function build process.
1473
+ */
1474
+ hook?: {
1475
+ /**
1476
+ * Specify a callback that'll be run after the Lambda function is built.
1477
+ *
1478
+ * :::note
1479
+ * This is not called in `sst dev`.
1480
+ * :::
1481
+ *
1482
+ * Useful for modifying the generated Lambda function code before it's
1483
+ * deployed to AWS. It can also be used for uploading the generated sourcemaps
1484
+ * to a service like Sentry.
1485
+ *
1486
+ * @param dir The directory where the function code is generated.
1487
+ */
1488
+ postbuild(dir: string): Promise<void>;
1489
+ };
1490
+ /**
1491
+ * Configure the lambda function as a [AWS durable function](https://docs.aws.amazon.com/lambda/latest/dg/durable-functions.html).
1492
+ *
1493
+ * :::caution
1494
+ * This property is meant to be used internally by [Workflow](/docs/component/aws/workflow).
1495
+ * Prefer the component if you want to use the [SDK](/docs/component/aws/workflow#sdk) or if you are not very familiar with durable functions limitations.
1496
+ * :::
1497
+ */
1498
+ durable?:
1499
+ | boolean
1500
+ | {
1501
+ /**
1502
+ * Maximum execution time for the durable function.
1503
+ * @default `14 days`
1504
+ */
1505
+ timeout?: Input<Duration>;
1506
+ /**
1507
+ * Number of days to retain the function's execution state.
1508
+ * @default `30 days`
1509
+ */
1510
+ retention?: Input<DurationDays>;
1511
+ };
1512
+ /**
1513
+ * [Transform](/docs/components#transform) how this component creates its underlying
1514
+ * resources.
1515
+ */
1516
+ transform?: {
1517
+ /**
1518
+ * Transform the Lambda Function resource.
1519
+ */
1520
+ function?: Transform<lambda.FunctionArgs>;
1521
+ /**
1522
+ * Transform the IAM Role resource.
1523
+ */
1524
+ role?: Transform<iam.RoleArgs>;
1525
+ /**
1526
+ * Transform the CloudWatch LogGroup resource.
1527
+ */
1528
+ logGroup?: Transform<cloudwatch.LogGroupArgs>;
1529
+ /**
1530
+ * Transform the Function Event Invoke Config resource. This is only created
1531
+ * when the `retries` property is set.
1532
+ */
1533
+ eventInvokeConfig?: Transform<lambda.FunctionEventInvokeConfigArgs>;
1534
+ };
1535
+ /**
1536
+ * @internal
1537
+ */
1538
+ _skipMetadata?: boolean;
1539
+ /**
1540
+ * @internal
1541
+ */
1542
+ _skipHint?: boolean;
1543
+ }
1544
+
1545
+ /**
1546
+ * The `Function` component lets you add serverless functions to your app.
1547
+ * It uses [AWS Lambda](https://aws.amazon.com/lambda/).
1548
+ *
1549
+ * #### Supported runtimes
1550
+ *
1551
+ * Currently supports **Node.js** and **Golang** functions. **Python** and **Rust**
1552
+ * are community supported. Other runtimes are on the roadmap.
1553
+ *
1554
+ * @example
1555
+ *
1556
+ * #### Minimal example
1557
+ *
1558
+ *
1559
+ * <Tabs>
1560
+ * <TabItem label="Node">
1561
+ * Pass in the path to your handler function.
1562
+ *
1563
+ * ```ts title="sst.config.ts"
1564
+ * new sst.aws.Function("MyFunction", {
1565
+ * handler: "src/lambda.handler"
1566
+ * });
1567
+ * ```
1568
+ *
1569
+ * [Learn more below](#handler).
1570
+ * </TabItem>
1571
+ * <TabItem label="Python">
1572
+ * Pass in the path to your handler function.
1573
+ *
1574
+ * ```ts title="sst.config.ts"
1575
+ * new sst.aws.Function("MyFunction", {
1576
+ * runtime: "python3.13",
1577
+ * handler: "functions/src/functions/api.handler"
1578
+ * });
1579
+ * ```
1580
+ *
1581
+ * You need to have uv installed and your handler function needs to be in a uv workspace. [Learn more below](#handler).
1582
+ * </TabItem>
1583
+ * <TabItem label="Go">
1584
+ * Pass in the directory to your Go module.
1585
+ *
1586
+ * ```ts title="sst.config.ts"
1587
+ * new sst.aws.Function("MyFunction", {
1588
+ * runtime: "go",
1589
+ * handler: "./src"
1590
+ * });
1591
+ * ```
1592
+ *
1593
+ * [Learn more below](#handler).
1594
+ * </TabItem>
1595
+ * <TabItem label="Rust">
1596
+ * Pass in the directory where your Cargo.toml lives.
1597
+ *
1598
+ * ```ts title="sst.config.ts"
1599
+ * new sst.aws.Function("MyFunction", {
1600
+ * runtime: "rust",
1601
+ * handler: "./crates/api/"
1602
+ * });
1603
+ * ```
1604
+ *
1605
+ * [Learn more below](#handler).
1606
+ * </TabItem>
1607
+ * </Tabs>
1608
+ *
1609
+ * #### Set additional config
1610
+ *
1611
+ * Pass in additional Lambda config.
1612
+ *
1613
+ * ```ts {3,4} title="sst.config.ts"
1614
+ * new sst.aws.Function("MyFunction", {
1615
+ * handler: "src/lambda.handler",
1616
+ * timeout: "3 minutes",
1617
+ * memory: "1024 MB"
1618
+ * });
1619
+ * ```
1620
+ *
1621
+ * #### Link resources
1622
+ *
1623
+ * [Link resources](/docs/linking/) to the function. This will grant permissions
1624
+ * to the resources and allow you to access it in your handler.
1625
+ *
1626
+ * ```ts {5} title="sst.config.ts"
1627
+ * const bucket = new sst.aws.Bucket("MyBucket");
1628
+ *
1629
+ * new sst.aws.Function("MyFunction", {
1630
+ * handler: "src/lambda.handler",
1631
+ * link: [bucket]
1632
+ * });
1633
+ * ```
1634
+ *
1635
+ * You can use the [SDK](/docs/reference/sdk/) to access the linked resources
1636
+ * in your handler.
1637
+ *
1638
+ * <Tabs>
1639
+ * <TabItem label="Node">
1640
+ * ```ts title="src/lambda.ts"
1641
+ * import { Resource } from "sst";
1642
+ *
1643
+ * console.log(Resource.MyBucket.name);
1644
+ * ```
1645
+ * </TabItem>
1646
+ * <TabItem label="Python">
1647
+ * ```ts title="functions/src/functions/api.py"
1648
+ * from sst import Resource
1649
+ *
1650
+ * def handler(event, context):
1651
+ * print(Resource.MyBucket.name)
1652
+ * ```
1653
+ *
1654
+ * Where the `sst-sdk` package can be added to your `pyproject.toml`.
1655
+ *
1656
+ * ```toml title="functions/pyproject.toml"
1657
+ * [project]
1658
+ * dependencies = ["sst-sdk"]
1659
+ *
1660
+ * [tool.uv.sources]
1661
+ * sst-sdk = { git = "https://github.com/sst-community/sst.git", subdirectory = "sdk/python", branch = "main" }
1662
+ * ```
1663
+ * </TabItem>
1664
+ * <TabItem label="Go">
1665
+ * ```go title="src/main.go"
1666
+ * import (
1667
+ * "github.com/sst/sst/v3/sdk/golang/resource"
1668
+ * )
1669
+ *
1670
+ * resource.Get("MyBucket", "name")
1671
+ * ```
1672
+ * </TabItem>
1673
+ * <TabItem label="Rust">
1674
+ * ```rust title="src/main.rs"
1675
+ * use sst_sdk::Resource;
1676
+ * #[derive(serde::Deserialize, Debug)]
1677
+ * struct Bucket {
1678
+ * name: String,
1679
+ * }
1680
+ *
1681
+ * let resource = Resource::init().unwrap();
1682
+ * let Bucket { name } = resource.get("Bucket").unwrap();
1683
+ * ```
1684
+ * </TabItem>
1685
+ * </Tabs>
1686
+ *
1687
+ * #### Set environment variables
1688
+ *
1689
+ * Set environment variables that you can read in your function. For example, using
1690
+ * `process.env` in your Node.js functions.
1691
+ *
1692
+ * ```ts {4} title="sst.config.ts"
1693
+ * new sst.aws.Function("MyFunction", {
1694
+ * handler: "src/lambda.handler",
1695
+ * environment: {
1696
+ * DEBUG: "true"
1697
+ * }
1698
+ * });
1699
+ * ```
1700
+ *
1701
+ * #### Enable function URLs
1702
+ *
1703
+ * Enable function URLs to invoke the function over HTTP.
1704
+ *
1705
+ * ```ts {3} title="sst.config.ts"
1706
+ * new sst.aws.Function("MyFunction", {
1707
+ * handler: "src/lambda.handler",
1708
+ * url: true
1709
+ * });
1710
+ * ```
1711
+ *
1712
+ * #### Bundling
1713
+ *
1714
+ * Customize how SST uses [esbuild](https://esbuild.github.io/) to bundle your Node.js
1715
+ * functions with the `nodejs` property.
1716
+ *
1717
+ * ```ts title="sst.config.ts" {3-5}
1718
+ * new sst.aws.Function("MyFunction", {
1719
+ * handler: "src/lambda.handler",
1720
+ * nodejs: {
1721
+ * install: ["pg"]
1722
+ * }
1723
+ * });
1724
+ * ```
1725
+ *
1726
+ * Or override it entirely by passing in your own function `bundle`.
1727
+ */
1728
+ export class Function extends Component implements Link.Linkable {
1729
+ private constructorName: string;
1730
+ private durable: boolean;
1731
+ private function: Output<lambda.Function>;
1732
+ private role: iam.Role;
1733
+ private logGroup: Output<cloudwatch.LogGroup | undefined>;
1734
+ private urlEndpoint: Output<string | undefined>;
1735
+ private urlResource: Output<lambda.FunctionUrl | undefined>;
1736
+ private eventInvokeConfig?: lambda.FunctionEventInvokeConfig;
1737
+
1738
+ private static readonly encryptionKey = lazy(
1739
+ () =>
1740
+ new RandomBytes("LambdaEncryptionKey", {
1741
+ length: 32,
1742
+ }),
1743
+ );
1744
+
1745
+ private static readonly devBridgeCode = lazy(
1746
+ () => new Map<string, Promise<s3.BucketObjectv2>>(),
1747
+ );
1748
+
1749
+ public static readonly appsync = lazy(() =>
1750
+ rpc.call("Provider.Aws.Appsync", {}),
1751
+ );
1752
+
1753
+ /** @internal */
1754
+ public static reset() {
1755
+ Function.devBridgeCode().clear();
1756
+ }
1757
+
1758
+ constructor(
1759
+ name: string,
1760
+ args: FunctionArgs,
1761
+ opts?: ComponentResourceOptions,
1762
+ ) {
1763
+ super(__pulumiType, name, args, opts);
1764
+ this.constructorName = name;
1765
+ this.durable = Boolean(args.durable);
1766
+
1767
+ const parent = this;
1768
+ const dev = normalizeDev();
1769
+ const isContainer = all([args.python, dev]).apply(
1770
+ ([python, dev]) => !dev && !!python?.container,
1771
+ );
1772
+ const containerCache = all([args.python]).apply(([python]) =>
1773
+ typeof python?.container === "object"
1774
+ ? python.container.cache ?? true
1775
+ : true,
1776
+ );
1777
+ const partition = getPartitionOutput({}, opts).partition;
1778
+ const region = getRegionOutput({}, opts).region;
1779
+ const bootstrapData = region.apply((region) => bootstrap.forRegion(region));
1780
+ const injections = normalizeInjections();
1781
+ const runtime = output(args.runtime ?? "nodejs24.x");
1782
+ const timeout = normalizeTimeout();
1783
+ const memory = normalizeMemory();
1784
+ const storage = output(args.storage).apply((v) => v ?? "512 MB");
1785
+ const architecture = output(args.architecture).apply((v) => v ?? "x86_64");
1786
+ const environment = normalizeEnvironment();
1787
+ const streaming = normalizeStreaming();
1788
+ const logging = normalizeLogging();
1789
+ const volume = normalizeVolume();
1790
+ const url = normalizeUrl();
1791
+ const copyFiles = normalizeCopyFiles();
1792
+ const durable = normalizeDurable();
1793
+ const policies = output(args.policies ?? []);
1794
+ const vpc = normalizeVpc();
1795
+ const nodejs = normalizeNodeJs();
1796
+
1797
+ const linkData = buildLinkData();
1798
+ const linkPermissions = buildLinkPermissions();
1799
+ const { bundle, handler: handler0, sourcemaps } = buildHandler();
1800
+ const { handler, wrapper } = buildHandlerWrapper();
1801
+ const role = createRole();
1802
+ const imageAsset = createImageAsset();
1803
+ const logGroup = createLogGroup();
1804
+ const zipAsset = createZipAsset();
1805
+ const fn = createFunction();
1806
+ const { endpoint: urlEndpoint, resource: urlResource } = createUrl();
1807
+ createProvisioned();
1808
+ const eventInvokeConfig = createEventInvokeConfig();
1809
+
1810
+ const links = linkData.apply((input) => input.map((item) => item.name));
1811
+
1812
+ this.function = fn;
1813
+ this.role = role;
1814
+ this.logGroup = logGroup;
1815
+ this.urlEndpoint = urlEndpoint;
1816
+ this.urlResource = urlResource;
1817
+ this.eventInvokeConfig = eventInvokeConfig;
1818
+
1819
+ const buildInput = output({
1820
+ functionID: name,
1821
+ handler: args.handler,
1822
+ bundle: args.bundle,
1823
+ logGroup: logGroup.apply((l) => l?.name),
1824
+ encryptionKey: Function.encryptionKey().base64,
1825
+ runtime,
1826
+ links: output(linkData).apply((input) =>
1827
+ Object.fromEntries(input.map((item) => [item.name, item.properties])),
1828
+ ),
1829
+ copyFiles,
1830
+ properties: output({ nodejs, python: args.python }).apply((val) => ({
1831
+ ...(val.nodejs || val.python),
1832
+ architecture,
1833
+ })),
1834
+ dev,
1835
+ });
1836
+
1837
+ buildInput.apply(async (input) => {
1838
+ if (!input.dev) return;
1839
+ await rpc.call("Runtime.AddTarget", input);
1840
+ });
1841
+
1842
+ this.registerOutputs({
1843
+ _live: unsecret(
1844
+ output(dev).apply((dev) => {
1845
+ if (!dev) return undefined;
1846
+ return all([
1847
+ name,
1848
+ links,
1849
+ args.handler,
1850
+ args.bundle,
1851
+ args.runtime,
1852
+ nodejs,
1853
+ copyFiles,
1854
+ ]).apply(
1855
+ ([name, links, handler, bundle, runtime, nodejs, copyFiles]) => {
1856
+ return {
1857
+ functionID: name,
1858
+ links,
1859
+ handler: handler,
1860
+ bundle: bundle,
1861
+ runtime: runtime || "nodejs24.x",
1862
+ copyFiles,
1863
+ properties: nodejs,
1864
+ };
1865
+ },
1866
+ );
1867
+ }),
1868
+ ),
1869
+ _metadata: {
1870
+ handler: args.handler,
1871
+ internal: args._skipMetadata,
1872
+ dev: dev,
1873
+ },
1874
+ _hint: args._skipHint ? undefined : urlEndpoint,
1875
+ });
1876
+
1877
+ function normalizeDev() {
1878
+ return all([args.dev, args.live]).apply(
1879
+ ([d, l]) => $dev && d !== false && l !== false,
1880
+ );
1881
+ }
1882
+
1883
+ function normalizeNodeJs() {
1884
+ return output(args.nodejs).apply((nodejs) =>
1885
+ nodejs?.install && Array.isArray(nodejs.install)
1886
+ ? {
1887
+ ...nodejs,
1888
+ install: Object.fromEntries(
1889
+ nodejs.install.map((dep) => [dep, "*"]),
1890
+ ),
1891
+ }
1892
+ : nodejs,
1893
+ );
1894
+ }
1895
+
1896
+ function normalizeInjections() {
1897
+ return output(args.injections).apply((injections) => injections ?? []);
1898
+ }
1899
+
1900
+ function normalizeTimeout() {
1901
+ return output(args.timeout).apply((timeout) => timeout ?? "20 seconds");
1902
+ }
1903
+
1904
+ function normalizeMemory() {
1905
+ return output(args.memory).apply((memory) => memory ?? "1024 MB");
1906
+ }
1907
+
1908
+ function normalizeEnvironment() {
1909
+ return all([
1910
+ args.environment,
1911
+ dev,
1912
+ bootstrapData,
1913
+ Function.encryptionKey().base64,
1914
+ args.link,
1915
+ args.streaming,
1916
+ args.bundle,
1917
+ dev.apply((dev) => dev ? Function.appsync() : undefined),
1918
+ ]).apply(([environment, dev, bootstrap, key, link, streaming, bundle, appsync]) => {
1919
+ const result = environment ?? {};
1920
+ result.SST_RESOURCE_App = JSON.stringify({
1921
+ name: $app.name,
1922
+ stage: $app.stage,
1923
+ });
1924
+ for (const linkable of link || []) {
1925
+ if (!Link.isLinkable(linkable)) continue;
1926
+ const def = linkable.getSSTLink();
1927
+ for (const item of def.include || []) {
1928
+ if (item.type === "environment") Object.assign(result, item.env);
1929
+ }
1930
+ }
1931
+ result.SST_KEY = key;
1932
+ // When a shared `bundle` is used, multiple functions write into the
1933
+ // same output directory — the Go runtime namespaces the encrypted
1934
+ // resource file under `.sst/<FunctionID>/resource.enc` to avoid a
1935
+ // concurrent-write race that corrupts the ciphertext, AND so each
1936
+ // Lambda's uploaded zip can exclude every sibling's subtree (the
1937
+ // zipper filters on `.sst/<otherFunctionID>/`). Point each Lambda
1938
+ // at its own file to match.
1939
+ result.SST_KEY_FILE = bundle
1940
+ ? `.sst/${name}/resource.enc`
1941
+ : "resource.enc";
1942
+ if (dev) {
1943
+ result.SST_REGION = process.env.SST_AWS_REGION!;
1944
+ result.SST_APPSYNC_HTTP = appsync.http;
1945
+ result.SST_APPSYNC_REALTIME = appsync.realtime;
1946
+ result.SST_FUNCTION_ID = name;
1947
+ result.SST_APP = $app.name;
1948
+ result.SST_STAGE = $app.stage;
1949
+ result.SST_ASSET_BUCKET = bootstrap.asset;
1950
+ if (process.env.SST_FUNCTION_TIMEOUT) {
1951
+ result.SST_FUNCTION_TIMEOUT = process.env.SST_FUNCTION_TIMEOUT;
1952
+ }
1953
+ if (streaming) {
1954
+ result.SST_FUNCTION_STREAMING = "true";
1955
+ }
1956
+ }
1957
+ return result;
1958
+ });
1959
+ }
1960
+
1961
+ function normalizeStreaming() {
1962
+ return output(args.streaming).apply((streaming) => streaming ?? false);
1963
+ }
1964
+
1965
+ function normalizeLogging() {
1966
+ return output(args.logging).apply((logging) => {
1967
+ if (logging === false) return undefined;
1968
+
1969
+ if (logging?.retention && logging?.logGroup) {
1970
+ throw new VisibleError(
1971
+ `Cannot set both "logging.retention" and "logging.logGroup"`,
1972
+ );
1973
+ }
1974
+
1975
+ if (args.durable && logging?.format && logging?.format != "json") {
1976
+ throw new VisibleError(
1977
+ `Durable functions require "logging.format" to be set to "json"`,
1978
+ );
1979
+ }
1980
+
1981
+ const defaultFormat = args.durable ? "json" : "text";
1982
+
1983
+ return {
1984
+ logGroup: logging?.logGroup,
1985
+ retention: logging?.retention ?? "1 month",
1986
+ format: logging?.format ?? defaultFormat,
1987
+ };
1988
+ });
1989
+ }
1990
+
1991
+ function normalizeVolume() {
1992
+ if (!args.volume) return;
1993
+
1994
+ return output(args.volume).apply((volume) => ({
1995
+ efs:
1996
+ volume.efs instanceof Efs
1997
+ ? volume.efs.nodes.accessPoint.arn
1998
+ : output(volume.efs),
1999
+ path: volume.path ?? "/mnt/efs",
2000
+ }));
2001
+ }
2002
+
2003
+ function normalizeUrl() {
2004
+ return output(args.url).apply((url) => {
2005
+ if (url === false || url === undefined) return;
2006
+ if (url === true) {
2007
+ url = {};
2008
+ }
2009
+
2010
+ // normalize authorization
2011
+ const defaultAuthorization = "none" as const;
2012
+ const authorization = url.authorization ?? defaultAuthorization;
2013
+
2014
+ // normalize cors
2015
+ const defaultCors: types.input.lambda.FunctionUrlCors = {
2016
+ allowHeaders: ["*"],
2017
+ allowMethods: ["*"],
2018
+ allowOrigins: ["*"],
2019
+ };
2020
+ const cors =
2021
+ url.cors === false
2022
+ ? undefined
2023
+ : url.cors === true || url.cors === undefined
2024
+ ? defaultCors
2025
+ : {
2026
+ ...defaultCors,
2027
+ ...url.cors,
2028
+ maxAge: url.cors.maxAge && toSeconds(url.cors.maxAge),
2029
+ };
2030
+
2031
+ return {
2032
+ authorization,
2033
+ cors,
2034
+ route: normalizeRouteArgs(url.router, url.route),
2035
+ };
2036
+ });
2037
+ }
2038
+
2039
+ function normalizeCopyFiles() {
2040
+ return output(args.copyFiles ?? []).apply((copyFiles) =>
2041
+ Promise.all(
2042
+ copyFiles.map(async (entry) => {
2043
+ const from = path.join($cli.paths.root, entry.from);
2044
+ const to = entry.to || entry.from;
2045
+ if (path.isAbsolute(to)) {
2046
+ throw new VisibleError(
2047
+ `Copy destination path "${to}" must be relative`,
2048
+ );
2049
+ }
2050
+
2051
+ const stats = await fs.promises.stat(from);
2052
+ const isDir = stats.isDirectory();
2053
+
2054
+ return { from, to, isDir };
2055
+ }),
2056
+ ),
2057
+ );
2058
+ }
2059
+
2060
+ function normalizeVpc() {
2061
+ // "vpc" is undefined
2062
+ if (!args.vpc) return;
2063
+
2064
+ // "vpc" is a Vpc component
2065
+ if (args.vpc instanceof Vpc) {
2066
+ const result = {
2067
+ privateSubnets: args.vpc.privateSubnets,
2068
+ securityGroups: args.vpc.securityGroups,
2069
+ };
2070
+ return all([
2071
+ args.vpc.id,
2072
+ args.vpc.nodes.natGateways,
2073
+ args.vpc.nodes.natInstances,
2074
+ ]).apply(([id, natGateways, natInstances]) => {
2075
+ if (natGateways.length === 0 && natInstances.length === 0) {
2076
+ warnOnce(
2077
+ `\nWarning: One or more functions are deployed in the "${id}" VPC, which does not have a NAT gateway. As a result, these functions cannot access the internet. If your functions need internet access, enable it by setting the "nat" prop on the "Vpc" component.\n`,
2078
+ );
2079
+ }
2080
+ return result;
2081
+ });
2082
+ }
2083
+
2084
+ return output(args.vpc).apply((vpc) => {
2085
+ // "vpc" is object
2086
+ if (vpc.subnets) {
2087
+ throw new VisibleError(
2088
+ `The "vpc.subnets" property has been renamed to "vpc.privateSubnets". Update your code to use "vpc.privateSubnets" instead.`,
2089
+ );
2090
+ }
2091
+
2092
+ return vpc;
2093
+ });
2094
+ }
2095
+
2096
+ function normalizeDurable() {
2097
+ if (!args.durable) return;
2098
+ const config = args.durable === true ? {} : args.durable;
2099
+ return {
2100
+ timeout: output(config.timeout).apply((v) =>
2101
+ toSeconds(v ?? "14 days"),
2102
+ ),
2103
+ retention: output(config.retention).apply((v) =>
2104
+ toDays(v ?? "30 days"),
2105
+ ),
2106
+ };
2107
+ }
2108
+
2109
+ function buildLinkData() {
2110
+ return output(args.link || []).apply((links) => Link.build(links));
2111
+ }
2112
+
2113
+ function buildLinkPermissions() {
2114
+ return Link.getInclude<Permission>("aws.permission", args.link);
2115
+ }
2116
+
2117
+ function buildHandler() {
2118
+ return all([runtime, dev, isContainer]).apply(
2119
+ async ([runtime, dev, isContainer]) => {
2120
+ if (dev) {
2121
+ return resolveDevBridge();
2122
+ }
2123
+
2124
+ const buildResult = buildInput.apply(async (input) => {
2125
+ const result = await rpc.call<{
2126
+ handler: string;
2127
+ out: string;
2128
+ errors: string[];
2129
+ sourcemaps: string[];
2130
+ }>("Runtime.Build", { ...input, isContainer });
2131
+ if (result.errors.length > 0) {
2132
+ throw new Error(result.errors.join("\n"));
2133
+ }
2134
+ if (args.hook?.postbuild) await args.hook.postbuild(result.out);
2135
+ return result;
2136
+ });
2137
+
2138
+ return {
2139
+ handler: buildResult.handler,
2140
+ bundle: buildResult.out,
2141
+ sourcemaps: buildResult.sourcemaps,
2142
+ };
2143
+
2144
+ function resolveDevBridge() {
2145
+ if (durable) {
2146
+ return {
2147
+ handler: "index.handler",
2148
+ bundle: path.join($cli.paths.platform, "dist", "nodejs-bridge"),
2149
+ sourcemaps: undefined,
2150
+ };
2151
+ }
2152
+
2153
+ return {
2154
+ handler: "bootstrap",
2155
+ bundle: path.join($cli.paths.platform, "dist", "bridge"),
2156
+ sourcemaps: undefined,
2157
+ };
2158
+ }
2159
+ },
2160
+ );
2161
+ }
2162
+
2163
+ function buildHandlerWrapper() {
2164
+ const ret = all([
2165
+ dev,
2166
+ bundle,
2167
+ handler0,
2168
+ linkData,
2169
+ streaming,
2170
+ injections,
2171
+ runtime,
2172
+ ]).apply(
2173
+ async ([
2174
+ dev,
2175
+ bundle,
2176
+ handler,
2177
+ linkData,
2178
+ streaming,
2179
+ injections,
2180
+ runtime,
2181
+ ]) => {
2182
+ if (dev) return { handler };
2183
+ if (!runtime.startsWith("nodejs")) {
2184
+ return { handler };
2185
+ }
2186
+
2187
+ const hasUserInjections = injections.length > 0;
2188
+
2189
+ if (!hasUserInjections) return { handler };
2190
+
2191
+ const parsed = path.posix.parse(handler);
2192
+ const handlerDir = parsed.dir;
2193
+ const oldHandlerFileName = parsed.name;
2194
+ const oldHandlerFunction = parsed.ext.replace(/^\./, "");
2195
+ const newHandlerFileName = "server-index";
2196
+ const newHandlerFunction = "handler";
2197
+
2198
+ // Validate handler file exists
2199
+ const newHandlerFileExt = [".js", ".mjs", ".cjs"].find((ext) =>
2200
+ fs.existsSync(
2201
+ path.join(bundle!, handlerDir, oldHandlerFileName + ext),
2202
+ ),
2203
+ );
2204
+ if (!newHandlerFileExt) {
2205
+ throw new VisibleError(
2206
+ `Could not find handler file "${handler}" for function "${name}"`,
2207
+ );
2208
+ }
2209
+
2210
+ const split = injections.reduce(
2211
+ (acc, item) => {
2212
+ if (item.startsWith("outer:")) {
2213
+ acc.outer.push(item.substring("outer:".length));
2214
+ return acc;
2215
+ }
2216
+ acc.inner.push(item);
2217
+ return acc;
2218
+ },
2219
+ { outer: [] as string[], inner: [] as string[] },
2220
+ );
2221
+
2222
+ return {
2223
+ handler: path.posix.join(
2224
+ handlerDir,
2225
+ `${newHandlerFileName}.${newHandlerFunction}`,
2226
+ ),
2227
+ wrapper: {
2228
+ name: path.posix.join(handlerDir, `${newHandlerFileName}.mjs`),
2229
+ content: streaming
2230
+ ? [
2231
+ ...split.outer,
2232
+ `export const ${newHandlerFunction} = awslambda.streamifyResponse(async (event, responseStream, context) => {`,
2233
+ ...split.inner,
2234
+ ` const { ${oldHandlerFunction}: rawHandler} = await import("./${oldHandlerFileName}${newHandlerFileExt}");`,
2235
+ ` return rawHandler(event, responseStream, context);`,
2236
+ `});`,
2237
+ ].join("\n")
2238
+ : [
2239
+ ...split.outer,
2240
+ `export const ${newHandlerFunction} = async (event, context) => {`,
2241
+ ...split.inner,
2242
+ ` const { ${oldHandlerFunction}: rawHandler} = await import("./${oldHandlerFileName}${newHandlerFileExt}");`,
2243
+ ` return rawHandler(event, context);`,
2244
+ `};`,
2245
+ ].join("\n"),
2246
+ },
2247
+ };
2248
+ },
2249
+ );
2250
+ return {
2251
+ handler: ret.handler,
2252
+ wrapper: ret.wrapper,
2253
+ };
2254
+ }
2255
+
2256
+ function createRole() {
2257
+ if (args.role) {
2258
+ return iam.Role.get(
2259
+ `${name}Role`,
2260
+ output(args.role).apply(parseRoleArn).roleName,
2261
+ {},
2262
+ { parent },
2263
+ );
2264
+ }
2265
+
2266
+ const policy = all([args.permissions || [], linkPermissions, dev]).apply(
2267
+ ([argsPermissions, linkPermissions, dev]) =>
2268
+ iam.getPolicyDocumentOutput({
2269
+ statements: [
2270
+ ...argsPermissions,
2271
+ ...linkPermissions,
2272
+ ...(dev
2273
+ ? [
2274
+ {
2275
+ effect: "allow",
2276
+ actions: ["appsync:*"],
2277
+ resources: ["*"],
2278
+ },
2279
+ {
2280
+ effect: "allow",
2281
+ actions: ["s3:*"],
2282
+ resources: [
2283
+ interpolate`arn:${partition}:s3:::${bootstrapData.asset}`,
2284
+ interpolate`arn:${partition}:s3:::${bootstrapData.asset}/*`,
2285
+ ],
2286
+ },
2287
+ ]
2288
+ : []),
2289
+ ].map((item) => ({
2290
+ effect: (() => {
2291
+ const effect = item.effect ?? "allow";
2292
+ return effect.charAt(0).toUpperCase() + effect.slice(1);
2293
+ })(),
2294
+ actions: item.actions,
2295
+ resources: item.resources,
2296
+ conditions: "conditions" in item ? item.conditions : undefined,
2297
+ })),
2298
+ }),
2299
+ );
2300
+
2301
+ return new iam.Role(
2302
+ ...transform(
2303
+ args.transform?.role,
2304
+ `${name}Role`,
2305
+ {
2306
+ // Only `sst dev` trusts the account root, so the CLI can assume the
2307
+ // role. This goes by `$dev` and not by this function's own `dev`,
2308
+ // as the dev server of a site is created with `dev: false` and its
2309
+ // role is still assumed by the CLI. A deployed role trusts the
2310
+ // Lambda service alone.
2311
+ assumeRolePolicy: iam.getPolicyDocumentOutput({
2312
+ statements: [
2313
+ {
2314
+ actions: ["sts:AssumeRole"],
2315
+ principals: [
2316
+ {
2317
+ type: "Service",
2318
+ identifiers: ["lambda.amazonaws.com"],
2319
+ },
2320
+ ...($dev
2321
+ ? [
2322
+ {
2323
+ type: "AWS",
2324
+ identifiers: [
2325
+ interpolate`arn:${partition}:iam::${
2326
+ getCallerIdentityOutput({}, opts).accountId
2327
+ }:root`,
2328
+ ],
2329
+ },
2330
+ ]
2331
+ : []),
2332
+ ],
2333
+ },
2334
+ ],
2335
+ }).json,
2336
+ // if there are no statements, do not add an inline policy.
2337
+ // adding an inline policy with no statements will cause an error.
2338
+ inlinePolicies: policy.apply(({ statements }) =>
2339
+ statements ? [{ name: "inline", policy: policy.json }] : [],
2340
+ ),
2341
+ managedPolicyArns: all([logging, policies]).apply(
2342
+ ([logging, policies]) => [
2343
+ ...policies,
2344
+ ...(logging
2345
+ ? [
2346
+ interpolate`arn:${partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole`,
2347
+ ]
2348
+ : []),
2349
+ ...(vpc
2350
+ ? [
2351
+ interpolate`arn:${partition}:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole`,
2352
+ ]
2353
+ : []),
2354
+ ...(durable
2355
+ ? [
2356
+ interpolate`arn:${partition}:iam::aws:policy/service-role/AWSLambdaBasicDurableExecutionRolePolicy`,
2357
+ ]
2358
+ : []),
2359
+ ],
2360
+ ),
2361
+ },
2362
+ { parent },
2363
+ ),
2364
+ );
2365
+ }
2366
+
2367
+ function createImageAsset() {
2368
+ // The build artifact directory already exists, with all the user code and
2369
+ // config files. It also has the dockerfile, we need to now just build and push to
2370
+ // the container registry.
2371
+ return all([isContainer, dev, bundle, containerCache]).apply(
2372
+ ([
2373
+ isContainer,
2374
+ dev,
2375
+ bundle, // We need the bundle to be resolved because of implicit dockerfiles even though we don't use it here
2376
+ containerCache,
2377
+ ]) => {
2378
+ if (!isContainer || dev) return;
2379
+
2380
+ const authToken = ecr.getAuthorizationTokenOutput({
2381
+ registryId: bootstrapData.assetEcrRegistryId,
2382
+ });
2383
+
2384
+ return new Image(
2385
+ `${name}Image`,
2386
+ {
2387
+ tags: [$interpolate`${bootstrapData.assetEcrUrl}:latest`],
2388
+ context: {
2389
+ location: path.join(
2390
+ $cli.paths.work,
2391
+ "artifacts",
2392
+ `${name}-src`,
2393
+ ),
2394
+ },
2395
+ ...(containerCache !== false
2396
+ ? {
2397
+ cacheFrom: [
2398
+ {
2399
+ registry: {
2400
+ ref: $interpolate`${bootstrapData.assetEcrUrl}:${name}-cache`,
2401
+ },
2402
+ },
2403
+ ],
2404
+ cacheTo: [
2405
+ {
2406
+ registry: {
2407
+ ref: $interpolate`${bootstrapData.assetEcrUrl}:${name}-cache`,
2408
+ imageManifest: true,
2409
+ ociMediaTypes: true,
2410
+ mode: "max",
2411
+ },
2412
+ },
2413
+ ],
2414
+ }
2415
+ : {}),
2416
+ platforms: [
2417
+ architecture.apply((v) =>
2418
+ v === "arm64" ? "linux/arm64" : "linux/amd64",
2419
+ ),
2420
+ ],
2421
+ push: true,
2422
+ registries: [
2423
+ authToken.apply((authToken) => ({
2424
+ address: authToken.proxyEndpoint,
2425
+ username: authToken.userName,
2426
+ password: secret(authToken.password),
2427
+ })),
2428
+ ],
2429
+ },
2430
+ { parent },
2431
+ );
2432
+ },
2433
+ );
2434
+ }
2435
+
2436
+ function createZipAsset() {
2437
+ // Note: cannot point the bundle to the `.open-next/server-function`
2438
+ // b/c the folder contains node_modules. And pnpm node_modules
2439
+ // contains symlinks. Pulumi cannot zip symlinks correctly.
2440
+ // We will zip the folder ourselves.
2441
+ return all([
2442
+ bundle,
2443
+ wrapper,
2444
+ sourcemaps,
2445
+ copyFiles,
2446
+ isContainer,
2447
+ logGroup.apply((l) => l?.arn),
2448
+ dev,
2449
+ all([region, args.bundle]).apply(([regionName, customBundle]) => ({
2450
+ regionName,
2451
+ customBundle: !!customBundle,
2452
+ })),
2453
+ ]).apply(
2454
+ async ([
2455
+ bundle,
2456
+ wrapper,
2457
+ sourcemaps,
2458
+ copyFiles,
2459
+ isContainer,
2460
+ logGroupArn,
2461
+ dev,
2462
+ { regionName, customBundle },
2463
+ ]) => {
2464
+ if (isContainer) return;
2465
+
2466
+ if (dev) {
2467
+ const cacheKey = `${regionName}:${bundle}`;
2468
+ const cache = Function.devBridgeCode();
2469
+ const existing = cache.get(cacheKey);
2470
+ if (existing) return existing;
2471
+
2472
+ const created = createCode();
2473
+ cache.set(cacheKey, created);
2474
+ created.catch(() => cache.delete(cacheKey));
2475
+ return created;
2476
+ }
2477
+
2478
+ return createCode();
2479
+
2480
+ async function createCode() {
2481
+ const zipPath = path.resolve(
2482
+ $cli.paths.work,
2483
+ "artifacts",
2484
+ dev
2485
+ ? `dev-bridge-${regionName}-${logicalName(path.basename(bundle))}`
2486
+ : name,
2487
+ "code.zip",
2488
+ );
2489
+ await fs.promises.mkdir(path.dirname(zipPath), {
2490
+ recursive: true,
2491
+ });
2492
+
2493
+ await new Promise(async (resolve, reject) => {
2494
+ const ws = fs.createWriteStream(zipPath);
2495
+ const archive = archiver("zip", {
2496
+ // Ensure deterministic zip file hashes
2497
+ // https://github.com/archiverjs/node-archiver/issues/397#issuecomment-554327338
2498
+ statConcurrency: 1,
2499
+ });
2500
+ archive.on("warning", reject);
2501
+ archive.on("error", reject);
2502
+ // archive has been finalized and the output file descriptor has closed, resolve promise
2503
+ // this has to be done before calling `finalize` since the events may fire immediately after.
2504
+ // see https://www.npmjs.com/package/archiver
2505
+ ws.once("close", () => {
2506
+ resolve(zipPath);
2507
+ });
2508
+ archive.pipe(ws);
2509
+
2510
+ const files = [];
2511
+
2512
+ for (const item of [
2513
+ {
2514
+ from: bundle,
2515
+ to: ".",
2516
+ isDir: true,
2517
+ },
2518
+ ...(!dev ? copyFiles : []),
2519
+ ]) {
2520
+ if (!item.isDir) {
2521
+ files.push({
2522
+ from: item.from,
2523
+ to: item.to,
2524
+ });
2525
+ }
2526
+ const found = await glob("**", {
2527
+ cwd: item.from,
2528
+ dot: true,
2529
+ ignore:
2530
+ sourcemaps?.map((item) => path.relative(bundle, item)) ||
2531
+ [],
2532
+ });
2533
+ // Functions that share a `bundle:` directory each get their
2534
+ // own `.sst/<name>/resource.enc` (written by the Go runtime).
2535
+ // Keep only this function's folder in its zip, so a function
2536
+ // doesn't ship the linked resources of its siblings. Only
2537
+ // applies to zip functions, `glob` returns "/" separated paths
2538
+ // on every platform.
2539
+ const ownDir = `.sst/${name}/`;
2540
+ const filtered =
2541
+ !dev && customBundle && item.from === bundle
2542
+ ? found.filter((file) => {
2543
+ const f = toPosix(file);
2544
+ // also leave out the shared file an older version wrote
2545
+ if (f === "resource.enc") return false;
2546
+ return (
2547
+ !f.startsWith(".sst/") ||
2548
+ f === `.sst/${name}` ||
2549
+ f.startsWith(ownDir)
2550
+ );
2551
+ })
2552
+ : found;
2553
+ files.push(
2554
+ ...filtered.map((file) => ({
2555
+ from: path.join(item.from, file),
2556
+ to: path.join(item.to, file),
2557
+ })),
2558
+ );
2559
+ }
2560
+ files.sort((a, b) => a.to.localeCompare(b.to));
2561
+ for (const file of files) {
2562
+ archive.file(file.from, {
2563
+ name: file.to,
2564
+ date: new Date(0),
2565
+ });
2566
+ }
2567
+
2568
+ // Add handler wrapper into the zip
2569
+ if (wrapper) {
2570
+ archive.append(wrapper.content, {
2571
+ name: wrapper.name,
2572
+ date: new Date(0),
2573
+ });
2574
+ }
2575
+
2576
+ await archive.finalize();
2577
+ });
2578
+
2579
+ const hash = crypto.createHash("sha256");
2580
+ hash.update(await fs.promises.readFile(zipPath));
2581
+ const hashValue = hash.digest("hex");
2582
+ const assetBucket = region.apply((region) =>
2583
+ bootstrap.forRegion(region).then((d) => d.asset),
2584
+ );
2585
+ if (logGroupArn && sourcemaps) {
2586
+ let index = 0;
2587
+ for (const file of sourcemaps) {
2588
+ new s3.BucketObjectv2(
2589
+ `${name}Sourcemap${index}`,
2590
+ {
2591
+ key: interpolate`sourcemap/${logGroupArn}/${hashValue}.${path.basename(
2592
+ file,
2593
+ )}`,
2594
+ bucket: assetBucket,
2595
+ source: new asset.FileAsset(file),
2596
+ },
2597
+ { parent, retainOnDelete: true },
2598
+ );
2599
+ index++;
2600
+ }
2601
+ }
2602
+
2603
+ return new s3.BucketObjectv2(
2604
+ dev
2605
+ ? `DevBridgeCode${logicalName(regionName)}${logicalName(path.basename(bundle))}`
2606
+ : `${name}Code`,
2607
+ {
2608
+ key: dev
2609
+ ? `assets/dev-bridge-code-${hashValue}.zip`
2610
+ : interpolate`assets/${name}-code-${hashValue}.zip`,
2611
+ bucket: assetBucket,
2612
+ source: new asset.FileArchive(zipPath),
2613
+ },
2614
+ dev
2615
+ ? {
2616
+ parent: rootStackResource,
2617
+ provider: opts?.provider,
2618
+ // The dev bridge key is shared by every app and stage in this
2619
+ // account and region. Retain it so removing a stage, deploying it
2620
+ // outside dev, or changing its bridge version doesn't delete the
2621
+ // object other stages' Lambdas are still created from.
2622
+ retainOnDelete: true,
2623
+ }
2624
+ : { parent },
2625
+ );
2626
+ }
2627
+ },
2628
+ );
2629
+ }
2630
+
2631
+ function createLogGroup() {
2632
+ return logging.apply((logging) => {
2633
+ if (!logging) return;
2634
+ if (logging.logGroup) return;
2635
+
2636
+ return new cloudwatch.LogGroup(
2637
+ ...transform(
2638
+ args.transform?.logGroup,
2639
+ `${name}LogGroup`,
2640
+ {
2641
+ name: interpolate`/aws/lambda/${
2642
+ args.name ?? physicalName(64, `${name}Function`)
2643
+ }`,
2644
+ retentionInDays: RETENTION[logging.retention],
2645
+ },
2646
+ { parent, ignoreChanges: ["name"] },
2647
+ ),
2648
+ );
2649
+ });
2650
+ }
2651
+
2652
+ function createFunction() {
2653
+ return all([
2654
+ logging,
2655
+ logGroup,
2656
+ isContainer,
2657
+ imageAsset,
2658
+ zipAsset,
2659
+ args.concurrency,
2660
+ dev,
2661
+ ]).apply(
2662
+ ([
2663
+ logging,
2664
+ logGroup,
2665
+ isContainer,
2666
+ imageAsset,
2667
+ zipAsset,
2668
+ concurrency,
2669
+ dev,
2670
+ ]) => {
2671
+ // This is a hack to avoid handler being marked as having propertyDependencies.
2672
+ // There is an unresolved bug in pulumi that causes issues when it does
2673
+ // @ts-expect-error
2674
+ handler.allResources = () => Promise.resolve(new Set());
2675
+ const transformed = transform(
2676
+ args.transform?.function,
2677
+ `${name}Function`,
2678
+ {
2679
+ name: args.name,
2680
+ description: args.description ?? "",
2681
+ role: args.role ?? role!.arn,
2682
+ timeout: timeout.apply((timeout) => toSeconds(timeout)),
2683
+ memorySize: memory.apply((memory) => toMBs(memory)),
2684
+ ephemeralStorage: { size: storage.apply((v) => toMBs(v)) },
2685
+ environment: {
2686
+ variables: environment,
2687
+ },
2688
+ architectures: [architecture],
2689
+ loggingConfig: logging && {
2690
+ logFormat: logging.format === "json" ? "JSON" : "Text",
2691
+ logGroup: logging.logGroup ?? logGroup!.name,
2692
+ },
2693
+ vpcConfig: vpc && {
2694
+ securityGroupIds: vpc.securityGroups,
2695
+ subnetIds: vpc.privateSubnets,
2696
+ },
2697
+ fileSystemConfig: volume && {
2698
+ arn: volume.efs,
2699
+ localMountPath: volume.path,
2700
+ },
2701
+ layers: args.layers,
2702
+ tags: args.tags,
2703
+ publish: output(args.versioning).apply(
2704
+ (v) => v ?? Boolean(args.durable),
2705
+ ),
2706
+ reservedConcurrentExecutions: concurrency?.reserved,
2707
+ durableConfig: durable && {
2708
+ executionTimeout: durable.timeout,
2709
+ retentionPeriod: durable.retention,
2710
+ },
2711
+ ...(isContainer
2712
+ ? {
2713
+ packageType: "Image",
2714
+ imageUri: imageAsset!.ref.apply(
2715
+ (ref) => ref?.replace(":latest", ""),
2716
+ ),
2717
+ imageConfig: {
2718
+ commands: [
2719
+ all([handler, runtime]).apply(([handler, runtime]) => {
2720
+ // If a python container image we have to rewrite the handler path so lambdaric is happy
2721
+ // This means no leading . and replace all / with .
2722
+ if (isContainer && runtime.includes("python")) {
2723
+ return handler
2724
+ .replace(/\.\//g, "")
2725
+ .replace(/\//g, ".");
2726
+ }
2727
+ return handler;
2728
+ }),
2729
+ ],
2730
+ },
2731
+ }
2732
+ : {
2733
+ packageType: "Zip",
2734
+ s3Bucket: zipAsset!.bucket,
2735
+ s3Key: zipAsset!.key,
2736
+ handler: unsecret(handler),
2737
+ runtime: runtime.apply((v) =>
2738
+ v === "go" || v === "rust" ? "provided.al2023" : v,
2739
+ ),
2740
+ }),
2741
+ },
2742
+ { parent },
2743
+ );
2744
+ return new lambda.Function(
2745
+ transformed[0],
2746
+ {
2747
+ ...transformed[1],
2748
+ ...(dev
2749
+ ? {
2750
+ description: transformed[1].description
2751
+ ? output(transformed[1].description).apply(
2752
+ (v) => (v ? `${v.substring(0, 240)} (live)` : "live"),
2753
+ )
2754
+ : "live",
2755
+ runtime: resolveDevRuntime(),
2756
+ architectures: ["x86_64"],
2757
+ }
2758
+ : {}),
2759
+ },
2760
+ transformed[2],
2761
+ );
2762
+
2763
+ function resolveDevRuntime() {
2764
+ if (durable) {
2765
+ return "nodejs24.x";
2766
+ }
2767
+
2768
+ return "provided.al2023";
2769
+ }
2770
+ },
2771
+ );
2772
+ }
2773
+
2774
+ function createUrl(): {
2775
+ endpoint: Output<string | undefined>;
2776
+ resource: Output<lambda.FunctionUrl | undefined>;
2777
+ } {
2778
+ const result = url.apply((url) => {
2779
+ if (url === undefined)
2780
+ return { endpoint: output(undefined), resource: undefined };
2781
+
2782
+ const authorization = output(url.authorization ?? "none");
2783
+ const isOac = output(url.route?.routerProtection).apply(
2784
+ (p) => p?.mode === "oac" || p?.mode === "oac-with-edge-signing",
2785
+ );
2786
+ const isIam = all([isOac, authorization]).apply(
2787
+ ([oac, authorization]) => oac || authorization === "iam",
2788
+ );
2789
+
2790
+ /**
2791
+ * Lambda Function URLs only accept alias names in the explicit `qualifier`
2792
+ * field. Durable functions with URLs therefore need an alias target here,
2793
+ * even when the underlying function is still on `$LATEST`.
2794
+ * See https://github.com/hashicorp/terraform-provider-aws/issues/31459
2795
+ */
2796
+ const qualifier = durable
2797
+ ? new lambda.Alias(`${name}Durable`, {
2798
+ functionName: fn.arn,
2799
+ functionVersion: fn.version,
2800
+ }).name
2801
+ : undefined;
2802
+
2803
+ const fnUrl = new lambda.FunctionUrl(
2804
+ `${name}Url`,
2805
+ {
2806
+ functionName: durable ? fn.arn : fn.name,
2807
+ qualifier,
2808
+ authorizationType: isIam.apply((isIam) =>
2809
+ isIam ? "AWS_IAM" : "NONE",
2810
+ ),
2811
+ invokeMode: streaming.apply((streaming) =>
2812
+ streaming ? "RESPONSE_STREAM" : "BUFFERED",
2813
+ ),
2814
+ cors: url.cors,
2815
+ },
2816
+ { parent },
2817
+ );
2818
+
2819
+ if (!url.route) {
2820
+ authorization.apply((authorization) => {
2821
+ if (authorization !== "none") return;
2822
+
2823
+ new lambda.Permission(
2824
+ `${name}PublicFunctionUrlAccess`,
2825
+ {
2826
+ action: "lambda:InvokeFunctionUrl",
2827
+ function: fn.name,
2828
+ principal: "*",
2829
+ functionUrlAuthType: "NONE",
2830
+ },
2831
+ { parent, dependsOn: [fnUrl] },
2832
+ );
2833
+ new lambda.Permission(
2834
+ `${name}InvokeFunction`,
2835
+ {
2836
+ action: "lambda:InvokeFunction",
2837
+ function: fn.name,
2838
+ principal: "*",
2839
+ invokedViaFunctionUrl: true,
2840
+ },
2841
+ { parent, dependsOn: [fnUrl] },
2842
+ );
2843
+ });
2844
+ return { endpoint: fnUrl.functionUrl, resource: fnUrl };
2845
+ }
2846
+
2847
+ // Create permissions based on Router protection mode
2848
+ all([isOac, authorization, url.route.routerDistributionArn]).apply(
2849
+ ([oac, authorization, distributionArn]) => {
2850
+ if (oac && distributionArn) {
2851
+ new lambda.Permission(
2852
+ `${name}CloudFrontFunctionUrlAccess`,
2853
+ {
2854
+ action: "lambda:InvokeFunctionUrl",
2855
+ function: fn.name,
2856
+ principal: "cloudfront.amazonaws.com",
2857
+ sourceArn: distributionArn,
2858
+ },
2859
+ { parent, dependsOn: [fnUrl] },
2860
+ );
2861
+ new lambda.Permission(
2862
+ `${name}CloudFrontInvokeFunction`,
2863
+ {
2864
+ action: "lambda:InvokeFunction",
2865
+ function: fn.name,
2866
+ principal: "cloudfront.amazonaws.com",
2867
+ sourceArn: distributionArn,
2868
+ invokedViaFunctionUrl: true,
2869
+ },
2870
+ { parent, dependsOn: [fnUrl] },
2871
+ );
2872
+ } else if (authorization === "none") {
2873
+ new lambda.Permission(
2874
+ `${name}PublicFunctionUrlAccess`,
2875
+ {
2876
+ action: "lambda:InvokeFunctionUrl",
2877
+ function: fn.name,
2878
+ principal: "*",
2879
+ functionUrlAuthType: "NONE",
2880
+ },
2881
+ { parent, dependsOn: [fnUrl] },
2882
+ );
2883
+ new lambda.Permission(
2884
+ `${name}PublicInvokeFunction`,
2885
+ {
2886
+ action: "lambda:InvokeFunction",
2887
+ function: fn.name,
2888
+ principal: "*",
2889
+ invokedViaFunctionUrl: true,
2890
+ },
2891
+ { parent, dependsOn: [fnUrl] },
2892
+ );
2893
+ }
2894
+ },
2895
+ );
2896
+
2897
+ // add router route
2898
+ const routeNamespace = crypto
2899
+ .createHash("md5")
2900
+ .update(`${$app.name}-${$app.stage}-${name}`)
2901
+ .digest("hex")
2902
+ .substring(0, 4);
2903
+ new KvKeys(
2904
+ `${name}RouteKey`,
2905
+ {
2906
+ store: url.route.routerKvStoreArn,
2907
+ namespace: routeNamespace,
2908
+ entries: all([fnUrl.functionUrl, isOac, url.route]).apply(
2909
+ ([fnUrlValue, oac, route]) => {
2910
+ const timeouts = [
2911
+ "connectionTimeout" as const,
2912
+ "readTimeout" as const,
2913
+ "keepAliveTimeout" as const,
2914
+ ].flatMap((k) => {
2915
+ const value = route[k];
2916
+ return value ? [[k, toSeconds(value)]] : [];
2917
+ });
2918
+ return {
2919
+ metadata: JSON.stringify({
2920
+ host: new URL(fnUrlValue).host,
2921
+ rewrite: route.rewrite,
2922
+ origin: {
2923
+ ...(oac
2924
+ ? {
2925
+ originAccessControlConfig: {
2926
+ enabled: true,
2927
+ signingBehavior: "always",
2928
+ signingProtocol: "sigv4",
2929
+ originType: "lambda",
2930
+ },
2931
+ }
2932
+ : {}),
2933
+ connectionAttempts: route.connectionAttempts,
2934
+ ...(timeouts.length
2935
+ ? { timeouts: Object.fromEntries(timeouts) }
2936
+ : {}),
2937
+ },
2938
+ }),
2939
+ };
2940
+ },
2941
+ ),
2942
+ purge: false,
2943
+ },
2944
+ { parent },
2945
+ );
2946
+ new KvRoutesUpdate(
2947
+ `${name}RoutesUpdate`,
2948
+ {
2949
+ store: url.route.routerKvStoreArn,
2950
+ namespace: url.route.routerKvNamespace,
2951
+ key: "routes",
2952
+ entry: url.route.apply((route) =>
2953
+ ["url", routeNamespace, route.hostPattern, route.pathPrefix].join(
2954
+ ",",
2955
+ ),
2956
+ ),
2957
+ },
2958
+ { parent },
2959
+ );
2960
+ return { endpoint: url.route.routerUrl, resource: fnUrl };
2961
+ });
2962
+ return {
2963
+ endpoint: result.apply((r) => r.endpoint),
2964
+ resource: result.apply((r) => r.resource),
2965
+ };
2966
+ }
2967
+
2968
+ function createProvisioned() {
2969
+ return all([args.concurrency, fn.publish]).apply(
2970
+ ([concurrency, publish]) => {
2971
+ if (!concurrency?.provisioned || concurrency.provisioned === 0) {
2972
+ return;
2973
+ }
2974
+
2975
+ if (publish !== true) {
2976
+ throw new VisibleError(
2977
+ `Provisioned concurrency requires function versioning. Set "versioning: true" to enable function versioning.`,
2978
+ );
2979
+ }
2980
+
2981
+ return new lambda.ProvisionedConcurrencyConfig(
2982
+ `${name}Provisioned`,
2983
+ {
2984
+ functionName: fn.name,
2985
+ qualifier: fn.version,
2986
+ provisionedConcurrentExecutions: concurrency.provisioned,
2987
+ },
2988
+ { parent },
2989
+ );
2990
+ },
2991
+ );
2992
+ }
2993
+
2994
+ function createEventInvokeConfig() {
2995
+ if (args.retries === undefined) {
2996
+ return undefined;
2997
+ }
2998
+
2999
+ return new lambda.FunctionEventInvokeConfig(
3000
+ ...transform(
3001
+ args.transform?.eventInvokeConfig,
3002
+ `${name}EventInvokeConfig`,
3003
+ {
3004
+ functionName: fn.name,
3005
+ maximumRetryAttempts: args.retries,
3006
+ },
3007
+ { parent },
3008
+ ),
3009
+ );
3010
+ }
3011
+ }
3012
+
3013
+ /**
3014
+ * The underlying [resources](/docs/components/#nodes) this component creates.
3015
+ */
3016
+ public get nodes() {
3017
+ return {
3018
+ /**
3019
+ * The IAM Role the function will use.
3020
+ */
3021
+ role: this.role,
3022
+ /**
3023
+ * The AWS Lambda function.
3024
+ */
3025
+ function: this.function,
3026
+ /**
3027
+ * The CloudWatch Log Group the function logs are stored.
3028
+ */
3029
+ logGroup: this.logGroup,
3030
+ /**
3031
+ * The Function Event Invoke Config resource if retries are configured.
3032
+ */
3033
+ eventInvokeConfig: this.eventInvokeConfig,
3034
+ /**
3035
+ * The Lambda Function URL resource if `url` is enabled.
3036
+ */
3037
+ url: this.urlResource,
3038
+ };
3039
+ }
3040
+
3041
+ /**
3042
+ * The Lambda function URL if `url` is enabled.
3043
+ */
3044
+ public get url() {
3045
+ return this.urlEndpoint.apply((url) => {
3046
+ if (!url) {
3047
+ throw new VisibleError(
3048
+ `Function URL is not enabled. Enable it with "url: true".`,
3049
+ );
3050
+ }
3051
+ return url;
3052
+ });
3053
+ }
3054
+
3055
+ /**
3056
+ * The name of the Lambda function.
3057
+ */
3058
+ public get name() {
3059
+ return this.function.name;
3060
+ }
3061
+
3062
+ /**
3063
+ * The ARN of the Lambda function.
3064
+ */
3065
+ public get arn() {
3066
+ return this.function.arn;
3067
+ }
3068
+
3069
+ /** @internal */
3070
+ private get useQualifiedTarget() {
3071
+ return this.function.publish.apply(
3072
+ (publish) => (publish ?? false) || this.durable,
3073
+ );
3074
+ }
3075
+
3076
+ /** @internal */
3077
+ public get targetArn() {
3078
+ return this.useQualifiedTarget.apply((useQualifiedTarget) =>
3079
+ useQualifiedTarget ? this.function.qualifiedArn : this.arn,
3080
+ );
3081
+ }
3082
+
3083
+ /** @internal */
3084
+ public get qualifier() {
3085
+ return this.targetArn.apply(
3086
+ (arn) => splitQualifiedFunctionArn(arn).qualifier,
3087
+ );
3088
+ }
3089
+
3090
+ /** @internal */
3091
+ public get targetInvokeArn() {
3092
+ return this.useQualifiedTarget.apply((useQualifiedTarget) =>
3093
+ useQualifiedTarget
3094
+ ? this.function.qualifiedInvokeArn
3095
+ : this.function.invokeArn,
3096
+ );
3097
+ }
3098
+
3099
+ /** @internal */
3100
+ public get targetResponseStreamingInvokeArn() {
3101
+ return this.useQualifiedTarget.apply((useQualifiedTarget) =>
3102
+ useQualifiedTarget
3103
+ ? all([
3104
+ this.arn,
3105
+ this.function.qualifiedArn,
3106
+ this.function.responseStreamingInvokeArn,
3107
+ ]).apply(([arn, qualifiedArn, responseStreamingInvokeArn]) =>
3108
+ responseStreamingInvokeArn.replace(arn, qualifiedArn),
3109
+ )
3110
+ : this.function.responseStreamingInvokeArn,
3111
+ );
3112
+ }
3113
+
3114
+ /**
3115
+ * Add environment variables lazily to the function after the function is created.
3116
+ *
3117
+ * This is useful for adding environment variables that are only available after the
3118
+ * function is created, like the function URL.
3119
+ *
3120
+ * @param environment The environment variables to add to the function.
3121
+ *
3122
+ * @example
3123
+ * Add the function URL as an environment variable.
3124
+ *
3125
+ * ```ts title="sst.config.ts"
3126
+ * const fn = new sst.aws.Function("MyFunction", {
3127
+ * handler: "src/handler.handler",
3128
+ * url: true,
3129
+ * });
3130
+ *
3131
+ * fn.addEnvironment({
3132
+ * URL: fn.url,
3133
+ * });
3134
+ * ```
3135
+ */
3136
+ public addEnvironment(environment: Input<Record<string, Input<string>>>) {
3137
+ return new FunctionEnvironmentUpdate(
3138
+ `${this.constructorName}EnvironmentUpdate`,
3139
+ {
3140
+ functionName: this.name,
3141
+ environment,
3142
+ region: getRegionOutput(undefined, { parent: this }).region,
3143
+ functionLastModified: this.function.lastModified,
3144
+ },
3145
+ { parent: this },
3146
+ );
3147
+ }
3148
+
3149
+ /** @internal */
3150
+ static fromDefinition(
3151
+ name: string,
3152
+ definition: Input<string | FunctionArgs>,
3153
+ override: Pick<FunctionArgs, "description" | "permissions">,
3154
+ argsTransform?: Transform<FunctionArgs>,
3155
+ opts?: ComponentResourceOptions,
3156
+ ) {
3157
+ return output(definition).apply((definition) => {
3158
+ if (typeof definition === "string") {
3159
+ return new Function(
3160
+ ...transform(
3161
+ argsTransform,
3162
+ name,
3163
+ { handler: definition, ...override },
3164
+ opts || {},
3165
+ ),
3166
+ );
3167
+ } else if (definition.handler) {
3168
+ return new Function(
3169
+ ...transform(
3170
+ argsTransform,
3171
+ name,
3172
+ {
3173
+ ...definition,
3174
+ ...override,
3175
+ permissions: all([
3176
+ definition.permissions,
3177
+ override?.permissions,
3178
+ ]).apply(([permissions, overridePermissions]) => [
3179
+ ...(permissions ?? []),
3180
+ ...(overridePermissions ?? []),
3181
+ ]),
3182
+ },
3183
+ opts || {},
3184
+ ),
3185
+ );
3186
+ }
3187
+ throw new Error(`Invalid function definition for the "${name}" Function`);
3188
+ });
3189
+ }
3190
+
3191
+ /** @internal */
3192
+ public getSSTLink() {
3193
+ return {
3194
+ properties: {
3195
+ name: this.name,
3196
+ url: this.urlEndpoint,
3197
+ ...(this.durable
3198
+ ? {
3199
+ qualifier: this.qualifier,
3200
+ }
3201
+ : {}),
3202
+ },
3203
+ include: [
3204
+ permission({
3205
+ actions: [
3206
+ "lambda:InvokeFunction",
3207
+ ...(this.durable
3208
+ ? [
3209
+ "lambda:ListDurableExecutionsByFunction",
3210
+ "lambda:GetDurableExecution",
3211
+ "lambda:GetDurableExecutionHistory",
3212
+ "lambda:StopDurableExecution",
3213
+ "lambda:SendDurableExecutionCallbackSuccess",
3214
+ "lambda:SendDurableExecutionCallbackFailure",
3215
+ "lambda:SendDurableExecutionCallbackHeartbeat",
3216
+ ]
3217
+ : []),
3218
+ ],
3219
+ resources: [this.durable ? interpolate`${this.arn}:*` : this.arn],
3220
+ }),
3221
+ ],
3222
+ };
3223
+ }
3224
+ }
3225
+ const __pulumiType = "sst:aws:Function";
3226
+ // @ts-expect-error
3227
+ Function.__pulumiType = __pulumiType;