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

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