@sst-community/sst 4.20.0 → 5.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -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-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/chunk-ZOXXXME5.js +472 -0
- package/platform/js/chunks/chunk-ZOXXXME5.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-DMGMTLNB.js +10 -0
- package/platform/js/chunks/config-DMGMTLNB.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 +35362 -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 +3227 -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 +202 -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 +1047 -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 +3281 -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 +1527 -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 +1460 -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 +1755 -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 +525 -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 +1754 -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 +582 -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 +241 -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 +1437 -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,2204 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { globSync } from "glob";
|
|
4
|
+
import crypto from "crypto";
|
|
5
|
+
import type { Loader } from "esbuild";
|
|
6
|
+
import {
|
|
7
|
+
Output,
|
|
8
|
+
Unwrap,
|
|
9
|
+
output,
|
|
10
|
+
all,
|
|
11
|
+
interpolate,
|
|
12
|
+
ComponentResourceOptions,
|
|
13
|
+
Resource,
|
|
14
|
+
asset as pulumiAsset,
|
|
15
|
+
} from "@pulumi/pulumi";
|
|
16
|
+
import { Cdn, CdnArgs } from "./cdn.js";
|
|
17
|
+
import { Function, FunctionArgs, FunctionArn } from "./function.js";
|
|
18
|
+
import { parseLambdaEdgeArn } from "./helpers/arn.js";
|
|
19
|
+
import { Bucket, BucketArgs } from "./bucket.js";
|
|
20
|
+
import { BucketFile, BucketFiles } from "./providers/bucket-files.js";
|
|
21
|
+
import { logicalName, physicalName } from "../naming.js";
|
|
22
|
+
import { Input } from "../input.js";
|
|
23
|
+
import {
|
|
24
|
+
Component,
|
|
25
|
+
Prettify,
|
|
26
|
+
transform,
|
|
27
|
+
type Transform,
|
|
28
|
+
} from "../component.js";
|
|
29
|
+
import { VisibleError } from "../error.js";
|
|
30
|
+
import { Cron } from "./cron.js";
|
|
31
|
+
import { BaseSiteFileOptions, getContentType } from "../base/base-site.js";
|
|
32
|
+
import { BaseSsrSiteArgs, buildApp } from "../base/base-ssr-site.js";
|
|
33
|
+
import { cloudfront, getRegionOutput, lambda, Region, iam } from "@pulumi/aws";
|
|
34
|
+
import { KvKeys } from "./providers/kv-keys.js";
|
|
35
|
+
import { useProvider } from "./helpers/provider.js";
|
|
36
|
+
import { Link } from "../link.js";
|
|
37
|
+
import { URL_UNAVAILABLE } from "./linkable.js";
|
|
38
|
+
import {
|
|
39
|
+
CF_ROUTER_INJECTION,
|
|
40
|
+
CF_BLOCK_CLOUDFRONT_URL_INJECTION,
|
|
41
|
+
KV_SITE_METADATA,
|
|
42
|
+
ProtectionConfig,
|
|
43
|
+
RouterRouteArgsDeprecated,
|
|
44
|
+
normalizeRouteArgs,
|
|
45
|
+
RouterRouteArgs,
|
|
46
|
+
} from "./router.js";
|
|
47
|
+
import { DistributionInvalidation } from "./providers/distribution-invalidation.js";
|
|
48
|
+
import { toSeconds, DurationSeconds } from "../duration.js";
|
|
49
|
+
import { Size, toMBs } from "../size.js";
|
|
50
|
+
import { KvRoutesUpdate } from "./providers/kv-routes-update.js";
|
|
51
|
+
import { toPosix } from "../path.js";
|
|
52
|
+
|
|
53
|
+
// CloudFront KeyValueStore keys are at most 512 bytes, including the
|
|
54
|
+
// `<namespace>:` prefix.
|
|
55
|
+
const MAX_KV_KEY_LENGTH = 500;
|
|
56
|
+
// The KV store holds 5 MB and is shared by the sites on a Router, so each site
|
|
57
|
+
// lists at most 1 MB of prerendered files.
|
|
58
|
+
const MAX_LISTED_KV_BYTES = 1024 * 1024;
|
|
59
|
+
|
|
60
|
+
// Regions without Lambda function URLs, which the server functions use. Creating one there
|
|
61
|
+
// fails with `AccessDeniedException: Unable to determine service/operation name to be
|
|
62
|
+
// authorized`. Checked by creating a function URL in each region, in October 2026. The ones
|
|
63
|
+
// not listed here either work or couldn't be reached (me-south-1, Bahrain, is out of
|
|
64
|
+
// service). AWS no longer publishes a list of these regions; the page below is the general
|
|
65
|
+
// function URL documentation:
|
|
66
|
+
// https://docs.aws.amazon.com/lambda/latest/dg/urls-configuration.html
|
|
67
|
+
export const regionsWithoutFunctionUrls = [
|
|
68
|
+
"ap-east-2",
|
|
69
|
+
"ap-south-2",
|
|
70
|
+
"ap-southeast-4",
|
|
71
|
+
"ap-southeast-5",
|
|
72
|
+
"ap-southeast-6",
|
|
73
|
+
"ap-southeast-7",
|
|
74
|
+
"ca-west-1",
|
|
75
|
+
"eu-central-2",
|
|
76
|
+
"il-central-1",
|
|
77
|
+
"me-central-1",
|
|
78
|
+
"mx-central-1",
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
export const supportedRegions = {
|
|
82
|
+
"af-south-1": { lat: -33.9249, lon: 18.4241 }, // Cape Town, South Africa
|
|
83
|
+
"ap-east-1": { lat: 22.3193, lon: 114.1694 }, // Hong Kong
|
|
84
|
+
"ap-east-2": { lat: 25.033, lon: 121.5654 }, // Taipei, Taiwan
|
|
85
|
+
"ap-northeast-1": { lat: 35.6895, lon: 139.6917 }, // Tokyo, Japan
|
|
86
|
+
"ap-northeast-2": { lat: 37.5665, lon: 126.978 }, // Seoul, South Korea
|
|
87
|
+
"ap-northeast-3": { lat: 34.6937, lon: 135.5023 }, // Osaka, Japan
|
|
88
|
+
"ap-southeast-1": { lat: 1.3521, lon: 103.8198 }, // Singapore
|
|
89
|
+
"ap-southeast-2": { lat: -33.8688, lon: 151.2093 }, // Sydney, Australia
|
|
90
|
+
"ap-southeast-3": { lat: -6.2088, lon: 106.8456 }, // Jakarta, Indonesia
|
|
91
|
+
"ap-southeast-4": { lat: -37.8136, lon: 144.9631 }, // Melbourne, Australia
|
|
92
|
+
"ap-southeast-5": { lat: 3.139, lon: 101.6869 }, // Kuala Lumpur, Malaysia
|
|
93
|
+
"ap-southeast-6": { lat: -36.8485, lon: 174.7633 }, // Auckland, New Zealand
|
|
94
|
+
"ap-southeast-7": { lat: 13.7563, lon: 100.5018 }, // Bangkok, Thailand
|
|
95
|
+
"ap-south-1": { lat: 19.076, lon: 72.8777 }, // Mumbai, India
|
|
96
|
+
"ap-south-2": { lat: 17.385, lon: 78.4867 }, // Hyderabad, India
|
|
97
|
+
"ca-central-1": { lat: 45.5017, lon: -73.5673 }, // Montreal, Canada
|
|
98
|
+
"ca-west-1": { lat: 51.0447, lon: -114.0719 }, // Calgary, Canada
|
|
99
|
+
"cn-north-1": { lat: 39.9042, lon: 116.4074 }, // Beijing, China
|
|
100
|
+
"cn-northwest-1": { lat: 38.4872, lon: 106.2309 }, // Yinchuan, Ningxia
|
|
101
|
+
"eu-central-1": { lat: 50.1109, lon: 8.6821 }, // Frankfurt, Germany
|
|
102
|
+
"eu-central-2": { lat: 47.3769, lon: 8.5417 }, // Zurich, Switzerland
|
|
103
|
+
"eu-north-1": { lat: 59.3293, lon: 18.0686 }, // Stockholm, Sweden
|
|
104
|
+
"eu-south-1": { lat: 45.4642, lon: 9.19 }, // Milan, Italy
|
|
105
|
+
"eu-south-2": { lat: 40.4168, lon: -3.7038 }, // Madrid, Spain
|
|
106
|
+
"eu-west-1": { lat: 53.3498, lon: -6.2603 }, // Dublin, Ireland
|
|
107
|
+
"eu-west-2": { lat: 51.5074, lon: -0.1278 }, // London, UK
|
|
108
|
+
"eu-west-3": { lat: 48.8566, lon: 2.3522 }, // Paris, France
|
|
109
|
+
"il-central-1": { lat: 32.0853, lon: 34.7818 }, // Tel Aviv, Israel
|
|
110
|
+
"me-central-1": { lat: 25.2048, lon: 55.2708 }, // Dubai, UAE
|
|
111
|
+
"me-south-1": { lat: 26.0667, lon: 50.5577 }, // Manama, Bahrain
|
|
112
|
+
"mx-central-1": { lat: 19.4326, lon: -99.1332 }, // Mexico City, Mexico
|
|
113
|
+
"sa-east-1": { lat: -23.5505, lon: -46.6333 }, // São Paulo, Brazil
|
|
114
|
+
"us-east-1": { lat: 39.0438, lon: -77.4874 }, // Ashburn, VA
|
|
115
|
+
"us-east-2": { lat: 39.9612, lon: -82.9988 }, // Columbus, OH
|
|
116
|
+
"us-gov-east-1": { lat: 38.9696, lon: -77.3861 }, // Herndon, VA
|
|
117
|
+
"us-gov-west-1": { lat: 34.0522, lon: -118.2437 }, // Los Angeles, CA
|
|
118
|
+
"us-west-1": { lat: 37.7749, lon: -122.4194 }, // San Francisco, CA
|
|
119
|
+
"us-west-2": { lat: 45.5122, lon: -122.6587 }, // Portland, OR
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export type Plan = {
|
|
123
|
+
// The base path of the site (ie. /docs). Note that S3 assets are not stored inside a
|
|
124
|
+
// folder with this name. The CF router will stripe the base path from the request URI
|
|
125
|
+
// when routing to S3.
|
|
126
|
+
base?: string;
|
|
127
|
+
server?: Unwrap<FunctionArgs>;
|
|
128
|
+
imageOptimizer?: {
|
|
129
|
+
function: Unwrap<FunctionArgs>;
|
|
130
|
+
prefix: string;
|
|
131
|
+
};
|
|
132
|
+
assets: {
|
|
133
|
+
from: string;
|
|
134
|
+
// KV asset entries do not include the `to` value in their keys. The CF router will
|
|
135
|
+
// add the `to` value to the request URI when routing to S3.
|
|
136
|
+
to: string;
|
|
137
|
+
cached: boolean;
|
|
138
|
+
versionedSubDir?: string;
|
|
139
|
+
deepRoute?: string;
|
|
140
|
+
// List every file in this copy in the KV store instead of routing its
|
|
141
|
+
// folders to S3. For copies that hold prerendered routes only.
|
|
142
|
+
listFiles?: boolean;
|
|
143
|
+
}[];
|
|
144
|
+
isrCache?: {
|
|
145
|
+
from: string;
|
|
146
|
+
to: string;
|
|
147
|
+
};
|
|
148
|
+
custom404?: string;
|
|
149
|
+
buildId?: string;
|
|
150
|
+
// Asset folders with an `.html` file at any depth are listed file by file
|
|
151
|
+
// in the KV store instead of being routed to S3 as a whole, so server
|
|
152
|
+
// routes in the same folder still reach the server.
|
|
153
|
+
hasStaticRoutes?: boolean;
|
|
154
|
+
// Top-level asset folders known to hold prerendered routes. They're listed
|
|
155
|
+
// file by file too.
|
|
156
|
+
prerenderedDirs?: string[];
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export interface SsrSiteArgs extends BaseSsrSiteArgs {
|
|
160
|
+
domain?: CdnArgs["domain"];
|
|
161
|
+
/**
|
|
162
|
+
* @deprecated Use `router` instead.
|
|
163
|
+
*/
|
|
164
|
+
route?: Prettify<RouterRouteArgsDeprecated>;
|
|
165
|
+
router?: Prettify<RouterRouteArgs>;
|
|
166
|
+
cachePolicy?: Input<string>;
|
|
167
|
+
/**
|
|
168
|
+
* Configure Lambda function protection through CloudFront.
|
|
169
|
+
*
|
|
170
|
+
* @default `"none"`
|
|
171
|
+
*
|
|
172
|
+
* The available options are:
|
|
173
|
+
* - `"none"`: Lambda URLs are publicly accessible.
|
|
174
|
+
* - `"oac"`: Lambda URLs protected by CloudFront Origin Access Control. Requires manual `x-amz-content-sha256` header for POST requests. Use when you control all POST requests.
|
|
175
|
+
* - `"oac-with-edge-signing"`: Full protection with automatic header signing via Lambda@Edge. Works with external webhooks and callbacks. Higher cost and latency but works out of the box.
|
|
176
|
+
*
|
|
177
|
+
* :::note
|
|
178
|
+
* When using `"oac-with-edge-signing"`, request bodies are limited to 1MB due to Lambda@Edge payload limits. For file uploads larger than 1MB, consider using presigned S3 URLs or the `"oac"` mode with manual header signing.
|
|
179
|
+
* :::
|
|
180
|
+
*
|
|
181
|
+
* :::note
|
|
182
|
+
* When removing a stage that uses `"oac-with-edge-signing"`, deletion may take 5-10 minutes while AWS removes the Lambda@Edge replicated functions from all edge locations.
|
|
183
|
+
* :::
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```js
|
|
187
|
+
* // No protection (default)
|
|
188
|
+
* {
|
|
189
|
+
* protection: "none"
|
|
190
|
+
* }
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```js
|
|
195
|
+
* // OAC protection, manual header signing required
|
|
196
|
+
* {
|
|
197
|
+
* protection: "oac"
|
|
198
|
+
* }
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```js
|
|
203
|
+
* // Full protection with automatic Lambda@Edge
|
|
204
|
+
* {
|
|
205
|
+
* protection: "oac-with-edge-signing"
|
|
206
|
+
* }
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```js
|
|
211
|
+
* // Custom Lambda@Edge configuration
|
|
212
|
+
* {
|
|
213
|
+
* protection: {
|
|
214
|
+
* mode: "oac-with-edge-signing",
|
|
215
|
+
* edgeFunction: {
|
|
216
|
+
* memory: "256 MB",
|
|
217
|
+
* timeout: "10 seconds"
|
|
218
|
+
* }
|
|
219
|
+
* }
|
|
220
|
+
* }
|
|
221
|
+
* ```
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```js
|
|
225
|
+
* // Use existing Lambda@Edge function
|
|
226
|
+
* {
|
|
227
|
+
* protection: {
|
|
228
|
+
* mode: "oac-with-edge-signing",
|
|
229
|
+
* edgeFunction: {
|
|
230
|
+
* arn: "arn:aws:lambda:us-east-1:123456789012:function:my-signing-function:1"
|
|
231
|
+
* }
|
|
232
|
+
* }
|
|
233
|
+
* }
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
protection?: Input<
|
|
237
|
+
| "none"
|
|
238
|
+
| "oac"
|
|
239
|
+
| "oac-with-edge-signing"
|
|
240
|
+
| {
|
|
241
|
+
mode: "oac-with-edge-signing";
|
|
242
|
+
edgeFunction?: {
|
|
243
|
+
/**
|
|
244
|
+
* Custom Lambda@Edge function ARN to use for request signing.
|
|
245
|
+
* If provided, this function will be used instead of creating a new one.
|
|
246
|
+
* Must be a qualified ARN (with version) and deployed in us-east-1.
|
|
247
|
+
*/
|
|
248
|
+
arn?: Input<FunctionArn>;
|
|
249
|
+
/**
|
|
250
|
+
* Memory size for the auto-created Lambda@Edge function.
|
|
251
|
+
* Only used when arn is not provided.
|
|
252
|
+
* @default `"128 MB"`
|
|
253
|
+
*/
|
|
254
|
+
memory?: Input<Size>;
|
|
255
|
+
/**
|
|
256
|
+
* Timeout for the auto-created Lambda@Edge function.
|
|
257
|
+
* Only used when arn is not provided.
|
|
258
|
+
* @default `"5 seconds"`
|
|
259
|
+
*/
|
|
260
|
+
timeout?: Input<DurationSeconds>;
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
>;
|
|
264
|
+
invalidation?: Input<
|
|
265
|
+
| false
|
|
266
|
+
| {
|
|
267
|
+
/**
|
|
268
|
+
* Configure if `sst deploy` should wait for the CloudFront cache invalidation to finish.
|
|
269
|
+
*
|
|
270
|
+
* :::tip
|
|
271
|
+
* For non-prod environments it might make sense to pass in `false`.
|
|
272
|
+
* :::
|
|
273
|
+
*
|
|
274
|
+
* Waiting for this process to finish ensures that new content will be available after the deploy finishes. However, this process can sometimes take more than 5 mins.
|
|
275
|
+
* @default `false`
|
|
276
|
+
* @example
|
|
277
|
+
* ```js
|
|
278
|
+
* {
|
|
279
|
+
* invalidation: {
|
|
280
|
+
* wait: true
|
|
281
|
+
* }
|
|
282
|
+
* }
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
wait?: Input<boolean>;
|
|
286
|
+
/**
|
|
287
|
+
* The paths to invalidate.
|
|
288
|
+
*
|
|
289
|
+
* You can either pass in an array of glob patterns to invalidate specific files. Or you can use one of these built-in options:
|
|
290
|
+
* - `all`: All files will be invalidated when any file changes
|
|
291
|
+
* - `versioned`: Only versioned files will be invalidated when versioned files change
|
|
292
|
+
*
|
|
293
|
+
* :::note
|
|
294
|
+
* Each glob pattern counts as a single invalidation. Whereas, invalidating
|
|
295
|
+
* `/*` counts as a single invalidation.
|
|
296
|
+
* :::
|
|
297
|
+
* @default `"all"`
|
|
298
|
+
* @example
|
|
299
|
+
* Invalidate the `index.html` and all files under the `products/` route.
|
|
300
|
+
* ```js
|
|
301
|
+
* {
|
|
302
|
+
* invalidation: {
|
|
303
|
+
* paths: ["/index.html", "/products/*"]
|
|
304
|
+
* }
|
|
305
|
+
* }
|
|
306
|
+
* ```
|
|
307
|
+
* This counts as two invalidations.
|
|
308
|
+
*/
|
|
309
|
+
paths?: Input<"all" | "versioned" | string[]>;
|
|
310
|
+
}
|
|
311
|
+
>;
|
|
312
|
+
/**
|
|
313
|
+
* Regions that the server function will be deployed to.
|
|
314
|
+
*
|
|
315
|
+
* By default, the server function is deployed to a single region, this is the
|
|
316
|
+
* default region of your SST app.
|
|
317
|
+
*
|
|
318
|
+
* :::note
|
|
319
|
+
* This does not use Lambda@Edge, it deploys multiple Lambda functions instead.
|
|
320
|
+
* :::
|
|
321
|
+
*
|
|
322
|
+
* To deploy it to multiple regions, you can pass in a list of regions. And
|
|
323
|
+
* any requests made will be routed to the nearest region based on the user's
|
|
324
|
+
* location.
|
|
325
|
+
*
|
|
326
|
+
* @default The default region of the SST app
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```js
|
|
330
|
+
* {
|
|
331
|
+
* regions: ["us-east-1", "eu-west-1"]
|
|
332
|
+
* }
|
|
333
|
+
* ```
|
|
334
|
+
*
|
|
335
|
+
* :::note
|
|
336
|
+
* A site with a server function can't be deployed to the regions where Lambda function
|
|
337
|
+
* URLs aren't available: `ap-east-2`, `ap-south-2`, `ap-southeast-4`, `ap-southeast-5`,
|
|
338
|
+
* `ap-southeast-6`, `ap-southeast-7`, `ca-west-1`, `eu-central-2`, `il-central-1`,
|
|
339
|
+
* `me-central-1` and `mx-central-1`.
|
|
340
|
+
* :::
|
|
341
|
+
*/
|
|
342
|
+
regions?: Input<string[]>;
|
|
343
|
+
permissions?: FunctionArgs["permissions"];
|
|
344
|
+
/**
|
|
345
|
+
* The number of instances of the [server function](#nodes-server) to keep warm. This is useful for cases where you are experiencing long cold starts. The default is to not keep any instances warm.
|
|
346
|
+
*
|
|
347
|
+
* This works by starting a serverless cron job to make _n_ concurrent requests to the server function every few minutes. Where _n_ is the number of instances to keep warm.
|
|
348
|
+
*
|
|
349
|
+
* @default `0`
|
|
350
|
+
*/
|
|
351
|
+
warm?: Input<number>;
|
|
352
|
+
/**
|
|
353
|
+
* Configure the Lambda function used for server.
|
|
354
|
+
* @default `{architecture: "x86_64", memory: "1024 MB"}`
|
|
355
|
+
*/
|
|
356
|
+
server?: {
|
|
357
|
+
/**
|
|
358
|
+
* The amount of memory allocated to the server function.
|
|
359
|
+
* Takes values between 128 MB and 10240 MB in 1 MB increments.
|
|
360
|
+
*
|
|
361
|
+
* @default `"1024 MB"`
|
|
362
|
+
* @example
|
|
363
|
+
* ```js
|
|
364
|
+
* {
|
|
365
|
+
* server: {
|
|
366
|
+
* memory: "2048 MB"
|
|
367
|
+
* }
|
|
368
|
+
* }
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
memory?: FunctionArgs["memory"];
|
|
372
|
+
/**
|
|
373
|
+
* The runtime environment for the server function.
|
|
374
|
+
*
|
|
375
|
+
* @default `"nodejs24.x"`
|
|
376
|
+
* @example
|
|
377
|
+
* ```js
|
|
378
|
+
* {
|
|
379
|
+
* server: {
|
|
380
|
+
* runtime: "nodejs24.x"
|
|
381
|
+
* }
|
|
382
|
+
* }
|
|
383
|
+
* ```
|
|
384
|
+
*/
|
|
385
|
+
runtime?: Input<"nodejs18.x" | "nodejs20.x" | "nodejs22.x" | "nodejs24.x">;
|
|
386
|
+
/**
|
|
387
|
+
* The maximum amount of time the server function can run.
|
|
388
|
+
*
|
|
389
|
+
* While Lambda supports timeouts up to 900 seconds, your requests are served
|
|
390
|
+
* through AWS CloudFront. And it has a default limit of 60 seconds.
|
|
391
|
+
*
|
|
392
|
+
* :::tip
|
|
393
|
+
* If you need a timeout longer than 60 seconds, you'll need to request a
|
|
394
|
+
* limit increase.
|
|
395
|
+
* :::
|
|
396
|
+
*
|
|
397
|
+
* You can increase this to 180 seconds for your account by contacting AWS
|
|
398
|
+
* Support and [requesting a limit increase](https://console.aws.amazon.com/support/home#/case/create?issueType=service-limit-increase).
|
|
399
|
+
*
|
|
400
|
+
* @default `"20 seconds"`
|
|
401
|
+
* @example
|
|
402
|
+
* ```js
|
|
403
|
+
* {
|
|
404
|
+
* server: {
|
|
405
|
+
* timeout: "50 seconds"
|
|
406
|
+
* }
|
|
407
|
+
* }
|
|
408
|
+
* ```
|
|
409
|
+
*
|
|
410
|
+
* If you need a timeout longer than what CloudFront supports, we recommend
|
|
411
|
+
* using a separate Lambda `Function` with the `url` enabled instead.
|
|
412
|
+
*/
|
|
413
|
+
timeout?: FunctionArgs["timeout"];
|
|
414
|
+
/**
|
|
415
|
+
* The [architecture](https://docs.aws.amazon.com/lambda/latest/dg/foundation-arch.html)
|
|
416
|
+
* of the server function.
|
|
417
|
+
*
|
|
418
|
+
* @default `"x86_64"`
|
|
419
|
+
* @example
|
|
420
|
+
* ```js
|
|
421
|
+
* {
|
|
422
|
+
* server: {
|
|
423
|
+
* architecture: "arm64"
|
|
424
|
+
* }
|
|
425
|
+
* }
|
|
426
|
+
* ```
|
|
427
|
+
*/
|
|
428
|
+
architecture?: FunctionArgs["architecture"];
|
|
429
|
+
/**
|
|
430
|
+
* Dependencies that need to be excluded from the server function package.
|
|
431
|
+
*
|
|
432
|
+
* Certain npm packages cannot be bundled using esbuild. This allows you to exclude them
|
|
433
|
+
* from the bundle. Instead they'll be moved into a `node_modules/` directory in the
|
|
434
|
+
* function package.
|
|
435
|
+
*
|
|
436
|
+
* :::tip
|
|
437
|
+
* If esbuild is giving you an error about a package, try adding it to the `install` list.
|
|
438
|
+
* :::
|
|
439
|
+
*
|
|
440
|
+
* This will allow your functions to be able to use these dependencies when deployed. They
|
|
441
|
+
* just won't be tree shaken. You however still need to have them in your `package.json`.
|
|
442
|
+
*
|
|
443
|
+
* :::caution
|
|
444
|
+
* Packages listed here still need to be in your `package.json`.
|
|
445
|
+
* :::
|
|
446
|
+
*
|
|
447
|
+
* Esbuild will ignore them while traversing the imports in your code. So these are the
|
|
448
|
+
* **package names as seen in the imports**. It also works on packages that are not directly
|
|
449
|
+
* imported by your code.
|
|
450
|
+
*
|
|
451
|
+
* @example
|
|
452
|
+
* ```js
|
|
453
|
+
* {
|
|
454
|
+
* server: {
|
|
455
|
+
* install: ["sharp"]
|
|
456
|
+
* }
|
|
457
|
+
* }
|
|
458
|
+
* ```
|
|
459
|
+
*/
|
|
460
|
+
install?: Input<string[]>;
|
|
461
|
+
/**
|
|
462
|
+
* Configure additional esbuild loaders for other file extensions. This is useful
|
|
463
|
+
* when your code is importing non-JS files like `.png`, `.css`, etc.
|
|
464
|
+
*
|
|
465
|
+
* @example
|
|
466
|
+
* ```js
|
|
467
|
+
* {
|
|
468
|
+
* server: {
|
|
469
|
+
* loader: {
|
|
470
|
+
* ".png": "file"
|
|
471
|
+
* }
|
|
472
|
+
* }
|
|
473
|
+
* }
|
|
474
|
+
* ```
|
|
475
|
+
*/
|
|
476
|
+
loader?: Input<Record<string, Loader>>;
|
|
477
|
+
/**
|
|
478
|
+
* A list of Lambda layer ARNs to add to the server function.
|
|
479
|
+
*
|
|
480
|
+
* @example
|
|
481
|
+
* ```js
|
|
482
|
+
* {
|
|
483
|
+
* server: {
|
|
484
|
+
* layers: ["arn:aws:lambda:us-east-1:123456789012:layer:my-layer:1"]
|
|
485
|
+
* }
|
|
486
|
+
* }
|
|
487
|
+
* ```
|
|
488
|
+
*/
|
|
489
|
+
layers?: Input<Input<string>[]>;
|
|
490
|
+
/**
|
|
491
|
+
* @deprecated The `server.edge` prop has been moved to the top level `edge` prop on the component.
|
|
492
|
+
*/
|
|
493
|
+
edge?: Input<{
|
|
494
|
+
viewerRequest?: Input<{
|
|
495
|
+
injection: Input<string>;
|
|
496
|
+
kvStore?: Input<string>;
|
|
497
|
+
kvStores?: Input<Input<string>[]>;
|
|
498
|
+
}>;
|
|
499
|
+
viewerResponse?: Input<{
|
|
500
|
+
injection: Input<string>;
|
|
501
|
+
kvStore?: Input<string>;
|
|
502
|
+
kvStores?: Input<Input<string>[]>;
|
|
503
|
+
}>;
|
|
504
|
+
}>;
|
|
505
|
+
};
|
|
506
|
+
/**
|
|
507
|
+
* Configure CloudFront Functions to customize the behavior of HTTP requests and responses at the edge.
|
|
508
|
+
*/
|
|
509
|
+
edge?: Input<{
|
|
510
|
+
/**
|
|
511
|
+
* Configure the viewer request function.
|
|
512
|
+
*
|
|
513
|
+
* The viewer request function can be used to modify incoming requests before they
|
|
514
|
+
* reach your origin server. For example, you can redirect users, rewrite URLs,
|
|
515
|
+
* or add headers.
|
|
516
|
+
*/
|
|
517
|
+
viewerRequest?: Input<{
|
|
518
|
+
/**
|
|
519
|
+
* The code to inject into the viewer request function.
|
|
520
|
+
*
|
|
521
|
+
* By default, a viewer request function is created to:
|
|
522
|
+
* - Disable CloudFront default URL if custom domain is set
|
|
523
|
+
* - Add the `x-forwarded-host` header
|
|
524
|
+
* - Route assets requests to S3 (static files stored in the bucket)
|
|
525
|
+
* - Route server requests to server functions (dynamic rendering)
|
|
526
|
+
*
|
|
527
|
+
* The function manages routing by:
|
|
528
|
+
* 1. First checking if the requested path exists in S3 (with variations like adding index.html)
|
|
529
|
+
* 2. Serving a custom 404 page from S3 if configured and the path isn't found
|
|
530
|
+
* 3. Routing image optimization requests to the image optimizer function
|
|
531
|
+
* 4. Routing all other requests to the nearest server function
|
|
532
|
+
*
|
|
533
|
+
* The given code will be injected at the beginning of this function.
|
|
534
|
+
*
|
|
535
|
+
* ```js
|
|
536
|
+
* async function handler(event) {
|
|
537
|
+
* // User injected code
|
|
538
|
+
*
|
|
539
|
+
* // Default behavior code
|
|
540
|
+
*
|
|
541
|
+
* return event.request;
|
|
542
|
+
* }
|
|
543
|
+
* ```
|
|
544
|
+
*
|
|
545
|
+
* @example
|
|
546
|
+
* To add a custom header to all requests.
|
|
547
|
+
*
|
|
548
|
+
* ```js
|
|
549
|
+
* {
|
|
550
|
+
* edge: {
|
|
551
|
+
* viewerRequest: {
|
|
552
|
+
* injection: `event.request.headers["x-foo"] = { value: "bar" };`
|
|
553
|
+
* }
|
|
554
|
+
* }
|
|
555
|
+
* }
|
|
556
|
+
* ```
|
|
557
|
+
*
|
|
558
|
+
* You can use this to add basic auth, [check out an example](/docs/examples/#aws-nextjs-basic-auth).
|
|
559
|
+
*/
|
|
560
|
+
injection: Input<string>;
|
|
561
|
+
/**
|
|
562
|
+
* The KV store to associate with the viewer request function.
|
|
563
|
+
*
|
|
564
|
+
* @example
|
|
565
|
+
* ```js
|
|
566
|
+
* {
|
|
567
|
+
* edge: {
|
|
568
|
+
* viewerRequest: {
|
|
569
|
+
* kvStore: "arn:aws:cloudfront::123456789012:key-value-store/my-store"
|
|
570
|
+
* }
|
|
571
|
+
* }
|
|
572
|
+
* }
|
|
573
|
+
* ```
|
|
574
|
+
*/
|
|
575
|
+
kvStore?: Input<string>;
|
|
576
|
+
}>;
|
|
577
|
+
/**
|
|
578
|
+
* Configure the viewer response function.
|
|
579
|
+
*
|
|
580
|
+
* The viewer response function can be used to modify outgoing responses before they are
|
|
581
|
+
* sent to the client. For example, you can add security headers or change the response
|
|
582
|
+
* status code.
|
|
583
|
+
*
|
|
584
|
+
* By default, no viewer response function is set. A new function will be created
|
|
585
|
+
* with the provided code.
|
|
586
|
+
*/
|
|
587
|
+
viewerResponse?: Input<{
|
|
588
|
+
/**
|
|
589
|
+
* The code to inject into the viewer response function.
|
|
590
|
+
*
|
|
591
|
+
* ```js
|
|
592
|
+
* async function handler(event) {
|
|
593
|
+
* // User injected code
|
|
594
|
+
*
|
|
595
|
+
* return event.response;
|
|
596
|
+
* }
|
|
597
|
+
* ```
|
|
598
|
+
*
|
|
599
|
+
* @example
|
|
600
|
+
* To add a custom header to all responses.
|
|
601
|
+
*
|
|
602
|
+
* ```js
|
|
603
|
+
* {
|
|
604
|
+
* edge: {
|
|
605
|
+
* viewerResponse: {
|
|
606
|
+
* injection: `event.response.headers["x-foo"] = { value: "bar" };`
|
|
607
|
+
* }
|
|
608
|
+
* }
|
|
609
|
+
* }
|
|
610
|
+
* ```
|
|
611
|
+
*/
|
|
612
|
+
injection: Input<string>;
|
|
613
|
+
/**
|
|
614
|
+
* The KV store to associate with the viewer response function.
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* ```js
|
|
618
|
+
* {
|
|
619
|
+
* edge: {
|
|
620
|
+
* viewerResponse: {
|
|
621
|
+
* kvStore: "arn:aws:cloudfront::123456789012:key-value-store/my-store"
|
|
622
|
+
* }
|
|
623
|
+
* }
|
|
624
|
+
* }
|
|
625
|
+
* ```
|
|
626
|
+
*/
|
|
627
|
+
kvStore?: Input<string>;
|
|
628
|
+
}>;
|
|
629
|
+
}>;
|
|
630
|
+
/**
|
|
631
|
+
* Configure the server function to connect to private subnets in a virtual private cloud or VPC. This allows it to access private resources.
|
|
632
|
+
*
|
|
633
|
+
* @example
|
|
634
|
+
* Create a `Vpc` component.
|
|
635
|
+
*
|
|
636
|
+
* ```js title="sst.config.ts"
|
|
637
|
+
* const myVpc = new sst.aws.Vpc("MyVpc");
|
|
638
|
+
* ```
|
|
639
|
+
*
|
|
640
|
+
* Or reference an existing VPC.
|
|
641
|
+
*
|
|
642
|
+
* ```js title="sst.config.ts"
|
|
643
|
+
* const myVpc = sst.aws.Vpc.get("MyVpc", "vpc-12345678901234567");
|
|
644
|
+
* ```
|
|
645
|
+
*
|
|
646
|
+
* And pass it in.
|
|
647
|
+
*
|
|
648
|
+
* ```js
|
|
649
|
+
* {
|
|
650
|
+
* vpc: myVpc
|
|
651
|
+
* }
|
|
652
|
+
* ```
|
|
653
|
+
*/
|
|
654
|
+
vpc?: FunctionArgs["vpc"];
|
|
655
|
+
/**
|
|
656
|
+
* Configure how the assets are uploaded to S3.
|
|
657
|
+
*
|
|
658
|
+
* By default, this is set to the following. Read more about these options below.
|
|
659
|
+
* ```js
|
|
660
|
+
* {
|
|
661
|
+
* assets: {
|
|
662
|
+
* textEncoding: "utf-8",
|
|
663
|
+
* versionedFilesCacheHeader: "public,max-age=31536000,immutable",
|
|
664
|
+
* nonVersionedFilesCacheHeader: "public,max-age=0,s-maxage=86400,stale-while-revalidate=8640"
|
|
665
|
+
* }
|
|
666
|
+
* }
|
|
667
|
+
* ```
|
|
668
|
+
*
|
|
669
|
+
* #### Limits
|
|
670
|
+
*
|
|
671
|
+
* CloudFront distributions have a **limit of 25 cache behaviors** per distribution.
|
|
672
|
+
* Each top-level file or directory in your app's public asset directory creates a cache
|
|
673
|
+
* behavior. If you have too many, you'll hit the `TooManyCacheBehaviors` error. This is
|
|
674
|
+
* most common with `SvelteKit`, `SolidStart`, `Nuxt`, and `Analog` apps.
|
|
675
|
+
*
|
|
676
|
+
* For example, in the case of SvelteKit, the static assets are in the `static/`
|
|
677
|
+
* directory. If you have a file and a directory in it, it'll create 2 cache behaviors.
|
|
678
|
+
*
|
|
679
|
+
* ```bash frame="none"
|
|
680
|
+
* static/
|
|
681
|
+
* ├── icons/ # Cache behavior for /icons/*
|
|
682
|
+
* └── logo.png # Cache behavior for /logo.png
|
|
683
|
+
* ```
|
|
684
|
+
*
|
|
685
|
+
* So if you have many of these at the top-level, you'll hit the limit. You can request a
|
|
686
|
+
* limit increase through AWS Support.
|
|
687
|
+
*
|
|
688
|
+
* Alternatively, you can move some of these into subdirectories. For example, moving them
|
|
689
|
+
* to an `images/` directory, will only create 1 cache behavior.
|
|
690
|
+
*
|
|
691
|
+
* ```bash frame="none"
|
|
692
|
+
* static/
|
|
693
|
+
* └── images/ # Cache behavior for /images/*
|
|
694
|
+
* ├── icons/
|
|
695
|
+
* └── logo.png
|
|
696
|
+
* ```
|
|
697
|
+
*
|
|
698
|
+
* Learn more about these [CloudFront limits](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html#limits-web-distributions).
|
|
699
|
+
*/
|
|
700
|
+
assets?: Input<{
|
|
701
|
+
/**
|
|
702
|
+
* Character encoding for text based assets, like HTML, CSS, JS. This is
|
|
703
|
+
* used to set the `Content-Type` header when these files are served out.
|
|
704
|
+
*
|
|
705
|
+
* If set to `"none"`, then no charset will be returned in header.
|
|
706
|
+
* @default `"utf-8"`
|
|
707
|
+
* @example
|
|
708
|
+
* ```js
|
|
709
|
+
* {
|
|
710
|
+
* assets: {
|
|
711
|
+
* textEncoding: "iso-8859-1"
|
|
712
|
+
* }
|
|
713
|
+
* }
|
|
714
|
+
* ```
|
|
715
|
+
*/
|
|
716
|
+
textEncoding?: Input<
|
|
717
|
+
"utf-8" | "iso-8859-1" | "windows-1252" | "ascii" | "none"
|
|
718
|
+
>;
|
|
719
|
+
/**
|
|
720
|
+
* The `Cache-Control` header used for versioned files, like `main-1234.css`. This is
|
|
721
|
+
* used by both CloudFront and the browser cache.
|
|
722
|
+
*
|
|
723
|
+
* The default `max-age` is set to 1 year.
|
|
724
|
+
* @default `"public,max-age=31536000,immutable"`
|
|
725
|
+
* @example
|
|
726
|
+
* ```js
|
|
727
|
+
* {
|
|
728
|
+
* assets: {
|
|
729
|
+
* versionedFilesCacheHeader: "public,max-age=31536000,immutable"
|
|
730
|
+
* }
|
|
731
|
+
* }
|
|
732
|
+
* ```
|
|
733
|
+
*/
|
|
734
|
+
versionedFilesCacheHeader?: Input<string>;
|
|
735
|
+
/**
|
|
736
|
+
* The `Cache-Control` header used for non-versioned files, like `index.html`. This is used by both CloudFront and the browser cache.
|
|
737
|
+
*
|
|
738
|
+
* The default is set to not cache on browsers, and cache for 1 day on CloudFront.
|
|
739
|
+
* @default `"public,max-age=0,s-maxage=86400,stale-while-revalidate=8640"`
|
|
740
|
+
* @example
|
|
741
|
+
* ```js
|
|
742
|
+
* {
|
|
743
|
+
* assets: {
|
|
744
|
+
* nonVersionedFilesCacheHeader: "public,max-age=0,no-cache"
|
|
745
|
+
* }
|
|
746
|
+
* }
|
|
747
|
+
* ```
|
|
748
|
+
*/
|
|
749
|
+
nonVersionedFilesCacheHeader?: Input<string>;
|
|
750
|
+
/**
|
|
751
|
+
* Specify the `Content-Type` and `Cache-Control` headers for specific files. This allows
|
|
752
|
+
* you to override the default behavior for specific files using glob patterns.
|
|
753
|
+
*
|
|
754
|
+
* @example
|
|
755
|
+
* Apply `Cache-Control` and `Content-Type` to all zip files.
|
|
756
|
+
* ```js
|
|
757
|
+
* {
|
|
758
|
+
* assets: {
|
|
759
|
+
* fileOptions: [
|
|
760
|
+
* {
|
|
761
|
+
* files: "**\/*.zip",
|
|
762
|
+
* contentType: "application/zip",
|
|
763
|
+
* cacheControl: "private,no-cache,no-store,must-revalidate"
|
|
764
|
+
* }
|
|
765
|
+
* ]
|
|
766
|
+
* }
|
|
767
|
+
* }
|
|
768
|
+
* ```
|
|
769
|
+
* Apply `Cache-Control` to all CSS and JS files except for CSS files with `index-`
|
|
770
|
+
* prefix in the `main/` directory.
|
|
771
|
+
* ```js
|
|
772
|
+
* {
|
|
773
|
+
* assets: {
|
|
774
|
+
* fileOptions: [
|
|
775
|
+
* {
|
|
776
|
+
* files: ["**\/*.css", "**\/*.js"],
|
|
777
|
+
* ignore: "main\/index-*.css",
|
|
778
|
+
* cacheControl: "private,no-cache,no-store,must-revalidate"
|
|
779
|
+
* }
|
|
780
|
+
* ]
|
|
781
|
+
* }
|
|
782
|
+
* }
|
|
783
|
+
* ```
|
|
784
|
+
*/
|
|
785
|
+
fileOptions?: Input<Prettify<BaseSiteFileOptions>[]>;
|
|
786
|
+
/**
|
|
787
|
+
* Configure if files from previous deployments should be purged from the bucket.
|
|
788
|
+
* @default `false`
|
|
789
|
+
* @example
|
|
790
|
+
* ```js
|
|
791
|
+
* {
|
|
792
|
+
* assets: {
|
|
793
|
+
* purge: false
|
|
794
|
+
* }
|
|
795
|
+
* }
|
|
796
|
+
* ```
|
|
797
|
+
*/
|
|
798
|
+
purge?: Input<boolean>;
|
|
799
|
+
}>;
|
|
800
|
+
/**
|
|
801
|
+
* @deprecated The `route` prop is now the recommended way to use the `Router` component
|
|
802
|
+
* to serve your site. Setting `route` will not create a standalone CloudFront
|
|
803
|
+
* distribution.
|
|
804
|
+
*/
|
|
805
|
+
cdn?: Input<boolean>;
|
|
806
|
+
/**
|
|
807
|
+
* [Transform](/docs/components#transform) how this component creates its underlying
|
|
808
|
+
* resources.
|
|
809
|
+
*/
|
|
810
|
+
transform?: {
|
|
811
|
+
/**
|
|
812
|
+
* Transform the Bucket resource used for uploading the assets.
|
|
813
|
+
*/
|
|
814
|
+
assets?: Transform<BucketArgs>;
|
|
815
|
+
/**
|
|
816
|
+
* Transform the server Function resource.
|
|
817
|
+
*/
|
|
818
|
+
server?: Transform<FunctionArgs>;
|
|
819
|
+
/**
|
|
820
|
+
* Transform the image optimizer Function resource.
|
|
821
|
+
*/
|
|
822
|
+
imageOptimizer?: Transform<FunctionArgs>;
|
|
823
|
+
/**
|
|
824
|
+
* Transform the CloudFront CDN resource.
|
|
825
|
+
*/
|
|
826
|
+
cdn?: Transform<CdnArgs>;
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
export abstract class SsrSite extends Component implements Link.Linkable {
|
|
831
|
+
private cdn?: Cdn;
|
|
832
|
+
private bucket?: Bucket;
|
|
833
|
+
private server?: Output<Function>;
|
|
834
|
+
private devUrl?: Output<string>;
|
|
835
|
+
private prodUrl?: Output<string | undefined>;
|
|
836
|
+
|
|
837
|
+
protected abstract normalizeBuildCommand(
|
|
838
|
+
args: SsrSiteArgs,
|
|
839
|
+
): Output<string> | void;
|
|
840
|
+
|
|
841
|
+
protected abstract buildPlan(
|
|
842
|
+
outputPath: Output<string>,
|
|
843
|
+
name: string,
|
|
844
|
+
args: SsrSiteArgs,
|
|
845
|
+
{ bucket }: { bucket: Bucket },
|
|
846
|
+
): Output<Plan>;
|
|
847
|
+
|
|
848
|
+
constructor(
|
|
849
|
+
type: string,
|
|
850
|
+
name: string,
|
|
851
|
+
args: SsrSiteArgs = {},
|
|
852
|
+
opts: ComponentResourceOptions = {},
|
|
853
|
+
) {
|
|
854
|
+
super(type, name, args, opts);
|
|
855
|
+
const self = this;
|
|
856
|
+
|
|
857
|
+
validateDeprecatedProps();
|
|
858
|
+
const regions = normalizeRegions();
|
|
859
|
+
const route = normalizeRoute();
|
|
860
|
+
const edge = normalizeEdge();
|
|
861
|
+
const serverTimeout = output(args.server?.timeout);
|
|
862
|
+
const buildCommand = this.normalizeBuildCommand(args);
|
|
863
|
+
const sitePath = regions.apply(() => normalizeSitePath());
|
|
864
|
+
const dev = normalizeDev();
|
|
865
|
+
const purge = output(args.assets).apply((assets) => assets?.purge ?? false);
|
|
866
|
+
const protection = normalizeProtection();
|
|
867
|
+
|
|
868
|
+
if (dev.enabled) {
|
|
869
|
+
const server = createDevServer();
|
|
870
|
+
this.devUrl = dev.url;
|
|
871
|
+
this.registerOutputs({
|
|
872
|
+
_metadata: {
|
|
873
|
+
mode: "placeholder",
|
|
874
|
+
path: sitePath,
|
|
875
|
+
server: server.arn,
|
|
876
|
+
},
|
|
877
|
+
_dev: {
|
|
878
|
+
...dev.outputs,
|
|
879
|
+
aws: { role: server.nodes.role.arn },
|
|
880
|
+
},
|
|
881
|
+
});
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
const outputPath = buildApp(
|
|
886
|
+
self,
|
|
887
|
+
name,
|
|
888
|
+
args,
|
|
889
|
+
sitePath,
|
|
890
|
+
buildCommand ?? undefined,
|
|
891
|
+
);
|
|
892
|
+
const bucket = createS3Bucket();
|
|
893
|
+
const plan = validatePlan(
|
|
894
|
+
this.buildPlan(outputPath, name, args, { bucket }),
|
|
895
|
+
);
|
|
896
|
+
const timeout = all([serverTimeout, plan.server]).apply(
|
|
897
|
+
([argsTimeout, plan]) => argsTimeout ?? plan?.timeout ?? "20 seconds",
|
|
898
|
+
);
|
|
899
|
+
const servers = createServers();
|
|
900
|
+
const imageOptimizer = createImageOptimizer();
|
|
901
|
+
const assetsUploaded = uploadAssets();
|
|
902
|
+
const kvNamespace = buildKvNamespace();
|
|
903
|
+
const edgeFunction = createLambdaEdgeFunction();
|
|
904
|
+
|
|
905
|
+
let distribution: Cdn | undefined;
|
|
906
|
+
let distributionId: Output<string>;
|
|
907
|
+
let kvStoreArn: Output<string>;
|
|
908
|
+
let invalidationDependsOn: Resource[] = [];
|
|
909
|
+
let prodUrl: Output<string | undefined>;
|
|
910
|
+
if (route) {
|
|
911
|
+
kvStoreArn = route.routerKvStoreArn;
|
|
912
|
+
distributionId = route.routerDistributionId;
|
|
913
|
+
invalidationDependsOn = [updateRouterKvRoutes()];
|
|
914
|
+
prodUrl = route.routerUrl;
|
|
915
|
+
} else {
|
|
916
|
+
kvStoreArn = createRequestKvStore();
|
|
917
|
+
distribution = createDistribution();
|
|
918
|
+
distributionId = distribution.nodes.distribution.id;
|
|
919
|
+
prodUrl = distribution.domainUrl.apply((domainUrl) =>
|
|
920
|
+
output(domainUrl ?? distribution!.url),
|
|
921
|
+
);
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
function createCachePolicy() {
|
|
925
|
+
return new cloudfront.CachePolicy(
|
|
926
|
+
`${name}ServerCachePolicy`,
|
|
927
|
+
{
|
|
928
|
+
comment: "SST server response cache policy",
|
|
929
|
+
defaultTtl: 0,
|
|
930
|
+
maxTtl: 31536000, // 1 year
|
|
931
|
+
minTtl: 0,
|
|
932
|
+
parametersInCacheKeyAndForwardedToOrigin: {
|
|
933
|
+
cookiesConfig: {
|
|
934
|
+
cookieBehavior: "none",
|
|
935
|
+
},
|
|
936
|
+
headersConfig: {
|
|
937
|
+
headerBehavior: "whitelist",
|
|
938
|
+
headers: {
|
|
939
|
+
items: ["x-open-next-cache-key", "x-forwarded-host"],
|
|
940
|
+
},
|
|
941
|
+
},
|
|
942
|
+
queryStringsConfig: {
|
|
943
|
+
queryStringBehavior: "all",
|
|
944
|
+
},
|
|
945
|
+
enableAcceptEncodingBrotli: true,
|
|
946
|
+
enableAcceptEncodingGzip: true,
|
|
947
|
+
},
|
|
948
|
+
},
|
|
949
|
+
{ parent: self },
|
|
950
|
+
);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
function createRequestKvStore() {
|
|
954
|
+
return edge.apply((edge) => {
|
|
955
|
+
const viewerRequest = edge?.viewerRequest;
|
|
956
|
+
if (viewerRequest?.kvStore) return output(viewerRequest?.kvStore);
|
|
957
|
+
|
|
958
|
+
return new cloudfront.KeyValueStore(
|
|
959
|
+
`${name}KvStore`,
|
|
960
|
+
{},
|
|
961
|
+
{ parent: self },
|
|
962
|
+
).arn;
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
function createRequestFunction() {
|
|
967
|
+
return edge.apply((edge) => {
|
|
968
|
+
const userInjection = edge?.viewerRequest?.injection ?? "";
|
|
969
|
+
const blockCloudfrontUrlInjection = args.domain
|
|
970
|
+
? CF_BLOCK_CLOUDFRONT_URL_INJECTION
|
|
971
|
+
: "";
|
|
972
|
+
return new cloudfront.Function(
|
|
973
|
+
`${name}CloudfrontFunctionRequest`,
|
|
974
|
+
{
|
|
975
|
+
runtime: "cloudfront-js-2.0",
|
|
976
|
+
keyValueStoreAssociations: kvStoreArn ? [kvStoreArn] : [],
|
|
977
|
+
code: interpolate`
|
|
978
|
+
import cf from "cloudfront";
|
|
979
|
+
async function handler(event) {
|
|
980
|
+
${userInjection}
|
|
981
|
+
${blockCloudfrontUrlInjection}
|
|
982
|
+
${CF_ROUTER_INJECTION}
|
|
983
|
+
|
|
984
|
+
const kvNamespace = "${kvNamespace}";
|
|
985
|
+
|
|
986
|
+
// Load metadata
|
|
987
|
+
let metadata;
|
|
988
|
+
try {
|
|
989
|
+
const v = await cf.kvs().get(kvNamespace + ":metadata");
|
|
990
|
+
metadata = JSON.parse(v);
|
|
991
|
+
} catch (e) {}
|
|
992
|
+
|
|
993
|
+
const response = await routeSite(kvNamespace, metadata);
|
|
994
|
+
return response || event.request;
|
|
995
|
+
}`,
|
|
996
|
+
},
|
|
997
|
+
{ parent: self },
|
|
998
|
+
);
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
function createResponseFunction() {
|
|
1003
|
+
return edge.apply((edge) => {
|
|
1004
|
+
const userConfig = edge?.viewerResponse;
|
|
1005
|
+
const userInjection = userConfig?.injection;
|
|
1006
|
+
const kvStoreArn = userConfig?.kvStore;
|
|
1007
|
+
|
|
1008
|
+
if (!userInjection) return;
|
|
1009
|
+
|
|
1010
|
+
return new cloudfront.Function(
|
|
1011
|
+
`${name}CloudfrontFunctionResponse`,
|
|
1012
|
+
{
|
|
1013
|
+
runtime: "cloudfront-js-2.0",
|
|
1014
|
+
keyValueStoreAssociations: kvStoreArn ? [kvStoreArn] : [],
|
|
1015
|
+
code: `
|
|
1016
|
+
import cf from "cloudfront";
|
|
1017
|
+
async function handler(event) {
|
|
1018
|
+
${userInjection}
|
|
1019
|
+
return event.response;
|
|
1020
|
+
}`,
|
|
1021
|
+
},
|
|
1022
|
+
{ parent: self },
|
|
1023
|
+
);
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
function createDistribution() {
|
|
1028
|
+
return new Cdn(
|
|
1029
|
+
...transform(
|
|
1030
|
+
args.transform?.cdn,
|
|
1031
|
+
`${name}Cdn`,
|
|
1032
|
+
{
|
|
1033
|
+
comment: `${name} app`,
|
|
1034
|
+
domain: args.domain,
|
|
1035
|
+
origins: [
|
|
1036
|
+
{
|
|
1037
|
+
originId: "default",
|
|
1038
|
+
domainName: "placeholder.sst.dev",
|
|
1039
|
+
customOriginConfig: {
|
|
1040
|
+
httpPort: 80,
|
|
1041
|
+
httpsPort: 443,
|
|
1042
|
+
originProtocolPolicy: "http-only",
|
|
1043
|
+
originReadTimeout: 20,
|
|
1044
|
+
originSslProtocols: ["TLSv1.2"],
|
|
1045
|
+
},
|
|
1046
|
+
},
|
|
1047
|
+
],
|
|
1048
|
+
defaultCacheBehavior: {
|
|
1049
|
+
targetOriginId: "default",
|
|
1050
|
+
viewerProtocolPolicy: "redirect-to-https",
|
|
1051
|
+
allowedMethods: [
|
|
1052
|
+
"DELETE",
|
|
1053
|
+
"GET",
|
|
1054
|
+
"HEAD",
|
|
1055
|
+
"OPTIONS",
|
|
1056
|
+
"PATCH",
|
|
1057
|
+
"POST",
|
|
1058
|
+
"PUT",
|
|
1059
|
+
],
|
|
1060
|
+
cachedMethods: ["GET", "HEAD"],
|
|
1061
|
+
compress: true,
|
|
1062
|
+
cachePolicyId: args.cachePolicy ?? createCachePolicy().id,
|
|
1063
|
+
// CloudFront's Managed-AllViewerExceptHostHeader policy
|
|
1064
|
+
originRequestPolicyId: "b689b0a8-53d0-40ab-baf2-68738e2966ac",
|
|
1065
|
+
functionAssociations: all([
|
|
1066
|
+
createRequestFunction(),
|
|
1067
|
+
createResponseFunction(),
|
|
1068
|
+
]).apply(([reqFn, resFn]) => [
|
|
1069
|
+
{ eventType: "viewer-request", functionArn: reqFn.arn },
|
|
1070
|
+
...(resFn
|
|
1071
|
+
? [{ eventType: "viewer-response", functionArn: resFn.arn }]
|
|
1072
|
+
: []),
|
|
1073
|
+
]),
|
|
1074
|
+
lambdaFunctionAssociations: all([protection, edgeFunction]).apply(
|
|
1075
|
+
([protectionConfig, autoEdgeFunction]) => {
|
|
1076
|
+
if (protectionConfig.mode !== "oac-with-edge-signing") {
|
|
1077
|
+
return [];
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
if (protectionConfig.edgeFunction?.arn) {
|
|
1081
|
+
return [
|
|
1082
|
+
{
|
|
1083
|
+
eventType: "origin-request",
|
|
1084
|
+
lambdaArn: protectionConfig.edgeFunction.arn,
|
|
1085
|
+
includeBody: true,
|
|
1086
|
+
},
|
|
1087
|
+
];
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
if (autoEdgeFunction) {
|
|
1091
|
+
return [
|
|
1092
|
+
{
|
|
1093
|
+
eventType: "origin-request",
|
|
1094
|
+
lambdaArn: autoEdgeFunction.qualifiedArn,
|
|
1095
|
+
includeBody: true,
|
|
1096
|
+
},
|
|
1097
|
+
];
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
return [];
|
|
1101
|
+
},
|
|
1102
|
+
),
|
|
1103
|
+
},
|
|
1104
|
+
},
|
|
1105
|
+
{ parent: self },
|
|
1106
|
+
),
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
const kvUpdated = createKvEntries();
|
|
1111
|
+
createInvalidation();
|
|
1112
|
+
|
|
1113
|
+
// Create Lambda permissions based on protection mode
|
|
1114
|
+
all([distribution, route, servers, imageOptimizer, protection]).apply(
|
|
1115
|
+
([dist, routeVal, servers, imgOptimizer, protection]) => {
|
|
1116
|
+
const distributionArn = dist
|
|
1117
|
+
? dist.nodes.distribution.arn
|
|
1118
|
+
: routeVal?.routerDistributionArn;
|
|
1119
|
+
if (!distributionArn) return;
|
|
1120
|
+
|
|
1121
|
+
// Server functions
|
|
1122
|
+
servers.forEach(({ region, server }) => {
|
|
1123
|
+
const provider = useProvider(region);
|
|
1124
|
+
const urlDependsOn = server.nodes.url.apply((u) => (u ? [u] : []));
|
|
1125
|
+
|
|
1126
|
+
if (protection.mode === "none") {
|
|
1127
|
+
new lambda.Permission(
|
|
1128
|
+
`${name}PublicFunctionUrlAccess${logicalName(region)}`,
|
|
1129
|
+
{
|
|
1130
|
+
action: "lambda:InvokeFunctionUrl",
|
|
1131
|
+
function: server.nodes.function.name,
|
|
1132
|
+
principal: "*",
|
|
1133
|
+
functionUrlAuthType: "NONE",
|
|
1134
|
+
},
|
|
1135
|
+
{ provider, parent: self, dependsOn: urlDependsOn },
|
|
1136
|
+
);
|
|
1137
|
+
} else if (
|
|
1138
|
+
protection.mode === "oac" ||
|
|
1139
|
+
protection.mode === "oac-with-edge-signing"
|
|
1140
|
+
) {
|
|
1141
|
+
new lambda.Permission(
|
|
1142
|
+
`${name}CloudFrontFunctionUrlAccess${logicalName(region)}`,
|
|
1143
|
+
{
|
|
1144
|
+
action: "lambda:InvokeFunctionUrl",
|
|
1145
|
+
function: server.nodes.function.name,
|
|
1146
|
+
principal: "cloudfront.amazonaws.com",
|
|
1147
|
+
sourceArn: distributionArn,
|
|
1148
|
+
},
|
|
1149
|
+
{ provider, parent: self, dependsOn: urlDependsOn },
|
|
1150
|
+
);
|
|
1151
|
+
new lambda.Permission(
|
|
1152
|
+
`${name}CloudFrontInvokeFunction${logicalName(region)}`,
|
|
1153
|
+
{
|
|
1154
|
+
action: "lambda:InvokeFunction",
|
|
1155
|
+
function: server.nodes.function.name,
|
|
1156
|
+
principal: "cloudfront.amazonaws.com",
|
|
1157
|
+
sourceArn: distributionArn,
|
|
1158
|
+
invokedViaFunctionUrl: true,
|
|
1159
|
+
},
|
|
1160
|
+
{ provider, parent: self, dependsOn: urlDependsOn },
|
|
1161
|
+
);
|
|
1162
|
+
}
|
|
1163
|
+
});
|
|
1164
|
+
|
|
1165
|
+
// Image optimizer
|
|
1166
|
+
if (imgOptimizer) {
|
|
1167
|
+
const urlDependsOn = imgOptimizer.nodes.url.apply((u) =>
|
|
1168
|
+
u ? [u] : [],
|
|
1169
|
+
);
|
|
1170
|
+
if (protection.mode === "none") {
|
|
1171
|
+
new lambda.Permission(
|
|
1172
|
+
`${name}ImageOptimizerPublicFunctionUrlAccess`,
|
|
1173
|
+
{
|
|
1174
|
+
action: "lambda:InvokeFunctionUrl",
|
|
1175
|
+
function: imgOptimizer.nodes.function.name,
|
|
1176
|
+
principal: "*",
|
|
1177
|
+
functionUrlAuthType: "NONE",
|
|
1178
|
+
},
|
|
1179
|
+
{ parent: self, dependsOn: urlDependsOn },
|
|
1180
|
+
);
|
|
1181
|
+
} else if (
|
|
1182
|
+
protection.mode === "oac" ||
|
|
1183
|
+
protection.mode === "oac-with-edge-signing"
|
|
1184
|
+
) {
|
|
1185
|
+
new lambda.Permission(
|
|
1186
|
+
`${name}ImageOptimizerCloudFrontFunctionUrlAccess`,
|
|
1187
|
+
{
|
|
1188
|
+
action: "lambda:InvokeFunctionUrl",
|
|
1189
|
+
function: imgOptimizer.nodes.function.name,
|
|
1190
|
+
principal: "cloudfront.amazonaws.com",
|
|
1191
|
+
sourceArn: distributionArn,
|
|
1192
|
+
},
|
|
1193
|
+
{ parent: self, dependsOn: urlDependsOn },
|
|
1194
|
+
);
|
|
1195
|
+
new lambda.Permission(
|
|
1196
|
+
`${name}ImageOptimizerCloudFrontInvokeFunction`,
|
|
1197
|
+
{
|
|
1198
|
+
action: "lambda:InvokeFunction",
|
|
1199
|
+
function: imgOptimizer.nodes.function.name,
|
|
1200
|
+
principal: "cloudfront.amazonaws.com",
|
|
1201
|
+
sourceArn: distributionArn,
|
|
1202
|
+
invokedViaFunctionUrl: true,
|
|
1203
|
+
},
|
|
1204
|
+
{ parent: self, dependsOn: urlDependsOn },
|
|
1205
|
+
);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
},
|
|
1209
|
+
);
|
|
1210
|
+
|
|
1211
|
+
const server = servers.apply((servers) => servers[0]?.server);
|
|
1212
|
+
this.bucket = bucket;
|
|
1213
|
+
this.cdn = distribution;
|
|
1214
|
+
this.server = server;
|
|
1215
|
+
this.prodUrl = prodUrl;
|
|
1216
|
+
|
|
1217
|
+
this.registerOutputs({
|
|
1218
|
+
_hint: this.url,
|
|
1219
|
+
_metadata: {
|
|
1220
|
+
mode: "deployed",
|
|
1221
|
+
path: sitePath,
|
|
1222
|
+
url: this.url,
|
|
1223
|
+
edge: false,
|
|
1224
|
+
server: server.arn,
|
|
1225
|
+
},
|
|
1226
|
+
});
|
|
1227
|
+
|
|
1228
|
+
function validateDeprecatedProps() {
|
|
1229
|
+
if (args.cdn !== undefined)
|
|
1230
|
+
throw new VisibleError(
|
|
1231
|
+
`"cdn" prop is deprecated. Use the "route.router" prop instead to use an existing "Router" component to serve your site.`,
|
|
1232
|
+
);
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
function normalizeDev() {
|
|
1236
|
+
const enabled = $dev && args.dev !== false;
|
|
1237
|
+
const devArgs = args.dev || {};
|
|
1238
|
+
|
|
1239
|
+
return {
|
|
1240
|
+
enabled,
|
|
1241
|
+
url: output(devArgs.url ?? URL_UNAVAILABLE),
|
|
1242
|
+
outputs: {
|
|
1243
|
+
title: devArgs.title,
|
|
1244
|
+
command: output(devArgs.command ?? "npm run dev"),
|
|
1245
|
+
autostart: output(devArgs.autostart ?? true),
|
|
1246
|
+
directory: output(devArgs.directory ?? sitePath),
|
|
1247
|
+
environment: args.environment,
|
|
1248
|
+
links: output(args.link || [])
|
|
1249
|
+
.apply(Link.build)
|
|
1250
|
+
.apply((links) => links.map((link) => link.name)),
|
|
1251
|
+
},
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
function normalizeSitePath() {
|
|
1256
|
+
return output(args.path).apply((sitePath) => {
|
|
1257
|
+
if (!sitePath) return ".";
|
|
1258
|
+
|
|
1259
|
+
if (!fs.existsSync(sitePath)) {
|
|
1260
|
+
throw new VisibleError(
|
|
1261
|
+
`Site directory not found at "${path.resolve(
|
|
1262
|
+
sitePath,
|
|
1263
|
+
)}". Please check the path setting in your configuration.`,
|
|
1264
|
+
);
|
|
1265
|
+
}
|
|
1266
|
+
return sitePath;
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
function normalizeRegions() {
|
|
1271
|
+
return output(
|
|
1272
|
+
args.regions ?? [getRegionOutput(undefined, { parent: self }).region],
|
|
1273
|
+
).apply((regions) => {
|
|
1274
|
+
if (regions.length === 0)
|
|
1275
|
+
throw new VisibleError(
|
|
1276
|
+
"No deployment regions specified. Please specify at least one region in the 'regions' property.",
|
|
1277
|
+
);
|
|
1278
|
+
|
|
1279
|
+
return regions.map((region) => {
|
|
1280
|
+
if (!Object.values(Region).includes(region as Region))
|
|
1281
|
+
throw new VisibleError(
|
|
1282
|
+
`Invalid AWS region: "${region}". Please specify a valid AWS region.`,
|
|
1283
|
+
);
|
|
1284
|
+
return region as Region;
|
|
1285
|
+
});
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
function normalizeRoute() {
|
|
1290
|
+
const route = normalizeRouteArgs(args.router, args.route);
|
|
1291
|
+
|
|
1292
|
+
if (route) {
|
|
1293
|
+
if (args.domain)
|
|
1294
|
+
throw new VisibleError(
|
|
1295
|
+
`Cannot provide both "domain" and "route". Use the "domain" prop on the "Router" component when serving your site through a Router.`,
|
|
1296
|
+
);
|
|
1297
|
+
|
|
1298
|
+
if (args.edge)
|
|
1299
|
+
throw new VisibleError(
|
|
1300
|
+
`Cannot provide both "edge" and "route". Use the "edge" prop on the "Router" component when serving your site through a Router.`,
|
|
1301
|
+
);
|
|
1302
|
+
|
|
1303
|
+
if (args.protection)
|
|
1304
|
+
throw new VisibleError(
|
|
1305
|
+
`Cannot set "protection" when routing through a Router. Set "protection" on the Router component instead.`,
|
|
1306
|
+
);
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
return route;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
function normalizeEdge() {
|
|
1313
|
+
return output([args.edge, args.server?.edge]).apply(
|
|
1314
|
+
([edge, serverEdge]) => {
|
|
1315
|
+
if (serverEdge)
|
|
1316
|
+
throw new VisibleError(
|
|
1317
|
+
`The "server.edge" prop is deprecated. Use the "edge" prop on the top level instead.`,
|
|
1318
|
+
);
|
|
1319
|
+
|
|
1320
|
+
if (!edge) return edge;
|
|
1321
|
+
return edge;
|
|
1322
|
+
},
|
|
1323
|
+
);
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
function normalizeProtection(): Output<ProtectionConfig> {
|
|
1327
|
+
if (route) {
|
|
1328
|
+
return route.apply((r) => r.routerProtection);
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
return output(args.protection).apply((protection) => {
|
|
1332
|
+
if (!protection) return { mode: "none" as const };
|
|
1333
|
+
|
|
1334
|
+
if (typeof protection === "string") {
|
|
1335
|
+
return { mode: protection };
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
if (
|
|
1339
|
+
protection.mode === "oac-with-edge-signing" &&
|
|
1340
|
+
protection.edgeFunction?.arn
|
|
1341
|
+
) {
|
|
1342
|
+
const arn = protection.edgeFunction.arn;
|
|
1343
|
+
if (typeof arn === "string") {
|
|
1344
|
+
parseLambdaEdgeArn(arn);
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
return protection;
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
function createLambdaEdgeFunction() {
|
|
1353
|
+
if (route) return output(undefined);
|
|
1354
|
+
|
|
1355
|
+
return protection.apply((protectionConfig) => {
|
|
1356
|
+
if (
|
|
1357
|
+
protectionConfig.mode !== "oac-with-edge-signing" ||
|
|
1358
|
+
protectionConfig.edgeFunction?.arn
|
|
1359
|
+
) {
|
|
1360
|
+
return undefined;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
const edgeConfig = protectionConfig.edgeFunction;
|
|
1364
|
+
const memory = edgeConfig?.memory ? toMBs(edgeConfig.memory) : 128;
|
|
1365
|
+
const timeout = edgeConfig?.timeout ? toSeconds(edgeConfig.timeout) : 5;
|
|
1366
|
+
|
|
1367
|
+
const edgeRole = new iam.Role(
|
|
1368
|
+
...transform(
|
|
1369
|
+
undefined,
|
|
1370
|
+
`${name}EdgeFunctionRole`,
|
|
1371
|
+
{
|
|
1372
|
+
name: physicalName(64, `${name}EdgeRole`),
|
|
1373
|
+
assumeRolePolicy: JSON.stringify({
|
|
1374
|
+
Version: "2012-10-17",
|
|
1375
|
+
Statement: [
|
|
1376
|
+
{
|
|
1377
|
+
Action: "sts:AssumeRole",
|
|
1378
|
+
Effect: "Allow",
|
|
1379
|
+
Principal: {
|
|
1380
|
+
Service: [
|
|
1381
|
+
"lambda.amazonaws.com",
|
|
1382
|
+
"edgelambda.amazonaws.com",
|
|
1383
|
+
],
|
|
1384
|
+
},
|
|
1385
|
+
},
|
|
1386
|
+
],
|
|
1387
|
+
}),
|
|
1388
|
+
managedPolicyArns: [
|
|
1389
|
+
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
|
|
1390
|
+
],
|
|
1391
|
+
},
|
|
1392
|
+
{ parent: self, ignoreChanges: ["name"] },
|
|
1393
|
+
),
|
|
1394
|
+
);
|
|
1395
|
+
|
|
1396
|
+
const edgeFunction = new lambda.Function(
|
|
1397
|
+
...transform(
|
|
1398
|
+
undefined,
|
|
1399
|
+
`${name}EdgeFunction`,
|
|
1400
|
+
{
|
|
1401
|
+
name: physicalName(64, `${name}EdgeFn`),
|
|
1402
|
+
runtime: "nodejs24.x",
|
|
1403
|
+
handler: "index.handler",
|
|
1404
|
+
role: edgeRole.arn,
|
|
1405
|
+
code: new pulumiAsset.FileArchive(
|
|
1406
|
+
path.join($cli.paths.platform, "dist", "oac-edge-signer"),
|
|
1407
|
+
),
|
|
1408
|
+
publish: true,
|
|
1409
|
+
timeout: timeout,
|
|
1410
|
+
memorySize: memory,
|
|
1411
|
+
description: `${name} Lambda@Edge function for OAC request signing`,
|
|
1412
|
+
},
|
|
1413
|
+
{
|
|
1414
|
+
parent: self,
|
|
1415
|
+
provider: useProvider("us-east-1"),
|
|
1416
|
+
ignoreChanges: ["name"],
|
|
1417
|
+
},
|
|
1418
|
+
),
|
|
1419
|
+
);
|
|
1420
|
+
|
|
1421
|
+
return edgeFunction;
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
function createDevServer() {
|
|
1426
|
+
return new Function(
|
|
1427
|
+
...transform(
|
|
1428
|
+
args.transform?.server,
|
|
1429
|
+
`${name}DevServer`,
|
|
1430
|
+
{
|
|
1431
|
+
description: `${name} dev server`,
|
|
1432
|
+
runtime: "nodejs24.x",
|
|
1433
|
+
timeout: "20 seconds",
|
|
1434
|
+
memory: "128 MB",
|
|
1435
|
+
bundle: path.join(
|
|
1436
|
+
$cli.paths.platform,
|
|
1437
|
+
"functions",
|
|
1438
|
+
"empty-function",
|
|
1439
|
+
),
|
|
1440
|
+
handler: "index.handler",
|
|
1441
|
+
environment: args.environment,
|
|
1442
|
+
permissions: args.permissions,
|
|
1443
|
+
link: args.link,
|
|
1444
|
+
dev: false,
|
|
1445
|
+
},
|
|
1446
|
+
{ parent: self },
|
|
1447
|
+
),
|
|
1448
|
+
);
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
function validatePlan(plan: Output<Plan>) {
|
|
1452
|
+
return all([plan, route]).apply(([plan, route]) => {
|
|
1453
|
+
if (plan.base) {
|
|
1454
|
+
// starts with /
|
|
1455
|
+
plan.base = !plan.base.startsWith("/") ? `/${plan.base}` : plan.base;
|
|
1456
|
+
// does not end with /
|
|
1457
|
+
plan.base = plan.base.replace(/\/$/, "");
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
if (route?.pathPrefix && route.pathPrefix !== "/") {
|
|
1461
|
+
if (!plan.base)
|
|
1462
|
+
throw new VisibleError(
|
|
1463
|
+
`No base path found for site. You must configure the base path to match the route path prefix "${route.pathPrefix}".`,
|
|
1464
|
+
);
|
|
1465
|
+
|
|
1466
|
+
if (!plan.base.startsWith(route.pathPrefix))
|
|
1467
|
+
throw new VisibleError(
|
|
1468
|
+
`The site base path "${plan.base}" must start with the route path prefix "${route.pathPrefix}".`,
|
|
1469
|
+
);
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
// if copy.to has a leading slash, files will be uploaded to `/` folder in bucket
|
|
1473
|
+
plan.assets.forEach((copy) => {
|
|
1474
|
+
copy.to = copy.to.replace(/^\/|\/$/g, "");
|
|
1475
|
+
});
|
|
1476
|
+
if (plan.isrCache) {
|
|
1477
|
+
plan.isrCache.to = plan.isrCache.to.replace(/^\/|\/$/g, "");
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
return plan;
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
function createS3Bucket() {
|
|
1485
|
+
return new Bucket(
|
|
1486
|
+
...transform(
|
|
1487
|
+
args.transform?.assets,
|
|
1488
|
+
`${name}Assets`,
|
|
1489
|
+
{ access: "cloudfront" },
|
|
1490
|
+
{ parent: self, retainOnDelete: false },
|
|
1491
|
+
),
|
|
1492
|
+
);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
function createServers() {
|
|
1496
|
+
return all([regions, plan.server]).apply(([regions, planServer]) => {
|
|
1497
|
+
if (!planServer) return [];
|
|
1498
|
+
|
|
1499
|
+
// Only sites that create a server function need a function URL. `sst dev`
|
|
1500
|
+
// doesn't create one, and `sst refresh` has to work on a stack that an earlier
|
|
1501
|
+
// deploy left behind in one of these regions. (`sst remove` doesn't run the
|
|
1502
|
+
// program.)
|
|
1503
|
+
const needsFunctionUrls =
|
|
1504
|
+
!($dev && args.dev !== false) && $cli.command !== "refresh";
|
|
1505
|
+
for (const region of regions) {
|
|
1506
|
+
if (needsFunctionUrls && regionsWithoutFunctionUrls.includes(region))
|
|
1507
|
+
throw new VisibleError(
|
|
1508
|
+
`Region ${region} is not supported by this component, because Lambda function URLs aren't available there. Please select a different AWS region.`,
|
|
1509
|
+
);
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
return regions.map((region) => {
|
|
1513
|
+
const provider = useProvider(region);
|
|
1514
|
+
const server = new Function(
|
|
1515
|
+
...transform(
|
|
1516
|
+
args.transform?.server,
|
|
1517
|
+
`${name}Server${logicalName(region)}`,
|
|
1518
|
+
{
|
|
1519
|
+
...planServer,
|
|
1520
|
+
description: planServer.description ?? `${name} server`,
|
|
1521
|
+
runtime: output(args.server?.runtime).apply(
|
|
1522
|
+
(v) => v ?? planServer.runtime ?? "nodejs24.x",
|
|
1523
|
+
),
|
|
1524
|
+
timeout,
|
|
1525
|
+
memory: output(args.server?.memory).apply(
|
|
1526
|
+
(v) => v ?? planServer.memory ?? "1024 MB",
|
|
1527
|
+
),
|
|
1528
|
+
architecture: output(args.server?.architecture).apply(
|
|
1529
|
+
(v) => v ?? planServer.architecture ?? "x86_64",
|
|
1530
|
+
),
|
|
1531
|
+
vpc: args.vpc,
|
|
1532
|
+
nodejs: {
|
|
1533
|
+
...planServer.nodejs,
|
|
1534
|
+
format: "esm" as const,
|
|
1535
|
+
install: output({
|
|
1536
|
+
install: args.server?.install,
|
|
1537
|
+
planInstall: planServer.nodejs?.install,
|
|
1538
|
+
}).apply(({ install, planInstall }) => {
|
|
1539
|
+
const result: Record<string, string> = {};
|
|
1540
|
+
for (const pkg of install ?? []) {
|
|
1541
|
+
result[pkg] = "*";
|
|
1542
|
+
}
|
|
1543
|
+
if (Array.isArray(planInstall)) {
|
|
1544
|
+
for (const pkg of planInstall) {
|
|
1545
|
+
result[pkg] = "*";
|
|
1546
|
+
}
|
|
1547
|
+
} else if (planInstall) {
|
|
1548
|
+
Object.assign(result, planInstall);
|
|
1549
|
+
}
|
|
1550
|
+
return result;
|
|
1551
|
+
}),
|
|
1552
|
+
loader: args.server?.loader ?? planServer.nodejs?.loader,
|
|
1553
|
+
},
|
|
1554
|
+
environment: output(args.environment).apply((environment) => ({
|
|
1555
|
+
...environment,
|
|
1556
|
+
...planServer.environment,
|
|
1557
|
+
})),
|
|
1558
|
+
permissions: output(args.permissions).apply((permissions) => [
|
|
1559
|
+
{
|
|
1560
|
+
actions: ["cloudfront:CreateInvalidation"],
|
|
1561
|
+
resources: ["*"],
|
|
1562
|
+
},
|
|
1563
|
+
...(permissions ?? []),
|
|
1564
|
+
...(planServer.permissions ?? []),
|
|
1565
|
+
]),
|
|
1566
|
+
injections: [
|
|
1567
|
+
...(args.warm
|
|
1568
|
+
? [useServerWarmingInjection(planServer.streaming)]
|
|
1569
|
+
: []),
|
|
1570
|
+
...(planServer.injections || []),
|
|
1571
|
+
],
|
|
1572
|
+
link: output(args.link).apply((link) => [
|
|
1573
|
+
...(planServer.link ?? []),
|
|
1574
|
+
...(link ?? []),
|
|
1575
|
+
]),
|
|
1576
|
+
layers: output(args.server?.layers).apply((layers) => [
|
|
1577
|
+
...(planServer.layers ?? []),
|
|
1578
|
+
...(layers ?? []),
|
|
1579
|
+
]),
|
|
1580
|
+
url: {
|
|
1581
|
+
authorization: protection.apply((p) =>
|
|
1582
|
+
p.mode === "oac" || p.mode === "oac-with-edge-signing"
|
|
1583
|
+
? "iam"
|
|
1584
|
+
: "none",
|
|
1585
|
+
),
|
|
1586
|
+
},
|
|
1587
|
+
dev: false,
|
|
1588
|
+
_skipHint: true,
|
|
1589
|
+
},
|
|
1590
|
+
{ provider, parent: self },
|
|
1591
|
+
),
|
|
1592
|
+
);
|
|
1593
|
+
|
|
1594
|
+
if (args.warm) {
|
|
1595
|
+
// Create cron job
|
|
1596
|
+
const cron = new Cron(
|
|
1597
|
+
`${name}Warmer${logicalName(region)}`,
|
|
1598
|
+
{
|
|
1599
|
+
schedule: "rate(5 minutes)",
|
|
1600
|
+
job: {
|
|
1601
|
+
description: `${name} warmer`,
|
|
1602
|
+
bundle: path.join($cli.paths.platform, "dist", "ssr-warmer"),
|
|
1603
|
+
runtime: "nodejs24.x",
|
|
1604
|
+
handler: "index.handler",
|
|
1605
|
+
timeout: "900 seconds",
|
|
1606
|
+
memory: "128 MB",
|
|
1607
|
+
dev: false,
|
|
1608
|
+
environment: {
|
|
1609
|
+
FUNCTION_NAME: server.nodes.function.name,
|
|
1610
|
+
CONCURRENCY: output(args.warm).apply((warm) =>
|
|
1611
|
+
warm.toString(),
|
|
1612
|
+
),
|
|
1613
|
+
},
|
|
1614
|
+
link: [server],
|
|
1615
|
+
_skipMetadata: true,
|
|
1616
|
+
},
|
|
1617
|
+
transform: {
|
|
1618
|
+
target: (args) => {
|
|
1619
|
+
args.retryPolicy = {
|
|
1620
|
+
maximumRetryAttempts: 0,
|
|
1621
|
+
maximumEventAgeInSeconds: 60,
|
|
1622
|
+
};
|
|
1623
|
+
},
|
|
1624
|
+
},
|
|
1625
|
+
},
|
|
1626
|
+
{ provider, parent: self },
|
|
1627
|
+
);
|
|
1628
|
+
|
|
1629
|
+
// Prewarm on deploy
|
|
1630
|
+
new lambda.Invocation(
|
|
1631
|
+
`${name}Prewarm${logicalName(region)}`,
|
|
1632
|
+
{
|
|
1633
|
+
functionName: cron.nodes.job.name,
|
|
1634
|
+
triggers: {
|
|
1635
|
+
version: Date.now().toString(),
|
|
1636
|
+
},
|
|
1637
|
+
input: JSON.stringify({}),
|
|
1638
|
+
},
|
|
1639
|
+
{ provider, parent: self },
|
|
1640
|
+
);
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
return { region, server };
|
|
1644
|
+
});
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
function createImageOptimizer() {
|
|
1649
|
+
return output(plan.imageOptimizer).apply((imageOptimizer) => {
|
|
1650
|
+
if (!imageOptimizer) return;
|
|
1651
|
+
return new Function(
|
|
1652
|
+
...transform(
|
|
1653
|
+
args.transform?.imageOptimizer,
|
|
1654
|
+
`${name}ImageOptimizer`,
|
|
1655
|
+
{
|
|
1656
|
+
timeout: "25 seconds",
|
|
1657
|
+
logging: {
|
|
1658
|
+
retention: "3 days",
|
|
1659
|
+
},
|
|
1660
|
+
permissions: [
|
|
1661
|
+
{
|
|
1662
|
+
actions: ["s3:GetObject"],
|
|
1663
|
+
resources: [interpolate`${bucket.arn}/*`],
|
|
1664
|
+
},
|
|
1665
|
+
],
|
|
1666
|
+
...imageOptimizer.function,
|
|
1667
|
+
url: {
|
|
1668
|
+
authorization: protection.apply((p) =>
|
|
1669
|
+
p.mode === "oac" || p.mode === "oac-with-edge-signing"
|
|
1670
|
+
? "iam"
|
|
1671
|
+
: "none",
|
|
1672
|
+
),
|
|
1673
|
+
},
|
|
1674
|
+
dev: false,
|
|
1675
|
+
_skipMetadata: true,
|
|
1676
|
+
_skipHint: true,
|
|
1677
|
+
},
|
|
1678
|
+
{ parent: self },
|
|
1679
|
+
),
|
|
1680
|
+
);
|
|
1681
|
+
});
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
function useServerWarmingInjection(streaming?: boolean) {
|
|
1685
|
+
return [
|
|
1686
|
+
`if (event.type === "warmer") {`,
|
|
1687
|
+
` const p = new Promise((resolve) => {`,
|
|
1688
|
+
` setTimeout(() => {`,
|
|
1689
|
+
` resolve({ serverId: "server-" + Math.random().toString(36).slice(2, 8) });`,
|
|
1690
|
+
` }, event.delay);`,
|
|
1691
|
+
` });`,
|
|
1692
|
+
...(streaming
|
|
1693
|
+
? [
|
|
1694
|
+
` const response = await p;`,
|
|
1695
|
+
` responseStream.write(JSON.stringify(response));`,
|
|
1696
|
+
` responseStream.end();`,
|
|
1697
|
+
` return;`,
|
|
1698
|
+
]
|
|
1699
|
+
: [` return p;`]),
|
|
1700
|
+
`}`,
|
|
1701
|
+
].join("\n");
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
function uploadAssets() {
|
|
1705
|
+
return all([args.assets, route, plan, outputPath]).apply(
|
|
1706
|
+
async ([assets, route, plan, outputPath]) => {
|
|
1707
|
+
// Define content headers
|
|
1708
|
+
const versionedFilesTTL = 31536000; // 1 year
|
|
1709
|
+
const nonVersionedFilesTTL = 86400; // 1 day
|
|
1710
|
+
|
|
1711
|
+
const bucketFiles: BucketFile[] = [];
|
|
1712
|
+
|
|
1713
|
+
// Handle each copy source
|
|
1714
|
+
for (const copy of [
|
|
1715
|
+
...plan.assets,
|
|
1716
|
+
...(plan.isrCache
|
|
1717
|
+
? [{ ...plan.isrCache, versionedSubDir: undefined }]
|
|
1718
|
+
: []),
|
|
1719
|
+
]) {
|
|
1720
|
+
// Build fileOptions
|
|
1721
|
+
const fileOptions: BaseSiteFileOptions[] = [
|
|
1722
|
+
// unversioned files
|
|
1723
|
+
{
|
|
1724
|
+
files: "**",
|
|
1725
|
+
ignore: copy.versionedSubDir
|
|
1726
|
+
? toPosix(path.join(copy.versionedSubDir, "**"))
|
|
1727
|
+
: undefined,
|
|
1728
|
+
cacheControl:
|
|
1729
|
+
assets?.nonVersionedFilesCacheHeader ??
|
|
1730
|
+
`public,max-age=0,s-maxage=${nonVersionedFilesTTL},stale-while-revalidate=${nonVersionedFilesTTL}`,
|
|
1731
|
+
},
|
|
1732
|
+
// versioned files
|
|
1733
|
+
...(copy.versionedSubDir
|
|
1734
|
+
? [
|
|
1735
|
+
{
|
|
1736
|
+
files: toPosix(path.join(copy.versionedSubDir, "**")),
|
|
1737
|
+
cacheControl:
|
|
1738
|
+
assets?.versionedFilesCacheHeader ??
|
|
1739
|
+
`public,max-age=${versionedFilesTTL},immutable`,
|
|
1740
|
+
},
|
|
1741
|
+
]
|
|
1742
|
+
: []),
|
|
1743
|
+
...(assets?.fileOptions ?? []),
|
|
1744
|
+
];
|
|
1745
|
+
|
|
1746
|
+
// Upload files based on fileOptions
|
|
1747
|
+
const filesUploaded: string[] = [];
|
|
1748
|
+
for (const fileOption of fileOptions.reverse()) {
|
|
1749
|
+
const files = globSync(fileOption.files, {
|
|
1750
|
+
cwd: path.resolve(outputPath, copy.from),
|
|
1751
|
+
nodir: true,
|
|
1752
|
+
dot: true,
|
|
1753
|
+
ignore: fileOption.ignore,
|
|
1754
|
+
}).filter((file) => !filesUploaded.includes(file));
|
|
1755
|
+
|
|
1756
|
+
bucketFiles.push(
|
|
1757
|
+
...(await Promise.all(
|
|
1758
|
+
files.map(async (file) => {
|
|
1759
|
+
const source = path.resolve(outputPath, copy.from, file);
|
|
1760
|
+
const content = await fs.promises.readFile(source, "utf-8");
|
|
1761
|
+
const hash = crypto
|
|
1762
|
+
.createHash("sha256")
|
|
1763
|
+
.update(content)
|
|
1764
|
+
.digest("hex");
|
|
1765
|
+
return {
|
|
1766
|
+
source,
|
|
1767
|
+
key: toPosix(
|
|
1768
|
+
path.join(
|
|
1769
|
+
copy.to,
|
|
1770
|
+
route?.pathPrefix?.replace(/^\//, "") ?? "",
|
|
1771
|
+
file,
|
|
1772
|
+
),
|
|
1773
|
+
),
|
|
1774
|
+
hash,
|
|
1775
|
+
cacheControl: fileOption.cacheControl,
|
|
1776
|
+
contentType:
|
|
1777
|
+
fileOption.contentType ?? getContentType(file, "UTF-8"),
|
|
1778
|
+
};
|
|
1779
|
+
}),
|
|
1780
|
+
)),
|
|
1781
|
+
);
|
|
1782
|
+
filesUploaded.push(...files);
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
return new BucketFiles(
|
|
1787
|
+
`${name}AssetFiles`,
|
|
1788
|
+
{
|
|
1789
|
+
bucketName: bucket.name,
|
|
1790
|
+
files: bucketFiles,
|
|
1791
|
+
purge,
|
|
1792
|
+
region: getRegionOutput(undefined, { parent: self }).region,
|
|
1793
|
+
},
|
|
1794
|
+
{ parent: self },
|
|
1795
|
+
);
|
|
1796
|
+
},
|
|
1797
|
+
);
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
function buildKvNamespace() {
|
|
1801
|
+
// In the case multiple sites use the same kv store, we need to namespace the keys
|
|
1802
|
+
return crypto
|
|
1803
|
+
.createHash("md5")
|
|
1804
|
+
.update(`${$app.name}-${$app.stage}-${name}`)
|
|
1805
|
+
.digest("hex")
|
|
1806
|
+
.substring(0, 4);
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
function createKvEntries() {
|
|
1810
|
+
const entries = all([
|
|
1811
|
+
servers,
|
|
1812
|
+
imageOptimizer,
|
|
1813
|
+
outputPath,
|
|
1814
|
+
plan,
|
|
1815
|
+
bucket.nodes.bucket.bucketRegionalDomainName,
|
|
1816
|
+
timeout,
|
|
1817
|
+
protection,
|
|
1818
|
+
route,
|
|
1819
|
+
]).apply(
|
|
1820
|
+
([
|
|
1821
|
+
servers,
|
|
1822
|
+
imageOptimizer,
|
|
1823
|
+
outputPath,
|
|
1824
|
+
plan,
|
|
1825
|
+
bucketDomain,
|
|
1826
|
+
timeout,
|
|
1827
|
+
protectionConfig,
|
|
1828
|
+
route,
|
|
1829
|
+
]) =>
|
|
1830
|
+
all([
|
|
1831
|
+
servers.map((s) => ({ region: s.region, url: s.server!.url })),
|
|
1832
|
+
imageOptimizer?.url,
|
|
1833
|
+
]).apply(([servers, imageOptimizerUrl]) => {
|
|
1834
|
+
const kvEntries: Record<string, string> = {};
|
|
1835
|
+
const dirs: string[] = [];
|
|
1836
|
+
// Router append .html and index.html suffixes to requests to s3 routes:
|
|
1837
|
+
// - `.well-known` contain files without suffix, hence will be appended .html
|
|
1838
|
+
// - in the future, it might make sense for each dir to have props that controls
|
|
1839
|
+
// the suffixes ie. "handleTrailingSlashse"
|
|
1840
|
+
const expandDirs = [".well-known"];
|
|
1841
|
+
|
|
1842
|
+
// Every file under `dir`, as paths relative to it. Undefined if it
|
|
1843
|
+
// holds anything other than files and folders, like a symlink.
|
|
1844
|
+
const listDir = (dir: string): string[] | undefined => {
|
|
1845
|
+
const files: string[] = [];
|
|
1846
|
+
for (const item of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
1847
|
+
if (item.isFile()) {
|
|
1848
|
+
files.push(item.name);
|
|
1849
|
+
continue;
|
|
1850
|
+
}
|
|
1851
|
+
if (!item.isDirectory()) return;
|
|
1852
|
+
const children = listDir(path.join(dir, item.name));
|
|
1853
|
+
if (!children) return;
|
|
1854
|
+
files.push(
|
|
1855
|
+
...children.map((file) => path.join(item.name, file)),
|
|
1856
|
+
);
|
|
1857
|
+
}
|
|
1858
|
+
return files;
|
|
1859
|
+
};
|
|
1860
|
+
// Folders to list file by file, if they fit in the KV budget.
|
|
1861
|
+
const listed: { dir: string; keys: string[] }[] = [];
|
|
1862
|
+
|
|
1863
|
+
plan.assets.forEach((copy) => {
|
|
1864
|
+
const processDir = (childPath = "", level = 0) => {
|
|
1865
|
+
const currentPath = path.join(outputPath, copy.from, childPath);
|
|
1866
|
+
fs.readdirSync(currentPath, { withFileTypes: true }).forEach(
|
|
1867
|
+
(item) => {
|
|
1868
|
+
// File: add to kvEntries
|
|
1869
|
+
if (item.isFile()) {
|
|
1870
|
+
kvEntries[toPosix(path.join("/", childPath, item.name))] =
|
|
1871
|
+
"s3";
|
|
1872
|
+
return;
|
|
1873
|
+
}
|
|
1874
|
+
// Directory + deep routes: recursively process it
|
|
1875
|
+
// In Next.js, asset requests are prefixed with is /_next/static,
|
|
1876
|
+
// and image optimization requests are prefixed with /_next/image.
|
|
1877
|
+
// We cannot route by 1 level of subdirs (ie. /_next/`), so we need
|
|
1878
|
+
// to route by 2 levels of subdirs.
|
|
1879
|
+
// Directory + expand: recursively process it
|
|
1880
|
+
if (
|
|
1881
|
+
level === 0 &&
|
|
1882
|
+
(expandDirs.includes(item.name) ||
|
|
1883
|
+
item.name === copy.deepRoute)
|
|
1884
|
+
) {
|
|
1885
|
+
processDir(path.join(childPath, item.name), level + 1);
|
|
1886
|
+
return;
|
|
1887
|
+
}
|
|
1888
|
+
// Directory with prerendered routes: add its files, not the
|
|
1889
|
+
// folder, so server routes in the same folder are not
|
|
1890
|
+
// shadowed by S3 (ie. /blog/post.html and /blog/[slug]).
|
|
1891
|
+
// Folders with a key over the KV key size limit are still
|
|
1892
|
+
// routed as a whole.
|
|
1893
|
+
const dirPath = toPosix(path.join(childPath, item.name));
|
|
1894
|
+
if (
|
|
1895
|
+
item.isDirectory() &&
|
|
1896
|
+
!(
|
|
1897
|
+
copy.versionedSubDir &&
|
|
1898
|
+
(dirPath === copy.versionedSubDir ||
|
|
1899
|
+
dirPath.startsWith(copy.versionedSubDir + "/"))
|
|
1900
|
+
) &&
|
|
1901
|
+
(copy.listFiles ||
|
|
1902
|
+
plan.hasStaticRoutes ||
|
|
1903
|
+
plan.prerenderedDirs?.length)
|
|
1904
|
+
) {
|
|
1905
|
+
const keys = listDir(
|
|
1906
|
+
path.join(currentPath, item.name),
|
|
1907
|
+
)?.map((file) => toPosix(path.join("/", dirPath, file)));
|
|
1908
|
+
if (
|
|
1909
|
+
keys &&
|
|
1910
|
+
(copy.listFiles ||
|
|
1911
|
+
(level === 0 &&
|
|
1912
|
+
plan.prerenderedDirs?.includes(item.name)) ||
|
|
1913
|
+
keys.some((key) => key.endsWith(".html"))) &&
|
|
1914
|
+
keys.every(
|
|
1915
|
+
(key) => Buffer.byteLength(key) <= MAX_KV_KEY_LENGTH,
|
|
1916
|
+
)
|
|
1917
|
+
) {
|
|
1918
|
+
listed.push({
|
|
1919
|
+
dir: toPosix(path.join("/", dirPath)),
|
|
1920
|
+
keys,
|
|
1921
|
+
});
|
|
1922
|
+
return;
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
// Directory + NOT expand: add to route
|
|
1926
|
+
dirs.push(toPosix(path.join("/", childPath, item.name)));
|
|
1927
|
+
},
|
|
1928
|
+
);
|
|
1929
|
+
};
|
|
1930
|
+
processDir();
|
|
1931
|
+
});
|
|
1932
|
+
|
|
1933
|
+
// Over the budget, route the folders to S3 as a whole, as before.
|
|
1934
|
+
// Each item also stores the `<namespace>:` prefix and the "s3" value.
|
|
1935
|
+
const listedBytes = listed
|
|
1936
|
+
.flatMap(({ keys }) => keys)
|
|
1937
|
+
.reduce((total, key) => total + Buffer.byteLength(key) + 8, 0);
|
|
1938
|
+
if (listedBytes <= MAX_LISTED_KV_BYTES) {
|
|
1939
|
+
listed.forEach(({ keys }) =>
|
|
1940
|
+
keys.forEach((key) => (kvEntries[key] = "s3")),
|
|
1941
|
+
);
|
|
1942
|
+
} else {
|
|
1943
|
+
const dirList = listed.map(({ dir }) => dir).join(", ");
|
|
1944
|
+
console.warn(
|
|
1945
|
+
`${name}: too many prerendered files to list in the KV store, so server routes in these folders may return 403: ${dirList}`,
|
|
1946
|
+
);
|
|
1947
|
+
dirs.push(...listed.map(({ dir }) => dir));
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
kvEntries["metadata"] = JSON.stringify({
|
|
1951
|
+
base: plan.base,
|
|
1952
|
+
custom404: plan.custom404,
|
|
1953
|
+
s3: {
|
|
1954
|
+
domain: bucketDomain,
|
|
1955
|
+
dir: plan.assets[0].to ? "/" + plan.assets[0].to : "",
|
|
1956
|
+
prefix:
|
|
1957
|
+
route?.pathPrefix && route.pathPrefix !== "/"
|
|
1958
|
+
? route.pathPrefix
|
|
1959
|
+
: "",
|
|
1960
|
+
routes: dirs,
|
|
1961
|
+
},
|
|
1962
|
+
image: imageOptimizerUrl
|
|
1963
|
+
? {
|
|
1964
|
+
host: new URL(imageOptimizerUrl!).host,
|
|
1965
|
+
route: plan.imageOptimizer!.prefix,
|
|
1966
|
+
...(protectionConfig.mode === "oac" ||
|
|
1967
|
+
protectionConfig.mode === "oac-with-edge-signing"
|
|
1968
|
+
? {
|
|
1969
|
+
originAccessControlConfig: {
|
|
1970
|
+
enabled: true,
|
|
1971
|
+
signingBehavior: "always",
|
|
1972
|
+
signingProtocol: "sigv4",
|
|
1973
|
+
originType: "lambda",
|
|
1974
|
+
},
|
|
1975
|
+
}
|
|
1976
|
+
: {}),
|
|
1977
|
+
}
|
|
1978
|
+
: undefined,
|
|
1979
|
+
servers: servers.map((s) => [
|
|
1980
|
+
new URL(s.url!).host,
|
|
1981
|
+
supportedRegions[s.region as keyof typeof supportedRegions].lat,
|
|
1982
|
+
supportedRegions[s.region as keyof typeof supportedRegions].lon,
|
|
1983
|
+
]),
|
|
1984
|
+
origin: {
|
|
1985
|
+
timeouts: {
|
|
1986
|
+
readTimeout: toSeconds(timeout),
|
|
1987
|
+
},
|
|
1988
|
+
...(protectionConfig.mode === "oac" ||
|
|
1989
|
+
protectionConfig.mode === "oac-with-edge-signing"
|
|
1990
|
+
? {
|
|
1991
|
+
originAccessControlConfig: {
|
|
1992
|
+
enabled: true,
|
|
1993
|
+
signingBehavior: "always",
|
|
1994
|
+
signingProtocol: "sigv4",
|
|
1995
|
+
originType: "lambda",
|
|
1996
|
+
},
|
|
1997
|
+
}
|
|
1998
|
+
: {}),
|
|
1999
|
+
},
|
|
2000
|
+
} satisfies KV_SITE_METADATA);
|
|
2001
|
+
return kvEntries;
|
|
2002
|
+
}),
|
|
2003
|
+
);
|
|
2004
|
+
|
|
2005
|
+
return new KvKeys(
|
|
2006
|
+
`${name}KvKeys`,
|
|
2007
|
+
{
|
|
2008
|
+
store: kvStoreArn!,
|
|
2009
|
+
namespace: kvNamespace,
|
|
2010
|
+
entries,
|
|
2011
|
+
purge,
|
|
2012
|
+
},
|
|
2013
|
+
{ parent: self },
|
|
2014
|
+
);
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
function updateRouterKvRoutes() {
|
|
2018
|
+
return new KvRoutesUpdate(
|
|
2019
|
+
`${name}RoutesUpdate`,
|
|
2020
|
+
{
|
|
2021
|
+
store: route!.routerKvStoreArn,
|
|
2022
|
+
namespace: route!.routerKvNamespace,
|
|
2023
|
+
key: "routes",
|
|
2024
|
+
entry: route!.apply((route) =>
|
|
2025
|
+
["site", kvNamespace, route!.hostPattern, route!.pathPrefix].join(
|
|
2026
|
+
",",
|
|
2027
|
+
),
|
|
2028
|
+
),
|
|
2029
|
+
},
|
|
2030
|
+
{ parent: self },
|
|
2031
|
+
);
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
function createInvalidation() {
|
|
2035
|
+
// Resolve server/image-optimizer code hashes so that server-only code
|
|
2036
|
+
// changes also trigger a CloudFront invalidation. Without this, the
|
|
2037
|
+
// version below is derived purely from static assets and an SSR deploy
|
|
2038
|
+
// that only changes the Lambda bundle produces an identical hash,
|
|
2039
|
+
// causing Pulumi to skip the DistributionInvalidation update.
|
|
2040
|
+
const serverCodeHashes = servers.apply((list) =>
|
|
2041
|
+
all(list.map(({ server }) => server.nodes.function.codeSha256)),
|
|
2042
|
+
);
|
|
2043
|
+
const imageOptimizerCodeHash = imageOptimizer.apply(
|
|
2044
|
+
(opt) => opt?.nodes.function.codeSha256,
|
|
2045
|
+
);
|
|
2046
|
+
|
|
2047
|
+
all([
|
|
2048
|
+
args.invalidation,
|
|
2049
|
+
outputPath,
|
|
2050
|
+
plan,
|
|
2051
|
+
serverCodeHashes,
|
|
2052
|
+
imageOptimizerCodeHash,
|
|
2053
|
+
]).apply(
|
|
2054
|
+
([
|
|
2055
|
+
invalidationRaw,
|
|
2056
|
+
outputPath,
|
|
2057
|
+
plan,
|
|
2058
|
+
serverCodeHashes,
|
|
2059
|
+
imageOptimizerCodeHash,
|
|
2060
|
+
]) => {
|
|
2061
|
+
// Normalize invalidation
|
|
2062
|
+
if (invalidationRaw === false) return;
|
|
2063
|
+
const invalidation = {
|
|
2064
|
+
wait: false,
|
|
2065
|
+
paths: "all",
|
|
2066
|
+
...invalidationRaw,
|
|
2067
|
+
};
|
|
2068
|
+
|
|
2069
|
+
// We will generate a hash based on the contents of the S3 files with cache enabled.
|
|
2070
|
+
// This will be used to determine if we need to invalidate our CloudFront cache.
|
|
2071
|
+
const s3Origin = plan.assets;
|
|
2072
|
+
const cachedS3Files = s3Origin.filter((file) => file.cached);
|
|
2073
|
+
if (cachedS3Files.length === 0) return;
|
|
2074
|
+
|
|
2075
|
+
// Build invalidation paths
|
|
2076
|
+
const invalidationPaths: string[] = [];
|
|
2077
|
+
if (invalidation.paths === "all") {
|
|
2078
|
+
invalidationPaths.push("/*");
|
|
2079
|
+
} else if (invalidation.paths === "versioned") {
|
|
2080
|
+
cachedS3Files.forEach((item) => {
|
|
2081
|
+
if (!item.versionedSubDir) return;
|
|
2082
|
+
invalidationPaths.push(
|
|
2083
|
+
toPosix(path.join("/", item.to, item.versionedSubDir, "*")),
|
|
2084
|
+
);
|
|
2085
|
+
});
|
|
2086
|
+
} else {
|
|
2087
|
+
invalidationPaths.push(...(invalidation?.paths || []));
|
|
2088
|
+
}
|
|
2089
|
+
if (invalidationPaths.length === 0) return;
|
|
2090
|
+
|
|
2091
|
+
// Build build ID
|
|
2092
|
+
let invalidationBuildId: string;
|
|
2093
|
+
if (plan.buildId) {
|
|
2094
|
+
invalidationBuildId = plan.buildId;
|
|
2095
|
+
} else {
|
|
2096
|
+
const hash = crypto.createHash("md5");
|
|
2097
|
+
|
|
2098
|
+
// Fold in server bundle hashes so that changes to server-only
|
|
2099
|
+
// code (e.g. loaders, handlers) invalidate the CloudFront cache
|
|
2100
|
+
// even when no static assets changed.
|
|
2101
|
+
serverCodeHashes.forEach((h) => hash.update(h));
|
|
2102
|
+
if (imageOptimizerCodeHash) hash.update(imageOptimizerCodeHash);
|
|
2103
|
+
|
|
2104
|
+
cachedS3Files.forEach((item) => {
|
|
2105
|
+
// The below options are needed to support following symlinks when building zip files:
|
|
2106
|
+
// - nodir: This will prevent symlinks themselves from being copied into the zip.
|
|
2107
|
+
// - follow: This will follow symlinks and copy the files within.
|
|
2108
|
+
|
|
2109
|
+
// For versioned files, use file path for digest since file version in name should change on content change
|
|
2110
|
+
if (item.versionedSubDir) {
|
|
2111
|
+
globSync("**", {
|
|
2112
|
+
dot: true,
|
|
2113
|
+
nodir: true,
|
|
2114
|
+
follow: true,
|
|
2115
|
+
cwd: path.resolve(
|
|
2116
|
+
outputPath,
|
|
2117
|
+
item.from,
|
|
2118
|
+
item.versionedSubDir,
|
|
2119
|
+
),
|
|
2120
|
+
}).forEach((filePath) => hash.update(filePath));
|
|
2121
|
+
}
|
|
2122
|
+
|
|
2123
|
+
// For non-versioned files, use file content for digest
|
|
2124
|
+
if (invalidation.paths !== "versioned") {
|
|
2125
|
+
globSync("**", {
|
|
2126
|
+
ignore: item.versionedSubDir
|
|
2127
|
+
? [toPosix(path.join(item.versionedSubDir, "**"))]
|
|
2128
|
+
: undefined,
|
|
2129
|
+
dot: true,
|
|
2130
|
+
nodir: true,
|
|
2131
|
+
follow: true,
|
|
2132
|
+
cwd: path.resolve(outputPath, item.from),
|
|
2133
|
+
}).forEach((filePath) =>
|
|
2134
|
+
hash.update(
|
|
2135
|
+
fs.readFileSync(
|
|
2136
|
+
path.resolve(outputPath, item.from, filePath),
|
|
2137
|
+
"utf-8",
|
|
2138
|
+
),
|
|
2139
|
+
),
|
|
2140
|
+
);
|
|
2141
|
+
}
|
|
2142
|
+
});
|
|
2143
|
+
invalidationBuildId = hash.digest("hex");
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
new DistributionInvalidation(
|
|
2147
|
+
`${name}Invalidation`,
|
|
2148
|
+
{
|
|
2149
|
+
distributionId,
|
|
2150
|
+
paths: invalidationPaths,
|
|
2151
|
+
version: invalidationBuildId,
|
|
2152
|
+
wait: invalidation.wait,
|
|
2153
|
+
},
|
|
2154
|
+
{
|
|
2155
|
+
parent: self,
|
|
2156
|
+
dependsOn: [assetsUploaded, kvUpdated, ...invalidationDependsOn],
|
|
2157
|
+
},
|
|
2158
|
+
);
|
|
2159
|
+
},
|
|
2160
|
+
);
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
/**
|
|
2165
|
+
* The URL of the Astro site.
|
|
2166
|
+
*
|
|
2167
|
+
* If the `domain` is set, this is the URL with the custom domain.
|
|
2168
|
+
* Otherwise, it's the auto-generated CloudFront URL.
|
|
2169
|
+
*/
|
|
2170
|
+
public get url() {
|
|
2171
|
+
return all([this.prodUrl, this.devUrl]).apply(
|
|
2172
|
+
([prodUrl, devUrl]) => (prodUrl ?? devUrl)!,
|
|
2173
|
+
);
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
/**
|
|
2177
|
+
* The underlying [resources](/docs/components/#nodes) this component creates.
|
|
2178
|
+
*/
|
|
2179
|
+
public get nodes() {
|
|
2180
|
+
return {
|
|
2181
|
+
/**
|
|
2182
|
+
* The AWS Lambda server function that renders the site.
|
|
2183
|
+
*/
|
|
2184
|
+
server: this.server,
|
|
2185
|
+
/**
|
|
2186
|
+
* The Amazon S3 Bucket that stores the assets.
|
|
2187
|
+
*/
|
|
2188
|
+
assets: this.bucket,
|
|
2189
|
+
/**
|
|
2190
|
+
* The Amazon CloudFront CDN that serves the site.
|
|
2191
|
+
*/
|
|
2192
|
+
cdn: this.cdn,
|
|
2193
|
+
};
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
/** @internal */
|
|
2197
|
+
public getSSTLink() {
|
|
2198
|
+
return {
|
|
2199
|
+
properties: {
|
|
2200
|
+
url: this.url,
|
|
2201
|
+
},
|
|
2202
|
+
};
|
|
2203
|
+
}
|
|
2204
|
+
}
|