sst 2.0.0-rc.9 → 2.0.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/bootstrap.d.ts +2 -4
- package/bootstrap.js +208 -61
- package/bus.d.ts +3 -3
- package/bus.js +1 -1
- package/cache.js +1 -1
- package/cdk/cloudformation-deployments-wrapper.d.ts +3 -0
- package/cdk/cloudformation-deployments-wrapper.js +117 -0
- package/cdk/cloudformation-deployments.d.ts +19 -4
- package/cdk/deploy-stack.d.ts +17 -2
- package/cdk/deploy-stack.js +6 -1
- package/cli/colors.d.ts +28 -0
- package/cli/colors.js +27 -0
- package/cli/commands/bind.d.ts +4 -0
- package/cli/commands/bind.js +10 -7
- package/cli/commands/bootstrap.d.ts +13 -0
- package/cli/commands/bootstrap.js +11 -0
- package/cli/commands/build.d.ts +6 -2
- package/cli/commands/build.js +13 -8
- package/cli/commands/console.d.ts +5 -1
- package/cli/commands/console.js +8 -6
- package/cli/commands/deploy.d.ts +4 -2
- package/cli/commands/deploy.js +69 -29
- package/cli/commands/dev.d.ts +5 -1
- package/cli/commands/dev.js +157 -79
- package/cli/commands/diff.d.ts +15 -0
- package/cli/commands/diff.js +61 -0
- package/cli/commands/env.d.ts +5 -1
- package/cli/commands/env.js +14 -15
- package/cli/commands/plugins/kysely.js +13 -5
- package/cli/commands/plugins/pothos.js +9 -4
- package/cli/commands/remove.d.ts +4 -0
- package/cli/commands/remove.js +26 -18
- package/cli/commands/secrets/get.d.ts +7 -3
- package/cli/commands/secrets/get.js +11 -24
- package/cli/commands/secrets/list.d.ts +6 -2
- package/cli/commands/secrets/list.js +15 -7
- package/cli/commands/secrets/remove.d.ts +8 -4
- package/cli/commands/secrets/remove.js +18 -16
- package/cli/commands/secrets/secrets.js +3 -3
- package/cli/commands/secrets/set.d.ts +8 -6
- package/cli/commands/secrets/set.js +16 -33
- package/cli/commands/telemetry.d.ts +15 -0
- package/cli/commands/telemetry.js +17 -0
- package/cli/commands/transform.d.ts +15 -0
- package/cli/commands/transform.js +55 -0
- package/cli/commands/update.d.ts +6 -2
- package/cli/commands/update.js +41 -33
- package/cli/commands/version.d.ts +13 -0
- package/cli/commands/version.js +7 -0
- package/cli/local/router.d.ts +6 -6
- package/cli/local/router.js +3 -3
- package/cli/local/server.d.ts +5 -3
- package/cli/local/server.js +21 -14
- package/cli/program.d.ts +5 -1
- package/cli/program.js +29 -5
- package/cli/spinner.js +2 -0
- package/cli/sst.js +35 -23
- package/cli/telemetry/environment.d.ts +1 -1
- package/cli/telemetry/environment.js +1 -1
- package/cli/terminal.d.ts +1 -0
- package/cli/terminal.js +8 -0
- package/cli/ui/deploy.d.ts +3 -2
- package/cli/ui/deploy.js +106 -106
- package/cli/ui/functions.d.ts +2 -0
- package/cli/ui/functions.js +132 -0
- package/cli/ui/header.d.ts +5 -0
- package/cli/ui/header.js +16 -0
- package/cli/ui/stack.d.ts +1 -0
- package/cli/ui/stack.js +6 -0
- package/config.d.ts +1 -1
- package/config.js +8 -8
- package/constructs/Api.d.ts +3 -71
- package/constructs/Api.js +3 -42
- package/constructs/ApiGatewayV1Api.d.ts +3 -3
- package/constructs/ApiGatewayV1Api.js +4 -3
- package/constructs/App.d.ts +2 -22
- package/constructs/App.js +12 -25
- package/constructs/AppSyncApi.d.ts +4 -5
- package/constructs/AppSyncApi.js +8 -5
- package/constructs/AstroSite.d.ts +2 -3
- package/constructs/AstroSite.js +43 -53
- package/constructs/Auth.js +27 -16
- package/constructs/BaseSite.d.ts +10 -10
- package/constructs/BaseSite.js +2 -2
- package/constructs/Cognito.js +28 -28
- package/constructs/EdgeFunction.d.ts +6 -4
- package/constructs/EdgeFunction.js +56 -59
- package/constructs/EventBus.js +1 -1
- package/constructs/Function.d.ts +4 -44
- package/constructs/Function.js +14 -50
- package/constructs/FunctionalStack.d.ts +2 -2
- package/constructs/Job.d.ts +23 -63
- package/constructs/Job.js +11 -32
- package/constructs/Metadata.d.ts +18 -20
- package/constructs/NextjsSite.d.ts +21 -5
- package/constructs/NextjsSite.js +67 -101
- package/constructs/Queue.js +10 -10
- package/constructs/RDS.d.ts +1 -1
- package/constructs/RDS.js +1 -1
- package/constructs/RemixSite.d.ts +0 -2
- package/constructs/RemixSite.js +20 -20
- package/constructs/Script.js +1 -1
- package/constructs/Secret.js +5 -3
- package/constructs/SolidStartSite.d.ts +2 -3
- package/constructs/SolidStartSite.js +42 -52
- package/constructs/SsrFunction.d.ts +22 -0
- package/constructs/SsrFunction.js +113 -0
- package/constructs/SsrSite.d.ts +104 -104
- package/constructs/SsrSite.js +196 -217
- package/constructs/Stack.d.ts +1 -20
- package/constructs/Stack.js +3 -65
- package/constructs/StaticSite.d.ts +33 -53
- package/constructs/StaticSite.js +92 -118
- package/constructs/Table.d.ts +1 -1
- package/constructs/Table.js +4 -4
- package/constructs/Topic.js +1 -1
- package/constructs/cdk/certificate-base.d.ts +18 -0
- package/constructs/cdk/certificate-base.js +26 -0
- package/constructs/cdk/dns-validated-certificate.d.ts +77 -0
- package/constructs/cdk/dns-validated-certificate.js +125 -0
- package/constructs/cdk/website-redirect.d.ts +53 -0
- package/constructs/cdk/website-redirect.js +77 -0
- package/constructs/deferred_task.d.ts +1 -1
- package/constructs/deprecated/NextjsSite.js +8 -6
- package/constructs/index.d.ts +0 -6
- package/constructs/index.js +0 -6
- package/constructs/util/apiGatewayV1AccessLog.d.ts +1 -1
- package/constructs/util/apiGatewayV2AccessLog.js +4 -4
- package/constructs/util/apiGatewayV2Domain.js +9 -2
- package/constructs/util/appSyncApiDomain.d.ts +1 -1
- package/constructs/util/appSyncApiDomain.js +9 -15
- package/constructs/util/duration.d.ts +1 -1
- package/constructs/util/functionBinding.js +1 -1
- package/constructs/util/permission.d.ts +3 -3
- package/constructs/util/permission.js +16 -18
- package/constructs/util/size.d.ts +1 -1
- package/constructs/util/warning.js +2 -2
- package/context/context.d.ts +2 -2
- package/context/context.js +4 -4
- package/context/handler.d.ts +1 -1
- package/credentials.d.ts +1 -1
- package/credentials.js +42 -6
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/iot.js +6 -2
- package/logger.js +3 -1
- package/node/api/index.d.ts +2 -3
- package/node/api/index.js +8 -2
- package/node/auth/adapter/adapter.d.ts +1 -1
- package/node/auth/adapter/facebook.js +1 -1
- package/node/auth/adapter/github.js +4 -4
- package/node/auth/adapter/google.d.ts +1 -1
- package/node/auth/adapter/google.js +2 -2
- package/node/auth/adapter/twitch.js +1 -1
- package/node/auth/session.d.ts +1 -1
- package/node/config/index.d.ts +2 -2
- package/node/config/index.js +3 -8
- package/node/job/index.d.ts +2 -2
- package/node/site/index.js +3 -5
- package/package.json +26 -21
- package/pothos.js +1 -0
- package/project.d.ts +47 -0
- package/{app.js → project.js} +60 -53
- package/runtime/handlers/dotnet.d.ts +1 -1
- package/runtime/handlers/dotnet.js +4 -4
- package/runtime/handlers/go.d.ts +1 -1
- package/runtime/handlers/go.js +3 -3
- package/runtime/handlers/java.d.ts +1 -1
- package/runtime/handlers/java.js +4 -4
- package/runtime/handlers/node.d.ts +1 -1
- package/runtime/handlers/node.js +60 -39
- package/runtime/handlers/python.d.ts +1 -1
- package/runtime/handlers/python.js +3 -3
- package/runtime/handlers.js +15 -12
- package/runtime/iot.js +3 -0
- package/runtime/runtime.d.ts +4 -0
- package/runtime/server.d.ts +3 -3
- package/runtime/server.js +11 -5
- package/runtime/workers.d.ts +4 -2
- package/runtime/workers.js +13 -3
- package/site-env.js +2 -1
- package/sst.mjs +6357 -20848
- package/stacks/app-metadata.d.ts +7 -0
- package/stacks/app-metadata.js +78 -0
- package/stacks/assembly.d.ts +1 -0
- package/stacks/assembly.js +4 -0
- package/stacks/build.d.ts +1 -1
- package/stacks/build.js +41 -48
- package/stacks/deploy.d.ts +1 -0
- package/stacks/deploy.js +128 -7
- package/stacks/diff.d.ts +8 -0
- package/stacks/diff.js +62 -0
- package/stacks/index.d.ts +3 -0
- package/stacks/index.js +3 -0
- package/stacks/metadata.d.ts +2 -0
- package/stacks/metadata.js +14 -12
- package/stacks/monitor.d.ts +8 -3
- package/stacks/monitor.js +38 -4
- package/stacks/remove.js +0 -4
- package/stacks/synth.d.ts +1 -0
- package/stacks/synth.js +27 -13
- package/support/base-site-archiver.mjs +1 -1
- package/support/bootstrap-metadata-function/index.mjs +68740 -0
- package/support/bridge/bridge.mjs +28 -28
- package/support/certificate-requestor/index.js +549 -0
- package/support/custom-resources/index.mjs +3824 -26567
- package/support/dotnet6-bootstrap/release/dotnet-bootstrap.deps.json +1 -1
- package/support/dotnet6-bootstrap/release/dotnet-bootstrap.runtimeconfig.json +1 -1
- package/support/edge-function/edge-lambda.mjs +2 -2
- package/support/job-invoker/index.mjs +26 -0
- package/support/nodejs-runtime/index.mjs +75 -72
- package/support/rds-migrator/index.mjs +22 -23
- package/support/remix-site-function/edge-server.js +1 -1
- package/support/script-function/index.mjs +30485 -0
- package/support/{edge-function-code-replacer → sls-nextjs-site-function-code-replacer}/lambda-code-updater.py +0 -0
- package/support/ssr-site-function-archiver.mjs +96 -0
- package/watcher.js +1 -1
- package/app.d.ts +0 -36
- package/constructs/DebugApp.d.ts +0 -49
- package/constructs/DebugApp.js +0 -63
- package/constructs/DebugStack.d.ts +0 -34
- package/constructs/DebugStack.js +0 -132
- package/constructs/GraphQLApi.d.ts +0 -98
- package/constructs/GraphQLApi.js +0 -80
- package/constructs/ReactStaticSite.d.ts +0 -20
- package/constructs/ReactStaticSite.js +0 -54
- package/constructs/Script/cfn-response.d.ts +0 -19
- package/constructs/Script/cfn-response.js +0 -77
- package/constructs/Script/index.d.ts +0 -1
- package/constructs/Script/index.js +0 -78
- package/constructs/Script/outbound.d.ts +0 -10
- package/constructs/Script/outbound.js +0 -42
- package/constructs/Script/util.d.ts +0 -2
- package/constructs/Script/util.js +0 -11
- package/constructs/ViteStaticSite.d.ts +0 -32
- package/constructs/ViteStaticSite.js +0 -66
- package/support/astro-site-html-stub/index.html +0 -99
- package/support/base-site-archiver.cjs +0 -116
- package/support/nextjs-site-html-stub/index.html +0 -99
- package/support/remix-site-html-stub/index.html +0 -99
- package/support/solid-start-site-html-stub/index.html +0 -99
- package/support/static-site-stub/index.html +0 -90
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createAppContext } from "../context.js";
|
|
2
2
|
const WARNINGS = {
|
|
3
3
|
"config.deprecated": `WARNING: The "config" prop is deprecated, and will be removed in SST v2. Pass Parameters and Secrets in through the "bind" prop. Read more about how to upgrade here — https://docs.serverless-stack.com/upgrade-guide#upgrade-to-v116`,
|
|
4
|
-
"permissions.noConstructs": `WARNING: Passing SST constructs into "permissions" is deprecated, and will be removed in SST v2. Pass them into the "bind" prop. Read more about how to upgrade here — https://docs.serverless-stack.com/upgrade-guide#upgrade-to-v116
|
|
4
|
+
"permissions.noConstructs": `WARNING: Passing SST constructs into "permissions" is deprecated, and will be removed in SST v2. Pass them into the "bind" prop. Read more about how to upgrade here — https://docs.serverless-stack.com/upgrade-guide#upgrade-to-v116`,
|
|
5
5
|
};
|
|
6
6
|
export const useWarning = createAppContext(() => {
|
|
7
7
|
const set = new Set();
|
|
@@ -13,6 +13,6 @@ export const useWarning = createAppContext(() => {
|
|
|
13
13
|
for (const key of set) {
|
|
14
14
|
console.warn(WARNINGS[key]);
|
|
15
15
|
}
|
|
16
|
-
}
|
|
16
|
+
},
|
|
17
17
|
};
|
|
18
18
|
});
|
package/context/context.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ export declare const Context: {
|
|
|
3
3
|
reset: typeof reset;
|
|
4
4
|
memo: typeof memo;
|
|
5
5
|
};
|
|
6
|
-
declare function create<C>(cb?: (() => C) | string): {
|
|
6
|
+
declare function create<C>(cb?: (() => C) | string, name?: string): {
|
|
7
7
|
use(): C;
|
|
8
8
|
provide(value: C): void;
|
|
9
9
|
};
|
|
10
10
|
declare function reset(): void;
|
|
11
|
-
export declare function memo<C>(cb: () => C): () => C;
|
|
11
|
+
export declare function memo<C>(cb: () => C, name?: string): () => C;
|
|
12
12
|
export {};
|
package/context/context.js
CHANGED
|
@@ -8,8 +8,8 @@ const state = {
|
|
|
8
8
|
contexts: new Map(),
|
|
9
9
|
tracking: [],
|
|
10
10
|
};
|
|
11
|
-
function create(cb) {
|
|
12
|
-
const id = Symbol(cb?.toString());
|
|
11
|
+
function create(cb, name) {
|
|
12
|
+
const id = typeof cb === "string" ? cb : name || Symbol(cb?.toString());
|
|
13
13
|
return {
|
|
14
14
|
use() {
|
|
15
15
|
let result = state.contexts.get(id);
|
|
@@ -59,7 +59,7 @@ function resetDependencies(id) {
|
|
|
59
59
|
state.contexts.delete(dependantID);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
export function memo(cb) {
|
|
63
|
-
const ctx = create(cb);
|
|
62
|
+
export function memo(cb, name) {
|
|
63
|
+
const ctx = create(cb, name);
|
|
64
64
|
return ctx.use;
|
|
65
65
|
}
|
package/context/handler.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface Handlers {
|
|
|
9
9
|
response: SQSBatchResponse;
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
type HandlerTypes = keyof Handlers;
|
|
13
13
|
export declare function useEvent<Type extends HandlerTypes>(type: Type): Handlers[Type]["event"];
|
|
14
14
|
export declare function useLambdaContext(): LambdaContext;
|
|
15
15
|
export declare function Handler<Type extends HandlerTypes, Event = Handlers[Type]["event"], Response = Handlers[Type]["response"]>(type: Type, cb: (evt: Event, ctx: LambdaContext) => Promise<Response>): (event: Event, context: LambdaContext) => Promise<Response>;
|
package/credentials.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { RegionInputConfig } from "@aws-sdk/config-resolver";
|
|
|
4
4
|
import { RetryInputConfig } from "@aws-sdk/middleware-retry";
|
|
5
5
|
import { AwsAuthInputConfig } from "@aws-sdk/middleware-signing";
|
|
6
6
|
import { SdkProvider } from "aws-cdk/lib/api/aws-auth/sdk-provider.js";
|
|
7
|
-
|
|
7
|
+
type Config = RegionInputConfig & RetryInputConfig & AwsAuthInputConfig & HostHeaderConditionConfig;
|
|
8
8
|
export declare const useAWSCredentialsProvider: () => import("@aws-sdk/types").CredentialProvider;
|
|
9
9
|
export declare const useAWSCredentials: () => Promise<import("@aws-sdk/types").Credentials>;
|
|
10
10
|
export declare const useSTSIdentity: () => Promise<import("@aws-sdk/client-sts").GetCallerIdentityCommandOutput>;
|
package/credentials.js
CHANGED
|
@@ -7,9 +7,29 @@ import { SdkProvider } from "aws-cdk/lib/api/aws-auth/sdk-provider.js";
|
|
|
7
7
|
import { StandardRetryStrategy } from "@aws-sdk/middleware-retry";
|
|
8
8
|
export const useAWSCredentialsProvider = Context.memo(() => {
|
|
9
9
|
const project = useProject();
|
|
10
|
-
Logger.debug("Using AWS profile", project.profile);
|
|
10
|
+
Logger.debug("Using AWS profile", project.config.profile);
|
|
11
11
|
const provider = fromNodeProviderChain({
|
|
12
|
-
profile: project.profile,
|
|
12
|
+
profile: project.config.profile,
|
|
13
|
+
roleArn: project.config.role,
|
|
14
|
+
mfaCodeProvider: async (serialArn) => {
|
|
15
|
+
const readline = await import("readline");
|
|
16
|
+
const rl = readline.createInterface({
|
|
17
|
+
input: process.stdin,
|
|
18
|
+
output: process.stdout,
|
|
19
|
+
});
|
|
20
|
+
return new Promise((resolve) => {
|
|
21
|
+
Logger.debug(`Require MFA token for serial ARN ${serialArn}`);
|
|
22
|
+
const prompt = () => rl.question(`Enter MFA code for ${serialArn}: `, async (input) => {
|
|
23
|
+
if (input.trim() !== "") {
|
|
24
|
+
resolve(input.trim());
|
|
25
|
+
rl.close();
|
|
26
|
+
}
|
|
27
|
+
// prompt again if no input
|
|
28
|
+
prompt();
|
|
29
|
+
});
|
|
30
|
+
prompt();
|
|
31
|
+
});
|
|
32
|
+
},
|
|
13
33
|
});
|
|
14
34
|
return provider;
|
|
15
35
|
});
|
|
@@ -30,15 +50,31 @@ export function useAWSClient(client, force = false) {
|
|
|
30
50
|
if (existing && !force)
|
|
31
51
|
return existing;
|
|
32
52
|
const [project, credentials] = [useProject(), useAWSCredentialsProvider()];
|
|
53
|
+
const printNoInternet = (() => {
|
|
54
|
+
let lastPrinted = 0;
|
|
55
|
+
return () => {
|
|
56
|
+
const now = Date.now();
|
|
57
|
+
if (now - lastPrinted > 5000) {
|
|
58
|
+
console.log("Waiting for internet connection...");
|
|
59
|
+
lastPrinted = now;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
})();
|
|
33
63
|
const result = new client({
|
|
34
|
-
region: project.region,
|
|
64
|
+
region: project.config.region,
|
|
35
65
|
credentials: credentials,
|
|
36
66
|
retryStrategy: new StandardRetryStrategy(async () => 10000, {
|
|
37
67
|
retryDecider: (err) => {
|
|
38
68
|
if (err.$fault === "client")
|
|
39
69
|
return false;
|
|
70
|
+
if (err.name === "CredentialsProviderError")
|
|
71
|
+
return false;
|
|
40
72
|
if (err.message === "Could not load credentials from any providers")
|
|
41
73
|
return false;
|
|
74
|
+
// Handle no internet connection
|
|
75
|
+
if (err.code === "ENOTFOUND") {
|
|
76
|
+
printNoInternet();
|
|
77
|
+
}
|
|
42
78
|
return true;
|
|
43
79
|
},
|
|
44
80
|
delayDecider: (_, attempts) => {
|
|
@@ -51,7 +87,7 @@ export function useAWSClient(client, force = false) {
|
|
|
51
87
|
return result;
|
|
52
88
|
}
|
|
53
89
|
import aws from "aws-sdk";
|
|
54
|
-
import { useProject } from "./
|
|
90
|
+
import { useProject } from "./project.js";
|
|
55
91
|
const CredentialProviderChain = aws.CredentialProviderChain;
|
|
56
92
|
/**
|
|
57
93
|
* Do not use this. It is only used for AWS CDK compatibility.
|
|
@@ -81,9 +117,9 @@ export const useAWSProvider = Context.memo(async () => {
|
|
|
81
117
|
secretAccessKey: creds.secretAccessKey,
|
|
82
118
|
}),
|
|
83
119
|
]);
|
|
84
|
-
const provider = new SdkProvider(chain, project.region, {
|
|
120
|
+
const provider = new SdkProvider(chain, project.config.region, {
|
|
85
121
|
maxRetries: 10000,
|
|
86
|
-
region: project.region,
|
|
122
|
+
region: project.config.region,
|
|
87
123
|
});
|
|
88
124
|
return provider;
|
|
89
125
|
});
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { SSTConfig } from "./project.js";
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/iot.js
CHANGED
|
@@ -15,7 +15,7 @@ export const useIOTEndpoint = Context.memo(async () => {
|
|
|
15
15
|
});
|
|
16
16
|
import iot from "aws-iot-device-sdk";
|
|
17
17
|
import { useBus } from "./bus.js";
|
|
18
|
-
import { useProject } from "./
|
|
18
|
+
import { useProject } from "./project.js";
|
|
19
19
|
import { Logger } from "./logger.js";
|
|
20
20
|
export const useIOT = Context.memo(async () => {
|
|
21
21
|
const bus = useBus();
|
|
@@ -29,7 +29,7 @@ export const useIOT = Context.memo(async () => {
|
|
|
29
29
|
secretKey: creds.secretAccessKey,
|
|
30
30
|
sessionToken: creds.sessionToken,
|
|
31
31
|
});
|
|
32
|
-
const PREFIX = `/sst/${project.name}/${project.stage}`;
|
|
32
|
+
const PREFIX = `/sst/${project.config.name}/${project.config.stage}`;
|
|
33
33
|
device.subscribe(`${PREFIX}/events`);
|
|
34
34
|
const fragments = new Map();
|
|
35
35
|
device.on("error", (err) => {
|
|
@@ -37,6 +37,10 @@ export const useIOT = Context.memo(async () => {
|
|
|
37
37
|
});
|
|
38
38
|
device.on("message", (_topic, buffer) => {
|
|
39
39
|
const fragment = JSON.parse(buffer.toString());
|
|
40
|
+
if (!fragment.id) {
|
|
41
|
+
bus.publish(fragment.type, fragment.properties);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
40
44
|
let pending = fragments.get(fragment.id);
|
|
41
45
|
if (!pending) {
|
|
42
46
|
pending = new Map();
|
package/logger.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import fs from "fs/promises";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import { useProject } from "./app.js";
|
|
4
3
|
import { Context } from "./context/context.js";
|
|
5
4
|
let previous = new Date();
|
|
6
5
|
const useFile = Context.memo(async () => {
|
|
6
|
+
const { useProject } = await import("./project.js");
|
|
7
7
|
const project = useProject();
|
|
8
8
|
const filePath = path.join(project.paths.out, "debug.log");
|
|
9
9
|
const file = await fs.open(filePath, "w");
|
|
@@ -24,6 +24,8 @@ export const Logger = {
|
|
|
24
24
|
return JSON.stringify(x);
|
|
25
25
|
}),
|
|
26
26
|
];
|
|
27
|
+
if (process.env.SST_VERBOSE)
|
|
28
|
+
console.log(...line);
|
|
27
29
|
useFile().then((file) => {
|
|
28
30
|
file.write(line.join(" ") + "\n");
|
|
29
31
|
});
|
package/node/api/index.d.ts
CHANGED
|
@@ -10,13 +10,10 @@ export interface ApiGatewayV1ApiResources {
|
|
|
10
10
|
}
|
|
11
11
|
export interface WebSocketApiResources {
|
|
12
12
|
}
|
|
13
|
-
export interface GraphQLApiResources {
|
|
14
|
-
}
|
|
15
13
|
export declare const Api: ApiResources;
|
|
16
14
|
export declare const AppSyncApi: AppSyncApiResources;
|
|
17
15
|
export declare const ApiGatewayV1Api: ApiGatewayV1ApiResources;
|
|
18
16
|
export declare const WebSocketApi: WebSocketApiResources;
|
|
19
|
-
export declare const GraphQLApi: GraphQLApiResources;
|
|
20
17
|
/**
|
|
21
18
|
* Create a new api handler that can be used to create an authenticated session.
|
|
22
19
|
*
|
|
@@ -40,3 +37,5 @@ export declare function useHeader(key: string): string | undefined;
|
|
|
40
37
|
export declare function useFormValue(name: string): string | null | undefined;
|
|
41
38
|
export declare function useQueryParams(): import("aws-lambda").APIGatewayProxyEventQueryStringParameters;
|
|
42
39
|
export declare function useQueryParam(name: string): string | undefined;
|
|
40
|
+
export declare function usePathParams(): import("aws-lambda").APIGatewayProxyEventPathParameters;
|
|
41
|
+
export declare function usePathParam(name: string): string | undefined;
|
package/node/api/index.js
CHANGED
|
@@ -5,12 +5,10 @@ export const Api = createProxy("Api");
|
|
|
5
5
|
export const AppSyncApi = createProxy("AppSyncApi");
|
|
6
6
|
export const ApiGatewayV1Api = createProxy("ApiGatewayV1Api");
|
|
7
7
|
export const WebSocketApi = createProxy("WebSocketApi");
|
|
8
|
-
export const GraphQLApi = createProxy("GraphQLApi");
|
|
9
8
|
Object.assign(Api, parseEnvironment("Api", ["url"]));
|
|
10
9
|
Object.assign(AppSyncApi, parseEnvironment("AppSyncApi", ["url"]));
|
|
11
10
|
Object.assign(ApiGatewayV1Api, parseEnvironment("ApiGatewayV1Api", ["url"]));
|
|
12
11
|
Object.assign(WebSocketApi, parseEnvironment("WebSocketApi", ["url"]));
|
|
13
|
-
Object.assign(GraphQLApi, parseEnvironment("GraphQLApi", ["url"]));
|
|
14
12
|
/**
|
|
15
13
|
* Create a new api handler that can be used to create an authenticated session.
|
|
16
14
|
*
|
|
@@ -86,3 +84,11 @@ export function useQueryParams() {
|
|
|
86
84
|
export function useQueryParam(name) {
|
|
87
85
|
return useQueryParams()[name];
|
|
88
86
|
}
|
|
87
|
+
export function usePathParams() {
|
|
88
|
+
const evt = useEvent("api");
|
|
89
|
+
const path = evt.pathParameters || {};
|
|
90
|
+
return path;
|
|
91
|
+
}
|
|
92
|
+
export function usePathParam(name) {
|
|
93
|
+
return usePathParams()[name];
|
|
94
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { APIGatewayProxyStructuredResultV2 } from "aws-lambda";
|
|
2
2
|
export declare function createAdapter<A extends (config: any) => Adapter>(adapter: A): A;
|
|
3
|
-
export
|
|
3
|
+
export type Adapter = () => Promise<APIGatewayProxyStructuredResultV2>;
|
|
@@ -5,17 +5,17 @@ import { OidcAdapter } from "./oidc.js";
|
|
|
5
5
|
const issuer = new Issuer({
|
|
6
6
|
issuer: "https://github.com",
|
|
7
7
|
authorization_endpoint: "https://github.com/login/oauth/authorize",
|
|
8
|
-
token_endpoint: "https://github.com/login/oauth/access_token"
|
|
8
|
+
token_endpoint: "https://github.com/login/oauth/access_token",
|
|
9
9
|
});
|
|
10
10
|
export const GithubAdapter = /* @__PURE__ */ createAdapter((config) => {
|
|
11
|
-
if (
|
|
11
|
+
if (config.clientSecret) {
|
|
12
12
|
return OauthAdapter({
|
|
13
13
|
issuer,
|
|
14
|
-
...config
|
|
14
|
+
...config,
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
return OidcAdapter({
|
|
18
18
|
issuer,
|
|
19
|
-
...config
|
|
19
|
+
...config,
|
|
20
20
|
});
|
|
21
21
|
});
|
|
@@ -7,12 +7,12 @@ export const GoogleAdapter = /* @__PURE__ */ createAdapter((config) => {
|
|
|
7
7
|
if ("clientSecret" in config) {
|
|
8
8
|
return OauthAdapter({
|
|
9
9
|
issuer,
|
|
10
|
-
...config
|
|
10
|
+
...config,
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
return OidcAdapter({
|
|
14
14
|
issuer,
|
|
15
15
|
scope: "openid email profile",
|
|
16
|
-
...config
|
|
16
|
+
...config,
|
|
17
17
|
});
|
|
18
18
|
});
|
package/node/auth/session.d.ts
CHANGED
package/node/config/index.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ export interface SecretResources {
|
|
|
4
4
|
}
|
|
5
5
|
export interface ConfigTypes {
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export type ParameterTypes = {
|
|
8
8
|
[T in keyof ParameterResources]: string;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type SecretTypes = {
|
|
11
11
|
[T in keyof SecretResources]: string;
|
|
12
12
|
};
|
|
13
13
|
export declare const Config: ConfigTypes & ParameterTypes & SecretTypes;
|
package/node/config/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { GetParametersCommand, SSMClient } from "@aws-sdk/client-ssm";
|
|
1
|
+
import { GetParametersCommand, SSMClient, } from "@aws-sdk/client-ssm";
|
|
2
2
|
const ssm = new SSMClient({});
|
|
3
|
-
import { createProxy, parseEnvironment, buildSsmPath, buildSsmFallbackPath, ssmNameToConstructId, ssmFallbackNameToConstructId } from "../util/index.js";
|
|
4
|
-
;
|
|
5
|
-
;
|
|
6
|
-
;
|
|
3
|
+
import { createProxy, parseEnvironment, buildSsmPath, buildSsmFallbackPath, ssmNameToConstructId, ssmFallbackNameToConstructId, } from "../util/index.js";
|
|
7
4
|
export const Config = createProxy("Config");
|
|
8
5
|
const metadata = parseMetadataEnvironment();
|
|
9
6
|
const parametersRaw = parseEnvironment("Parameter", ["value"]);
|
|
@@ -39,9 +36,7 @@ function flattenConfigValues(configValues) {
|
|
|
39
36
|
}
|
|
40
37
|
async function replaceSecretsWithRealValues() {
|
|
41
38
|
// Find all the secrets and params that match the prefix
|
|
42
|
-
const names = Object
|
|
43
|
-
.keys(secrets)
|
|
44
|
-
.filter((name) => secrets[name] === "__FETCH_FROM_SSM__");
|
|
39
|
+
const names = Object.keys(secrets).filter((name) => secrets[name] === "__FETCH_FROM_SSM__");
|
|
45
40
|
if (names.length === 0) {
|
|
46
41
|
return;
|
|
47
42
|
}
|
package/node/job/index.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ export interface JobResources {
|
|
|
2
2
|
}
|
|
3
3
|
export interface JobTypes {
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export type JobRunProps<T extends keyof JobResources> = {
|
|
6
6
|
payload?: JobTypes[T];
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type JobType = {
|
|
9
9
|
[T in keyof JobResources]: ReturnType<typeof JobControl<T>>;
|
|
10
10
|
};
|
|
11
11
|
export declare const Job: JobType;
|
package/node/site/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GetParametersCommand, SSMClient } from "@aws-sdk/client-ssm";
|
|
1
|
+
import { GetParametersCommand, SSMClient, } from "@aws-sdk/client-ssm";
|
|
2
2
|
const ssm = new SSMClient({});
|
|
3
|
-
import { createProxy, parseEnvironment, buildSsmPath, ssmNameToConstructId } from "../util/index.js";
|
|
3
|
+
import { createProxy, parseEnvironment, buildSsmPath, ssmNameToConstructId, } from "../util/index.js";
|
|
4
4
|
export const StaticSite = createProxy("StaticSite");
|
|
5
5
|
export const ReactStaticSite = createProxy("ReactStaticSite");
|
|
6
6
|
export const ViteStaticSite = createProxy("ViteStaticSite");
|
|
@@ -23,9 +23,7 @@ Object.assign(NextjsSite, nextjsSiteData);
|
|
|
23
23
|
Object.assign(RemixSite, remixSiteData);
|
|
24
24
|
async function replaceWithSsmValues(className, siteData) {
|
|
25
25
|
// Find all the site data that match the prefix
|
|
26
|
-
const names = Object
|
|
27
|
-
.keys(siteData)
|
|
28
|
-
.filter((name) => siteData[name].url === "__FETCH_FROM_SSM__");
|
|
26
|
+
const names = Object.keys(siteData).filter((name) => siteData[name].url === "__FETCH_FROM_SSM__");
|
|
29
27
|
if (names.length === 0) {
|
|
30
28
|
return;
|
|
31
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sst",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"bin": {
|
|
5
5
|
"sst": "cli/sst.js"
|
|
6
6
|
},
|
|
@@ -17,20 +17,21 @@
|
|
|
17
17
|
"./constructs": "./constructs/index.js",
|
|
18
18
|
"./context": "./context/index.js",
|
|
19
19
|
"./node/*": "./node/*/index.js",
|
|
20
|
+
".": "./index.js",
|
|
20
21
|
"./*": "./*"
|
|
21
22
|
},
|
|
22
23
|
"homepage": "https://sst.dev",
|
|
23
24
|
"dependencies": {
|
|
24
|
-
"@aws-cdk/aws-apigatewayv2-alpha": "^2.
|
|
25
|
-
"@aws-cdk/aws-apigatewayv2-authorizers-alpha": "^2.
|
|
26
|
-
"@aws-cdk/aws-apigatewayv2-integrations-alpha": "^2.
|
|
27
|
-
"@aws-cdk/
|
|
28
|
-
"@aws-cdk/
|
|
29
|
-
"@aws-cdk/
|
|
30
|
-
"@aws-cdk/
|
|
31
|
-
"@aws-cdk/region-info": "2.55.0",
|
|
25
|
+
"@aws-cdk/aws-apigatewayv2-alpha": "^2.62.2-alpha.0",
|
|
26
|
+
"@aws-cdk/aws-apigatewayv2-authorizers-alpha": "^2.62.2-alpha.0",
|
|
27
|
+
"@aws-cdk/aws-apigatewayv2-integrations-alpha": "^2.62.2-alpha.0",
|
|
28
|
+
"@aws-cdk/cloud-assembly-schema": "2.62.2",
|
|
29
|
+
"@aws-cdk/cloudformation-diff": "2.62.2",
|
|
30
|
+
"@aws-cdk/cx-api": "2.62.2",
|
|
31
|
+
"@aws-cdk/region-info": "2.62.2",
|
|
32
32
|
"@aws-sdk/client-cloudformation": "3.208.0",
|
|
33
33
|
"@aws-sdk/client-iot": "3.208.0",
|
|
34
|
+
"@aws-sdk/client-iot-data-plane": "3.208.0",
|
|
34
35
|
"@aws-sdk/client-lambda": "3.208.0",
|
|
35
36
|
"@aws-sdk/client-rds-data": "3.208.0",
|
|
36
37
|
"@aws-sdk/client-s3": "3.208.0",
|
|
@@ -45,13 +46,15 @@
|
|
|
45
46
|
"@babel/core": "^7.0.0-0",
|
|
46
47
|
"@babel/generator": "^7.20.5",
|
|
47
48
|
"@trpc/server": "9.16.0",
|
|
49
|
+
"adm-zip": "^0.5.10",
|
|
48
50
|
"archiver": "^5.3.1",
|
|
49
|
-
"aws-cdk": "2.
|
|
50
|
-
"aws-cdk-lib": "2.
|
|
51
|
+
"aws-cdk": "2.62.2",
|
|
52
|
+
"aws-cdk-lib": "2.62.2",
|
|
51
53
|
"aws-iot-device-sdk": "^2.2.12",
|
|
52
54
|
"aws-sdk": "2.1252.0",
|
|
53
55
|
"builtin-modules": "3.2.0",
|
|
54
|
-
"cdk-assets": "2.
|
|
56
|
+
"cdk-assets": "2.62.2",
|
|
57
|
+
"chalk": "^4.1.2",
|
|
55
58
|
"chokidar": "^3.5.3",
|
|
56
59
|
"ci-info": "^3.7.0",
|
|
57
60
|
"colorette": "^2.0.19",
|
|
@@ -63,14 +66,17 @@
|
|
|
63
66
|
"esbuild": "0.16.13",
|
|
64
67
|
"express": "^4.18.2",
|
|
65
68
|
"fast-jwt": "^1.6.1",
|
|
69
|
+
"get-port": "^6.1.2",
|
|
66
70
|
"glob": "^8.0.3",
|
|
71
|
+
"graphql": "*",
|
|
67
72
|
"graphql-helix": "^1.12.0",
|
|
68
73
|
"immer": "9",
|
|
69
74
|
"ink": "^3.2.0",
|
|
70
75
|
"ink-spinner": "^4.0.3",
|
|
71
|
-
"kysely": "^0.
|
|
72
|
-
"kysely-codegen": "^0.
|
|
76
|
+
"kysely": "^0.23.3",
|
|
77
|
+
"kysely-codegen": "^0.9.0",
|
|
73
78
|
"kysely-data-api": "^0.1.4",
|
|
79
|
+
"minimatch": "^6.1.6",
|
|
74
80
|
"openid-client": "^5.1.8",
|
|
75
81
|
"ora": "^6.1.2",
|
|
76
82
|
"promptly": "^3.2.0",
|
|
@@ -84,9 +90,12 @@
|
|
|
84
90
|
"zip-local": "^0.3.5"
|
|
85
91
|
},
|
|
86
92
|
"devDependencies": {
|
|
93
|
+
"@aws-sdk/client-codebuild": "^3.257.0",
|
|
87
94
|
"@aws-sdk/types": "^3.208.0",
|
|
95
|
+
"@graphql-tools/merge": "^8.3.16",
|
|
88
96
|
"@sls-next/lambda-at-edge": "^3.7.0",
|
|
89
97
|
"@tsconfig/node16": "^1.0.3",
|
|
98
|
+
"@types/adm-zip": "^0.5.0",
|
|
90
99
|
"@types/aws-iot-device-sdk": "^2.2.4",
|
|
91
100
|
"@types/aws-lambda": "^8.10.108",
|
|
92
101
|
"@types/babel__core": "^7.1.20",
|
|
@@ -99,20 +108,15 @@
|
|
|
99
108
|
"@types/uuid": "^8.3.4",
|
|
100
109
|
"@types/ws": "^8.5.3",
|
|
101
110
|
"@types/yargs": "^17.0.13",
|
|
102
|
-
"graphql": "^16.5.0",
|
|
103
111
|
"tsx": "^3.12.1",
|
|
104
|
-
"vitest": "^0.
|
|
112
|
+
"vitest": "^0.28.3"
|
|
105
113
|
},
|
|
106
114
|
"peerDependencies": {
|
|
107
|
-
"@sls-next/lambda-at-edge": "^3.7.0"
|
|
108
|
-
"graphql": "^16.5.0"
|
|
115
|
+
"@sls-next/lambda-at-edge": "^3.7.0"
|
|
109
116
|
},
|
|
110
117
|
"peerDependenciesMeta": {
|
|
111
118
|
"@sls-next/lambda-at-edge": {
|
|
112
119
|
"optional": true
|
|
113
|
-
},
|
|
114
|
-
"graphql": {
|
|
115
|
-
"optional": true
|
|
116
120
|
}
|
|
117
121
|
},
|
|
118
122
|
"bugs": {
|
|
@@ -126,6 +130,7 @@
|
|
|
126
130
|
"author": "",
|
|
127
131
|
"scripts": {
|
|
128
132
|
"build": "node build.mjs && tsc",
|
|
133
|
+
"test": "vitest run",
|
|
129
134
|
"dev": "tsc -w"
|
|
130
135
|
}
|
|
131
136
|
}
|
package/pothos.js
CHANGED
|
@@ -77,6 +77,7 @@ export async function extractSchema(opts) {
|
|
|
77
77
|
if (!types.isMemberExpression(callPath.node.callee) ||
|
|
78
78
|
!types.isIdentifier(callPath.node.callee.object) ||
|
|
79
79
|
!types.isIdentifier(callPath.node.callee.property) ||
|
|
80
|
+
!schemaBuilder ||
|
|
80
81
|
(callPath.node.callee.object.name !==
|
|
81
82
|
schemaBuilder.node.id.name &&
|
|
82
83
|
callPath.node.callee.property.name !== "implement")) {
|
package/project.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Metafile } from "esbuild";
|
|
2
|
+
import type { App } from "./constructs/App.js";
|
|
3
|
+
export interface SSTConfig {
|
|
4
|
+
config: (globals: GlobalOptions) => Promise<ConfigOptions> | ConfigOptions;
|
|
5
|
+
stacks: (app: App) => Promise<void> | void;
|
|
6
|
+
}
|
|
7
|
+
export interface ConfigOptions {
|
|
8
|
+
name: string;
|
|
9
|
+
region?: string;
|
|
10
|
+
stage?: string;
|
|
11
|
+
profile?: string;
|
|
12
|
+
role?: string;
|
|
13
|
+
ssmPrefix?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const DEFAULTS: {
|
|
16
|
+
readonly stage: undefined;
|
|
17
|
+
readonly ssmPrefix: undefined;
|
|
18
|
+
};
|
|
19
|
+
interface Project {
|
|
20
|
+
config: ConfigOptions & Required<{
|
|
21
|
+
[key in keyof typeof DEFAULTS]: Exclude<ConfigOptions[key], undefined>;
|
|
22
|
+
}>;
|
|
23
|
+
version: string;
|
|
24
|
+
cdkVersion: string;
|
|
25
|
+
paths: {
|
|
26
|
+
root: string;
|
|
27
|
+
config: string;
|
|
28
|
+
out: string;
|
|
29
|
+
artifacts: string;
|
|
30
|
+
};
|
|
31
|
+
metafile: Metafile;
|
|
32
|
+
stacks: SSTConfig["stacks"];
|
|
33
|
+
}
|
|
34
|
+
export declare const ProjectContext: {
|
|
35
|
+
use(): Project;
|
|
36
|
+
provide(value: Project): void;
|
|
37
|
+
};
|
|
38
|
+
export declare function useProject(): Project;
|
|
39
|
+
interface GlobalOptions {
|
|
40
|
+
profile?: string;
|
|
41
|
+
role?: string;
|
|
42
|
+
stage?: string;
|
|
43
|
+
root?: string;
|
|
44
|
+
region?: string;
|
|
45
|
+
}
|
|
46
|
+
export declare function initProject(globals: GlobalOptions): Promise<void>;
|
|
47
|
+
export {};
|