sst 1.16.0 → 2.0.0-rc.0
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/LICENSE +21 -0
- package/{dist/app.d.ts → app.d.ts} +8 -1
- package/app.js +122 -0
- package/{dist/bootstrap.d.ts → bootstrap.d.ts} +1 -0
- package/bootstrap.js +79 -0
- package/{dist/bus.d.ts → bus.d.ts} +0 -0
- package/{dist/bus.js → bus.js} +0 -0
- package/{dist/cache.d.ts → cache.d.ts} +0 -0
- package/{dist/cache.js → cache.js} +0 -0
- package/{dist/cdk → cdk}/cloudformation-deployments.d.ts +1 -1
- package/{dist/cdk → cdk}/cloudformation-deployments.js +1 -0
- package/{dist/cdk → cdk}/deploy-stack.d.ts +0 -0
- package/{dist/cdk → cdk}/deploy-stack.js +13 -6
- package/{dist/cli → cli}/commands/bind.d.ts +3 -1
- package/{dist/cli → cli}/commands/bind.js +8 -4
- package/{dist/cli → cli}/commands/build.d.ts +2 -0
- package/cli/commands/build.js +12 -0
- package/cli/commands/console.d.ts +9 -0
- package/cli/commands/console.js +15 -0
- package/{dist/cli → cli}/commands/deploy.d.ts +7 -1
- package/cli/commands/deploy.js +48 -0
- package/cli/commands/dev.d.ts +11 -0
- package/cli/commands/dev.js +188 -0
- package/cli/commands/env.d.ts +11 -0
- package/cli/commands/env.js +39 -0
- package/cli/commands/plugins/kysely.d.ts +1 -0
- package/cli/commands/plugins/kysely.js +91 -0
- package/cli/commands/plugins/pothos.d.ts +1 -0
- package/cli/commands/plugins/pothos.js +52 -0
- package/cli/commands/plugins/warmer.d.ts +1 -0
- package/cli/commands/plugins/warmer.js +33 -0
- package/cli/commands/remove.d.ts +13 -0
- package/cli/commands/remove.js +39 -0
- package/{dist/cli → cli}/commands/secrets/get.d.ts +2 -0
- package/{dist/cli → cli}/commands/secrets/get.js +0 -0
- package/{dist/cli → cli}/commands/secrets/list.d.ts +2 -0
- package/{dist/cli → cli}/commands/secrets/list.js +5 -5
- package/{dist/cli → cli}/commands/secrets/remove.d.ts +2 -0
- package/{dist/cli → cli}/commands/secrets/remove.js +0 -0
- package/{dist/cli → cli}/commands/secrets/secrets.d.ts +0 -0
- package/{dist/cli → cli}/commands/secrets/secrets.js +0 -0
- package/{dist/cli → cli}/commands/secrets/set.d.ts +2 -0
- package/{dist/cli → cli}/commands/secrets/set.js +13 -11
- package/{dist/cli → cli}/commands/update.d.ts +2 -0
- package/{dist/cli → cli}/commands/update.js +17 -21
- package/cli/local/router.d.ts +42 -0
- package/cli/local/router.js +43 -0
- package/cli/local/server.d.ts +20 -0
- package/cli/local/server.js +212 -0
- package/cli/program.d.ts +9 -0
- package/{dist/cli → cli}/program.js +6 -1
- package/{dist/cli → cli}/spinner.d.ts +0 -0
- package/{dist/cli → cli}/spinner.js +0 -0
- package/cli/sst.d.ts +2 -0
- package/{dist/cli → cli}/sst.js +27 -16
- package/cli/telemetry/environment.d.ts +15 -0
- package/cli/telemetry/environment.js +27 -0
- package/cli/telemetry/post-payload.d.ts +1 -0
- package/cli/telemetry/post-payload.js +18 -0
- package/cli/telemetry/project-id.d.ts +2 -0
- package/cli/telemetry/project-id.js +47 -0
- package/cli/telemetry/telemetry.d.ts +4 -0
- package/cli/telemetry/telemetry.js +90 -0
- package/cli/ui/deploy.d.ts +8 -0
- package/{dist/cli → cli}/ui/deploy.js +39 -1
- package/{dist/config.d.ts → config.d.ts} +0 -0
- package/{dist/config.js → config.js} +16 -4
- package/{dist/constructs → constructs}/Api.d.ts +98 -12
- package/{dist/constructs → constructs}/Api.js +93 -7
- package/{dist/constructs → constructs}/ApiGatewayV1Api.d.ts +0 -0
- package/{dist/constructs → constructs}/ApiGatewayV1Api.js +10 -5
- package/{dist/constructs → constructs}/App.d.ts +4 -26
- package/{dist/constructs → constructs}/App.js +119 -99
- package/{dist/constructs → constructs}/AppSyncApi.d.ts +3 -3
- package/{dist/constructs → constructs}/AppSyncApi.js +27 -20
- package/constructs/AstroSite.d.ts +25 -0
- package/constructs/AstroSite.js +111 -0
- package/constructs/AstroSite.tsdoc.d.ts +2 -0
- package/constructs/AstroSite.tsdoc.js +2 -0
- package/{dist/constructs → constructs}/Auth.d.ts +1 -1
- package/{dist/constructs → constructs}/Auth.js +6 -4
- package/{dist/constructs → constructs}/BaseSite.d.ts +0 -0
- package/{dist/constructs → constructs}/BaseSite.js +0 -0
- package/{dist/constructs → constructs}/Bucket.d.ts +0 -0
- package/{dist/constructs → constructs}/Bucket.js +6 -3
- package/{dist/constructs → constructs}/Cognito.d.ts +0 -0
- package/{dist/constructs → constructs}/Cognito.js +4 -1
- package/{dist/constructs → constructs}/Config.d.ts +0 -0
- package/{dist/constructs → constructs}/Config.js +0 -0
- package/{dist/constructs → constructs}/Construct.d.ts +0 -0
- package/{dist/constructs → constructs}/Construct.js +0 -0
- package/{dist/constructs → constructs}/Cron.d.ts +0 -0
- package/{dist/constructs → constructs}/Cron.js +7 -0
- package/{dist/constructs → constructs}/DebugApp.d.ts +2 -2
- package/{dist/constructs → constructs}/DebugApp.js +16 -0
- package/{dist/constructs → constructs}/DebugStack.d.ts +0 -0
- package/{dist/constructs → constructs}/DebugStack.js +4 -0
- package/{dist/constructs → constructs}/EdgeFunction.d.ts +1 -0
- package/{dist/constructs → constructs}/EdgeFunction.js +27 -22
- package/{dist/constructs → constructs}/EventBus.d.ts +0 -0
- package/{dist/constructs → constructs}/EventBus.js +7 -4
- package/{dist/constructs → constructs}/Function.d.ts +73 -174
- package/{dist/constructs → constructs}/Function.js +43 -83
- package/{dist/constructs → constructs}/FunctionalStack.d.ts +0 -0
- package/{dist/constructs → constructs}/FunctionalStack.js +5 -5
- package/{dist/constructs → constructs}/GraphQLApi.d.ts +11 -1
- package/{dist/constructs → constructs}/GraphQLApi.js +3 -0
- package/{dist/constructs → constructs}/Job.d.ts +0 -14
- package/{dist/constructs → constructs}/Job.js +50 -46
- package/{dist/constructs → constructs}/KinesisStream.d.ts +0 -0
- package/{dist/constructs → constructs}/KinesisStream.js +6 -3
- package/{dist/constructs → constructs}/Metadata.d.ts +1 -1
- package/{dist/constructs → constructs}/Metadata.js +0 -0
- package/constructs/NextjsSite.d.ts +33 -0
- package/constructs/NextjsSite.js +285 -0
- package/{dist/constructs → constructs}/Parameter.d.ts +0 -0
- package/{dist/constructs → constructs}/Parameter.js +3 -0
- package/{dist/constructs → constructs}/Queue.d.ts +0 -0
- package/{dist/constructs → constructs}/Queue.js +19 -12
- package/{dist/constructs → constructs}/RDS.d.ts +0 -0
- package/{dist/constructs → constructs}/RDS.js +26 -19
- package/{dist/constructs → constructs}/ReactStaticSite.d.ts +0 -0
- package/{dist/constructs → constructs}/ReactStaticSite.js +1 -1
- package/constructs/RemixSite.d.ts +28 -0
- package/constructs/RemixSite.js +150 -0
- package/constructs/RemixSite.tsdoc.d.ts +2 -0
- package/constructs/RemixSite.tsdoc.js +2 -0
- package/{dist/constructs → constructs}/Script/cfn-response.d.ts +0 -0
- package/{dist/constructs → constructs}/Script/cfn-response.js +0 -0
- package/{dist/constructs → constructs}/Script/index.d.ts +0 -0
- package/{dist/constructs → constructs}/Script/index.js +0 -0
- package/{dist/constructs → constructs}/Script/outbound.d.ts +1 -1
- package/{dist/constructs → constructs}/Script/outbound.js +0 -0
- package/{dist/constructs → constructs}/Script/util.d.ts +0 -0
- package/{dist/constructs → constructs}/Script/util.js +0 -0
- package/{dist/constructs → constructs}/Script.d.ts +0 -0
- package/{dist/constructs → constructs}/Script.js +13 -0
- package/{dist/constructs → constructs}/Secret.d.ts +0 -0
- package/{dist/constructs → constructs}/Secret.js +2 -0
- package/constructs/SolidStartSite.d.ts +24 -0
- package/constructs/SolidStartSite.js +103 -0
- package/constructs/SolidStartSite.tsdoc.d.ts +2 -0
- package/constructs/SolidStartSite.tsdoc.js +2 -0
- package/{dist/constructs/RemixSite.d.ts → constructs/SsrSite.d.ts} +69 -107
- package/{dist/constructs/RemixSite.js → constructs/SsrSite.js} +243 -446
- package/{dist/constructs → constructs}/Stack.d.ts +1 -1
- package/{dist/constructs → constructs}/Stack.js +19 -4
- package/{dist/constructs → constructs}/StaticSite.d.ts +44 -17
- package/{dist/constructs → constructs}/StaticSite.js +121 -72
- package/{dist/constructs → constructs}/Table.d.ts +0 -0
- package/{dist/constructs → constructs}/Table.js +9 -3
- package/{dist/constructs → constructs}/Topic.d.ts +0 -0
- package/{dist/constructs → constructs}/Topic.js +6 -3
- package/{dist/constructs → constructs}/ViteStaticSite.d.ts +0 -0
- package/{dist/constructs → constructs}/ViteStaticSite.js +2 -2
- package/{dist/constructs → constructs}/WebSocketApi.d.ts +0 -0
- package/{dist/constructs → constructs}/WebSocketApi.js +9 -4
- package/{dist/constructs → constructs}/context.d.ts +1 -1
- package/{dist/constructs → constructs}/context.js +0 -0
- package/{dist/constructs → constructs}/deferred_task.d.ts +0 -0
- package/{dist/constructs → constructs}/deferred_task.js +4 -2
- package/{dist/constructs → constructs/deprecated}/NextjsSite.d.ts +12 -8
- package/{dist/constructs → constructs/deprecated}/NextjsSite.js +112 -89
- package/{dist/constructs/nextjs-site → constructs/deprecated}/cross-region-helper.d.ts +0 -0
- package/{dist/constructs/nextjs-site → constructs/deprecated}/cross-region-helper.js +3 -3
- package/constructs/deprecated/index.d.ts +1 -0
- package/constructs/deprecated/index.js +1 -0
- package/{dist/constructs → constructs}/index.d.ts +3 -2
- package/{dist/constructs → constructs}/index.js +2 -0
- package/{dist/constructs → constructs}/util/apiGatewayV1AccessLog.d.ts +0 -0
- package/{dist/constructs → constructs}/util/apiGatewayV1AccessLog.js +0 -0
- package/{dist/constructs → constructs}/util/apiGatewayV2AccessLog.d.ts +0 -0
- package/{dist/constructs → constructs}/util/apiGatewayV2AccessLog.js +4 -4
- package/{dist/constructs → constructs}/util/apiGatewayV2Cors.d.ts +0 -0
- package/{dist/constructs → constructs}/util/apiGatewayV2Cors.js +0 -0
- package/{dist/constructs → constructs}/util/apiGatewayV2Domain.d.ts +0 -0
- package/{dist/constructs → constructs}/util/apiGatewayV2Domain.js +0 -0
- package/{dist/constructs → constructs}/util/appSyncApiDomain.d.ts +1 -1
- package/{dist/constructs → constructs}/util/appSyncApiDomain.js +15 -9
- package/{dist/constructs → constructs}/util/builder.d.ts +0 -0
- package/{dist/constructs → constructs}/util/builder.js +0 -0
- package/{dist/constructs → constructs}/util/duration.d.ts +0 -0
- package/{dist/constructs → constructs}/util/duration.js +0 -0
- package/{dist/constructs → constructs}/util/functionBinding.d.ts +0 -0
- package/{dist/constructs → constructs}/util/functionBinding.js +0 -0
- package/{dist/constructs → constructs}/util/functionUrlCors.d.ts +0 -0
- package/{dist/constructs → constructs}/util/functionUrlCors.js +0 -0
- package/{dist/constructs → constructs}/util/permission.d.ts +0 -0
- package/{dist/constructs → constructs}/util/permission.js +32 -16
- package/{dist/constructs → constructs}/util/python/bundling.d.ts +0 -0
- package/{dist/constructs → constructs}/util/python/bundling.js +0 -0
- package/{dist/constructs → constructs}/util/size.d.ts +0 -0
- package/{dist/constructs → constructs}/util/size.js +0 -0
- package/{dist/constructs → constructs}/util/warning.d.ts +0 -0
- package/{dist/constructs → constructs}/util/warning.js +0 -0
- package/{dist/context → context}/context.d.ts +1 -1
- package/{dist/context → context}/context.js +3 -4
- package/{dist/context → context}/handler.d.ts +0 -0
- package/{dist/context → context}/handler.js +1 -1
- package/{dist/context → context}/index.d.ts +0 -0
- package/{dist/context → context}/index.js +0 -0
- package/{dist/credentials.d.ts → credentials.d.ts} +3 -1
- package/{dist/credentials.js → credentials.js} +11 -3
- package/{dist/error.d.ts → error.d.ts} +0 -0
- package/{dist/error.js → error.js} +0 -0
- package/{dist/iot.d.ts → iot.d.ts} +0 -0
- package/{dist/iot.js → iot.js} +3 -0
- package/logger.d.ts +3 -0
- package/{dist/logger.js → logger.js} +12 -8
- package/node/api/index.d.ts +42 -0
- package/node/api/index.js +88 -0
- package/node/auth/adapter/adapter.d.ts +3 -0
- package/node/auth/adapter/adapter.js +3 -0
- package/node/auth/adapter/facebook.d.ts +2 -0
- package/node/auth/adapter/facebook.js +26 -0
- package/node/auth/adapter/github.d.ts +2 -0
- package/node/auth/adapter/github.js +21 -0
- package/node/auth/adapter/google.d.ts +9 -0
- package/node/auth/adapter/google.js +18 -0
- package/node/auth/adapter/link.d.ts +8 -0
- package/node/auth/adapter/link.js +39 -0
- package/node/auth/adapter/oauth.d.ts +25 -0
- package/node/auth/adapter/oauth.js +52 -0
- package/node/auth/adapter/oidc.d.ts +17 -0
- package/node/auth/adapter/oidc.js +50 -0
- package/node/auth/adapter/twitch.d.ts +2 -0
- package/node/auth/adapter/twitch.js +11 -0
- package/node/auth/auth.d.ts +24 -0
- package/node/auth/auth.js +118 -0
- package/node/auth/index.d.ts +10 -0
- package/node/auth/index.js +10 -0
- package/node/auth/session.d.ts +76 -0
- package/node/auth/session.js +109 -0
- package/node/bucket/index.d.ts +3 -0
- package/node/bucket/index.js +3 -0
- package/node/config/index.d.ts +13 -0
- package/node/config/index.js +88 -0
- package/node/event-bus/index.d.ts +3 -0
- package/node/event-bus/index.js +3 -0
- package/node/function/index.d.ts +3 -0
- package/node/function/index.js +3 -0
- package/node/graphql/index.d.ts +38 -0
- package/node/graphql/index.js +48 -0
- package/node/job/index.d.ts +34 -0
- package/node/job/index.js +51 -0
- package/node/kinesis-stream/index.d.ts +3 -0
- package/node/kinesis-stream/index.js +3 -0
- package/node/queue/index.d.ts +3 -0
- package/node/queue/index.js +3 -0
- package/node/rds/index.d.ts +3 -0
- package/node/rds/index.js +3 -0
- package/node/site/index.d.ts +15 -0
- package/node/site/index.js +64 -0
- package/node/table/index.d.ts +3 -0
- package/node/table/index.js +3 -0
- package/node/topic/index.d.ts +3 -0
- package/node/topic/index.js +3 -0
- package/node/util/index.d.ts +7 -0
- package/node/util/index.js +57 -0
- package/package.json +107 -40
- package/pothos.d.ts +8 -0
- package/pothos.js +156 -0
- package/runtime/handlers/dotnet.d.ts +1 -0
- package/runtime/handlers/dotnet.js +117 -0
- package/runtime/handlers/go.d.ts +1 -0
- package/runtime/handlers/go.js +105 -0
- package/runtime/handlers/java.d.ts +1 -0
- package/runtime/handlers/java.js +97 -0
- package/{dist/runtime → runtime/handlers}/node.d.ts +0 -0
- package/runtime/handlers/node.js +172 -0
- package/runtime/handlers/python.d.ts +1 -0
- package/runtime/handlers/python.js +89 -0
- package/{dist/runtime → runtime}/handlers.d.ts +30 -12
- package/runtime/handlers.js +117 -0
- package/{dist/runtime → runtime}/iot.d.ts +0 -0
- package/{dist/runtime → runtime}/iot.js +1 -1
- package/{dist/runtime → runtime}/runtime.d.ts +2 -0
- package/{dist/runtime → runtime}/runtime.js +0 -0
- package/{dist/runtime → runtime}/server.d.ts +0 -0
- package/{dist/runtime → runtime}/server.js +39 -3
- package/{dist/runtime → runtime}/workers.d.ts +1 -0
- package/{dist/runtime → runtime}/workers.js +12 -4
- package/{dist/cli/sst.d.ts → scrap.d.ts} +0 -0
- package/scrap.js +58 -0
- package/site-env.d.ts +13 -0
- package/site-env.js +47 -0
- package/sst.mjs +21848 -0
- package/{dist/stacks → stacks}/build.d.ts +0 -0
- package/{dist/stacks → stacks}/build.js +18 -9
- package/stacks/deploy.d.ts +8 -0
- package/stacks/deploy.js +105 -0
- package/stacks/index.d.ts +7 -0
- package/stacks/index.js +7 -0
- package/stacks/metadata.d.ts +9 -0
- package/{dist/stacks → stacks}/metadata.js +2 -14
- package/stacks/monitor.d.ts +27 -0
- package/stacks/monitor.js +111 -0
- package/stacks/remove.d.ts +8 -0
- package/stacks/remove.js +80 -0
- package/stacks/synth.d.ts +10 -0
- package/stacks/synth.js +77 -0
- package/support/astro-site-html-stub/index.html +99 -0
- package/support/base-site-archiver.cjs +12 -11
- package/support/base-site-archiver.mjs +20 -0
- package/support/bridge/bridge.mjs +59 -0
- package/{dist/support → support}/custom-resources/index.mjs +44209 -42781
- package/support/dotnet31-bootstrap/Program.cs +17 -0
- package/support/dotnet31-bootstrap/dotnet-bootstrap.csproj +12 -0
- package/support/dotnet31-bootstrap/release/Amazon.Lambda.Core.dll +0 -0
- package/support/dotnet31-bootstrap/release/Amazon.Lambda.RuntimeSupport.dll +0 -0
- package/support/dotnet31-bootstrap/release/System.Runtime.CompilerServices.Unsafe.dll +0 -0
- package/support/dotnet31-bootstrap/release/System.Text.Encodings.Web.dll +0 -0
- package/support/dotnet31-bootstrap/release/System.Text.Json.dll +0 -0
- package/support/dotnet31-bootstrap/release/dotnet-bootstrap +0 -0
- package/support/dotnet31-bootstrap/release/dotnet-bootstrap.deps.json +230 -0
- package/support/dotnet31-bootstrap/release/dotnet-bootstrap.dll +0 -0
- package/support/dotnet31-bootstrap/release/dotnet-bootstrap.pdb +0 -0
- package/support/dotnet31-bootstrap/release/dotnet-bootstrap.runtimeconfig.json +9 -0
- package/support/dotnet6-bootstrap/Program.cs +17 -0
- package/support/dotnet6-bootstrap/dotnet-bootstrap.csproj +12 -0
- package/support/dotnet6-bootstrap/release/Amazon.Lambda.Core.dll +0 -0
- package/support/dotnet6-bootstrap/release/Amazon.Lambda.RuntimeSupport.dll +0 -0
- package/support/dotnet6-bootstrap/release/dotnet-bootstrap +0 -0
- package/support/dotnet6-bootstrap/release/dotnet-bootstrap.deps.json +59 -0
- package/support/dotnet6-bootstrap/release/dotnet-bootstrap.dll +0 -0
- package/support/dotnet6-bootstrap/release/dotnet-bootstrap.pdb +0 -0
- package/support/dotnet6-bootstrap/release/dotnet-bootstrap.runtimeconfig.json +12 -0
- package/support/edge-function/edge-lambda-version.mjs +3 -0
- package/support/edge-function/edge-lambda.mjs +3 -0
- package/support/edge-function/s3-bucket.mjs +3 -0
- package/{dist/support/base-site-custom-resource/cf-invalidate.py → support/edge-function-code-replacer/lambda-code-updater.py} +56 -30
- package/support/java-runtime/install.sh +25 -0
- package/support/java-runtime/pom.xml +39 -0
- package/support/java-runtime/release/aws-lambda-java-core-1.2.0.jar +0 -0
- package/support/java-runtime/release/aws-lambda-java-runtime-interface-client-1.1.0.jar +0 -0
- package/support/java-runtime/release/aws-lambda-java-serialization-1.0.0.jar +0 -0
- package/support/nextjs-site-html-stub/index.html +99 -0
- package/{dist/support → support}/nodejs-runtime/index.mjs +7822 -2771
- package/support/python-runtime/runtime.py +116 -0
- package/support/rds-migrator/index.mjs +28 -0
- package/support/remix-site-function/edge-server.js +158 -0
- package/support/remix-site-function/polyfill.js +24 -0
- package/support/remix-site-function/regional-server.js +162 -0
- package/support/remix-site-html-stub/index.html +99 -0
- package/support/sls-nextjs-site-build-helper/build.cjs +91 -0
- package/support/sls-nextjs-site-build-helper/index-wrapper.js +19 -0
- package/support/sls-nextjs-site-stub/index.html +99 -0
- package/support/solid-start-site-html-stub/index.html +99 -0
- package/support/ssr-site-function-stub/index.js +5 -0
- package/util/fs.d.ts +4 -0
- package/util/fs.js +46 -0
- package/util/module.d.ts +1 -0
- package/util/module.js +5 -0
- package/util/process.d.ts +2 -0
- package/util/process.js +3 -0
- package/{dist/watcher.d.ts → watcher.d.ts} +0 -0
- package/{dist/watcher.js → watcher.js} +1 -1
- package/.build/sst-debug.log +0 -10
- package/.turbo/turbo-build.log +0 -2
- package/CHANGELOG.md +0 -332
- package/analyze +0 -11090
- package/bin/sst.mjs +0 -3
- package/build.mjs +0 -116
- package/debug.log +0 -6
- package/dist/app.js +0 -92
- package/dist/bootstrap.js +0 -23
- package/dist/cli/commands/build.js +0 -8
- package/dist/cli/commands/deploy.js +0 -20
- package/dist/cli/commands/env.d.ts +0 -0
- package/dist/cli/commands/env.js +0 -1
- package/dist/cli/commands/scrap.d.ts +0 -5
- package/dist/cli/commands/scrap.js +0 -1
- package/dist/cli/commands/start.d.ts +0 -7
- package/dist/cli/commands/start.js +0 -136
- package/dist/cli/program.d.ts +0 -7
- package/dist/cli/ui/deploy.d.ts +0 -6
- package/dist/constructs/nextjs-site/custom-resource/cfn-response.d.ts +0 -19
- package/dist/constructs/nextjs-site/custom-resource/cfn-response.js +0 -94
- package/dist/constructs/nextjs-site/custom-resource/edge-lambda-version.d.ts +0 -1
- package/dist/constructs/nextjs-site/custom-resource/edge-lambda-version.js +0 -138
- package/dist/constructs/nextjs-site/custom-resource/edge-lambda.d.ts +0 -1
- package/dist/constructs/nextjs-site/custom-resource/edge-lambda.js +0 -136
- package/dist/constructs/nextjs-site/custom-resource/s3-bucket.d.ts +0 -1
- package/dist/constructs/nextjs-site/custom-resource/s3-bucket.js +0 -94
- package/dist/constructs/nextjs-site/custom-resource/util.d.ts +0 -1
- package/dist/constructs/nextjs-site/custom-resource/util.js +0 -4
- package/dist/logger.d.ts +0 -9
- package/dist/runtime/handlers.js +0 -72
- package/dist/runtime/node.js +0 -99
- package/dist/sst.mjs +0 -164202
- package/dist/stacks/deploy.d.ts +0 -33
- package/dist/stacks/deploy.js +0 -168
- package/dist/stacks/index.d.ts +0 -21
- package/dist/stacks/index.js +0 -57
- package/dist/stacks/metadata.d.ts +0 -9
- package/dist/support/base-site-archiver.cjs +0 -115
- package/dist/support/base-site-custom-resource/s3-handler.py +0 -195
- package/dist/support/base-site-custom-resource/s3-upload.py +0 -91
- package/dist/support/bridge/bridge.mjs +0 -86
- package/dist/support/static-site-stub/index.html +0 -90
- package/src/app.ts +0 -140
- package/src/bootstrap.ts +0 -28
- package/src/bus.ts +0 -81
- package/src/cache.ts +0 -34
- package/src/cdk/cloudformation-deployments.ts +0 -730
- package/src/cdk/deploy-stack.ts +0 -1030
- package/src/cli/commands/bind.ts +0 -31
- package/src/cli/commands/build.ts +0 -16
- package/src/cli/commands/deploy.ts +0 -34
- package/src/cli/commands/env.ts +0 -0
- package/src/cli/commands/scrap.ts +0 -5
- package/src/cli/commands/secrets/get.ts +0 -50
- package/src/cli/commands/secrets/list.ts +0 -66
- package/src/cli/commands/secrets/remove.ts +0 -36
- package/src/cli/commands/secrets/secrets.ts +0 -17
- package/src/cli/commands/secrets/set.ts +0 -59
- package/src/cli/commands/start.tsx +0 -162
- package/src/cli/commands/update.ts +0 -100
- package/src/cli/program.ts +0 -22
- package/src/cli/spinner.ts +0 -14
- package/src/cli/sst.ts +0 -50
- package/src/cli/ui/deploy.tsx +0 -139
- package/src/config.ts +0 -226
- package/src/constructs/Api.ts +0 -1448
- package/src/constructs/ApiGatewayV1Api.ts +0 -1481
- package/src/constructs/App.ts +0 -744
- package/src/constructs/AppSyncApi.ts +0 -1045
- package/src/constructs/Auth.ts +0 -252
- package/src/constructs/BaseSite.ts +0 -146
- package/src/constructs/Bucket.ts +0 -670
- package/src/constructs/Cognito.ts +0 -708
- package/src/constructs/Config.ts +0 -4
- package/src/constructs/Construct.ts +0 -77
- package/src/constructs/Cron.ts +0 -235
- package/src/constructs/DebugApp.ts +0 -97
- package/src/constructs/DebugStack.ts +0 -182
- package/src/constructs/EdgeFunction.ts +0 -460
- package/src/constructs/EventBus.ts +0 -651
- package/src/constructs/Function.ts +0 -1329
- package/src/constructs/FunctionalStack.ts +0 -90
- package/src/constructs/GraphQLApi.ts +0 -140
- package/src/constructs/Job.ts +0 -557
- package/src/constructs/KinesisStream.ts +0 -388
- package/src/constructs/Metadata.ts +0 -75
- package/src/constructs/NextjsSite.ts +0 -1498
- package/src/constructs/Parameter.ts +0 -72
- package/src/constructs/Queue.ts +0 -360
- package/src/constructs/RDS.ts +0 -578
- package/src/constructs/ReactStaticSite.ts +0 -66
- package/src/constructs/RemixSite.ts +0 -1397
- package/src/constructs/Script/cfn-response.ts +0 -116
- package/src/constructs/Script/index.ts +0 -103
- package/src/constructs/Script/outbound.ts +0 -59
- package/src/constructs/Script/package.json +0 -3
- package/src/constructs/Script/util.ts +0 -19
- package/src/constructs/Script.ts +0 -270
- package/src/constructs/Secret.ts +0 -66
- package/src/constructs/Stack.ts +0 -319
- package/src/constructs/StaticSite.ts +0 -995
- package/src/constructs/Table.ts +0 -844
- package/src/constructs/Topic.ts +0 -486
- package/src/constructs/ViteStaticSite.ts +0 -99
- package/src/constructs/WebSocketApi.ts +0 -687
- package/src/constructs/context.ts +0 -12
- package/src/constructs/deferred_task.ts +0 -53
- package/src/constructs/descs.d.ts +0 -1
- package/src/constructs/index.ts +0 -39
- package/src/constructs/nextjs-site/cross-region-helper.ts +0 -189
- package/src/constructs/nextjs-site/custom-resource/cfn-response.ts +0 -146
- package/src/constructs/nextjs-site/custom-resource/edge-lambda-version.ts +0 -162
- package/src/constructs/nextjs-site/custom-resource/edge-lambda.ts +0 -167
- package/src/constructs/nextjs-site/custom-resource/s3-bucket.ts +0 -112
- package/src/constructs/nextjs-site/custom-resource/util.ts +0 -11
- package/src/constructs/util/apiGatewayV1AccessLog.ts +0 -106
- package/src/constructs/util/apiGatewayV2AccessLog.ts +0 -139
- package/src/constructs/util/apiGatewayV2Cors.ts +0 -94
- package/src/constructs/util/apiGatewayV2Domain.ts +0 -312
- package/src/constructs/util/appSyncApiDomain.ts +0 -204
- package/src/constructs/util/builder.ts +0 -17
- package/src/constructs/util/duration.ts +0 -27
- package/src/constructs/util/functionBinding.ts +0 -102
- package/src/constructs/util/functionUrlCors.ts +0 -96
- package/src/constructs/util/permission.ts +0 -299
- package/src/constructs/util/python/bundling.ts +0 -174
- package/src/constructs/util/size.ts +0 -13
- package/src/constructs/util/warning.ts +0 -20
- package/src/context/context.ts +0 -79
- package/src/context/handler.ts +0 -53
- package/src/context/index.ts +0 -2
- package/src/credentials.ts +0 -103
- package/src/error.ts +0 -5
- package/src/iot.ts +0 -105
- package/src/logger.ts +0 -35
- package/src/runtime/handlers.ts +0 -121
- package/src/runtime/iot.ts +0 -16
- package/src/runtime/node.ts +0 -111
- package/src/runtime/runtime.ts +0 -27
- package/src/runtime/server.ts +0 -149
- package/src/runtime/workers.ts +0 -96
- package/src/stacks/build.ts +0 -69
- package/src/stacks/deploy.ts +0 -232
- package/src/stacks/index.ts +0 -73
- package/src/stacks/metadata.ts +0 -125
- package/src/watcher.ts +0 -47
- package/sst.config.mjs +0 -6
- package/support/bridge/bridge.ts +0 -136
- package/support/bridge/build.mjs +0 -18
- package/support/custom-resources/auth-keys.ts +0 -113
- package/support/custom-resources/build.mjs +0 -18
- package/support/custom-resources/cfn-response.ts +0 -151
- package/support/custom-resources/index.ts +0 -18
- package/support/custom-resources/secrets-migration.ts +0 -82
- package/support/custom-resources/stack-metadata.ts +0 -75
- package/support/custom-resources/util.ts +0 -44
- package/support/nodejs-runtime/index.ts +0 -69
- package/support/tsconfig.json +0 -11
- package/tsconfig.json +0 -13
- package/yarn-error.log +0 -75
|
@@ -1,730 +0,0 @@
|
|
|
1
|
-
// Copied from https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk/lib/api/cloudformation-deployments.ts
|
|
2
|
-
|
|
3
|
-
import * as cxapi from "@aws-cdk/cx-api";
|
|
4
|
-
import { AssetManifest } from "cdk-assets";
|
|
5
|
-
import { Tag } from "aws-cdk/lib/cdk-toolkit.js";
|
|
6
|
-
import { debug, warning } from "aws-cdk/lib/logging.js";
|
|
7
|
-
import {
|
|
8
|
-
buildAssets,
|
|
9
|
-
publishAssets,
|
|
10
|
-
BuildAssetsOptions,
|
|
11
|
-
PublishAssetsOptions,
|
|
12
|
-
} from "aws-cdk/lib/util/asset-publishing.js";
|
|
13
|
-
import { Mode } from "aws-cdk/lib/api/aws-auth/credentials.js";
|
|
14
|
-
import { ISDK } from "aws-cdk/lib/api/aws-auth/sdk.js";
|
|
15
|
-
import { SdkProvider } from "aws-cdk/lib/api/aws-auth/sdk-provider.js";
|
|
16
|
-
import {
|
|
17
|
-
deployStack,
|
|
18
|
-
DeployStackResult,
|
|
19
|
-
destroyStack,
|
|
20
|
-
makeBodyParameterAndUpload,
|
|
21
|
-
DeploymentMethod,
|
|
22
|
-
} from "./deploy-stack.js";
|
|
23
|
-
import {
|
|
24
|
-
loadCurrentTemplateWithNestedStacks,
|
|
25
|
-
loadCurrentTemplate,
|
|
26
|
-
} from "aws-cdk/lib/api/nested-stack-helpers.js";
|
|
27
|
-
import { ToolkitInfo } from "aws-cdk/lib/api/toolkit-info.js";
|
|
28
|
-
import {
|
|
29
|
-
CloudFormationStack,
|
|
30
|
-
Template,
|
|
31
|
-
ResourcesToImport,
|
|
32
|
-
ResourceIdentifierSummaries,
|
|
33
|
-
} from "aws-cdk/lib/api/util/cloudformation.js";
|
|
34
|
-
import { StackActivityProgress } from "aws-cdk/lib/api/util/cloudformation/stack-activity-monitor";
|
|
35
|
-
import { replaceEnvPlaceholders } from "aws-cdk/lib/api/util/placeholders.js";
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* SDK obtained by assuming the lookup role
|
|
39
|
-
* for a given environment
|
|
40
|
-
*/
|
|
41
|
-
export interface PreparedSdkWithLookupRoleForEnvironment {
|
|
42
|
-
/**
|
|
43
|
-
* The SDK for the given environment
|
|
44
|
-
*/
|
|
45
|
-
readonly sdk: ISDK;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* The resolved environment for the stack
|
|
49
|
-
* (no more 'unknown-account/unknown-region')
|
|
50
|
-
*/
|
|
51
|
-
readonly resolvedEnvironment: cxapi.Environment;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Whether or not the assume role was successful.
|
|
55
|
-
* If the assume role was not successful (false)
|
|
56
|
-
* then that means that the 'sdk' returned contains
|
|
57
|
-
* the default credentials (not the assume role credentials)
|
|
58
|
-
*/
|
|
59
|
-
readonly didAssumeRole: boolean;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Try to use the bootstrap lookupRole. There are two scenarios that are handled here
|
|
64
|
-
* 1. The lookup role may not exist (it was added in bootstrap stack version 7)
|
|
65
|
-
* 2. The lookup role may not have the correct permissions (ReadOnlyAccess was added in
|
|
66
|
-
* bootstrap stack version 8)
|
|
67
|
-
*
|
|
68
|
-
* In the case of 1 (lookup role doesn't exist) `forEnvironment` will either:
|
|
69
|
-
* 1. Return the default credentials if the default credentials are for the stack account
|
|
70
|
-
* 2. Throw an error if the default credentials are not for the stack account.
|
|
71
|
-
*
|
|
72
|
-
* If we successfully assume the lookup role we then proceed to 2 and check whether the bootstrap
|
|
73
|
-
* stack version is valid. If it is not we throw an error which should be handled in the calling
|
|
74
|
-
* function (and fallback to use a different role, etc)
|
|
75
|
-
*
|
|
76
|
-
* If we do not successfully assume the lookup role, but do get back the default credentials
|
|
77
|
-
* then return those and note that we are returning the default credentials. The calling
|
|
78
|
-
* function can then decide to use them or fallback to another role.
|
|
79
|
-
*/
|
|
80
|
-
export async function prepareSdkWithLookupRoleFor(
|
|
81
|
-
sdkProvider: SdkProvider,
|
|
82
|
-
stack: cxapi.CloudFormationStackArtifact
|
|
83
|
-
): Promise<PreparedSdkWithLookupRoleForEnvironment> {
|
|
84
|
-
const resolvedEnvironment = await sdkProvider.resolveEnvironment(
|
|
85
|
-
stack.environment
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
// Substitute any placeholders with information about the current environment
|
|
89
|
-
const arns = await replaceEnvPlaceholders(
|
|
90
|
-
{
|
|
91
|
-
lookupRoleArn: stack.lookupRole?.arn,
|
|
92
|
-
},
|
|
93
|
-
resolvedEnvironment,
|
|
94
|
-
sdkProvider
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
// try to assume the lookup role
|
|
98
|
-
const warningMessage = `Could not assume ${arns.lookupRoleArn}, proceeding anyway.`;
|
|
99
|
-
const upgradeMessage = `(To get rid of this warning, please upgrade to bootstrap version >= ${stack.lookupRole?.requiresBootstrapStackVersion})`;
|
|
100
|
-
try {
|
|
101
|
-
const stackSdk = await sdkProvider.forEnvironment(
|
|
102
|
-
resolvedEnvironment,
|
|
103
|
-
Mode.ForReading,
|
|
104
|
-
{
|
|
105
|
-
assumeRoleArn: arns.lookupRoleArn,
|
|
106
|
-
assumeRoleExternalId: stack.lookupRole?.assumeRoleExternalId,
|
|
107
|
-
}
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
// if we succeed in assuming the lookup role, make sure we have the correct bootstrap stack version
|
|
111
|
-
if (
|
|
112
|
-
stackSdk.didAssumeRole &&
|
|
113
|
-
stack.lookupRole?.bootstrapStackVersionSsmParameter &&
|
|
114
|
-
stack.lookupRole.requiresBootstrapStackVersion
|
|
115
|
-
) {
|
|
116
|
-
const version = await ToolkitInfo.versionFromSsmParameter(
|
|
117
|
-
stackSdk.sdk,
|
|
118
|
-
stack.lookupRole.bootstrapStackVersionSsmParameter
|
|
119
|
-
);
|
|
120
|
-
if (version < stack.lookupRole.requiresBootstrapStackVersion) {
|
|
121
|
-
throw new Error(
|
|
122
|
-
`Bootstrap stack version '${stack.lookupRole.requiresBootstrapStackVersion}' is required, found version '${version}'.`
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
// we may not have assumed the lookup role because one was not provided
|
|
126
|
-
// if that is the case then don't print the upgrade warning
|
|
127
|
-
} else if (
|
|
128
|
-
!stackSdk.didAssumeRole &&
|
|
129
|
-
stack.lookupRole?.requiresBootstrapStackVersion
|
|
130
|
-
) {
|
|
131
|
-
warning(upgradeMessage);
|
|
132
|
-
}
|
|
133
|
-
return { ...stackSdk, resolvedEnvironment };
|
|
134
|
-
} catch (e: any) {
|
|
135
|
-
debug(e);
|
|
136
|
-
// only print out the warnings if the lookupRole exists AND there is a required
|
|
137
|
-
// bootstrap version, otherwise the warnings will print `undefined`
|
|
138
|
-
if (stack.lookupRole && stack.lookupRole.requiresBootstrapStackVersion) {
|
|
139
|
-
warning(warningMessage);
|
|
140
|
-
warning(upgradeMessage);
|
|
141
|
-
}
|
|
142
|
-
throw e;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export interface DeployStackOptions {
|
|
147
|
-
/**
|
|
148
|
-
* Stack to deploy
|
|
149
|
-
*/
|
|
150
|
-
readonly stack: cxapi.CloudFormationStackArtifact;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Execution role for the deployment (pass through to CloudFormation)
|
|
154
|
-
*
|
|
155
|
-
* @default - Current role
|
|
156
|
-
*/
|
|
157
|
-
readonly roleArn?: string;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Topic ARNs to send a message when deployment finishes (pass through to CloudFormation)
|
|
161
|
-
*
|
|
162
|
-
* @default - No notifications
|
|
163
|
-
*/
|
|
164
|
-
readonly notificationArns?: string[];
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Override name under which stack will be deployed
|
|
168
|
-
*
|
|
169
|
-
* @default - Use artifact default
|
|
170
|
-
*/
|
|
171
|
-
readonly deployName?: string;
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Don't show stack deployment events, just wait
|
|
175
|
-
*
|
|
176
|
-
* @default false
|
|
177
|
-
*/
|
|
178
|
-
readonly quiet?: boolean;
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Name of the toolkit stack, if not the default name
|
|
182
|
-
*
|
|
183
|
-
* @default 'CDKToolkit'
|
|
184
|
-
*/
|
|
185
|
-
readonly toolkitStackName?: string;
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* List of asset IDs which should NOT be built or uploaded
|
|
189
|
-
*
|
|
190
|
-
* @default - Build all assets
|
|
191
|
-
*/
|
|
192
|
-
readonly reuseAssets?: string[];
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Stack tags (pass through to CloudFormation)
|
|
196
|
-
*/
|
|
197
|
-
readonly tags?: Tag[];
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Stage the change set but don't execute it
|
|
201
|
-
*
|
|
202
|
-
* @default - true
|
|
203
|
-
* @deprecated Use 'deploymentMethod' instead
|
|
204
|
-
*/
|
|
205
|
-
readonly execute?: boolean;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Optional name to use for the CloudFormation change set.
|
|
209
|
-
* If not provided, a name will be generated automatically.
|
|
210
|
-
*
|
|
211
|
-
* @deprecated Use 'deploymentMethod' instead
|
|
212
|
-
*/
|
|
213
|
-
readonly changeSetName?: string;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Select the deployment method (direct or using a change set)
|
|
217
|
-
*
|
|
218
|
-
* @default - Change set with default options
|
|
219
|
-
*/
|
|
220
|
-
readonly deploymentMethod?: DeploymentMethod;
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Force deployment, even if the deployed template is identical to the one we are about to deploy.
|
|
224
|
-
* @default false deployment will be skipped if the template is identical
|
|
225
|
-
*/
|
|
226
|
-
readonly force?: boolean;
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Extra parameters for CloudFormation
|
|
230
|
-
* @default - no additional parameters will be passed to the template
|
|
231
|
-
*/
|
|
232
|
-
readonly parameters?: { [name: string]: string | undefined };
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Use previous values for unspecified parameters
|
|
236
|
-
*
|
|
237
|
-
* If not set, all parameters must be specified for every deployment.
|
|
238
|
-
*
|
|
239
|
-
* @default true
|
|
240
|
-
*/
|
|
241
|
-
readonly usePreviousParameters?: boolean;
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Display mode for stack deployment progress.
|
|
245
|
-
*
|
|
246
|
-
* @default - StackActivityProgress.Bar - stack events will be displayed for
|
|
247
|
-
* the resource currently being deployed.
|
|
248
|
-
*/
|
|
249
|
-
readonly progress?: StackActivityProgress;
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Whether we are on a CI system
|
|
253
|
-
*
|
|
254
|
-
* @default false
|
|
255
|
-
*/
|
|
256
|
-
readonly ci?: boolean;
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Rollback failed deployments
|
|
260
|
-
*
|
|
261
|
-
* @default true
|
|
262
|
-
*/
|
|
263
|
-
readonly rollback?: boolean;
|
|
264
|
-
|
|
265
|
-
/*
|
|
266
|
-
* Whether to perform a 'hotswap' deployment.
|
|
267
|
-
* A 'hotswap' deployment will attempt to short-circuit CloudFormation
|
|
268
|
-
* and update the affected resources like Lambda functions directly.
|
|
269
|
-
*
|
|
270
|
-
* @default - false for regular deployments, true for 'watch' deployments
|
|
271
|
-
*/
|
|
272
|
-
readonly hotswap?: boolean;
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* The extra string to append to the User-Agent header when performing AWS SDK calls.
|
|
276
|
-
*
|
|
277
|
-
* @default - nothing extra is appended to the User-Agent header
|
|
278
|
-
*/
|
|
279
|
-
readonly extraUserAgent?: string;
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* List of existing resources to be IMPORTED into the stack, instead of being CREATED
|
|
283
|
-
*/
|
|
284
|
-
readonly resourcesToImport?: ResourcesToImport;
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* If present, use this given template instead of the stored one
|
|
288
|
-
*
|
|
289
|
-
* @default - Use the stored template
|
|
290
|
-
*/
|
|
291
|
-
readonly overrideTemplate?: any;
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Whether to build assets before publishing.
|
|
295
|
-
*
|
|
296
|
-
* @default true To remain backward compatible.
|
|
297
|
-
*/
|
|
298
|
-
readonly buildAssets?: boolean;
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Whether to build/publish assets in parallel
|
|
302
|
-
*
|
|
303
|
-
* @default true To remain backward compatible.
|
|
304
|
-
*/
|
|
305
|
-
readonly assetParallelism?: boolean;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
export interface BuildStackAssetsOptions {
|
|
309
|
-
/**
|
|
310
|
-
* Stack with assets to build.
|
|
311
|
-
*/
|
|
312
|
-
readonly stack: cxapi.CloudFormationStackArtifact;
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Name of the toolkit stack, if not the default name.
|
|
316
|
-
*
|
|
317
|
-
* @default 'CDKToolkit'
|
|
318
|
-
*/
|
|
319
|
-
readonly toolkitStackName?: string;
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Execution role for the building.
|
|
323
|
-
*
|
|
324
|
-
* @default - Current role
|
|
325
|
-
*/
|
|
326
|
-
readonly roleArn?: string;
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Options to pass on to `buildAsests()` function
|
|
330
|
-
*/
|
|
331
|
-
readonly buildOptions?: BuildAssetsOptions;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
interface PublishStackAssetsOptions {
|
|
335
|
-
/**
|
|
336
|
-
* Whether to build assets before publishing.
|
|
337
|
-
*
|
|
338
|
-
* @default true To remain backward compatible.
|
|
339
|
-
*/
|
|
340
|
-
readonly buildAssets?: boolean;
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Options to pass on to `publishAsests()` function
|
|
344
|
-
*/
|
|
345
|
-
readonly publishOptions?: Omit<PublishAssetsOptions, "buildAssets">;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
export interface DestroyStackOptions {
|
|
349
|
-
stack: cxapi.CloudFormationStackArtifact;
|
|
350
|
-
deployName?: string;
|
|
351
|
-
roleArn?: string;
|
|
352
|
-
quiet?: boolean;
|
|
353
|
-
force?: boolean;
|
|
354
|
-
ci?: boolean;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
export interface StackExistsOptions {
|
|
358
|
-
stack: cxapi.CloudFormationStackArtifact;
|
|
359
|
-
deployName?: string;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
export interface ProvisionerProps {
|
|
363
|
-
sdkProvider: SdkProvider;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* SDK obtained by assuming the deploy role
|
|
368
|
-
* for a given environment
|
|
369
|
-
*/
|
|
370
|
-
export interface PreparedSdkForEnvironment {
|
|
371
|
-
/**
|
|
372
|
-
* The SDK for the given environment
|
|
373
|
-
*/
|
|
374
|
-
readonly stackSdk: ISDK;
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* The resolved environment for the stack
|
|
378
|
-
* (no more 'unknown-account/unknown-region')
|
|
379
|
-
*/
|
|
380
|
-
readonly resolvedEnvironment: cxapi.Environment;
|
|
381
|
-
/**
|
|
382
|
-
* The Execution Role that should be passed to CloudFormation.
|
|
383
|
-
*
|
|
384
|
-
* @default - no execution role is used
|
|
385
|
-
*/
|
|
386
|
-
readonly cloudFormationRoleArn?: string;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Helper class for CloudFormation deployments
|
|
391
|
-
*
|
|
392
|
-
* Looks us the right SDK and Bootstrap stack to deploy a given
|
|
393
|
-
* stack artifact.
|
|
394
|
-
*/
|
|
395
|
-
export class CloudFormationDeployments {
|
|
396
|
-
private readonly sdkProvider: SdkProvider;
|
|
397
|
-
|
|
398
|
-
constructor(props: ProvisionerProps) {
|
|
399
|
-
this.sdkProvider = props.sdkProvider;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
public async readCurrentTemplateWithNestedStacks(
|
|
403
|
-
rootStackArtifact: cxapi.CloudFormationStackArtifact,
|
|
404
|
-
retrieveProcessedTemplate: boolean = false
|
|
405
|
-
): Promise<Template> {
|
|
406
|
-
const sdk = (await this.prepareSdkWithLookupOrDeployRole(rootStackArtifact))
|
|
407
|
-
.stackSdk;
|
|
408
|
-
return (
|
|
409
|
-
await loadCurrentTemplateWithNestedStacks(
|
|
410
|
-
rootStackArtifact,
|
|
411
|
-
sdk,
|
|
412
|
-
retrieveProcessedTemplate
|
|
413
|
-
)
|
|
414
|
-
).deployedTemplate;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
public async readCurrentTemplate(
|
|
418
|
-
stackArtifact: cxapi.CloudFormationStackArtifact
|
|
419
|
-
): Promise<Template> {
|
|
420
|
-
debug(`Reading existing template for stack ${stackArtifact.displayName}.`);
|
|
421
|
-
const sdk = (await this.prepareSdkWithLookupOrDeployRole(stackArtifact))
|
|
422
|
-
.stackSdk;
|
|
423
|
-
return loadCurrentTemplate(stackArtifact, sdk);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
public async resourceIdentifierSummaries(
|
|
427
|
-
stackArtifact: cxapi.CloudFormationStackArtifact,
|
|
428
|
-
toolkitStackName?: string
|
|
429
|
-
): Promise<ResourceIdentifierSummaries> {
|
|
430
|
-
debug(
|
|
431
|
-
`Retrieving template summary for stack ${stackArtifact.displayName}.`
|
|
432
|
-
);
|
|
433
|
-
// Currently, needs to use `deploy-role` since it may need to read templates in the staging
|
|
434
|
-
// bucket which have been encrypted with a KMS key (and lookup-role may not read encrypted things)
|
|
435
|
-
const { stackSdk, resolvedEnvironment } = await this.prepareSdkFor(
|
|
436
|
-
stackArtifact,
|
|
437
|
-
undefined,
|
|
438
|
-
Mode.ForReading
|
|
439
|
-
);
|
|
440
|
-
const cfn = stackSdk.cloudFormation();
|
|
441
|
-
|
|
442
|
-
const toolkitInfo = await ToolkitInfo.lookup(
|
|
443
|
-
resolvedEnvironment,
|
|
444
|
-
stackSdk,
|
|
445
|
-
toolkitStackName
|
|
446
|
-
);
|
|
447
|
-
|
|
448
|
-
// Upload the template, if necessary, before passing it to CFN
|
|
449
|
-
const cfnParam = await makeBodyParameterAndUpload(
|
|
450
|
-
stackArtifact,
|
|
451
|
-
resolvedEnvironment,
|
|
452
|
-
toolkitInfo,
|
|
453
|
-
this.sdkProvider,
|
|
454
|
-
stackSdk
|
|
455
|
-
);
|
|
456
|
-
|
|
457
|
-
const response = await cfn.getTemplateSummary(cfnParam).promise();
|
|
458
|
-
if (!response.ResourceIdentifierSummaries) {
|
|
459
|
-
debug(
|
|
460
|
-
'GetTemplateSummary API call did not return "ResourceIdentifierSummaries"'
|
|
461
|
-
);
|
|
462
|
-
}
|
|
463
|
-
return response.ResourceIdentifierSummaries ?? [];
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
public async deployStack(
|
|
467
|
-
options: DeployStackOptions
|
|
468
|
-
): Promise<DeployStackResult | undefined> {
|
|
469
|
-
let deploymentMethod = options.deploymentMethod;
|
|
470
|
-
if (options.changeSetName || options.execute !== undefined) {
|
|
471
|
-
if (deploymentMethod) {
|
|
472
|
-
throw new Error(
|
|
473
|
-
"You cannot supply both 'deploymentMethod' and 'changeSetName/execute'. Supply one or the other."
|
|
474
|
-
);
|
|
475
|
-
}
|
|
476
|
-
deploymentMethod = {
|
|
477
|
-
method: "change-set",
|
|
478
|
-
changeSetName: options.changeSetName,
|
|
479
|
-
execute: options.execute,
|
|
480
|
-
};
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
const { stackSdk, resolvedEnvironment, cloudFormationRoleArn } =
|
|
484
|
-
await this.prepareSdkFor(options.stack, options.roleArn);
|
|
485
|
-
|
|
486
|
-
const toolkitInfo = await ToolkitInfo.lookup(
|
|
487
|
-
resolvedEnvironment,
|
|
488
|
-
stackSdk,
|
|
489
|
-
options.toolkitStackName
|
|
490
|
-
);
|
|
491
|
-
|
|
492
|
-
// Publish any assets before doing the actual deploy (do not publish any assets on import operation)
|
|
493
|
-
if (options.resourcesToImport === undefined) {
|
|
494
|
-
await this.publishStackAssets(options.stack, toolkitInfo, {
|
|
495
|
-
buildAssets: options.buildAssets ?? true,
|
|
496
|
-
publishOptions: {
|
|
497
|
-
quiet: options.quiet,
|
|
498
|
-
parallel: options.assetParallelism,
|
|
499
|
-
},
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
// Do a verification of the bootstrap stack version
|
|
504
|
-
await this.validateBootstrapStackVersion(
|
|
505
|
-
options.stack.stackName,
|
|
506
|
-
options.stack.requiresBootstrapStackVersion,
|
|
507
|
-
options.stack.bootstrapStackVersionSsmParameter,
|
|
508
|
-
toolkitInfo
|
|
509
|
-
);
|
|
510
|
-
|
|
511
|
-
return deployStack({
|
|
512
|
-
stack: options.stack,
|
|
513
|
-
noMonitor: true,
|
|
514
|
-
resolvedEnvironment,
|
|
515
|
-
deployName: options.deployName,
|
|
516
|
-
notificationArns: options.notificationArns,
|
|
517
|
-
quiet: options.quiet,
|
|
518
|
-
sdk: stackSdk,
|
|
519
|
-
sdkProvider: this.sdkProvider,
|
|
520
|
-
roleArn: cloudFormationRoleArn,
|
|
521
|
-
reuseAssets: options.reuseAssets,
|
|
522
|
-
toolkitInfo,
|
|
523
|
-
tags: options.tags,
|
|
524
|
-
deploymentMethod,
|
|
525
|
-
force: options.force,
|
|
526
|
-
parameters: options.parameters,
|
|
527
|
-
usePreviousParameters: options.usePreviousParameters,
|
|
528
|
-
progress: options.progress,
|
|
529
|
-
ci: options.ci,
|
|
530
|
-
rollback: options.rollback,
|
|
531
|
-
hotswap: options.hotswap,
|
|
532
|
-
extraUserAgent: options.extraUserAgent,
|
|
533
|
-
resourcesToImport: options.resourcesToImport,
|
|
534
|
-
overrideTemplate: options.overrideTemplate,
|
|
535
|
-
assetParallelism: options.assetParallelism,
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
public async destroyStack(options: DestroyStackOptions): Promise<void> {
|
|
540
|
-
const { stackSdk, cloudFormationRoleArn: roleArn } =
|
|
541
|
-
await this.prepareSdkFor(options.stack, options.roleArn);
|
|
542
|
-
|
|
543
|
-
return destroyStack({
|
|
544
|
-
sdk: stackSdk,
|
|
545
|
-
roleArn,
|
|
546
|
-
stack: options.stack,
|
|
547
|
-
deployName: options.deployName,
|
|
548
|
-
quiet: options.quiet,
|
|
549
|
-
ci: options.ci,
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
public async stackExists(options: StackExistsOptions): Promise<boolean> {
|
|
554
|
-
const { stackSdk } = await this.prepareSdkFor(
|
|
555
|
-
options.stack,
|
|
556
|
-
undefined,
|
|
557
|
-
Mode.ForReading
|
|
558
|
-
);
|
|
559
|
-
const stack = await CloudFormationStack.lookup(
|
|
560
|
-
stackSdk.cloudFormation(),
|
|
561
|
-
options.deployName ?? options.stack.stackName
|
|
562
|
-
);
|
|
563
|
-
return stack.exists;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
private async prepareSdkWithLookupOrDeployRole(
|
|
567
|
-
stackArtifact: cxapi.CloudFormationStackArtifact
|
|
568
|
-
): Promise<PreparedSdkForEnvironment> {
|
|
569
|
-
// try to assume the lookup role
|
|
570
|
-
try {
|
|
571
|
-
const result = await prepareSdkWithLookupRoleFor(
|
|
572
|
-
this.sdkProvider,
|
|
573
|
-
stackArtifact
|
|
574
|
-
);
|
|
575
|
-
if (result.didAssumeRole) {
|
|
576
|
-
return {
|
|
577
|
-
resolvedEnvironment: result.resolvedEnvironment,
|
|
578
|
-
stackSdk: result.sdk,
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
} catch {}
|
|
582
|
-
// fall back to the deploy role
|
|
583
|
-
return this.prepareSdkFor(stackArtifact, undefined, Mode.ForReading);
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
/**
|
|
587
|
-
* Get the environment necessary for touching the given stack
|
|
588
|
-
*
|
|
589
|
-
* Returns the following:
|
|
590
|
-
*
|
|
591
|
-
* - The resolved environment for the stack (no more 'unknown-account/unknown-region')
|
|
592
|
-
* - SDK loaded with the right credentials for calling `CreateChangeSet`.
|
|
593
|
-
* - The Execution Role that should be passed to CloudFormation.
|
|
594
|
-
*/
|
|
595
|
-
private async prepareSdkFor(
|
|
596
|
-
stack: cxapi.CloudFormationStackArtifact,
|
|
597
|
-
roleArn?: string,
|
|
598
|
-
mode = Mode.ForWriting
|
|
599
|
-
): Promise<PreparedSdkForEnvironment> {
|
|
600
|
-
if (!stack.environment) {
|
|
601
|
-
throw new Error(
|
|
602
|
-
`The stack ${stack.displayName} does not have an environment`
|
|
603
|
-
);
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
const resolvedEnvironment = await this.sdkProvider.resolveEnvironment(
|
|
607
|
-
stack.environment
|
|
608
|
-
);
|
|
609
|
-
|
|
610
|
-
// Substitute any placeholders with information about the current environment
|
|
611
|
-
const arns = await replaceEnvPlaceholders(
|
|
612
|
-
{
|
|
613
|
-
assumeRoleArn: stack.assumeRoleArn,
|
|
614
|
-
|
|
615
|
-
// Use the override if given, otherwise use the field from the stack
|
|
616
|
-
cloudFormationRoleArn: roleArn ?? stack.cloudFormationExecutionRoleArn,
|
|
617
|
-
},
|
|
618
|
-
resolvedEnvironment,
|
|
619
|
-
this.sdkProvider
|
|
620
|
-
);
|
|
621
|
-
|
|
622
|
-
const stackSdk = await this.sdkProvider.forEnvironment(
|
|
623
|
-
resolvedEnvironment,
|
|
624
|
-
mode,
|
|
625
|
-
{
|
|
626
|
-
assumeRoleArn: arns.assumeRoleArn,
|
|
627
|
-
assumeRoleExternalId: stack.assumeRoleExternalId,
|
|
628
|
-
}
|
|
629
|
-
);
|
|
630
|
-
|
|
631
|
-
return {
|
|
632
|
-
stackSdk: stackSdk.sdk,
|
|
633
|
-
resolvedEnvironment,
|
|
634
|
-
cloudFormationRoleArn: arns.cloudFormationRoleArn,
|
|
635
|
-
};
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
* Build a stack's assets.
|
|
640
|
-
*/
|
|
641
|
-
public async buildStackAssets(options: BuildStackAssetsOptions) {
|
|
642
|
-
const { stackSdk, resolvedEnvironment } = await this.prepareSdkFor(
|
|
643
|
-
options.stack,
|
|
644
|
-
options.roleArn
|
|
645
|
-
);
|
|
646
|
-
const toolkitInfo = await ToolkitInfo.lookup(
|
|
647
|
-
resolvedEnvironment,
|
|
648
|
-
stackSdk,
|
|
649
|
-
options.toolkitStackName
|
|
650
|
-
);
|
|
651
|
-
|
|
652
|
-
const stackEnv = await this.sdkProvider.resolveEnvironment(
|
|
653
|
-
options.stack.environment
|
|
654
|
-
);
|
|
655
|
-
const assetArtifacts = options.stack.dependencies.filter(
|
|
656
|
-
cxapi.AssetManifestArtifact.isAssetManifestArtifact
|
|
657
|
-
);
|
|
658
|
-
|
|
659
|
-
for (const assetArtifact of assetArtifacts) {
|
|
660
|
-
await this.validateBootstrapStackVersion(
|
|
661
|
-
options.stack.stackName,
|
|
662
|
-
assetArtifact.requiresBootstrapStackVersion,
|
|
663
|
-
assetArtifact.bootstrapStackVersionSsmParameter,
|
|
664
|
-
toolkitInfo
|
|
665
|
-
);
|
|
666
|
-
|
|
667
|
-
const manifest = AssetManifest.fromFile(assetArtifact.file);
|
|
668
|
-
await buildAssets(
|
|
669
|
-
manifest,
|
|
670
|
-
this.sdkProvider,
|
|
671
|
-
stackEnv,
|
|
672
|
-
options.buildOptions
|
|
673
|
-
);
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
/**
|
|
678
|
-
* Publish all asset manifests that are referenced by the given stack
|
|
679
|
-
*/
|
|
680
|
-
private async publishStackAssets(
|
|
681
|
-
stack: cxapi.CloudFormationStackArtifact,
|
|
682
|
-
toolkitInfo: ToolkitInfo,
|
|
683
|
-
options: PublishStackAssetsOptions = {}
|
|
684
|
-
) {
|
|
685
|
-
const stackEnv = await this.sdkProvider.resolveEnvironment(
|
|
686
|
-
stack.environment
|
|
687
|
-
);
|
|
688
|
-
const assetArtifacts = stack.dependencies.filter(
|
|
689
|
-
cxapi.AssetManifestArtifact.isAssetManifestArtifact
|
|
690
|
-
);
|
|
691
|
-
|
|
692
|
-
for (const assetArtifact of assetArtifacts) {
|
|
693
|
-
await this.validateBootstrapStackVersion(
|
|
694
|
-
stack.stackName,
|
|
695
|
-
assetArtifact.requiresBootstrapStackVersion,
|
|
696
|
-
assetArtifact.bootstrapStackVersionSsmParameter,
|
|
697
|
-
toolkitInfo
|
|
698
|
-
);
|
|
699
|
-
|
|
700
|
-
const manifest = AssetManifest.fromFile(assetArtifact.file);
|
|
701
|
-
await publishAssets(manifest, this.sdkProvider, stackEnv, {
|
|
702
|
-
...options.publishOptions,
|
|
703
|
-
buildAssets: options.buildAssets ?? true,
|
|
704
|
-
});
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
/**
|
|
709
|
-
* Validate that the bootstrap stack has the right version for this stack
|
|
710
|
-
*/
|
|
711
|
-
private async validateBootstrapStackVersion(
|
|
712
|
-
stackName: string,
|
|
713
|
-
requiresBootstrapStackVersion: number | undefined,
|
|
714
|
-
bootstrapStackVersionSsmParameter: string | undefined,
|
|
715
|
-
toolkitInfo: ToolkitInfo
|
|
716
|
-
) {
|
|
717
|
-
if (requiresBootstrapStackVersion === undefined) {
|
|
718
|
-
return;
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
try {
|
|
722
|
-
await toolkitInfo.validateVersion(
|
|
723
|
-
requiresBootstrapStackVersion,
|
|
724
|
-
bootstrapStackVersionSsmParameter
|
|
725
|
-
);
|
|
726
|
-
} catch (e: any) {
|
|
727
|
-
throw new Error(`${stackName}: ${e.message}`);
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
}
|