@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.
- package/README.md +86 -52
- package/package.json +35 -11
- package/platform/js/chunks/chunk-HIZZCEDS.js +328 -0
- package/platform/js/chunks/chunk-HIZZCEDS.js.map +6 -0
- package/platform/js/chunks/chunk-KOKHGKJ2.js +639 -0
- package/platform/js/chunks/chunk-KOKHGKJ2.js.map +6 -0
- package/platform/js/chunks/chunk-MR4XM5XA.js +473 -0
- package/platform/js/chunks/chunk-MR4XM5XA.js.map +6 -0
- package/platform/js/chunks/chunk-ONNI4XNK.js +367 -0
- package/platform/js/chunks/chunk-ONNI4XNK.js.map +6 -0
- package/platform/js/chunks/chunk-VIFHC73J.js +108 -0
- package/platform/js/chunks/chunk-VIFHC73J.js.map +6 -0
- package/platform/js/chunks/chunk-WJ6BVA46.js +10 -0
- package/platform/js/chunks/chunk-WJ6BVA46.js.map +6 -0
- package/platform/js/chunks/component-32FCLIRK.js +26 -0
- package/platform/js/chunks/component-32FCLIRK.js.map +6 -0
- package/platform/js/chunks/config-CRGKEDQW.js +10 -0
- package/platform/js/chunks/config-CRGKEDQW.js.map +6 -0
- package/platform/js/chunks/link-OJ3RNGQ3.js +9 -0
- package/platform/js/chunks/link-OJ3RNGQ3.js.map +6 -0
- package/platform/js/components/aws/index.js +35399 -0
- package/platform/js/components/aws/index.js.map +6 -0
- package/platform/js/components/cloudflare/index.js +3246 -0
- package/platform/js/components/cloudflare/index.js.map +6 -0
- package/platform/js/components/core.js +114 -0
- package/platform/js/components/core.js.map +6 -0
- package/platform/js/components/vercel/index.js +120 -0
- package/platform/js/components/vercel/index.js.map +6 -0
- package/platform/js/testing/index.js +569 -0
- package/platform/js/testing/index.js.map +6 -0
- package/platform/package.json +25 -0
- package/platform/src/ast/add.mjs +190 -0
- package/platform/src/auto/run.ts +109 -0
- package/platform/src/components/README.md +652 -0
- package/platform/src/components/args.ts +133 -0
- package/platform/src/components/aws/alb.ts +577 -0
- package/platform/src/components/aws/analog.ts +462 -0
- package/platform/src/components/aws/apigateway-websocket-route.ts +206 -0
- package/platform/src/components/aws/apigateway-websocket.ts +894 -0
- package/platform/src/components/aws/apigatewayv1-api-key.ts +90 -0
- package/platform/src/components/aws/apigatewayv1-authorizer.ts +178 -0
- package/platform/src/components/aws/apigatewayv1-base-route.ts +78 -0
- package/platform/src/components/aws/apigatewayv1-integration-route.ts +92 -0
- package/platform/src/components/aws/apigatewayv1-lambda-route.ts +152 -0
- package/platform/src/components/aws/apigatewayv1-usage-plan.ts +109 -0
- package/platform/src/components/aws/apigatewayv1.ts +1691 -0
- package/platform/src/components/aws/apigatewayv2-authorizer.ts +199 -0
- package/platform/src/components/aws/apigatewayv2-base-route.ts +69 -0
- package/platform/src/components/aws/apigatewayv2-lambda-route.ts +141 -0
- package/platform/src/components/aws/apigatewayv2-private-route.ts +101 -0
- package/platform/src/components/aws/apigatewayv2-url-route.ts +90 -0
- package/platform/src/components/aws/apigatewayv2.ts +1439 -0
- package/platform/src/components/aws/app-sync-data-source.ts +264 -0
- package/platform/src/components/aws/app-sync-function.ts +79 -0
- package/platform/src/components/aws/app-sync-resolver.ts +110 -0
- package/platform/src/components/aws/app-sync.ts +849 -0
- package/platform/src/components/aws/astro.ts +580 -0
- package/platform/src/components/aws/aurora.ts +1356 -0
- package/platform/src/components/aws/auth-v1.ts +69 -0
- package/platform/src/components/aws/auth.ts +417 -0
- package/platform/src/components/aws/bucket-lambda-subscriber.ts +162 -0
- package/platform/src/components/aws/bucket-notification.ts +254 -0
- package/platform/src/components/aws/bucket-queue-subscriber.ts +122 -0
- package/platform/src/components/aws/bucket-topic-subscriber.ts +144 -0
- package/platform/src/components/aws/bucket.ts +2046 -0
- package/platform/src/components/aws/bus-base-subscriber.ts +52 -0
- package/platform/src/components/aws/bus-lambda-subscriber.ts +125 -0
- package/platform/src/components/aws/bus-queue-subscriber.ts +88 -0
- package/platform/src/components/aws/bus.ts +630 -0
- package/platform/src/components/aws/cdn.ts +561 -0
- package/platform/src/components/aws/cluster-v1.ts +932 -0
- package/platform/src/components/aws/cluster.ts +584 -0
- package/platform/src/components/aws/cognito-identity-pool.ts +433 -0
- package/platform/src/components/aws/cognito-identity-provider.ts +96 -0
- package/platform/src/components/aws/cognito-user-pool-client.ts +114 -0
- package/platform/src/components/aws/cognito-user-pool.ts +1089 -0
- package/platform/src/components/aws/cron-v2.ts +555 -0
- package/platform/src/components/aws/cron.ts +435 -0
- package/platform/src/components/aws/dns-validated-certificate.ts +108 -0
- package/platform/src/components/aws/dns.ts +221 -0
- package/platform/src/components/aws/dsql.ts +741 -0
- package/platform/src/components/aws/dynamo-lambda-subscriber.ts +124 -0
- package/platform/src/components/aws/dynamo.ts +929 -0
- package/platform/src/components/aws/efs.ts +410 -0
- package/platform/src/components/aws/email.ts +673 -0
- package/platform/src/components/aws/fargate.ts +1279 -0
- package/platform/src/components/aws/function.ts +3280 -0
- package/platform/src/components/aws/helpers/apigateway-account.ts +78 -0
- package/platform/src/components/aws/helpers/apigatewayv2-domain.ts +144 -0
- package/platform/src/components/aws/helpers/arn.ts +182 -0
- package/platform/src/components/aws/helpers/bootstrap.ts +16 -0
- package/platform/src/components/aws/helpers/client.ts +76 -0
- package/platform/src/components/aws/helpers/container-builder.ts +33 -0
- package/platform/src/components/aws/helpers/custom-domain.ts +128 -0
- package/platform/src/components/aws/helpers/event-source.ts +41 -0
- package/platform/src/components/aws/helpers/fargate.ts +727 -0
- package/platform/src/components/aws/helpers/function-builder.ts +133 -0
- package/platform/src/components/aws/helpers/function-code.ts +224 -0
- package/platform/src/components/aws/helpers/function-part.ts +212 -0
- package/platform/src/components/aws/helpers/function-permission.ts +29 -0
- package/platform/src/components/aws/helpers/load-balancer-args.ts +88 -0
- package/platform/src/components/aws/helpers/load-balancer.ts +17 -0
- package/platform/src/components/aws/helpers/provider.ts +36 -0
- package/platform/src/components/aws/helpers/queue-policy.ts +33 -0
- package/platform/src/components/aws/helpers/rds.ts +212 -0
- package/platform/src/components/aws/helpers/site-builder.ts +41 -0
- package/platform/src/components/aws/helpers/subscriber.ts +23 -0
- package/platform/src/components/aws/helpers/vpc.ts +27 -0
- package/platform/src/components/aws/https-redirect.ts +216 -0
- package/platform/src/components/aws/iam-edit.ts +50 -0
- package/platform/src/components/aws/index.ts +61 -0
- package/platform/src/components/aws/kinesis-stream-lambda-subscriber.ts +122 -0
- package/platform/src/components/aws/kinesis-stream.ts +416 -0
- package/platform/src/components/aws/linkable.ts +32 -0
- package/platform/src/components/aws/logging.ts +25 -0
- package/platform/src/components/aws/microvm.ts +988 -0
- package/platform/src/components/aws/mysql.ts +1050 -0
- package/platform/src/components/aws/nextjs.ts +1052 -0
- package/platform/src/components/aws/nuxt.ts +527 -0
- package/platform/src/components/aws/open-search.ts +603 -0
- package/platform/src/components/aws/opencontrol.ts +235 -0
- package/platform/src/components/aws/permission.ts +80 -0
- package/platform/src/components/aws/postgres-v1.ts +537 -0
- package/platform/src/components/aws/postgres.ts +1074 -0
- package/platform/src/components/aws/providers/bucket-files.ts +32 -0
- package/platform/src/components/aws/providers/distribution-deployment-waiter.ts +27 -0
- package/platform/src/components/aws/providers/distribution-invalidation.ts +24 -0
- package/platform/src/components/aws/providers/function-environment-update.ts +46 -0
- package/platform/src/components/aws/providers/hosted-zone-lookup.ts +25 -0
- package/platform/src/components/aws/providers/kv-keys.ts +15 -0
- package/platform/src/components/aws/providers/kv-routes-update.ts +24 -0
- package/platform/src/components/aws/providers/microvm-image-prune.ts +48 -0
- package/platform/src/components/aws/providers/origin-access-control.ts +21 -0
- package/platform/src/components/aws/providers/rds-role-lookup.ts +21 -0
- package/platform/src/components/aws/providers/vector-table.ts +25 -0
- package/platform/src/components/aws/queue-lambda-subscriber.ts +135 -0
- package/platform/src/components/aws/queue.ts +712 -0
- package/platform/src/components/aws/react.ts +510 -0
- package/platform/src/components/aws/realtime-lambda-subscriber.ts +129 -0
- package/platform/src/components/aws/realtime.ts +345 -0
- package/platform/src/components/aws/redis-v1.ts +595 -0
- package/platform/src/components/aws/redis.ts +1078 -0
- package/platform/src/components/aws/remix.ts +576 -0
- package/platform/src/components/aws/router-base-route.ts +83 -0
- package/platform/src/components/aws/router-bucket-route.ts +63 -0
- package/platform/src/components/aws/router-url-route.ts +75 -0
- package/platform/src/components/aws/router.ts +3294 -0
- package/platform/src/components/aws/service-v1.ts +876 -0
- package/platform/src/components/aws/service.ts +2994 -0
- package/platform/src/components/aws/sns-topic-lambda-subscriber.ts +127 -0
- package/platform/src/components/aws/sns-topic-queue-subscriber.ts +105 -0
- package/platform/src/components/aws/sns-topic.ts +700 -0
- package/platform/src/components/aws/solid-start.ts +467 -0
- package/platform/src/components/aws/ssr-site.ts +2204 -0
- package/platform/src/components/aws/static-site.ts +1389 -0
- package/platform/src/components/aws/step-functions/choice.ts +123 -0
- package/platform/src/components/aws/step-functions/fail.ts +69 -0
- package/platform/src/components/aws/step-functions/map.ts +264 -0
- package/platform/src/components/aws/step-functions/parallel.ts +170 -0
- package/platform/src/components/aws/step-functions/pass.ts +48 -0
- package/platform/src/components/aws/step-functions/state.ts +376 -0
- package/platform/src/components/aws/step-functions/succeed.ts +31 -0
- package/platform/src/components/aws/step-functions/task.ts +538 -0
- package/platform/src/components/aws/step-functions/wait.ts +105 -0
- package/platform/src/components/aws/step-functions.ts +804 -0
- package/platform/src/components/aws/svelte-kit.ts +563 -0
- package/platform/src/components/aws/takeover/alb.ts +9 -0
- package/platform/src/components/aws/takeover/apigatewayv2.ts +43 -0
- package/platform/src/components/aws/takeover/app-sync.ts +45 -0
- package/platform/src/components/aws/takeover/aurora.ts +19 -0
- package/platform/src/components/aws/takeover/bucket.ts +94 -0
- package/platform/src/components/aws/takeover/bus.ts +43 -0
- package/platform/src/components/aws/takeover/cognito-user-pool.ts +21 -0
- package/platform/src/components/aws/takeover/cron-v2.ts +9 -0
- package/platform/src/components/aws/takeover/dsql.ts +12 -0
- package/platform/src/components/aws/takeover/dynamo.ts +31 -0
- package/platform/src/components/aws/takeover/efs.ts +9 -0
- package/platform/src/components/aws/takeover/function.ts +21 -0
- package/platform/src/components/aws/takeover/helpers.ts +26 -0
- package/platform/src/components/aws/takeover/index.ts +27 -0
- package/platform/src/components/aws/takeover/mysql.ts +17 -0
- package/platform/src/components/aws/takeover/postgres.ts +17 -0
- package/platform/src/components/aws/takeover/queue.ts +21 -0
- package/platform/src/components/aws/takeover/redis.ts +10 -0
- package/platform/src/components/aws/takeover/service.ts +22 -0
- package/platform/src/components/aws/takeover/sns-topic.ts +27 -0
- package/platform/src/components/aws/takeover/task.ts +13 -0
- package/platform/src/components/aws/tan-stack-start.ts +479 -0
- package/platform/src/components/aws/task.ts +571 -0
- package/platform/src/components/aws/v5/alb.ts +310 -0
- package/platform/src/components/aws/v5/apigatewayv2.ts +845 -0
- package/platform/src/components/aws/v5/app-sync.ts +673 -0
- package/platform/src/components/aws/v5/aurora.ts +855 -0
- package/platform/src/components/aws/v5/bucket.ts +1001 -0
- package/platform/src/components/aws/v5/bus.ts +321 -0
- package/platform/src/components/aws/v5/cluster.ts +230 -0
- package/platform/src/components/aws/v5/cognito-user-pool-client.ts +100 -0
- package/platform/src/components/aws/v5/cognito-user-pool.ts +693 -0
- package/platform/src/components/aws/v5/cron-v2.ts +316 -0
- package/platform/src/components/aws/v5/dsql.ts +665 -0
- package/platform/src/components/aws/v5/dynamo.ts +477 -0
- package/platform/src/components/aws/v5/efs.ts +311 -0
- package/platform/src/components/aws/v5/function.ts +1546 -0
- package/platform/src/components/aws/v5/index.ts +26 -0
- package/platform/src/components/aws/v5/mysql.ts +604 -0
- package/platform/src/components/aws/v5/postgres.ts +612 -0
- package/platform/src/components/aws/v5/queue.ts +271 -0
- package/platform/src/components/aws/v5/redis.ts +550 -0
- package/platform/src/components/aws/v5/service.ts +2209 -0
- package/platform/src/components/aws/v5/sns-topic.ts +284 -0
- package/platform/src/components/aws/v5/task.ts +549 -0
- package/platform/src/components/aws/vector.ts +316 -0
- package/platform/src/components/aws/vpc-v1.ts +580 -0
- package/platform/src/components/aws/vpc.ts +1641 -0
- package/platform/src/components/aws/workflow.ts +421 -0
- package/platform/src/components/base/base-site.ts +101 -0
- package/platform/src/components/base/base-ssr-site.ts +120 -0
- package/platform/src/components/base/base-static-site.ts +314 -0
- package/platform/src/components/cloudflare/account-id.ts +1 -0
- package/platform/src/components/cloudflare/ai.ts +77 -0
- package/platform/src/components/cloudflare/astro.ts +355 -0
- package/platform/src/components/cloudflare/auth.ts +69 -0
- package/platform/src/components/cloudflare/binding.ts +132 -0
- package/platform/src/components/cloudflare/bucket.ts +142 -0
- package/platform/src/components/cloudflare/cron.ts +207 -0
- package/platform/src/components/cloudflare/d1.ts +230 -0
- package/platform/src/components/cloudflare/dns.ts +253 -0
- package/platform/src/components/cloudflare/durable-object.ts +144 -0
- package/platform/src/components/cloudflare/experimental/index.ts +3 -0
- package/platform/src/components/cloudflare/experimental/solid-start.ts +288 -0
- package/platform/src/components/cloudflare/experimental/static-site.ts +4 -0
- package/platform/src/components/cloudflare/helpers/compatibility.ts +44 -0
- package/platform/src/components/cloudflare/helpers/fetch.ts +81 -0
- package/platform/src/components/cloudflare/helpers/validation.ts +74 -0
- package/platform/src/components/cloudflare/helpers/worker-builder.ts +57 -0
- package/platform/src/components/cloudflare/helpers/wrangler.ts +222 -0
- package/platform/src/components/cloudflare/hyperdrive.ts +402 -0
- package/platform/src/components/cloudflare/index.ts +25 -0
- package/platform/src/components/cloudflare/kv.ts +218 -0
- package/platform/src/components/cloudflare/providers/dns-record.ts +43 -0
- package/platform/src/components/cloudflare/providers/kv-data.ts +107 -0
- package/platform/src/components/cloudflare/providers/worker-assets.ts +41 -0
- package/platform/src/components/cloudflare/providers/worker-placement.ts +93 -0
- package/platform/src/components/cloudflare/providers/worker-script.ts +47 -0
- package/platform/src/components/cloudflare/providers/worker-url.ts +109 -0
- package/platform/src/components/cloudflare/providers/zone-lookup.ts +85 -0
- package/platform/src/components/cloudflare/queue-worker-subscriber.ts +192 -0
- package/platform/src/components/cloudflare/queue.ts +310 -0
- package/platform/src/components/cloudflare/rate-limit.ts +178 -0
- package/platform/src/components/cloudflare/react-router.ts +322 -0
- package/platform/src/components/cloudflare/ssr-site.ts +293 -0
- package/platform/src/components/cloudflare/static-site-v2.ts +428 -0
- package/platform/src/components/cloudflare/static-site.ts +470 -0
- package/platform/src/components/cloudflare/tan-stack-start.ts +408 -0
- package/platform/src/components/cloudflare/worker.ts +1080 -0
- package/platform/src/components/cloudflare/workflow.ts +319 -0
- package/platform/src/components/component.ts +242 -0
- package/platform/src/components/core.ts +43 -0
- package/platform/src/components/cpu.ts +10 -0
- package/platform/src/components/dns.ts +82 -0
- package/platform/src/components/duration.ts +67 -0
- package/platform/src/components/error.ts +5 -0
- package/platform/src/components/esbuild.ts +15 -0
- package/platform/src/components/experimental/dev-command.ts +127 -0
- package/platform/src/components/experimental/index.ts +1 -0
- package/platform/src/components/groups.ts +9 -0
- package/platform/src/components/index.ts +9 -0
- package/platform/src/components/input.ts +2 -0
- package/platform/src/components/link.ts +201 -0
- package/platform/src/components/linkable.ts +360 -0
- package/platform/src/components/naming-rules.ts +299 -0
- package/platform/src/components/naming.ts +189 -0
- package/platform/src/components/parts-component.ts +662 -0
- package/platform/src/components/parts.ts +299 -0
- package/platform/src/components/path.ts +5 -0
- package/platform/src/components/rpc/rpc.ts +110 -0
- package/platform/src/components/secret.ts +159 -0
- package/platform/src/components/size.ts +28 -0
- package/platform/src/components/takeover.ts +131 -0
- package/platform/src/components/transform.ts +107 -0
- package/platform/src/components/vercel/account-id.ts +1 -0
- package/platform/src/components/vercel/dns.ts +171 -0
- package/platform/src/components/vercel/index.ts +2 -0
- package/platform/src/components/vercel/providers/dns-record.ts +34 -0
- package/platform/src/config.ts +1463 -0
- package/platform/src/global-aliases.d.ts +37 -0
- package/platform/src/global.d.ts +374 -0
- package/platform/src/internal.d.ts +18 -0
- package/platform/src/runtime/worker/unenv.d.ts +14 -0
- package/platform/src/runtime/worker/unenv.mjs +26 -0
- package/platform/src/shim/run.js +25 -0
- package/platform/src/testing/global.ts +83 -0
- package/platform/src/testing/index.ts +103 -0
- package/platform/src/testing/mock.ts +646 -0
- package/platform/src/testing/vitest.ts +36 -0
- package/platform/src/util/compare-semver.ts +23 -0
- package/platform/src/util/fs.ts +49 -0
- package/platform/src/util/lazy.ts +12 -0
- package/platform/src/util/minify.ts +10 -0
- package/platform/src/util/package.ts +29 -0
- package/platform/src/util/semaphore.ts +29 -0
- package/platform/src/util/warn.ts +7 -0
- package/platform/types/auto/run.d.ts +9 -0
- package/platform/types/auto/run.d.ts.map +1 -0
- package/platform/types/components/args.d.ts +77 -0
- package/platform/types/components/args.d.ts.map +1 -0
- package/platform/types/components/aws/alb.d.ts +283 -0
- package/platform/types/components/aws/alb.d.ts.map +1 -0
- package/platform/types/components/aws/analog.d.ts +408 -0
- package/platform/types/components/aws/analog.d.ts.map +1 -0
- package/platform/types/components/aws/apigateway-websocket-route.d.ts +74 -0
- package/platform/types/components/aws/apigateway-websocket-route.d.ts.map +1 -0
- package/platform/types/components/aws/apigateway-websocket.d.ts +560 -0
- package/platform/types/components/aws/apigateway-websocket.d.ts.map +1 -0
- package/platform/types/components/aws/apigatewayv1-api-key.d.ts +48 -0
- package/platform/types/components/aws/apigatewayv1-api-key.d.ts.map +1 -0
- package/platform/types/components/aws/apigatewayv1-authorizer.d.ts +55 -0
- package/platform/types/components/aws/apigatewayv1-authorizer.d.ts.map +1 -0
- package/platform/types/components/aws/apigatewayv1-base-route.d.ts +36 -0
- package/platform/types/components/aws/apigatewayv1-base-route.d.ts.map +1 -0
- package/platform/types/components/aws/apigatewayv1-integration-route.d.ts +39 -0
- package/platform/types/components/aws/apigatewayv1-integration-route.d.ts.map +1 -0
- package/platform/types/components/aws/apigatewayv1-lambda-route.d.ts +53 -0
- package/platform/types/components/aws/apigatewayv1-lambda-route.d.ts.map +1 -0
- package/platform/types/components/aws/apigatewayv1-usage-plan.d.ts +53 -0
- package/platform/types/components/aws/apigatewayv1-usage-plan.d.ts.map +1 -0
- package/platform/types/components/aws/apigatewayv1.d.ts +1028 -0
- package/platform/types/components/aws/apigatewayv1.d.ts.map +1 -0
- package/platform/types/components/aws/apigatewayv2-authorizer.d.ts +54 -0
- package/platform/types/components/aws/apigatewayv2-authorizer.d.ts.map +1 -0
- package/platform/types/components/aws/apigatewayv2-base-route.d.ts +28 -0
- package/platform/types/components/aws/apigatewayv2-base-route.d.ts.map +1 -0
- package/platform/types/components/aws/apigatewayv2-lambda-route.d.ts +59 -0
- package/platform/types/components/aws/apigatewayv2-lambda-route.d.ts.map +1 -0
- package/platform/types/components/aws/apigatewayv2-private-route.d.ts +54 -0
- package/platform/types/components/aws/apigatewayv2-private-route.d.ts.map +1 -0
- package/platform/types/components/aws/apigatewayv2-url-route.d.ts +44 -0
- package/platform/types/components/aws/apigatewayv2-url-route.d.ts.map +1 -0
- package/platform/types/components/aws/apigatewayv2.d.ts +955 -0
- package/platform/types/components/aws/apigatewayv2.d.ts.map +1 -0
- package/platform/types/components/aws/app-sync-data-source.d.ts +52 -0
- package/platform/types/components/aws/app-sync-data-source.d.ts.map +1 -0
- package/platform/types/components/aws/app-sync-function.d.ts +33 -0
- package/platform/types/components/aws/app-sync-function.d.ts.map +1 -0
- package/platform/types/components/aws/app-sync-resolver.d.ts +41 -0
- package/platform/types/components/aws/app-sync-resolver.d.ts.map +1 -0
- package/platform/types/components/aws/app-sync.d.ts +638 -0
- package/platform/types/components/aws/app-sync.d.ts.map +1 -0
- package/platform/types/components/aws/astro.d.ts +409 -0
- package/platform/types/components/aws/astro.d.ts.map +1 -0
- package/platform/types/components/aws/aurora.d.ts +720 -0
- package/platform/types/components/aws/aurora.d.ts.map +1 -0
- package/platform/types/components/aws/auth-v1.d.ts +26 -0
- package/platform/types/components/aws/auth-v1.d.ts.map +1 -0
- package/platform/types/components/aws/auth.d.ts +295 -0
- package/platform/types/components/aws/auth.d.ts.map +1 -0
- package/platform/types/components/aws/bucket-lambda-subscriber.d.ts +61 -0
- package/platform/types/components/aws/bucket-lambda-subscriber.d.ts.map +1 -0
- package/platform/types/components/aws/bucket-notification.d.ts +47 -0
- package/platform/types/components/aws/bucket-notification.d.ts.map +1 -0
- package/platform/types/components/aws/bucket-queue-subscriber.d.ts +55 -0
- package/platform/types/components/aws/bucket-queue-subscriber.d.ts.map +1 -0
- package/platform/types/components/aws/bucket-topic-subscriber.d.ts +55 -0
- package/platform/types/components/aws/bucket-topic-subscriber.d.ts.map +1 -0
- package/platform/types/components/aws/bucket.d.ts +1356 -0
- package/platform/types/components/aws/bucket.d.ts.map +1 -0
- package/platform/types/components/aws/bus-base-subscriber.d.ts +20 -0
- package/platform/types/components/aws/bus-base-subscriber.d.ts.map +1 -0
- package/platform/types/components/aws/bus-lambda-subscriber.d.ts +50 -0
- package/platform/types/components/aws/bus-lambda-subscriber.d.ts.map +1 -0
- package/platform/types/components/aws/bus-queue-subscriber.d.ts +44 -0
- package/platform/types/components/aws/bus-queue-subscriber.d.ts.map +1 -0
- package/platform/types/components/aws/bus.d.ts +447 -0
- package/platform/types/components/aws/bus.d.ts.map +1 -0
- package/platform/types/components/aws/cdn.d.ts +310 -0
- package/platform/types/components/aws/cdn.d.ts.map +1 -0
- package/platform/types/components/aws/cluster-v1.d.ts +885 -0
- package/platform/types/components/aws/cluster-v1.d.ts.map +1 -0
- package/platform/types/components/aws/cluster.d.ts +364 -0
- package/platform/types/components/aws/cluster.d.ts.map +1 -0
- package/platform/types/components/aws/cognito-identity-pool.d.ts +199 -0
- package/platform/types/components/aws/cognito-identity-pool.d.ts.map +1 -0
- package/platform/types/components/aws/cognito-identity-provider.d.ts +38 -0
- package/platform/types/components/aws/cognito-identity-provider.d.ts.map +1 -0
- package/platform/types/components/aws/cognito-user-pool-client.d.ts +50 -0
- package/platform/types/components/aws/cognito-user-pool-client.d.ts.map +1 -0
- package/platform/types/components/aws/cognito-user-pool.d.ts +703 -0
- package/platform/types/components/aws/cognito-user-pool.d.ts.map +1 -0
- package/platform/types/components/aws/cron-v2.d.ts +325 -0
- package/platform/types/components/aws/cron-v2.d.ts.map +1 -0
- package/platform/types/components/aws/cron.d.ts +259 -0
- package/platform/types/components/aws/cron.d.ts.map +1 -0
- package/platform/types/components/aws/dns-validated-certificate.d.ts +27 -0
- package/platform/types/components/aws/dns-validated-certificate.d.ts.map +1 -0
- package/platform/types/components/aws/dns.d.ts +94 -0
- package/platform/types/components/aws/dns.d.ts.map +1 -0
- package/platform/types/components/aws/dsql.d.ts +369 -0
- package/platform/types/components/aws/dsql.d.ts.map +1 -0
- package/platform/types/components/aws/dynamo-lambda-subscriber.d.ts +55 -0
- package/platform/types/components/aws/dynamo-lambda-subscriber.d.ts.map +1 -0
- package/platform/types/components/aws/dynamo.d.ts +628 -0
- package/platform/types/components/aws/dynamo.d.ts.map +1 -0
- package/platform/types/components/aws/efs.d.ts +217 -0
- package/platform/types/components/aws/efs.d.ts.map +1 -0
- package/platform/types/components/aws/email.d.ts +370 -0
- package/platform/types/components/aws/email.d.ts.map +1 -0
- package/platform/types/components/aws/fargate.d.ts +894 -0
- package/platform/types/components/aws/fargate.d.ts.map +1 -0
- package/platform/types/components/aws/function.d.ts +1780 -0
- package/platform/types/components/aws/function.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/apigateway-account.d.ts +3 -0
- package/platform/types/components/aws/helpers/apigateway-account.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/apigatewayv2-domain.d.ts +144 -0
- package/platform/types/components/aws/helpers/apigatewayv2-domain.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/arn.d.ts +51 -0
- package/platform/types/components/aws/helpers/arn.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/bootstrap.d.ts +13 -0
- package/platform/types/components/aws/helpers/bootstrap.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/client.d.ts +7 -0
- package/platform/types/components/aws/helpers/client.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/container-builder.d.ts +4 -0
- package/platform/types/components/aws/helpers/container-builder.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/custom-domain.d.ts +111 -0
- package/platform/types/components/aws/helpers/custom-domain.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/event-source.d.ts +26 -0
- package/platform/types/components/aws/helpers/event-source.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/fargate.d.ts +225 -0
- package/platform/types/components/aws/helpers/fargate.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/function-builder.d.ts +14 -0
- package/platform/types/components/aws/helpers/function-builder.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/function-code.d.ts +80 -0
- package/platform/types/components/aws/helpers/function-code.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/function-part.d.ts +61 -0
- package/platform/types/components/aws/helpers/function-part.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/function-permission.d.ts +17 -0
- package/platform/types/components/aws/helpers/function-permission.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/load-balancer-args.d.ts +40 -0
- package/platform/types/components/aws/helpers/load-balancer-args.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/load-balancer.d.ts +9 -0
- package/platform/types/components/aws/helpers/load-balancer.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/provider.d.ts +3 -0
- package/platform/types/components/aws/helpers/provider.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/queue-policy.d.ts +11 -0
- package/platform/types/components/aws/helpers/queue-policy.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/rds.d.ts +98 -0
- package/platform/types/components/aws/helpers/rds.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/site-builder.d.ts +4 -0
- package/platform/types/components/aws/helpers/site-builder.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/subscriber.d.ts +6 -0
- package/platform/types/components/aws/helpers/subscriber.d.ts.map +1 -0
- package/platform/types/components/aws/helpers/vpc.d.ts +14 -0
- package/platform/types/components/aws/helpers/vpc.d.ts.map +1 -0
- package/platform/types/components/aws/https-redirect.d.ts +38 -0
- package/platform/types/components/aws/https-redirect.d.ts.map +1 -0
- package/platform/types/components/aws/iam-edit.d.ts +39 -0
- package/platform/types/components/aws/iam-edit.d.ts.map +1 -0
- package/platform/types/components/aws/index.d.ts +56 -0
- package/platform/types/components/aws/index.d.ts.map +1 -0
- package/platform/types/components/aws/kinesis-stream-lambda-subscriber.d.ts +49 -0
- package/platform/types/components/aws/kinesis-stream-lambda-subscriber.d.ts.map +1 -0
- package/platform/types/components/aws/kinesis-stream.d.ts +254 -0
- package/platform/types/components/aws/kinesis-stream.d.ts.map +1 -0
- package/platform/types/components/aws/linkable.d.ts +17 -0
- package/platform/types/components/aws/linkable.d.ts.map +1 -0
- package/platform/types/components/aws/logging.d.ts +26 -0
- package/platform/types/components/aws/logging.d.ts.map +1 -0
- package/platform/types/components/aws/microvm.d.ts +439 -0
- package/platform/types/components/aws/microvm.d.ts.map +1 -0
- package/platform/types/components/aws/mysql.d.ts +528 -0
- package/platform/types/components/aws/mysql.d.ts.map +1 -0
- package/platform/types/components/aws/nextjs.d.ts +534 -0
- package/platform/types/components/aws/nextjs.d.ts.map +1 -0
- package/platform/types/components/aws/nuxt.d.ts +480 -0
- package/platform/types/components/aws/nuxt.d.ts.map +1 -0
- package/platform/types/components/aws/open-search.d.ts +306 -0
- package/platform/types/components/aws/open-search.d.ts.map +1 -0
- package/platform/types/components/aws/opencontrol.d.ts +169 -0
- package/platform/types/components/aws/opencontrol.d.ts.map +1 -0
- package/platform/types/components/aws/permission.d.ts +80 -0
- package/platform/types/components/aws/permission.d.ts.map +1 -0
- package/platform/types/components/aws/postgres-v1.d.ts +328 -0
- package/platform/types/components/aws/postgres-v1.d.ts.map +1 -0
- package/platform/types/components/aws/postgres.d.ts +529 -0
- package/platform/types/components/aws/postgres.d.ts.map +1 -0
- package/platform/types/components/aws/providers/bucket-files.d.ts +18 -0
- package/platform/types/components/aws/providers/bucket-files.d.ts.map +1 -0
- package/platform/types/components/aws/providers/distribution-deployment-waiter.d.ts +13 -0
- package/platform/types/components/aws/providers/distribution-deployment-waiter.d.ts.map +1 -0
- package/platform/types/components/aws/providers/distribution-invalidation.d.ts +11 -0
- package/platform/types/components/aws/providers/distribution-invalidation.d.ts.map +1 -0
- package/platform/types/components/aws/providers/function-environment-update.d.ts +33 -0
- package/platform/types/components/aws/providers/function-environment-update.d.ts.map +1 -0
- package/platform/types/components/aws/providers/hosted-zone-lookup.d.ts +11 -0
- package/platform/types/components/aws/providers/hosted-zone-lookup.d.ts.map +1 -0
- package/platform/types/components/aws/providers/kv-keys.d.ts +11 -0
- package/platform/types/components/aws/providers/kv-keys.d.ts.map +1 -0
- package/platform/types/components/aws/providers/kv-routes-update.d.ts +11 -0
- package/platform/types/components/aws/providers/kv-routes-update.d.ts.map +1 -0
- package/platform/types/components/aws/providers/microvm-image-prune.d.ts +35 -0
- package/platform/types/components/aws/providers/microvm-image-prune.d.ts.map +1 -0
- package/platform/types/components/aws/providers/origin-access-control.d.ts +8 -0
- package/platform/types/components/aws/providers/origin-access-control.d.ts.map +1 -0
- package/platform/types/components/aws/providers/rds-role-lookup.d.ts +8 -0
- package/platform/types/components/aws/providers/rds-role-lookup.d.ts.map +1 -0
- package/platform/types/components/aws/providers/vector-table.d.ts +12 -0
- package/platform/types/components/aws/providers/vector-table.d.ts.map +1 -0
- package/platform/types/components/aws/queue-lambda-subscriber.d.ts +53 -0
- package/platform/types/components/aws/queue-lambda-subscriber.d.ts.map +1 -0
- package/platform/types/components/aws/queue.d.ts +494 -0
- package/platform/types/components/aws/queue.d.ts.map +1 -0
- package/platform/types/components/aws/react.d.ts +407 -0
- package/platform/types/components/aws/react.d.ts.map +1 -0
- package/platform/types/components/aws/realtime-lambda-subscriber.d.ts +53 -0
- package/platform/types/components/aws/realtime-lambda-subscriber.d.ts.map +1 -0
- package/platform/types/components/aws/realtime.d.ts +237 -0
- package/platform/types/components/aws/realtime.d.ts.map +1 -0
- package/platform/types/components/aws/redis-v1.d.ts +348 -0
- package/platform/types/components/aws/redis-v1.d.ts.map +1 -0
- package/platform/types/components/aws/redis.d.ts +545 -0
- package/platform/types/components/aws/redis.d.ts.map +1 -0
- package/platform/types/components/aws/remix.d.ts +408 -0
- package/platform/types/components/aws/remix.d.ts.map +1 -0
- package/platform/types/components/aws/router-base-route.d.ts +28 -0
- package/platform/types/components/aws/router-base-route.d.ts.map +1 -0
- package/platform/types/components/aws/router-bucket-route.d.ts +29 -0
- package/platform/types/components/aws/router-bucket-route.d.ts.map +1 -0
- package/platform/types/components/aws/router-url-route.d.ts +28 -0
- package/platform/types/components/aws/router-url-route.d.ts.map +1 -0
- package/platform/types/components/aws/router.d.ts +1767 -0
- package/platform/types/components/aws/router.d.ts.map +1 -0
- package/platform/types/components/aws/service-v1.d.ts +78 -0
- package/platform/types/components/aws/service-v1.d.ts.map +1 -0
- package/platform/types/components/aws/service.d.ts +1756 -0
- package/platform/types/components/aws/service.d.ts.map +1 -0
- package/platform/types/components/aws/sns-topic-lambda-subscriber.d.ts +53 -0
- package/platform/types/components/aws/sns-topic-lambda-subscriber.d.ts.map +1 -0
- package/platform/types/components/aws/sns-topic-queue-subscriber.d.ts +55 -0
- package/platform/types/components/aws/sns-topic-queue-subscriber.d.ts.map +1 -0
- package/platform/types/components/aws/sns-topic.d.ts +394 -0
- package/platform/types/components/aws/sns-topic.d.ts.map +1 -0
- package/platform/types/components/aws/solid-start.d.ts +399 -0
- package/platform/types/components/aws/solid-start.d.ts.map +1 -0
- package/platform/types/components/aws/ssr-site.d.ts +895 -0
- package/platform/types/components/aws/ssr-site.d.ts.map +1 -0
- package/platform/types/components/aws/static-site.d.ts +744 -0
- package/platform/types/components/aws/static-site.d.ts.map +1 -0
- package/platform/types/components/aws/step-functions/choice.d.ts +73 -0
- package/platform/types/components/aws/step-functions/choice.d.ts.map +1 -0
- package/platform/types/components/aws/step-functions/fail.d.ts +63 -0
- package/platform/types/components/aws/step-functions/fail.d.ts.map +1 -0
- package/platform/types/components/aws/step-functions/map.d.ts +236 -0
- package/platform/types/components/aws/step-functions/map.d.ts.map +1 -0
- package/platform/types/components/aws/step-functions/parallel.d.ts +127 -0
- package/platform/types/components/aws/step-functions/parallel.d.ts.map +1 -0
- package/platform/types/components/aws/step-functions/pass.d.ts +39 -0
- package/platform/types/components/aws/step-functions/pass.d.ts.map +1 -0
- package/platform/types/components/aws/step-functions/state.d.ts +231 -0
- package/platform/types/components/aws/step-functions/state.d.ts.map +1 -0
- package/platform/types/components/aws/step-functions/succeed.d.ts +26 -0
- package/platform/types/components/aws/step-functions/succeed.d.ts.map +1 -0
- package/platform/types/components/aws/step-functions/task.d.ts +485 -0
- package/platform/types/components/aws/step-functions/task.d.ts.map +1 -0
- package/platform/types/components/aws/step-functions/wait.d.ts +91 -0
- package/platform/types/components/aws/step-functions/wait.d.ts.map +1 -0
- package/platform/types/components/aws/step-functions.d.ts +478 -0
- package/platform/types/components/aws/step-functions.d.ts.map +1 -0
- package/platform/types/components/aws/svelte-kit.d.ts +456 -0
- package/platform/types/components/aws/svelte-kit.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/alb.d.ts +2 -0
- package/platform/types/components/aws/takeover/alb.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/apigatewayv2.d.ts +2 -0
- package/platform/types/components/aws/takeover/apigatewayv2.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/app-sync.d.ts +2 -0
- package/platform/types/components/aws/takeover/app-sync.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/aurora.d.ts +2 -0
- package/platform/types/components/aws/takeover/aurora.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/bucket.d.ts +2 -0
- package/platform/types/components/aws/takeover/bucket.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/bus.d.ts +2 -0
- package/platform/types/components/aws/takeover/bus.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/cognito-user-pool.d.ts +2 -0
- package/platform/types/components/aws/takeover/cognito-user-pool.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/cron-v2.d.ts +2 -0
- package/platform/types/components/aws/takeover/cron-v2.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/dsql.d.ts +2 -0
- package/platform/types/components/aws/takeover/dsql.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/dynamo.d.ts +2 -0
- package/platform/types/components/aws/takeover/dynamo.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/efs.d.ts +2 -0
- package/platform/types/components/aws/takeover/efs.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/function.d.ts +2 -0
- package/platform/types/components/aws/takeover/function.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/helpers.d.ts +16 -0
- package/platform/types/components/aws/takeover/helpers.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/index.d.ts +28 -0
- package/platform/types/components/aws/takeover/index.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/mysql.d.ts +2 -0
- package/platform/types/components/aws/takeover/mysql.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/postgres.d.ts +2 -0
- package/platform/types/components/aws/takeover/postgres.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/queue.d.ts +2 -0
- package/platform/types/components/aws/takeover/queue.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/redis.d.ts +2 -0
- package/platform/types/components/aws/takeover/redis.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/service.d.ts +2 -0
- package/platform/types/components/aws/takeover/service.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/sns-topic.d.ts +2 -0
- package/platform/types/components/aws/takeover/sns-topic.d.ts.map +1 -0
- package/platform/types/components/aws/takeover/task.d.ts +2 -0
- package/platform/types/components/aws/takeover/task.d.ts.map +1 -0
- package/platform/types/components/aws/tan-stack-start.d.ts +359 -0
- package/platform/types/components/aws/tan-stack-start.d.ts.map +1 -0
- package/platform/types/components/aws/task.d.ts +342 -0
- package/platform/types/components/aws/task.d.ts.map +1 -0
- package/platform/types/components/aws/v5/alb.d.ts +177 -0
- package/platform/types/components/aws/v5/alb.d.ts.map +1 -0
- package/platform/types/components/aws/v5/apigatewayv2.d.ts +482 -0
- package/platform/types/components/aws/v5/apigatewayv2.d.ts.map +1 -0
- package/platform/types/components/aws/v5/app-sync.d.ts +424 -0
- package/platform/types/components/aws/v5/app-sync.d.ts.map +1 -0
- package/platform/types/components/aws/v5/aurora.d.ts +459 -0
- package/platform/types/components/aws/v5/aurora.d.ts.map +1 -0
- package/platform/types/components/aws/v5/bucket.d.ts +578 -0
- package/platform/types/components/aws/v5/bucket.d.ts.map +1 -0
- package/platform/types/components/aws/v5/bus.d.ts +255 -0
- package/platform/types/components/aws/v5/bus.d.ts.map +1 -0
- package/platform/types/components/aws/v5/cluster.d.ts +167 -0
- package/platform/types/components/aws/v5/cluster.d.ts.map +1 -0
- package/platform/types/components/aws/v5/cognito-user-pool-client.d.ts +69 -0
- package/platform/types/components/aws/v5/cognito-user-pool-client.d.ts.map +1 -0
- package/platform/types/components/aws/v5/cognito-user-pool.d.ts +396 -0
- package/platform/types/components/aws/v5/cognito-user-pool.d.ts.map +1 -0
- package/platform/types/components/aws/v5/cron-v2.d.ts +206 -0
- package/platform/types/components/aws/v5/cron-v2.d.ts.map +1 -0
- package/platform/types/components/aws/v5/dsql.d.ts +453 -0
- package/platform/types/components/aws/v5/dsql.d.ts.map +1 -0
- package/platform/types/components/aws/v5/dynamo.d.ts +328 -0
- package/platform/types/components/aws/v5/dynamo.d.ts.map +1 -0
- package/platform/types/components/aws/v5/efs.d.ts +178 -0
- package/platform/types/components/aws/v5/efs.d.ts.map +1 -0
- package/platform/types/components/aws/v5/function.d.ts +586 -0
- package/platform/types/components/aws/v5/function.d.ts.map +1 -0
- package/platform/types/components/aws/v5/index.d.ts +27 -0
- package/platform/types/components/aws/v5/index.d.ts.map +1 -0
- package/platform/types/components/aws/v5/mysql.d.ts +347 -0
- package/platform/types/components/aws/v5/mysql.d.ts.map +1 -0
- package/platform/types/components/aws/v5/postgres.d.ts +348 -0
- package/platform/types/components/aws/v5/postgres.d.ts.map +1 -0
- package/platform/types/components/aws/v5/queue.d.ts +190 -0
- package/platform/types/components/aws/v5/queue.d.ts.map +1 -0
- package/platform/types/components/aws/v5/redis.d.ts +214 -0
- package/platform/types/components/aws/v5/redis.d.ts.map +1 -0
- package/platform/types/components/aws/v5/service.d.ts +1347 -0
- package/platform/types/components/aws/v5/service.d.ts.map +1 -0
- package/platform/types/components/aws/v5/sns-topic.d.ts +226 -0
- package/platform/types/components/aws/v5/sns-topic.d.ts.map +1 -0
- package/platform/types/components/aws/v5/task.d.ts +346 -0
- package/platform/types/components/aws/v5/task.d.ts.map +1 -0
- package/platform/types/components/aws/vector.d.ts +163 -0
- package/platform/types/components/aws/vector.d.ts.map +1 -0
- package/platform/types/components/aws/vpc-v1.d.ts +208 -0
- package/platform/types/components/aws/vpc-v1.d.ts.map +1 -0
- package/platform/types/components/aws/vpc.d.ts +491 -0
- package/platform/types/components/aws/vpc.d.ts.map +1 -0
- package/platform/types/components/aws/workflow.d.ts +331 -0
- package/platform/types/components/aws/workflow.d.ts.map +1 -0
- package/platform/types/components/base/base-site.d.ts +53 -0
- package/platform/types/components/base/base-site.d.ts.map +1 -0
- package/platform/types/components/base/base-ssr-site.d.ts +13 -0
- package/platform/types/components/base/base-ssr-site.d.ts.map +1 -0
- package/platform/types/components/base/base-static-site.d.ts +199 -0
- package/platform/types/components/base/base-static-site.d.ts.map +1 -0
- package/platform/types/components/cloudflare/account-id.d.ts +2 -0
- package/platform/types/components/cloudflare/account-id.d.ts.map +1 -0
- package/platform/types/components/cloudflare/ai.d.ts +68 -0
- package/platform/types/components/cloudflare/ai.d.ts.map +1 -0
- package/platform/types/components/cloudflare/astro.d.ts +249 -0
- package/platform/types/components/cloudflare/astro.d.ts.map +1 -0
- package/platform/types/components/cloudflare/auth.d.ts +22 -0
- package/platform/types/components/cloudflare/auth.d.ts.map +1 -0
- package/platform/types/components/cloudflare/binding.d.ts +109 -0
- package/platform/types/components/cloudflare/binding.d.ts.map +1 -0
- package/platform/types/components/cloudflare/bucket.d.ts +98 -0
- package/platform/types/components/cloudflare/bucket.d.ts.map +1 -0
- package/platform/types/components/cloudflare/cron.d.ts +151 -0
- package/platform/types/components/cloudflare/cron.d.ts.map +1 -0
- package/platform/types/components/cloudflare/d1.d.ts +142 -0
- package/platform/types/components/cloudflare/d1.d.ts.map +1 -0
- package/platform/types/components/cloudflare/dns.d.ts +100 -0
- package/platform/types/components/cloudflare/dns.d.ts.map +1 -0
- package/platform/types/components/cloudflare/durable-object.d.ts +125 -0
- package/platform/types/components/cloudflare/durable-object.d.ts.map +1 -0
- package/platform/types/components/cloudflare/experimental/index.d.ts +4 -0
- package/platform/types/components/cloudflare/experimental/index.d.ts.map +1 -0
- package/platform/types/components/cloudflare/experimental/solid-start.d.ts +219 -0
- package/platform/types/components/cloudflare/experimental/solid-start.d.ts.map +1 -0
- package/platform/types/components/cloudflare/experimental/static-site.d.ts +3 -0
- package/platform/types/components/cloudflare/experimental/static-site.d.ts.map +1 -0
- package/platform/types/components/cloudflare/helpers/compatibility.d.ts +21 -0
- package/platform/types/components/cloudflare/helpers/compatibility.d.ts.map +1 -0
- package/platform/types/components/cloudflare/helpers/fetch.d.ts +19 -0
- package/platform/types/components/cloudflare/helpers/fetch.d.ts.map +1 -0
- package/platform/types/components/cloudflare/helpers/validation.d.ts +15 -0
- package/platform/types/components/cloudflare/helpers/validation.d.ts.map +1 -0
- package/platform/types/components/cloudflare/helpers/worker-builder.d.ts +10 -0
- package/platform/types/components/cloudflare/helpers/worker-builder.d.ts.map +1 -0
- package/platform/types/components/cloudflare/helpers/wrangler.d.ts +31 -0
- package/platform/types/components/cloudflare/helpers/wrangler.d.ts.map +1 -0
- package/platform/types/components/cloudflare/hyperdrive.d.ts +302 -0
- package/platform/types/components/cloudflare/hyperdrive.d.ts.map +1 -0
- package/platform/types/components/cloudflare/index.d.ts +25 -0
- package/platform/types/components/cloudflare/index.d.ts.map +1 -0
- package/platform/types/components/cloudflare/kv.d.ts +140 -0
- package/platform/types/components/cloudflare/kv.d.ts.map +1 -0
- package/platform/types/components/cloudflare/providers/dns-record.d.ts +21 -0
- package/platform/types/components/cloudflare/providers/dns-record.d.ts.map +1 -0
- package/platform/types/components/cloudflare/providers/kv-data.d.ts +23 -0
- package/platform/types/components/cloudflare/providers/kv-data.d.ts.map +1 -0
- package/platform/types/components/cloudflare/providers/worker-assets.d.ts +19 -0
- package/platform/types/components/cloudflare/providers/worker-assets.d.ts.map +1 -0
- package/platform/types/components/cloudflare/providers/worker-placement.d.ts +27 -0
- package/platform/types/components/cloudflare/providers/worker-placement.d.ts.map +1 -0
- package/platform/types/components/cloudflare/providers/worker-script.d.ts +23 -0
- package/platform/types/components/cloudflare/providers/worker-script.d.ts.map +1 -0
- package/platform/types/components/cloudflare/providers/worker-url.d.ts +24 -0
- package/platform/types/components/cloudflare/providers/worker-url.d.ts.map +1 -0
- package/platform/types/components/cloudflare/providers/zone-lookup.d.ts +22 -0
- package/platform/types/components/cloudflare/providers/zone-lookup.d.ts.map +1 -0
- package/platform/types/components/cloudflare/queue-worker-subscriber.d.ts +122 -0
- package/platform/types/components/cloudflare/queue-worker-subscriber.d.ts.map +1 -0
- package/platform/types/components/cloudflare/queue.d.ts +235 -0
- package/platform/types/components/cloudflare/queue.d.ts.map +1 -0
- package/platform/types/components/cloudflare/rate-limit.d.ts +117 -0
- package/platform/types/components/cloudflare/rate-limit.d.ts.map +1 -0
- package/platform/types/components/cloudflare/react-router.d.ts +262 -0
- package/platform/types/components/cloudflare/react-router.d.ts.map +1 -0
- package/platform/types/components/cloudflare/ssr-site.d.ts +60 -0
- package/platform/types/components/cloudflare/ssr-site.d.ts.map +1 -0
- package/platform/types/components/cloudflare/static-site-v2.d.ts +302 -0
- package/platform/types/components/cloudflare/static-site-v2.d.ts.map +1 -0
- package/platform/types/components/cloudflare/static-site.d.ts +270 -0
- package/platform/types/components/cloudflare/static-site.d.ts.map +1 -0
- package/platform/types/components/cloudflare/tan-stack-start.d.ts +259 -0
- package/platform/types/components/cloudflare/tan-stack-start.d.ts.map +1 -0
- package/platform/types/components/cloudflare/worker.d.ts +483 -0
- package/platform/types/components/cloudflare/worker.d.ts.map +1 -0
- package/platform/types/components/cloudflare/workflow.d.ts +248 -0
- package/platform/types/components/cloudflare/workflow.d.ts.map +1 -0
- package/platform/types/components/component.d.ts +67 -0
- package/platform/types/components/component.d.ts.map +1 -0
- package/platform/types/components/core.d.ts +16 -0
- package/platform/types/components/core.d.ts.map +1 -0
- package/platform/types/components/cpu.d.ts +3 -0
- package/platform/types/components/cpu.d.ts.map +1 -0
- package/platform/types/components/dns.d.ts +63 -0
- package/platform/types/components/dns.d.ts.map +1 -0
- package/platform/types/components/duration.d.ts +9 -0
- package/platform/types/components/duration.d.ts.map +1 -0
- package/platform/types/components/error.d.ts +4 -0
- package/platform/types/components/error.d.ts.map +1 -0
- package/platform/types/components/esbuild.d.ts +3 -0
- package/platform/types/components/esbuild.d.ts.map +1 -0
- package/platform/types/components/experimental/dev-command.d.ts +99 -0
- package/platform/types/components/experimental/dev-command.d.ts.map +1 -0
- package/platform/types/components/experimental/index.d.ts +2 -0
- package/platform/types/components/experimental/index.d.ts.map +1 -0
- package/platform/types/components/groups.d.ts +6 -0
- package/platform/types/components/groups.d.ts.map +1 -0
- package/platform/types/components/index.d.ts +5 -0
- package/platform/types/components/index.d.ts.map +1 -0
- package/platform/types/components/input.d.ts +3 -0
- package/platform/types/components/input.d.ts.map +1 -0
- package/platform/types/components/link.d.ts +41 -0
- package/platform/types/components/link.d.ts.map +1 -0
- package/platform/types/components/linkable.d.ts +301 -0
- package/platform/types/components/linkable.d.ts.map +1 -0
- package/platform/types/components/naming-rules.d.ts +32 -0
- package/platform/types/components/naming-rules.d.ts.map +1 -0
- package/platform/types/components/naming.d.ts +21 -0
- package/platform/types/components/naming.d.ts.map +1 -0
- package/platform/types/components/parts-component.d.ts +242 -0
- package/platform/types/components/parts-component.d.ts.map +1 -0
- package/platform/types/components/parts.d.ts +194 -0
- package/platform/types/components/parts.d.ts.map +1 -0
- package/platform/types/components/path.d.ts +2 -0
- package/platform/types/components/path.d.ts.map +1 -0
- package/platform/types/components/rpc/rpc.d.ts +19 -0
- package/platform/types/components/rpc/rpc.d.ts.map +1 -0
- package/platform/types/components/secret.d.ts +123 -0
- package/platform/types/components/secret.d.ts.map +1 -0
- package/platform/types/components/size.d.ts +5 -0
- package/platform/types/components/size.d.ts.map +1 -0
- package/platform/types/components/takeover.d.ts +88 -0
- package/platform/types/components/takeover.d.ts.map +1 -0
- package/platform/types/components/transform.d.ts +34 -0
- package/platform/types/components/transform.d.ts.map +1 -0
- package/platform/types/components/vercel/account-id.d.ts +2 -0
- package/platform/types/components/vercel/account-id.d.ts.map +1 -0
- package/platform/types/components/vercel/dns.d.ts +73 -0
- package/platform/types/components/vercel/dns.d.ts.map +1 -0
- package/platform/types/components/vercel/index.d.ts +3 -0
- package/platform/types/components/vercel/index.d.ts.map +1 -0
- package/platform/types/components/vercel/providers/dns-record.d.ts +15 -0
- package/platform/types/components/vercel/providers/dns-record.d.ts.map +1 -0
- package/platform/types/config.d.ts +1440 -0
- package/platform/types/config.d.ts.map +1 -0
- package/platform/types/global-aliases.d.ts +37 -0
- package/platform/types/global.d.ts +374 -0
- package/platform/types/internal.d.ts +18 -0
- package/platform/types/runtime/worker/unenv.d.ts +14 -0
- package/platform/types/testing/global.d.ts +11 -0
- package/platform/types/testing/global.d.ts.map +1 -0
- package/platform/types/testing/index.d.ts +80 -0
- package/platform/types/testing/index.d.ts.map +1 -0
- package/platform/types/testing/mock.d.ts +136 -0
- package/platform/types/testing/mock.d.ts.map +1 -0
- package/platform/types/testing/vitest.d.ts +19 -0
- package/platform/types/testing/vitest.d.ts.map +1 -0
- package/platform/types/util/compare-semver.d.ts +4 -0
- package/platform/types/util/compare-semver.d.ts.map +1 -0
- package/platform/types/util/fs.d.ts +5 -0
- package/platform/types/util/fs.d.ts.map +1 -0
- package/platform/types/util/lazy.d.ts +2 -0
- package/platform/types/util/lazy.d.ts.map +1 -0
- package/platform/types/util/minify.d.ts +2 -0
- package/platform/types/util/minify.d.ts.map +1 -0
- package/platform/types/util/package.d.ts +10 -0
- package/platform/types/util/package.d.ts.map +1 -0
- package/platform/types/util/semaphore.d.ts +9 -0
- package/platform/types/util/semaphore.d.ts.map +1 -0
- package/platform/types/util/warn.d.ts +2 -0
- package/platform/types/util/warn.d.ts.map +1 -0
|
@@ -0,0 +1,1546 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import crypto from "crypto";
|
|
4
|
+
import {
|
|
5
|
+
all,
|
|
6
|
+
asset,
|
|
7
|
+
ComponentResourceOptions,
|
|
8
|
+
interpolate,
|
|
9
|
+
Output,
|
|
10
|
+
output,
|
|
11
|
+
rootStackResource,
|
|
12
|
+
secret,
|
|
13
|
+
unsecret,
|
|
14
|
+
} from "@pulumi/pulumi";
|
|
15
|
+
import {
|
|
16
|
+
cloudwatch,
|
|
17
|
+
ecr,
|
|
18
|
+
getCallerIdentityOutput,
|
|
19
|
+
getPartitionOutput,
|
|
20
|
+
getRegionOutput,
|
|
21
|
+
iam,
|
|
22
|
+
lambda,
|
|
23
|
+
s3,
|
|
24
|
+
types,
|
|
25
|
+
} from "@pulumi/aws";
|
|
26
|
+
import { Image } from "@pulumi/docker-build";
|
|
27
|
+
import { V5Args, component, many, optional } from "../../parts-component";
|
|
28
|
+
import {
|
|
29
|
+
Plain,
|
|
30
|
+
ifSet,
|
|
31
|
+
plain,
|
|
32
|
+
withDefault,
|
|
33
|
+
withoutDependencies,
|
|
34
|
+
} from "../../args";
|
|
35
|
+
import type { Input } from "../../input";
|
|
36
|
+
import { VisibleError } from "../../error";
|
|
37
|
+
import { Link } from "../../link";
|
|
38
|
+
import { logicalName, physicalName } from "../../naming";
|
|
39
|
+
import { toDays, toSeconds } from "../../duration";
|
|
40
|
+
import { toMBs } from "../../size";
|
|
41
|
+
import { rpc } from "../../rpc/rpc";
|
|
42
|
+
import { warnOnce } from "../../../util/warn";
|
|
43
|
+
import {
|
|
44
|
+
Function as OriginalFunction,
|
|
45
|
+
FunctionArgs as OriginalFunctionArgs,
|
|
46
|
+
} from "../function";
|
|
47
|
+
import { Efs as OriginalEfs } from "../efs";
|
|
48
|
+
import { type TakesVpc, isVpc } from "../helpers/vpc";
|
|
49
|
+
import { Efs } from "./efs";
|
|
50
|
+
import { RETENTION } from "../logging";
|
|
51
|
+
import { Permission, permission } from "../permission";
|
|
52
|
+
import { normalizeRouteArgs } from "../router";
|
|
53
|
+
import { bootstrap } from "../helpers/bootstrap";
|
|
54
|
+
import { parseRoleArn, splitQualifiedFunctionArn } from "../helpers/arn";
|
|
55
|
+
import {
|
|
56
|
+
FunctionBundle,
|
|
57
|
+
FunctionFile,
|
|
58
|
+
buildBundle,
|
|
59
|
+
devBridgeBundle,
|
|
60
|
+
injectHandler,
|
|
61
|
+
zipCode,
|
|
62
|
+
} from "../helpers/function-code";
|
|
63
|
+
import { FunctionEnvironmentUpdate } from "../providers/function-environment-update";
|
|
64
|
+
import { KvKeys } from "../providers/kv-keys";
|
|
65
|
+
import { KvRoutesUpdate } from "../providers/kv-routes-update";
|
|
66
|
+
|
|
67
|
+
const parts = {
|
|
68
|
+
/**
|
|
69
|
+
* The IAM Role the function uses. A role you passed by its ARN is looked up when you
|
|
70
|
+
* read this, and the deploy fails if it doesn't exist.
|
|
71
|
+
*/
|
|
72
|
+
role: iam.Role,
|
|
73
|
+
/**
|
|
74
|
+
* The CloudWatch Log Group the function's logs are stored in. It isn't created when
|
|
75
|
+
* `logging` is `false`.
|
|
76
|
+
*/
|
|
77
|
+
logGroup: optional(cloudwatch.LogGroup),
|
|
78
|
+
/**
|
|
79
|
+
* The function's code: a zip file in the asset bucket of your account. A Python
|
|
80
|
+
* function deployed as a container has an `image` instead.
|
|
81
|
+
*/
|
|
82
|
+
code: optional(s3.BucketObjectv2),
|
|
83
|
+
/**
|
|
84
|
+
* The source maps of the function's code, one for each file the build writes. They
|
|
85
|
+
* are numbered from `0`, and they're only known once the function is built.
|
|
86
|
+
*/
|
|
87
|
+
sourcemap: many(s3.BucketObjectv2),
|
|
88
|
+
/**
|
|
89
|
+
* The container image of a Python function that's deployed as a container.
|
|
90
|
+
*/
|
|
91
|
+
image: optional(Image),
|
|
92
|
+
/**
|
|
93
|
+
* The AWS Lambda function.
|
|
94
|
+
*/
|
|
95
|
+
function: lambda.Function,
|
|
96
|
+
/**
|
|
97
|
+
* The Lambda function URL, when `url` is enabled.
|
|
98
|
+
*/
|
|
99
|
+
url: optional(lambda.FunctionUrl),
|
|
100
|
+
/**
|
|
101
|
+
* The alias the URL of a durable function points to.
|
|
102
|
+
*/
|
|
103
|
+
urlAlias: optional(lambda.Alias),
|
|
104
|
+
/**
|
|
105
|
+
* The permission to call the function's URL: for everyone, or for the router's
|
|
106
|
+
* distribution when the URL is behind a router that signs its requests. When the URL
|
|
107
|
+
* is behind a router, it's only known once the router is.
|
|
108
|
+
*/
|
|
109
|
+
urlAccess: optional(lambda.Permission),
|
|
110
|
+
/**
|
|
111
|
+
* The permission to invoke the function through its URL. It's given to whoever
|
|
112
|
+
* `urlAccess` is.
|
|
113
|
+
*/
|
|
114
|
+
urlInvoke: optional(lambda.Permission),
|
|
115
|
+
/**
|
|
116
|
+
* What the router needs to know to reach the function's URL, stored in the router's
|
|
117
|
+
* key value store.
|
|
118
|
+
*/
|
|
119
|
+
routeKey: optional(KvKeys),
|
|
120
|
+
/**
|
|
121
|
+
* The entry for the function's URL in the router's list of routes.
|
|
122
|
+
*/
|
|
123
|
+
routesUpdate: optional(KvRoutesUpdate),
|
|
124
|
+
/**
|
|
125
|
+
* The provisioned concurrency of the function, when `concurrency.provisioned` is set.
|
|
126
|
+
*/
|
|
127
|
+
provisioned: optional(lambda.ProvisionedConcurrencyConfig),
|
|
128
|
+
/**
|
|
129
|
+
* The settings for asynchronous invocations, when `retries` is set.
|
|
130
|
+
*/
|
|
131
|
+
eventInvokeConfig: optional(lambda.FunctionEventInvokeConfig),
|
|
132
|
+
/**
|
|
133
|
+
* The environment variables added with `addEnvironment`.
|
|
134
|
+
*/
|
|
135
|
+
environmentUpdate: optional(FunctionEnvironmentUpdate),
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
type Logging = Exclude<
|
|
139
|
+
Plain<OriginalFunctionArgs["logging"]>,
|
|
140
|
+
false | undefined
|
|
141
|
+
>;
|
|
142
|
+
type Url = Exclude<Plain<OriginalFunctionArgs["url"]>, boolean | undefined>;
|
|
143
|
+
type Python = NonNullable<Plain<OriginalFunctionArgs["python"]>>;
|
|
144
|
+
type Concurrency = NonNullable<Plain<OriginalFunctionArgs["concurrency"]>>;
|
|
145
|
+
|
|
146
|
+
export interface FunctionLoggingArgs extends Omit<Logging, "logGroup"> {}
|
|
147
|
+
|
|
148
|
+
export interface FunctionUrlArgs extends Omit<Url, "route" | "authorization"> {
|
|
149
|
+
/**
|
|
150
|
+
* The authorization used for the function URL. Supports [IAM authorization](https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html).
|
|
151
|
+
*
|
|
152
|
+
* It decides which permissions are created, so it has to be a plain value.
|
|
153
|
+
*
|
|
154
|
+
* @default `"none"`
|
|
155
|
+
* @example
|
|
156
|
+
* ```js
|
|
157
|
+
* {
|
|
158
|
+
* url: {
|
|
159
|
+
* authorization: "iam"
|
|
160
|
+
* }
|
|
161
|
+
* }
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
authorization?: "none" | "iam";
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface FunctionPythonArgs extends Omit<Python, "container"> {
|
|
168
|
+
/**
|
|
169
|
+
* Set this to `true` to deploy the function as a container image. That lifts the
|
|
170
|
+
* 250MB limit on the unzipped package to 10GB, and lets you use your own Dockerfile.
|
|
171
|
+
* It needs the Docker daemon to be running.
|
|
172
|
+
*
|
|
173
|
+
* It decides whether an image is built, so it has to be a plain value.
|
|
174
|
+
*
|
|
175
|
+
* @default `false`
|
|
176
|
+
* @example
|
|
177
|
+
* ```js
|
|
178
|
+
* {
|
|
179
|
+
* python: {
|
|
180
|
+
* container: true
|
|
181
|
+
* }
|
|
182
|
+
* }
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
185
|
+
* To use a custom Dockerfile, add one to the root of the uv workspace of the function.
|
|
186
|
+
*
|
|
187
|
+
* Disable the Docker build cache, for environments like Localstack where exporting
|
|
188
|
+
* the cache to ECR isn't supported.
|
|
189
|
+
*
|
|
190
|
+
* ```js
|
|
191
|
+
* {
|
|
192
|
+
* python: {
|
|
193
|
+
* container: {
|
|
194
|
+
* cache: false
|
|
195
|
+
* }
|
|
196
|
+
* }
|
|
197
|
+
* }
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
container?: boolean | { cache?: Input<boolean> };
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface FunctionConcurrencyArgs
|
|
204
|
+
extends Omit<Concurrency, "provisioned"> {
|
|
205
|
+
/**
|
|
206
|
+
* Provisioned concurrency keeps a number of Lambda instances ready to handle
|
|
207
|
+
* requests, which reduces cold starts. It incurs extra charges, and it needs
|
|
208
|
+
* `versioning` to be enabled.
|
|
209
|
+
*
|
|
210
|
+
* It decides whether the provisioned concurrency is created, so it has to be a
|
|
211
|
+
* plain number.
|
|
212
|
+
*
|
|
213
|
+
* @default No provisioned concurrency
|
|
214
|
+
* @example
|
|
215
|
+
* ```js
|
|
216
|
+
* {
|
|
217
|
+
* concurrency: {
|
|
218
|
+
* provisioned: 10
|
|
219
|
+
* }
|
|
220
|
+
* }
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
provisioned?: number;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface FunctionArgs
|
|
227
|
+
extends V5Args<
|
|
228
|
+
TakesVpc<
|
|
229
|
+
Omit<
|
|
230
|
+
OriginalFunctionArgs,
|
|
231
|
+
| "live"
|
|
232
|
+
| "dev"
|
|
233
|
+
| "role"
|
|
234
|
+
| "logging"
|
|
235
|
+
| "url"
|
|
236
|
+
| "python"
|
|
237
|
+
| "concurrency"
|
|
238
|
+
| "volume"
|
|
239
|
+
>
|
|
240
|
+
>,
|
|
241
|
+
typeof parts
|
|
242
|
+
> {
|
|
243
|
+
/**
|
|
244
|
+
* Mount an EFS file system to the function.
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* Create an EFS file system.
|
|
248
|
+
*
|
|
249
|
+
* ```ts title="sst.config.ts"
|
|
250
|
+
* const vpc = new sst.aws.Vpc("MyVpc");
|
|
251
|
+
* const fileSystem = new sst.aws.v5.Efs("MyFileSystem", { vpc });
|
|
252
|
+
* ```
|
|
253
|
+
*
|
|
254
|
+
* And pass it in.
|
|
255
|
+
*
|
|
256
|
+
* ```js
|
|
257
|
+
* {
|
|
258
|
+
* volume: {
|
|
259
|
+
* efs: fileSystem
|
|
260
|
+
* }
|
|
261
|
+
* }
|
|
262
|
+
* ```
|
|
263
|
+
*
|
|
264
|
+
* By default, the file system will be mounted to `/mnt/efs`. You can change this by
|
|
265
|
+
* passing in the `path` property.
|
|
266
|
+
*
|
|
267
|
+
* ```js
|
|
268
|
+
* {
|
|
269
|
+
* volume: {
|
|
270
|
+
* efs: fileSystem,
|
|
271
|
+
* path: "/mnt/my-files"
|
|
272
|
+
* }
|
|
273
|
+
* }
|
|
274
|
+
* ```
|
|
275
|
+
*
|
|
276
|
+
* To use an existing EFS, you can pass in an EFS access point ARN.
|
|
277
|
+
*
|
|
278
|
+
* ```js
|
|
279
|
+
* {
|
|
280
|
+
* volume: {
|
|
281
|
+
* efs: "arn:aws:elasticfilesystem:us-east-1:123456789012:access-point/fsap-12345678",
|
|
282
|
+
* }
|
|
283
|
+
* }
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
volume?: Input<{
|
|
287
|
+
/**
|
|
288
|
+
* The EFS file system to mount. Or an EFS access point ARN.
|
|
289
|
+
*/
|
|
290
|
+
efs: Input<OriginalEfs | Efs | string>;
|
|
291
|
+
/**
|
|
292
|
+
* The path to mount the volume.
|
|
293
|
+
* @default `"/mnt/efs"`
|
|
294
|
+
*/
|
|
295
|
+
path?: Input<string>;
|
|
296
|
+
}>;
|
|
297
|
+
/**
|
|
298
|
+
* Disable running this function [_Live_](/docs/live/) in `sst dev`.
|
|
299
|
+
*
|
|
300
|
+
* By default, the functions in your app are run locally in `sst dev`. To do this, a
|
|
301
|
+
* _stub_ version of your function is deployed, instead of the real function. You can
|
|
302
|
+
* turn this off by setting `dev` to `false`. It has to be a plain value.
|
|
303
|
+
*
|
|
304
|
+
* @default `true`
|
|
305
|
+
* @example
|
|
306
|
+
* ```js
|
|
307
|
+
* {
|
|
308
|
+
* dev: false
|
|
309
|
+
* }
|
|
310
|
+
* ```
|
|
311
|
+
*/
|
|
312
|
+
dev?: Plain<OriginalFunctionArgs["dev"]>;
|
|
313
|
+
/**
|
|
314
|
+
* Configure the function logs in CloudWatch. Or pass in `false` to disable writing
|
|
315
|
+
* logs: the function is then not given permissions to write to CloudWatch.
|
|
316
|
+
*
|
|
317
|
+
* Whether the function logs has to be a plain value. The fields can be outputs.
|
|
318
|
+
*
|
|
319
|
+
* To write to a log group you already have, pass it in `existing.logGroup`.
|
|
320
|
+
*
|
|
321
|
+
* @default `{retention: "1 month", format: "text"}`
|
|
322
|
+
* @example
|
|
323
|
+
* ```js
|
|
324
|
+
* {
|
|
325
|
+
* logging: false
|
|
326
|
+
* }
|
|
327
|
+
* ```
|
|
328
|
+
*/
|
|
329
|
+
logging?: false | FunctionLoggingArgs;
|
|
330
|
+
/**
|
|
331
|
+
* Enable [Lambda function URLs](https://docs.aws.amazon.com/lambda/latest/dg/lambda-urls.html).
|
|
332
|
+
* These are dedicated endpoints for your Lambda functions.
|
|
333
|
+
*
|
|
334
|
+
* Whether there is a URL, and whether it's served through a router, have to be plain
|
|
335
|
+
* values. The fields of the CORS settings can be outputs.
|
|
336
|
+
*
|
|
337
|
+
* @default `false`
|
|
338
|
+
* @example
|
|
339
|
+
* Enable it with the default options.
|
|
340
|
+
* ```js
|
|
341
|
+
* {
|
|
342
|
+
* url: true
|
|
343
|
+
* }
|
|
344
|
+
* ```
|
|
345
|
+
*
|
|
346
|
+
* Configure the authorization and CORS settings for the URL.
|
|
347
|
+
* ```js
|
|
348
|
+
* {
|
|
349
|
+
* url: {
|
|
350
|
+
* authorization: "iam",
|
|
351
|
+
* cors: {
|
|
352
|
+
* allowOrigins: ["https://example.com"]
|
|
353
|
+
* }
|
|
354
|
+
* }
|
|
355
|
+
* }
|
|
356
|
+
* ```
|
|
357
|
+
*/
|
|
358
|
+
url?: boolean | FunctionUrlArgs;
|
|
359
|
+
/**
|
|
360
|
+
* Configure how your Python function is packaged.
|
|
361
|
+
*/
|
|
362
|
+
python?: FunctionPythonArgs;
|
|
363
|
+
/**
|
|
364
|
+
* Configure the concurrency settings for the function.
|
|
365
|
+
*
|
|
366
|
+
* @default No concurrency settings set
|
|
367
|
+
* @example
|
|
368
|
+
* ```js
|
|
369
|
+
* {
|
|
370
|
+
* concurrency: {
|
|
371
|
+
* provisioned: 10,
|
|
372
|
+
* reserved: 50
|
|
373
|
+
* }
|
|
374
|
+
* }
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
377
|
+
concurrency?: FunctionConcurrencyArgs;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* The `Function` component lets you add serverless functions to your app.
|
|
382
|
+
* It uses [AWS Lambda](https://aws.amazon.com/lambda/).
|
|
383
|
+
*
|
|
384
|
+
* It takes the same args as [`sst.aws.Function`](/docs/component/aws/function), apart from the
|
|
385
|
+
* few listed under [Switch from `Function`](#switch-from-function). It's built from parts,
|
|
386
|
+
* so every resource it creates can be transformed, is available in `nodes`, and can be
|
|
387
|
+
* swapped for one you already have.
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
*
|
|
391
|
+
* #### Minimal example
|
|
392
|
+
*
|
|
393
|
+
* Pass in the path to your handler function.
|
|
394
|
+
*
|
|
395
|
+
* ```ts title="sst.config.ts"
|
|
396
|
+
* new sst.aws.v5.Function("MyFunction", {
|
|
397
|
+
* handler: "src/lambda.handler"
|
|
398
|
+
* });
|
|
399
|
+
* ```
|
|
400
|
+
*
|
|
401
|
+
* The runtimes, and what `handler` means for each, are the same as for
|
|
402
|
+
* [`sst.aws.Function`](/docs/component/aws/function#handler).
|
|
403
|
+
*
|
|
404
|
+
* #### Set additional config
|
|
405
|
+
*
|
|
406
|
+
* ```ts {3,4} title="sst.config.ts"
|
|
407
|
+
* new sst.aws.v5.Function("MyFunction", {
|
|
408
|
+
* handler: "src/lambda.handler",
|
|
409
|
+
* timeout: "3 minutes",
|
|
410
|
+
* memory: "1024 MB"
|
|
411
|
+
* });
|
|
412
|
+
* ```
|
|
413
|
+
*
|
|
414
|
+
* #### Link resources
|
|
415
|
+
*
|
|
416
|
+
* [Link resources](/docs/linking/) to the function. This will grant permissions
|
|
417
|
+
* to the resources and allow you to access it in your handler.
|
|
418
|
+
*
|
|
419
|
+
* ```ts {5} title="sst.config.ts"
|
|
420
|
+
* const bucket = new sst.aws.v5.Bucket("MyBucket");
|
|
421
|
+
*
|
|
422
|
+
* new sst.aws.v5.Function("MyFunction", {
|
|
423
|
+
* handler: "src/lambda.handler",
|
|
424
|
+
* link: [bucket]
|
|
425
|
+
* });
|
|
426
|
+
* ```
|
|
427
|
+
*
|
|
428
|
+
* ```ts title="src/lambda.ts"
|
|
429
|
+
* import { Resource } from "sst";
|
|
430
|
+
*
|
|
431
|
+
* console.log(Resource.MyBucket.name);
|
|
432
|
+
* ```
|
|
433
|
+
*
|
|
434
|
+
* #### Enable function URLs
|
|
435
|
+
*
|
|
436
|
+
* ```ts {3} title="sst.config.ts"
|
|
437
|
+
* new sst.aws.v5.Function("MyFunction", {
|
|
438
|
+
* handler: "src/lambda.handler",
|
|
439
|
+
* url: true
|
|
440
|
+
* });
|
|
441
|
+
* ```
|
|
442
|
+
*
|
|
443
|
+
* #### Change what's created
|
|
444
|
+
*
|
|
445
|
+
* Every resource the function creates is a part you can transform.
|
|
446
|
+
*
|
|
447
|
+
* ```ts title="sst.config.ts"
|
|
448
|
+
* new sst.aws.v5.Function("MyFunction", {
|
|
449
|
+
* handler: "src/lambda.handler",
|
|
450
|
+
* url: true,
|
|
451
|
+
* transform: {
|
|
452
|
+
* function: { tracingConfig: { mode: "Active" } },
|
|
453
|
+
* logGroup: { logGroupClass: "INFREQUENT_ACCESS" },
|
|
454
|
+
* url: { invokeMode: "RESPONSE_STREAM" }
|
|
455
|
+
* }
|
|
456
|
+
* });
|
|
457
|
+
* ```
|
|
458
|
+
*
|
|
459
|
+
* #### Use a role or log group you already have
|
|
460
|
+
*
|
|
461
|
+
* Pass the resource, or the name to look it up by. A role can also be passed by its ARN.
|
|
462
|
+
* It's then used as it is, and only looked up if you read `nodes.role`.
|
|
463
|
+
*
|
|
464
|
+
* ```ts title="sst.config.ts"
|
|
465
|
+
* new sst.aws.v5.Function("MyFunction", {
|
|
466
|
+
* handler: "src/lambda.handler",
|
|
467
|
+
* existing: {
|
|
468
|
+
* role: "my-lambda-role",
|
|
469
|
+
* logGroup: "/my/shared/logs"
|
|
470
|
+
* }
|
|
471
|
+
* });
|
|
472
|
+
* ```
|
|
473
|
+
*
|
|
474
|
+
* #### Switch from `sst.aws.Function`
|
|
475
|
+
*
|
|
476
|
+
* Change `sst.aws.Function` to `sst.aws.v5.Function` and keep the name. The function, its
|
|
477
|
+
* role, log group, code and URL are kept. A few things are written differently:
|
|
478
|
+
*
|
|
479
|
+
* - `dev`, `logging`, `url`, `url.authorization`, `python`, `python.container`,
|
|
480
|
+
* `concurrency` and `concurrency.provisioned` have to be plain values, not outputs.
|
|
481
|
+
* - `role: roleArn` becomes `existing: { role: roleArn }`. It can also be the role or
|
|
482
|
+
* its name, which is looked up on every deploy.
|
|
483
|
+
* - `logging: { logGroup: name }` becomes `existing: { logGroup }`, with the log group
|
|
484
|
+
* or its name.
|
|
485
|
+
* - `live: false` becomes `dev: false`, and `url.route` becomes `url.router`.
|
|
486
|
+
* - The way `sst.aws.Function` takes those four still works.
|
|
487
|
+
* - `nodes.function` and `nodes.logGroup` are the resources themselves, not outputs.
|
|
488
|
+
* - The alias the URL of a durable function points at is created with the function's
|
|
489
|
+
* `provider`. `sst.aws.Function` created it with your app's provider, whatever the
|
|
490
|
+
* function was given. If a durable function has a `url` and a `provider`, the alias is
|
|
491
|
+
* replaced on switch, and the URL with it.
|
|
492
|
+
* - `transform: { function: { environment: { variables: { A: "1" } } } }` adds a
|
|
493
|
+
* variable where it used to replace them all.
|
|
494
|
+
*
|
|
495
|
+
* The V5 components create their functions, like a queue's subscriber, as
|
|
496
|
+
* `sst.aws.v5.Function` too. There you can keep writing the function the way
|
|
497
|
+
* `sst.aws.Function` takes it.
|
|
498
|
+
*
|
|
499
|
+
* ```ts title="sst.config.ts" del={1} ins={2}
|
|
500
|
+
* new sst.aws.Function("MyFunction", { handler: "src/lambda.handler" });
|
|
501
|
+
* new sst.aws.v5.Function("MyFunction", { handler: "src/lambda.handler" });
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
export class Function extends component("sst:aws:Function", parts) {
|
|
505
|
+
private readonly durable: boolean;
|
|
506
|
+
private readonly fn: lambda.Function;
|
|
507
|
+
private readonly urlEndpoint: Output<string | undefined>;
|
|
508
|
+
|
|
509
|
+
constructor(
|
|
510
|
+
name: string,
|
|
511
|
+
args: FunctionArgs,
|
|
512
|
+
opts?: ComponentResourceOptions,
|
|
513
|
+
) {
|
|
514
|
+
super(name, args, opts);
|
|
515
|
+
const self = this;
|
|
516
|
+
const durable = (this.durable = Boolean(args.durable));
|
|
517
|
+
|
|
518
|
+
// A function that's already deployed is only referenced
|
|
519
|
+
const existing = this.existingPart("function");
|
|
520
|
+
if (existing) {
|
|
521
|
+
this.fn = existing;
|
|
522
|
+
this.urlEndpoint = output(undefined);
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
const option = (arg: string) => `The "${arg}" of the "${name}" function`;
|
|
527
|
+
// A few options are written another way for the 4.x `Function`: `live`,
|
|
528
|
+
// `role`, `logging.logGroup` and `url.route`. They're taken here too. A
|
|
529
|
+
// `$transform` written for the 4.x one runs on this one, as they have
|
|
530
|
+
// the same type, and so does the definition of a function part.
|
|
531
|
+
const given = args as Record<string, any>;
|
|
532
|
+
const original: {
|
|
533
|
+
live?: boolean;
|
|
534
|
+
role?: Input<string>;
|
|
535
|
+
logGroup?: Input<string>;
|
|
536
|
+
} = {
|
|
537
|
+
live: given.live,
|
|
538
|
+
role: given.role,
|
|
539
|
+
logGroup: plain(given.logging, option("logging"))?.logGroup,
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
// The args that decide which resources are created are read first
|
|
543
|
+
const dev =
|
|
544
|
+
plain(args.dev, option("dev")) !== false &&
|
|
545
|
+
!(args.dev === undefined && original.live === false) &&
|
|
546
|
+
$dev;
|
|
547
|
+
const logging = normalizeLogging();
|
|
548
|
+
const url = normalizeUrl();
|
|
549
|
+
const python = plain(args.python, option("python"));
|
|
550
|
+
const container = plain(python?.container, option("python.container"));
|
|
551
|
+
const isContainer = !dev && Boolean(container);
|
|
552
|
+
const concurrency = plain(args.concurrency, option("concurrency"));
|
|
553
|
+
const provisioned = plain(
|
|
554
|
+
concurrency?.provisioned,
|
|
555
|
+
option("concurrency.provisioned"),
|
|
556
|
+
);
|
|
557
|
+
|
|
558
|
+
const partition = getPartitionOutput({}, opts).partition;
|
|
559
|
+
const region = getRegionOutput({}, opts).region;
|
|
560
|
+
const bootstrapData = region.apply((region) => bootstrap.forRegion(region));
|
|
561
|
+
const assetBucket = bootstrapData.apply((data) => data.asset);
|
|
562
|
+
// The key links are encrypted with, and the code of the dev stub, are
|
|
563
|
+
// created once for the app. `Function` holds them, so that an app with
|
|
564
|
+
// both kinds of function has one of each.
|
|
565
|
+
const encryptionKey = OriginalFunction["encryptionKey"]().base64;
|
|
566
|
+
const runtime = output(args.runtime ?? "nodejs24.x");
|
|
567
|
+
const architecture = withDefault(args.architecture, "x86_64");
|
|
568
|
+
const streaming = withDefault(args.streaming, false);
|
|
569
|
+
const injections = withDefault(args.injections, []);
|
|
570
|
+
// `Link.build` gives an output for each link, and `all` reads them. Left
|
|
571
|
+
// as outputs, each one's name would be an output where a string is read.
|
|
572
|
+
const links = output(args.link || []).apply((links) =>
|
|
573
|
+
all(Link.build(links)),
|
|
574
|
+
);
|
|
575
|
+
const copyFiles = normalizeCopyFiles();
|
|
576
|
+
const nodejs = normalizeNodeJs();
|
|
577
|
+
const vpc = normalizeVpc();
|
|
578
|
+
const volume = normalizeVolume();
|
|
579
|
+
const environment = normalizeEnvironment();
|
|
580
|
+
const durableConfig = normalizeDurable();
|
|
581
|
+
|
|
582
|
+
// A role passed by its ARN, the way 4.x takes it, is used as it is. It's
|
|
583
|
+
// only looked up when `nodes.role` is read: a lookup is an IAM GetRole on
|
|
584
|
+
// every run, for every function that shares the role. One passed by its
|
|
585
|
+
// name, or as an output, is looked up for its ARN.
|
|
586
|
+
const existingRole = args.existing?.role;
|
|
587
|
+
const givenRoleArn =
|
|
588
|
+
typeof existingRole === "string" && existingRole.startsWith("arn:")
|
|
589
|
+
? existingRole
|
|
590
|
+
: existingRole === undefined
|
|
591
|
+
? original.role
|
|
592
|
+
: undefined;
|
|
593
|
+
const lookUpRole = (id: Input<string>) =>
|
|
594
|
+
this.lookupPart(
|
|
595
|
+
"role",
|
|
596
|
+
output(id).apply((id) =>
|
|
597
|
+
id.startsWith("arn:") ? parseRoleArn(id).roleName : id,
|
|
598
|
+
),
|
|
599
|
+
);
|
|
600
|
+
let role: iam.Role | undefined;
|
|
601
|
+
if (givenRoleArn !== undefined)
|
|
602
|
+
this.partHandle("role").defer(() => (role ??= lookUpRole(givenRoleArn)));
|
|
603
|
+
else if (existingRole !== undefined && !(existingRole instanceof iam.Role))
|
|
604
|
+
role = lookUpRole(existingRole);
|
|
605
|
+
else role = this.existingPart("role") ?? this.part("role", roleArgs());
|
|
606
|
+
const roleArn = givenRoleArn ?? role!.arn;
|
|
607
|
+
|
|
608
|
+
const givenLogGroup =
|
|
609
|
+
original.logGroup !== undefined && !args.existing?.logGroup;
|
|
610
|
+
const logGroup = !logging
|
|
611
|
+
? undefined
|
|
612
|
+
: givenLogGroup
|
|
613
|
+
? this.lookupPart("logGroup", original.logGroup!)
|
|
614
|
+
: this.part(
|
|
615
|
+
"logGroup",
|
|
616
|
+
{
|
|
617
|
+
name: interpolate`/aws/lambda/${
|
|
618
|
+
args.name ?? physicalName(64, `${name}Function`)
|
|
619
|
+
}`,
|
|
620
|
+
retentionInDays: logging.retention,
|
|
621
|
+
},
|
|
622
|
+
{ ignoreChanges: ["name"] },
|
|
623
|
+
);
|
|
624
|
+
|
|
625
|
+
// Build the code. In `sst dev` the stub is deployed in its place, and the
|
|
626
|
+
// CLI is told about the function so it can run it locally.
|
|
627
|
+
const buildInput = output({
|
|
628
|
+
functionID: name,
|
|
629
|
+
handler: args.handler,
|
|
630
|
+
bundle: args.bundle,
|
|
631
|
+
encryptionKey,
|
|
632
|
+
runtime,
|
|
633
|
+
links: links.apply((links) =>
|
|
634
|
+
Object.fromEntries(links.map((item) => [item.name, item.properties])),
|
|
635
|
+
),
|
|
636
|
+
copyFiles,
|
|
637
|
+
properties: output({ nodejs, python }).apply((val) => ({
|
|
638
|
+
...(val.nodejs || val.python),
|
|
639
|
+
architecture,
|
|
640
|
+
})),
|
|
641
|
+
dev,
|
|
642
|
+
});
|
|
643
|
+
if (dev) buildInput.apply((input) => rpc.call("Runtime.AddTarget", input));
|
|
644
|
+
// What's built is files on this machine. It's given the links, and a
|
|
645
|
+
// link's name is read from the component that's linked, so without this
|
|
646
|
+
// the code would depend on every resource of every linked component. A
|
|
647
|
+
// subscriber that links what it subscribes to would wait for itself.
|
|
648
|
+
const built: Output<FunctionBundle> = dev
|
|
649
|
+
? output(devBridgeBundle(durable))
|
|
650
|
+
: withoutDependencies(
|
|
651
|
+
buildInput.apply((input) =>
|
|
652
|
+
buildBundle(
|
|
653
|
+
{ ...input, isContainer },
|
|
654
|
+
args.hook && ((dir) => args.hook!.postbuild(dir)),
|
|
655
|
+
),
|
|
656
|
+
),
|
|
657
|
+
);
|
|
658
|
+
// A Node.js handler is wrapped in a file that runs the injections first
|
|
659
|
+
const entry = all([built, runtime, streaming, injections]).apply(
|
|
660
|
+
([built, runtime, streaming, injections]): {
|
|
661
|
+
handler: string;
|
|
662
|
+
wrapper?: FunctionFile;
|
|
663
|
+
} =>
|
|
664
|
+
dev || !runtime.startsWith("nodejs")
|
|
665
|
+
? { handler: built.handler }
|
|
666
|
+
: injectHandler(name, { ...built, streaming, injections }),
|
|
667
|
+
);
|
|
668
|
+
const handler = entry.apply((entry) => entry.handler);
|
|
669
|
+
|
|
670
|
+
const image = isContainer ? createImage() : undefined;
|
|
671
|
+
const code = isContainer
|
|
672
|
+
? undefined
|
|
673
|
+
: output(dev ? devBridgeCode() : createCode());
|
|
674
|
+
|
|
675
|
+
// This is a hack to avoid handler being marked as having propertyDependencies.
|
|
676
|
+
// There is an unresolved bug in pulumi that causes issues when it does:
|
|
677
|
+
// "runtime and handler must be defined when code is zip".
|
|
678
|
+
// @ts-expect-error
|
|
679
|
+
handler.allResources = () => Promise.resolve(new Set());
|
|
680
|
+
const fn = this.part(
|
|
681
|
+
"function",
|
|
682
|
+
{
|
|
683
|
+
name: args.name,
|
|
684
|
+
description: args.description ?? "",
|
|
685
|
+
role: roleArn,
|
|
686
|
+
timeout: withDefault(args.timeout, "20 seconds", toSeconds),
|
|
687
|
+
memorySize: withDefault(args.memory, "1024 MB", toMBs),
|
|
688
|
+
ephemeralStorage: { size: withDefault(args.storage, "512 MB", toMBs) },
|
|
689
|
+
environment: { variables: environment },
|
|
690
|
+
architectures: [architecture],
|
|
691
|
+
loggingConfig: logging &&
|
|
692
|
+
logGroup && { logFormat: logging.format, logGroup: logGroup.name },
|
|
693
|
+
vpcConfig: vpc && {
|
|
694
|
+
securityGroupIds: vpc.securityGroups,
|
|
695
|
+
subnetIds: vpc.privateSubnets,
|
|
696
|
+
},
|
|
697
|
+
fileSystemConfig: volume && {
|
|
698
|
+
arn: volume.efs,
|
|
699
|
+
localMountPath: volume.path,
|
|
700
|
+
},
|
|
701
|
+
layers: args.layers,
|
|
702
|
+
tags: args.tags,
|
|
703
|
+
publish: output(args.versioning).apply((v) => v ?? durable),
|
|
704
|
+
reservedConcurrentExecutions: concurrency?.reserved,
|
|
705
|
+
durableConfig: durableConfig && {
|
|
706
|
+
executionTimeout: durableConfig.timeout,
|
|
707
|
+
retentionPeriod: durableConfig.retention,
|
|
708
|
+
},
|
|
709
|
+
...(image
|
|
710
|
+
? {
|
|
711
|
+
packageType: "Image",
|
|
712
|
+
imageUri: image.ref.apply((ref) => ref?.replace(":latest", "")),
|
|
713
|
+
imageConfig: {
|
|
714
|
+
commands: [
|
|
715
|
+
all([handler, runtime]).apply(([handler, runtime]) =>
|
|
716
|
+
// A Python image is given the handler as a module path:
|
|
717
|
+
// no leading "./", and "." in place of "/"
|
|
718
|
+
runtime.includes("python")
|
|
719
|
+
? handler.replace(/\.\//g, "").replace(/\//g, ".")
|
|
720
|
+
: handler,
|
|
721
|
+
),
|
|
722
|
+
],
|
|
723
|
+
},
|
|
724
|
+
}
|
|
725
|
+
: {
|
|
726
|
+
packageType: "Zip",
|
|
727
|
+
s3Bucket: code!.apply((code) => code.bucket),
|
|
728
|
+
s3Key: code!.apply((code) => code.key),
|
|
729
|
+
handler: unsecret(handler),
|
|
730
|
+
runtime: runtime.apply((v) =>
|
|
731
|
+
v === "go" || v === "rust" ? "provided.al2023" : v,
|
|
732
|
+
),
|
|
733
|
+
}),
|
|
734
|
+
},
|
|
735
|
+
// In `sst dev` the function is the stub, whatever its transform says
|
|
736
|
+
dev
|
|
737
|
+
? {
|
|
738
|
+
transformations: [
|
|
739
|
+
({ props, opts }) => ({
|
|
740
|
+
props: {
|
|
741
|
+
...props,
|
|
742
|
+
description: props.description
|
|
743
|
+
? output(props.description as Input<string>).apply(
|
|
744
|
+
(v) => (v ? `${v.substring(0, 240)} (live)` : "live"),
|
|
745
|
+
)
|
|
746
|
+
: "live",
|
|
747
|
+
runtime: durable ? "nodejs24.x" : "provided.al2023",
|
|
748
|
+
architectures: ["x86_64"],
|
|
749
|
+
},
|
|
750
|
+
opts,
|
|
751
|
+
}),
|
|
752
|
+
],
|
|
753
|
+
}
|
|
754
|
+
: undefined,
|
|
755
|
+
);
|
|
756
|
+
|
|
757
|
+
this.fn = fn;
|
|
758
|
+
this.urlEndpoint = url ? createUrl(url) : output(undefined);
|
|
759
|
+
|
|
760
|
+
if (provisioned)
|
|
761
|
+
this.part("provisioned", {
|
|
762
|
+
functionName: fn.name,
|
|
763
|
+
qualifier: fn.publish.apply((publish) => {
|
|
764
|
+
if (publish !== true)
|
|
765
|
+
throw new VisibleError(
|
|
766
|
+
`Provisioned concurrency requires function versioning. Set "versioning: true" to enable function versioning.`,
|
|
767
|
+
);
|
|
768
|
+
return fn.version;
|
|
769
|
+
}),
|
|
770
|
+
provisionedConcurrentExecutions: provisioned,
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
if (args.retries !== undefined)
|
|
774
|
+
this.part("eventInvokeConfig", {
|
|
775
|
+
functionName: fn.name,
|
|
776
|
+
maximumRetryAttempts: args.retries,
|
|
777
|
+
});
|
|
778
|
+
|
|
779
|
+
this.registerOutputs({
|
|
780
|
+
// What's run locally in `sst dev`
|
|
781
|
+
_live: dev
|
|
782
|
+
? unsecret(
|
|
783
|
+
all([
|
|
784
|
+
links,
|
|
785
|
+
args.handler,
|
|
786
|
+
args.bundle,
|
|
787
|
+
args.runtime,
|
|
788
|
+
nodejs,
|
|
789
|
+
copyFiles,
|
|
790
|
+
]).apply(
|
|
791
|
+
([links, handler, bundle, runtime, nodejs, copyFiles]) => ({
|
|
792
|
+
functionID: name,
|
|
793
|
+
links,
|
|
794
|
+
handler,
|
|
795
|
+
bundle,
|
|
796
|
+
runtime: runtime || "nodejs24.x",
|
|
797
|
+
copyFiles,
|
|
798
|
+
properties: nodejs,
|
|
799
|
+
}),
|
|
800
|
+
),
|
|
801
|
+
)
|
|
802
|
+
: undefined,
|
|
803
|
+
_metadata: {
|
|
804
|
+
handler: args.handler,
|
|
805
|
+
internal: args._skipMetadata,
|
|
806
|
+
dev,
|
|
807
|
+
},
|
|
808
|
+
_hint: args._skipHint ? undefined : this.urlEndpoint,
|
|
809
|
+
});
|
|
810
|
+
|
|
811
|
+
function normalizeLogging() {
|
|
812
|
+
const logging = plain(args.logging, option("logging"));
|
|
813
|
+
if (logging === false) return undefined;
|
|
814
|
+
|
|
815
|
+
if (
|
|
816
|
+
logging?.retention !== undefined &&
|
|
817
|
+
(args.existing?.logGroup || original.logGroup !== undefined)
|
|
818
|
+
)
|
|
819
|
+
throw new VisibleError(
|
|
820
|
+
`Cannot set "logging.retention" for the "${name}" function: it's given a log group, and that log group has its own retention.`,
|
|
821
|
+
);
|
|
822
|
+
|
|
823
|
+
return {
|
|
824
|
+
retention: output(logging?.retention).apply(
|
|
825
|
+
(retention) => RETENTION[retention ?? "1 month"],
|
|
826
|
+
),
|
|
827
|
+
format: output(logging?.format).apply((format) => {
|
|
828
|
+
if (durable && format && format !== "json")
|
|
829
|
+
throw new VisibleError(
|
|
830
|
+
`Durable functions require "logging.format" to be set to "json"`,
|
|
831
|
+
);
|
|
832
|
+
return (format ?? (durable ? "json" : "text")) === "json"
|
|
833
|
+
? "JSON"
|
|
834
|
+
: "Text";
|
|
835
|
+
}),
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
function normalizeUrl() {
|
|
840
|
+
const url = plain(args.url, option("url"));
|
|
841
|
+
if (url === false || url === undefined) return undefined;
|
|
842
|
+
const urlArgs = url === true ? {} : url;
|
|
843
|
+
// 4.x names the router `route.router`
|
|
844
|
+
const { router: instance, ...routing } =
|
|
845
|
+
plain((urlArgs as any).route, option("url.route")) ?? {};
|
|
846
|
+
const router =
|
|
847
|
+
urlArgs.router ?? (instance ? { ...routing, instance } : undefined);
|
|
848
|
+
|
|
849
|
+
const defaultCors: types.input.lambda.FunctionUrlCors = {
|
|
850
|
+
allowHeaders: ["*"],
|
|
851
|
+
allowMethods: ["*"],
|
|
852
|
+
allowOrigins: ["*"],
|
|
853
|
+
};
|
|
854
|
+
return {
|
|
855
|
+
authorization:
|
|
856
|
+
plain(urlArgs.authorization, option("url.authorization")) ?? "none",
|
|
857
|
+
cors: output(urlArgs.cors).apply((cors) =>
|
|
858
|
+
cors === false
|
|
859
|
+
? undefined
|
|
860
|
+
: cors === true || cors === undefined
|
|
861
|
+
? defaultCors
|
|
862
|
+
: {
|
|
863
|
+
...defaultCors,
|
|
864
|
+
...cors,
|
|
865
|
+
maxAge: cors.maxAge && toSeconds(cors.maxAge),
|
|
866
|
+
},
|
|
867
|
+
),
|
|
868
|
+
route: normalizeRouteArgs(plain(router, option("url.router"))),
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
function normalizeCopyFiles() {
|
|
873
|
+
return output(args.copyFiles ?? []).apply((copyFiles) =>
|
|
874
|
+
Promise.all(
|
|
875
|
+
copyFiles.map(async (entry) => {
|
|
876
|
+
const from = path.join($cli.paths.root, entry.from);
|
|
877
|
+
const to = entry.to || entry.from;
|
|
878
|
+
if (path.isAbsolute(to))
|
|
879
|
+
throw new VisibleError(
|
|
880
|
+
`Copy destination path "${to}" must be relative`,
|
|
881
|
+
);
|
|
882
|
+
|
|
883
|
+
const stats = await fs.promises.stat(from);
|
|
884
|
+
return { from, to, isDir: stats.isDirectory() };
|
|
885
|
+
}),
|
|
886
|
+
),
|
|
887
|
+
);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
function normalizeNodeJs() {
|
|
891
|
+
return output(args.nodejs).apply((nodejs) =>
|
|
892
|
+
nodejs?.install && Array.isArray(nodejs.install)
|
|
893
|
+
? {
|
|
894
|
+
...nodejs,
|
|
895
|
+
install: Object.fromEntries(
|
|
896
|
+
nodejs.install.map((dep) => [dep, "*"]),
|
|
897
|
+
),
|
|
898
|
+
}
|
|
899
|
+
: nodejs,
|
|
900
|
+
);
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
function normalizeVpc() {
|
|
904
|
+
if (!args.vpc) return;
|
|
905
|
+
|
|
906
|
+
if (isVpc(args.vpc)) {
|
|
907
|
+
const result = {
|
|
908
|
+
privateSubnets: args.vpc.privateSubnets,
|
|
909
|
+
securityGroups: args.vpc.securityGroups,
|
|
910
|
+
};
|
|
911
|
+
return all([
|
|
912
|
+
args.vpc.id,
|
|
913
|
+
args.vpc.nodes.natGateways,
|
|
914
|
+
args.vpc.nodes.natInstances,
|
|
915
|
+
]).apply(([id, natGateways, natInstances]) => {
|
|
916
|
+
if (natGateways.length === 0 && natInstances.length === 0) {
|
|
917
|
+
warnOnce(
|
|
918
|
+
`\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`,
|
|
919
|
+
);
|
|
920
|
+
}
|
|
921
|
+
return result;
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
return output(args.vpc).apply((vpc) => {
|
|
926
|
+
if (vpc.subnets) {
|
|
927
|
+
throw new VisibleError(
|
|
928
|
+
`The "vpc.subnets" property has been renamed to "vpc.privateSubnets". Update your code to use "vpc.privateSubnets" instead.`,
|
|
929
|
+
);
|
|
930
|
+
}
|
|
931
|
+
return vpc;
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
function normalizeVolume() {
|
|
936
|
+
if (!args.volume) return;
|
|
937
|
+
|
|
938
|
+
return output(args.volume).apply((volume) => ({
|
|
939
|
+
efs:
|
|
940
|
+
volume.efs instanceof OriginalEfs || volume.efs instanceof Efs
|
|
941
|
+
? volume.efs.nodes.accessPoint.arn
|
|
942
|
+
: output(volume.efs),
|
|
943
|
+
path: volume.path ?? "/mnt/efs",
|
|
944
|
+
}));
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
function normalizeDurable() {
|
|
948
|
+
if (!args.durable) return;
|
|
949
|
+
const config = args.durable === true ? {} : args.durable;
|
|
950
|
+
return {
|
|
951
|
+
timeout: withDefault(config.timeout, "14 days", toSeconds),
|
|
952
|
+
retention: withDefault(config.retention, "30 days", toDays),
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
function normalizeEnvironment() {
|
|
957
|
+
return all([
|
|
958
|
+
args.environment,
|
|
959
|
+
bootstrapData,
|
|
960
|
+
encryptionKey,
|
|
961
|
+
args.link,
|
|
962
|
+
args.streaming,
|
|
963
|
+
args.bundle,
|
|
964
|
+
dev ? OriginalFunction.appsync() : undefined,
|
|
965
|
+
]).apply(([environment, bootstrap, key, link, streaming, bundle, appsync]) => {
|
|
966
|
+
const result = environment ?? {};
|
|
967
|
+
result.SST_RESOURCE_App = JSON.stringify({
|
|
968
|
+
name: $app.name,
|
|
969
|
+
stage: $app.stage,
|
|
970
|
+
});
|
|
971
|
+
for (const linkable of link || []) {
|
|
972
|
+
if (!Link.isLinkable(linkable)) continue;
|
|
973
|
+
const def = linkable.getSSTLink();
|
|
974
|
+
for (const item of def.include || []) {
|
|
975
|
+
if (item.type === "environment") Object.assign(result, item.env);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
result.SST_KEY = key;
|
|
979
|
+
// Functions that share a `bundle` each have their own file, under
|
|
980
|
+
// `.sst/<name>/`, where the CLI writes it
|
|
981
|
+
result.SST_KEY_FILE = bundle
|
|
982
|
+
? `.sst/${name}/resource.enc`
|
|
983
|
+
: "resource.enc";
|
|
984
|
+
if (dev) {
|
|
985
|
+
result.SST_REGION = process.env.SST_AWS_REGION!;
|
|
986
|
+
result.SST_APPSYNC_HTTP = appsync.http;
|
|
987
|
+
result.SST_APPSYNC_REALTIME = appsync.realtime;
|
|
988
|
+
result.SST_FUNCTION_ID = name;
|
|
989
|
+
result.SST_APP = $app.name;
|
|
990
|
+
result.SST_STAGE = $app.stage;
|
|
991
|
+
result.SST_ASSET_BUCKET = bootstrap.asset;
|
|
992
|
+
if (process.env.SST_FUNCTION_TIMEOUT) {
|
|
993
|
+
result.SST_FUNCTION_TIMEOUT = process.env.SST_FUNCTION_TIMEOUT;
|
|
994
|
+
}
|
|
995
|
+
if (streaming) {
|
|
996
|
+
result.SST_FUNCTION_STREAMING = "true";
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
return result;
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
function roleArgs(): iam.RoleArgs {
|
|
1004
|
+
const linkPermissions = Link.getInclude<Permission>(
|
|
1005
|
+
"aws.permission",
|
|
1006
|
+
args.link,
|
|
1007
|
+
);
|
|
1008
|
+
// In `sst dev` the stub talks to the CLI through AppSync and the asset bucket
|
|
1009
|
+
const devPermissions = dev
|
|
1010
|
+
? [
|
|
1011
|
+
{ effect: "allow", actions: ["appsync:*"], resources: ["*"] },
|
|
1012
|
+
{
|
|
1013
|
+
effect: "allow",
|
|
1014
|
+
actions: ["s3:*"],
|
|
1015
|
+
resources: [
|
|
1016
|
+
interpolate`arn:${partition}:s3:::${assetBucket}`,
|
|
1017
|
+
interpolate`arn:${partition}:s3:::${assetBucket}/*`,
|
|
1018
|
+
],
|
|
1019
|
+
},
|
|
1020
|
+
]
|
|
1021
|
+
: [];
|
|
1022
|
+
const policy = all([args.permissions || [], linkPermissions]).apply(
|
|
1023
|
+
([argsPermissions, linkPermissions]) =>
|
|
1024
|
+
iam.getPolicyDocumentOutput({
|
|
1025
|
+
statements: [
|
|
1026
|
+
...argsPermissions,
|
|
1027
|
+
...linkPermissions,
|
|
1028
|
+
...devPermissions,
|
|
1029
|
+
].map((item) => ({
|
|
1030
|
+
effect: (() => {
|
|
1031
|
+
const effect = item.effect ?? "allow";
|
|
1032
|
+
return effect.charAt(0).toUpperCase() + effect.slice(1);
|
|
1033
|
+
})(),
|
|
1034
|
+
actions: item.actions,
|
|
1035
|
+
resources: item.resources,
|
|
1036
|
+
conditions: "conditions" in item ? item.conditions : undefined,
|
|
1037
|
+
})),
|
|
1038
|
+
}),
|
|
1039
|
+
);
|
|
1040
|
+
|
|
1041
|
+
const managed = (policy: string) =>
|
|
1042
|
+
interpolate`arn:${partition}:iam::aws:policy/service-role/${policy}`;
|
|
1043
|
+
return {
|
|
1044
|
+
// Only `sst dev` trusts the account too, so the CLI can take the role
|
|
1045
|
+
// to run the function locally. This goes by `$dev`, as `Function`
|
|
1046
|
+
// does, and not by the function's own `dev`: a site's dev server is
|
|
1047
|
+
// created with `dev: false`, and the CLI still takes its role.
|
|
1048
|
+
assumeRolePolicy: iam.getPolicyDocumentOutput({
|
|
1049
|
+
statements: [
|
|
1050
|
+
{
|
|
1051
|
+
actions: ["sts:AssumeRole"],
|
|
1052
|
+
principals: [
|
|
1053
|
+
{
|
|
1054
|
+
type: "Service",
|
|
1055
|
+
identifiers: ["lambda.amazonaws.com"],
|
|
1056
|
+
},
|
|
1057
|
+
...($dev
|
|
1058
|
+
? [
|
|
1059
|
+
{
|
|
1060
|
+
type: "AWS",
|
|
1061
|
+
identifiers: [
|
|
1062
|
+
interpolate`arn:${partition}:iam::${
|
|
1063
|
+
getCallerIdentityOutput({}, opts).accountId
|
|
1064
|
+
}:root`,
|
|
1065
|
+
],
|
|
1066
|
+
},
|
|
1067
|
+
]
|
|
1068
|
+
: []),
|
|
1069
|
+
],
|
|
1070
|
+
},
|
|
1071
|
+
],
|
|
1072
|
+
}).json,
|
|
1073
|
+
// if there are no statements, do not add an inline policy.
|
|
1074
|
+
// adding an inline policy with no statements will cause an error.
|
|
1075
|
+
inlinePolicies: policy.apply(({ statements }) =>
|
|
1076
|
+
statements ? [{ name: "inline", policy: policy.json }] : [],
|
|
1077
|
+
),
|
|
1078
|
+
managedPolicyArns: output(args.policies ?? []).apply((policies) => [
|
|
1079
|
+
...policies,
|
|
1080
|
+
...(logging ? [managed("AWSLambdaBasicExecutionRole")] : []),
|
|
1081
|
+
...(vpc ? [managed("AWSLambdaVPCAccessExecutionRole")] : []),
|
|
1082
|
+
...(durable
|
|
1083
|
+
? [managed("AWSLambdaBasicDurableExecutionRolePolicy")]
|
|
1084
|
+
: []),
|
|
1085
|
+
]),
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
// The build has already put the user's code, its config and a Dockerfile
|
|
1090
|
+
// in the artifact directory. What's left is to build the image and push
|
|
1091
|
+
// it to the container registry.
|
|
1092
|
+
function createImage() {
|
|
1093
|
+
const authToken = ecr.getAuthorizationTokenOutput({
|
|
1094
|
+
registryId: bootstrapData.assetEcrRegistryId,
|
|
1095
|
+
});
|
|
1096
|
+
// Set unless the cache is switched off
|
|
1097
|
+
const cached = output(
|
|
1098
|
+
typeof container === "object" ? container.cache : undefined,
|
|
1099
|
+
).apply((cache) => (cache === false ? undefined : true));
|
|
1100
|
+
const cacheRef = interpolate`${bootstrapData.assetEcrUrl}:${name}-cache`;
|
|
1101
|
+
|
|
1102
|
+
return self.part("image", {
|
|
1103
|
+
tags: [interpolate`${bootstrapData.assetEcrUrl}:latest`],
|
|
1104
|
+
context: {
|
|
1105
|
+
// Read once the code is built, so the image is built after it
|
|
1106
|
+
location: built.apply(() =>
|
|
1107
|
+
path.join($cli.paths.work, "artifacts", `${name}-src`),
|
|
1108
|
+
),
|
|
1109
|
+
},
|
|
1110
|
+
cacheFrom: ifSet(cached, () => [{ registry: { ref: cacheRef } }]),
|
|
1111
|
+
cacheTo: ifSet(cached, () => [
|
|
1112
|
+
{
|
|
1113
|
+
registry: {
|
|
1114
|
+
ref: cacheRef,
|
|
1115
|
+
imageManifest: true,
|
|
1116
|
+
ociMediaTypes: true,
|
|
1117
|
+
mode: "max" as const,
|
|
1118
|
+
},
|
|
1119
|
+
},
|
|
1120
|
+
]),
|
|
1121
|
+
platforms: [
|
|
1122
|
+
architecture.apply((v) =>
|
|
1123
|
+
v === "arm64" ? "linux/arm64" : "linux/amd64",
|
|
1124
|
+
),
|
|
1125
|
+
],
|
|
1126
|
+
push: true,
|
|
1127
|
+
registries: [
|
|
1128
|
+
authToken.apply((authToken) => ({
|
|
1129
|
+
address: authToken.proxyEndpoint,
|
|
1130
|
+
username: authToken.userName,
|
|
1131
|
+
password: secret(authToken.password),
|
|
1132
|
+
})),
|
|
1133
|
+
],
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
function createCode() {
|
|
1138
|
+
const zip = all([built, entry, copyFiles, args.bundle]).apply(
|
|
1139
|
+
([built, entry, copyFiles, customBundle]) =>
|
|
1140
|
+
zipCode({
|
|
1141
|
+
to: path.resolve($cli.paths.work, "artifacts", name, "code.zip"),
|
|
1142
|
+
bundle: built.bundle,
|
|
1143
|
+
sourcemaps: built.sourcemaps,
|
|
1144
|
+
copyFiles,
|
|
1145
|
+
wrapper: entry.wrapper,
|
|
1146
|
+
sharedBundle: customBundle ? name : undefined,
|
|
1147
|
+
}),
|
|
1148
|
+
);
|
|
1149
|
+
|
|
1150
|
+
// The source maps are stored under the log group the function creates,
|
|
1151
|
+
// which is where the errors to map are read from. How many there are
|
|
1152
|
+
// is only known once the code is built.
|
|
1153
|
+
const ownLogGroup =
|
|
1154
|
+
self.existingPart("logGroup") || givenLogGroup ? undefined : logGroup;
|
|
1155
|
+
if (ownLogGroup)
|
|
1156
|
+
all([built, zip]).apply(([built, zip]) =>
|
|
1157
|
+
(built.sourcemaps ?? []).forEach((file, index) =>
|
|
1158
|
+
self.part(
|
|
1159
|
+
"sourcemap",
|
|
1160
|
+
`${index}`,
|
|
1161
|
+
{
|
|
1162
|
+
key: interpolate`sourcemap/${ownLogGroup.arn}/${
|
|
1163
|
+
zip.hash
|
|
1164
|
+
}.${path.basename(file)}`,
|
|
1165
|
+
bucket: assetBucket,
|
|
1166
|
+
source: new asset.FileAsset(file),
|
|
1167
|
+
},
|
|
1168
|
+
{ retainOnDelete: true },
|
|
1169
|
+
),
|
|
1170
|
+
),
|
|
1171
|
+
);
|
|
1172
|
+
|
|
1173
|
+
return self.part("code", {
|
|
1174
|
+
key: interpolate`assets/${name}-code-${zip.hash}.zip`,
|
|
1175
|
+
bucket: assetBucket,
|
|
1176
|
+
source: zip.apply((zip) => new asset.FileArchive(zip.path)),
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
// Every live function in a region is created from the same stub, so its
|
|
1181
|
+
// code is uploaded once for the app, outside of any function.
|
|
1182
|
+
function devBridgeCode() {
|
|
1183
|
+
return all([built, region]).apply(([{ bundle }, region]) => {
|
|
1184
|
+
const cache = OriginalFunction["devBridgeCode"]();
|
|
1185
|
+
const cacheKey = `${region}:${bundle}`;
|
|
1186
|
+
const cached = cache.get(cacheKey);
|
|
1187
|
+
if (cached) return cached;
|
|
1188
|
+
|
|
1189
|
+
const stub = logicalName(path.basename(bundle));
|
|
1190
|
+
const created = zipCode({
|
|
1191
|
+
to: path.resolve(
|
|
1192
|
+
$cli.paths.work,
|
|
1193
|
+
"artifacts",
|
|
1194
|
+
`dev-bridge-${region}-${stub}`,
|
|
1195
|
+
"code.zip",
|
|
1196
|
+
),
|
|
1197
|
+
bundle,
|
|
1198
|
+
}).then(
|
|
1199
|
+
(zip) =>
|
|
1200
|
+
new s3.BucketObjectv2(
|
|
1201
|
+
`DevBridgeCode${logicalName(region)}${stub}`,
|
|
1202
|
+
{
|
|
1203
|
+
key: `assets/dev-bridge-code-${zip.hash}.zip`,
|
|
1204
|
+
bucket: assetBucket,
|
|
1205
|
+
source: new asset.FileArchive(zip.path),
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
parent: rootStackResource,
|
|
1209
|
+
provider: opts?.provider,
|
|
1210
|
+
// The dev bridge key is shared by every app and stage in this
|
|
1211
|
+
// account and region. Retain it so removing a stage, deploying it
|
|
1212
|
+
// outside dev, or changing its bridge version doesn't delete the
|
|
1213
|
+
// object other stages' Lambdas are still created from.
|
|
1214
|
+
retainOnDelete: true,
|
|
1215
|
+
},
|
|
1216
|
+
),
|
|
1217
|
+
);
|
|
1218
|
+
cache.set(cacheKey, created);
|
|
1219
|
+
created.catch(() => cache.delete(cacheKey));
|
|
1220
|
+
return created;
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
function createUrl(url: NonNullable<ReturnType<typeof normalizeUrl>>) {
|
|
1225
|
+
const { authorization, route } = url;
|
|
1226
|
+
// A router can sign its requests to the URL. Then only its
|
|
1227
|
+
// distribution may call the URL, whatever the authorization is.
|
|
1228
|
+
const isOac = output(route?.routerProtection).apply(
|
|
1229
|
+
(p) => p?.mode === "oac" || p?.mode === "oac-with-edge-signing",
|
|
1230
|
+
);
|
|
1231
|
+
|
|
1232
|
+
/**
|
|
1233
|
+
* Lambda Function URLs only accept alias names in the explicit `qualifier`
|
|
1234
|
+
* field. Durable functions with URLs therefore need an alias target here,
|
|
1235
|
+
* even when the underlying function is still on `$LATEST`.
|
|
1236
|
+
* See https://github.com/hashicorp/terraform-provider-aws/issues/31459
|
|
1237
|
+
*/
|
|
1238
|
+
const alias = durable
|
|
1239
|
+
? self.part("urlAlias", {
|
|
1240
|
+
functionName: fn.arn,
|
|
1241
|
+
functionVersion: fn.version,
|
|
1242
|
+
})
|
|
1243
|
+
: undefined;
|
|
1244
|
+
|
|
1245
|
+
const fnUrl = self.part("url", {
|
|
1246
|
+
functionName: durable ? fn.arn : fn.name,
|
|
1247
|
+
qualifier: alias?.name,
|
|
1248
|
+
authorizationType: isOac.apply((oac) =>
|
|
1249
|
+
oac || authorization === "iam" ? "AWS_IAM" : "NONE",
|
|
1250
|
+
),
|
|
1251
|
+
invokeMode: streaming.apply((streaming) =>
|
|
1252
|
+
streaming ? "RESPONSE_STREAM" : "BUFFERED",
|
|
1253
|
+
),
|
|
1254
|
+
cors: ifSet(url.cors),
|
|
1255
|
+
});
|
|
1256
|
+
|
|
1257
|
+
// Lambda takes one change to a function at a time, so a permission
|
|
1258
|
+
// added while the URL is still being created can fail with a conflict.
|
|
1259
|
+
// The permissions wait for the URL.
|
|
1260
|
+
const afterUrl = { dependsOn: [fnUrl] };
|
|
1261
|
+
|
|
1262
|
+
const allowEveryone = () => {
|
|
1263
|
+
self.part(
|
|
1264
|
+
"urlAccess",
|
|
1265
|
+
{
|
|
1266
|
+
action: "lambda:InvokeFunctionUrl",
|
|
1267
|
+
function: fn.name,
|
|
1268
|
+
principal: "*",
|
|
1269
|
+
functionUrlAuthType: "NONE",
|
|
1270
|
+
},
|
|
1271
|
+
afterUrl,
|
|
1272
|
+
);
|
|
1273
|
+
self.part(
|
|
1274
|
+
"urlInvoke",
|
|
1275
|
+
{
|
|
1276
|
+
action: "lambda:InvokeFunction",
|
|
1277
|
+
function: fn.name,
|
|
1278
|
+
principal: "*",
|
|
1279
|
+
invokedViaFunctionUrl: true,
|
|
1280
|
+
},
|
|
1281
|
+
afterUrl,
|
|
1282
|
+
);
|
|
1283
|
+
};
|
|
1284
|
+
|
|
1285
|
+
if (!route) {
|
|
1286
|
+
if (authorization === "none") allowEveryone();
|
|
1287
|
+
return fnUrl.functionUrl;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
// Who may call the URL depends on how the router protects its origins,
|
|
1291
|
+
// and that's only known once the router is.
|
|
1292
|
+
all([isOac, route.routerDistributionArn]).apply(
|
|
1293
|
+
([oac, distributionArn]) => {
|
|
1294
|
+
if (oac && distributionArn) {
|
|
1295
|
+
self.part(
|
|
1296
|
+
"urlAccess",
|
|
1297
|
+
{
|
|
1298
|
+
action: "lambda:InvokeFunctionUrl",
|
|
1299
|
+
function: fn.name,
|
|
1300
|
+
principal: "cloudfront.amazonaws.com",
|
|
1301
|
+
sourceArn: distributionArn,
|
|
1302
|
+
},
|
|
1303
|
+
afterUrl,
|
|
1304
|
+
);
|
|
1305
|
+
self.part(
|
|
1306
|
+
"urlInvoke",
|
|
1307
|
+
{
|
|
1308
|
+
action: "lambda:InvokeFunction",
|
|
1309
|
+
function: fn.name,
|
|
1310
|
+
principal: "cloudfront.amazonaws.com",
|
|
1311
|
+
sourceArn: distributionArn,
|
|
1312
|
+
invokedViaFunctionUrl: true,
|
|
1313
|
+
},
|
|
1314
|
+
afterUrl,
|
|
1315
|
+
);
|
|
1316
|
+
} else if (authorization === "none") allowEveryone();
|
|
1317
|
+
},
|
|
1318
|
+
);
|
|
1319
|
+
|
|
1320
|
+
const routeNamespace = crypto
|
|
1321
|
+
.createHash("md5")
|
|
1322
|
+
.update(`${$app.name}-${$app.stage}-${name}`)
|
|
1323
|
+
.digest("hex")
|
|
1324
|
+
.substring(0, 4);
|
|
1325
|
+
self.part("routeKey", {
|
|
1326
|
+
store: route.routerKvStoreArn,
|
|
1327
|
+
namespace: routeNamespace,
|
|
1328
|
+
entries: all([fnUrl.functionUrl, isOac, route]).apply(
|
|
1329
|
+
([fnUrlValue, oac, route]) => {
|
|
1330
|
+
const timeouts = [
|
|
1331
|
+
"connectionTimeout" as const,
|
|
1332
|
+
"readTimeout" as const,
|
|
1333
|
+
"keepAliveTimeout" as const,
|
|
1334
|
+
].flatMap((k) => {
|
|
1335
|
+
const value = route[k];
|
|
1336
|
+
return value ? [[k, toSeconds(value)]] : [];
|
|
1337
|
+
});
|
|
1338
|
+
return {
|
|
1339
|
+
metadata: JSON.stringify({
|
|
1340
|
+
host: new URL(fnUrlValue).host,
|
|
1341
|
+
rewrite: route.rewrite,
|
|
1342
|
+
origin: {
|
|
1343
|
+
...(oac
|
|
1344
|
+
? {
|
|
1345
|
+
originAccessControlConfig: {
|
|
1346
|
+
enabled: true,
|
|
1347
|
+
signingBehavior: "always",
|
|
1348
|
+
signingProtocol: "sigv4",
|
|
1349
|
+
originType: "lambda",
|
|
1350
|
+
},
|
|
1351
|
+
}
|
|
1352
|
+
: {}),
|
|
1353
|
+
connectionAttempts: route.connectionAttempts,
|
|
1354
|
+
...(timeouts.length
|
|
1355
|
+
? { timeouts: Object.fromEntries(timeouts) }
|
|
1356
|
+
: {}),
|
|
1357
|
+
},
|
|
1358
|
+
}),
|
|
1359
|
+
};
|
|
1360
|
+
},
|
|
1361
|
+
),
|
|
1362
|
+
purge: false,
|
|
1363
|
+
});
|
|
1364
|
+
self.part("routesUpdate", {
|
|
1365
|
+
store: route.routerKvStoreArn,
|
|
1366
|
+
namespace: route.routerKvNamespace,
|
|
1367
|
+
key: "routes",
|
|
1368
|
+
entry: route.apply((route) =>
|
|
1369
|
+
["url", routeNamespace, route.hostPattern, route.pathPrefix].join(
|
|
1370
|
+
",",
|
|
1371
|
+
),
|
|
1372
|
+
),
|
|
1373
|
+
});
|
|
1374
|
+
return route.routerUrl;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
/**
|
|
1379
|
+
* The Lambda function URL if `url` is enabled.
|
|
1380
|
+
*/
|
|
1381
|
+
public get url() {
|
|
1382
|
+
return this.urlEndpoint.apply((url) => {
|
|
1383
|
+
if (!url) {
|
|
1384
|
+
throw new VisibleError(
|
|
1385
|
+
`Function URL is not enabled. Enable it with "url: true".`,
|
|
1386
|
+
);
|
|
1387
|
+
}
|
|
1388
|
+
return url;
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
/**
|
|
1393
|
+
* The name of the Lambda function.
|
|
1394
|
+
*/
|
|
1395
|
+
public get name() {
|
|
1396
|
+
return this.fn.name;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
/**
|
|
1400
|
+
* The ARN of the Lambda function.
|
|
1401
|
+
*/
|
|
1402
|
+
public get arn() {
|
|
1403
|
+
return this.fn.arn;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
// A function with versions, or a durable one, is invoked through its
|
|
1407
|
+
// latest version.
|
|
1408
|
+
private get useQualifiedTarget() {
|
|
1409
|
+
return this.fn.publish.apply(
|
|
1410
|
+
(publish) => (publish ?? false) || this.durable,
|
|
1411
|
+
);
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
/** @internal */
|
|
1415
|
+
public get targetArn() {
|
|
1416
|
+
return this.useQualifiedTarget.apply((useQualifiedTarget) =>
|
|
1417
|
+
useQualifiedTarget ? this.fn.qualifiedArn : this.arn,
|
|
1418
|
+
);
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
/** @internal */
|
|
1422
|
+
public get qualifier() {
|
|
1423
|
+
return this.targetArn.apply(
|
|
1424
|
+
(arn) => splitQualifiedFunctionArn(arn).qualifier,
|
|
1425
|
+
);
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
/** @internal */
|
|
1429
|
+
public get targetInvokeArn() {
|
|
1430
|
+
return this.useQualifiedTarget.apply((useQualifiedTarget) =>
|
|
1431
|
+
useQualifiedTarget ? this.fn.qualifiedInvokeArn : this.fn.invokeArn,
|
|
1432
|
+
);
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
/** @internal */
|
|
1436
|
+
public get targetResponseStreamingInvokeArn() {
|
|
1437
|
+
return this.useQualifiedTarget.apply((useQualifiedTarget) =>
|
|
1438
|
+
useQualifiedTarget
|
|
1439
|
+
? all([
|
|
1440
|
+
this.arn,
|
|
1441
|
+
this.fn.qualifiedArn,
|
|
1442
|
+
this.fn.responseStreamingInvokeArn,
|
|
1443
|
+
]).apply(([arn, qualifiedArn, responseStreamingInvokeArn]) =>
|
|
1444
|
+
responseStreamingInvokeArn.replace(arn, qualifiedArn),
|
|
1445
|
+
)
|
|
1446
|
+
: this.fn.responseStreamingInvokeArn,
|
|
1447
|
+
);
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
/**
|
|
1451
|
+
* Add environment variables lazily to the function after the function is created.
|
|
1452
|
+
*
|
|
1453
|
+
* This is useful for adding environment variables that are only available after the
|
|
1454
|
+
* function is created, like the function URL. It can be called once.
|
|
1455
|
+
*
|
|
1456
|
+
* @param environment The environment variables to add to the function.
|
|
1457
|
+
*
|
|
1458
|
+
* @example
|
|
1459
|
+
* Add the function URL as an environment variable.
|
|
1460
|
+
*
|
|
1461
|
+
* ```ts title="sst.config.ts"
|
|
1462
|
+
* const fn = new sst.aws.v5.Function("MyFunction", {
|
|
1463
|
+
* handler: "src/handler.handler",
|
|
1464
|
+
* url: true,
|
|
1465
|
+
* });
|
|
1466
|
+
*
|
|
1467
|
+
* fn.addEnvironment({
|
|
1468
|
+
* URL: fn.url,
|
|
1469
|
+
* });
|
|
1470
|
+
* ```
|
|
1471
|
+
*/
|
|
1472
|
+
public addEnvironment(environment: Input<Record<string, Input<string>>>) {
|
|
1473
|
+
if (this.nodes.environmentUpdate)
|
|
1474
|
+
throw new VisibleError(
|
|
1475
|
+
`"addEnvironment" was already called on the "${this.componentName}" function. Pass all of the environment variables in one call.`,
|
|
1476
|
+
);
|
|
1477
|
+
return this.part("environmentUpdate", {
|
|
1478
|
+
functionName: this.name,
|
|
1479
|
+
environment,
|
|
1480
|
+
region: getRegionOutput(undefined, { parent: this }).region,
|
|
1481
|
+
functionLastModified: this.fn.lastModified,
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
/**
|
|
1486
|
+
* Linking a function gives the linked resource its name and URL, and lets it invoke
|
|
1487
|
+
* the function.
|
|
1488
|
+
*/
|
|
1489
|
+
public link() {
|
|
1490
|
+
return {
|
|
1491
|
+
properties: {
|
|
1492
|
+
name: this.name,
|
|
1493
|
+
url: this.urlEndpoint,
|
|
1494
|
+
...(this.durable ? { qualifier: this.qualifier } : {}),
|
|
1495
|
+
},
|
|
1496
|
+
include: [
|
|
1497
|
+
permission({
|
|
1498
|
+
actions: [
|
|
1499
|
+
"lambda:InvokeFunction",
|
|
1500
|
+
...(this.durable
|
|
1501
|
+
? [
|
|
1502
|
+
"lambda:ListDurableExecutionsByFunction",
|
|
1503
|
+
"lambda:GetDurableExecution",
|
|
1504
|
+
"lambda:GetDurableExecutionHistory",
|
|
1505
|
+
"lambda:StopDurableExecution",
|
|
1506
|
+
"lambda:SendDurableExecutionCallbackSuccess",
|
|
1507
|
+
"lambda:SendDurableExecutionCallbackFailure",
|
|
1508
|
+
"lambda:SendDurableExecutionCallbackHeartbeat",
|
|
1509
|
+
]
|
|
1510
|
+
: []),
|
|
1511
|
+
],
|
|
1512
|
+
resources: [this.durable ? interpolate`${this.arn}:*` : this.arn],
|
|
1513
|
+
}),
|
|
1514
|
+
],
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
/**
|
|
1519
|
+
* Reference an existing function with the given function name. This is useful when you
|
|
1520
|
+
* create a function in one stage and want to share it in another. Linking it gives the
|
|
1521
|
+
* linked resource its name and lets it invoke the function.
|
|
1522
|
+
*
|
|
1523
|
+
* @param name The name of the component.
|
|
1524
|
+
* @param functionName The name of the existing Lambda function.
|
|
1525
|
+
* @param opts Component resource options.
|
|
1526
|
+
*
|
|
1527
|
+
* @example
|
|
1528
|
+
*
|
|
1529
|
+
* ```ts title="sst.config.ts"
|
|
1530
|
+
* const fn = $app.stage === "frank"
|
|
1531
|
+
* ? sst.aws.v5.Function.get("MyFunction", "app-dev-MyFunctionFunction-abcdefgh")
|
|
1532
|
+
* : new sst.aws.v5.Function("MyFunction", { handler: "src/lambda.handler" });
|
|
1533
|
+
* ```
|
|
1534
|
+
*/
|
|
1535
|
+
public static get(
|
|
1536
|
+
name: string,
|
|
1537
|
+
functionName: Input<string>,
|
|
1538
|
+
opts?: ComponentResourceOptions,
|
|
1539
|
+
) {
|
|
1540
|
+
return new Function(
|
|
1541
|
+
name,
|
|
1542
|
+
{ existing: { function: functionName } } as FunctionArgs,
|
|
1543
|
+
opts,
|
|
1544
|
+
);
|
|
1545
|
+
}
|
|
1546
|
+
}
|