@takumi-stack/core 1.0.0 → 1.0.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/.dist/common/coordinator.d.ts +18 -0
- package/.dist/common/index.d.ts +6 -0
- package/.dist/common/modifier.d.ts +4 -0
- package/.dist/common/naming/get-deploy-config.d.ts +5 -0
- package/.dist/common/naming/get-domain.d.ts +8 -0
- package/.dist/common/naming/get-function-entry.d.ts +3 -0
- package/.dist/common/naming/get-logical-name.d.ts +2 -0
- package/.dist/common/naming/get-resource-name.d.ts +26 -0
- package/.dist/common/naming/get-service-name.d.ts +9 -0
- package/.dist/common/naming/index.d.ts +8 -0
- package/.dist/common/naming/string-parser.d.ts +4 -0
- package/.dist/common/service.d.ts +21 -0
- package/.dist/common/synth/account-mapping.d.ts +2 -0
- package/.dist/common/synth/assume-role.d.ts +17 -0
- package/.dist/common/synth/get-global-props.d.ts +4 -0
- package/.dist/common/synth/get-service-props.d.ts +3 -0
- package/.dist/common/synth/index.d.ts +8 -0
- package/.dist/common/synth/pre-script.d.ts +21 -0
- package/.dist/common/synth/props-types.d.ts +41 -0
- package/.dist/common/synth/synth-error.d.ts +7 -0
- package/.dist/index.d.ts +4 -0
- package/.dist/package.json +43 -0
- package/.dist/prefab/analytics/events/handlers/ingestion-transform/handler.d.ts +3 -0
- package/.dist/prefab/analytics/events/index.d.ts +28 -0
- package/.dist/prefab/analytics/events/index.d.ts.map +1 -0
- package/.dist/prefab/analytics/events/index.js +163 -0
- package/.dist/prefab/analytics/events/index.js.map +1 -0
- package/.dist/prefab/analytics/index.d.ts +2 -0
- package/.dist/prefab/auth/cognito-pool/index.d.ts +57 -0
- package/.dist/prefab/auth/cognito-pool/index.d.ts.map +1 -0
- package/.dist/prefab/auth/cognito-pool/index.js.map +1 -0
- package/.dist/prefab/auth/index.d.ts +2 -0
- package/.dist/prefab/cdn/cdn-api/index.d.ts +34 -0
- package/.dist/prefab/cdn/cdn-api/index.d.ts.map +1 -0
- package/.dist/prefab/cdn/cdn-api/index.js +153 -0
- package/.dist/prefab/cdn/cdn-api/index.js.map +1 -0
- package/.dist/prefab/cdn/cdn-asset/index.d.ts +24 -0
- package/.dist/prefab/cdn/cdn-asset/index.d.ts.map +1 -0
- package/.dist/prefab/cdn/cdn-asset/index.js +96 -0
- package/.dist/prefab/cdn/cdn-asset/index.js.map +1 -0
- package/.dist/prefab/cdn/cdn-spa/index.d.ts +24 -0
- package/.dist/prefab/cdn/cdn-spa/index.d.ts.map +1 -0
- package/.dist/prefab/cdn/cdn-spa/index.js +138 -0
- package/.dist/prefab/cdn/cdn-spa/index.js.map +1 -0
- package/.dist/prefab/cdn/cdn-ssr/index.d.ts +33 -0
- package/.dist/prefab/cdn/cdn-ssr/index.d.ts.map +1 -0
- package/.dist/prefab/cdn/cdn-ssr/index.js +271 -0
- package/.dist/prefab/cdn/cdn-ssr/index.js.map +1 -0
- package/.dist/prefab/cdn/index.d.ts +5 -0
- package/.dist/prefab/compute/fargate/cluster.d.ts +13 -0
- package/.dist/prefab/compute/fargate/cluster.d.ts.map +1 -0
- package/.dist/prefab/compute/fargate/cluster.js.map +1 -0
- package/.dist/prefab/compute/fargate/index.d.ts +3 -0
- package/.dist/prefab/compute/fargate/service.d.ts +45 -0
- package/.dist/prefab/compute/fargate/service.d.ts.map +1 -0
- package/.dist/prefab/compute/fargate/service.js.map +1 -0
- package/.dist/prefab/compute/function/api-function/api-aggregate.d.ts +31 -0
- package/.dist/prefab/compute/function/api-function/api-aggregate.d.ts.map +1 -0
- package/.dist/prefab/compute/function/api-function/api-aggregate.js +53 -0
- package/.dist/prefab/compute/function/api-function/api-aggregate.js.map +1 -0
- package/.dist/prefab/compute/function/api-function/api-function.d.ts +22 -0
- package/.dist/prefab/compute/function/api-function/api-function.d.ts.map +1 -0
- package/.dist/prefab/compute/function/api-function/api-function.js +44 -0
- package/.dist/prefab/compute/function/api-function/api-function.js.map +1 -0
- package/.dist/prefab/compute/function/api-function/index.d.ts +3 -0
- package/.dist/prefab/compute/function/base-function/index.d.ts +33 -0
- package/.dist/prefab/compute/function/base-function/index.d.ts.map +1 -0
- package/.dist/prefab/compute/function/base-function/index.js +70 -0
- package/.dist/prefab/compute/function/base-function/index.js.map +1 -0
- package/.dist/prefab/compute/function/cognito-function/cognito-aggregate.d.ts +15 -0
- package/.dist/prefab/compute/function/cognito-function/cognito-aggregate.d.ts.map +1 -0
- package/.dist/prefab/compute/function/cognito-function/cognito-aggregate.js.map +1 -0
- package/.dist/prefab/compute/function/cognito-function/cognito-function.d.ts +17 -0
- package/.dist/prefab/compute/function/cognito-function/cognito-function.d.ts.map +1 -0
- package/.dist/prefab/compute/function/cognito-function/cognito-function.js.map +1 -0
- package/.dist/prefab/compute/function/cognito-function/index.d.ts +3 -0
- package/.dist/prefab/compute/function/cron-function/cron-aggregate.d.ts +14 -0
- package/.dist/prefab/compute/function/cron-function/cron-aggregate.d.ts.map +1 -0
- package/.dist/prefab/compute/function/cron-function/cron-aggregate.js.map +1 -0
- package/.dist/prefab/compute/function/cron-function/cron-function.d.ts +15 -0
- package/.dist/prefab/compute/function/cron-function/cron-function.d.ts.map +1 -0
- package/.dist/prefab/compute/function/cron-function/cron-function.js +24 -0
- package/.dist/prefab/compute/function/cron-function/cron-function.js.map +1 -0
- package/.dist/prefab/compute/function/cron-function/index.d.ts +3 -0
- package/.dist/prefab/compute/function/event-function/EventAggregateParams.d.ts +9 -0
- package/.dist/prefab/compute/function/event-function/EventAggregateParams.d.ts.map +1 -0
- package/.dist/prefab/compute/function/event-function/EventAggregateParams.js +3 -0
- package/.dist/prefab/compute/function/event-function/EventAggregateParams.js.map +1 -0
- package/.dist/prefab/compute/function/event-function/event-aggregate.d.ts +16 -0
- package/.dist/prefab/compute/function/event-function/event-aggregate.d.ts.map +1 -0
- package/.dist/prefab/compute/function/event-function/event-aggregate.js.map +1 -0
- package/.dist/prefab/compute/function/event-function/event-function.d.ts +14 -0
- package/.dist/prefab/compute/function/event-function/event-function.d.ts.map +1 -0
- package/.dist/prefab/compute/function/event-function/event-function.js.map +1 -0
- package/.dist/prefab/compute/function/event-function/index.d.ts +3 -0
- package/.dist/prefab/compute/function/index.d.ts +8 -0
- package/.dist/prefab/compute/function/queue-function/index.d.ts +22 -0
- package/.dist/prefab/compute/function/queue-function/index.d.ts.map +1 -0
- package/.dist/prefab/compute/function/queue-function/index.js +46 -0
- package/.dist/prefab/compute/function/queue-function/index.js.map +1 -0
- package/.dist/prefab/compute/function/topic-function/index.d.ts +20 -0
- package/.dist/prefab/compute/function/topic-function/index.d.ts.map +1 -0
- package/.dist/prefab/compute/function/topic-function/index.js +23 -0
- package/.dist/prefab/compute/function/topic-function/index.js.map +1 -0
- package/.dist/prefab/compute/index.d.ts +3 -0
- package/.dist/prefab/database/dynamo/index.d.ts +13 -0
- package/.dist/prefab/database/dynamo/index.d.ts.map +1 -0
- package/.dist/prefab/database/dynamo/index.js.map +1 -0
- package/.dist/prefab/database/index.d.ts +4 -0
- package/.dist/prefab/database/rds/handlers/start-cluster/handler.d.ts +2 -0
- package/.dist/prefab/database/rds/handlers/stop-cluster/handler.d.ts +2 -0
- package/.dist/prefab/database/rds/index.d.ts +51 -0
- package/.dist/prefab/database/rds/index.d.ts.map +1 -0
- package/.dist/prefab/database/rds/index.js +223 -0
- package/.dist/prefab/database/rds/index.js.map +1 -0
- package/.dist/prefab/database/timestream/index.d.ts +3 -0
- package/.dist/prefab/database/timestream/timestream-database.d.ts +11 -0
- package/.dist/prefab/database/timestream/timestream-database.d.ts.map +1 -0
- package/.dist/prefab/database/timestream/timestream-database.js.map +1 -0
- package/.dist/prefab/database/timestream/timestream-table.d.ts +21 -0
- package/.dist/prefab/database/timestream/timestream-table.d.ts.map +1 -0
- package/.dist/prefab/database/timestream/timestream-table.js.map +1 -0
- package/.dist/prefab/gateway/alb-public/index.d.ts +41 -0
- package/.dist/prefab/gateway/alb-public/index.d.ts.map +1 -0
- package/.dist/prefab/gateway/alb-public/index.js.map +1 -0
- package/.dist/prefab/gateway/api-gateway/api-http.d.ts +27 -0
- package/.dist/prefab/gateway/api-gateway/api-http.d.ts.map +1 -0
- package/.dist/prefab/gateway/api-gateway/api-http.js.map +1 -0
- package/.dist/prefab/gateway/api-gateway/api-rest.d.ts +23 -0
- package/.dist/prefab/gateway/api-gateway/api-rest.d.ts.map +1 -0
- package/.dist/prefab/gateway/api-gateway/api-rest.js.map +1 -0
- package/.dist/prefab/gateway/api-gateway/index.d.ts +3 -0
- package/.dist/prefab/gateway/app-sync/index.d.ts +31 -0
- package/.dist/prefab/gateway/app-sync/index.d.ts.map +1 -0
- package/.dist/prefab/gateway/app-sync/index.js.map +1 -0
- package/.dist/prefab/gateway/app-sync/resolver-aggregate.d.ts +33 -0
- package/.dist/prefab/gateway/app-sync/resolver-aggregate.d.ts.map +1 -0
- package/.dist/prefab/gateway/app-sync/resolver-aggregate.js.map +1 -0
- package/.dist/prefab/gateway/app-sync/types.d.ts +29 -0
- package/.dist/prefab/gateway/app-sync/types.d.ts.map +1 -0
- package/.dist/prefab/gateway/index.d.ts +4 -0
- package/.dist/prefab/index.d.ts +11 -0
- package/.dist/prefab/integration/event-bus/index.d.ts +18 -0
- package/.dist/prefab/integration/event-bus/index.d.ts.map +1 -0
- package/.dist/prefab/integration/event-bus/index.js.map +1 -0
- package/.dist/prefab/integration/index.d.ts +4 -0
- package/.dist/prefab/integration/queue/index.d.ts +29 -0
- package/.dist/prefab/integration/queue/index.d.ts.map +1 -0
- package/.dist/prefab/integration/queue/index.js.map +1 -0
- package/.dist/prefab/integration/topic/index.d.ts +19 -0
- package/.dist/prefab/integration/topic/index.d.ts.map +1 -0
- package/.dist/prefab/integration/topic/index.js.map +1 -0
- package/.dist/prefab/networking/dns-domain-ref/index.d.ts +14 -0
- package/.dist/prefab/networking/dns-domain-ref/index.d.ts.map +1 -0
- package/.dist/prefab/networking/dns-domain-ref/index.js.map +1 -0
- package/.dist/prefab/networking/dns-subdomain-certificate/index.d.ts +11 -0
- package/.dist/prefab/networking/dns-subdomain-certificate/index.d.ts.map +1 -0
- package/.dist/prefab/networking/dns-subdomain-certificate/index.js.map +1 -0
- package/.dist/prefab/networking/dns-subdomain-hosted-zone/index.d.ts +10 -0
- package/.dist/prefab/networking/dns-subdomain-hosted-zone/index.d.ts.map +1 -0
- package/.dist/prefab/networking/dns-subdomain-hosted-zone/index.js.map +1 -0
- package/.dist/prefab/networking/index.d.ts +6 -0
- package/.dist/prefab/networking/vpc/index.d.ts +18 -0
- package/.dist/prefab/networking/vpc/index.d.ts.map +1 -0
- package/.dist/prefab/networking/vpc/index.js.map +1 -0
- package/.dist/prefab/networking/waf/index.d.ts +12 -0
- package/.dist/prefab/networking/waf/index.d.ts.map +1 -0
- package/.dist/prefab/networking/waf/index.js.map +1 -0
- package/.dist/prefab/storage/bucket/asset-bucket.d.ts +10 -0
- package/.dist/prefab/storage/bucket/asset-bucket.d.ts.map +1 -0
- package/.dist/prefab/storage/bucket/index.d.ts +3 -0
- package/.dist/prefab/storage/bucket/private-bucket.d.ts +32 -0
- package/.dist/prefab/storage/bucket/private-bucket.d.ts.map +1 -0
- package/.dist/prefab/storage/bucket/private-bucket.js.map +1 -0
- package/.dist/prefab/storage/index.d.ts +2 -0
- package/.dist/prefab/utils/config/frontend-env-builder.d.ts +12 -0
- package/.dist/prefab/utils/config/frontend-env-builder.d.ts.map +1 -0
- package/.dist/prefab/utils/config/frontend-env-builder.js.map +1 -0
- package/.dist/prefab/utils/config/index.d.ts +4 -0
- package/.dist/prefab/utils/config/parameter-secret.d.ts +19 -0
- package/.dist/prefab/utils/config/parameter-secret.d.ts.map +1 -0
- package/.dist/prefab/utils/config/parameter-secret.js.map +1 -0
- package/.dist/prefab/utils/config/runtime-secret.d.ts.map +1 -0
- package/.dist/prefab/utils/config/runtime-secret.js.map +1 -0
- package/.dist/prefab/utils/deploy-pipeline/catalog/integrations/index.d.ts +2 -0
- package/.dist/prefab/utils/deploy-pipeline/entities/index.d.ts +29 -0
- package/.dist/prefab/utils/deploy-pipeline/index.d.ts +13 -0
- package/.dist/prefab/utils/deploy-pipeline/index.d.ts.map +1 -0
- package/.dist/prefab/utils/deploy-pipeline/index.js.map +1 -0
- package/.dist/prefab/utils/deploy-pipeline/platform/get-pipeline-detail.d.ts +6 -0
- package/.dist/prefab/utils/deploy-pipeline/platform/get-slack-payload.d.ts +3 -0
- package/.dist/prefab/utils/duration.d.ts +2 -0
- package/.dist/prefab/utils/index.d.ts +5 -0
- package/.dist/prefab/utils/ses/index.d.ts +20 -0
- package/.dist/prefab/utils/ses/index.d.ts.map +1 -0
- package/.dist/prefab/utils/ses/index.js.map +1 -0
- package/.dist/script/config-command/bootstrap.d.ts +3 -0
- package/.dist/script/config-command/bootstrap.js +65 -0
- package/.dist/script/config-command/bootstrap.js.map +1 -0
- package/.dist/script/config-command/deploy-spa.d.ts +3 -0
- package/.dist/script/config-command/deploy-spa.d.ts.map +1 -0
- package/.dist/script/config-command/deploy-spa.js +82 -0
- package/.dist/script/config-command/deploy-spa.js.map +1 -0
- package/.dist/script/config-command/deploy.d.ts +3 -0
- package/.dist/script/config-command/deploy.js +26 -0
- package/.dist/script/config-command/deploy.js.map +1 -0
- package/.dist/script/config-command/destroy.d.ts +3 -0
- package/.dist/script/config-command/destroy.js +26 -0
- package/.dist/script/config-command/destroy.js.map +1 -0
- package/.dist/script/config-command/env-ssr.d.ts +3 -0
- package/.dist/script/config-command/env-ssr.js +49 -0
- package/.dist/script/config-command/env-ssr.js.map +1 -0
- package/.dist/script/config-command/invalidation-ssr.d.ts +3 -0
- package/.dist/script/config-command/invalidation-ssr.js +53 -0
- package/.dist/script/config-command/invalidation-ssr.js.map +1 -0
- package/.dist/script/config-command/rds-migration.d.ts +5 -0
- package/.dist/script/config-command/rds-migration.js.map +1 -0
- package/.dist/script/config-command/rds-sync.d.ts +3 -0
- package/.dist/script/config-command/rds-sync.js.map +1 -0
- package/.dist/script/config-command/ssm-connect.d.ts +3 -0
- package/.dist/script/config-command/ssm-connect.js.map +1 -0
- package/.dist/script/config-command/start-spa.d.ts +3 -0
- package/.dist/script/config-command/start-spa.js +53 -0
- package/.dist/script/config-command/start-spa.js.map +1 -0
- package/.dist/script/config-command/start-ssr.d.ts +3 -0
- package/.dist/script/config-command/start-ssr.js +53 -0
- package/.dist/script/config-command/start-ssr.js.map +1 -0
- package/.dist/script/config-command/synth.d.ts +3 -0
- package/.dist/script/config-command/synth.js +26 -0
- package/.dist/script/config-command/synth.js.map +1 -0
- package/.dist/script/index.d.ts +7 -0
- package/.dist/script/index.d.ts.map +1 -0
- package/.dist/script/output-command/create-user.d.ts +9 -0
- package/.dist/script/output-command/create-user.d.ts.map +1 -0
- package/.dist/script/output-command/create-user.js.map +1 -0
- package/.dist/script/output-command/gen-postman-env.d.ts +9 -0
- package/.dist/script/output-command/gen-postman-env.d.ts.map +1 -0
- package/.dist/script/output-command/gen-postman-env.js +55 -0
- package/.dist/script/output-command/gen-postman-env.js.map +1 -0
- package/.dist/tsconfig.tsbuildinfo +1 -0
- package/.prettierignore +10 -0
- package/.prettierrc.json +12 -0
- package/.turbo/turbo-build.log +5 -0
- package/.turbo/turbo-release.log +7 -0
- package/CHANGELOG.md +8 -0
- package/common/coordinator.ts +103 -0
- package/common/index.ts +5 -0
- package/common/modifier.ts +11 -0
- package/common/naming/get-deploy-config.ts +5 -0
- package/common/naming/get-domain.ts +14 -0
- package/common/naming/get-function-entry.ts +11 -0
- package/common/naming/get-logical-name.ts +3 -0
- package/common/naming/get-resource-name.ts +77 -0
- package/common/naming/get-service-name.ts +13 -0
- package/common/naming/index.ts +7 -0
- package/common/naming/string-parser.ts +17 -0
- package/common/service.ts +48 -0
- package/common/synth/account-mapping.ts +16 -0
- package/common/synth/assume-role.ts +39 -0
- package/common/synth/get-global-props.ts +46 -0
- package/common/synth/get-service-props.ts +16 -0
- package/common/synth/index.ts +7 -0
- package/common/synth/pre-script.ts +103 -0
- package/common/synth/props-types.ts +79 -0
- package/common/synth/synth-error.ts +13 -0
- package/index.ts +3 -0
- package/package.json +4 -5
- package/prefab/analytics/events/handlers/ingestion-transform/handler.ts +35 -0
- package/prefab/analytics/events/index.ts +192 -0
- package/prefab/analytics/index.ts +1 -0
- package/prefab/auth/cognito-pool/index.ts +263 -0
- package/prefab/auth/index.ts +1 -0
- package/prefab/cdn/cdn-api/index.ts +169 -0
- package/prefab/cdn/cdn-asset/index.ts +89 -0
- package/prefab/cdn/cdn-spa/index.ts +136 -0
- package/prefab/cdn/cdn-ssr/index.ts +288 -0
- package/prefab/cdn/index.ts +4 -0
- package/prefab/compute/fargate/cluster.ts +24 -0
- package/prefab/compute/fargate/index.ts +2 -0
- package/prefab/compute/fargate/service.ts +130 -0
- package/prefab/compute/function/api-function/api-aggregate.ts +73 -0
- package/prefab/compute/function/api-function/api-function.ts +63 -0
- package/prefab/compute/function/api-function/index.ts +2 -0
- package/prefab/compute/function/base-function/index.ts +102 -0
- package/prefab/compute/function/cognito-function/cognito-aggregate.ts +29 -0
- package/prefab/compute/function/cognito-function/cognito-function.ts +36 -0
- package/prefab/compute/function/cognito-function/index.ts +2 -0
- package/prefab/compute/function/cron-function/cron-aggregate.ts +28 -0
- package/prefab/compute/function/cron-function/cron-function.ts +32 -0
- package/prefab/compute/function/cron-function/index.ts +2 -0
- package/prefab/compute/function/event-function/EventAggregateParams.ts +9 -0
- package/prefab/compute/function/event-function/event-aggregate.ts +33 -0
- package/prefab/compute/function/event-function/event-function.ts +42 -0
- package/prefab/compute/function/event-function/index.ts +2 -0
- package/prefab/compute/function/index.ts +7 -0
- package/prefab/compute/function/queue-function/index.ts +67 -0
- package/prefab/compute/function/topic-function/index.ts +36 -0
- package/prefab/compute/index.ts +2 -0
- package/prefab/database/dynamo/index.ts +113 -0
- package/prefab/database/index.ts +3 -0
- package/prefab/database/rds/handlers/start-cluster/handler.ts +7 -0
- package/prefab/database/rds/handlers/stop-cluster/handler.ts +7 -0
- package/prefab/database/rds/index.ts +248 -0
- package/prefab/database/timestream/index.ts +2 -0
- package/prefab/database/timestream/timestream-database.ts +24 -0
- package/prefab/database/timestream/timestream-table.ts +76 -0
- package/prefab/gateway/alb-public/index.ts +124 -0
- package/prefab/gateway/api-gateway/api-http.ts +71 -0
- package/prefab/gateway/api-gateway/api-rest.ts +93 -0
- package/prefab/gateway/api-gateway/index.ts +2 -0
- package/prefab/gateway/app-sync/index.ts +117 -0
- package/prefab/gateway/app-sync/resolver-aggregate.ts +138 -0
- package/prefab/gateway/app-sync/types.ts +29 -0
- package/prefab/gateway/index.ts +3 -0
- package/prefab/index.ts +10 -0
- package/prefab/integration/event-bus/index.ts +52 -0
- package/prefab/integration/index.ts +3 -0
- package/prefab/integration/queue/index.ts +94 -0
- package/prefab/integration/topic/index.ts +57 -0
- package/prefab/networking/dns-domain-ref/index.ts +32 -0
- package/prefab/networking/dns-subdomain-certificate/index.ts +30 -0
- package/prefab/networking/dns-subdomain-hosted-zone/index.ts +30 -0
- package/prefab/networking/index.ts +5 -0
- package/prefab/networking/vpc/index.ts +39 -0
- package/prefab/networking/waf/index.ts +49 -0
- package/prefab/storage/bucket/asset-bucket.ts +24 -0
- package/prefab/storage/bucket/index.ts +2 -0
- package/prefab/storage/bucket/private-bucket.ts +74 -0
- package/prefab/storage/index.ts +1 -0
- package/prefab/utils/config/frontend-env-builder.ts +30 -0
- package/prefab/utils/config/index.ts +3 -0
- package/prefab/utils/config/parameter-secret.ts +52 -0
- package/prefab/utils/config/runtime-secret.ts +48 -0
- package/prefab/utils/deploy-pipeline/catalog/integrations/index.ts +1 -0
- package/prefab/utils/deploy-pipeline/catalog/integrations/slack.ts +23 -0
- package/prefab/utils/deploy-pipeline/entities/index.ts +23 -0
- package/prefab/utils/deploy-pipeline/handlers/send-to-slack/handler.ts +32 -0
- package/prefab/utils/deploy-pipeline/index.ts +172 -0
- package/prefab/utils/deploy-pipeline/platform/get-pipeline-detail.ts +31 -0
- package/prefab/utils/deploy-pipeline/platform/get-slack-payload.ts +38 -0
- package/prefab/utils/deploy-pipeline/platform/send-to-slack.ts +16 -0
- package/prefab/utils/duration.ts +1 -0
- package/prefab/utils/index.ts +4 -0
- package/prefab/utils/ses/index.ts +134 -0
- package/readme.md +78 -0
- package/script/config-command/bootstrap.ts +108 -0
- package/script/config-command/deploy-spa.ts +126 -0
- package/script/config-command/deploy.ts +50 -0
- package/script/config-command/destroy.ts +49 -0
- package/script/config-command/env-ssr.ts +85 -0
- package/script/config-command/invalidation-ssr.ts +88 -0
- package/script/config-command/rds-migration.ts +177 -0
- package/script/config-command/rds-sync.ts +108 -0
- package/script/config-command/ssm-connect.ts +129 -0
- package/script/config-command/start-spa.ts +93 -0
- package/script/config-command/start-ssr.ts +91 -0
- package/script/config-command/synth.ts +50 -0
- package/script/index.ts +86 -0
- package/script/output-command/create-user.ts +89 -0
- package/script/output-command/gen-postman-env.ts +75 -0
- package/tsconfig.json +26 -0
- package/common/coordinator.d.ts +0 -28
- package/common/index.d.ts +0 -6
- package/common/modifier.d.ts +0 -5
- package/common/naming/get-deploy-config.d.ts +0 -9
- package/common/naming/get-domain.d.ts +0 -9
- package/common/naming/get-function-entry.d.ts +0 -4
- package/common/naming/get-logical-name.d.ts +0 -2
- package/common/naming/get-resource-name.d.ts +0 -47
- package/common/naming/get-service-name.d.ts +0 -10
- package/common/naming/index.d.ts +0 -8
- package/common/naming/string-parser.d.ts +0 -4
- package/common/service.d.ts +0 -29
- package/common/synth/account-mapping.d.ts +0 -2
- package/common/synth/assume-role.d.ts +0 -18
- package/common/synth/get-global-props.d.ts +0 -16
- package/common/synth/get-service-props.d.ts +0 -11
- package/common/synth/index.d.ts +0 -8
- package/common/synth/pre-script.d.ts +0 -32
- package/common/synth/props-types.d.ts +0 -60
- package/common/synth/synth-error.d.ts +0 -8
- package/index.d.ts +0 -4
- package/prefab/analytics/events/handlers/ingestion-transform/handler.d.ts +0 -4
- package/prefab/analytics/events/index.d.ts +0 -31
- package/prefab/analytics/events/index.d.ts.map +0 -1
- package/prefab/analytics/events/index.js +0 -163
- package/prefab/analytics/events/index.js.map +0 -1
- package/prefab/analytics/index.d.ts +0 -2
- package/prefab/auth/cognito-pool/index.d.ts +0 -65
- package/prefab/auth/cognito-pool/index.d.ts.map +0 -1
- package/prefab/auth/cognito-pool/index.js.map +0 -1
- package/prefab/auth/index.d.ts +0 -2
- package/prefab/cdn/cdn-api/index.d.ts +0 -38
- package/prefab/cdn/cdn-api/index.d.ts.map +0 -1
- package/prefab/cdn/cdn-api/index.js +0 -153
- package/prefab/cdn/cdn-api/index.js.map +0 -1
- package/prefab/cdn/cdn-asset/index.d.ts +0 -27
- package/prefab/cdn/cdn-asset/index.d.ts.map +0 -1
- package/prefab/cdn/cdn-asset/index.js +0 -96
- package/prefab/cdn/cdn-asset/index.js.map +0 -1
- package/prefab/cdn/cdn-spa/index.d.ts +0 -27
- package/prefab/cdn/cdn-spa/index.d.ts.map +0 -1
- package/prefab/cdn/cdn-spa/index.js +0 -138
- package/prefab/cdn/cdn-spa/index.js.map +0 -1
- package/prefab/cdn/cdn-ssr/index.d.ts +0 -36
- package/prefab/cdn/cdn-ssr/index.d.ts.map +0 -1
- package/prefab/cdn/cdn-ssr/index.js +0 -271
- package/prefab/cdn/cdn-ssr/index.js.map +0 -1
- package/prefab/cdn/index.d.ts +0 -5
- package/prefab/compute/fargate/cluster.d.ts +0 -16
- package/prefab/compute/fargate/cluster.d.ts.map +0 -1
- package/prefab/compute/fargate/cluster.js.map +0 -1
- package/prefab/compute/fargate/index.d.ts +0 -3
- package/prefab/compute/fargate/service.d.ts +0 -49
- package/prefab/compute/fargate/service.d.ts.map +0 -1
- package/prefab/compute/fargate/service.js.map +0 -1
- package/prefab/compute/function/api-function/api-aggregate.d.ts +0 -32
- package/prefab/compute/function/api-function/api-aggregate.d.ts.map +0 -1
- package/prefab/compute/function/api-function/api-aggregate.js +0 -54
- package/prefab/compute/function/api-function/api-aggregate.js.map +0 -1
- package/prefab/compute/function/api-function/api-function.d.ts +0 -22
- package/prefab/compute/function/api-function/api-function.d.ts.map +0 -1
- package/prefab/compute/function/api-function/api-function.js +0 -45
- package/prefab/compute/function/api-function/api-function.js.map +0 -1
- package/prefab/compute/function/api-function/index.d.ts +0 -3
- package/prefab/compute/function/base-function/index.d.ts +0 -33
- package/prefab/compute/function/base-function/index.d.ts.map +0 -1
- package/prefab/compute/function/base-function/index.js +0 -70
- package/prefab/compute/function/base-function/index.js.map +0 -1
- package/prefab/compute/function/cognito-function/cognito-aggregate.d.ts +0 -18
- package/prefab/compute/function/cognito-function/cognito-aggregate.d.ts.map +0 -1
- package/prefab/compute/function/cognito-function/cognito-aggregate.js.map +0 -1
- package/prefab/compute/function/cognito-function/cognito-function.d.ts +0 -19
- package/prefab/compute/function/cognito-function/cognito-function.d.ts.map +0 -1
- package/prefab/compute/function/cognito-function/cognito-function.js.map +0 -1
- package/prefab/compute/function/cognito-function/index.d.ts +0 -3
- package/prefab/compute/function/cron-function/cron-aggregate.d.ts +0 -17
- package/prefab/compute/function/cron-function/cron-aggregate.d.ts.map +0 -1
- package/prefab/compute/function/cron-function/cron-aggregate.js.map +0 -1
- package/prefab/compute/function/cron-function/cron-function.d.ts +0 -17
- package/prefab/compute/function/cron-function/cron-function.d.ts.map +0 -1
- package/prefab/compute/function/cron-function/cron-function.js +0 -24
- package/prefab/compute/function/cron-function/cron-function.js.map +0 -1
- package/prefab/compute/function/cron-function/index.d.ts +0 -3
- package/prefab/compute/function/event-function/event-aggregate.d.ts +0 -20
- package/prefab/compute/function/event-function/event-aggregate.d.ts.map +0 -1
- package/prefab/compute/function/event-function/event-aggregate.js.map +0 -1
- package/prefab/compute/function/event-function/event-function.d.ts +0 -14
- package/prefab/compute/function/event-function/event-function.d.ts.map +0 -1
- package/prefab/compute/function/event-function/event-function.js.map +0 -1
- package/prefab/compute/function/event-function/index.d.ts +0 -3
- package/prefab/compute/function/index.d.ts +0 -8
- package/prefab/compute/function/queue-function/index.d.ts +0 -25
- package/prefab/compute/function/queue-function/index.d.ts.map +0 -1
- package/prefab/compute/function/queue-function/index.js +0 -46
- package/prefab/compute/function/queue-function/index.js.map +0 -1
- package/prefab/compute/function/topic-function/index.d.ts +0 -23
- package/prefab/compute/function/topic-function/index.d.ts.map +0 -1
- package/prefab/compute/function/topic-function/index.js +0 -23
- package/prefab/compute/function/topic-function/index.js.map +0 -1
- package/prefab/compute/index.d.ts +0 -3
- package/prefab/database/dynamo/index.d.ts +0 -14
- package/prefab/database/dynamo/index.d.ts.map +0 -1
- package/prefab/database/dynamo/index.js.map +0 -1
- package/prefab/database/index.d.ts +0 -4
- package/prefab/database/rds/handlers/start-cluster/handler.d.ts +0 -2
- package/prefab/database/rds/handlers/stop-cluster/handler.d.ts +0 -2
- package/prefab/database/rds/index.d.ts +0 -54
- package/prefab/database/rds/index.d.ts.map +0 -1
- package/prefab/database/rds/index.js +0 -223
- package/prefab/database/rds/index.js.map +0 -1
- package/prefab/database/timestream/index.d.ts +0 -3
- package/prefab/database/timestream/timestream-database.d.ts +0 -13
- package/prefab/database/timestream/timestream-database.d.ts.map +0 -1
- package/prefab/database/timestream/timestream-database.js.map +0 -1
- package/prefab/database/timestream/timestream-table.d.ts +0 -23
- package/prefab/database/timestream/timestream-table.d.ts.map +0 -1
- package/prefab/database/timestream/timestream-table.js.map +0 -1
- package/prefab/gateway/alb-public/index.d.ts +0 -44
- package/prefab/gateway/alb-public/index.d.ts.map +0 -1
- package/prefab/gateway/alb-public/index.js.map +0 -1
- package/prefab/gateway/api-gateway/api-http.d.ts +0 -27
- package/prefab/gateway/api-gateway/api-http.d.ts.map +0 -1
- package/prefab/gateway/api-gateway/api-http.js.map +0 -1
- package/prefab/gateway/api-gateway/api-rest.d.ts +0 -26
- package/prefab/gateway/api-gateway/api-rest.d.ts.map +0 -1
- package/prefab/gateway/api-gateway/api-rest.js.map +0 -1
- package/prefab/gateway/api-gateway/index.d.ts +0 -3
- package/prefab/gateway/app-sync/index.d.ts +0 -36
- package/prefab/gateway/app-sync/index.d.ts.map +0 -1
- package/prefab/gateway/app-sync/index.js.map +0 -1
- package/prefab/gateway/app-sync/resolver-aggregate.d.ts +0 -33
- package/prefab/gateway/app-sync/resolver-aggregate.d.ts.map +0 -1
- package/prefab/gateway/app-sync/resolver-aggregate.js.map +0 -1
- package/prefab/gateway/app-sync/types.d.ts +0 -29
- package/prefab/gateway/app-sync/types.d.ts.map +0 -1
- package/prefab/gateway/index.d.ts +0 -4
- package/prefab/index.d.ts +0 -11
- package/prefab/integration/event-bus/index.d.ts +0 -20
- package/prefab/integration/event-bus/index.d.ts.map +0 -1
- package/prefab/integration/event-bus/index.js.map +0 -1
- package/prefab/integration/index.d.ts +0 -4
- package/prefab/integration/queue/index.d.ts +0 -29
- package/prefab/integration/queue/index.d.ts.map +0 -1
- package/prefab/integration/queue/index.js.map +0 -1
- package/prefab/integration/topic/index.d.ts +0 -21
- package/prefab/integration/topic/index.d.ts.map +0 -1
- package/prefab/integration/topic/index.js.map +0 -1
- package/prefab/networking/dns-domain-ref/index.d.ts +0 -16
- package/prefab/networking/dns-domain-ref/index.d.ts.map +0 -1
- package/prefab/networking/dns-domain-ref/index.js.map +0 -1
- package/prefab/networking/dns-subdomain-certificate/index.d.ts +0 -13
- package/prefab/networking/dns-subdomain-certificate/index.d.ts.map +0 -1
- package/prefab/networking/dns-subdomain-certificate/index.js.map +0 -1
- package/prefab/networking/dns-subdomain-hosted-zone/index.d.ts +0 -12
- package/prefab/networking/dns-subdomain-hosted-zone/index.d.ts.map +0 -1
- package/prefab/networking/dns-subdomain-hosted-zone/index.js.map +0 -1
- package/prefab/networking/index.d.ts +0 -6
- package/prefab/networking/vpc/index.d.ts +0 -20
- package/prefab/networking/vpc/index.d.ts.map +0 -1
- package/prefab/networking/vpc/index.js.map +0 -1
- package/prefab/networking/waf/index.d.ts +0 -14
- package/prefab/networking/waf/index.d.ts.map +0 -1
- package/prefab/networking/waf/index.js.map +0 -1
- package/prefab/storage/bucket/asset-bucket.d.ts +0 -12
- package/prefab/storage/bucket/asset-bucket.d.ts.map +0 -1
- package/prefab/storage/bucket/index.d.ts +0 -3
- package/prefab/storage/bucket/private-bucket.d.ts +0 -26
- package/prefab/storage/bucket/private-bucket.d.ts.map +0 -1
- package/prefab/storage/bucket/private-bucket.js.map +0 -1
- package/prefab/storage/index.d.ts +0 -2
- package/prefab/utils/config/frontend-env-builder.d.ts +0 -14
- package/prefab/utils/config/frontend-env-builder.d.ts.map +0 -1
- package/prefab/utils/config/frontend-env-builder.js.map +0 -1
- package/prefab/utils/config/index.d.ts +0 -4
- package/prefab/utils/config/parameter-secret.d.ts +0 -21
- package/prefab/utils/config/parameter-secret.d.ts.map +0 -1
- package/prefab/utils/config/parameter-secret.js.map +0 -1
- package/prefab/utils/config/runtime-secret.d.ts.map +0 -1
- package/prefab/utils/config/runtime-secret.js.map +0 -1
- package/prefab/utils/deploy-pipeline/catalog/integrations/index.d.ts +0 -2
- package/prefab/utils/deploy-pipeline/entities/index.d.ts +0 -29
- package/prefab/utils/deploy-pipeline/index.d.ts +0 -15
- package/prefab/utils/deploy-pipeline/index.d.ts.map +0 -1
- package/prefab/utils/deploy-pipeline/index.js.map +0 -1
- package/prefab/utils/deploy-pipeline/platform/get-pipeline-detail.d.ts +0 -6
- package/prefab/utils/deploy-pipeline/platform/get-slack-payload.d.ts +0 -4
- package/prefab/utils/duration.d.ts +0 -2
- package/prefab/utils/index.d.ts +0 -5
- package/prefab/utils/ses/index.d.ts +0 -22
- package/prefab/utils/ses/index.d.ts.map +0 -1
- package/prefab/utils/ses/index.js.map +0 -1
- package/script/config-command/bootstrap.d.ts +0 -4
- package/script/config-command/bootstrap.js +0 -66
- package/script/config-command/bootstrap.js.map +0 -1
- package/script/config-command/deploy-spa.d.ts +0 -4
- package/script/config-command/deploy-spa.d.ts.map +0 -1
- package/script/config-command/deploy-spa.js +0 -84
- package/script/config-command/deploy-spa.js.map +0 -1
- package/script/config-command/deploy.d.ts +0 -4
- package/script/config-command/deploy.js +0 -26
- package/script/config-command/deploy.js.map +0 -1
- package/script/config-command/destroy.d.ts +0 -4
- package/script/config-command/destroy.js +0 -26
- package/script/config-command/destroy.js.map +0 -1
- package/script/config-command/env-ssr.d.ts +0 -4
- package/script/config-command/env-ssr.js +0 -51
- package/script/config-command/env-ssr.js.map +0 -1
- package/script/config-command/invalidation-ssr.d.ts +0 -4
- package/script/config-command/invalidation-ssr.js +0 -55
- package/script/config-command/invalidation-ssr.js.map +0 -1
- package/script/config-command/rds-migration.d.ts +0 -7
- package/script/config-command/rds-migration.js.map +0 -1
- package/script/config-command/rds-sync.d.ts +0 -4
- package/script/config-command/rds-sync.js.map +0 -1
- package/script/config-command/ssm-connect.d.ts +0 -4
- package/script/config-command/ssm-connect.js.map +0 -1
- package/script/config-command/start-spa.d.ts +0 -4
- package/script/config-command/start-spa.js +0 -55
- package/script/config-command/start-spa.js.map +0 -1
- package/script/config-command/start-ssr.d.ts +0 -4
- package/script/config-command/start-ssr.js +0 -55
- package/script/config-command/start-ssr.js.map +0 -1
- package/script/config-command/synth.d.ts +0 -4
- package/script/config-command/synth.js +0 -26
- package/script/config-command/synth.js.map +0 -1
- package/script/index.d.ts +0 -25
- package/script/index.d.ts.map +0 -1
- package/script/output-command/create-user.d.ts +0 -9
- package/script/output-command/create-user.d.ts.map +0 -1
- package/script/output-command/create-user.js.map +0 -1
- package/script/output-command/gen-postman-env.d.ts +0 -28
- package/script/output-command/gen-postman-env.d.ts.map +0 -1
- package/script/output-command/gen-postman-env.js +0 -56
- package/script/output-command/gen-postman-env.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
- /package/{common → .dist/common}/coordinator.d.ts.map +0 -0
- /package/{common → .dist/common}/coordinator.js +0 -0
- /package/{common → .dist/common}/coordinator.js.map +0 -0
- /package/{common → .dist/common}/index.d.ts.map +0 -0
- /package/{common → .dist/common}/index.js +0 -0
- /package/{common → .dist/common}/index.js.map +0 -0
- /package/{common → .dist/common}/modifier.d.ts.map +0 -0
- /package/{common → .dist/common}/modifier.js +0 -0
- /package/{common → .dist/common}/modifier.js.map +0 -0
- /package/{common → .dist/common}/naming/get-deploy-config.d.ts.map +0 -0
- /package/{common → .dist/common}/naming/get-deploy-config.js +0 -0
- /package/{common → .dist/common}/naming/get-deploy-config.js.map +0 -0
- /package/{common → .dist/common}/naming/get-domain.d.ts.map +0 -0
- /package/{common → .dist/common}/naming/get-domain.js +0 -0
- /package/{common → .dist/common}/naming/get-domain.js.map +0 -0
- /package/{common → .dist/common}/naming/get-function-entry.d.ts.map +0 -0
- /package/{common → .dist/common}/naming/get-function-entry.js +0 -0
- /package/{common → .dist/common}/naming/get-function-entry.js.map +0 -0
- /package/{common → .dist/common}/naming/get-logical-name.d.ts.map +0 -0
- /package/{common → .dist/common}/naming/get-logical-name.js +0 -0
- /package/{common → .dist/common}/naming/get-logical-name.js.map +0 -0
- /package/{common → .dist/common}/naming/get-resource-name.d.ts.map +0 -0
- /package/{common → .dist/common}/naming/get-resource-name.js +0 -0
- /package/{common → .dist/common}/naming/get-resource-name.js.map +0 -0
- /package/{common → .dist/common}/naming/get-service-name.d.ts.map +0 -0
- /package/{common → .dist/common}/naming/get-service-name.js +0 -0
- /package/{common → .dist/common}/naming/get-service-name.js.map +0 -0
- /package/{common → .dist/common}/naming/index.d.ts.map +0 -0
- /package/{common → .dist/common}/naming/index.js +0 -0
- /package/{common → .dist/common}/naming/index.js.map +0 -0
- /package/{common → .dist/common}/naming/string-parser.d.ts.map +0 -0
- /package/{common → .dist/common}/naming/string-parser.js +0 -0
- /package/{common → .dist/common}/naming/string-parser.js.map +0 -0
- /package/{common → .dist/common}/service.d.ts.map +0 -0
- /package/{common → .dist/common}/service.js +0 -0
- /package/{common → .dist/common}/service.js.map +0 -0
- /package/{common → .dist/common}/synth/account-mapping.d.ts.map +0 -0
- /package/{common → .dist/common}/synth/account-mapping.js +0 -0
- /package/{common → .dist/common}/synth/account-mapping.js.map +0 -0
- /package/{common → .dist/common}/synth/assume-role.d.ts.map +0 -0
- /package/{common → .dist/common}/synth/assume-role.js +0 -0
- /package/{common → .dist/common}/synth/assume-role.js.map +0 -0
- /package/{common → .dist/common}/synth/get-global-props.d.ts.map +0 -0
- /package/{common → .dist/common}/synth/get-global-props.js +0 -0
- /package/{common → .dist/common}/synth/get-global-props.js.map +0 -0
- /package/{common → .dist/common}/synth/get-service-props.d.ts.map +0 -0
- /package/{common → .dist/common}/synth/get-service-props.js +0 -0
- /package/{common → .dist/common}/synth/get-service-props.js.map +0 -0
- /package/{common → .dist/common}/synth/index.d.ts.map +0 -0
- /package/{common → .dist/common}/synth/index.js +0 -0
- /package/{common → .dist/common}/synth/index.js.map +0 -0
- /package/{common → .dist/common}/synth/pre-script.d.ts.map +0 -0
- /package/{common → .dist/common}/synth/pre-script.js +0 -0
- /package/{common → .dist/common}/synth/pre-script.js.map +0 -0
- /package/{common → .dist/common}/synth/props-types.d.ts.map +0 -0
- /package/{common → .dist/common}/synth/props-types.js +0 -0
- /package/{common → .dist/common}/synth/props-types.js.map +0 -0
- /package/{common → .dist/common}/synth/synth-error.d.ts.map +0 -0
- /package/{common → .dist/common}/synth/synth-error.js +0 -0
- /package/{common → .dist/common}/synth/synth-error.js.map +0 -0
- /package/{index.d.ts.map → .dist/index.d.ts.map} +0 -0
- /package/{index.js → .dist/index.js} +0 -0
- /package/{index.js.map → .dist/index.js.map} +0 -0
- /package/{prefab → .dist/prefab}/analytics/events/handlers/ingestion-transform/handler.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/analytics/events/handlers/ingestion-transform/handler.js +0 -0
- /package/{prefab → .dist/prefab}/analytics/events/handlers/ingestion-transform/handler.js.map +0 -0
- /package/{prefab → .dist/prefab}/analytics/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/analytics/index.js +0 -0
- /package/{prefab → .dist/prefab}/analytics/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/auth/cognito-pool/index.js +0 -0
- /package/{prefab → .dist/prefab}/auth/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/auth/index.js +0 -0
- /package/{prefab → .dist/prefab}/auth/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/cdn/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/cdn/index.js +0 -0
- /package/{prefab → .dist/prefab}/cdn/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/compute/fargate/cluster.js +0 -0
- /package/{prefab → .dist/prefab}/compute/fargate/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/compute/fargate/index.js +0 -0
- /package/{prefab → .dist/prefab}/compute/fargate/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/compute/fargate/service.js +0 -0
- /package/{prefab → .dist/prefab}/compute/function/api-function/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/compute/function/api-function/index.js +0 -0
- /package/{prefab → .dist/prefab}/compute/function/api-function/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/compute/function/cognito-function/cognito-aggregate.js +0 -0
- /package/{prefab → .dist/prefab}/compute/function/cognito-function/cognito-function.js +0 -0
- /package/{prefab → .dist/prefab}/compute/function/cognito-function/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/compute/function/cognito-function/index.js +0 -0
- /package/{prefab → .dist/prefab}/compute/function/cognito-function/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/compute/function/cron-function/cron-aggregate.js +0 -0
- /package/{prefab → .dist/prefab}/compute/function/cron-function/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/compute/function/cron-function/index.js +0 -0
- /package/{prefab → .dist/prefab}/compute/function/cron-function/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/compute/function/event-function/event-aggregate.js +0 -0
- /package/{prefab → .dist/prefab}/compute/function/event-function/event-function.js +0 -0
- /package/{prefab → .dist/prefab}/compute/function/event-function/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/compute/function/event-function/index.js +0 -0
- /package/{prefab → .dist/prefab}/compute/function/event-function/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/compute/function/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/compute/function/index.js +0 -0
- /package/{prefab → .dist/prefab}/compute/function/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/compute/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/compute/index.js +0 -0
- /package/{prefab → .dist/prefab}/compute/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/database/dynamo/index.js +0 -0
- /package/{prefab → .dist/prefab}/database/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/database/index.js +0 -0
- /package/{prefab → .dist/prefab}/database/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/database/rds/handlers/start-cluster/handler.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/database/rds/handlers/start-cluster/handler.js +0 -0
- /package/{prefab → .dist/prefab}/database/rds/handlers/start-cluster/handler.js.map +0 -0
- /package/{prefab → .dist/prefab}/database/rds/handlers/stop-cluster/handler.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/database/rds/handlers/stop-cluster/handler.js +0 -0
- /package/{prefab → .dist/prefab}/database/rds/handlers/stop-cluster/handler.js.map +0 -0
- /package/{prefab → .dist/prefab}/database/timestream/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/database/timestream/index.js +0 -0
- /package/{prefab → .dist/prefab}/database/timestream/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/database/timestream/timestream-database.js +0 -0
- /package/{prefab → .dist/prefab}/database/timestream/timestream-table.js +0 -0
- /package/{prefab → .dist/prefab}/gateway/alb-public/index.js +0 -0
- /package/{prefab → .dist/prefab}/gateway/api-gateway/api-http.js +0 -0
- /package/{prefab → .dist/prefab}/gateway/api-gateway/api-rest.js +0 -0
- /package/{prefab → .dist/prefab}/gateway/api-gateway/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/gateway/api-gateway/index.js +0 -0
- /package/{prefab → .dist/prefab}/gateway/api-gateway/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/gateway/app-sync/index.js +0 -0
- /package/{prefab → .dist/prefab}/gateway/app-sync/resolver-aggregate.js +0 -0
- /package/{prefab → .dist/prefab}/gateway/app-sync/types.js +0 -0
- /package/{prefab → .dist/prefab}/gateway/app-sync/types.js.map +0 -0
- /package/{prefab → .dist/prefab}/gateway/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/gateway/index.js +0 -0
- /package/{prefab → .dist/prefab}/gateway/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/index.js +0 -0
- /package/{prefab → .dist/prefab}/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/integration/event-bus/index.js +0 -0
- /package/{prefab → .dist/prefab}/integration/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/integration/index.js +0 -0
- /package/{prefab → .dist/prefab}/integration/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/integration/queue/index.js +0 -0
- /package/{prefab → .dist/prefab}/integration/topic/index.js +0 -0
- /package/{prefab → .dist/prefab}/networking/dns-domain-ref/index.js +0 -0
- /package/{prefab → .dist/prefab}/networking/dns-subdomain-certificate/index.js +0 -0
- /package/{prefab → .dist/prefab}/networking/dns-subdomain-hosted-zone/index.js +0 -0
- /package/{prefab → .dist/prefab}/networking/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/networking/index.js +0 -0
- /package/{prefab → .dist/prefab}/networking/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/networking/vpc/index.js +0 -0
- /package/{prefab → .dist/prefab}/networking/waf/index.js +0 -0
- /package/{prefab → .dist/prefab}/storage/bucket/asset-bucket.js +0 -0
- /package/{prefab → .dist/prefab}/storage/bucket/asset-bucket.js.map +0 -0
- /package/{prefab → .dist/prefab}/storage/bucket/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/storage/bucket/index.js +0 -0
- /package/{prefab → .dist/prefab}/storage/bucket/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/storage/bucket/private-bucket.js +0 -0
- /package/{prefab → .dist/prefab}/storage/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/storage/index.js +0 -0
- /package/{prefab → .dist/prefab}/storage/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/utils/config/frontend-env-builder.js +0 -0
- /package/{prefab → .dist/prefab}/utils/config/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/utils/config/index.js +0 -0
- /package/{prefab → .dist/prefab}/utils/config/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/utils/config/parameter-secret.js +0 -0
- /package/{prefab → .dist/prefab}/utils/config/runtime-secret.d.ts +0 -0
- /package/{prefab → .dist/prefab}/utils/config/runtime-secret.js +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/catalog/integrations/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/catalog/integrations/index.js +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/catalog/integrations/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/catalog/integrations/slack.d.ts +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/catalog/integrations/slack.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/catalog/integrations/slack.js +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/catalog/integrations/slack.js.map +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/entities/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/entities/index.js +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/entities/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/handlers/send-to-slack/handler.d.ts +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/handlers/send-to-slack/handler.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/handlers/send-to-slack/handler.js +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/handlers/send-to-slack/handler.js.map +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/index.js +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/platform/get-pipeline-detail.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/platform/get-pipeline-detail.js +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/platform/get-pipeline-detail.js.map +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/platform/get-slack-payload.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/platform/get-slack-payload.js +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/platform/get-slack-payload.js.map +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/platform/send-to-slack.d.ts +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/platform/send-to-slack.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/platform/send-to-slack.js +0 -0
- /package/{prefab → .dist/prefab}/utils/deploy-pipeline/platform/send-to-slack.js.map +0 -0
- /package/{prefab → .dist/prefab}/utils/duration.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/utils/duration.js +0 -0
- /package/{prefab → .dist/prefab}/utils/duration.js.map +0 -0
- /package/{prefab → .dist/prefab}/utils/index.d.ts.map +0 -0
- /package/{prefab → .dist/prefab}/utils/index.js +0 -0
- /package/{prefab → .dist/prefab}/utils/index.js.map +0 -0
- /package/{prefab → .dist/prefab}/utils/ses/index.js +0 -0
- /package/{script → .dist/script}/config-command/bootstrap.d.ts.map +0 -0
- /package/{script → .dist/script}/config-command/deploy.d.ts.map +0 -0
- /package/{script → .dist/script}/config-command/destroy.d.ts.map +0 -0
- /package/{script → .dist/script}/config-command/env-ssr.d.ts.map +0 -0
- /package/{script → .dist/script}/config-command/invalidation-ssr.d.ts.map +0 -0
- /package/{script → .dist/script}/config-command/rds-migration.d.ts.map +0 -0
- /package/{script → .dist/script}/config-command/rds-migration.js +0 -0
- /package/{script → .dist/script}/config-command/rds-sync.d.ts.map +0 -0
- /package/{script → .dist/script}/config-command/rds-sync.js +0 -0
- /package/{script → .dist/script}/config-command/ssm-connect.d.ts.map +0 -0
- /package/{script → .dist/script}/config-command/ssm-connect.js +0 -0
- /package/{script → .dist/script}/config-command/start-spa.d.ts.map +0 -0
- /package/{script → .dist/script}/config-command/start-ssr.d.ts.map +0 -0
- /package/{script → .dist/script}/config-command/synth.d.ts.map +0 -0
- /package/{script → .dist/script}/index.js +0 -0
- /package/{script → .dist/script}/index.js.map +0 -0
- /package/{script → .dist/script}/output-command/create-user.js +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import * as awsCloudfront from 'aws-cdk-lib/aws-cloudfront';
|
|
2
|
+
import { CfnOutput, Fn } from 'aws-cdk-lib';
|
|
3
|
+
import { ICertificate } from 'aws-cdk-lib/aws-certificatemanager';
|
|
4
|
+
import { HttpOrigin, HttpOriginProps, LoadBalancerV2Origin, RestApiOrigin } from 'aws-cdk-lib/aws-cloudfront-origins';
|
|
5
|
+
import { ApplicationLoadBalancer } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
|
|
6
|
+
import { ARecord, HostedZone, RecordTarget } from 'aws-cdk-lib/aws-route53';
|
|
7
|
+
import { CloudFrontTarget } from 'aws-cdk-lib/aws-route53-targets';
|
|
8
|
+
import { Construct } from 'constructs';
|
|
9
|
+
|
|
10
|
+
import { ServiceStack, SynthError, getCloudFrontName, getDomain, getLogicalName, getResourceName } from '../../../common';
|
|
11
|
+
import { PublicAlbPrefab, ApiRestPrefab } from '../../gateway';
|
|
12
|
+
import { WafPrefab } from '../../networking';
|
|
13
|
+
import { PrivateBucketPrefab } from '../../storage';
|
|
14
|
+
|
|
15
|
+
export type CdnApiPrefabParams = {
|
|
16
|
+
subDomain: string;
|
|
17
|
+
certificate: ICertificate;
|
|
18
|
+
albDefaultBehavior?: PublicAlbPrefab;
|
|
19
|
+
restApiDefaultBehavior?: ApiRestPrefab;
|
|
20
|
+
headersWhitelist?: string[];
|
|
21
|
+
waf?: WafPrefab;
|
|
22
|
+
skipRecord?: true;
|
|
23
|
+
explicitDomains?: string[];
|
|
24
|
+
cachePolicyProps?: Omit<awsCloudfront.CachePolicyProps, 'cachePolicyName' | 'headerBehavior' | 'queryStringBehavior'>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export class CdnApiPrefab extends Construct {
|
|
28
|
+
public readonly domain: string;
|
|
29
|
+
public readonly baseUrl: string;
|
|
30
|
+
private readonly service: ServiceStack;
|
|
31
|
+
private readonly distribution: awsCloudfront.Distribution;
|
|
32
|
+
private readonly apiGatewayRequestPolicy: awsCloudfront.OriginRequestPolicy;
|
|
33
|
+
private readonly apiGatewayCachePolicy: awsCloudfront.CachePolicy;
|
|
34
|
+
private readonly apiGatewayBehaviorOptions: Omit<awsCloudfront.BehaviorOptions, 'origin'>;
|
|
35
|
+
private readonly unrestrictedBehaviorOptions: Omit<awsCloudfront.BehaviorOptions, 'origin'>;
|
|
36
|
+
|
|
37
|
+
constructor(service: ServiceStack, params: CdnApiPrefabParams) {
|
|
38
|
+
super(service, getLogicalName(CdnApiPrefab.name, params.subDomain));
|
|
39
|
+
|
|
40
|
+
this.service = service;
|
|
41
|
+
this.domain = getDomain(params.subDomain, service.props);
|
|
42
|
+
this.baseUrl = `https://${this.domain}/`;
|
|
43
|
+
|
|
44
|
+
if (params.albDefaultBehavior && params.restApiDefaultBehavior) throw new SynthError('Only alb or api can be default behavior', service.props);
|
|
45
|
+
|
|
46
|
+
// Api Gateway Policies
|
|
47
|
+
this.apiGatewayCachePolicy = new awsCloudfront.CachePolicy(this, 'CachePolicy', {
|
|
48
|
+
cachePolicyName: getCloudFrontName('ApiGateway', 'CachePolicy', this.service.props),
|
|
49
|
+
queryStringBehavior: awsCloudfront.CacheQueryStringBehavior.all(),
|
|
50
|
+
headerBehavior: {
|
|
51
|
+
behavior: 'whitelist',
|
|
52
|
+
headers: [...(params.headersWhitelist || []), 'Authorization'],
|
|
53
|
+
},
|
|
54
|
+
...params.cachePolicyProps,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
this.apiGatewayRequestPolicy = new awsCloudfront.OriginRequestPolicy(this, 'OriginRequestPolicy', {
|
|
58
|
+
originRequestPolicyName: getCloudFrontName('ApiGateway', 'RequestPolicy', this.service.props),
|
|
59
|
+
headerBehavior: {
|
|
60
|
+
behavior: 'whitelist',
|
|
61
|
+
headers: [
|
|
62
|
+
...(params.headersWhitelist || []),
|
|
63
|
+
'Access-Control-Allow-Origin',
|
|
64
|
+
'Access-Control-Request-Method',
|
|
65
|
+
'Access-Control-Allow-Headers',
|
|
66
|
+
'Access-Control-Request-Headers',
|
|
67
|
+
'Origin',
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
queryStringBehavior: awsCloudfront.OriginRequestQueryStringBehavior.all(),
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
this.apiGatewayBehaviorOptions = {
|
|
74
|
+
compress: true,
|
|
75
|
+
cachePolicy: this.apiGatewayCachePolicy,
|
|
76
|
+
originRequestPolicy: this.apiGatewayRequestPolicy,
|
|
77
|
+
allowedMethods: awsCloudfront.AllowedMethods.ALLOW_ALL,
|
|
78
|
+
viewerProtocolPolicy: awsCloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// Integrations Policies
|
|
82
|
+
this.unrestrictedBehaviorOptions = {
|
|
83
|
+
compress: true,
|
|
84
|
+
cachePolicy: awsCloudfront.CachePolicy.CACHING_DISABLED,
|
|
85
|
+
originRequestPolicy: awsCloudfront.OriginRequestPolicy.ALL_VIEWER,
|
|
86
|
+
allowedMethods: awsCloudfront.AllowedMethods.ALLOW_ALL,
|
|
87
|
+
viewerProtocolPolicy: awsCloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// Default Behavior
|
|
91
|
+
let defaultBehavior: awsCloudfront.BehaviorOptions = {
|
|
92
|
+
origin: new HttpOrigin(new PrivateBucketPrefab(service, { bucketName: 'default-origin' }).bucket.bucketDomainName, {
|
|
93
|
+
originId: getCloudFrontName('Origin', 'Default', this.service.props),
|
|
94
|
+
}),
|
|
95
|
+
...this.apiGatewayBehaviorOptions,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
if (params.albDefaultBehavior) {
|
|
99
|
+
defaultBehavior = {
|
|
100
|
+
origin: new LoadBalancerV2Origin(params.albDefaultBehavior.alb, {
|
|
101
|
+
originId: getCloudFrontName('Origin', 'Default', this.service.props),
|
|
102
|
+
}),
|
|
103
|
+
...this.unrestrictedBehaviorOptions,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (params.restApiDefaultBehavior) {
|
|
108
|
+
defaultBehavior = {
|
|
109
|
+
origin: new RestApiOrigin(params.restApiDefaultBehavior.api, {
|
|
110
|
+
originId: getCloudFrontName('Origin', 'Default', this.service.props),
|
|
111
|
+
}),
|
|
112
|
+
...this.unrestrictedBehaviorOptions,
|
|
113
|
+
originRequestPolicy: awsCloudfront.OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Distribution
|
|
118
|
+
this.distribution = new awsCloudfront.Distribution(this, 'Distribution', {
|
|
119
|
+
enabled: true,
|
|
120
|
+
comment: getResourceName('cdn', service.props),
|
|
121
|
+
certificate: params.certificate,
|
|
122
|
+
domainNames: params.explicitDomains ?? [this.domain],
|
|
123
|
+
defaultBehavior,
|
|
124
|
+
...(service.props.envName !== 'prod' ? { priceClass: awsCloudfront.PriceClass.PRICE_CLASS_100 } : {}),
|
|
125
|
+
webAclId: params.waf?.webACL?.attrArn,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// Route53
|
|
129
|
+
if (!params.explicitDomains && !params.skipRecord) {
|
|
130
|
+
const hostedZone = HostedZone.fromLookup(this, 'HostedZoneEnvDns', { domainName: getDomain('', service.props) });
|
|
131
|
+
new ARecord(service, 'Record', {
|
|
132
|
+
zone: hostedZone,
|
|
133
|
+
target: RecordTarget.fromAlias(new CloudFrontTarget(this.distribution)),
|
|
134
|
+
recordName: this.domain,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
new CfnOutput(this, 'Domain', { value: params.explicitDomains ? params.explicitDomains[0]! : this.domain });
|
|
138
|
+
new CfnOutput(this, 'BaseUrl', {
|
|
139
|
+
value: params.explicitDomains ? `https://${params.explicitDomains[0]}/` : this.baseUrl,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
public addApiGateway(basePath: string, apiUrl: string, originOptions?: HttpOriginProps): void {
|
|
144
|
+
this.distribution.addBehavior(
|
|
145
|
+
`/${basePath}*`,
|
|
146
|
+
new HttpOrigin(apiUrl, { originId: getCloudFrontName('Origin', basePath, this.service.props), ...originOptions }),
|
|
147
|
+
this.apiGatewayBehaviorOptions
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
public addAppSync(apiUrl: string, originOptions?: HttpOriginProps): void {
|
|
152
|
+
this.distribution.addBehavior(
|
|
153
|
+
'/graphql*',
|
|
154
|
+
new HttpOrigin(Fn.select(2, Fn.split('/', apiUrl)), {
|
|
155
|
+
originId: getCloudFrontName('Origin', 'graphql', this.service.props),
|
|
156
|
+
...originOptions,
|
|
157
|
+
}),
|
|
158
|
+
this.apiGatewayBehaviorOptions
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
public addAlb(basePath: string, alb: ApplicationLoadBalancer): void {
|
|
163
|
+
this.distribution.addBehavior(
|
|
164
|
+
`/${basePath}/*`,
|
|
165
|
+
new LoadBalancerV2Origin(alb, { originId: getCloudFrontName('Origin', basePath, this.service.props) }),
|
|
166
|
+
this.unrestrictedBehaviorOptions
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as awsCloudfront from 'aws-cdk-lib/aws-cloudfront';
|
|
2
|
+
import { CfnOutput } from 'aws-cdk-lib';
|
|
3
|
+
import { ICertificate } from 'aws-cdk-lib/aws-certificatemanager';
|
|
4
|
+
import { S3Origin } from 'aws-cdk-lib/aws-cloudfront-origins';
|
|
5
|
+
import { ARecord, HostedZone, RecordTarget } from 'aws-cdk-lib/aws-route53';
|
|
6
|
+
import { CloudFrontTarget } from 'aws-cdk-lib/aws-route53-targets';
|
|
7
|
+
import { HttpMethods } from 'aws-cdk-lib/aws-s3';
|
|
8
|
+
import { Construct } from 'constructs';
|
|
9
|
+
|
|
10
|
+
import { ServiceStack, getCloudFrontName, getDomain, getLogicalName, getResourceName } from '../../../common';
|
|
11
|
+
import { WafPrefab } from '../../networking';
|
|
12
|
+
import { AssetBucketParams, AssetBucketPrefab } from '../../storage';
|
|
13
|
+
|
|
14
|
+
export type CdnAssetConstructProps = {
|
|
15
|
+
subDomain: string;
|
|
16
|
+
certificate: ICertificate;
|
|
17
|
+
assetBucketProps: AssetBucketParams;
|
|
18
|
+
waf?: WafPrefab;
|
|
19
|
+
skipRecord?: true;
|
|
20
|
+
explicitDomains?: string[];
|
|
21
|
+
distributionProps?: Partial<awsCloudfront.DistributionProps>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export class CdnAssetPrefab extends Construct {
|
|
25
|
+
public readonly bucketPrefab: AssetBucketPrefab;
|
|
26
|
+
public readonly domain: string;
|
|
27
|
+
public readonly baseUrl: string;
|
|
28
|
+
public readonly distribution: awsCloudfront.Distribution;
|
|
29
|
+
public readonly behaviorOptions: Omit<awsCloudfront.BehaviorOptions, 'origin'>;
|
|
30
|
+
|
|
31
|
+
constructor(service: ServiceStack, params: CdnAssetConstructProps) {
|
|
32
|
+
super(service, getLogicalName(CdnAssetPrefab.name, params.subDomain));
|
|
33
|
+
|
|
34
|
+
this.domain = getDomain(params.subDomain, service.props);
|
|
35
|
+
this.baseUrl = `https://${this.domain}/`;
|
|
36
|
+
|
|
37
|
+
this.bucketPrefab = new AssetBucketPrefab(service, {
|
|
38
|
+
...params.assetBucketProps,
|
|
39
|
+
bucketProps: {
|
|
40
|
+
cors: [{ allowedMethods: [HttpMethods.GET, HttpMethods.POST], allowedOrigins: ['*'], allowedHeaders: ['*'] }],
|
|
41
|
+
...params.assetBucketProps?.bucketProps,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
this.behaviorOptions = {
|
|
46
|
+
compress: true,
|
|
47
|
+
originRequestPolicy: new awsCloudfront.OriginRequestPolicy(this, 'OriginRequestPolicy', {
|
|
48
|
+
originRequestPolicyName: getCloudFrontName('Bucket', 'RequestPolicy', service.props),
|
|
49
|
+
headerBehavior: {
|
|
50
|
+
behavior: 'whitelist',
|
|
51
|
+
headers: ['Access-Control-Allow-Origin', 'Access-Control-Allow-Headers', 'Origin'],
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
cachePolicy: awsCloudfront.CachePolicy.CACHING_OPTIMIZED,
|
|
55
|
+
allowedMethods: awsCloudfront.AllowedMethods.ALLOW_ALL,
|
|
56
|
+
viewerProtocolPolicy: awsCloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
this.distribution = new awsCloudfront.Distribution(this, 'Distribution', {
|
|
60
|
+
enabled: true,
|
|
61
|
+
comment: getResourceName('cdn', service.props),
|
|
62
|
+
certificate: params.certificate,
|
|
63
|
+
domainNames: params.explicitDomains ?? [this.domain],
|
|
64
|
+
defaultBehavior: {
|
|
65
|
+
origin: new S3Origin(this.bucketPrefab.bucket, {
|
|
66
|
+
originId: getCloudFrontName('Origin', 'Default', service.props),
|
|
67
|
+
}),
|
|
68
|
+
...this.behaviorOptions,
|
|
69
|
+
},
|
|
70
|
+
...(service.props.envName !== 'prod' ? { priceClass: awsCloudfront.PriceClass.PRICE_CLASS_100 } : {}),
|
|
71
|
+
webAclId: params.waf?.webACL?.attrArn,
|
|
72
|
+
...params.distributionProps,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
if (!params.explicitDomains || !params.skipRecord) {
|
|
76
|
+
const hostedZone = HostedZone.fromLookup(this, 'HostedZoneEnvDns', { domainName: getDomain('', service.props) });
|
|
77
|
+
new ARecord(service, 'Record', {
|
|
78
|
+
zone: hostedZone,
|
|
79
|
+
target: RecordTarget.fromAlias(new CloudFrontTarget(this.distribution)),
|
|
80
|
+
recordName: this.domain,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
new CfnOutput(this, 'Domain', { value: params.explicitDomains ? params.explicitDomains[0]! : this.domain });
|
|
85
|
+
new CfnOutput(this, 'BaseUrl', {
|
|
86
|
+
value: params.explicitDomains ? `https://${params.explicitDomains[0]}/` : this.baseUrl,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import * as awsCloudfront from 'aws-cdk-lib/aws-cloudfront';
|
|
2
|
+
import { CfnOutput, Duration, RemovalPolicy } from 'aws-cdk-lib';
|
|
3
|
+
import { ICertificate } from 'aws-cdk-lib/aws-certificatemanager';
|
|
4
|
+
import { S3Origin } from 'aws-cdk-lib/aws-cloudfront-origins';
|
|
5
|
+
import { ARecord, HostedZone, RecordTarget } from 'aws-cdk-lib/aws-route53';
|
|
6
|
+
import { CloudFrontTarget } from 'aws-cdk-lib/aws-route53-targets';
|
|
7
|
+
import { HttpMethods } from 'aws-cdk-lib/aws-s3';
|
|
8
|
+
import { StringParameter } from 'aws-cdk-lib/aws-ssm';
|
|
9
|
+
import { Construct } from 'constructs';
|
|
10
|
+
|
|
11
|
+
import { ServiceStack, SynthError, getCloudFrontName, getDomain, getLogicalName, getResourceName } from '../../../common';
|
|
12
|
+
import { WafPrefab } from '../../networking';
|
|
13
|
+
import { PrivateBucketPrefab } from '../../storage';
|
|
14
|
+
import { FrontendEnvBuilder } from '../../utils';
|
|
15
|
+
|
|
16
|
+
export type SpaPrefabParams = {
|
|
17
|
+
subDomain: string;
|
|
18
|
+
certificate: ICertificate;
|
|
19
|
+
assetMaxAge?: string;
|
|
20
|
+
indexMaxAge?: string;
|
|
21
|
+
baseDir?: string;
|
|
22
|
+
distDir?: string;
|
|
23
|
+
calculatedSecrets?: Record<string, string>;
|
|
24
|
+
waf?: WafPrefab;
|
|
25
|
+
skipRecord?: true;
|
|
26
|
+
wwwRedirectEnabled?: true;
|
|
27
|
+
explicitDomains?: string[];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export class SpaPrefab extends Construct {
|
|
31
|
+
private readonly domain: string;
|
|
32
|
+
private readonly baseUrl: string;
|
|
33
|
+
private readonly distribution: awsCloudfront.Distribution;
|
|
34
|
+
|
|
35
|
+
constructor(service: ServiceStack, params: SpaPrefabParams) {
|
|
36
|
+
super(service, getLogicalName(SpaPrefab.name, params.subDomain));
|
|
37
|
+
|
|
38
|
+
this.domain = getDomain(params.subDomain, service.props);
|
|
39
|
+
this.baseUrl = `https://${this.domain}/`;
|
|
40
|
+
|
|
41
|
+
const privateBucketPrefab = new PrivateBucketPrefab(service, {
|
|
42
|
+
bucketName: 'spawebapp',
|
|
43
|
+
bucketProps: {
|
|
44
|
+
autoDeleteObjects: true,
|
|
45
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
46
|
+
cors: [
|
|
47
|
+
{
|
|
48
|
+
allowedMethods: [HttpMethods.GET, HttpMethods.HEAD],
|
|
49
|
+
allowedOrigins: ['*'],
|
|
50
|
+
allowedHeaders: ['*'],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const behaviorOptions = {
|
|
57
|
+
compress: true,
|
|
58
|
+
origin: new S3Origin(privateBucketPrefab.bucket, {
|
|
59
|
+
originId: getCloudFrontName('Origin', 'Default', service.props),
|
|
60
|
+
}),
|
|
61
|
+
originRequestPolicy: new awsCloudfront.OriginRequestPolicy(this, 'OriginRequestPolicy', {
|
|
62
|
+
originRequestPolicyName: getCloudFrontName('Bucket', 'RequestPolicy', service.props),
|
|
63
|
+
headerBehavior: {
|
|
64
|
+
behavior: 'whitelist',
|
|
65
|
+
headers: ['Access-Control-Allow-Origin', 'Access-Control-Allow-Headers', 'Origin'],
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
cachePolicy: awsCloudfront.CachePolicy.CACHING_OPTIMIZED,
|
|
69
|
+
cachedMethods: awsCloudfront.AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
|
|
70
|
+
allowedMethods: awsCloudfront.AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
|
|
71
|
+
viewerProtocolPolicy: awsCloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const domains = [this.domain];
|
|
75
|
+
if (params.wwwRedirectEnabled) {
|
|
76
|
+
if (params.subDomain) throw new SynthError('wwwRedirectEnabled is only allowed in the root domain', service.props);
|
|
77
|
+
domains.push(`www.${this.domain}`);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
this.distribution = new awsCloudfront.Distribution(this, 'Distribution', {
|
|
81
|
+
enabled: true,
|
|
82
|
+
comment: getResourceName('cdn', service.props),
|
|
83
|
+
certificate: params.certificate,
|
|
84
|
+
domainNames: params.explicitDomains ?? domains,
|
|
85
|
+
defaultRootObject: 'index.html',
|
|
86
|
+
errorResponses: [
|
|
87
|
+
{
|
|
88
|
+
httpStatus: 403,
|
|
89
|
+
responseHttpStatus: 200,
|
|
90
|
+
ttl: Duration.seconds(86400),
|
|
91
|
+
responsePagePath: '/index.html',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
httpStatus: 404,
|
|
95
|
+
responseHttpStatus: 200,
|
|
96
|
+
responsePagePath: '/index.html',
|
|
97
|
+
ttl: Duration.seconds(86400),
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
defaultBehavior: behaviorOptions,
|
|
101
|
+
...(service.props.envName !== 'prod' ? { priceClass: awsCloudfront.PriceClass.PRICE_CLASS_100 } : {}),
|
|
102
|
+
webAclId: params.waf?.webACL?.attrArn,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
if (!params.explicitDomains && !params.skipRecord) {
|
|
106
|
+
const hostedZone = HostedZone.fromLookup(this, 'HostedZoneEnvDns', { domainName: getDomain('', service.props) });
|
|
107
|
+
domains.map((d) => {
|
|
108
|
+
new ARecord(service, d.split('.')[0]!, {
|
|
109
|
+
zone: hostedZone,
|
|
110
|
+
target: RecordTarget.fromAlias(new CloudFrontTarget(this.distribution)),
|
|
111
|
+
recordName: d,
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
new FrontendEnvBuilder(service, { ...params, name: params.subDomain });
|
|
116
|
+
|
|
117
|
+
new StringParameter(this, 'Config', {
|
|
118
|
+
simpleName: true,
|
|
119
|
+
parameterName: getResourceName('config', service.props),
|
|
120
|
+
stringValue: JSON.stringify({
|
|
121
|
+
domain: params.explicitDomains ? params.explicitDomains[0] : this.domain,
|
|
122
|
+
bucketName: privateBucketPrefab.bucket.bucketName,
|
|
123
|
+
distributionId: this.distribution.distributionId,
|
|
124
|
+
assetMaxAge: params.assetMaxAge || '604800',
|
|
125
|
+
indexMaxAge: params.indexMaxAge || '1800',
|
|
126
|
+
baseDir: params.baseDir || `frontend/${service.props.serviceName}`,
|
|
127
|
+
distDir: params.distDir || 'build',
|
|
128
|
+
}),
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
new CfnOutput(this, 'Domain', { value: params.explicitDomains ? params.explicitDomains[0]! : this.domain });
|
|
132
|
+
new CfnOutput(this, 'BaseUrl', {
|
|
133
|
+
value: params.explicitDomains ? `https://${params.explicitDomains[0]}/` : this.baseUrl,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import * as awsCloudfront from 'aws-cdk-lib/aws-cloudfront';
|
|
2
|
+
import * as lambda from 'aws-cdk-lib/aws-lambda';
|
|
3
|
+
import { CfnOutput, Duration, Fn, RemovalPolicy } from 'aws-cdk-lib';
|
|
4
|
+
import { ICertificate } from 'aws-cdk-lib/aws-certificatemanager';
|
|
5
|
+
import { HttpOrigin, OriginGroup, S3Origin } from 'aws-cdk-lib/aws-cloudfront-origins';
|
|
6
|
+
import { PolicyStatement } from 'aws-cdk-lib/aws-iam';
|
|
7
|
+
import { RetentionDays } from 'aws-cdk-lib/aws-logs';
|
|
8
|
+
import { ARecord, HostedZone, RecordTarget } from 'aws-cdk-lib/aws-route53';
|
|
9
|
+
import { CloudFrontTarget } from 'aws-cdk-lib/aws-route53-targets';
|
|
10
|
+
import { HttpMethods } from 'aws-cdk-lib/aws-s3';
|
|
11
|
+
import { BucketDeployment, Source } from 'aws-cdk-lib/aws-s3-deployment';
|
|
12
|
+
import { StringParameter } from 'aws-cdk-lib/aws-ssm';
|
|
13
|
+
import { Construct } from 'constructs';
|
|
14
|
+
|
|
15
|
+
import { execSync } from 'child_process';
|
|
16
|
+
import fs from 'fs';
|
|
17
|
+
import path from 'path';
|
|
18
|
+
|
|
19
|
+
import { ServiceStack, SynthError, getDomain, getLogicalName, getResourceName, getShortResourceName } from '../../../common';
|
|
20
|
+
import { WafPrefab } from '../../networking';
|
|
21
|
+
import { PrivateBucketPrefab } from '../../storage';
|
|
22
|
+
import { FrontendEnvBuilder } from '../../utils';
|
|
23
|
+
|
|
24
|
+
export type SsrPrefabParams = {
|
|
25
|
+
subDomain: string;
|
|
26
|
+
certificate: ICertificate;
|
|
27
|
+
assetMaxAge?: string;
|
|
28
|
+
indexMaxAge?: string;
|
|
29
|
+
baseDir?: string;
|
|
30
|
+
distDir?: string;
|
|
31
|
+
calculatedSecrets?: Record<string, string>;
|
|
32
|
+
waf?: WafPrefab;
|
|
33
|
+
skipRecord?: true;
|
|
34
|
+
wwwRedirectEnabled?: true;
|
|
35
|
+
filesPathAssets: string;
|
|
36
|
+
filesPathNextFunction: string;
|
|
37
|
+
filesPathImageFunction: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export class SsrPrefab extends Construct {
|
|
41
|
+
public readonly domain: string;
|
|
42
|
+
public readonly baseUrl: string;
|
|
43
|
+
public readonly distribution: awsCloudfront.Distribution;
|
|
44
|
+
public readonly bucket: PrivateBucketPrefab;
|
|
45
|
+
public readonly serverFunction: lambda.Function;
|
|
46
|
+
public readonly imageFunction: lambda.Function;
|
|
47
|
+
|
|
48
|
+
constructor(service: ServiceStack, params: SsrPrefabParams) {
|
|
49
|
+
super(service, getLogicalName(SsrPrefab.name, params.subDomain));
|
|
50
|
+
|
|
51
|
+
const command = `npx dotenv -e .env.${service.props.envName} open-next build`;
|
|
52
|
+
execSync(command, { stdio: 'inherit', cwd: `${process.cwd()}/${params.baseDir}` });
|
|
53
|
+
|
|
54
|
+
this.domain = getDomain(params.subDomain, service.props);
|
|
55
|
+
this.baseUrl = `https://${this.domain}/`;
|
|
56
|
+
|
|
57
|
+
this.bucket = new PrivateBucketPrefab(service, {
|
|
58
|
+
bucketName: 'ssr',
|
|
59
|
+
bucketProps: {
|
|
60
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
61
|
+
autoDeleteObjects: true,
|
|
62
|
+
cors: [
|
|
63
|
+
{
|
|
64
|
+
allowedMethods: [HttpMethods.GET, HttpMethods.HEAD],
|
|
65
|
+
allowedOrigins: ['*'],
|
|
66
|
+
allowedHeaders: ['*'],
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
new BucketDeployment(this, 'DeployAssetsBucket', {
|
|
73
|
+
sources: [Source.asset(params.filesPathAssets)],
|
|
74
|
+
destinationBucket: this.bucket.bucket,
|
|
75
|
+
destinationKeyPrefix: '',
|
|
76
|
+
prune: true,
|
|
77
|
+
retainOnDelete: false,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// NextJS Server Function
|
|
81
|
+
this.serverFunction = new lambda.Function(this, 'SSRServerFunction', {
|
|
82
|
+
functionName: getShortResourceName('server-function', service.props),
|
|
83
|
+
handler: 'index.handler',
|
|
84
|
+
currentVersionOptions: {
|
|
85
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
86
|
+
},
|
|
87
|
+
logRetention: RetentionDays.FIVE_DAYS,
|
|
88
|
+
runtime: lambda.Runtime.NODEJS_18_X,
|
|
89
|
+
memorySize: 2048,
|
|
90
|
+
timeout: Duration.seconds(5),
|
|
91
|
+
code: lambda.Code.fromAsset(params.filesPathNextFunction),
|
|
92
|
+
environment: {
|
|
93
|
+
...params.calculatedSecrets,
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Image Optimization Function
|
|
98
|
+
this.imageFunction = new lambda.Function(this, 'SSRImageFunction', {
|
|
99
|
+
functionName: getShortResourceName('image-function', service.props),
|
|
100
|
+
handler: 'index.handler',
|
|
101
|
+
currentVersionOptions: {
|
|
102
|
+
removalPolicy: RemovalPolicy.DESTROY,
|
|
103
|
+
},
|
|
104
|
+
logRetention: RetentionDays.FIVE_DAYS,
|
|
105
|
+
runtime: lambda.Runtime.NODEJS_18_X,
|
|
106
|
+
memorySize: 1536,
|
|
107
|
+
code: lambda.Code.fromAsset(params.filesPathImageFunction),
|
|
108
|
+
architecture: lambda.Architecture.ARM_64,
|
|
109
|
+
timeout: Duration.seconds(25),
|
|
110
|
+
environment: {
|
|
111
|
+
BUCKET_NAME: this.bucket.bucket.bucketName,
|
|
112
|
+
// TODO: Add allowed domains here. These are on the nextjs config file.
|
|
113
|
+
NEXT_IMAGE_ALLOWED_DOMAINS: '',
|
|
114
|
+
...params.calculatedSecrets,
|
|
115
|
+
},
|
|
116
|
+
initialPolicy: [
|
|
117
|
+
new PolicyStatement({
|
|
118
|
+
actions: ['s3:GetObject'],
|
|
119
|
+
resources: [this.bucket.bucket.arnForObjects('*')],
|
|
120
|
+
}),
|
|
121
|
+
],
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Middleware Function (for redirects)
|
|
125
|
+
const oai: awsCloudfront.IOriginAccessIdentity = new awsCloudfront.OriginAccessIdentity(this, getResourceName('oai', service.props));
|
|
126
|
+
this.bucket.bucket.grantRead(oai);
|
|
127
|
+
|
|
128
|
+
// Create origin group with the bucket and server function
|
|
129
|
+
const origin = new S3Origin(this.bucket.bucket, {
|
|
130
|
+
originId: getResourceName('OriginId', service.props),
|
|
131
|
+
originAccessIdentity: oai,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// Create server behavior for the origin group with the server function and middleware function (for redirects)
|
|
135
|
+
const serverFnUrl = this.serverFunction.addFunctionUrl({
|
|
136
|
+
authType: lambda.FunctionUrlAuthType.NONE,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// Create server behavior for the origin group with the server function
|
|
140
|
+
const serverBehavior = {
|
|
141
|
+
viewerProtocolPolicy: awsCloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
142
|
+
origin: new HttpOrigin(Fn.parseDomainName(serverFnUrl.url)),
|
|
143
|
+
allowedMethods: awsCloudfront.AllowedMethods.ALLOW_ALL,
|
|
144
|
+
cachedMethods: awsCloudfront.CachedMethods.CACHE_GET_HEAD_OPTIONS,
|
|
145
|
+
compress: true,
|
|
146
|
+
cachePolicy: this.createCloudFrontServerCachePolicy(),
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// Create image optimization behavior for the origin group with the image function
|
|
150
|
+
const imageFnUrl = this.imageFunction.addFunctionUrl({
|
|
151
|
+
authType: lambda.FunctionUrlAuthType.NONE,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// Create image optimization behavior for the origin group with the image function
|
|
155
|
+
const imageBehavior = {
|
|
156
|
+
viewerProtocolPolicy: awsCloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
157
|
+
origin: new HttpOrigin(Fn.parseDomainName(imageFnUrl.url)),
|
|
158
|
+
allowedMethods: awsCloudfront.AllowedMethods.ALLOW_ALL,
|
|
159
|
+
cachedMethods: awsCloudfront.CachedMethods.CACHE_GET_HEAD_OPTIONS,
|
|
160
|
+
compress: true,
|
|
161
|
+
cachePolicy: serverBehavior.cachePolicy,
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const domains = [this.domain];
|
|
165
|
+
if (params.wwwRedirectEnabled) {
|
|
166
|
+
if (params.subDomain) throw new SynthError('wwwRedirectEnabled is only allowed in the root domain', service.props);
|
|
167
|
+
domains.push(`www.${this.domain}`);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Create default behavior
|
|
171
|
+
// default handler for requests that don't match any other path:
|
|
172
|
+
// - try lambda handler first first
|
|
173
|
+
// - if failed, fall back to S3
|
|
174
|
+
const fallbackOriginGroup = new OriginGroup({
|
|
175
|
+
primaryOrigin: serverBehavior.origin,
|
|
176
|
+
fallbackOrigin: origin,
|
|
177
|
+
fallbackStatusCodes: [404],
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const defaultBehavior = {
|
|
181
|
+
origin: fallbackOriginGroup,
|
|
182
|
+
viewerProtocolPolicy: awsCloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
183
|
+
compress: true,
|
|
184
|
+
cachePolicy: serverBehavior.cachePolicy,
|
|
185
|
+
// TODO: Add edge lambdas here
|
|
186
|
+
// edgeLambdas: serverBehavior.edgeLambdas,
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// Create statics behavior for the origin group with the bucket
|
|
190
|
+
const staticFileBehavior: awsCloudfront.BehaviorOptions = {
|
|
191
|
+
origin,
|
|
192
|
+
viewerProtocolPolicy: awsCloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
|
|
193
|
+
allowedMethods: awsCloudfront.AllowedMethods.ALLOW_GET_HEAD_OPTIONS,
|
|
194
|
+
cachedMethods: awsCloudfront.CachedMethods.CACHE_GET_HEAD_OPTIONS,
|
|
195
|
+
compress: true,
|
|
196
|
+
cachePolicy: awsCloudfront.CachePolicy.CACHING_OPTIMIZED,
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const staticsBehaviorsStatic: Record<string, awsCloudfront.BehaviorOptions> = {};
|
|
200
|
+
const publicDir = path.join(params.filesPathAssets);
|
|
201
|
+
// Get all files and folders in the public directory
|
|
202
|
+
// and create a behavior for each one
|
|
203
|
+
for (const item of fs.readdirSync(publicDir)) {
|
|
204
|
+
if (fs.statSync(path.join(publicDir, item)).isDirectory()) {
|
|
205
|
+
staticsBehaviorsStatic[`${item}/*`] = staticFileBehavior;
|
|
206
|
+
} else {
|
|
207
|
+
staticsBehaviorsStatic[item] = staticFileBehavior;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
this.distribution = new awsCloudfront.Distribution(this, 'Distribution', {
|
|
212
|
+
defaultRootObject: '',
|
|
213
|
+
domainNames: domains,
|
|
214
|
+
certificate: params.certificate,
|
|
215
|
+
comment: getResourceName('cdn', service.props),
|
|
216
|
+
enableIpv6: false,
|
|
217
|
+
enabled: true,
|
|
218
|
+
httpVersion: awsCloudfront.HttpVersion.HTTP2,
|
|
219
|
+
priceClass: awsCloudfront.PriceClass.PRICE_CLASS_100,
|
|
220
|
+
minimumProtocolVersion: awsCloudfront.SecurityPolicyProtocol.TLS_V1_2_2021,
|
|
221
|
+
sslSupportMethod: awsCloudfront.SSLMethod.SNI,
|
|
222
|
+
defaultBehavior: defaultBehavior,
|
|
223
|
+
additionalBehaviors: {
|
|
224
|
+
'api/*': serverBehavior,
|
|
225
|
+
'_next/data/*': serverBehavior,
|
|
226
|
+
'_next/image*': imageBehavior,
|
|
227
|
+
'_next/*': staticFileBehavior,
|
|
228
|
+
// all other static files
|
|
229
|
+
...staticsBehaviorsStatic,
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
if (!params.skipRecord) {
|
|
234
|
+
const hostedZone = HostedZone.fromLookup(this, 'HostedZoneEnvDns', { domainName: getDomain('', service.props) });
|
|
235
|
+
domains.map((d) => {
|
|
236
|
+
new ARecord(service, d.split('.')[0]!, {
|
|
237
|
+
zone: hostedZone,
|
|
238
|
+
target: RecordTarget.fromAlias(new CloudFrontTarget(this.distribution)),
|
|
239
|
+
recordName: d,
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
new FrontendEnvBuilder(service, { ...params, name: params.subDomain });
|
|
245
|
+
|
|
246
|
+
new StringParameter(this, 'Config', {
|
|
247
|
+
simpleName: true,
|
|
248
|
+
parameterName: getResourceName('config', service.props),
|
|
249
|
+
stringValue: JSON.stringify({
|
|
250
|
+
domain: this.domain,
|
|
251
|
+
distributionBucket: this.bucket.bucket.bucketName,
|
|
252
|
+
distributionId: this.distribution.distributionId,
|
|
253
|
+
assetMaxAge: params.assetMaxAge || '300',
|
|
254
|
+
indexMaxAge: params.indexMaxAge || '1800',
|
|
255
|
+
baseDir: params.baseDir || `frontend/${service.props.serviceName}`,
|
|
256
|
+
distDir: params.distDir || 'build',
|
|
257
|
+
}),
|
|
258
|
+
});
|
|
259
|
+
new CfnOutput(this, 'Domain', { value: this.domain });
|
|
260
|
+
new CfnOutput(this, 'BaseUrl', { value: this.baseUrl });
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
protected createCloudFrontServerCachePolicy(): awsCloudfront.CachePolicy {
|
|
264
|
+
return new awsCloudfront.CachePolicy(this, 'ServerCache', {
|
|
265
|
+
queryStringBehavior: awsCloudfront.CacheQueryStringBehavior.all(),
|
|
266
|
+
headerBehavior: awsCloudfront.CacheHeaderBehavior.allowList(
|
|
267
|
+
// required by image optimization request
|
|
268
|
+
'Accept',
|
|
269
|
+
// required by server request
|
|
270
|
+
'x-op-middleware-request-headers',
|
|
271
|
+
'x-op-middleware-response-headers',
|
|
272
|
+
'x-nextjs-data',
|
|
273
|
+
'x-middleware-prefetch',
|
|
274
|
+
// required by server request (in-place routing)
|
|
275
|
+
'rsc',
|
|
276
|
+
'next-router-prefetch',
|
|
277
|
+
'next-router-state-tree'
|
|
278
|
+
),
|
|
279
|
+
cookieBehavior: awsCloudfront.CacheCookieBehavior.all(),
|
|
280
|
+
defaultTtl: Duration.days(0),
|
|
281
|
+
maxTtl: Duration.days(365),
|
|
282
|
+
minTtl: Duration.days(0),
|
|
283
|
+
enableAcceptEncodingBrotli: true,
|
|
284
|
+
enableAcceptEncodingGzip: true,
|
|
285
|
+
comment: 'Server response cache policy',
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|