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,5 +1,5 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import fs from "fs
|
|
2
|
+
import fs from "fs";
|
|
3
3
|
import * as cdk from "aws-cdk-lib";
|
|
4
4
|
import * as s3 from "aws-cdk-lib/aws-s3";
|
|
5
5
|
import * as iam from "aws-cdk-lib/aws-iam";
|
|
@@ -8,12 +8,15 @@ import * as lambda from "aws-cdk-lib/aws-lambda";
|
|
|
8
8
|
import { Stack } from "./Stack.js";
|
|
9
9
|
import { isSSTConstruct, isStackConstruct, } from "./Construct.js";
|
|
10
10
|
import { Function } from "./Function.js";
|
|
11
|
-
import { bindType } from "./util/functionBinding.js";
|
|
11
|
+
import { bindParameters, bindType } from "./util/functionBinding.js";
|
|
12
12
|
import { stack } from "./FunctionalStack.js";
|
|
13
13
|
import { createRequire } from "module";
|
|
14
14
|
import { Auth } from "./Auth.js";
|
|
15
15
|
import { useDeferredTasks } from "./deferred_task.js";
|
|
16
16
|
import { AppContext } from "./context.js";
|
|
17
|
+
import { useProject } from "../app.js";
|
|
18
|
+
import { Logger } from "../logger.js";
|
|
19
|
+
import { SiteEnv } from "../site-env.js";
|
|
17
20
|
const require = createRequire(import.meta.url);
|
|
18
21
|
function exitWithMessage(message) {
|
|
19
22
|
console.error(message);
|
|
@@ -23,35 +26,85 @@ function exitWithMessage(message) {
|
|
|
23
26
|
* The App construct extends cdk.App and is used internally by SST.
|
|
24
27
|
*/
|
|
25
28
|
export class App extends cdk.App {
|
|
29
|
+
/**
|
|
30
|
+
* Whether or not the app is running locally under `sst start`
|
|
31
|
+
*/
|
|
32
|
+
local = false;
|
|
33
|
+
/**
|
|
34
|
+
* Whether the app is running locally under start, deploy or remove
|
|
35
|
+
*/
|
|
36
|
+
mode;
|
|
37
|
+
/**
|
|
38
|
+
* The name of your app, comes from the `name` in your `sst.json`
|
|
39
|
+
*/
|
|
40
|
+
name;
|
|
41
|
+
/**
|
|
42
|
+
* The stage the app is being deployed to. If this is not specified as the --stage option, it'll default to the stage configured during the initial run of the SST CLI.
|
|
43
|
+
*/
|
|
44
|
+
stage;
|
|
45
|
+
/**
|
|
46
|
+
* The region the app is being deployed to. If this is not specified as the --region option in the SST CLI, it'll default to the region in your sst.json.
|
|
47
|
+
*/
|
|
48
|
+
region;
|
|
49
|
+
/**
|
|
50
|
+
* The AWS account the app is being deployed to. This comes from the IAM credentials being used to run the SST CLI.
|
|
51
|
+
*/
|
|
52
|
+
account;
|
|
53
|
+
/** @internal */
|
|
54
|
+
debugBridge;
|
|
55
|
+
/** @internal */
|
|
56
|
+
debugEndpoint;
|
|
57
|
+
/** @internal */
|
|
58
|
+
debugBucketArn;
|
|
59
|
+
/** @internal */
|
|
60
|
+
debugBucketName;
|
|
61
|
+
/** @internal */
|
|
62
|
+
debugStartedAt;
|
|
63
|
+
/** @internal */
|
|
64
|
+
debugIncreaseTimeout;
|
|
65
|
+
/** @internal */
|
|
66
|
+
appPath;
|
|
67
|
+
/** @internal */
|
|
68
|
+
bootstrap;
|
|
69
|
+
/** @internal */
|
|
70
|
+
defaultFunctionProps;
|
|
71
|
+
_defaultRemovalPolicy;
|
|
72
|
+
/** @internal */
|
|
73
|
+
get defaultRemovalPolicy() {
|
|
74
|
+
return this._defaultRemovalPolicy;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Skip building Function code
|
|
78
|
+
* Note that on `sst remove`, we do not want to bundle the Lambda functions.
|
|
79
|
+
* CDK disables bundling (ie. zipping) for `cdk destroy` command.
|
|
80
|
+
* But SST runs `cdk synth` first then manually remove each stack. Hence
|
|
81
|
+
* we cannot rely on CDK to disable bundling, and we disable it manually.
|
|
82
|
+
* This allows us to disable BOTH building and bundling, where as CDK
|
|
83
|
+
* would only disable the latter. For example, `cdk destroy` still trys
|
|
84
|
+
* to install Python dependencies in Docker.
|
|
85
|
+
*
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
skipBuild;
|
|
26
89
|
/**
|
|
27
90
|
* @internal
|
|
28
91
|
*/
|
|
29
92
|
constructor(deployProps, props = {}) {
|
|
30
93
|
super(props);
|
|
31
|
-
/**
|
|
32
|
-
* Whether or not the app is running locally under `sst start`
|
|
33
|
-
*/
|
|
34
|
-
this.local = false;
|
|
35
|
-
/**
|
|
36
|
-
* A list of Lambda functions in the app
|
|
37
|
-
*/
|
|
38
|
-
this.lambdaHandlers = [];
|
|
39
|
-
this.siteEnvironments = [];
|
|
40
94
|
AppContext.provide(this);
|
|
95
|
+
SiteEnv.reset();
|
|
41
96
|
this.bootstrap = deployProps.bootstrap;
|
|
42
97
|
this.appPath = process.cwd();
|
|
43
98
|
this.mode = deployProps.mode;
|
|
44
|
-
this.local = this.mode === "
|
|
99
|
+
this.local = this.mode === "dev";
|
|
45
100
|
this.stage = deployProps.stage || "dev";
|
|
46
101
|
this.name = deployProps.name || "my-app";
|
|
47
102
|
this.region =
|
|
48
103
|
deployProps.region || process.env.CDK_DEFAULT_REGION || "us-east-1";
|
|
49
104
|
this.account =
|
|
50
105
|
deployProps.account || process.env.CDK_DEFAULT_ACCOUNT || "my-account";
|
|
51
|
-
this.buildDir = deployProps.buildDir || ".build";
|
|
52
106
|
this.skipBuild = deployProps.skipBuild || false;
|
|
53
107
|
this.defaultFunctionProps = [];
|
|
54
|
-
this.synthCallback = deployProps.synthCallback;
|
|
55
108
|
if (deployProps.debugEndpoint) {
|
|
56
109
|
this.local = true;
|
|
57
110
|
this.debugEndpoint = deployProps.debugEndpoint;
|
|
@@ -64,10 +117,6 @@ export class App extends cdk.App {
|
|
|
64
117
|
}
|
|
65
118
|
}
|
|
66
119
|
}
|
|
67
|
-
/** @internal */
|
|
68
|
-
get defaultRemovalPolicy() {
|
|
69
|
-
return this._defaultRemovalPolicy;
|
|
70
|
-
}
|
|
71
120
|
/**
|
|
72
121
|
* 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}`.
|
|
73
122
|
* @example
|
|
@@ -107,8 +156,6 @@ export class App extends cdk.App {
|
|
|
107
156
|
* ```
|
|
108
157
|
*/
|
|
109
158
|
setDefaultFunctionProps(props) {
|
|
110
|
-
if (this.lambdaHandlers.length > 0)
|
|
111
|
-
throw new Error("Cannot call 'setDefaultFunctionProps' after a stack with functions has been created. Please use 'addDefaultFunctionEnv' or 'addDefaultFunctionPermissions' to add more default properties. Read more about this change here: https://docs.sst.dev/constructs/App#upgrading-to-v0420");
|
|
112
159
|
this.defaultFunctionProps.push(props);
|
|
113
160
|
}
|
|
114
161
|
/**
|
|
@@ -180,6 +227,7 @@ export class App extends cdk.App {
|
|
|
180
227
|
this.ensureUniqueConstructIds();
|
|
181
228
|
this.codegenTypes();
|
|
182
229
|
this.buildConstructsMetadata();
|
|
230
|
+
this.createBindingSsmParameters();
|
|
183
231
|
this.removeGovCloudUnsupportedResourceProperties();
|
|
184
232
|
for (const child of this.node.children) {
|
|
185
233
|
if (isStackConstruct(child)) {
|
|
@@ -198,35 +246,39 @@ export class App extends cdk.App {
|
|
|
198
246
|
}
|
|
199
247
|
}
|
|
200
248
|
const cloudAssembly = super.synth(options);
|
|
201
|
-
// Run callback after synth has finished
|
|
202
|
-
if (this.synthCallback) {
|
|
203
|
-
this.synthCallback(this.lambdaHandlers, this.siteEnvironments);
|
|
204
|
-
}
|
|
205
249
|
return cloudAssembly;
|
|
206
250
|
}
|
|
207
|
-
async
|
|
251
|
+
async finish() {
|
|
208
252
|
await useDeferredTasks().run();
|
|
209
253
|
}
|
|
210
254
|
isRunningSSTTest() {
|
|
211
255
|
// Check the env var set inside test/setup-tests.js
|
|
212
256
|
return process.env.SST_RESOURCES_TESTS === "enabled";
|
|
213
257
|
}
|
|
214
|
-
registerLambdaHandler(handler) {
|
|
215
|
-
this.lambdaHandlers.push(handler);
|
|
216
|
-
}
|
|
217
|
-
registerSiteEnvironment(environment) {
|
|
218
|
-
this.siteEnvironments.push(environment);
|
|
219
|
-
}
|
|
220
258
|
getInputFilesFromEsbuildMetafile(file) {
|
|
221
259
|
let metaJson;
|
|
222
260
|
try {
|
|
223
|
-
metaJson = fs.
|
|
261
|
+
metaJson = JSON.parse(fs.readFileSync(file).toString());
|
|
224
262
|
}
|
|
225
263
|
catch (e) {
|
|
226
264
|
exitWithMessage("There was a problem reading the esbuild metafile.");
|
|
227
265
|
}
|
|
228
266
|
return Object.keys(metaJson.inputs).map((input) => path.resolve(input));
|
|
229
267
|
}
|
|
268
|
+
createBindingSsmParameters() {
|
|
269
|
+
class CreateSsmParameters {
|
|
270
|
+
visit(c) {
|
|
271
|
+
if (!isSSTConstruct(c)) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (c instanceof Function && c._disableBind) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
bindParameters(c);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
cdk.Aspects.of(this).add(new CreateSsmParameters());
|
|
281
|
+
}
|
|
230
282
|
buildConstructsMetadata() {
|
|
231
283
|
const constructs = this.buildConstructsMetadata_collectConstructs(this);
|
|
232
284
|
const byStack = {};
|
|
@@ -390,57 +442,25 @@ export class App extends cdk.App {
|
|
|
390
442
|
cdk.Aspects.of(this).add(new EnsureUniqueConstructIds());
|
|
391
443
|
}
|
|
392
444
|
codegenTypes() {
|
|
393
|
-
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
this.codegenCreateConstructTypes(typesPath);
|
|
401
|
-
}
|
|
402
|
-
codegenFindNodeModulesPath() {
|
|
403
|
-
const rootPath = path.parse(process.cwd()).root;
|
|
404
|
-
let directory = this.appPath;
|
|
405
|
-
while (directory !== rootPath) {
|
|
406
|
-
const checkPath = path.resolve(directory, "node_modules", "@serverless-stack", "node");
|
|
407
|
-
if (fs.existsSync(checkPath)) {
|
|
408
|
-
return directory;
|
|
409
|
-
}
|
|
410
|
-
directory = path.dirname(directory);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
codegenCreateIndexType(typesPath) {
|
|
414
|
-
fs.removeSync(typesPath);
|
|
445
|
+
const project = useProject();
|
|
446
|
+
const typesPath = path.resolve(project.paths.out, "types");
|
|
447
|
+
Logger.debug(`Generating types in ${typesPath}`);
|
|
448
|
+
fs.rmSync(typesPath, {
|
|
449
|
+
recursive: true,
|
|
450
|
+
force: true,
|
|
451
|
+
});
|
|
415
452
|
fs.mkdirSync(typesPath, {
|
|
416
453
|
recursive: true,
|
|
417
454
|
});
|
|
418
|
-
fs.writeFileSync(`${typesPath}/index.
|
|
419
|
-
import "
|
|
420
|
-
declare module "
|
|
421
|
-
export interface ConfigTypes {
|
|
422
|
-
APP: string
|
|
423
|
-
STAGE: string
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
codegenCreateConstructTypes(typesPath) {
|
|
428
|
-
//export function codegenTypes(typesPath: string) {
|
|
429
|
-
// fs.appendFileSync(`${typesPath}/index.d.ts`, `export * from "./config";`);
|
|
430
|
-
// fs.writeFileSync(`${typesPath}/config.d.ts`, `
|
|
431
|
-
// import "@serverless-stack/node/config";
|
|
432
|
-
// declare module "@serverless-stack/node/config" {
|
|
433
|
-
// export interface ConfigType {
|
|
434
|
-
// ${[
|
|
435
|
-
// "APP",
|
|
436
|
-
// "STAGE",
|
|
437
|
-
// ...Parameter.getAllNames(),
|
|
438
|
-
// ...Secret.getAllNames()
|
|
439
|
-
// ].map((p) => `${p}: string;`).join("\n")}
|
|
440
|
-
// }
|
|
441
|
-
// }
|
|
442
|
-
// `);
|
|
443
|
-
//}
|
|
455
|
+
fs.writeFileSync(`${typesPath}/index.ts`, [
|
|
456
|
+
`import "sst/node/config";`,
|
|
457
|
+
`declare module "sst/node/config" {`,
|
|
458
|
+
` export interface ConfigTypes {`,
|
|
459
|
+
` APP: string;`,
|
|
460
|
+
` STAGE: string;`,
|
|
461
|
+
` }`,
|
|
462
|
+
`}`,
|
|
463
|
+
].join("\n"));
|
|
444
464
|
class CodegenTypes {
|
|
445
465
|
visit(c) {
|
|
446
466
|
if (!isSSTConstruct(c)) {
|
|
@@ -455,26 +475,26 @@ declare module "@serverless-stack/node/config" {
|
|
|
455
475
|
}
|
|
456
476
|
const className = c.constructor.name;
|
|
457
477
|
const id = c.id;
|
|
458
|
-
fs.appendFileSync(`${typesPath}/index.d.ts`, `export * from "./${className}-${id}";`);
|
|
459
478
|
// Case 1: variable does not have properties, ie. Secrets and Parameters
|
|
460
|
-
|
|
461
|
-
?
|
|
462
|
-
import "
|
|
463
|
-
declare module "
|
|
464
|
-
export interface ${className}Resources {
|
|
465
|
-
"${id}": string
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
|
|
479
|
+
fs.writeFileSync(`${typesPath}/${className}-${id}.ts`, (binding.variables[0] === "."
|
|
480
|
+
? [
|
|
481
|
+
`import "sst/node/${binding.clientPackage}";`,
|
|
482
|
+
`declare module "sst/node/${binding.clientPackage}" {`,
|
|
483
|
+
` export interface ${className}Resources {`,
|
|
484
|
+
` "${id}": string;`,
|
|
485
|
+
` }`,
|
|
486
|
+
`}`,
|
|
487
|
+
]
|
|
488
|
+
: [
|
|
489
|
+
`import "sst/node/${binding.clientPackage}";`,
|
|
490
|
+
`declare module "sst/node/${binding.clientPackage}" {`,
|
|
491
|
+
` export interface ${className}Resources {`,
|
|
492
|
+
` "${id}": {`,
|
|
493
|
+
...binding.variables.map((p) => ` ${p}: string;`),
|
|
494
|
+
` }`,
|
|
495
|
+
` }`,
|
|
496
|
+
`}`,
|
|
497
|
+
]).join("\n"));
|
|
478
498
|
}
|
|
479
499
|
}
|
|
480
500
|
cdk.Aspects.of(this).add(new CodegenTypes());
|
|
@@ -246,7 +246,7 @@ export interface AppSyncApiProps {
|
|
|
246
246
|
* });
|
|
247
247
|
* ```
|
|
248
248
|
*/
|
|
249
|
-
schema
|
|
249
|
+
schema: string | string[];
|
|
250
250
|
/**
|
|
251
251
|
* Specify a custom domain to use in addition to the automatically generated one. SST currently supports domains that are configured using [Route 53](https://aws.amazon.com/route53/)
|
|
252
252
|
*
|
|
@@ -331,7 +331,7 @@ export interface AppSyncApiProps {
|
|
|
331
331
|
graphqlApi?: appsync.IGraphqlApi | AppSyncApiCdkGraphqlProps;
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
|
-
export interface AppSyncApiCdkGraphqlProps extends Omit<appsync.GraphqlApiProps, "name"> {
|
|
334
|
+
export interface AppSyncApiCdkGraphqlProps extends Omit<appsync.GraphqlApiProps, "name" | "schema"> {
|
|
335
335
|
name?: string;
|
|
336
336
|
}
|
|
337
337
|
/**
|
|
@@ -379,7 +379,7 @@ export declare class AppSyncApi extends Construct implements SSTConstruct {
|
|
|
379
379
|
private readonly resolversByResKey;
|
|
380
380
|
private readonly bindingForAllFunctions;
|
|
381
381
|
private readonly permissionsAttachedForAllFunctions;
|
|
382
|
-
constructor(scope: Construct, id: string, props
|
|
382
|
+
constructor(scope: Construct, id: string, props: AppSyncApiProps);
|
|
383
383
|
/**
|
|
384
384
|
* The Id of the internally created AppSync GraphQL API.
|
|
385
385
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
2
3
|
export async function weakImport(pkg) {
|
|
3
4
|
try {
|
|
4
5
|
return await import(pkg);
|
|
@@ -14,7 +15,7 @@ import * as appsync from "@aws-cdk/aws-appsync-alpha";
|
|
|
14
15
|
import * as appSyncApiDomain from "./util/appSyncApiDomain.js";
|
|
15
16
|
import { getFunctionRef, isCDKConstruct } from "./Construct.js";
|
|
16
17
|
import { Function as Fn, } from "./Function.js";
|
|
17
|
-
import {
|
|
18
|
+
import { useProject } from "../app.js";
|
|
18
19
|
/////////////////////
|
|
19
20
|
// Construct
|
|
20
21
|
/////////////////////
|
|
@@ -43,16 +44,21 @@ import { State } from "@serverless-stack/core";
|
|
|
43
44
|
* ```
|
|
44
45
|
*/
|
|
45
46
|
export class AppSyncApi extends Construct {
|
|
47
|
+
id;
|
|
48
|
+
cdk;
|
|
49
|
+
props;
|
|
50
|
+
_customDomainUrl;
|
|
51
|
+
_cfnDomainName;
|
|
52
|
+
functionsByDsKey = {};
|
|
53
|
+
dataSourcesByDsKey = {};
|
|
54
|
+
dsKeysByResKey = {};
|
|
55
|
+
resolversByResKey = {};
|
|
56
|
+
bindingForAllFunctions = [];
|
|
57
|
+
permissionsAttachedForAllFunctions = [];
|
|
46
58
|
constructor(scope, id, props) {
|
|
47
59
|
super(scope, props?.cdk?.id || id);
|
|
48
|
-
this.functionsByDsKey = {};
|
|
49
|
-
this.dataSourcesByDsKey = {};
|
|
50
|
-
this.dsKeysByResKey = {};
|
|
51
|
-
this.resolversByResKey = {};
|
|
52
|
-
this.bindingForAllFunctions = [];
|
|
53
|
-
this.permissionsAttachedForAllFunctions = [];
|
|
54
60
|
this.id = id;
|
|
55
|
-
this.props = props
|
|
61
|
+
this.props = props;
|
|
56
62
|
this.cdk = {};
|
|
57
63
|
this.createGraphApi();
|
|
58
64
|
// Configure data sources
|
|
@@ -273,18 +279,19 @@ export class AppSyncApi extends Construct {
|
|
|
273
279
|
// build schema
|
|
274
280
|
let mainSchema;
|
|
275
281
|
if (typeof schema === "string") {
|
|
276
|
-
mainSchema = appsync.
|
|
282
|
+
mainSchema = appsync.SchemaFile.fromAsset(schema);
|
|
277
283
|
}
|
|
278
|
-
else
|
|
279
|
-
if (schema.length
|
|
280
|
-
|
|
281
|
-
const mergedSchema = mergeTypeDefs(schema
|
|
282
|
-
.map((file) => fs.readFileSync(file).toString())
|
|
283
|
-
.map(buildSchema));
|
|
284
|
-
const filePath = State.resolve(app.appPath, `appsyncapi-${id}-${this.node.addr}.graphql`);
|
|
285
|
-
fs.writeFileSync(filePath, print(mergedSchema));
|
|
286
|
-
mainSchema = appsync.Schema.fromAsset(filePath);
|
|
284
|
+
else {
|
|
285
|
+
if (schema.length === 0) {
|
|
286
|
+
throw new Error("Invalid schema. At least one schema file must be provided");
|
|
287
287
|
}
|
|
288
|
+
// merge schema files
|
|
289
|
+
const mergedSchema = mergeTypeDefs(schema
|
|
290
|
+
.map((file) => fs.readFileSync(file).toString())
|
|
291
|
+
.map(buildSchema));
|
|
292
|
+
const filePath = path.join(useProject().paths.out, `appsyncapi-${id}-${this.node.addr}.graphql`);
|
|
293
|
+
fs.writeFileSync(filePath, print(mergedSchema));
|
|
294
|
+
mainSchema = appsync.SchemaFile.fromAsset(filePath);
|
|
288
295
|
}
|
|
289
296
|
// build domain
|
|
290
297
|
const domainData = appSyncApiDomain.buildCustomDomainData(this, customDomain);
|
|
@@ -448,7 +455,7 @@ export class AppSyncApi extends Construct {
|
|
|
448
455
|
///////////////////
|
|
449
456
|
// Create resolver
|
|
450
457
|
///////////////////
|
|
451
|
-
const resolver = this.cdk.graphqlApi.createResolver({
|
|
458
|
+
const resolver = this.cdk.graphqlApi.createResolver(`${typeName}${fieldName}Resolver`, {
|
|
452
459
|
dataSource,
|
|
453
460
|
typeName,
|
|
454
461
|
fieldName,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as lambda from "aws-cdk-lib/aws-lambda";
|
|
2
|
+
import { SsrSite } from "./SsrSite.js";
|
|
3
|
+
import { EdgeFunction } from "./EdgeFunction.js";
|
|
4
|
+
/**
|
|
5
|
+
* The `AstroSite` construct is a higher level CDK construct that makes it easy to create a Astro app.
|
|
6
|
+
* @example
|
|
7
|
+
* Deploys a Astro app in the `my-astro-app` directory.
|
|
8
|
+
*
|
|
9
|
+
* ```js
|
|
10
|
+
* new AstroSite(stack, "web", {
|
|
11
|
+
* path: "my-astro-app/",
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class AstroSite extends SsrSite {
|
|
16
|
+
protected initBuildConfig(): {
|
|
17
|
+
serverBuildOutputFile: string;
|
|
18
|
+
clientBuildOutputDir: string;
|
|
19
|
+
clientBuildVersionedSubDir: string;
|
|
20
|
+
siteStub: string;
|
|
21
|
+
};
|
|
22
|
+
protected validateBuildOutput(): void;
|
|
23
|
+
protected createFunctionForRegional(): lambda.Function;
|
|
24
|
+
protected createFunctionForEdge(): EdgeFunction;
|
|
25
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import url from "url";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import * as esbuild from "esbuild";
|
|
5
|
+
import { SsrSite } from "./SsrSite.js";
|
|
6
|
+
import { Function } from "./Function.js";
|
|
7
|
+
import { EdgeFunction } from "./EdgeFunction.js";
|
|
8
|
+
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
9
|
+
/**
|
|
10
|
+
* The `AstroSite` construct is a higher level CDK construct that makes it easy to create a Astro app.
|
|
11
|
+
* @example
|
|
12
|
+
* Deploys a Astro app in the `my-astro-app` directory.
|
|
13
|
+
*
|
|
14
|
+
* ```js
|
|
15
|
+
* new AstroSite(stack, "web", {
|
|
16
|
+
* path: "my-astro-app/",
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export class AstroSite extends SsrSite {
|
|
21
|
+
initBuildConfig() {
|
|
22
|
+
return {
|
|
23
|
+
serverBuildOutputFile: "dist/server/entry.mjs",
|
|
24
|
+
clientBuildOutputDir: "dist/client",
|
|
25
|
+
clientBuildVersionedSubDir: "assets",
|
|
26
|
+
siteStub: path.resolve(__dirname, "../support/astro-site-html-stub"),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
validateBuildOutput() {
|
|
30
|
+
const serverDir = path.join(this.props.path, "dist/server");
|
|
31
|
+
const clientDir = path.join(this.props.path, "dist/client");
|
|
32
|
+
if (!fs.existsSync(serverDir) || !fs.existsSync(clientDir)) {
|
|
33
|
+
throw new Error(`Build output inside "dist/" does not contain the "server" and "client" folders. Make sure Server-side Rendering (SSR) is enabled in your Astro app. If you are looking to deploy the Astro app as a static site, please use the StaticSite construct — https://docs.sst.dev/constructs/StaticSite`);
|
|
34
|
+
}
|
|
35
|
+
super.validateBuildOutput();
|
|
36
|
+
}
|
|
37
|
+
createFunctionForRegional() {
|
|
38
|
+
const { defaults, environment } = this.props;
|
|
39
|
+
// Bundle code
|
|
40
|
+
const handler = this.isPlaceholder
|
|
41
|
+
? path.resolve(__dirname, "../support/ssr-site-function-stub/index.handler")
|
|
42
|
+
: path.join(this.props.path, "dist", "server", "entry.handler");
|
|
43
|
+
// Create function
|
|
44
|
+
const fn = new Function(this, `ServerFunction`, {
|
|
45
|
+
description: "Server handler",
|
|
46
|
+
handler,
|
|
47
|
+
logRetention: "three_days",
|
|
48
|
+
runtime: "nodejs16.x",
|
|
49
|
+
memorySize: defaults?.function?.memorySize || "512 MB",
|
|
50
|
+
timeout: defaults?.function?.timeout || "10 seconds",
|
|
51
|
+
nodejs: {
|
|
52
|
+
format: "esm",
|
|
53
|
+
},
|
|
54
|
+
enableLiveDev: false,
|
|
55
|
+
environment,
|
|
56
|
+
});
|
|
57
|
+
fn._disableBind = true;
|
|
58
|
+
return fn;
|
|
59
|
+
}
|
|
60
|
+
createFunctionForEdge() {
|
|
61
|
+
const { defaults, environment } = this.props;
|
|
62
|
+
// Bundle code
|
|
63
|
+
let bundlePath;
|
|
64
|
+
let handler;
|
|
65
|
+
if (this.isPlaceholder) {
|
|
66
|
+
bundlePath = path.resolve(__dirname, "../support/ssr-site-function-stub");
|
|
67
|
+
handler = "index.handler";
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
// Create a directory that we will use to create the bundled version
|
|
71
|
+
// of the "core server build" along with our custom Lamba server handler.
|
|
72
|
+
const outputPath = path.resolve(path.join(this.sstBuildDir, `AstroSiteFunction-${this.node.id}-${this.node.addr}`));
|
|
73
|
+
const result = esbuild.buildSync({
|
|
74
|
+
entryPoints: [path.join(this.props.path, this.buildConfig.serverBuildOutputFile)],
|
|
75
|
+
target: "esnext",
|
|
76
|
+
format: "esm",
|
|
77
|
+
platform: "node",
|
|
78
|
+
metafile: true,
|
|
79
|
+
bundle: true,
|
|
80
|
+
write: true,
|
|
81
|
+
allowOverwrite: true,
|
|
82
|
+
outfile: path.join(outputPath, "entry.mjs"),
|
|
83
|
+
banner: {
|
|
84
|
+
js: [
|
|
85
|
+
`import { createRequire as topLevelCreateRequire } from 'module';`,
|
|
86
|
+
`const require = topLevelCreateRequire(import.meta.url);`,
|
|
87
|
+
].join(""),
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
if (result.errors.length > 0) {
|
|
91
|
+
result.errors.forEach((error) => console.error(error));
|
|
92
|
+
throw new Error(`There was a problem bundling the function code for the ${this.id} AstroSite.`);
|
|
93
|
+
}
|
|
94
|
+
// Create package.json
|
|
95
|
+
fs.writeFileSync(path.join(outputPath, "package.json"), `{"type":"module"}`);
|
|
96
|
+
bundlePath = outputPath;
|
|
97
|
+
handler = "entry.handler";
|
|
98
|
+
}
|
|
99
|
+
// Create function
|
|
100
|
+
return new EdgeFunction(this, `Server`, {
|
|
101
|
+
scopeOverride: this,
|
|
102
|
+
bundlePath,
|
|
103
|
+
handler,
|
|
104
|
+
timeout: defaults?.function?.timeout,
|
|
105
|
+
memory: defaults?.function?.memorySize,
|
|
106
|
+
permissions: defaults?.function?.permissions,
|
|
107
|
+
environment,
|
|
108
|
+
format: "esm",
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Construct } from "constructs";
|
|
2
2
|
import { Api } from "./Api.js";
|
|
3
|
-
import { FunctionDefinition } from "./Function";
|
|
3
|
+
import { FunctionDefinition } from "./Function.js";
|
|
4
4
|
import { SSTConstruct } from "./Construct.js";
|
|
5
5
|
import { FunctionBindingProps } from "./util/functionBinding.js";
|
|
6
6
|
export interface AuthProps {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ssm from "aws-cdk-lib/aws-ssm";
|
|
2
2
|
import { Effect, PolicyStatement } from "aws-cdk-lib/aws-iam";
|
|
3
3
|
import { Construct } from "constructs";
|
|
4
|
-
import { Stack } from "./
|
|
4
|
+
import { Stack } from "./Stack.js";
|
|
5
5
|
import { ENVIRONMENT_PLACEHOLDER, getEnvironmentKey, getParameterPath } from "./util/functionBinding.js";
|
|
6
6
|
import { CustomResource } from "aws-cdk-lib";
|
|
7
7
|
const PUBLIC_KEY_PROP = "publicKey";
|
|
@@ -18,9 +18,13 @@ const PREFIX_PROP = "prefix";
|
|
|
18
18
|
* })
|
|
19
19
|
*/
|
|
20
20
|
export class Auth extends Construct {
|
|
21
|
+
id;
|
|
22
|
+
authenticator;
|
|
23
|
+
apis = new Set();
|
|
24
|
+
/** @internal */
|
|
25
|
+
static list = new Set();
|
|
21
26
|
constructor(scope, id, props) {
|
|
22
27
|
super(scope, props.cdk?.id || id);
|
|
23
|
-
this.apis = new Set();
|
|
24
28
|
if (!props.authenticator ||
|
|
25
29
|
"defaults" in props ||
|
|
26
30
|
"login" in props ||
|
|
@@ -151,5 +155,3 @@ export class Auth extends Construct {
|
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
}
|
|
154
|
-
/** @internal */
|
|
155
|
-
Auth.list = new Set();
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -21,11 +21,14 @@ import { toCdkDuration } from "./util/duration.js";
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
export class Bucket extends Construct {
|
|
24
|
+
id;
|
|
25
|
+
cdk;
|
|
26
|
+
notifications = {};
|
|
27
|
+
bindingForAllNotifications = [];
|
|
28
|
+
permissionsAttachedForAllNotifications = [];
|
|
29
|
+
props;
|
|
24
30
|
constructor(scope, id, props) {
|
|
25
31
|
super(scope, props?.cdk?.id || id);
|
|
26
|
-
this.notifications = {};
|
|
27
|
-
this.bindingForAllNotifications = [];
|
|
28
|
-
this.permissionsAttachedForAllNotifications = [];
|
|
29
32
|
this.id = id;
|
|
30
33
|
this.props = props || {};
|
|
31
34
|
this.cdk = {};
|
|
File without changes
|
|
@@ -34,9 +34,12 @@ const CognitoUserPoolTriggerOperationMapping = {
|
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
36
|
export class Cognito extends Construct {
|
|
37
|
+
id;
|
|
38
|
+
cdk;
|
|
39
|
+
functions = {};
|
|
40
|
+
props;
|
|
37
41
|
constructor(scope, id, props) {
|
|
38
42
|
super(scope, props?.cdk?.id || id);
|
|
39
|
-
this.functions = {};
|
|
40
43
|
this.id = id;
|
|
41
44
|
this.props = props || {};
|
|
42
45
|
this.cdk = {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|