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
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import Conf from "conf";
|
|
2
|
+
import { createHash, randomBytes } from "crypto";
|
|
3
|
+
import { postPayload } from "./post-payload.js";
|
|
4
|
+
import { getRawProjectId } from "./project-id.js";
|
|
5
|
+
import { getEnvironmentData } from "./environment.js";
|
|
6
|
+
import { cyan } from "colorette";
|
|
7
|
+
const TELEMETRY_API = "https://telemetry.sst.dev/events";
|
|
8
|
+
const TELEMETRY_KEY_ENABLED = "telemetry.enabled";
|
|
9
|
+
const TELEMETRY_KEY_NOTIFY_DATE = "telemetry.notifiedAt";
|
|
10
|
+
const TELEMETRY_KEY_ID = `telemetry.anonymousId`;
|
|
11
|
+
const conf = initializeConf();
|
|
12
|
+
const sessionId = randomBytes(32).toString("hex");
|
|
13
|
+
const projectId = hash(getRawProjectId());
|
|
14
|
+
const anonymousId = getAnonymousId();
|
|
15
|
+
notify();
|
|
16
|
+
export function enable() {
|
|
17
|
+
conf && conf.set(TELEMETRY_KEY_ENABLED, true);
|
|
18
|
+
}
|
|
19
|
+
export function disable() {
|
|
20
|
+
conf && conf.set(TELEMETRY_KEY_ENABLED, false);
|
|
21
|
+
}
|
|
22
|
+
export function isEnabled() {
|
|
23
|
+
if (!conf) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return conf.get(TELEMETRY_KEY_ENABLED, true) !== false;
|
|
27
|
+
}
|
|
28
|
+
export function trackCli(command) {
|
|
29
|
+
record("CLI_COMMAND", {
|
|
30
|
+
command,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function initializeConf() {
|
|
34
|
+
try {
|
|
35
|
+
// @ts-expect-error
|
|
36
|
+
return new Conf({ projectName: "sst" });
|
|
37
|
+
}
|
|
38
|
+
catch (_) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function notify() {
|
|
43
|
+
if (!conf || willNotRecord()) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
// Do not notify if user has been notified before.
|
|
47
|
+
if (conf.get(TELEMETRY_KEY_NOTIFY_DATE) !== undefined) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
conf.set(TELEMETRY_KEY_NOTIFY_DATE, Date.now().toString());
|
|
51
|
+
console.log(`${cyan("Attention")}: SST now collects completely anonymous telemetry regarding usage. This is used to guide SST's roadmap.`);
|
|
52
|
+
console.log(`You can learn more, including how to opt-out of this anonymous program, by heading over to:`);
|
|
53
|
+
console.log("https://docs.sst.dev/anonymous-telemetry");
|
|
54
|
+
console.log();
|
|
55
|
+
}
|
|
56
|
+
function willNotRecord() {
|
|
57
|
+
return !isEnabled() || !!process.env.SST_TELEMETRY_DISABLED;
|
|
58
|
+
}
|
|
59
|
+
function record(name, properties) {
|
|
60
|
+
if (willNotRecord()) {
|
|
61
|
+
return Promise.resolve();
|
|
62
|
+
}
|
|
63
|
+
const context = {
|
|
64
|
+
anonymousId,
|
|
65
|
+
projectId,
|
|
66
|
+
sessionId,
|
|
67
|
+
};
|
|
68
|
+
return postPayload(TELEMETRY_API, {
|
|
69
|
+
context,
|
|
70
|
+
environment: getEnvironmentData(),
|
|
71
|
+
events: [
|
|
72
|
+
{
|
|
73
|
+
name,
|
|
74
|
+
properties,
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function getAnonymousId() {
|
|
80
|
+
const val = conf && conf.get(TELEMETRY_KEY_ID);
|
|
81
|
+
if (val) {
|
|
82
|
+
return val;
|
|
83
|
+
}
|
|
84
|
+
const generated = randomBytes(32).toString("hex");
|
|
85
|
+
conf && conf.set(TELEMETRY_KEY_ID, generated);
|
|
86
|
+
return generated;
|
|
87
|
+
}
|
|
88
|
+
function hash(payload) {
|
|
89
|
+
return createHash("sha256").update(payload).digest("hex");
|
|
90
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" resolution-mode="require"/>
|
|
2
|
+
import { Stacks } from "../../stacks/index.js";
|
|
3
|
+
interface Props {
|
|
4
|
+
stacks: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const DeploymentUI: (props: Props) => JSX.Element;
|
|
7
|
+
export declare function printDeploymentResults(results: Awaited<ReturnType<typeof Stacks.deployMany>>): void;
|
|
8
|
+
export {};
|
|
@@ -4,6 +4,7 @@ import { useBus } from "../../bus.js";
|
|
|
4
4
|
import { Stacks } from "../../stacks/index.js";
|
|
5
5
|
import inkSpinner from "ink-spinner";
|
|
6
6
|
import { useProject } from "../../app.js";
|
|
7
|
+
import { blue, bold, green, red } from "colorette";
|
|
7
8
|
// @ts-ignore
|
|
8
9
|
const { default: Spinner } = inkSpinner;
|
|
9
10
|
const FullScreen = (props) => {
|
|
@@ -98,7 +99,44 @@ export const DeploymentUI = (props) => {
|
|
|
98
99
|
" ",
|
|
99
100
|
resource.LogicalResourceId,
|
|
100
101
|
" ",
|
|
101
|
-
resource.ResourceStatusReason
|
|
102
|
+
resource.ResourceStatusReason,
|
|
103
|
+
" "),
|
|
102
104
|
React.createElement(Text, { color: color(resource.ResourceStatus || "") }, resource.ResourceStatus))))));
|
|
103
105
|
})));
|
|
104
106
|
};
|
|
107
|
+
export function printDeploymentResults(results) {
|
|
108
|
+
console.log();
|
|
109
|
+
console.log(`----------------------------`);
|
|
110
|
+
console.log(`| Stack deployment results |`);
|
|
111
|
+
console.log(`----------------------------`);
|
|
112
|
+
for (const [stack, result] of Object.entries(results)) {
|
|
113
|
+
const icon = (() => {
|
|
114
|
+
if (Stacks.isSuccess(result.status))
|
|
115
|
+
return green("✔");
|
|
116
|
+
if (Stacks.isFailed(result.status))
|
|
117
|
+
return red("✖");
|
|
118
|
+
})();
|
|
119
|
+
console.log(`${icon} ${stack}`);
|
|
120
|
+
const outputs = Object.entries(result.outputs).filter(([key, _]) => {
|
|
121
|
+
if (key.startsWith("Export"))
|
|
122
|
+
return false;
|
|
123
|
+
if (key.includes("SstSiteEnv"))
|
|
124
|
+
return false;
|
|
125
|
+
return true;
|
|
126
|
+
});
|
|
127
|
+
if (outputs.length > 0) {
|
|
128
|
+
console.log(` ${blue("Outputs:")}`);
|
|
129
|
+
for (const key of Object.keys(Object.fromEntries(outputs)).sort()) {
|
|
130
|
+
const value = result.outputs[key];
|
|
131
|
+
console.log(bold(` ${key}: ${value}`));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (Object.entries(result.errors).length > 0) {
|
|
135
|
+
console.log(` ${red("Errors:")}`);
|
|
136
|
+
for (const [id, error] of Object.entries(result.errors)) {
|
|
137
|
+
console.log(bold(` ${id}: ${error}`));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
console.log();
|
|
142
|
+
}
|
|
File without changes
|
|
@@ -3,11 +3,20 @@ import { GetFunctionConfigurationCommand, LambdaClient, UpdateFunctionConfigurat
|
|
|
3
3
|
import { pipe, map } from "remeda";
|
|
4
4
|
import { useProject } from "./app.js";
|
|
5
5
|
import { useAWSClient } from "./credentials.js";
|
|
6
|
-
import {
|
|
6
|
+
import { Stacks } from "./stacks/index.js";
|
|
7
7
|
export var Config;
|
|
8
8
|
(function (Config) {
|
|
9
9
|
async function parameters() {
|
|
10
10
|
const result = [];
|
|
11
|
+
for await (const p of scan(PREFIX.FALLBACK)) {
|
|
12
|
+
const parsed = parse(p.Name);
|
|
13
|
+
if (parsed.type === "secrets")
|
|
14
|
+
continue;
|
|
15
|
+
result.push({
|
|
16
|
+
...parsed,
|
|
17
|
+
value: p.Value,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
11
20
|
for await (const p of scan(PREFIX.STAGE)) {
|
|
12
21
|
const parsed = parse(p.Name);
|
|
13
22
|
if (parsed.type === "secrets")
|
|
@@ -67,7 +76,7 @@ export var Config;
|
|
|
67
76
|
id: input.key,
|
|
68
77
|
type: "Secret",
|
|
69
78
|
prop: "value",
|
|
70
|
-
fallback:
|
|
79
|
+
fallback: input.fallback,
|
|
71
80
|
}),
|
|
72
81
|
Value: input.value,
|
|
73
82
|
Type: "SecureString",
|
|
@@ -103,8 +112,11 @@ export var Config;
|
|
|
103
112
|
Config.removeSecret = removeSecret;
|
|
104
113
|
async function restart(key) {
|
|
105
114
|
const lambda = useAWSClient(LambdaClient);
|
|
106
|
-
const
|
|
107
|
-
const filtered = Object.values(
|
|
115
|
+
const metadata = await Stacks.metadata();
|
|
116
|
+
const filtered = Object.values(metadata)
|
|
117
|
+
.flat()
|
|
118
|
+
.filter((f) => f.type === "Function")
|
|
119
|
+
.filter((f) => f.data.secrets.includes(key));
|
|
108
120
|
await Promise.all(filtered.map(async (f) => {
|
|
109
121
|
const config = await lambda.send(new GetFunctionConfigurationCommand({
|
|
110
122
|
FunctionName: f.data.arn,
|
|
@@ -393,7 +393,7 @@ export interface ApiProps<Authorizers extends Record<string, ApiAuthorizer> = Re
|
|
|
393
393
|
httpStages?: Omit<apig.HttpStageProps, "httpApi">[];
|
|
394
394
|
};
|
|
395
395
|
}
|
|
396
|
-
export declare type ApiRouteProps<AuthorizerKeys> = FunctionInlineDefinition | ApiFunctionRouteProps<AuthorizerKeys> | ApiHttpRouteProps<AuthorizerKeys> | ApiAlbRouteProps<AuthorizerKeys> | ApiPothosRouteProps<AuthorizerKeys>;
|
|
396
|
+
export declare type ApiRouteProps<AuthorizerKeys> = FunctionInlineDefinition | ApiFunctionRouteProps<AuthorizerKeys> | ApiHttpRouteProps<AuthorizerKeys> | ApiAlbRouteProps<AuthorizerKeys> | ApiGraphQLRouteProps<AuthorizerKeys> | ApiPothosRouteProps<AuthorizerKeys>;
|
|
397
397
|
interface ApiBaseRouteProps<AuthorizerKeys = string> {
|
|
398
398
|
authorizer?: "none" | "iam" | (string extends AuthorizerKeys ? Omit<AuthorizerKeys, "none" | "iam"> : AuthorizerKeys);
|
|
399
399
|
authorizationScopes?: string[];
|
|
@@ -487,20 +487,38 @@ export interface ApiAlbRouteProps<AuthorizersKeys> extends ApiBaseRouteProps<Aut
|
|
|
487
487
|
}
|
|
488
488
|
/**
|
|
489
489
|
* Specify a route handler that handles GraphQL queries using Pothos
|
|
490
|
-
*
|
|
490
|
+
* @deprecated "pothos" routes are deprecated for the Api construct, and will be removed in SST v2. Use "graphql" routes instead. Read more about how to upgrade here — https://docs.sst.dev/upgrade-guide#upgrade-to-v118
|
|
491
491
|
* @example
|
|
492
492
|
* ```js
|
|
493
|
+
* // Change
|
|
493
494
|
* api.addRoutes(stack, {
|
|
494
495
|
* "POST /graphql": {
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
*
|
|
503
|
-
*
|
|
496
|
+
* type: "pothos",
|
|
497
|
+
* function: {
|
|
498
|
+
* handler: "functions/graphql/graphql.ts",
|
|
499
|
+
* },
|
|
500
|
+
* schema: "backend/functions/graphql/schema.ts",
|
|
501
|
+
* output: "graphql/schema.graphql",
|
|
502
|
+
* commands: [
|
|
503
|
+
* "./genql graphql/graphql.schema graphql/
|
|
504
|
+
* ]
|
|
505
|
+
* }
|
|
506
|
+
* })
|
|
507
|
+
*
|
|
508
|
+
* // To
|
|
509
|
+
* api.addRoutes(stack, {
|
|
510
|
+
* "POST /graphql": {
|
|
511
|
+
* type: "graphql",
|
|
512
|
+
* function: {
|
|
513
|
+
* handler: "functions/graphql/graphql.ts",
|
|
514
|
+
* },
|
|
515
|
+
* pothos: {
|
|
516
|
+
* schema: "backend/functions/graphql/schema.ts",
|
|
517
|
+
* output: "graphql/schema.graphql",
|
|
518
|
+
* commands: [
|
|
519
|
+
* "./genql graphql/graphql.schema graphql/
|
|
520
|
+
* ]
|
|
521
|
+
* }
|
|
504
522
|
* }
|
|
505
523
|
* })
|
|
506
524
|
* ```
|
|
@@ -524,6 +542,49 @@ export interface ApiPothosRouteProps<AuthorizerKeys> extends ApiBaseRouteProps<A
|
|
|
524
542
|
*/
|
|
525
543
|
commands?: string[];
|
|
526
544
|
}
|
|
545
|
+
/**
|
|
546
|
+
* Specify a route handler that handles GraphQL queries using Pothos
|
|
547
|
+
*
|
|
548
|
+
* @example
|
|
549
|
+
* ```js
|
|
550
|
+
* api.addRoutes(stack, {
|
|
551
|
+
* "POST /graphql": {
|
|
552
|
+
* type: "graphql",
|
|
553
|
+
* function: {
|
|
554
|
+
* handler: "functions/graphql/graphql.ts",
|
|
555
|
+
* },
|
|
556
|
+
* pothos: {
|
|
557
|
+
* schema: "backend/functions/graphql/schema.ts",
|
|
558
|
+
* output: "graphql/schema.graphql",
|
|
559
|
+
* commands: [
|
|
560
|
+
* "./genql graphql/graphql.schema graphql/
|
|
561
|
+
* ]
|
|
562
|
+
* }
|
|
563
|
+
* }
|
|
564
|
+
* })
|
|
565
|
+
* ```
|
|
566
|
+
*/
|
|
567
|
+
export interface ApiGraphQLRouteProps<AuthorizerKeys> extends ApiBaseRouteProps<AuthorizerKeys> {
|
|
568
|
+
type: "graphql";
|
|
569
|
+
/**
|
|
570
|
+
* The function definition used to create the function for this route. Must be a graphql handler
|
|
571
|
+
*/
|
|
572
|
+
function: FunctionDefinition;
|
|
573
|
+
pothos?: {
|
|
574
|
+
/**
|
|
575
|
+
* Path to pothos schema
|
|
576
|
+
*/
|
|
577
|
+
schema?: string;
|
|
578
|
+
/**
|
|
579
|
+
* File to write graphql schema to
|
|
580
|
+
*/
|
|
581
|
+
output?: string;
|
|
582
|
+
/**
|
|
583
|
+
* Commands to run after generating schema. Useful for code generation steps
|
|
584
|
+
*/
|
|
585
|
+
commands?: string[];
|
|
586
|
+
};
|
|
587
|
+
}
|
|
527
588
|
/**
|
|
528
589
|
* The Api construct is a higher level CDK construct that makes it easy to create an API.
|
|
529
590
|
*
|
|
@@ -702,7 +763,17 @@ export declare class Api<Authorizers extends Record<string, ApiAuthorizer> = Rec
|
|
|
702
763
|
output: string | undefined;
|
|
703
764
|
commands: string[] | undefined;
|
|
704
765
|
} | {
|
|
705
|
-
type: "
|
|
766
|
+
type: "graphql";
|
|
767
|
+
route: string;
|
|
768
|
+
fn: {
|
|
769
|
+
node: string;
|
|
770
|
+
stack: string;
|
|
771
|
+
} | undefined;
|
|
772
|
+
schema: string | undefined;
|
|
773
|
+
output: string | undefined;
|
|
774
|
+
commands: string[] | undefined;
|
|
775
|
+
} | {
|
|
776
|
+
type: "lambda_function" | "url" | "alb";
|
|
706
777
|
route: string;
|
|
707
778
|
fn?: undefined;
|
|
708
779
|
schema?: undefined;
|
|
@@ -728,9 +799,24 @@ export declare class Api<Authorizers extends Record<string, ApiAuthorizer> = Rec
|
|
|
728
799
|
private createHttpIntegration;
|
|
729
800
|
private createAlbIntegration;
|
|
730
801
|
protected createPothosIntegration(scope: Construct, routeKey: string, routeProps: ApiPothosRouteProps<keyof Authorizers>, postfixName: string): apig.HttpRouteIntegration;
|
|
802
|
+
protected createGraphQLIntegration(scope: Construct, routeKey: string, routeProps: ApiGraphQLRouteProps<keyof Authorizers>, postfixName: string): apig.HttpRouteIntegration;
|
|
731
803
|
protected createCdkFunctionIntegration(scope: Construct, routeKey: string, routeProps: ApiFunctionRouteProps<keyof Authorizers>, postfixName: string): apig.HttpRouteIntegration;
|
|
732
804
|
protected createFunctionIntegration(scope: Construct, routeKey: string, routeProps: ApiFunctionRouteProps<keyof Authorizers>, postfixName: string): apig.HttpRouteIntegration;
|
|
733
805
|
private buildRouteAuth;
|
|
734
806
|
private normalizeRouteKey;
|
|
807
|
+
/**
|
|
808
|
+
* Binds the given list of resources to a specific route.
|
|
809
|
+
*
|
|
810
|
+
* @example
|
|
811
|
+
* ```js
|
|
812
|
+
* const api = new Api(stack, "Api");
|
|
813
|
+
*
|
|
814
|
+
* api.setCors({
|
|
815
|
+
* allowMethods: ["GET"],
|
|
816
|
+
* });
|
|
817
|
+
* ```
|
|
818
|
+
*
|
|
819
|
+
*/
|
|
820
|
+
setCors(cors?: boolean | ApiCorsProps): void;
|
|
735
821
|
}
|
|
736
822
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Construct } from "constructs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as cdkLib from "aws-cdk-lib";
|
|
3
3
|
import * as cognito from "aws-cdk-lib/aws-cognito";
|
|
4
4
|
import * as apig from "@aws-cdk/aws-apigatewayv2-alpha";
|
|
5
5
|
import * as apigAuthorizers from "@aws-cdk/aws-apigatewayv2-authorizers-alpha";
|
|
@@ -35,10 +35,16 @@ const PayloadFormatVersions = ["1.0", "2.0"];
|
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
37
|
export class Api extends Construct {
|
|
38
|
+
id;
|
|
39
|
+
cdk;
|
|
40
|
+
props;
|
|
41
|
+
_customDomainUrl;
|
|
42
|
+
routesData;
|
|
43
|
+
authorizersData;
|
|
44
|
+
bindingForAllRoutes = [];
|
|
45
|
+
permissionsAttachedForAllRoutes = [];
|
|
38
46
|
constructor(scope, id, props) {
|
|
39
47
|
super(scope, props?.cdk?.id || id);
|
|
40
|
-
this.bindingForAllRoutes = [];
|
|
41
|
-
this.permissionsAttachedForAllRoutes = [];
|
|
42
48
|
this.id = id;
|
|
43
49
|
this.props = props || {};
|
|
44
50
|
this.cdk = {};
|
|
@@ -121,7 +127,9 @@ export class Api extends Construct {
|
|
|
121
127
|
const route = this.routesData[this.normalizeRouteKey(routeKey)];
|
|
122
128
|
if (!route)
|
|
123
129
|
return;
|
|
124
|
-
if (route.type === "function" ||
|
|
130
|
+
if (route.type === "function" ||
|
|
131
|
+
route.type === "pothos" ||
|
|
132
|
+
route.type === "graphql") {
|
|
125
133
|
return route.function;
|
|
126
134
|
}
|
|
127
135
|
}
|
|
@@ -136,7 +144,9 @@ export class Api extends Construct {
|
|
|
136
144
|
*/
|
|
137
145
|
bind(constructs) {
|
|
138
146
|
for (const route of Object.values(this.routesData)) {
|
|
139
|
-
if (route.type === "function" ||
|
|
147
|
+
if (route.type === "function" ||
|
|
148
|
+
route.type === "pothos" ||
|
|
149
|
+
route.type === "graphql") {
|
|
140
150
|
route.function.bind(constructs);
|
|
141
151
|
}
|
|
142
152
|
}
|
|
@@ -175,7 +185,9 @@ export class Api extends Construct {
|
|
|
175
185
|
*/
|
|
176
186
|
attachPermissions(permissions) {
|
|
177
187
|
for (const route of Object.values(this.routesData)) {
|
|
178
|
-
if (route.type === "function" ||
|
|
188
|
+
if (route.type === "function" ||
|
|
189
|
+
route.type === "pothos" ||
|
|
190
|
+
route.type === "graphql") {
|
|
179
191
|
route.function.attachPermissions(permissions);
|
|
180
192
|
}
|
|
181
193
|
}
|
|
@@ -227,6 +239,15 @@ export class Api extends Construct {
|
|
|
227
239
|
output: data.output,
|
|
228
240
|
commands: data.commands,
|
|
229
241
|
};
|
|
242
|
+
if (data.type === "graphql")
|
|
243
|
+
return {
|
|
244
|
+
type: "graphql",
|
|
245
|
+
route: key,
|
|
246
|
+
fn: getFunctionRef(data.function),
|
|
247
|
+
schema: data.schema,
|
|
248
|
+
output: data.output,
|
|
249
|
+
commands: data.commands,
|
|
250
|
+
};
|
|
230
251
|
return { type: data.type, route: key };
|
|
231
252
|
}),
|
|
232
253
|
},
|
|
@@ -376,7 +397,7 @@ export class Api extends Construct {
|
|
|
376
397
|
value.responseTypes.map((type) => apigAuthorizers.HttpLambdaResponseType[type.toUpperCase()]),
|
|
377
398
|
resultsCacheTtl: value.resultsCacheTtl
|
|
378
399
|
? toCdkDuration(value.resultsCacheTtl)
|
|
379
|
-
:
|
|
400
|
+
: cdkLib.Duration.seconds(0),
|
|
380
401
|
});
|
|
381
402
|
}
|
|
382
403
|
}
|
|
@@ -450,6 +471,12 @@ export class Api extends Construct {
|
|
|
450
471
|
this.createPothosIntegration(scope, routeKey, routeValue, postfixName),
|
|
451
472
|
];
|
|
452
473
|
}
|
|
474
|
+
if (routeValue.type === "graphql") {
|
|
475
|
+
return [
|
|
476
|
+
routeValue,
|
|
477
|
+
this.createGraphQLIntegration(scope, routeKey, routeValue, postfixName),
|
|
478
|
+
];
|
|
479
|
+
}
|
|
453
480
|
if (routeValue.cdk?.function) {
|
|
454
481
|
return [
|
|
455
482
|
routeValue,
|
|
@@ -532,6 +559,24 @@ export class Api extends Construct {
|
|
|
532
559
|
}
|
|
533
560
|
return result;
|
|
534
561
|
}
|
|
562
|
+
createGraphQLIntegration(scope, routeKey, routeProps, postfixName) {
|
|
563
|
+
const result = this.createFunctionIntegration(scope, routeKey, {
|
|
564
|
+
...routeProps,
|
|
565
|
+
type: "function",
|
|
566
|
+
payloadFormatVersion: "2.0",
|
|
567
|
+
}, postfixName);
|
|
568
|
+
const data = this.routesData[routeKey];
|
|
569
|
+
if (data.type === "function") {
|
|
570
|
+
this.routesData[routeKey] = {
|
|
571
|
+
...data,
|
|
572
|
+
type: "graphql",
|
|
573
|
+
output: routeProps.pothos?.output,
|
|
574
|
+
schema: routeProps.pothos?.schema,
|
|
575
|
+
commands: routeProps.pothos?.commands,
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
return result;
|
|
579
|
+
}
|
|
535
580
|
createCdkFunctionIntegration(scope, routeKey, routeProps, postfixName) {
|
|
536
581
|
///////////////////
|
|
537
582
|
// Get payload format
|
|
@@ -633,4 +678,45 @@ export class Api extends Construct {
|
|
|
633
678
|
normalizeRouteKey(routeKey) {
|
|
634
679
|
return routeKey.split(/\s+/).join(" ");
|
|
635
680
|
}
|
|
681
|
+
/**
|
|
682
|
+
* Binds the given list of resources to a specific route.
|
|
683
|
+
*
|
|
684
|
+
* @example
|
|
685
|
+
* ```js
|
|
686
|
+
* const api = new Api(stack, "Api");
|
|
687
|
+
*
|
|
688
|
+
* api.setCors({
|
|
689
|
+
* allowMethods: ["GET"],
|
|
690
|
+
* });
|
|
691
|
+
* ```
|
|
692
|
+
*
|
|
693
|
+
*/
|
|
694
|
+
setCors(cors) {
|
|
695
|
+
const { cdk } = this.props;
|
|
696
|
+
if (isCDKConstruct(cdk?.httpApi)) {
|
|
697
|
+
// Cannot set CORS if cdk.httpApi is a construct.
|
|
698
|
+
if (cors !== undefined) {
|
|
699
|
+
throw new Error(`Cannot configure the "cors" when "cdk.httpApi" is a construct`);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
else {
|
|
703
|
+
// Cannot set CORS via cdk.httpApi. Always use Api.cors.
|
|
704
|
+
const httpApiProps = (cdk?.httpApi || {});
|
|
705
|
+
if (httpApiProps.corsPreflight !== undefined) {
|
|
706
|
+
throw new Error(`Cannot configure the "httpApi.corsPreflight" in the Api`);
|
|
707
|
+
}
|
|
708
|
+
const corsConfig = apigV2Cors.buildCorsConfig(cors);
|
|
709
|
+
if (corsConfig) {
|
|
710
|
+
const cfnApi = this.cdk.httpApi.node.defaultChild;
|
|
711
|
+
cfnApi.corsConfiguration = {
|
|
712
|
+
allowCredentials: corsConfig?.allowCredentials,
|
|
713
|
+
allowHeaders: corsConfig?.allowHeaders,
|
|
714
|
+
allowMethods: corsConfig?.allowMethods,
|
|
715
|
+
allowOrigins: corsConfig?.allowOrigins,
|
|
716
|
+
exposeHeaders: corsConfig?.exposeHeaders,
|
|
717
|
+
maxAge: corsConfig?.maxAge?.toSeconds(),
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
636
722
|
}
|
|
File without changes
|
|
@@ -44,13 +44,18 @@ const allowedMethods = [
|
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
46
|
export class ApiGatewayV1Api extends Construct {
|
|
47
|
+
id;
|
|
48
|
+
cdk;
|
|
49
|
+
_deployment;
|
|
50
|
+
_customDomainUrl;
|
|
51
|
+
importedResources = {};
|
|
52
|
+
props;
|
|
53
|
+
functions = {};
|
|
54
|
+
authorizersData = {};
|
|
55
|
+
bindingForAllRoutes = [];
|
|
56
|
+
permissionsAttachedForAllRoutes = [];
|
|
47
57
|
constructor(scope, id, props) {
|
|
48
58
|
super(scope, props?.cdk?.id || id);
|
|
49
|
-
this.importedResources = {};
|
|
50
|
-
this.functions = {};
|
|
51
|
-
this.authorizersData = {};
|
|
52
|
-
this.bindingForAllRoutes = [];
|
|
53
|
-
this.permissionsAttachedForAllRoutes = [];
|
|
54
59
|
this.id = id;
|
|
55
60
|
this.props = props || {};
|
|
56
61
|
this.cdk = {};
|
|
@@ -2,9 +2,8 @@ import * as cdk from "aws-cdk-lib";
|
|
|
2
2
|
import * as lambda from "aws-cdk-lib/aws-lambda";
|
|
3
3
|
import * as cxapi from "aws-cdk-lib/cx-api";
|
|
4
4
|
import { SSTConstruct } from "./Construct.js";
|
|
5
|
-
import { FunctionProps
|
|
5
|
+
import { FunctionProps } from "./Function.js";
|
|
6
6
|
import * as Config from "./Config.js";
|
|
7
|
-
import { BaseSiteEnvironmentOutputsInfo } from "./BaseSite.js";
|
|
8
7
|
import { Permissions } from "./util/permission.js";
|
|
9
8
|
import { StackProps } from "./Stack.js";
|
|
10
9
|
import { FunctionalStack } from "./FunctionalStack.js";
|
|
@@ -40,14 +39,8 @@ export interface AppDeployProps {
|
|
|
40
39
|
readonly debugStartedAt?: number;
|
|
41
40
|
readonly debugBridge?: string;
|
|
42
41
|
readonly debugIncreaseTimeout?: boolean;
|
|
43
|
-
readonly mode: "deploy" | "
|
|
42
|
+
readonly mode: "deploy" | "dev" | "remove";
|
|
44
43
|
readonly bootstrap: Awaited<ReturnType<typeof useBootstrap>>;
|
|
45
|
-
/**
|
|
46
|
-
* The callback after synth completes, used by `sst start`.
|
|
47
|
-
*
|
|
48
|
-
* @default - Defaults to undefined
|
|
49
|
-
*/
|
|
50
|
-
readonly synthCallback?: (lambdaHandlers: FunctionHandlerProps[], siteEnvironments: BaseSiteEnvironmentOutputsInfo[]) => void;
|
|
51
44
|
}
|
|
52
45
|
declare type AppRemovalPolicy = Lowercase<keyof typeof cdk.RemovalPolicy>;
|
|
53
46
|
export declare type AppProps = cdk.AppProps;
|
|
@@ -80,8 +73,6 @@ export declare class App extends cdk.App {
|
|
|
80
73
|
*/
|
|
81
74
|
readonly account: string;
|
|
82
75
|
/** @internal */
|
|
83
|
-
readonly buildDir: string;
|
|
84
|
-
/** @internal */
|
|
85
76
|
readonly debugBridge?: string;
|
|
86
77
|
/** @internal */
|
|
87
78
|
readonly debugEndpoint?: string;
|
|
@@ -102,15 +93,6 @@ export declare class App extends cdk.App {
|
|
|
102
93
|
private _defaultRemovalPolicy?;
|
|
103
94
|
/** @internal */
|
|
104
95
|
get defaultRemovalPolicy(): "destroy" | "retain" | "snapshot" | undefined;
|
|
105
|
-
/**
|
|
106
|
-
* The callback after synth completes.
|
|
107
|
-
*/
|
|
108
|
-
private readonly synthCallback?;
|
|
109
|
-
/**
|
|
110
|
-
* A list of Lambda functions in the app
|
|
111
|
-
*/
|
|
112
|
-
private readonly lambdaHandlers;
|
|
113
|
-
private readonly siteEnvironments;
|
|
114
96
|
/**
|
|
115
97
|
* Skip building Function code
|
|
116
98
|
* Note that on `sst remove`, we do not want to bundle the Lambda functions.
|
|
@@ -211,20 +193,16 @@ export declare class App extends cdk.App {
|
|
|
211
193
|
*/
|
|
212
194
|
addDefaultFunctionLayers(layers: lambda.ILayerVersion[]): void;
|
|
213
195
|
synth(options?: cdk.StageSynthesisOptions): cxapi.CloudAssembly;
|
|
214
|
-
|
|
196
|
+
finish(): Promise<void>;
|
|
215
197
|
isRunningSSTTest(): boolean;
|
|
216
|
-
registerLambdaHandler(handler: FunctionHandlerProps): void;
|
|
217
|
-
registerSiteEnvironment(environment: BaseSiteEnvironmentOutputsInfo): void;
|
|
218
198
|
getInputFilesFromEsbuildMetafile(file: string): Array<string>;
|
|
199
|
+
private createBindingSsmParameters;
|
|
219
200
|
private buildConstructsMetadata;
|
|
220
201
|
private buildConstructsMetadata_collectConstructs;
|
|
221
202
|
private applyRemovalPolicy;
|
|
222
203
|
private removeGovCloudUnsupportedResourceProperties;
|
|
223
204
|
private ensureUniqueConstructIds;
|
|
224
205
|
private codegenTypes;
|
|
225
|
-
private codegenFindNodeModulesPath;
|
|
226
|
-
private codegenCreateIndexType;
|
|
227
|
-
private codegenCreateConstructTypes;
|
|
228
206
|
stack<T extends FunctionalStack<any>>(fn: T, props?: StackProps & {
|
|
229
207
|
id?: string;
|
|
230
208
|
}): ReturnType<T> extends Promise<any> ? Promise<void> : App;
|