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,13 +1,11 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
2
|
// Note: disabling ban-type rule so we don't get an error referencing the class Function
|
|
3
3
|
import path from "path";
|
|
4
|
-
import fs from "fs-extra";
|
|
5
4
|
import * as cdk from "aws-cdk-lib";
|
|
6
5
|
import * as iam from "aws-cdk-lib/aws-iam";
|
|
7
6
|
import * as lambda from "aws-cdk-lib/aws-lambda";
|
|
8
7
|
import * as logs from "aws-cdk-lib/aws-logs";
|
|
9
8
|
import * as ssm from "aws-cdk-lib/aws-ssm";
|
|
10
|
-
import { Runtime, } from "@serverless-stack/core";
|
|
11
9
|
import { Stack } from "./Stack.js";
|
|
12
10
|
import { Job } from "./Job.js";
|
|
13
11
|
import { Secret } from "./Config.js";
|
|
@@ -21,6 +19,8 @@ import url from "url";
|
|
|
21
19
|
import { useDeferredTasks } from "./deferred_task.js";
|
|
22
20
|
import { useWarning } from "./util/warning.js";
|
|
23
21
|
import { useProject } from "../app.js";
|
|
22
|
+
import { useRuntimeHandlers } from "../runtime/handlers.js";
|
|
23
|
+
import { createAppContext } from "./context.js";
|
|
24
24
|
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
25
25
|
const supportedRuntimes = {
|
|
26
26
|
nodejs: lambda.Runtime.NODEJS,
|
|
@@ -31,6 +31,7 @@ const supportedRuntimes = {
|
|
|
31
31
|
"nodejs12.x": lambda.Runtime.NODEJS_12_X,
|
|
32
32
|
"nodejs14.x": lambda.Runtime.NODEJS_14_X,
|
|
33
33
|
"nodejs16.x": lambda.Runtime.NODEJS_16_X,
|
|
34
|
+
"nodejs18.x": lambda.Runtime.NODEJS_18_X,
|
|
34
35
|
"python2.7": lambda.Runtime.PYTHON_2_7,
|
|
35
36
|
"python3.6": lambda.Runtime.PYTHON_3_6,
|
|
36
37
|
"python3.7": lambda.Runtime.PYTHON_3_7,
|
|
@@ -59,6 +60,12 @@ const supportedRuntimes = {
|
|
|
59
60
|
* ```
|
|
60
61
|
*/
|
|
61
62
|
export class Function extends lambda.Function {
|
|
63
|
+
id;
|
|
64
|
+
_isLiveDevEnabled;
|
|
65
|
+
/** @internal */
|
|
66
|
+
_disableBind;
|
|
67
|
+
functionUrl;
|
|
68
|
+
props;
|
|
62
69
|
constructor(scope, id, props) {
|
|
63
70
|
const app = scope.node.root;
|
|
64
71
|
const stack = Stack.of(scope);
|
|
@@ -77,7 +84,6 @@ export class Function extends lambda.Function {
|
|
|
77
84
|
: props.functionName({ stack, functionProps: props }));
|
|
78
85
|
const handler = props.handler;
|
|
79
86
|
const timeout = Function.normalizeTimeout(props.timeout);
|
|
80
|
-
const srcPath = Function.normalizeSrcPath(props.srcPath || ".");
|
|
81
87
|
const runtime = Function.normalizeRuntime(props.runtime);
|
|
82
88
|
const architecture = (() => {
|
|
83
89
|
if (props.architecture === "arm_64")
|
|
@@ -91,7 +97,6 @@ export class Function extends lambda.Function {
|
|
|
91
97
|
const tracing = lambda.Tracing[(props.tracing || "active").toUpperCase()];
|
|
92
98
|
const logRetention = props.logRetention &&
|
|
93
99
|
logs.RetentionDays[props.logRetention.toUpperCase()];
|
|
94
|
-
let bundle = props.bundle;
|
|
95
100
|
const isLiveDevEnabled = props.enableLiveDev === false ? false : true;
|
|
96
101
|
// Validate handler
|
|
97
102
|
if (!handler) {
|
|
@@ -101,30 +106,13 @@ export class Function extends lambda.Function {
|
|
|
101
106
|
const isNodeRuntime = runtime.startsWith("nodejs");
|
|
102
107
|
const isPythonRuntime = runtime.startsWith("python");
|
|
103
108
|
const isJavaRuntime = runtime.startsWith("java");
|
|
104
|
-
if (isNodeRuntime) {
|
|
105
|
-
bundle = bundle === undefined ? true : props.bundle;
|
|
106
|
-
if (!bundle && srcPath === ".") {
|
|
107
|
-
throw new Error(`Bundle cannot be disabled for the "${id}" function since the "srcPath" is set to the project root. Read more here — https://github.com/serverless-stack/sst/issues/78`);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
else if (isPythonRuntime) {
|
|
111
|
-
bundle = bundle === undefined ? {} : props.bundle;
|
|
112
|
-
if (srcPath === ".") {
|
|
113
|
-
throw new Error(`Cannot set the "srcPath" to the project root for the "${id}" function.`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
const localId = path.posix
|
|
117
|
-
.join(scope.node.path, id)
|
|
118
|
-
.replace(/\$/g, "-")
|
|
119
|
-
.replace(/\//g, "-")
|
|
120
|
-
.replace(/\./g, "-");
|
|
121
109
|
// Handle local development (ie. sst start)
|
|
122
110
|
// - set runtime to nodejs12.x for non-Node runtimes (b/c the stub is in Node)
|
|
123
111
|
// - set retry to 0. When the debugger is disconnected, the Cron construct
|
|
124
112
|
// will still try to periodically invoke the Lambda, and the requests would
|
|
125
113
|
// fail and retry. So when launching `sst start`, a couple of retry requests
|
|
126
114
|
// from recent failed request will be received. And this behavior is confusing.
|
|
127
|
-
if (isLiveDevEnabled && app.mode === "
|
|
115
|
+
if (isLiveDevEnabled && app.mode === "dev") {
|
|
128
116
|
// If debugIncreaseTimeout is enabled:
|
|
129
117
|
// set timeout to 900s. This will give people more time to debug the function
|
|
130
118
|
// without timing out the request. Note API Gateway requests have a maximum
|
|
@@ -147,17 +135,13 @@ export class Function extends lambda.Function {
|
|
|
147
135
|
ephemeralStorageSize: diskSize,
|
|
148
136
|
timeout,
|
|
149
137
|
tracing,
|
|
150
|
-
environment:
|
|
151
|
-
...(props.environment || {}),
|
|
152
|
-
SST_DEBUG_SRC_PATH: srcPath,
|
|
153
|
-
SST_DEBUG_SRC_HANDLER: handler,
|
|
154
|
-
SST_FUNCTION_ID: localId,
|
|
155
|
-
},
|
|
138
|
+
environment: props.environment,
|
|
156
139
|
layers: [],
|
|
157
140
|
logRetention,
|
|
158
141
|
retryAttempts: 0,
|
|
159
142
|
...(debugOverrideProps || {}),
|
|
160
143
|
});
|
|
144
|
+
this.addEnvironment("SST_FUNCTION_ID", this.node.addr);
|
|
161
145
|
this.attachPermissions([
|
|
162
146
|
new iam.PolicyStatement({
|
|
163
147
|
actions: ["iot:*"],
|
|
@@ -205,41 +189,30 @@ export class Function extends lambda.Function {
|
|
|
205
189
|
});
|
|
206
190
|
useDeferredTasks().add(async () => {
|
|
207
191
|
// Build function
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
runtime,
|
|
213
|
-
srcPath,
|
|
214
|
-
bundle: props.bundle,
|
|
215
|
-
});
|
|
216
|
-
// Python builder returns AssetCode instead of directory
|
|
217
|
-
const code = (() => {
|
|
218
|
-
if ("directory" in bundled) {
|
|
219
|
-
Function.copyFiles(bundle, srcPath, bundled.directory);
|
|
220
|
-
return lambda.AssetCode.fromAsset(bundled.directory);
|
|
221
|
-
}
|
|
222
|
-
return bundled.asset;
|
|
223
|
-
})();
|
|
192
|
+
const result = await useRuntimeHandlers().build(this.node.addr, "deploy");
|
|
193
|
+
if (result.type === "error")
|
|
194
|
+
throw new Error(`Failed to build function "${props.handler}"`);
|
|
195
|
+
const code = lambda.AssetCode.fromAsset(result.out);
|
|
224
196
|
// Update function's code
|
|
225
197
|
const codeConfig = code.bind(this);
|
|
226
198
|
const cfnFunction = this.node.defaultChild;
|
|
227
199
|
cfnFunction.runtime = supportedRuntimes[runtime].toString();
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
200
|
+
/*
|
|
201
|
+
if (isJavaRuntime) {
|
|
202
|
+
const providedRuntime = (bundle as FunctionBundleJavaProps)
|
|
203
|
+
.experimentalUseProvidedRuntime;
|
|
204
|
+
if (providedRuntime) {
|
|
205
|
+
cfnFunction.runtime = providedRuntime;
|
|
206
|
+
}
|
|
234
207
|
}
|
|
208
|
+
*/
|
|
235
209
|
cfnFunction.code = {
|
|
236
210
|
s3Bucket: codeConfig.s3Location?.bucketName,
|
|
237
211
|
s3Key: codeConfig.s3Location?.objectKey,
|
|
238
212
|
s3ObjectVersion: codeConfig.s3Location?.objectVersion,
|
|
239
213
|
};
|
|
240
|
-
cfnFunction.handler =
|
|
241
|
-
|
|
242
|
-
// code.bindToResource(cfnFunction);
|
|
214
|
+
cfnFunction.handler = result.handler;
|
|
215
|
+
code.bindToResource(cfnFunction);
|
|
243
216
|
});
|
|
244
217
|
}
|
|
245
218
|
this.id = id;
|
|
@@ -262,14 +235,8 @@ export class Function extends lambda.Function {
|
|
|
262
235
|
this.addConfig(props.config || []);
|
|
263
236
|
this.bind(props.bind || []);
|
|
264
237
|
this.createUrl();
|
|
265
|
-
app.registerLambdaHandler({
|
|
266
|
-
bundle: props.bundle,
|
|
267
|
-
handler,
|
|
268
|
-
runtime,
|
|
269
|
-
srcPath,
|
|
270
|
-
});
|
|
271
238
|
this._isLiveDevEnabled = isLiveDevEnabled;
|
|
272
|
-
this.
|
|
239
|
+
useFunctions().add(this.node.addr, props);
|
|
273
240
|
}
|
|
274
241
|
/**
|
|
275
242
|
* The AWS generated URL of the Function.
|
|
@@ -286,7 +253,6 @@ export class Function extends lambda.Function {
|
|
|
286
253
|
* ```
|
|
287
254
|
*/
|
|
288
255
|
bind(constructs) {
|
|
289
|
-
const app = this.node.root;
|
|
290
256
|
constructs.forEach((c) => {
|
|
291
257
|
// Bind environment
|
|
292
258
|
const env = bindEnvironment(c);
|
|
@@ -353,10 +319,8 @@ export class Function extends lambda.Function {
|
|
|
353
319
|
return {
|
|
354
320
|
type: "Function",
|
|
355
321
|
data: {
|
|
356
|
-
localId: this.localId,
|
|
357
|
-
srcPath: this.props.srcPath,
|
|
358
|
-
handler: this.props.handler,
|
|
359
322
|
arn: this.functionArn,
|
|
323
|
+
localId: this.node.addr,
|
|
360
324
|
secrets: [...(config || []), ...(bind || [])]
|
|
361
325
|
.filter((c) => c instanceof Secret)
|
|
362
326
|
.map((c) => c.name),
|
|
@@ -428,7 +392,7 @@ export class Function extends lambda.Function {
|
|
|
428
392
|
return cdk.Duration.seconds(timeout || 10);
|
|
429
393
|
}
|
|
430
394
|
static normalizeRuntime(runtime) {
|
|
431
|
-
runtime = runtime || "
|
|
395
|
+
runtime = runtime || "nodejs18.x";
|
|
432
396
|
if (!supportedRuntimes[runtime]) {
|
|
433
397
|
throw new Error(`The specified runtime is not supported for sst.Function. Only NodeJS, Python, Go, and .NET runtimes are currently supported.`);
|
|
434
398
|
}
|
|
@@ -437,24 +401,6 @@ export class Function extends lambda.Function {
|
|
|
437
401
|
static normalizeSrcPath(srcPath) {
|
|
438
402
|
return srcPath.replace(/\/+$/, "");
|
|
439
403
|
}
|
|
440
|
-
static copyFiles(bundle, srcPath, buildPath) {
|
|
441
|
-
if (!bundle)
|
|
442
|
-
return;
|
|
443
|
-
if (typeof bundle === "boolean")
|
|
444
|
-
return;
|
|
445
|
-
if (!bundle.copyFiles)
|
|
446
|
-
return;
|
|
447
|
-
bundle.copyFiles.forEach((entry) => {
|
|
448
|
-
const fromPath = path.join(srcPath, entry.from);
|
|
449
|
-
if (!fs.existsSync(fromPath))
|
|
450
|
-
throw new Error(`Tried to copy nonexistent file from "${path.resolve(fromPath)}" - check copyFiles entry "${entry.from}"`);
|
|
451
|
-
const to = entry.to || entry.from;
|
|
452
|
-
if (path.isAbsolute(to))
|
|
453
|
-
throw new Error(`Copy destination path "${to}" must be relative`);
|
|
454
|
-
const toPath = path.join(buildPath, to);
|
|
455
|
-
fs.copySync(fromPath, toPath);
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
404
|
static handleImportedLayer(scope, layer) {
|
|
459
405
|
const layerStack = Stack.of(layer);
|
|
460
406
|
const currentStack = Stack.of(scope);
|
|
@@ -558,3 +504,17 @@ export class Function extends lambda.Function {
|
|
|
558
504
|
};
|
|
559
505
|
}
|
|
560
506
|
}
|
|
507
|
+
export const useFunctions = createAppContext(() => {
|
|
508
|
+
const functions = {};
|
|
509
|
+
return {
|
|
510
|
+
fromID(id) {
|
|
511
|
+
return functions[id];
|
|
512
|
+
},
|
|
513
|
+
add(name, props) {
|
|
514
|
+
functions[name] = props;
|
|
515
|
+
},
|
|
516
|
+
get all() {
|
|
517
|
+
return functions;
|
|
518
|
+
},
|
|
519
|
+
};
|
|
520
|
+
});
|
|
File without changes
|
|
@@ -6,6 +6,11 @@ export function stack(app, fn, props) {
|
|
|
6
6
|
const exists = getExports(app).has(fn);
|
|
7
7
|
if (exists)
|
|
8
8
|
throw new Error(`StackDuplicates: Attempting to initialize stack ${id} several times`);
|
|
9
|
+
class EmptyStack extends Stack {
|
|
10
|
+
constructor(scope, id, props) {
|
|
11
|
+
super(scope, id, props);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
9
14
|
const stack = new EmptyStack(app, id, props);
|
|
10
15
|
getStacks(app).set(fn, stack);
|
|
11
16
|
const ctx = {
|
|
@@ -55,8 +60,3 @@ export function getStack(stack) {
|
|
|
55
60
|
throw new Error(`StackWrongOrder: Initialize "${stack.name}" stack before "${currentStack?.name}" stack`);
|
|
56
61
|
return stacks.get(stack);
|
|
57
62
|
}
|
|
58
|
-
class EmptyStack extends Stack {
|
|
59
|
-
constructor(scope, id, props) {
|
|
60
|
-
super(scope, id, props);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -75,7 +75,17 @@ export declare class GraphQLApi extends Api {
|
|
|
75
75
|
output: string | undefined;
|
|
76
76
|
commands: string[] | undefined;
|
|
77
77
|
} | {
|
|
78
|
-
type: "
|
|
78
|
+
type: "graphql";
|
|
79
|
+
route: string;
|
|
80
|
+
fn: {
|
|
81
|
+
node: string;
|
|
82
|
+
stack: string;
|
|
83
|
+
} | undefined;
|
|
84
|
+
schema: string | undefined;
|
|
85
|
+
output: string | undefined;
|
|
86
|
+
commands: string[] | undefined;
|
|
87
|
+
} | {
|
|
88
|
+
type: "lambda_function" | "url" | "alb";
|
|
79
89
|
route: string;
|
|
80
90
|
fn?: undefined;
|
|
81
91
|
schema?: undefined;
|
|
@@ -15,6 +15,9 @@ import { Api } from "./Api.js";
|
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
17
|
export class GraphQLApi extends Api {
|
|
18
|
+
codegen;
|
|
19
|
+
lambdaIntegration;
|
|
20
|
+
rootPath;
|
|
18
21
|
constructor(scope, id, props) {
|
|
19
22
|
if ("routes" in props || !props.server) {
|
|
20
23
|
throw new Error(`Please use the "server" option instead of the "routes" to configure the handler for the "${id}" GraphQLApi`);
|
|
@@ -19,20 +19,6 @@ export interface JobProps {
|
|
|
19
19
|
*```
|
|
20
20
|
*/
|
|
21
21
|
handler: string;
|
|
22
|
-
/**
|
|
23
|
-
* Root directory of the project, typically where package.json is located. Set if using a monorepo with multiple subpackages
|
|
24
|
-
*
|
|
25
|
-
* @default Defaults to the same directory as sst.json
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```js
|
|
29
|
-
* new Job(stack, "MyJob", {
|
|
30
|
-
* srcPath: "services",
|
|
31
|
-
* handler: "job.handler",
|
|
32
|
-
* })
|
|
33
|
-
*```
|
|
34
|
-
*/
|
|
35
|
-
srcPath?: string;
|
|
36
22
|
/**
|
|
37
23
|
* The amount of memory in MB allocated.
|
|
38
24
|
*
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
// import path from "path";
|
|
2
2
|
import url from "url";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import fs from "fs
|
|
4
|
+
import fs from "fs/promises";
|
|
5
5
|
import { Construct } from "constructs";
|
|
6
6
|
import * as iam from "aws-cdk-lib/aws-iam";
|
|
7
7
|
import * as lambda from "aws-cdk-lib/aws-lambda";
|
|
8
8
|
import * as codebuild from "aws-cdk-lib/aws-codebuild";
|
|
9
|
-
import { Runtime } from "@serverless-stack/core";
|
|
10
9
|
import { Function } from "./Function.js";
|
|
11
10
|
import { toCdkDuration } from "./util/duration.js";
|
|
12
11
|
import { attachPermissionsToRole } from "./util/permission.js";
|
|
@@ -14,6 +13,7 @@ import { bindEnvironment, bindPermissions } from "./util/functionBinding.js";
|
|
|
14
13
|
import { useDeferredTasks } from "./deferred_task.js";
|
|
15
14
|
import { useWarning } from "./util/warning.js";
|
|
16
15
|
import { useProject } from "../app.js";
|
|
16
|
+
import { useRuntimeHandlers } from "../runtime/handlers.js";
|
|
17
17
|
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
18
18
|
/////////////////////
|
|
19
19
|
// Construct
|
|
@@ -33,6 +33,12 @@ const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
35
|
export class Job extends Construct {
|
|
36
|
+
id;
|
|
37
|
+
localId;
|
|
38
|
+
props;
|
|
39
|
+
job;
|
|
40
|
+
isLiveDevEnabled;
|
|
41
|
+
_jobInvoker;
|
|
36
42
|
constructor(scope, id, props) {
|
|
37
43
|
super(scope, props.cdk?.id || id);
|
|
38
44
|
const app = this.node.root;
|
|
@@ -175,54 +181,54 @@ export class Job extends Construct {
|
|
|
175
181
|
});
|
|
176
182
|
}
|
|
177
183
|
buildCodeBuildProjectCode() {
|
|
178
|
-
const { handler, srcPath: srcPathRaw } = this.props;
|
|
179
|
-
const srcPath = Function.normalizeSrcPath(srcPathRaw || ".");
|
|
180
|
-
const bundle = { format: "esm" };
|
|
181
184
|
const app = this.node.root;
|
|
182
185
|
// Handle remove (ie. sst remove)
|
|
183
|
-
if (app.
|
|
186
|
+
if (app.mode !== "deploy") {
|
|
184
187
|
// do nothing
|
|
185
188
|
}
|
|
186
189
|
// Handle build
|
|
187
190
|
else {
|
|
188
191
|
useDeferredTasks().add(async () => {
|
|
189
192
|
// Build function
|
|
193
|
+
/*
|
|
190
194
|
const bundled = await Runtime.Handler.bundle({
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
})
|
|
195
|
+
id: this.localId,
|
|
196
|
+
root: app.appPath,
|
|
197
|
+
handler,
|
|
198
|
+
runtime: "nodejs16.x",
|
|
199
|
+
srcPath,
|
|
200
|
+
bundle
|
|
201
|
+
})!;
|
|
202
|
+
*/
|
|
203
|
+
// TODO: Fix
|
|
204
|
+
const bundle = await useRuntimeHandlers().build(this.node.addr, "deploy");
|
|
205
|
+
// handle copy files
|
|
206
|
+
// create wrapper that calls the handler
|
|
207
|
+
if (bundle.type === "error")
|
|
208
|
+
throw new Error(`Failed to build job "${this.props.handler}"`);
|
|
209
|
+
const parsed = path.parse(bundle.handler);
|
|
210
|
+
await fs.writeFile(path.join(bundle.out, "handler-wrapper.js"), [
|
|
211
|
+
`console.log("")`,
|
|
212
|
+
`console.log("//////////////////////")`,
|
|
213
|
+
`console.log("// Start of the job //")`,
|
|
214
|
+
`console.log("//////////////////////")`,
|
|
215
|
+
`console.log("")`,
|
|
216
|
+
`import { ${parsed.ext.substring(1)} } from "./${path.join(parsed.dir, parsed.name)}.mjs";`,
|
|
217
|
+
`const event = JSON.parse(process.env.SST_PAYLOAD);`,
|
|
218
|
+
`const result = await ${parsed.name}(event);`,
|
|
219
|
+
`console.log("")`,
|
|
220
|
+
`console.log("----------------------")`,
|
|
221
|
+
`console.log("")`,
|
|
222
|
+
`console.log("Result:", result);`,
|
|
223
|
+
`console.log("")`,
|
|
224
|
+
`console.log("//////////////////////")`,
|
|
225
|
+
`console.log("// End of the job //")`,
|
|
226
|
+
`console.log("//////////////////////")`,
|
|
227
|
+
`console.log("")`,
|
|
228
|
+
].join("\n"));
|
|
229
|
+
const code = lambda.AssetCode.fromAsset(bundle.out);
|
|
230
|
+
this.updateCodeBuildProjectCode(code, "handler-wrapper.js");
|
|
198
231
|
// This should always be true b/c runtime is always Node.js
|
|
199
|
-
if ("directory" in bundled) {
|
|
200
|
-
// handle copy files
|
|
201
|
-
Function.copyFiles(bundle, srcPath, bundled.directory);
|
|
202
|
-
// create wrapper that calls the handler
|
|
203
|
-
const [file, module] = bundled.handler.split(".");
|
|
204
|
-
await fs.writeFile(path.join(bundled.directory, "handler-wrapper.js"), [
|
|
205
|
-
`console.log("")`,
|
|
206
|
-
`console.log("//////////////////////")`,
|
|
207
|
-
`console.log("// Start of the job //")`,
|
|
208
|
-
`console.log("//////////////////////")`,
|
|
209
|
-
`console.log("")`,
|
|
210
|
-
`import { ${module} } from "./${file}.js";`,
|
|
211
|
-
`const event = JSON.parse(process.env.SST_PAYLOAD);`,
|
|
212
|
-
`const result = await ${module}(event);`,
|
|
213
|
-
`console.log("")`,
|
|
214
|
-
`console.log("----------------------")`,
|
|
215
|
-
`console.log("")`,
|
|
216
|
-
`console.log("Result:", result);`,
|
|
217
|
-
`console.log("")`,
|
|
218
|
-
`console.log("//////////////////////")`,
|
|
219
|
-
`console.log("// End of the job //")`,
|
|
220
|
-
`console.log("//////////////////////")`,
|
|
221
|
-
`console.log("")`,
|
|
222
|
-
].join("\n"));
|
|
223
|
-
const code = lambda.AssetCode.fromAsset(bundled.directory);
|
|
224
|
-
this.updateCodeBuildProjectCode(code, "handler-wrapper.js");
|
|
225
|
-
}
|
|
226
232
|
});
|
|
227
233
|
}
|
|
228
234
|
}
|
|
@@ -252,14 +258,13 @@ export class Job extends Construct {
|
|
|
252
258
|
]);
|
|
253
259
|
}
|
|
254
260
|
createLocalInvoker() {
|
|
255
|
-
const {
|
|
261
|
+
const { handler, config, environment, permissions } = this.props;
|
|
256
262
|
// Note: make the invoker function the same ID as the Job
|
|
257
263
|
// construct so users can identify the invoker function
|
|
258
264
|
// in the Console.
|
|
259
265
|
const fn = new Function(this, this.node.id, {
|
|
260
|
-
srcPath,
|
|
261
266
|
handler,
|
|
262
|
-
|
|
267
|
+
nodejs: { format: "esm" },
|
|
263
268
|
runtime: "nodejs16.x",
|
|
264
269
|
timeout: 10,
|
|
265
270
|
memorySize: 1024,
|
|
@@ -274,8 +279,7 @@ export class Job extends Construct {
|
|
|
274
279
|
}
|
|
275
280
|
createCodeBuildInvoker() {
|
|
276
281
|
return new Function(this, this.node.id, {
|
|
277
|
-
|
|
278
|
-
handler: "index.main",
|
|
282
|
+
handler: path.join(__dirname, "../dist/support/job-invoke/index.main"),
|
|
279
283
|
runtime: "nodejs16.x",
|
|
280
284
|
timeout: 10,
|
|
281
285
|
memorySize: 1024,
|
|
@@ -289,7 +293,7 @@ export class Job extends Construct {
|
|
|
289
293
|
resources: [this.job.projectArn],
|
|
290
294
|
}),
|
|
291
295
|
],
|
|
292
|
-
|
|
296
|
+
nodejs: {
|
|
293
297
|
format: "esm",
|
|
294
298
|
},
|
|
295
299
|
});
|
|
File without changes
|
|
@@ -23,11 +23,14 @@ import { Function as Fn, } from "./Function.js";
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
export class KinesisStream extends Construct {
|
|
26
|
+
id;
|
|
27
|
+
cdk;
|
|
28
|
+
functions = {};
|
|
29
|
+
bindingForAllConsumers = [];
|
|
30
|
+
permissionsAttachedForAllConsumers = [];
|
|
31
|
+
props;
|
|
26
32
|
constructor(scope, id, props) {
|
|
27
33
|
super(scope, props?.cdk?.id || id);
|
|
28
|
-
this.functions = {};
|
|
29
|
-
this.bindingForAllConsumers = [];
|
|
30
|
-
this.permissionsAttachedForAllConsumers = [];
|
|
31
34
|
this.id = id;
|
|
32
35
|
this.props = props || {};
|
|
33
36
|
this.cdk = {};
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import * as lambda from "aws-cdk-lib/aws-lambda";
|
|
3
|
+
import * as cloudfront from "aws-cdk-lib/aws-cloudfront";
|
|
4
|
+
import { SsrSite, SsrSiteProps } from "./SsrSite.js";
|
|
5
|
+
export interface NextjsSiteProps extends Omit<SsrSiteProps, "edge"> {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The `NextjsSite` construct is a higher level CDK construct that makes it easy to create a Next.js app.
|
|
9
|
+
* @example
|
|
10
|
+
* Deploys a Next.js app in the `my-next-app` directory.
|
|
11
|
+
*
|
|
12
|
+
* ```js
|
|
13
|
+
* new NextjsSite(stack, "web", {
|
|
14
|
+
* path: "my-next-app/",
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare class NextjsSite extends SsrSite {
|
|
19
|
+
constructor(scope: Construct, id: string, props: NextjsSiteProps);
|
|
20
|
+
protected initBuildConfig(): {
|
|
21
|
+
serverBuildOutputFile: string;
|
|
22
|
+
clientBuildOutputDir: string;
|
|
23
|
+
clientBuildVersionedSubDir: string;
|
|
24
|
+
siteStub: string;
|
|
25
|
+
};
|
|
26
|
+
protected createFunctionForRegional(): lambda.Function;
|
|
27
|
+
protected createCloudFrontDistributionForRegional(): cloudfront.Distribution;
|
|
28
|
+
protected createCloudFrontDistributionForStub(): cloudfront.Distribution;
|
|
29
|
+
protected createCloudFrontServerCachePolicy(): cloudfront.CachePolicy;
|
|
30
|
+
protected generateBuildId(): string;
|
|
31
|
+
private createImageOptimizationFunctionForRegional;
|
|
32
|
+
private createMiddlewareEdgeFunctionForRegional;
|
|
33
|
+
}
|