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,26 +1,17 @@
|
|
|
1
|
+
import { green, yellow } from "colorette";
|
|
1
2
|
import fs from "fs/promises";
|
|
2
3
|
import path from "path";
|
|
3
|
-
const
|
|
4
|
-
"@serverless-stack/resources",
|
|
5
|
-
"@serverless-stack/cli",
|
|
6
|
-
"@serverless-stack/cli2",
|
|
7
|
-
"@serverless-stack/node",
|
|
8
|
-
"@serverless-stack/static-site-env",
|
|
9
|
-
];
|
|
4
|
+
const PACKAGE_MATCH = ["sst", "aws-cdk", "@aws-cdk"];
|
|
10
5
|
const FIELDS = ["dependencies", "devDependencies"];
|
|
11
6
|
export const update = (program) => program.command("update [ver]", "Update SST and CDK packages to another version", (yargs) => yargs.positional("ver", {
|
|
12
7
|
type: "string",
|
|
13
8
|
describe: "Optional SST version to update to",
|
|
14
9
|
}), async (args) => {
|
|
15
10
|
const { fetch } = await import("undici");
|
|
16
|
-
const {
|
|
17
|
-
const { useProject } = await import("../../app");
|
|
11
|
+
const { useProject } = await import("../../app.js");
|
|
18
12
|
const project = useProject();
|
|
19
13
|
const files = await find(project.paths.root);
|
|
20
|
-
const
|
|
21
|
-
(await fetch(`https://registry.npmjs.org/@serverless-stack/core/latest`)
|
|
22
|
-
.then((resp) => resp.json())
|
|
23
|
-
.then((resp) => resp.version));
|
|
14
|
+
const metadata = await fetch(`https://registry.npmjs.org/sst/${args.ver || "latest"}`).then((resp) => resp.json());
|
|
24
15
|
const results = new Map();
|
|
25
16
|
const tasks = files.map(async (file) => {
|
|
26
17
|
const data = await fs
|
|
@@ -32,31 +23,36 @@ export const update = (program) => program.command("update [ver]", "Update SST a
|
|
|
32
23
|
if (!deps)
|
|
33
24
|
continue;
|
|
34
25
|
for (const [pkg, existing] of Object.entries(deps)) {
|
|
35
|
-
if (!
|
|
26
|
+
if (!PACKAGE_MATCH.some((x) => pkg.startsWith(x)))
|
|
27
|
+
continue;
|
|
28
|
+
const desired = pkg === "sst"
|
|
29
|
+
? metadata.version
|
|
30
|
+
: metadata.dependencies["aws-cdk-lib"];
|
|
31
|
+
if (existing === desired)
|
|
36
32
|
continue;
|
|
37
33
|
let arr = results.get(file);
|
|
38
34
|
if (!arr) {
|
|
39
35
|
arr = new Set();
|
|
40
36
|
results.set(file, arr);
|
|
41
37
|
}
|
|
42
|
-
arr.add(pkg);
|
|
43
|
-
deps[pkg] =
|
|
38
|
+
arr.add([pkg, desired]);
|
|
39
|
+
deps[pkg] = desired;
|
|
44
40
|
}
|
|
45
41
|
}
|
|
46
42
|
await fs.writeFile(file, JSON.stringify(data, null, 2));
|
|
47
43
|
});
|
|
48
44
|
await Promise.all(tasks);
|
|
49
45
|
if (results.size === 0) {
|
|
50
|
-
|
|
46
|
+
console.log(green(`All packages already match version ${metadata.version}`));
|
|
51
47
|
return;
|
|
52
48
|
}
|
|
53
49
|
for (const [file, pkgs] of results.entries()) {
|
|
54
|
-
|
|
55
|
-
for (const pkg of pkgs) {
|
|
56
|
-
|
|
50
|
+
console.log(green(`✅ ${path.relative(project.paths.root, file)}`));
|
|
51
|
+
for (const [pkg, version] of pkgs) {
|
|
52
|
+
console.log(green(` ${pkg}@${version}`));
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
|
-
|
|
55
|
+
console.log(yellow("Don't forget to run your package manager to install the packages"));
|
|
60
56
|
});
|
|
61
57
|
async function find(dir) {
|
|
62
58
|
const children = await fs.readdir(dir);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as trpc from "@trpc/server";
|
|
2
|
+
import { DendriformPatch } from "dendriform-immer-patch-optimiser";
|
|
3
|
+
export declare type State = {
|
|
4
|
+
app: string;
|
|
5
|
+
stage: string;
|
|
6
|
+
functions: Record<string, FunctionState>;
|
|
7
|
+
live: boolean;
|
|
8
|
+
stacks: {
|
|
9
|
+
status: any;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare type FunctionState = {
|
|
13
|
+
state: "idle" | "building" | "checking";
|
|
14
|
+
invocations: Invocation[];
|
|
15
|
+
issues: Record<string, any[]>;
|
|
16
|
+
warm: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare type Invocation = {
|
|
19
|
+
id: string;
|
|
20
|
+
request: any;
|
|
21
|
+
response?: any;
|
|
22
|
+
times: {
|
|
23
|
+
start: number;
|
|
24
|
+
end?: number;
|
|
25
|
+
};
|
|
26
|
+
logs: {
|
|
27
|
+
message: string;
|
|
28
|
+
timestamp: number;
|
|
29
|
+
}[];
|
|
30
|
+
};
|
|
31
|
+
export declare type Context = {
|
|
32
|
+
state: State;
|
|
33
|
+
};
|
|
34
|
+
export declare const router: import("@trpc/server/dist/declarations/src/router.js").Router<Context, Context, Record<"getCredentials", import("@trpc/server/dist/declarations/src/internals/procedure.js").Procedure<Context, Context, undefined, undefined, {
|
|
35
|
+
region: string;
|
|
36
|
+
credentials: {
|
|
37
|
+
accessKeyId: string;
|
|
38
|
+
secretAccessKey: string;
|
|
39
|
+
sessionToken: string | undefined;
|
|
40
|
+
};
|
|
41
|
+
}>> & Record<"getState", import("@trpc/server/dist/declarations/src/internals/procedure.js").Procedure<Context, Context, undefined, undefined, State>>, Record<"deploy", import("@trpc/server/dist/declarations/src/internals/procedure.js").Procedure<Context, Context, undefined, undefined, void>>, Record<"onStateChange", import("@trpc/server/dist/declarations/src/internals/procedure.js").Procedure<Context, Context, undefined, undefined, trpc.Subscription<DendriformPatch[]>>>, trpc.DefaultErrorShape>;
|
|
42
|
+
export declare type Router = typeof router;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as trpc from "@trpc/server";
|
|
2
|
+
import { useProject } from "../../app.js";
|
|
3
|
+
import { useBus } from "../../bus.js";
|
|
4
|
+
import { useAWSCredentials } from "../../credentials.js";
|
|
5
|
+
export const router = trpc
|
|
6
|
+
.router()
|
|
7
|
+
.query("getCredentials", {
|
|
8
|
+
async resolve({ ctx }) {
|
|
9
|
+
const project = useProject();
|
|
10
|
+
const credentials = await useAWSCredentials();
|
|
11
|
+
return {
|
|
12
|
+
region: project.region,
|
|
13
|
+
credentials: {
|
|
14
|
+
accessKeyId: credentials.accessKeyId,
|
|
15
|
+
secretAccessKey: credentials.secretAccessKey,
|
|
16
|
+
sessionToken: credentials.sessionToken,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
.query("getState", {
|
|
22
|
+
async resolve({ ctx }) {
|
|
23
|
+
return ctx.state;
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
.mutation("deploy", {
|
|
27
|
+
async resolve({ ctx }) {
|
|
28
|
+
return;
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
.subscription("onStateChange", {
|
|
32
|
+
async resolve({ ctx }) {
|
|
33
|
+
const bus = useBus();
|
|
34
|
+
return new trpc.Subscription((emit) => {
|
|
35
|
+
const sub = bus.subscribe("local.patches", (evt) => {
|
|
36
|
+
emit.data(evt.properties);
|
|
37
|
+
});
|
|
38
|
+
return () => {
|
|
39
|
+
bus.unsubscribe(sub);
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FunctionState, State } from "./router.js";
|
|
2
|
+
import { WritableDraft } from "immer/dist/internal.js";
|
|
3
|
+
import { DendriformPatch } from "dendriform-immer-patch-optimiser";
|
|
4
|
+
declare type Opts = {
|
|
5
|
+
port: number;
|
|
6
|
+
key: any;
|
|
7
|
+
cert: any;
|
|
8
|
+
live: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare module "../../bus.js" {
|
|
11
|
+
interface Events {
|
|
12
|
+
"local.patches": DendriformPatch[];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export declare function useLocalServer(opts: Opts): Promise<{
|
|
16
|
+
port: number;
|
|
17
|
+
updateState: (cb: (draft: WritableDraft<State>) => void) => void;
|
|
18
|
+
updateFunction: (id: string, cb: (draft: WritableDraft<FunctionState>) => void) => void;
|
|
19
|
+
}>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { produceWithPatches, enablePatches } from "immer";
|
|
2
|
+
import express from "express";
|
|
3
|
+
import fs from "fs/promises";
|
|
4
|
+
enablePatches();
|
|
5
|
+
import { WebSocketServer } from "ws";
|
|
6
|
+
import https from "https";
|
|
7
|
+
import http from "http";
|
|
8
|
+
import { applyWSSHandler } from "@trpc/server/adapters/ws/dist/trpc-server-adapters-ws.cjs.js";
|
|
9
|
+
import { router } from "./router.js";
|
|
10
|
+
import { optimise } from "dendriform-immer-patch-optimiser";
|
|
11
|
+
import { sync } from "cross-spawn";
|
|
12
|
+
import { useProject } from "../../app.js";
|
|
13
|
+
import { useBus } from "../../bus.js";
|
|
14
|
+
export async function useLocalServer(opts) {
|
|
15
|
+
const project = useProject();
|
|
16
|
+
let state = {
|
|
17
|
+
app: project.name,
|
|
18
|
+
stage: project.stage,
|
|
19
|
+
live: opts.live,
|
|
20
|
+
stacks: {
|
|
21
|
+
status: "idle",
|
|
22
|
+
},
|
|
23
|
+
functions: {},
|
|
24
|
+
};
|
|
25
|
+
const rest = express();
|
|
26
|
+
/*
|
|
27
|
+
rest.all(`/ping`, (req, res) => {
|
|
28
|
+
res.header("Access-Control-Allow-Origin", "*");
|
|
29
|
+
res.header("Access-Control-Allow-Methods", "GET, PUT, PATCH, POST, DELETE");
|
|
30
|
+
res.header(
|
|
31
|
+
"Access-Control-Allow-Headers",
|
|
32
|
+
req.header("access-control-request-headers")
|
|
33
|
+
);
|
|
34
|
+
res.sendStatus(200);
|
|
35
|
+
});
|
|
36
|
+
*/
|
|
37
|
+
rest.all(`/proxy*`, express.raw({
|
|
38
|
+
type: "*/*",
|
|
39
|
+
limit: "1024mb",
|
|
40
|
+
}), (req, res) => {
|
|
41
|
+
res.header("Access-Control-Allow-Origin", "*");
|
|
42
|
+
res.header("Access-Control-Allow-Methods", "GET, PUT, PATCH, POST, DELETE");
|
|
43
|
+
res.header("Access-Control-Allow-Headers", req.header("access-control-request-headers"));
|
|
44
|
+
if (req.method === "OPTIONS")
|
|
45
|
+
return res.send();
|
|
46
|
+
const u = new URL(req.url.substring(7));
|
|
47
|
+
const forward = https.request(u, {
|
|
48
|
+
headers: {
|
|
49
|
+
...req.headers,
|
|
50
|
+
host: u.hostname,
|
|
51
|
+
},
|
|
52
|
+
method: req.method,
|
|
53
|
+
}, (proxied) => {
|
|
54
|
+
res.status(proxied.statusCode);
|
|
55
|
+
for (const [key, value] of Object.entries(proxied.headers)) {
|
|
56
|
+
res.header(key, value);
|
|
57
|
+
}
|
|
58
|
+
proxied.pipe(res);
|
|
59
|
+
});
|
|
60
|
+
if (req.method !== "GET" &&
|
|
61
|
+
req.method !== "DELETE" &&
|
|
62
|
+
req.method !== "HEAD" &&
|
|
63
|
+
req.body)
|
|
64
|
+
forward.write(req.body);
|
|
65
|
+
forward.end();
|
|
66
|
+
forward.on("error", (e) => {
|
|
67
|
+
console.log(e.message);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
const server = await (async () => {
|
|
71
|
+
const result = sync("mkcert", ["--help"]);
|
|
72
|
+
const KEY_PATH = ".sst/localhost-key.pem";
|
|
73
|
+
const CERT_PATH = ".sst/localhost.pem";
|
|
74
|
+
if (result.status === 0) {
|
|
75
|
+
try {
|
|
76
|
+
await Promise.all([fs.access(KEY_PATH), fs.access(CERT_PATH)]);
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
sync("mkcert", ["localhost"], {
|
|
80
|
+
cwd: ".sst",
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const [key, cert] = await Promise.all([
|
|
84
|
+
fs.readFile(KEY_PATH),
|
|
85
|
+
fs.readFile(CERT_PATH),
|
|
86
|
+
]);
|
|
87
|
+
return https.createServer({
|
|
88
|
+
key: key,
|
|
89
|
+
cert: cert,
|
|
90
|
+
}, rest);
|
|
91
|
+
}
|
|
92
|
+
return http.createServer({}, rest);
|
|
93
|
+
})();
|
|
94
|
+
// Wire up websocket
|
|
95
|
+
const wss = new WebSocketServer({ server });
|
|
96
|
+
wss.on("connection", (socket, req) => {
|
|
97
|
+
if (req.headers.origin?.endsWith("localhost:3000"))
|
|
98
|
+
return;
|
|
99
|
+
if (req.headers.origin?.endsWith("localhost:3001"))
|
|
100
|
+
return;
|
|
101
|
+
if (req.headers.origin?.endsWith("console.serverless-stack.com"))
|
|
102
|
+
return;
|
|
103
|
+
if (req.headers.origin?.endsWith("console.sst.dev"))
|
|
104
|
+
return;
|
|
105
|
+
if (req.headers.origin?.endsWith("--sst-console.netlify.app"))
|
|
106
|
+
return;
|
|
107
|
+
console.log("Rejecting unauthorized connection from " + req.headers.origin);
|
|
108
|
+
socket.terminate();
|
|
109
|
+
});
|
|
110
|
+
server.listen(opts.port);
|
|
111
|
+
const handler = applyWSSHandler({
|
|
112
|
+
wss,
|
|
113
|
+
router,
|
|
114
|
+
createContext() {
|
|
115
|
+
return {
|
|
116
|
+
state,
|
|
117
|
+
};
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
process.on("SIGTERM", () => {
|
|
121
|
+
handler.broadcastReconnectNotification();
|
|
122
|
+
wss.close();
|
|
123
|
+
});
|
|
124
|
+
const bus = useBus();
|
|
125
|
+
const pending = [];
|
|
126
|
+
function updateState(cb) {
|
|
127
|
+
const [next, patches] = produceWithPatches(state, cb);
|
|
128
|
+
if (!patches.length)
|
|
129
|
+
return;
|
|
130
|
+
const scheduled = pending.length;
|
|
131
|
+
pending.push(...optimise(state, patches));
|
|
132
|
+
if (!scheduled)
|
|
133
|
+
setTimeout(() => {
|
|
134
|
+
bus.publish("local.patches", pending);
|
|
135
|
+
pending.splice(0, pending.length);
|
|
136
|
+
}, 0);
|
|
137
|
+
state = next;
|
|
138
|
+
}
|
|
139
|
+
function updateFunction(id, cb) {
|
|
140
|
+
return updateState((draft) => {
|
|
141
|
+
let func = draft.functions[id];
|
|
142
|
+
if (!func) {
|
|
143
|
+
func = {
|
|
144
|
+
warm: true,
|
|
145
|
+
state: "idle",
|
|
146
|
+
issues: {},
|
|
147
|
+
invocations: [],
|
|
148
|
+
};
|
|
149
|
+
draft.functions[id] = func;
|
|
150
|
+
}
|
|
151
|
+
cb(func);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
bus.subscribe("function.invoked", (evt) => {
|
|
155
|
+
updateFunction(evt.properties.functionID, (draft) => {
|
|
156
|
+
if (draft.invocations.length >= 25)
|
|
157
|
+
draft.invocations.pop();
|
|
158
|
+
draft.invocations.unshift({
|
|
159
|
+
id: evt.properties.context.awsRequestId,
|
|
160
|
+
request: evt.properties.event,
|
|
161
|
+
times: {
|
|
162
|
+
start: Date.now(),
|
|
163
|
+
},
|
|
164
|
+
logs: [],
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
bus.subscribe("worker.stdout", (evt) => {
|
|
169
|
+
updateFunction(evt.properties.functionID, (draft) => {
|
|
170
|
+
const entry = draft.invocations.find((i) => i.id === evt.properties.requestID);
|
|
171
|
+
if (!entry)
|
|
172
|
+
return;
|
|
173
|
+
entry.logs.push({
|
|
174
|
+
timestamp: Date.now(),
|
|
175
|
+
message: evt.properties.message,
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
bus.subscribe("function.success", (evt) => {
|
|
180
|
+
updateFunction(evt.properties.functionID, (draft) => {
|
|
181
|
+
const invocation = draft.invocations.find((x) => x.id === evt.properties.requestID);
|
|
182
|
+
if (!invocation)
|
|
183
|
+
return;
|
|
184
|
+
invocation.response = {
|
|
185
|
+
type: "success",
|
|
186
|
+
data: evt.properties.body,
|
|
187
|
+
};
|
|
188
|
+
invocation.times.end = Date.now();
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
bus.subscribe("function.error", (evt) => {
|
|
192
|
+
updateFunction(evt.properties.functionID, (draft) => {
|
|
193
|
+
const invocation = draft.invocations.find((x) => x.id === evt.properties.requestID);
|
|
194
|
+
if (!invocation)
|
|
195
|
+
return;
|
|
196
|
+
invocation.response = {
|
|
197
|
+
type: "failure",
|
|
198
|
+
error: {
|
|
199
|
+
errorMessage: evt.properties.errorMessage,
|
|
200
|
+
stackTrace: evt.properties.trace || [],
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
invocation.times.end = Date.now();
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
const result = {
|
|
207
|
+
port: opts.port,
|
|
208
|
+
updateState,
|
|
209
|
+
updateFunction,
|
|
210
|
+
};
|
|
211
|
+
return result;
|
|
212
|
+
}
|
package/cli/program.d.ts
ADDED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import yargs from "yargs";
|
|
2
|
-
/* @ts-expect-error */
|
|
3
2
|
import { hideBin } from "yargs/helpers";
|
|
4
3
|
import { initProject } from "../app.js";
|
|
4
|
+
import { trackCli } from "./telemetry/telemetry.js";
|
|
5
5
|
export const program = yargs(hideBin(process.argv))
|
|
6
6
|
.scriptName("sst")
|
|
7
7
|
.option("stage", {
|
|
@@ -11,9 +11,14 @@ export const program = yargs(hideBin(process.argv))
|
|
|
11
11
|
.option("profile", {
|
|
12
12
|
type: "string",
|
|
13
13
|
describe: "The AWS profile to use",
|
|
14
|
+
})
|
|
15
|
+
.option("region", {
|
|
16
|
+
type: "string",
|
|
17
|
+
describe: "The AWS region to use",
|
|
14
18
|
})
|
|
15
19
|
.middleware(async (argv) => {
|
|
16
20
|
await initProject(argv);
|
|
21
|
+
trackCli(argv._[0]);
|
|
17
22
|
})
|
|
18
23
|
.strict()
|
|
19
24
|
.demandCommand(1);
|
|
File without changes
|
|
File without changes
|
package/cli/sst.d.ts
ADDED
package/{dist/cli → cli}/sst.js
RENAMED
|
@@ -1,5 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { blue, red } from "colorette";
|
|
3
|
+
import { program } from "./program.js";
|
|
4
|
+
import { secrets } from "./commands/secrets/secrets.js";
|
|
5
|
+
import { update } from "./commands/update.js";
|
|
6
|
+
import { dev } from "./commands/dev.js";
|
|
7
|
+
import { bind } from "./commands/bind.js";
|
|
8
|
+
import { build } from "./commands/build.js";
|
|
9
|
+
import { VisibleError } from "../error.js";
|
|
10
|
+
import { useSpinners } from "./spinner.js";
|
|
11
|
+
import { deploy } from "./commands/deploy.js";
|
|
12
|
+
import { remove } from "./commands/remove.js";
|
|
13
|
+
import dotenv from "dotenv";
|
|
14
|
+
import { env } from "./commands/env.js";
|
|
15
|
+
import { Logger } from "../logger.js";
|
|
16
|
+
import { consoleCommand } from "./commands/console.js";
|
|
17
|
+
dotenv.config();
|
|
18
|
+
secrets(program);
|
|
19
|
+
update(program);
|
|
20
|
+
dev(program);
|
|
21
|
+
bind(program);
|
|
22
|
+
build(program);
|
|
23
|
+
deploy(program);
|
|
24
|
+
remove(program);
|
|
25
|
+
env(program);
|
|
26
|
+
consoleCommand(program);
|
|
1
27
|
process.removeAllListeners("uncaughtException");
|
|
2
28
|
process.on("uncaughtException", (err) => {
|
|
29
|
+
Logger.debug(err);
|
|
3
30
|
const spinners = useSpinners();
|
|
4
31
|
for (const spinner of spinners) {
|
|
5
32
|
if (spinner.isSpinning)
|
|
@@ -15,22 +42,6 @@ process.on("uncaughtException", (err) => {
|
|
|
15
42
|
process.exit(1);
|
|
16
43
|
});
|
|
17
44
|
process.on("beforeExit", () => { });
|
|
18
|
-
import { blue, red } from "colorette";
|
|
19
|
-
import { program } from "./program.js";
|
|
20
|
-
import { secrets } from "./commands/secrets/secrets.js";
|
|
21
|
-
import { update } from "./commands/update.js";
|
|
22
|
-
import { start } from "./commands/start.js";
|
|
23
|
-
import { bind } from "./commands/bind.js";
|
|
24
|
-
import { build } from "./commands/build.js";
|
|
25
|
-
import { VisibleError } from "../error.js";
|
|
26
|
-
import { useSpinners } from "./spinner.js";
|
|
27
|
-
import { deploy } from "./commands/deploy.js";
|
|
28
|
-
secrets(program);
|
|
29
|
-
update(program);
|
|
30
|
-
start(program);
|
|
31
|
-
bind(program);
|
|
32
|
-
build(program);
|
|
33
|
-
deploy(program);
|
|
34
45
|
program
|
|
35
46
|
.fail((msg, error) => {
|
|
36
47
|
if (!error) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
declare type EnvironmentData = {
|
|
3
|
+
systemPlatform: NodeJS.Platform;
|
|
4
|
+
systemRelease: string;
|
|
5
|
+
systemArchitecture: string;
|
|
6
|
+
cpuCount: number;
|
|
7
|
+
cpuModel: string | null;
|
|
8
|
+
cpuSpeed: number | null;
|
|
9
|
+
memoryInMb: number;
|
|
10
|
+
isCI: boolean;
|
|
11
|
+
ciName: string | null;
|
|
12
|
+
sstVersion: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function getEnvironmentData(): EnvironmentData;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import os from "os";
|
|
2
|
+
import ciInfo from "ci-info";
|
|
3
|
+
import { useProject } from "../../app.js";
|
|
4
|
+
let data;
|
|
5
|
+
export function getEnvironmentData() {
|
|
6
|
+
if (data) {
|
|
7
|
+
return data;
|
|
8
|
+
}
|
|
9
|
+
const cpus = os.cpus() || [];
|
|
10
|
+
const isSeed = !!process.env.SEED_APP_NAME;
|
|
11
|
+
data = {
|
|
12
|
+
// Software information
|
|
13
|
+
systemPlatform: os.platform(),
|
|
14
|
+
systemRelease: os.release(),
|
|
15
|
+
systemArchitecture: os.arch(),
|
|
16
|
+
// Machine information
|
|
17
|
+
cpuCount: cpus.length,
|
|
18
|
+
cpuModel: cpus.length ? cpus[0].model : null,
|
|
19
|
+
cpuSpeed: cpus.length ? cpus[0].speed : null,
|
|
20
|
+
memoryInMb: Math.trunc(os.totalmem() / Math.pow(1024, 2)),
|
|
21
|
+
// Environment information
|
|
22
|
+
isCI: ciInfo.isCI || isSeed,
|
|
23
|
+
ciName: (isSeed ? "Seed" : ciInfo.name) || null,
|
|
24
|
+
sstVersion: useProject().version,
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function postPayload(endpoint: string, body: any): Promise<void>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import https from "https";
|
|
2
|
+
export function postPayload(endpoint, body) {
|
|
3
|
+
return new Promise((resolve, reject) => {
|
|
4
|
+
const req = https.request(endpoint, {
|
|
5
|
+
method: "POST",
|
|
6
|
+
headers: { "content-type": "application/json" },
|
|
7
|
+
timeout: 5000,
|
|
8
|
+
}, (resp) => {
|
|
9
|
+
if (resp.statusCode !== 200) {
|
|
10
|
+
reject(new Error(`Unexpected status code: ${resp.statusCode}`));
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
resolve();
|
|
14
|
+
});
|
|
15
|
+
req.write(JSON.stringify(body));
|
|
16
|
+
req.end();
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { execSync } from "child_process";
|
|
2
|
+
function getProjectIdByGit() {
|
|
3
|
+
try {
|
|
4
|
+
const originBuffer = execSync(`git config --local --get remote.origin.url`, {
|
|
5
|
+
timeout: 1000,
|
|
6
|
+
stdio: `pipe`,
|
|
7
|
+
});
|
|
8
|
+
return String(originBuffer).trim();
|
|
9
|
+
}
|
|
10
|
+
catch (_) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function normalizeGitUrl(url) {
|
|
15
|
+
// Normalize url
|
|
16
|
+
// - https://x-access-token:ghs_xxxx@github.com/user/repo.git
|
|
17
|
+
// - https://github.com/user/repo.git
|
|
18
|
+
// - git@github.com:user/repo.git
|
|
19
|
+
// trim
|
|
20
|
+
url = url.trim();
|
|
21
|
+
// clean up ending `.git`
|
|
22
|
+
url = url.endsWith(".git") ? url.substring(0, url.length - 4) : url;
|
|
23
|
+
if (url.startsWith("git@")) {
|
|
24
|
+
const match = url.match(/git@([^:]+):(.*)/);
|
|
25
|
+
if (match && match.length > 2) {
|
|
26
|
+
return `${match[1]}/${match[2]}`;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
else if (url.startsWith("http://") || url.startsWith("https://")) {
|
|
30
|
+
const match = url.match(/https?:\/\/([^@]+@)?(.*)/);
|
|
31
|
+
if (match && match.length > 2) {
|
|
32
|
+
return match[2];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return url;
|
|
36
|
+
}
|
|
37
|
+
export function getRawProjectId() {
|
|
38
|
+
const gitUrl = getProjectIdByGit();
|
|
39
|
+
if (gitUrl) {
|
|
40
|
+
return normalizeGitUrl(gitUrl);
|
|
41
|
+
}
|
|
42
|
+
const repoUrl = process.env.REPOSITORY_URL;
|
|
43
|
+
if (repoUrl) {
|
|
44
|
+
return normalizeGitUrl(repoUrl);
|
|
45
|
+
}
|
|
46
|
+
return process.cwd();
|
|
47
|
+
}
|