sst 1.16.0 → 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/{dist/app.d.ts → app.d.ts} +8 -1
- package/app.js +122 -0
- package/{dist/bootstrap.d.ts → bootstrap.d.ts} +1 -0
- package/bootstrap.js +79 -0
- package/{dist/bus.d.ts → bus.d.ts} +0 -0
- package/{dist/bus.js → bus.js} +0 -0
- package/{dist/cache.d.ts → cache.d.ts} +0 -0
- package/{dist/cache.js → cache.js} +0 -0
- package/{dist/cdk → cdk}/cloudformation-deployments.d.ts +1 -1
- package/{dist/cdk → cdk}/cloudformation-deployments.js +1 -0
- package/{dist/cdk → cdk}/deploy-stack.d.ts +0 -0
- package/{dist/cdk → cdk}/deploy-stack.js +13 -6
- package/{dist/cli → cli}/commands/bind.d.ts +3 -1
- package/{dist/cli → cli}/commands/bind.js +8 -4
- package/{dist/cli → cli}/commands/build.d.ts +2 -0
- package/cli/commands/build.js +12 -0
- package/cli/commands/console.d.ts +9 -0
- package/cli/commands/console.js +15 -0
- package/{dist/cli → cli}/commands/deploy.d.ts +7 -1
- package/cli/commands/deploy.js +48 -0
- package/cli/commands/dev.d.ts +11 -0
- package/cli/commands/dev.js +188 -0
- package/cli/commands/env.d.ts +11 -0
- package/cli/commands/env.js +39 -0
- package/cli/commands/plugins/kysely.d.ts +1 -0
- package/cli/commands/plugins/kysely.js +91 -0
- package/cli/commands/plugins/pothos.d.ts +1 -0
- package/cli/commands/plugins/pothos.js +52 -0
- package/cli/commands/plugins/warmer.d.ts +1 -0
- package/cli/commands/plugins/warmer.js +33 -0
- package/cli/commands/remove.d.ts +13 -0
- package/cli/commands/remove.js +39 -0
- package/{dist/cli → cli}/commands/secrets/get.d.ts +2 -0
- package/{dist/cli → cli}/commands/secrets/get.js +0 -0
- package/{dist/cli → cli}/commands/secrets/list.d.ts +2 -0
- package/{dist/cli → cli}/commands/secrets/list.js +5 -5
- package/{dist/cli → cli}/commands/secrets/remove.d.ts +2 -0
- package/{dist/cli → cli}/commands/secrets/remove.js +0 -0
- package/{dist/cli → cli}/commands/secrets/secrets.d.ts +0 -0
- package/{dist/cli → cli}/commands/secrets/secrets.js +0 -0
- package/{dist/cli → cli}/commands/secrets/set.d.ts +2 -0
- package/{dist/cli → cli}/commands/secrets/set.js +13 -11
- package/{dist/cli → cli}/commands/update.d.ts +2 -0
- package/{dist/cli → cli}/commands/update.js +17 -21
- package/cli/local/router.d.ts +42 -0
- package/cli/local/router.js +43 -0
- package/cli/local/server.d.ts +20 -0
- package/cli/local/server.js +212 -0
- package/cli/program.d.ts +9 -0
- package/{dist/cli → cli}/program.js +6 -1
- package/{dist/cli → cli}/spinner.d.ts +0 -0
- package/{dist/cli → cli}/spinner.js +0 -0
- package/cli/sst.d.ts +2 -0
- package/{dist/cli → cli}/sst.js +27 -16
- package/cli/telemetry/environment.d.ts +15 -0
- package/cli/telemetry/environment.js +27 -0
- package/cli/telemetry/post-payload.d.ts +1 -0
- package/cli/telemetry/post-payload.js +18 -0
- package/cli/telemetry/project-id.d.ts +2 -0
- package/cli/telemetry/project-id.js +47 -0
- package/cli/telemetry/telemetry.d.ts +4 -0
- package/cli/telemetry/telemetry.js +90 -0
- package/cli/ui/deploy.d.ts +8 -0
- package/{dist/cli → cli}/ui/deploy.js +39 -1
- package/{dist/config.d.ts → config.d.ts} +0 -0
- package/{dist/config.js → config.js} +16 -4
- package/{dist/constructs → constructs}/Api.d.ts +98 -12
- package/{dist/constructs → constructs}/Api.js +93 -7
- package/{dist/constructs → constructs}/ApiGatewayV1Api.d.ts +0 -0
- package/{dist/constructs → constructs}/ApiGatewayV1Api.js +10 -5
- package/{dist/constructs → constructs}/App.d.ts +4 -26
- package/{dist/constructs → constructs}/App.js +119 -99
- package/{dist/constructs → constructs}/AppSyncApi.d.ts +3 -3
- package/{dist/constructs → constructs}/AppSyncApi.js +27 -20
- package/constructs/AstroSite.d.ts +25 -0
- package/constructs/AstroSite.js +111 -0
- package/constructs/AstroSite.tsdoc.d.ts +2 -0
- package/constructs/AstroSite.tsdoc.js +2 -0
- package/{dist/constructs → constructs}/Auth.d.ts +1 -1
- package/{dist/constructs → constructs}/Auth.js +6 -4
- package/{dist/constructs → constructs}/BaseSite.d.ts +0 -0
- package/{dist/constructs → constructs}/BaseSite.js +0 -0
- package/{dist/constructs → constructs}/Bucket.d.ts +0 -0
- package/{dist/constructs → constructs}/Bucket.js +6 -3
- package/{dist/constructs → constructs}/Cognito.d.ts +0 -0
- package/{dist/constructs → constructs}/Cognito.js +4 -1
- package/{dist/constructs → constructs}/Config.d.ts +0 -0
- package/{dist/constructs → constructs}/Config.js +0 -0
- package/{dist/constructs → constructs}/Construct.d.ts +0 -0
- package/{dist/constructs → constructs}/Construct.js +0 -0
- package/{dist/constructs → constructs}/Cron.d.ts +0 -0
- package/{dist/constructs → constructs}/Cron.js +7 -0
- package/{dist/constructs → constructs}/DebugApp.d.ts +2 -2
- package/{dist/constructs → constructs}/DebugApp.js +16 -0
- package/{dist/constructs → constructs}/DebugStack.d.ts +0 -0
- package/{dist/constructs → constructs}/DebugStack.js +4 -0
- package/{dist/constructs → constructs}/EdgeFunction.d.ts +1 -0
- package/{dist/constructs → constructs}/EdgeFunction.js +27 -22
- package/{dist/constructs → constructs}/EventBus.d.ts +0 -0
- package/{dist/constructs → constructs}/EventBus.js +7 -4
- package/{dist/constructs → constructs}/Function.d.ts +73 -174
- package/{dist/constructs → constructs}/Function.js +43 -83
- package/{dist/constructs → constructs}/FunctionalStack.d.ts +0 -0
- package/{dist/constructs → constructs}/FunctionalStack.js +5 -5
- package/{dist/constructs → constructs}/GraphQLApi.d.ts +11 -1
- package/{dist/constructs → constructs}/GraphQLApi.js +3 -0
- package/{dist/constructs → constructs}/Job.d.ts +0 -14
- package/{dist/constructs → constructs}/Job.js +50 -46
- package/{dist/constructs → constructs}/KinesisStream.d.ts +0 -0
- package/{dist/constructs → constructs}/KinesisStream.js +6 -3
- package/{dist/constructs → constructs}/Metadata.d.ts +1 -1
- package/{dist/constructs → constructs}/Metadata.js +0 -0
- package/constructs/NextjsSite.d.ts +33 -0
- package/constructs/NextjsSite.js +285 -0
- package/{dist/constructs → constructs}/Parameter.d.ts +0 -0
- package/{dist/constructs → constructs}/Parameter.js +3 -0
- package/{dist/constructs → constructs}/Queue.d.ts +0 -0
- package/{dist/constructs → constructs}/Queue.js +19 -12
- package/{dist/constructs → constructs}/RDS.d.ts +0 -0
- package/{dist/constructs → constructs}/RDS.js +26 -19
- package/{dist/constructs → constructs}/ReactStaticSite.d.ts +0 -0
- package/{dist/constructs → constructs}/ReactStaticSite.js +1 -1
- package/constructs/RemixSite.d.ts +28 -0
- package/constructs/RemixSite.js +150 -0
- package/constructs/RemixSite.tsdoc.d.ts +2 -0
- package/constructs/RemixSite.tsdoc.js +2 -0
- package/{dist/constructs → constructs}/Script/cfn-response.d.ts +0 -0
- package/{dist/constructs → constructs}/Script/cfn-response.js +0 -0
- package/{dist/constructs → constructs}/Script/index.d.ts +0 -0
- package/{dist/constructs → constructs}/Script/index.js +0 -0
- package/{dist/constructs → constructs}/Script/outbound.d.ts +1 -1
- package/{dist/constructs → constructs}/Script/outbound.js +0 -0
- package/{dist/constructs → constructs}/Script/util.d.ts +0 -0
- package/{dist/constructs → constructs}/Script/util.js +0 -0
- package/{dist/constructs → constructs}/Script.d.ts +0 -0
- package/{dist/constructs → constructs}/Script.js +13 -0
- package/{dist/constructs → constructs}/Secret.d.ts +0 -0
- package/{dist/constructs → constructs}/Secret.js +2 -0
- package/constructs/SolidStartSite.d.ts +24 -0
- package/constructs/SolidStartSite.js +103 -0
- package/constructs/SolidStartSite.tsdoc.d.ts +2 -0
- package/constructs/SolidStartSite.tsdoc.js +2 -0
- package/{dist/constructs/RemixSite.d.ts → constructs/SsrSite.d.ts} +69 -107
- package/{dist/constructs/RemixSite.js → constructs/SsrSite.js} +243 -446
- package/{dist/constructs → constructs}/Stack.d.ts +1 -1
- package/{dist/constructs → constructs}/Stack.js +19 -4
- package/{dist/constructs → constructs}/StaticSite.d.ts +44 -17
- package/{dist/constructs → constructs}/StaticSite.js +121 -72
- package/{dist/constructs → constructs}/Table.d.ts +0 -0
- package/{dist/constructs → constructs}/Table.js +9 -3
- package/{dist/constructs → constructs}/Topic.d.ts +0 -0
- package/{dist/constructs → constructs}/Topic.js +6 -3
- package/{dist/constructs → constructs}/ViteStaticSite.d.ts +0 -0
- package/{dist/constructs → constructs}/ViteStaticSite.js +2 -2
- package/{dist/constructs → constructs}/WebSocketApi.d.ts +0 -0
- package/{dist/constructs → constructs}/WebSocketApi.js +9 -4
- package/{dist/constructs → constructs}/context.d.ts +1 -1
- package/{dist/constructs → constructs}/context.js +0 -0
- package/{dist/constructs → constructs}/deferred_task.d.ts +0 -0
- package/{dist/constructs → constructs}/deferred_task.js +4 -2
- package/{dist/constructs → constructs/deprecated}/NextjsSite.d.ts +12 -8
- package/{dist/constructs → constructs/deprecated}/NextjsSite.js +112 -89
- package/{dist/constructs/nextjs-site → constructs/deprecated}/cross-region-helper.d.ts +0 -0
- package/{dist/constructs/nextjs-site → constructs/deprecated}/cross-region-helper.js +3 -3
- package/constructs/deprecated/index.d.ts +1 -0
- package/constructs/deprecated/index.js +1 -0
- package/{dist/constructs → constructs}/index.d.ts +3 -2
- package/{dist/constructs → constructs}/index.js +2 -0
- package/{dist/constructs → constructs}/util/apiGatewayV1AccessLog.d.ts +0 -0
- package/{dist/constructs → constructs}/util/apiGatewayV1AccessLog.js +0 -0
- package/{dist/constructs → constructs}/util/apiGatewayV2AccessLog.d.ts +0 -0
- package/{dist/constructs → constructs}/util/apiGatewayV2AccessLog.js +4 -4
- package/{dist/constructs → constructs}/util/apiGatewayV2Cors.d.ts +0 -0
- package/{dist/constructs → constructs}/util/apiGatewayV2Cors.js +0 -0
- package/{dist/constructs → constructs}/util/apiGatewayV2Domain.d.ts +0 -0
- package/{dist/constructs → constructs}/util/apiGatewayV2Domain.js +0 -0
- package/{dist/constructs → constructs}/util/appSyncApiDomain.d.ts +1 -1
- package/{dist/constructs → constructs}/util/appSyncApiDomain.js +15 -9
- package/{dist/constructs → constructs}/util/builder.d.ts +0 -0
- package/{dist/constructs → constructs}/util/builder.js +0 -0
- package/{dist/constructs → constructs}/util/duration.d.ts +0 -0
- package/{dist/constructs → constructs}/util/duration.js +0 -0
- package/{dist/constructs → constructs}/util/functionBinding.d.ts +0 -0
- package/{dist/constructs → constructs}/util/functionBinding.js +0 -0
- package/{dist/constructs → constructs}/util/functionUrlCors.d.ts +0 -0
- package/{dist/constructs → constructs}/util/functionUrlCors.js +0 -0
- package/{dist/constructs → constructs}/util/permission.d.ts +0 -0
- package/{dist/constructs → constructs}/util/permission.js +32 -16
- package/{dist/constructs → constructs}/util/python/bundling.d.ts +0 -0
- package/{dist/constructs → constructs}/util/python/bundling.js +0 -0
- package/{dist/constructs → constructs}/util/size.d.ts +0 -0
- package/{dist/constructs → constructs}/util/size.js +0 -0
- package/{dist/constructs → constructs}/util/warning.d.ts +0 -0
- package/{dist/constructs → constructs}/util/warning.js +0 -0
- package/{dist/context → context}/context.d.ts +1 -1
- package/{dist/context → context}/context.js +3 -4
- package/{dist/context → context}/handler.d.ts +0 -0
- package/{dist/context → context}/handler.js +1 -1
- package/{dist/context → context}/index.d.ts +0 -0
- package/{dist/context → context}/index.js +0 -0
- package/{dist/credentials.d.ts → credentials.d.ts} +3 -1
- package/{dist/credentials.js → credentials.js} +11 -3
- package/{dist/error.d.ts → error.d.ts} +0 -0
- package/{dist/error.js → error.js} +0 -0
- package/{dist/iot.d.ts → iot.d.ts} +0 -0
- package/{dist/iot.js → iot.js} +3 -0
- package/logger.d.ts +3 -0
- package/{dist/logger.js → logger.js} +12 -8
- package/node/api/index.d.ts +42 -0
- package/node/api/index.js +88 -0
- package/node/auth/adapter/adapter.d.ts +3 -0
- package/node/auth/adapter/adapter.js +3 -0
- package/node/auth/adapter/facebook.d.ts +2 -0
- package/node/auth/adapter/facebook.js +26 -0
- package/node/auth/adapter/github.d.ts +2 -0
- package/node/auth/adapter/github.js +21 -0
- package/node/auth/adapter/google.d.ts +9 -0
- package/node/auth/adapter/google.js +18 -0
- package/node/auth/adapter/link.d.ts +8 -0
- package/node/auth/adapter/link.js +39 -0
- package/node/auth/adapter/oauth.d.ts +25 -0
- package/node/auth/adapter/oauth.js +52 -0
- package/node/auth/adapter/oidc.d.ts +17 -0
- package/node/auth/adapter/oidc.js +50 -0
- package/node/auth/adapter/twitch.d.ts +2 -0
- package/node/auth/adapter/twitch.js +11 -0
- package/node/auth/auth.d.ts +24 -0
- package/node/auth/auth.js +118 -0
- package/node/auth/index.d.ts +10 -0
- package/node/auth/index.js +10 -0
- package/node/auth/session.d.ts +76 -0
- package/node/auth/session.js +109 -0
- package/node/bucket/index.d.ts +3 -0
- package/node/bucket/index.js +3 -0
- package/node/config/index.d.ts +13 -0
- package/node/config/index.js +88 -0
- package/node/event-bus/index.d.ts +3 -0
- package/node/event-bus/index.js +3 -0
- package/node/function/index.d.ts +3 -0
- package/node/function/index.js +3 -0
- package/node/graphql/index.d.ts +38 -0
- package/node/graphql/index.js +48 -0
- package/node/job/index.d.ts +34 -0
- package/node/job/index.js +51 -0
- package/node/kinesis-stream/index.d.ts +3 -0
- package/node/kinesis-stream/index.js +3 -0
- package/node/queue/index.d.ts +3 -0
- package/node/queue/index.js +3 -0
- package/node/rds/index.d.ts +3 -0
- package/node/rds/index.js +3 -0
- package/node/site/index.d.ts +15 -0
- package/node/site/index.js +64 -0
- package/node/table/index.d.ts +3 -0
- package/node/table/index.js +3 -0
- package/node/topic/index.d.ts +3 -0
- package/node/topic/index.js +3 -0
- package/node/util/index.d.ts +7 -0
- package/node/util/index.js +57 -0
- package/package.json +107 -40
- package/pothos.d.ts +8 -0
- package/pothos.js +156 -0
- package/runtime/handlers/dotnet.d.ts +1 -0
- package/runtime/handlers/dotnet.js +117 -0
- package/runtime/handlers/go.d.ts +1 -0
- package/runtime/handlers/go.js +105 -0
- package/runtime/handlers/java.d.ts +1 -0
- package/runtime/handlers/java.js +97 -0
- package/{dist/runtime → runtime/handlers}/node.d.ts +0 -0
- package/runtime/handlers/node.js +172 -0
- package/runtime/handlers/python.d.ts +1 -0
- package/runtime/handlers/python.js +89 -0
- package/{dist/runtime → runtime}/handlers.d.ts +30 -12
- package/runtime/handlers.js +117 -0
- package/{dist/runtime → runtime}/iot.d.ts +0 -0
- package/{dist/runtime → runtime}/iot.js +1 -1
- package/{dist/runtime → runtime}/runtime.d.ts +2 -0
- package/{dist/runtime → runtime}/runtime.js +0 -0
- package/{dist/runtime → runtime}/server.d.ts +0 -0
- package/{dist/runtime → runtime}/server.js +39 -3
- package/{dist/runtime → runtime}/workers.d.ts +1 -0
- package/{dist/runtime → runtime}/workers.js +12 -4
- package/{dist/cli/sst.d.ts → scrap.d.ts} +0 -0
- package/scrap.js +58 -0
- package/site-env.d.ts +13 -0
- package/site-env.js +47 -0
- package/sst.mjs +21848 -0
- package/{dist/stacks → stacks}/build.d.ts +0 -0
- package/{dist/stacks → stacks}/build.js +18 -9
- package/stacks/deploy.d.ts +8 -0
- package/stacks/deploy.js +105 -0
- package/stacks/index.d.ts +7 -0
- package/stacks/index.js +7 -0
- package/stacks/metadata.d.ts +9 -0
- package/{dist/stacks → stacks}/metadata.js +2 -14
- package/stacks/monitor.d.ts +27 -0
- package/stacks/monitor.js +111 -0
- package/stacks/remove.d.ts +8 -0
- package/stacks/remove.js +80 -0
- package/stacks/synth.d.ts +10 -0
- package/stacks/synth.js +77 -0
- package/support/astro-site-html-stub/index.html +99 -0
- package/support/base-site-archiver.cjs +12 -11
- package/support/base-site-archiver.mjs +20 -0
- package/support/bridge/bridge.mjs +59 -0
- package/{dist/support → support}/custom-resources/index.mjs +44209 -42781
- package/support/dotnet31-bootstrap/Program.cs +17 -0
- package/support/dotnet31-bootstrap/dotnet-bootstrap.csproj +12 -0
- package/support/dotnet31-bootstrap/release/Amazon.Lambda.Core.dll +0 -0
- package/support/dotnet31-bootstrap/release/Amazon.Lambda.RuntimeSupport.dll +0 -0
- package/support/dotnet31-bootstrap/release/System.Runtime.CompilerServices.Unsafe.dll +0 -0
- package/support/dotnet31-bootstrap/release/System.Text.Encodings.Web.dll +0 -0
- package/support/dotnet31-bootstrap/release/System.Text.Json.dll +0 -0
- package/support/dotnet31-bootstrap/release/dotnet-bootstrap +0 -0
- package/support/dotnet31-bootstrap/release/dotnet-bootstrap.deps.json +230 -0
- package/support/dotnet31-bootstrap/release/dotnet-bootstrap.dll +0 -0
- package/support/dotnet31-bootstrap/release/dotnet-bootstrap.pdb +0 -0
- package/support/dotnet31-bootstrap/release/dotnet-bootstrap.runtimeconfig.json +9 -0
- package/support/dotnet6-bootstrap/Program.cs +17 -0
- package/support/dotnet6-bootstrap/dotnet-bootstrap.csproj +12 -0
- package/support/dotnet6-bootstrap/release/Amazon.Lambda.Core.dll +0 -0
- package/support/dotnet6-bootstrap/release/Amazon.Lambda.RuntimeSupport.dll +0 -0
- package/support/dotnet6-bootstrap/release/dotnet-bootstrap +0 -0
- package/support/dotnet6-bootstrap/release/dotnet-bootstrap.deps.json +59 -0
- package/support/dotnet6-bootstrap/release/dotnet-bootstrap.dll +0 -0
- package/support/dotnet6-bootstrap/release/dotnet-bootstrap.pdb +0 -0
- package/support/dotnet6-bootstrap/release/dotnet-bootstrap.runtimeconfig.json +12 -0
- package/support/edge-function/edge-lambda-version.mjs +3 -0
- package/support/edge-function/edge-lambda.mjs +3 -0
- package/support/edge-function/s3-bucket.mjs +3 -0
- package/{dist/support/base-site-custom-resource/cf-invalidate.py → support/edge-function-code-replacer/lambda-code-updater.py} +56 -30
- package/support/java-runtime/install.sh +25 -0
- package/support/java-runtime/pom.xml +39 -0
- package/support/java-runtime/release/aws-lambda-java-core-1.2.0.jar +0 -0
- package/support/java-runtime/release/aws-lambda-java-runtime-interface-client-1.1.0.jar +0 -0
- package/support/java-runtime/release/aws-lambda-java-serialization-1.0.0.jar +0 -0
- package/support/nextjs-site-html-stub/index.html +99 -0
- package/{dist/support → support}/nodejs-runtime/index.mjs +7822 -2771
- package/support/python-runtime/runtime.py +116 -0
- package/support/rds-migrator/index.mjs +28 -0
- package/support/remix-site-function/edge-server.js +158 -0
- package/support/remix-site-function/polyfill.js +24 -0
- package/support/remix-site-function/regional-server.js +162 -0
- package/support/remix-site-html-stub/index.html +99 -0
- package/support/sls-nextjs-site-build-helper/build.cjs +91 -0
- package/support/sls-nextjs-site-build-helper/index-wrapper.js +19 -0
- package/support/sls-nextjs-site-stub/index.html +99 -0
- package/support/solid-start-site-html-stub/index.html +99 -0
- package/support/ssr-site-function-stub/index.js +5 -0
- package/util/fs.d.ts +4 -0
- package/util/fs.js +46 -0
- package/util/module.d.ts +1 -0
- package/util/module.js +5 -0
- package/util/process.d.ts +2 -0
- package/util/process.js +3 -0
- package/{dist/watcher.d.ts → watcher.d.ts} +0 -0
- package/{dist/watcher.js → watcher.js} +1 -1
- package/.build/sst-debug.log +0 -10
- package/.turbo/turbo-build.log +0 -2
- package/CHANGELOG.md +0 -332
- package/analyze +0 -11090
- package/bin/sst.mjs +0 -3
- package/build.mjs +0 -116
- package/debug.log +0 -6
- package/dist/app.js +0 -92
- package/dist/bootstrap.js +0 -23
- package/dist/cli/commands/build.js +0 -8
- package/dist/cli/commands/deploy.js +0 -20
- package/dist/cli/commands/env.d.ts +0 -0
- package/dist/cli/commands/env.js +0 -1
- package/dist/cli/commands/scrap.d.ts +0 -5
- package/dist/cli/commands/scrap.js +0 -1
- package/dist/cli/commands/start.d.ts +0 -7
- package/dist/cli/commands/start.js +0 -136
- package/dist/cli/program.d.ts +0 -7
- package/dist/cli/ui/deploy.d.ts +0 -6
- package/dist/constructs/nextjs-site/custom-resource/cfn-response.d.ts +0 -19
- package/dist/constructs/nextjs-site/custom-resource/cfn-response.js +0 -94
- package/dist/constructs/nextjs-site/custom-resource/edge-lambda-version.d.ts +0 -1
- package/dist/constructs/nextjs-site/custom-resource/edge-lambda-version.js +0 -138
- package/dist/constructs/nextjs-site/custom-resource/edge-lambda.d.ts +0 -1
- package/dist/constructs/nextjs-site/custom-resource/edge-lambda.js +0 -136
- package/dist/constructs/nextjs-site/custom-resource/s3-bucket.d.ts +0 -1
- package/dist/constructs/nextjs-site/custom-resource/s3-bucket.js +0 -94
- package/dist/constructs/nextjs-site/custom-resource/util.d.ts +0 -1
- package/dist/constructs/nextjs-site/custom-resource/util.js +0 -4
- package/dist/logger.d.ts +0 -9
- package/dist/runtime/handlers.js +0 -72
- package/dist/runtime/node.js +0 -99
- package/dist/sst.mjs +0 -164202
- package/dist/stacks/deploy.d.ts +0 -33
- package/dist/stacks/deploy.js +0 -168
- package/dist/stacks/index.d.ts +0 -21
- package/dist/stacks/index.js +0 -57
- package/dist/stacks/metadata.d.ts +0 -9
- package/dist/support/base-site-archiver.cjs +0 -115
- package/dist/support/base-site-custom-resource/s3-handler.py +0 -195
- package/dist/support/base-site-custom-resource/s3-upload.py +0 -91
- package/dist/support/bridge/bridge.mjs +0 -86
- package/dist/support/static-site-stub/index.html +0 -90
- package/src/app.ts +0 -140
- package/src/bootstrap.ts +0 -28
- package/src/bus.ts +0 -81
- package/src/cache.ts +0 -34
- package/src/cdk/cloudformation-deployments.ts +0 -730
- package/src/cdk/deploy-stack.ts +0 -1030
- package/src/cli/commands/bind.ts +0 -31
- package/src/cli/commands/build.ts +0 -16
- package/src/cli/commands/deploy.ts +0 -34
- package/src/cli/commands/env.ts +0 -0
- package/src/cli/commands/scrap.ts +0 -5
- package/src/cli/commands/secrets/get.ts +0 -50
- package/src/cli/commands/secrets/list.ts +0 -66
- package/src/cli/commands/secrets/remove.ts +0 -36
- package/src/cli/commands/secrets/secrets.ts +0 -17
- package/src/cli/commands/secrets/set.ts +0 -59
- package/src/cli/commands/start.tsx +0 -162
- package/src/cli/commands/update.ts +0 -100
- package/src/cli/program.ts +0 -22
- package/src/cli/spinner.ts +0 -14
- package/src/cli/sst.ts +0 -50
- package/src/cli/ui/deploy.tsx +0 -139
- package/src/config.ts +0 -226
- package/src/constructs/Api.ts +0 -1448
- package/src/constructs/ApiGatewayV1Api.ts +0 -1481
- package/src/constructs/App.ts +0 -744
- package/src/constructs/AppSyncApi.ts +0 -1045
- package/src/constructs/Auth.ts +0 -252
- package/src/constructs/BaseSite.ts +0 -146
- package/src/constructs/Bucket.ts +0 -670
- package/src/constructs/Cognito.ts +0 -708
- package/src/constructs/Config.ts +0 -4
- package/src/constructs/Construct.ts +0 -77
- package/src/constructs/Cron.ts +0 -235
- package/src/constructs/DebugApp.ts +0 -97
- package/src/constructs/DebugStack.ts +0 -182
- package/src/constructs/EdgeFunction.ts +0 -460
- package/src/constructs/EventBus.ts +0 -651
- package/src/constructs/Function.ts +0 -1329
- package/src/constructs/FunctionalStack.ts +0 -90
- package/src/constructs/GraphQLApi.ts +0 -140
- package/src/constructs/Job.ts +0 -557
- package/src/constructs/KinesisStream.ts +0 -388
- package/src/constructs/Metadata.ts +0 -75
- package/src/constructs/NextjsSite.ts +0 -1498
- package/src/constructs/Parameter.ts +0 -72
- package/src/constructs/Queue.ts +0 -360
- package/src/constructs/RDS.ts +0 -578
- package/src/constructs/ReactStaticSite.ts +0 -66
- package/src/constructs/RemixSite.ts +0 -1397
- package/src/constructs/Script/cfn-response.ts +0 -116
- package/src/constructs/Script/index.ts +0 -103
- package/src/constructs/Script/outbound.ts +0 -59
- package/src/constructs/Script/package.json +0 -3
- package/src/constructs/Script/util.ts +0 -19
- package/src/constructs/Script.ts +0 -270
- package/src/constructs/Secret.ts +0 -66
- package/src/constructs/Stack.ts +0 -319
- package/src/constructs/StaticSite.ts +0 -995
- package/src/constructs/Table.ts +0 -844
- package/src/constructs/Topic.ts +0 -486
- package/src/constructs/ViteStaticSite.ts +0 -99
- package/src/constructs/WebSocketApi.ts +0 -687
- package/src/constructs/context.ts +0 -12
- package/src/constructs/deferred_task.ts +0 -53
- package/src/constructs/descs.d.ts +0 -1
- package/src/constructs/index.ts +0 -39
- package/src/constructs/nextjs-site/cross-region-helper.ts +0 -189
- package/src/constructs/nextjs-site/custom-resource/cfn-response.ts +0 -146
- package/src/constructs/nextjs-site/custom-resource/edge-lambda-version.ts +0 -162
- package/src/constructs/nextjs-site/custom-resource/edge-lambda.ts +0 -167
- package/src/constructs/nextjs-site/custom-resource/s3-bucket.ts +0 -112
- package/src/constructs/nextjs-site/custom-resource/util.ts +0 -11
- package/src/constructs/util/apiGatewayV1AccessLog.ts +0 -106
- package/src/constructs/util/apiGatewayV2AccessLog.ts +0 -139
- package/src/constructs/util/apiGatewayV2Cors.ts +0 -94
- package/src/constructs/util/apiGatewayV2Domain.ts +0 -312
- package/src/constructs/util/appSyncApiDomain.ts +0 -204
- package/src/constructs/util/builder.ts +0 -17
- package/src/constructs/util/duration.ts +0 -27
- package/src/constructs/util/functionBinding.ts +0 -102
- package/src/constructs/util/functionUrlCors.ts +0 -96
- package/src/constructs/util/permission.ts +0 -299
- package/src/constructs/util/python/bundling.ts +0 -174
- package/src/constructs/util/size.ts +0 -13
- package/src/constructs/util/warning.ts +0 -20
- package/src/context/context.ts +0 -79
- package/src/context/handler.ts +0 -53
- package/src/context/index.ts +0 -2
- package/src/credentials.ts +0 -103
- package/src/error.ts +0 -5
- package/src/iot.ts +0 -105
- package/src/logger.ts +0 -35
- package/src/runtime/handlers.ts +0 -121
- package/src/runtime/iot.ts +0 -16
- package/src/runtime/node.ts +0 -111
- package/src/runtime/runtime.ts +0 -27
- package/src/runtime/server.ts +0 -149
- package/src/runtime/workers.ts +0 -96
- package/src/stacks/build.ts +0 -69
- package/src/stacks/deploy.ts +0 -232
- package/src/stacks/index.ts +0 -73
- package/src/stacks/metadata.ts +0 -125
- package/src/watcher.ts +0 -47
- package/sst.config.mjs +0 -6
- package/support/bridge/bridge.ts +0 -136
- package/support/bridge/build.mjs +0 -18
- package/support/custom-resources/auth-keys.ts +0 -113
- package/support/custom-resources/build.mjs +0 -18
- package/support/custom-resources/cfn-response.ts +0 -151
- package/support/custom-resources/index.ts +0 -18
- package/support/custom-resources/secrets-migration.ts +0 -82
- package/support/custom-resources/stack-metadata.ts +0 -75
- package/support/custom-resources/util.ts +0 -44
- package/support/nodejs-runtime/index.ts +0 -69
- package/support/tsconfig.json +0 -11
- package/tsconfig.json +0 -13
- package/yarn-error.log +0 -75
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs/promises";
|
|
3
|
+
import crypto from "crypto";
|
|
4
|
+
import { printDeploymentResults } from "../ui/deploy.js";
|
|
5
|
+
import { useFunctions } from "../../constructs/Function.js";
|
|
6
|
+
import { dim, gray, yellow } from "colorette";
|
|
7
|
+
import { useProject } from "../../app.js";
|
|
8
|
+
import { SiteEnv } from "../../site-env.js";
|
|
9
|
+
import { usePothosBuilder } from "./plugins/pothos.js";
|
|
10
|
+
import { useKyselyTypeGenerator } from "./plugins/kysely.js";
|
|
11
|
+
import { useRDSWarmer } from "./plugins/warmer.js";
|
|
12
|
+
export const dev = (program) => program.command(["start", "dev"], "Work on your SST app locally", (yargs) => yargs.option("fullscreen", {
|
|
13
|
+
type: "boolean",
|
|
14
|
+
describe: "Disable full screen UI",
|
|
15
|
+
default: true,
|
|
16
|
+
}), async (args) => {
|
|
17
|
+
const { useRuntimeWorkers } = await import("../../runtime/workers.js");
|
|
18
|
+
const { useIOTBridge } = await import("../../runtime/iot.js");
|
|
19
|
+
const { useRuntimeServer } = await import("../../runtime/server.js");
|
|
20
|
+
const { useBus } = await import("../../bus.js");
|
|
21
|
+
const { useWatcher } = await import("../../watcher.js");
|
|
22
|
+
const { Stacks } = await import("../../stacks/index.js");
|
|
23
|
+
const { Logger } = await import("../../logger.js");
|
|
24
|
+
const { createSpinner } = await import("../spinner.js");
|
|
25
|
+
const { bold, magenta, green, blue, red } = await import("colorette");
|
|
26
|
+
const { render } = await import("ink");
|
|
27
|
+
const React = await import("react");
|
|
28
|
+
const { Context } = await import("../../context/context.js");
|
|
29
|
+
const { DeploymentUI } = await import("../ui/deploy.js");
|
|
30
|
+
const { useLocalServer } = await import("../local/server.js");
|
|
31
|
+
if (args._[0] === "start") {
|
|
32
|
+
console.log(yellow(`Warning: ${bold(`sst start`)} has been renamed to ${bold(`sst dev`)}`));
|
|
33
|
+
}
|
|
34
|
+
const useFunctionLogger = Context.memo(async () => {
|
|
35
|
+
const bus = useBus();
|
|
36
|
+
bus.subscribe("function.invoked", async (evt) => {
|
|
37
|
+
console.log(bold(magenta(`Invoked `)), bold(useFunctions().fromID(evt.properties.functionID).handler));
|
|
38
|
+
});
|
|
39
|
+
bus.subscribe("function.build.success", async (evt) => {
|
|
40
|
+
console.log(bold(gray(`Built `)), bold(useFunctions().fromID(evt.properties.functionID).handler));
|
|
41
|
+
});
|
|
42
|
+
bus.subscribe("function.build.failed", async (evt) => {
|
|
43
|
+
console.log(bold(red(`Build failed `)), bold(useFunctions().fromID(evt.properties.functionID).handler));
|
|
44
|
+
console.log(dim(evt.properties.errors.join("\n")));
|
|
45
|
+
});
|
|
46
|
+
bus.subscribe("worker.stdout", async (evt) => {
|
|
47
|
+
const { message } = evt.properties;
|
|
48
|
+
const lines = message.split("\n");
|
|
49
|
+
for (let i = 0; i < lines.length; i++) {
|
|
50
|
+
const line = lines[i];
|
|
51
|
+
lines[i] = " " + line;
|
|
52
|
+
}
|
|
53
|
+
console.log(bold(blue(`Log `)), bold(useFunctions().fromID(evt.properties.functionID).handler));
|
|
54
|
+
console.log(dim(lines.join("\n")));
|
|
55
|
+
});
|
|
56
|
+
bus.subscribe("function.success", async (evt) => {
|
|
57
|
+
console.log(bold(green(`Success `)), bold(useFunctions().fromID(evt.properties.functionID).handler));
|
|
58
|
+
});
|
|
59
|
+
bus.subscribe("function.error", async (evt) => {
|
|
60
|
+
console.log(bold(red(`Error `)), bold(useFunctions().fromID(evt.properties.functionID).handler), evt.properties.errorMessage);
|
|
61
|
+
for (const line of evt.properties.trace || []) {
|
|
62
|
+
console.log(` ${dim(line)}`);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
const useStackBuilder = Context.memo(async () => {
|
|
67
|
+
const watcher = useWatcher();
|
|
68
|
+
const bus = useBus();
|
|
69
|
+
const project = useProject();
|
|
70
|
+
let lastDeployed;
|
|
71
|
+
let pending;
|
|
72
|
+
let isDeploying = false;
|
|
73
|
+
async function build() {
|
|
74
|
+
const spinner = createSpinner("Building stacks").start();
|
|
75
|
+
try {
|
|
76
|
+
const fn = await Stacks.build();
|
|
77
|
+
const assembly = await Stacks.synth({
|
|
78
|
+
fn,
|
|
79
|
+
outDir: `.sst/cdk.out`,
|
|
80
|
+
mode: "dev",
|
|
81
|
+
});
|
|
82
|
+
Logger.debug("Directory", assembly.directory);
|
|
83
|
+
const next = await checksum(assembly.directory);
|
|
84
|
+
Logger.debug("Checksum", "next", next, "old", lastDeployed);
|
|
85
|
+
if (next === lastDeployed) {
|
|
86
|
+
spinner.succeed("Stacks built! No changes");
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
spinner.succeed(lastDeployed ? `Stacks built!` : `Stacks built!`);
|
|
90
|
+
pending = assembly;
|
|
91
|
+
if (lastDeployed)
|
|
92
|
+
deploy();
|
|
93
|
+
}
|
|
94
|
+
catch (ex) {
|
|
95
|
+
spinner.fail();
|
|
96
|
+
console.error(ex);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async function deploy() {
|
|
100
|
+
if (!pending)
|
|
101
|
+
return;
|
|
102
|
+
if (isDeploying)
|
|
103
|
+
return;
|
|
104
|
+
isDeploying = true;
|
|
105
|
+
const assembly = pending;
|
|
106
|
+
const nextChecksum = await checksum(assembly.directory);
|
|
107
|
+
pending = undefined;
|
|
108
|
+
let component = undefined;
|
|
109
|
+
if (args.fullscreen) {
|
|
110
|
+
process.stdout.write("\x1b[?1049h");
|
|
111
|
+
component = render(React.createElement(DeploymentUI, { stacks: assembly.stacks.map((s) => s.stackName) }));
|
|
112
|
+
}
|
|
113
|
+
const results = await Stacks.deployMany(assembly.stacks);
|
|
114
|
+
if (component)
|
|
115
|
+
component.unmount();
|
|
116
|
+
process.stdout.write("\x1b[?1049l");
|
|
117
|
+
lastDeployed = nextChecksum;
|
|
118
|
+
printDeploymentResults(results);
|
|
119
|
+
const keys = await SiteEnv.keys();
|
|
120
|
+
if (keys.length) {
|
|
121
|
+
const result = {};
|
|
122
|
+
for (const key of keys) {
|
|
123
|
+
const stack = results[key.stack];
|
|
124
|
+
const value = stack.outputs[key.output];
|
|
125
|
+
let existing = result[key.path];
|
|
126
|
+
if (!existing) {
|
|
127
|
+
result[key.path] = existing;
|
|
128
|
+
existing = result[key.path] = {};
|
|
129
|
+
}
|
|
130
|
+
existing[key.environment] = value;
|
|
131
|
+
}
|
|
132
|
+
await SiteEnv.writeValues(result);
|
|
133
|
+
}
|
|
134
|
+
isDeploying = false;
|
|
135
|
+
deploy();
|
|
136
|
+
}
|
|
137
|
+
async function checksum(cdkOutPath) {
|
|
138
|
+
const manifestPath = path.join(cdkOutPath, "manifest.json");
|
|
139
|
+
const cdkManifest = JSON.parse(await fs.readFile(manifestPath).then((x) => x.toString()));
|
|
140
|
+
const checksumData = await Promise.all(Object.keys(cdkManifest.artifacts)
|
|
141
|
+
.filter((key) => cdkManifest.artifacts[key].type === "aws:cloudformation:stack")
|
|
142
|
+
.map(async (key) => {
|
|
143
|
+
const { templateFile } = cdkManifest.artifacts[key].properties;
|
|
144
|
+
const templatePath = path.join(cdkOutPath, templateFile);
|
|
145
|
+
const templateContent = await fs.readFile(templatePath);
|
|
146
|
+
return templateContent;
|
|
147
|
+
})).then((x) => x.join("\n"));
|
|
148
|
+
const hash = crypto
|
|
149
|
+
.createHash("sha256")
|
|
150
|
+
.update(checksumData)
|
|
151
|
+
.digest("hex");
|
|
152
|
+
return hash;
|
|
153
|
+
}
|
|
154
|
+
let metafile;
|
|
155
|
+
bus.subscribe("stack.built", async (evt) => {
|
|
156
|
+
metafile = evt.properties.metafile;
|
|
157
|
+
});
|
|
158
|
+
watcher.subscribe("file.changed", async (evt) => {
|
|
159
|
+
if (!metafile)
|
|
160
|
+
return;
|
|
161
|
+
if (!metafile.inputs[evt.properties.relative])
|
|
162
|
+
return;
|
|
163
|
+
build();
|
|
164
|
+
});
|
|
165
|
+
await build();
|
|
166
|
+
await deploy();
|
|
167
|
+
});
|
|
168
|
+
createSpinner("").start().succeed("Ready for function invocations");
|
|
169
|
+
createSpinner("")
|
|
170
|
+
.start()
|
|
171
|
+
.succeed(`Console ready at https://console.sst.dev`);
|
|
172
|
+
await Promise.all([
|
|
173
|
+
useLocalServer({
|
|
174
|
+
key: "",
|
|
175
|
+
cert: "",
|
|
176
|
+
live: true,
|
|
177
|
+
port: 13557,
|
|
178
|
+
}),
|
|
179
|
+
useRuntimeWorkers(),
|
|
180
|
+
useIOTBridge(),
|
|
181
|
+
useRuntimeServer(),
|
|
182
|
+
usePothosBuilder(),
|
|
183
|
+
useKyselyTypeGenerator(),
|
|
184
|
+
useRDSWarmer(),
|
|
185
|
+
useFunctionLogger(),
|
|
186
|
+
useStackBuilder(),
|
|
187
|
+
]);
|
|
188
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
import { Program } from "../program.js";
|
|
3
|
+
export declare const env: (program: Program) => import("yargs").Argv<{
|
|
4
|
+
stage: string | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
profile: string | undefined;
|
|
7
|
+
} & {
|
|
8
|
+
region: string | undefined;
|
|
9
|
+
} & {
|
|
10
|
+
command: string;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useProject } from "../../app.js";
|
|
2
|
+
import { createSpinner } from "../spinner.js";
|
|
3
|
+
import fs from "fs/promises";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { SiteEnv } from "../../site-env.js";
|
|
6
|
+
import { spawnSync } from "child_process";
|
|
7
|
+
export const env = (program) => program.command("env <command>", "description", (yargs) => yargs.positional("command", {
|
|
8
|
+
type: "string",
|
|
9
|
+
describe: "Command to run with environment variabels loaded",
|
|
10
|
+
demandOption: true,
|
|
11
|
+
}), async (args) => {
|
|
12
|
+
const project = useProject();
|
|
13
|
+
const spinner = createSpinner("Waiting for SST to start").start();
|
|
14
|
+
while (true) {
|
|
15
|
+
const exists = await fs
|
|
16
|
+
.access(SiteEnv.valuesFile())
|
|
17
|
+
.then(() => true)
|
|
18
|
+
.catch(() => false);
|
|
19
|
+
if (!exists) {
|
|
20
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
spinner.succeed();
|
|
24
|
+
const sites = await SiteEnv.values();
|
|
25
|
+
const current = path.relative(project.paths.root, process.cwd());
|
|
26
|
+
const env = sites[current] || {};
|
|
27
|
+
console.log(args.command);
|
|
28
|
+
const result = spawnSync(args.command, {
|
|
29
|
+
env: {
|
|
30
|
+
...process.env,
|
|
31
|
+
...env,
|
|
32
|
+
},
|
|
33
|
+
stdio: "inherit",
|
|
34
|
+
shell: process.env.SHELL || true,
|
|
35
|
+
});
|
|
36
|
+
process.exitCode = result.status || undefined;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useKyselyTypeGenerator: () => Promise<void>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Kysely } from "kysely";
|
|
2
|
+
import { DataApiDialect } from "kysely-data-api";
|
|
3
|
+
import RDSDataService from "aws-sdk/clients/rdsdataservice.js";
|
|
4
|
+
import * as fs from "fs/promises";
|
|
5
|
+
import { DatabaseMetadata, EnumCollection, PostgresDialect, Serializer, Transformer, } from "kysely-codegen";
|
|
6
|
+
import { Context } from "../../../context/context.js";
|
|
7
|
+
import { useBus } from "../../../bus.js";
|
|
8
|
+
import { useProject } from "../../../app.js";
|
|
9
|
+
export const useKyselyTypeGenerator = Context.memo(async () => {
|
|
10
|
+
let databases = [];
|
|
11
|
+
const bus = useBus();
|
|
12
|
+
const project = useProject();
|
|
13
|
+
async function generate(db) {
|
|
14
|
+
if (!db.types)
|
|
15
|
+
return;
|
|
16
|
+
const k = new Kysely({
|
|
17
|
+
dialect: new DataApiDialect({
|
|
18
|
+
mode: db.engine.includes("postgres") ? "postgres" : "mysql",
|
|
19
|
+
driver: {
|
|
20
|
+
secretArn: db.secretArn,
|
|
21
|
+
resourceArn: db.clusterArn,
|
|
22
|
+
database: db.defaultDatabaseName,
|
|
23
|
+
client: new RDSDataService({
|
|
24
|
+
region: project.region,
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
const tables = await k.introspection.getTables();
|
|
30
|
+
const metadata = db.engine.includes("postgres")
|
|
31
|
+
? tables.map((table) => ({
|
|
32
|
+
...table,
|
|
33
|
+
columns: table.columns.map((column) => {
|
|
34
|
+
const isArray = column.dataType.startsWith("_");
|
|
35
|
+
return {
|
|
36
|
+
...column,
|
|
37
|
+
dataType: isArray ? column.dataType.slice(1) : column.dataType,
|
|
38
|
+
enumValues: null,
|
|
39
|
+
isArray,
|
|
40
|
+
};
|
|
41
|
+
}),
|
|
42
|
+
}))
|
|
43
|
+
: tables.map((table) => ({
|
|
44
|
+
...table,
|
|
45
|
+
columns: table.columns.map((column) => ({
|
|
46
|
+
...column,
|
|
47
|
+
enumValues: null,
|
|
48
|
+
})),
|
|
49
|
+
}));
|
|
50
|
+
const transformer = new Transformer();
|
|
51
|
+
const nodes = transformer.transform({
|
|
52
|
+
dialect: new PostgresDialect(),
|
|
53
|
+
camelCase: db.types.camelCase === "true",
|
|
54
|
+
metadata: new DatabaseMetadata(metadata, new EnumCollection()),
|
|
55
|
+
});
|
|
56
|
+
const lastIndex = nodes.length - 1;
|
|
57
|
+
const last = nodes[lastIndex];
|
|
58
|
+
nodes[lastIndex] = {
|
|
59
|
+
...last,
|
|
60
|
+
argument: {
|
|
61
|
+
...last.argument,
|
|
62
|
+
name: "Database",
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
const serializer = new Serializer();
|
|
66
|
+
const data = serializer.serialize(nodes);
|
|
67
|
+
await fs.writeFile(db.types.path, data);
|
|
68
|
+
}
|
|
69
|
+
bus.subscribe("stacks.metadata", (evt) => {
|
|
70
|
+
databases = Object.values(evt.properties)
|
|
71
|
+
.flat()
|
|
72
|
+
.filter((c) => c.type === "RDS")
|
|
73
|
+
.filter((c) => c.data.migrator)
|
|
74
|
+
.filter((c) => c.data.types)
|
|
75
|
+
.map((c) => ({
|
|
76
|
+
migratorID: evt.properties.metadata.find((fn) => fn.addr == c.data.migrator?.node).addr,
|
|
77
|
+
clusterArn: c.data.clusterArn,
|
|
78
|
+
types: c.data.types,
|
|
79
|
+
engine: c.data.engine,
|
|
80
|
+
defaultDatabaseName: c.data.defaultDatabaseName,
|
|
81
|
+
secretArn: c.data.secretArn,
|
|
82
|
+
}));
|
|
83
|
+
databases.map((db) => generate(db));
|
|
84
|
+
});
|
|
85
|
+
bus.subscribe("function.success", async (evt) => {
|
|
86
|
+
const db = databases.find((db) => db.migratorID === evt.properties.functionID);
|
|
87
|
+
if (!db)
|
|
88
|
+
return;
|
|
89
|
+
generate(db);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const usePothosBuilder: () => void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useBus } from "../../../bus.js";
|
|
2
|
+
import { Context } from "../../../context/context.js";
|
|
3
|
+
import { Pothos } from "../../../pothos.js";
|
|
4
|
+
import fs from "fs/promises";
|
|
5
|
+
import { exec } from "child_process";
|
|
6
|
+
import { promisify } from "util";
|
|
7
|
+
const execAsync = promisify(exec);
|
|
8
|
+
import path from "path";
|
|
9
|
+
export const usePothosBuilder = Context.memo(() => {
|
|
10
|
+
let routes = [];
|
|
11
|
+
const bus = useBus();
|
|
12
|
+
async function build(route) {
|
|
13
|
+
try {
|
|
14
|
+
const schema = await Pothos.generate({
|
|
15
|
+
schema: route.schema,
|
|
16
|
+
});
|
|
17
|
+
await fs.writeFile(route.output, schema);
|
|
18
|
+
// bus.publish("pothos.extracted", { file: route.output });
|
|
19
|
+
await Promise.all(route.commands.map((cmd) => execAsync(cmd)));
|
|
20
|
+
console.log("Done building pothos schema");
|
|
21
|
+
}
|
|
22
|
+
catch (ex) {
|
|
23
|
+
console.error("Failed to extract schema from pothos");
|
|
24
|
+
console.error(ex);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
bus.subscribe("file.changed", async (evt) => {
|
|
28
|
+
if (evt.properties.file.endsWith("out.mjs"))
|
|
29
|
+
return;
|
|
30
|
+
for (const route of routes) {
|
|
31
|
+
const dir = path.dirname(route.schema);
|
|
32
|
+
const relative = path.relative(dir, evt.properties.file);
|
|
33
|
+
if (relative && !relative.startsWith("..") && !path.isAbsolute(relative))
|
|
34
|
+
build(route);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
let first = false;
|
|
38
|
+
bus.subscribe("stacks.metadata", async (evt) => {
|
|
39
|
+
routes = Object.values(evt.properties)
|
|
40
|
+
.flat()
|
|
41
|
+
.filter((c) => c.type == "Api")
|
|
42
|
+
.flatMap((c) => c.data.routes)
|
|
43
|
+
.filter((r) => ["pothos", "graphql"].includes(r.type))
|
|
44
|
+
.filter((r) => r.schema);
|
|
45
|
+
if (first)
|
|
46
|
+
return;
|
|
47
|
+
for (const route of routes) {
|
|
48
|
+
build(route);
|
|
49
|
+
first = true;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useRDSWarmer: () => Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useBus } from "../../../bus.js";
|
|
2
|
+
import { Context } from "../../../context/context.js";
|
|
3
|
+
import { RDSDataClient, ExecuteStatementCommand, } from "@aws-sdk/client-rds-data";
|
|
4
|
+
import { useAWSClient } from "../../../credentials.js";
|
|
5
|
+
export const useRDSWarmer = Context.memo(async () => {
|
|
6
|
+
let interval;
|
|
7
|
+
const bus = useBus();
|
|
8
|
+
const client = useAWSClient(RDSDataClient);
|
|
9
|
+
bus.subscribe("stacks.metadata", (evt) => {
|
|
10
|
+
if (interval)
|
|
11
|
+
clearInterval(interval);
|
|
12
|
+
interval = setInterval(() => {
|
|
13
|
+
Object.values(evt.properties)
|
|
14
|
+
.flat()
|
|
15
|
+
.filter((c) => c.type === "RDS")
|
|
16
|
+
.map((c) => {
|
|
17
|
+
try {
|
|
18
|
+
client.send(new ExecuteStatementCommand({
|
|
19
|
+
sql: "SELECT 1",
|
|
20
|
+
secretArn: c.data.secretArn,
|
|
21
|
+
resourceArn: c.data.clusterArn,
|
|
22
|
+
database: c.data.defaultDatabaseName,
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
// Ignore error
|
|
27
|
+
// If the cluster is not warm, this will throw:
|
|
28
|
+
// BadRequestException: Communication link failure
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}, 1000 * 60);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
import type { Program } from "../program.js";
|
|
3
|
+
export declare const remove: (program: Program) => import("yargs").Argv<{
|
|
4
|
+
stage: string | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
profile: string | undefined;
|
|
7
|
+
} & {
|
|
8
|
+
region: string | undefined;
|
|
9
|
+
} & {
|
|
10
|
+
from: string | undefined;
|
|
11
|
+
} & {
|
|
12
|
+
filter: string | undefined;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { printDeploymentResults } from "../ui/deploy.js";
|
|
2
|
+
export const remove = (program) => program.command("remove [filter]", "Remove all stacks for this app", (yargs) => yargs
|
|
3
|
+
.option("from", { type: "string" })
|
|
4
|
+
.positional("filter", { type: "string" }), async (args) => {
|
|
5
|
+
const React = await import("react");
|
|
6
|
+
const { CloudAssembly } = await import("aws-cdk-lib/cx-api");
|
|
7
|
+
const { blue, bold } = await import("colorette");
|
|
8
|
+
const { useProject } = await import("../../app.js");
|
|
9
|
+
const { Stacks } = await import("../../stacks/index.js");
|
|
10
|
+
const { render } = await import("ink");
|
|
11
|
+
const { DeploymentUI } = await import("../ui/deploy.js");
|
|
12
|
+
const assembly = await (async function () {
|
|
13
|
+
if (args.from) {
|
|
14
|
+
const result = new CloudAssembly(args.from);
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
const fn = await Stacks.build();
|
|
18
|
+
return await Stacks.synth({
|
|
19
|
+
fn,
|
|
20
|
+
mode: "remove",
|
|
21
|
+
});
|
|
22
|
+
})();
|
|
23
|
+
const project = useProject();
|
|
24
|
+
const target = assembly.stacks.filter((s) => !args.filter ||
|
|
25
|
+
s.stackName.toLowerCase().includes(args.filter.toLowerCase()));
|
|
26
|
+
if (!target.length) {
|
|
27
|
+
console.log(`No stacks found matching ${blue(args.filter)}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
console.log(`Removing ${bold(target.length + " stacks")} for stage ${blue(project.stage)}...`);
|
|
32
|
+
process.stdout.write("\x1b[?1049h");
|
|
33
|
+
const component = render(React.createElement(DeploymentUI, { stacks: target.map((s) => s.stackName) }));
|
|
34
|
+
const results = await Stacks.removeMany(target);
|
|
35
|
+
component.unmount();
|
|
36
|
+
process.stdout.write("\x1b[?1049l");
|
|
37
|
+
printDeploymentResults(results);
|
|
38
|
+
process.exit(0);
|
|
39
|
+
});
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Config } from "../../../config.js";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { gray } from "colorette";
|
|
3
|
+
export const list = (program) => program.command("list [format]", "Fetch and decrypt all secrets", yargs => yargs.positional("format", { type: "string", default: "table" }), async (args) => {
|
|
4
4
|
const secrets = await Config.secrets();
|
|
5
5
|
switch (args.format) {
|
|
6
6
|
case "env":
|
|
@@ -10,8 +10,8 @@ export const list = (program) => program.command("list [format]", "Fetch and dec
|
|
|
10
10
|
break;
|
|
11
11
|
case "table":
|
|
12
12
|
const keys = Object.keys(secrets);
|
|
13
|
-
const keyLen = Math.max("Secrets".length, ...keys.map(
|
|
14
|
-
const valueLen = Math.max("Values".length, ...keys.map(
|
|
13
|
+
const keyLen = Math.max("Secrets".length, ...keys.map(key => key.length));
|
|
14
|
+
const valueLen = Math.max("Values".length, ...keys.map(key => secrets[key].value
|
|
15
15
|
? secrets[key].value.length
|
|
16
16
|
: `${secrets[key].fallback} (fallback)`.length));
|
|
17
17
|
console.log("┌".padEnd(keyLen + 3, "─") +
|
|
@@ -23,7 +23,7 @@ export const list = (program) => program.command("list [format]", "Fetch and dec
|
|
|
23
23
|
"┼" +
|
|
24
24
|
"".padEnd(valueLen + 2, "─") +
|
|
25
25
|
"┤");
|
|
26
|
-
keys.sort().forEach(
|
|
26
|
+
keys.sort().forEach(key => {
|
|
27
27
|
const value = secrets[key].value
|
|
28
28
|
? secrets[key].value
|
|
29
29
|
: `${secrets[key].fallback} ${gray("(fallback)")}`;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,42 +1,44 @@
|
|
|
1
1
|
import { Config } from "../../../config.js";
|
|
2
2
|
import { blue } from "colorette";
|
|
3
|
+
import { createSpinner } from "../../spinner.js";
|
|
3
4
|
export const set = (program) => program
|
|
4
|
-
.command("set <name> <value>", "Set secret value",
|
|
5
|
+
.command("set <name> <value>", "Set secret value", yargs => yargs
|
|
5
6
|
.positional("name", {
|
|
6
7
|
type: "string",
|
|
7
8
|
describe: "Name of secret",
|
|
8
|
-
demandOption: true
|
|
9
|
+
demandOption: true
|
|
9
10
|
})
|
|
10
11
|
.positional("value", {
|
|
11
12
|
type: "string",
|
|
12
13
|
describe: "Value to set",
|
|
13
|
-
demandOption: true
|
|
14
|
+
demandOption: true
|
|
14
15
|
}), async (args) => {
|
|
15
|
-
|
|
16
|
+
const setting = createSpinner(`Setting secret ${blue(args.name)}`).start();
|
|
16
17
|
await Config.setSecret({
|
|
17
18
|
key: args.name,
|
|
18
|
-
value: args.value
|
|
19
|
+
value: args.value
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
+
setting.succeed();
|
|
22
|
+
const restarting = createSpinner(`Restarting all functions using ${blue(args.name)}...`).start();
|
|
21
23
|
const count = await Config.restart(args.name);
|
|
22
|
-
|
|
24
|
+
restarting.succeed(`Restarted ${blue(count)} functions`);
|
|
23
25
|
})
|
|
24
|
-
.command("set-fallback <name> <value>", "Set a fallback value for secret",
|
|
26
|
+
.command("set-fallback <name> <value>", "Set a fallback value for secret", yargs => yargs
|
|
25
27
|
.positional("name", {
|
|
26
28
|
type: "string",
|
|
27
29
|
describe: "Name of secret",
|
|
28
|
-
demandOption: true
|
|
30
|
+
demandOption: true
|
|
29
31
|
})
|
|
30
32
|
.positional("value", {
|
|
31
33
|
type: "string",
|
|
32
34
|
describe: "Value to set",
|
|
33
|
-
demandOption: true
|
|
35
|
+
demandOption: true
|
|
34
36
|
}), async (args) => {
|
|
35
37
|
console.log("Setting", `${blue(args.name)}...`);
|
|
36
38
|
await Config.setSecret({
|
|
37
39
|
key: args.name,
|
|
38
40
|
value: args.value,
|
|
39
|
-
fallback: true
|
|
41
|
+
fallback: true
|
|
40
42
|
});
|
|
41
43
|
console.log("Restarting all functions using", `${blue(args.name)}...`);
|
|
42
44
|
const count = await Config.restart(args.name);
|