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,77 +0,0 @@
|
|
|
1
|
-
import { Construct } from "constructs";
|
|
2
|
-
import * as cdk from "aws-cdk-lib";
|
|
3
|
-
import { Function as Fn } from "aws-cdk-lib/aws-lambda";
|
|
4
|
-
import { Stack } from "./Stack.js";
|
|
5
|
-
import { FunctionBindingProps } from "./util/functionBinding.js";
|
|
6
|
-
|
|
7
|
-
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
|
8
|
-
|
|
9
|
-
export interface SSTConstructMetadata<
|
|
10
|
-
T extends string = string,
|
|
11
|
-
D extends Record<string, any> = Record<string, any>,
|
|
12
|
-
L extends Record<string, any> = Record<string, any>
|
|
13
|
-
> {
|
|
14
|
-
type: T;
|
|
15
|
-
data: D;
|
|
16
|
-
local?: L;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface SSTConstruct extends Construct {
|
|
20
|
-
id: string;
|
|
21
|
-
getConstructMetadata(): SSTConstructMetadata;
|
|
22
|
-
getFunctionBinding(): FunctionBindingProps | undefined;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function getFunctionRef(fn?: any) {
|
|
26
|
-
if (!fn) return undefined;
|
|
27
|
-
if (!(fn instanceof Fn)) return undefined;
|
|
28
|
-
return {
|
|
29
|
-
node: fn.node.addr,
|
|
30
|
-
stack: Stack.of(fn).node.id,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function isConstruct(construct: any) {
|
|
35
|
-
return isSSTConstruct(construct) || isCDKConstruct(construct);
|
|
36
|
-
}
|
|
37
|
-
export function isStackConstruct(construct: any): construct is cdk.Stack {
|
|
38
|
-
return isCDKConstructOf(construct, "aws-cdk-lib.Stack");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function isSSTConstruct(construct: any): construct is SSTConstruct {
|
|
42
|
-
return typeof construct === "object" && "getConstructMetadata" in construct;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function isSSTDebugStack(construct: any): construct is cdk.Stack {
|
|
46
|
-
return (
|
|
47
|
-
isStackConstruct(construct) && construct.constructor.name === "DebugStack"
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function isCDKConstructOf(
|
|
52
|
-
construct: any,
|
|
53
|
-
moduleName: string
|
|
54
|
-
): construct is Construct {
|
|
55
|
-
// We need to check if construct is an CDK construct. To do that:
|
|
56
|
-
// - we cannot use the `construct instanceof` check because ie. the PolicyStatement
|
|
57
|
-
// instance in the user's app might come from a different npm package version
|
|
58
|
-
// - we cannot use the `construct.constructor.name` check because the constructor
|
|
59
|
-
// name can be prefixed with a number ie. PolicyStatement2
|
|
60
|
-
//
|
|
61
|
-
// Therefore we are going to get the constructor's fqn. The constructor for a CDK
|
|
62
|
-
// construct looks like:
|
|
63
|
-
// [class Bucket2 extends BucketBase] {
|
|
64
|
-
// [Symbol(jsii.rtti)]: { fqn: '@aws-cdk/aws-s3.Bucket', version: '1.91.0' }
|
|
65
|
-
// }
|
|
66
|
-
// We will check against `fqn`.
|
|
67
|
-
const fqn = construct?.constructor?.[JSII_RTTI_SYMBOL_1]?.fqn;
|
|
68
|
-
return typeof fqn === "string" && fqn === moduleName;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function isCDKConstruct(construct: any): construct is Construct {
|
|
72
|
-
const fqn = construct?.constructor?.[JSII_RTTI_SYMBOL_1]?.fqn;
|
|
73
|
-
return (
|
|
74
|
-
typeof fqn === "string" &&
|
|
75
|
-
(fqn.startsWith("@aws-cdk/") || fqn.startsWith("aws-cdk-lib"))
|
|
76
|
-
);
|
|
77
|
-
}
|
package/src/constructs/Cron.ts
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
import { Construct } from "constructs";
|
|
2
|
-
import * as events from "aws-cdk-lib/aws-events";
|
|
3
|
-
import * as eventsTargets from "aws-cdk-lib/aws-events-targets";
|
|
4
|
-
|
|
5
|
-
import { getFunctionRef, SSTConstruct } from "./Construct.js";
|
|
6
|
-
import {
|
|
7
|
-
Function as Func,
|
|
8
|
-
FunctionInlineDefinition,
|
|
9
|
-
FunctionDefinition,
|
|
10
|
-
} from "./Function.js";
|
|
11
|
-
import { Permissions } from "./util/permission.js";
|
|
12
|
-
|
|
13
|
-
export interface CronJobProps {
|
|
14
|
-
/**
|
|
15
|
-
* The function that will be executed when the job runs.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```js
|
|
19
|
-
* new Cron(stack, "Cron", {
|
|
20
|
-
* job: {
|
|
21
|
-
* function: "src/lambda.main",
|
|
22
|
-
* },
|
|
23
|
-
* });
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
function: FunctionDefinition;
|
|
27
|
-
cdk?: {
|
|
28
|
-
/**
|
|
29
|
-
* Override the default settings this construct uses internally to create the events rule.
|
|
30
|
-
*/
|
|
31
|
-
target?: eventsTargets.LambdaFunctionProps;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface CronProps {
|
|
36
|
-
/**
|
|
37
|
-
* The definition of the function to be executed.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```js
|
|
41
|
-
* new Cron(stack, "Cron", {
|
|
42
|
-
* job : "src/lambda.main",
|
|
43
|
-
* schedule: "rate(5 minutes)",
|
|
44
|
-
* })
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
job: FunctionInlineDefinition | CronJobProps;
|
|
48
|
-
/**
|
|
49
|
-
* The schedule for the cron job.
|
|
50
|
-
*
|
|
51
|
-
* The string format takes a [rate expression](https://docs.aws.amazon.com/lambda/latest/dg/services-cloudwatchevents-expressions.html).
|
|
52
|
-
*
|
|
53
|
-
* ```txt
|
|
54
|
-
* rate(1 minute)
|
|
55
|
-
* rate(5 minutes)
|
|
56
|
-
* rate(1 hour)
|
|
57
|
-
* rate(5 hours)
|
|
58
|
-
* rate(1 day)
|
|
59
|
-
* rate(5 days)
|
|
60
|
-
* ```
|
|
61
|
-
* Or as a [cron expression](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-rule-schedule.html#eb-cron-expressions).
|
|
62
|
-
*
|
|
63
|
-
* ```txt
|
|
64
|
-
* cron(15 10 * * ? *) // 10:15 AM (UTC) every day.
|
|
65
|
-
* ```
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* ```js
|
|
69
|
-
* new Cron(stack, "Cron", {
|
|
70
|
-
* job: "src/lambda.main",
|
|
71
|
-
* schedule: "rate(5 minutes)",
|
|
72
|
-
* });
|
|
73
|
-
* ```
|
|
74
|
-
* ```js
|
|
75
|
-
* new Cron(stack, "Cron", {
|
|
76
|
-
* job: "src/lambda.main",
|
|
77
|
-
* schedule: "cron(15 10 * * ? *)",
|
|
78
|
-
* });
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
schedule?: `rate(${string})` | `cron(${string})`;
|
|
82
|
-
/**
|
|
83
|
-
* Indicates whether the cron job is enabled.
|
|
84
|
-
* @default true
|
|
85
|
-
* @example
|
|
86
|
-
* ```js
|
|
87
|
-
* new Cron(stack, "Cron", {
|
|
88
|
-
* job: "src/lambda.main",
|
|
89
|
-
* schedule: "rate(5 minutes)",
|
|
90
|
-
* enabled: app.local,
|
|
91
|
-
* })
|
|
92
|
-
* ```
|
|
93
|
-
*/
|
|
94
|
-
enabled?: boolean;
|
|
95
|
-
cdk?: {
|
|
96
|
-
/**
|
|
97
|
-
* Allows you to override default id for this construct.
|
|
98
|
-
*/
|
|
99
|
-
id?: string;
|
|
100
|
-
/**
|
|
101
|
-
* Override the default settings this construct uses internally to create the events rule.
|
|
102
|
-
*/
|
|
103
|
-
rule?: events.RuleProps;
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/////////////////////
|
|
108
|
-
// Construct
|
|
109
|
-
/////////////////////
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* The `Cron` construct is a higher level CDK construct that makes it easy to create a cron job.
|
|
113
|
-
*
|
|
114
|
-
* @example
|
|
115
|
-
*
|
|
116
|
-
* ```js
|
|
117
|
-
* import { Cron } from "@serverless-stack/resources";
|
|
118
|
-
*
|
|
119
|
-
* new Cron(stack, "Cron", {
|
|
120
|
-
* schedule: "rate(1 minute)",
|
|
121
|
-
* job: "src/lambda.main",
|
|
122
|
-
* });
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
125
|
-
export class Cron extends Construct implements SSTConstruct {
|
|
126
|
-
public readonly id: string;
|
|
127
|
-
public readonly cdk: {
|
|
128
|
-
/**
|
|
129
|
-
* The internally created CDK EventBridge Rule instance.
|
|
130
|
-
*/
|
|
131
|
-
rule: events.Rule;
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* The internally created Function instance that'll be run on schedule.
|
|
135
|
-
*/
|
|
136
|
-
public readonly jobFunction: Func;
|
|
137
|
-
private props: CronProps;
|
|
138
|
-
|
|
139
|
-
constructor(scope: Construct, id: string, props: CronProps) {
|
|
140
|
-
super(scope, props.cdk?.id || id);
|
|
141
|
-
|
|
142
|
-
this.id = id;
|
|
143
|
-
this.props = props;
|
|
144
|
-
this.cdk = {} as any;
|
|
145
|
-
|
|
146
|
-
this.createEventsRule();
|
|
147
|
-
this.jobFunction = this.createRuleTarget();
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Binds the given list of resources to the cron job.
|
|
152
|
-
*
|
|
153
|
-
* @example
|
|
154
|
-
*
|
|
155
|
-
* ```js
|
|
156
|
-
* cron.bind([STRIPE_KEY, bucket]);
|
|
157
|
-
* ```
|
|
158
|
-
*
|
|
159
|
-
*/
|
|
160
|
-
public bind(constructs: SSTConstruct[]) {
|
|
161
|
-
this.jobFunction.bind(constructs);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Attaches the given list of permissions to the cron job. This allows the function to access other AWS resources.
|
|
166
|
-
*
|
|
167
|
-
* @example
|
|
168
|
-
*
|
|
169
|
-
* ```js
|
|
170
|
-
* cron.attachPermissions(["s3"]);
|
|
171
|
-
* ```
|
|
172
|
-
*
|
|
173
|
-
*/
|
|
174
|
-
public attachPermissions(permissions: Permissions) {
|
|
175
|
-
this.jobFunction.attachPermissions(permissions);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
public getConstructMetadata() {
|
|
179
|
-
const cfnRule = this.cdk.rule.node.defaultChild as events.CfnRule;
|
|
180
|
-
return {
|
|
181
|
-
type: "Cron" as const,
|
|
182
|
-
data: {
|
|
183
|
-
schedule: cfnRule.scheduleExpression,
|
|
184
|
-
ruleName: this.cdk.rule.ruleName,
|
|
185
|
-
job: getFunctionRef(this.jobFunction),
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/** @internal */
|
|
191
|
-
public getFunctionBinding() {
|
|
192
|
-
return undefined;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
private createEventsRule() {
|
|
196
|
-
const { cdk, schedule, enabled } = this.props;
|
|
197
|
-
const id = this.node.id;
|
|
198
|
-
|
|
199
|
-
// Configure Schedule
|
|
200
|
-
if (!schedule && !cdk?.rule?.schedule) {
|
|
201
|
-
throw new Error(`No schedule defined for the "${id}" Cron`);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
this.cdk.rule = new events.Rule(this, "Rule", {
|
|
205
|
-
schedule: schedule && events.Schedule.expression(schedule),
|
|
206
|
-
enabled: enabled === false ? false : true,
|
|
207
|
-
...cdk?.rule,
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
private createRuleTarget() {
|
|
212
|
-
const { job } = this.props;
|
|
213
|
-
const id = this.node.id;
|
|
214
|
-
|
|
215
|
-
if (!job) {
|
|
216
|
-
throw new Error(`No job defined for the "${id}" Cron`);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// normalize job
|
|
220
|
-
let jobFunction, jobProps;
|
|
221
|
-
if ((job as CronJobProps).function) {
|
|
222
|
-
jobFunction = (job as CronJobProps).function;
|
|
223
|
-
jobProps = (job as CronJobProps).cdk?.target;
|
|
224
|
-
} else {
|
|
225
|
-
jobFunction = job as FunctionInlineDefinition;
|
|
226
|
-
jobProps = {};
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// create function
|
|
230
|
-
const fn = Func.fromDefinition(this, "Job", jobFunction);
|
|
231
|
-
this.cdk.rule.addTarget(new eventsTargets.LambdaFunction(fn, jobProps));
|
|
232
|
-
|
|
233
|
-
return fn;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { App, StageSynthesisOptions } from "aws-cdk-lib";
|
|
2
|
-
import { CloudAssembly } from "aws-cdk-lib/cx-api";
|
|
3
|
-
import { isStackConstruct, isSSTDebugStack } from "./Construct.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Deploy props for apps.
|
|
7
|
-
*/
|
|
8
|
-
export interface DebugAppDeployProps {
|
|
9
|
-
/**
|
|
10
|
-
* The app name, used to prefix stacks.
|
|
11
|
-
*/
|
|
12
|
-
name: string;
|
|
13
|
-
/**
|
|
14
|
-
* The stage to deploy this app to.
|
|
15
|
-
*/
|
|
16
|
-
stage: string;
|
|
17
|
-
/**
|
|
18
|
-
* The region to deploy this app to.
|
|
19
|
-
*/
|
|
20
|
-
region: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* The DebugApp construct is used internally by SST to create the resources needed to power Live Lambda Development.
|
|
25
|
-
*/
|
|
26
|
-
export class DebugApp extends App {
|
|
27
|
-
/**
|
|
28
|
-
* The name of the app. This comes from the `name` in your `sst.json`.
|
|
29
|
-
*/
|
|
30
|
-
public readonly name: string;
|
|
31
|
-
/**
|
|
32
|
-
* The stage the app is being deployed to. If this is not specified as the [`--stage`](/packages/cli.md#--stage) option, it'll default to the stage configured during the initial run of the SST CLI.
|
|
33
|
-
*/
|
|
34
|
-
public readonly stage: string;
|
|
35
|
-
/**
|
|
36
|
-
* The region the app is being deployed to. If this is not specified as the [`--region`](/packages/cli.md#--region) option in the SST CLI, it'll default to the `region` in your `sst.json`.
|
|
37
|
-
*/
|
|
38
|
-
public readonly region: string;
|
|
39
|
-
/**
|
|
40
|
-
* The AWS account the app is being deployed to. This comes from the IAM credentials being used to run the SST CLI.
|
|
41
|
-
*/
|
|
42
|
-
public readonly account: string;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
constructor(deployProps: DebugAppDeployProps) {
|
|
48
|
-
super();
|
|
49
|
-
|
|
50
|
-
this.name = deployProps.name;
|
|
51
|
-
this.stage = deployProps.stage;
|
|
52
|
-
this.region = deployProps.region;
|
|
53
|
-
this.account = process.env.CDK_DEFAULT_ACCOUNT || "my-account";
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
synth(options: StageSynthesisOptions = {}): CloudAssembly {
|
|
57
|
-
// Check app has stack
|
|
58
|
-
const stacks = this.node.children.filter((child) => isSSTDebugStack(child));
|
|
59
|
-
if (stacks.length > 1) {
|
|
60
|
-
console.error(
|
|
61
|
-
`Error: You can only create 1 DebugStack inside the "debugApp()" callback.\n`
|
|
62
|
-
);
|
|
63
|
-
process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
if (stacks.length === 0) {
|
|
66
|
-
console.error(
|
|
67
|
-
`Error: The "debugApp()" callback is not creating a DebugStack.\n`
|
|
68
|
-
);
|
|
69
|
-
process.exit(1);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
for (const child of this.node.children) {
|
|
73
|
-
if (isStackConstruct(child)) {
|
|
74
|
-
// Stack names need to be parameterized with the stage name
|
|
75
|
-
if (
|
|
76
|
-
!child.stackName.startsWith(`${this.stage}-`) &&
|
|
77
|
-
!child.stackName.endsWith(`-${this.stage}`) &&
|
|
78
|
-
child.stackName.indexOf(`-${this.stage}-`) === -1
|
|
79
|
-
) {
|
|
80
|
-
console.error(
|
|
81
|
-
`Error: Stack "${child.stackName}" is not parameterized with the stage name. The stack name needs to either start with "$stage-", end in "-$stage", or contain the stage name "-$stage-".\n`
|
|
82
|
-
);
|
|
83
|
-
process.exit(1);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return super.synth(options);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Use this method to prefix resource names in your stacks to make sure they don't thrash when deployed to different stages in the same AWS account. This method will prefix a given resource name with the stage and app name. Using the format `${stage}-${name}-${logicalName}`.
|
|
93
|
-
*/
|
|
94
|
-
public logicalPrefixedName(logicalName: string): string {
|
|
95
|
-
return `${this.stage}-${this.name}-${logicalName}`;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import * as path from "path";
|
|
2
|
-
import url from "url";
|
|
3
|
-
import { Construct } from "constructs";
|
|
4
|
-
import * as cdk from "aws-cdk-lib";
|
|
5
|
-
import * as s3 from "aws-cdk-lib/aws-s3";
|
|
6
|
-
import * as iam from "aws-cdk-lib/aws-iam";
|
|
7
|
-
import * as logs from "aws-cdk-lib/aws-logs";
|
|
8
|
-
import * as lambda from "aws-cdk-lib/aws-lambda";
|
|
9
|
-
import * as apig from "aws-cdk-lib/aws-apigatewayv2";
|
|
10
|
-
import * as dynamodb from "aws-cdk-lib/aws-dynamodb";
|
|
11
|
-
import { DebugApp } from "./DebugApp.js";
|
|
12
|
-
|
|
13
|
-
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Stack properties for the DebugStack.
|
|
17
|
-
*/
|
|
18
|
-
export interface DebugStackProps extends cdk.StackProps {
|
|
19
|
-
/**
|
|
20
|
-
* S3 bucket to store large websocket payloads.
|
|
21
|
-
*/
|
|
22
|
-
payloadBucketArn?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Lambda function props for WebSocket request handlers.
|
|
25
|
-
*/
|
|
26
|
-
websocketHandlerRoleArn?: string;
|
|
27
|
-
cdk?: {
|
|
28
|
-
/**
|
|
29
|
-
* Override the settings of the internally created DynamoDB table
|
|
30
|
-
*/
|
|
31
|
-
table?: Omit<dynamodb.TableProps, "partitionKey" | "sortKey">;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* The `DebugStack` construct is used internally to create the resources needed to power Live Lambda Development. Note that, the `DebugStack` construct should only be created inside the [`DebugApp`](DebugApp).
|
|
37
|
-
*/
|
|
38
|
-
export class DebugStack extends cdk.Stack {
|
|
39
|
-
public readonly stage: string;
|
|
40
|
-
private readonly api: apig.CfnApi;
|
|
41
|
-
private readonly table: dynamodb.Table;
|
|
42
|
-
private readonly bucket: s3.IBucket;
|
|
43
|
-
|
|
44
|
-
constructor(scope: Construct, id: string, props?: DebugStackProps) {
|
|
45
|
-
const app = scope.node.root as DebugApp;
|
|
46
|
-
const stackId = app.logicalPrefixedName(id);
|
|
47
|
-
|
|
48
|
-
DebugStack.checkForEnvInProps(id, props);
|
|
49
|
-
|
|
50
|
-
super(scope, stackId, {
|
|
51
|
-
...props,
|
|
52
|
-
env: {
|
|
53
|
-
account: app.account,
|
|
54
|
-
region: app.region,
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
this.stage = app.stage;
|
|
59
|
-
|
|
60
|
-
// Create connection table
|
|
61
|
-
this.table = new dynamodb.Table(this, "Table", {
|
|
62
|
-
partitionKey: { name: "pk", type: dynamodb.AttributeType.STRING },
|
|
63
|
-
billingMode: dynamodb.BillingMode.PAY_PER_REQUEST,
|
|
64
|
-
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
65
|
-
...props?.cdk?.table,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// Create S3 bucket for storing large payloads
|
|
69
|
-
this.bucket = props?.payloadBucketArn
|
|
70
|
-
? s3.Bucket.fromBucketArn(this, "Bucket", props.payloadBucketArn)
|
|
71
|
-
: new s3.Bucket(this, "Bucket", {
|
|
72
|
-
lifecycleRules: [
|
|
73
|
-
{
|
|
74
|
-
expiration: cdk.Duration.days(1),
|
|
75
|
-
prefix: "payloads/",
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
encryption: s3.BucketEncryption.S3_MANAGED,
|
|
79
|
-
removalPolicy: cdk.RemovalPolicy.DESTROY,
|
|
80
|
-
autoDeleteObjects: true,
|
|
81
|
-
blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL,
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// Create API
|
|
85
|
-
this.api = new apig.CfnApi(this, "Api", {
|
|
86
|
-
name: `${this.stackName}-api`,
|
|
87
|
-
protocolType: "WEBSOCKET",
|
|
88
|
-
routeSelectionExpression: "$request.body.action",
|
|
89
|
-
});
|
|
90
|
-
new apig.CfnStage(this, "ApiStage", {
|
|
91
|
-
apiId: this.api.ref,
|
|
92
|
-
autoDeploy: true,
|
|
93
|
-
stageName: this.stage,
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
// Create API routes
|
|
97
|
-
const role = props?.websocketHandlerRoleArn
|
|
98
|
-
? iam.Role.fromRoleArn(this, "HandlerRole", props.websocketHandlerRoleArn)
|
|
99
|
-
: undefined;
|
|
100
|
-
this.addApiRoute("Connect", "$connect", "wsConnect.main", role);
|
|
101
|
-
this.addApiRoute("Disconnect", "$disconnect", "wsDisconnect.main", role);
|
|
102
|
-
this.addApiRoute("Default", "$default", "wsDefault.main", role);
|
|
103
|
-
|
|
104
|
-
// Stack Output
|
|
105
|
-
new cdk.CfnOutput(this, "Endpoint", {
|
|
106
|
-
value: `${this.api.attrApiEndpoint}/${this.stage}`,
|
|
107
|
-
});
|
|
108
|
-
new cdk.CfnOutput(this, "BucketArn", {
|
|
109
|
-
value: this.bucket.bucketArn,
|
|
110
|
-
});
|
|
111
|
-
new cdk.CfnOutput(this, "BucketName", {
|
|
112
|
-
value: this.bucket.bucketName,
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
private addApiRoute(
|
|
117
|
-
id: string,
|
|
118
|
-
routeKey: string,
|
|
119
|
-
handler: string,
|
|
120
|
-
role?: iam.IRole
|
|
121
|
-
) {
|
|
122
|
-
// Create execution policy
|
|
123
|
-
const policyStatement = new iam.PolicyStatement();
|
|
124
|
-
policyStatement.addAllResources();
|
|
125
|
-
policyStatement.addActions(
|
|
126
|
-
"apigateway:*",
|
|
127
|
-
"dynamodb:*",
|
|
128
|
-
"execute-api:ManageConnections"
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
// Create Lambda
|
|
132
|
-
const lambdaFunc = new lambda.Function(this, id, {
|
|
133
|
-
code: lambda.Code.fromAsset(path.join(__dirname, "../assets/DebugStack")),
|
|
134
|
-
handler,
|
|
135
|
-
runtime: lambda.Runtime.NODEJS_16_X,
|
|
136
|
-
timeout: cdk.Duration.seconds(10),
|
|
137
|
-
memorySize: 256,
|
|
138
|
-
logRetention: logs.RetentionDays.ONE_WEEK,
|
|
139
|
-
logRetentionRole: role,
|
|
140
|
-
environment: {
|
|
141
|
-
TABLE_NAME: this.table.tableName,
|
|
142
|
-
},
|
|
143
|
-
role,
|
|
144
|
-
initialPolicy: [policyStatement],
|
|
145
|
-
});
|
|
146
|
-
lambdaFunc.addPermission(`${id}Permission`, {
|
|
147
|
-
principal: new iam.ServicePrincipal("apigateway.amazonaws.com"),
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
// Create API integrations
|
|
151
|
-
const integration = new apig.CfnIntegration(this, `${id}Integration`, {
|
|
152
|
-
apiId: this.api.ref,
|
|
153
|
-
integrationType: "AWS_PROXY",
|
|
154
|
-
integrationUri: `arn:${this.partition}:apigateway:${this.region}:lambda:path/2015-03-31/functions/${lambdaFunc.functionArn}/invocations`,
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
// Create API routes
|
|
158
|
-
new apig.CfnRoute(this, `${id}Route`, {
|
|
159
|
-
apiId: this.api.ref,
|
|
160
|
-
routeKey,
|
|
161
|
-
authorizationType: "NONE",
|
|
162
|
-
target: `integrations/${integration.ref}`,
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
167
|
-
private static checkForEnvInProps(id: string, props?: any) {
|
|
168
|
-
if (props && props.env) {
|
|
169
|
-
let envS = "";
|
|
170
|
-
|
|
171
|
-
try {
|
|
172
|
-
envS = " (" + JSON.stringify(props.env) + ")";
|
|
173
|
-
} catch (e) {
|
|
174
|
-
// Ignore
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
throw new Error(
|
|
178
|
-
`Do not set the "env" prop while initializing "${id}" stack${envS}. Use the "AWS_PROFILE" environment variable and "--region" CLI option instead.`
|
|
179
|
-
);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|