sst 2.0.0-rc.16 → 2.0.0-rc.19

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.
Files changed (46) hide show
  1. package/bus.d.ts +3 -3
  2. package/cdk/deploy-stack.d.ts +2 -2
  3. package/cli/commands/deploy.js +5 -1
  4. package/cli/local/router.d.ts +5 -5
  5. package/cli/local/server.d.ts +1 -1
  6. package/cli/local/server.js +4 -9
  7. package/cli/program.d.ts +1 -1
  8. package/cli/telemetry/environment.d.ts +1 -1
  9. package/constructs/Api.d.ts +3 -3
  10. package/constructs/ApiGatewayV1Api.d.ts +2 -2
  11. package/constructs/App.d.ts +2 -2
  12. package/constructs/AppSyncApi.d.ts +1 -1
  13. package/constructs/Function.d.ts +4 -4
  14. package/constructs/FunctionalStack.d.ts +2 -2
  15. package/constructs/Job.d.ts +1 -1
  16. package/constructs/Metadata.d.ts +19 -19
  17. package/constructs/NextjsSite.d.ts +1 -1
  18. package/constructs/RDS.d.ts +1 -1
  19. package/constructs/ReactStaticSite.d.ts +2 -2
  20. package/constructs/ReactStaticSite.js +2 -1
  21. package/constructs/SsrSite.d.ts +7 -4
  22. package/constructs/SsrSite.js +6 -6
  23. package/constructs/Stack.d.ts +1 -1
  24. package/constructs/StaticSite.d.ts +3 -3
  25. package/constructs/StaticSite.js +7 -7
  26. package/constructs/Table.d.ts +1 -1
  27. package/constructs/ViteStaticSite.d.ts +1 -1
  28. package/constructs/ViteStaticSite.js +2 -1
  29. package/constructs/deferred_task.d.ts +1 -1
  30. package/constructs/util/apiGatewayV1AccessLog.d.ts +1 -1
  31. package/constructs/util/duration.d.ts +1 -1
  32. package/constructs/util/permission.d.ts +3 -3
  33. package/constructs/util/size.d.ts +1 -1
  34. package/context/handler.d.ts +1 -1
  35. package/credentials.d.ts +1 -1
  36. package/node/auth/adapter/adapter.d.ts +1 -1
  37. package/node/auth/adapter/github.js +4 -4
  38. package/node/auth/adapter/google.d.ts +1 -1
  39. package/node/auth/session.d.ts +1 -1
  40. package/node/config/index.d.ts +2 -2
  41. package/node/job/index.d.ts +2 -2
  42. package/package.json +3 -7
  43. package/runtime/handlers/node.js +4 -1
  44. package/sst.mjs +264 -16067
  45. package/stacks/monitor.d.ts +1 -1
  46. package/support/nodejs-runtime/index.mjs +74 -72
package/bus.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  export interface Events {
2
2
  }
3
- export declare type EventTypes = keyof Events;
4
- export declare type EventPayload<Type extends EventTypes = EventTypes> = {
3
+ export type EventTypes = keyof Events;
4
+ export type EventPayload<Type extends EventTypes = EventTypes> = {
5
5
  type: Type;
6
6
  sourceID: string;
7
7
  properties: Events[Type];
8
8
  };
9
- declare type Subscription = {
9
+ type Subscription = {
10
10
  type: EventTypes;
11
11
  cb: (payload: any) => void;
12
12
  };
@@ -4,7 +4,7 @@ import { ISDK, SdkProvider } from "aws-cdk/lib/api/aws-auth/index.js";
4
4
  import { ToolkitInfo } from "aws-cdk/lib/api/toolkit-info.js";
5
5
  import { ResourcesToImport } from "aws-cdk/lib/api/util/cloudformation.js";
6
6
  import { StackActivityProgress } from "aws-cdk/lib/api/util/cloudformation/stack-activity-monitor.js";
7
- declare type TemplateBodyParameter = {
7
+ type TemplateBodyParameter = {
8
8
  TemplateBody?: string;
9
9
  TemplateURL?: string;
10
10
  };
@@ -166,7 +166,7 @@ export interface DeployStackOptions {
166
166
  */
167
167
  readonly assetParallelism?: boolean;
168
168
  }
169
- export declare type DeploymentMethod = DirectDeploymentMethod | ChangeSetDeploymentMethod;
169
+ export type DeploymentMethod = DirectDeploymentMethod | ChangeSetDeploymentMethod;
170
170
  export interface DirectDeploymentMethod {
171
171
  readonly method: "direct";
172
172
  }
@@ -1,4 +1,5 @@
1
1
  import { printDeploymentResults } from "../ui/deploy.js";
2
+ import { createSpinner } from "../spinner.js";
2
3
  export const deploy = (program) => program.command("deploy [filter]", "Work on your SST app locally", (yargs) => yargs
3
4
  .option("from", { type: "string" })
4
5
  .option("fullscreen", {
@@ -20,10 +21,13 @@ export const deploy = (program) => program.command("deploy [filter]", "Work on y
20
21
  const result = new CloudAssembly(args.from);
21
22
  return result;
22
23
  }
23
- return await Stacks.synth({
24
+ const spinner = createSpinner("Building stacks");
25
+ const result = await Stacks.synth({
24
26
  fn: project.stacks,
25
27
  mode: "deploy",
26
28
  });
29
+ spinner.succeed();
30
+ return result;
27
31
  })();
28
32
  const target = assembly.stacks.filter((s) => !args.filter ||
29
33
  s.stackName.toLowerCase().includes(args.filter.toLowerCase()));
@@ -1,6 +1,6 @@
1
1
  import * as trpc from "@trpc/server";
2
2
  import { DendriformPatch } from "dendriform-immer-patch-optimiser";
3
- export declare type State = {
3
+ export type State = {
4
4
  app: string;
5
5
  stage: string;
6
6
  functions: Record<string, FunctionState>;
@@ -9,13 +9,13 @@ export declare type State = {
9
9
  status: any;
10
10
  };
11
11
  };
12
- export declare type FunctionState = {
12
+ export type FunctionState = {
13
13
  state: "idle" | "building" | "checking";
14
14
  invocations: Invocation[];
15
15
  issues: Record<string, any[]>;
16
16
  warm: boolean;
17
17
  };
18
- export declare type Invocation = {
18
+ export type Invocation = {
19
19
  id: string;
20
20
  request: any;
21
21
  response?: any;
@@ -28,7 +28,7 @@ export declare type Invocation = {
28
28
  timestamp: number;
29
29
  }[];
30
30
  };
31
- export declare type Context = {
31
+ export type Context = {
32
32
  state: State;
33
33
  };
34
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, {
@@ -39,4 +39,4 @@ export declare const router: import("@trpc/server/dist/declarations/src/router.j
39
39
  sessionToken: string | undefined;
40
40
  };
41
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;
42
+ export type Router = typeof router;
@@ -1,7 +1,7 @@
1
1
  import { FunctionState, State } from "./router.js";
2
2
  import { WritableDraft } from "immer/dist/internal.js";
3
3
  import { DendriformPatch } from "dendriform-immer-patch-optimiser";
4
- declare type Opts = {
4
+ type Opts = {
5
5
  port: number;
6
6
  key: any;
7
7
  cert: any;
@@ -23,17 +23,12 @@ export async function useLocalServer(opts) {
23
23
  functions: {},
24
24
  };
25
25
  const rest = express();
26
- /*
27
26
  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);
27
+ res.header("Access-Control-Allow-Origin", "*");
28
+ res.header("Access-Control-Allow-Methods", "GET, PUT, PATCH, POST, DELETE");
29
+ res.header("Access-Control-Allow-Headers", req.header("access-control-request-headers"));
30
+ res.sendStatus(200);
35
31
  });
36
- */
37
32
  rest.all(`/proxy*`, express.raw({
38
33
  type: "*/*",
39
34
  limit: "1024mb",
package/cli/program.d.ts CHANGED
@@ -6,4 +6,4 @@ export declare const program: import("yargs").Argv<{
6
6
  } & {
7
7
  region: string | undefined;
8
8
  }>;
9
- export declare type Program = typeof program;
9
+ export type Program = typeof program;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
- declare type EnvironmentData = {
2
+ type EnvironmentData = {
3
3
  systemPlatform: NodeJS.Platform;
4
4
  systemRelease: string;
5
5
  systemArchitecture: string;
@@ -14,8 +14,8 @@ import * as apigV2Cors from "./util/apiGatewayV2Cors.js";
14
14
  import * as apigV2Domain from "./util/apiGatewayV2Domain.js";
15
15
  import * as apigV2AccessLog from "./util/apiGatewayV2AccessLog.js";
16
16
  declare const PayloadFormatVersions: readonly ["1.0", "2.0"];
17
- export declare type ApiPayloadFormatVersion = typeof PayloadFormatVersions[number];
18
- export declare type ApiAuthorizer = ApiUserPoolAuthorizer | ApiJwtAuthorizer | ApiLambdaAuthorizer;
17
+ export type ApiPayloadFormatVersion = typeof PayloadFormatVersions[number];
18
+ export type ApiAuthorizer = ApiUserPoolAuthorizer | ApiJwtAuthorizer | ApiLambdaAuthorizer;
19
19
  interface ApiBaseAuthorizer {
20
20
  /**
21
21
  * The name of the authorizer.
@@ -393,7 +393,7 @@ export interface ApiProps<Authorizers extends Record<string, ApiAuthorizer> = Re
393
393
  httpStages?: Omit<apig.HttpStageProps, "httpApi">[];
394
394
  };
395
395
  }
396
- export declare type ApiRouteProps<AuthorizerKeys> = FunctionInlineDefinition | ApiFunctionRouteProps<AuthorizerKeys> | ApiHttpRouteProps<AuthorizerKeys> | ApiAlbRouteProps<AuthorizerKeys> | ApiGraphQLRouteProps<AuthorizerKeys> | ApiPothosRouteProps<AuthorizerKeys>;
396
+ export type ApiRouteProps<AuthorizerKeys> = FunctionInlineDefinition | ApiFunctionRouteProps<AuthorizerKeys> | ApiHttpRouteProps<AuthorizerKeys> | ApiAlbRouteProps<AuthorizerKeys> | ApiGraphQLRouteProps<AuthorizerKeys> | ApiPothosRouteProps<AuthorizerKeys>;
397
397
  interface ApiBaseRouteProps<AuthorizerKeys = string> {
398
398
  authorizer?: "none" | "iam" | (string extends AuthorizerKeys ? Omit<AuthorizerKeys, "none" | "iam"> : AuthorizerKeys);
399
399
  authorizationScopes?: string[];
@@ -203,7 +203,7 @@ export interface ApiGatewayV1ApiProps<Authorizers extends Record<string, ApiGate
203
203
  };
204
204
  };
205
205
  }
206
- export declare type ApiGatewayV1ApiRouteProps<AuthorizerKeys> = FunctionInlineDefinition | ApiGatewayV1ApiFunctionRouteProps<AuthorizerKeys>;
206
+ export type ApiGatewayV1ApiRouteProps<AuthorizerKeys> = FunctionInlineDefinition | ApiGatewayV1ApiFunctionRouteProps<AuthorizerKeys>;
207
207
  /**
208
208
  * Specify a function route handler and configure additional options
209
209
  *
@@ -230,7 +230,7 @@ export interface ApiGatewayV1ApiFunctionRouteProps<AuthorizerKeys = never> {
230
230
  function?: lambda.IFunction;
231
231
  };
232
232
  }
233
- export declare type ApiGatewayV1ApiAuthorizer = ApiGatewayV1ApiUserPoolsAuthorizer | ApiGatewayV1ApiLambdaTokenAuthorizer | ApiGatewayV1ApiLambdaRequestAuthorizer;
233
+ export type ApiGatewayV1ApiAuthorizer = ApiGatewayV1ApiUserPoolsAuthorizer | ApiGatewayV1ApiLambdaTokenAuthorizer | ApiGatewayV1ApiLambdaRequestAuthorizer;
234
234
  interface ApiGatewayV1ApiBaseAuthorizer {
235
235
  /**
236
236
  * The name of the authorizer.
@@ -42,8 +42,8 @@ export interface AppDeployProps {
42
42
  readonly mode: "deploy" | "dev" | "remove";
43
43
  readonly bootstrap: Awaited<ReturnType<typeof useBootstrap>>;
44
44
  }
45
- declare type AppRemovalPolicy = Lowercase<keyof typeof cdk.RemovalPolicy>;
46
- export declare type AppProps = cdk.AppProps;
45
+ type AppRemovalPolicy = Lowercase<keyof typeof cdk.RemovalPolicy>;
46
+ export type AppProps = cdk.AppProps;
47
47
  /**
48
48
  * The App construct extends cdk.App and is used internally by SST.
49
49
  */
@@ -178,7 +178,7 @@ export interface MappingTemplateInline {
178
178
  */
179
179
  inline: string;
180
180
  }
181
- export declare type MappingTemplate = MappingTemplateFile | MappingTemplateInline;
181
+ export type MappingTemplate = MappingTemplateFile | MappingTemplateInline;
182
182
  /**
183
183
  * Used to define full resolver config
184
184
  */
@@ -34,9 +34,9 @@ declare const supportedRuntimes: {
34
34
  java11: cdk.aws_lambda.Runtime;
35
35
  "go1.x": cdk.aws_lambda.Runtime;
36
36
  };
37
- export declare type Runtime = keyof typeof supportedRuntimes;
38
- export declare type FunctionInlineDefinition = string | Function;
39
- export declare type FunctionDefinition = string | Function | FunctionProps;
37
+ export type Runtime = keyof typeof supportedRuntimes;
38
+ export type FunctionInlineDefinition = string | Function;
39
+ export type FunctionDefinition = string | Function | FunctionProps;
40
40
  export interface FunctionUrlCorsProps extends functionUrlCors.CorsProps {
41
41
  }
42
42
  export interface FunctionHooks {
@@ -505,7 +505,7 @@ export interface JavaProps {
505
505
  */
506
506
  experimentalUseProvidedRuntime?: "provided" | "provided.al2";
507
507
  }
508
- export declare type FunctionBundleProp = FunctionBundlePythonProps | boolean;
508
+ export type FunctionBundleProp = FunctionBundlePythonProps | boolean;
509
509
  interface FunctionBundleBase {
510
510
  }
511
511
  /**
@@ -6,8 +6,8 @@ export declare function stack(app: App, fn: FunctionalStack<any>, props?: StackP
6
6
  export declare function use<T>(stack: FunctionalStack<T>): T;
7
7
  export declare function dependsOn(stack: FunctionalStack<any>): void;
8
8
  export declare function getStack(stack: FunctionalStack<any>): Stack;
9
- export declare type StackContext = {
9
+ export type StackContext = {
10
10
  app: App;
11
11
  stack: Stack;
12
12
  };
13
- export declare type FunctionalStack<T> = (this: Stack, ctx: StackContext) => T | Promise<T>;
13
+ export type FunctionalStack<T> = (this: Stack, ctx: StackContext) => T | Promise<T>;
@@ -5,7 +5,7 @@ import { Function } from "./Function.js";
5
5
  import { Duration } from "./util/duration.js";
6
6
  import { Permissions } from "./util/permission.js";
7
7
  import { IVpc } from "aws-cdk-lib/aws-ec2";
8
- export declare type JobMemorySize = "3 GB" | "7 GB" | "15 GB" | "145 GB";
8
+ export type JobMemorySize = "3 GB" | "7 GB" | "15 GB" | "145 GB";
9
9
  export interface JobProps {
10
10
  /**
11
11
  * Path to the entry point and handler function. Of the format:
@@ -1,42 +1,42 @@
1
1
  import { SSTConstruct } from "./Construct.js";
2
- declare type ExtractMetadata<T extends SSTConstruct> = ReturnType<T["getConstructMetadata"]> & {
2
+ type ExtractMetadata<T extends SSTConstruct> = ReturnType<T["getConstructMetadata"]> & {
3
3
  id: string;
4
4
  addr: string;
5
5
  stack: string;
6
6
  };
7
7
  import type { Api } from "./Api.js";
8
- export declare type ApiMetadata = ExtractMetadata<Api<any>>;
8
+ export type ApiMetadata = ExtractMetadata<Api<any>>;
9
9
  import { GraphQLApi } from "./GraphQLApi.js";
10
- export declare type GraphQLApiMetadata = ExtractMetadata<GraphQLApi>;
10
+ export type GraphQLApiMetadata = ExtractMetadata<GraphQLApi>;
11
11
  import type { ApiGatewayV1Api } from "./ApiGatewayV1Api.js";
12
- export declare type ApiGatewayV1ApiMetadata = ExtractMetadata<ApiGatewayV1Api<any>>;
12
+ export type ApiGatewayV1ApiMetadata = ExtractMetadata<ApiGatewayV1Api<any>>;
13
13
  import type { Cognito } from "./Cognito.js";
14
- export declare type AuthMetadata = ExtractMetadata<Cognito>;
14
+ export type AuthMetadata = ExtractMetadata<Cognito>;
15
15
  import type { AppSyncApi } from "./AppSyncApi.js";
16
- export declare type AppSyncApiMetadata = ExtractMetadata<AppSyncApi>;
16
+ export type AppSyncApiMetadata = ExtractMetadata<AppSyncApi>;
17
17
  import type { Bucket } from "./Bucket.js";
18
- export declare type BucketMetadata = ExtractMetadata<Bucket>;
18
+ export type BucketMetadata = ExtractMetadata<Bucket>;
19
19
  import type { Cron } from "./Cron.js";
20
- export declare type CronMetadata = ExtractMetadata<Cron>;
20
+ export type CronMetadata = ExtractMetadata<Cron>;
21
21
  import type { EventBus } from "./EventBus.js";
22
- export declare type EventBusMetadata = ExtractMetadata<EventBus>;
22
+ export type EventBusMetadata = ExtractMetadata<EventBus>;
23
23
  import type { Function as Fn } from "./Function.js";
24
- export declare type FunctionMetadata = ExtractMetadata<Fn>;
24
+ export type FunctionMetadata = ExtractMetadata<Fn>;
25
25
  import type { KinesisStream } from "./KinesisStream.js";
26
- export declare type KinesisStreamMetadata = ExtractMetadata<KinesisStream>;
26
+ export type KinesisStreamMetadata = ExtractMetadata<KinesisStream>;
27
27
  import type { NextjsSite } from "./NextjsSite.js";
28
- export declare type NextjsMetadata = ExtractMetadata<NextjsSite>;
28
+ export type NextjsMetadata = ExtractMetadata<NextjsSite>;
29
29
  import type { Queue } from "./Queue.js";
30
- export declare type QueueMetadata = ExtractMetadata<Queue>;
30
+ export type QueueMetadata = ExtractMetadata<Queue>;
31
31
  import type { StaticSite } from "./StaticSite.js";
32
- export declare type StaticSiteMetadata = ExtractMetadata<StaticSite>;
32
+ export type StaticSiteMetadata = ExtractMetadata<StaticSite>;
33
33
  import type { Table } from "./Table.js";
34
- export declare type TableMetadata = ExtractMetadata<Table>;
34
+ export type TableMetadata = ExtractMetadata<Table>;
35
35
  import type { Topic } from "./Topic.js";
36
- export declare type TopicMetadata = ExtractMetadata<Topic>;
36
+ export type TopicMetadata = ExtractMetadata<Topic>;
37
37
  import type { WebSocketApi } from "./WebSocketApi.js";
38
- export declare type WebSocketApiMetadata = ExtractMetadata<WebSocketApi>;
38
+ export type WebSocketApiMetadata = ExtractMetadata<WebSocketApi>;
39
39
  import type { RDS } from "./RDS.js";
40
- export declare type RDSMetadata = ExtractMetadata<RDS>;
41
- export declare type Metadata = ApiMetadata | ApiGatewayV1ApiMetadata | AuthMetadata | AppSyncApiMetadata | BucketMetadata | CronMetadata | EventBusMetadata | FunctionMetadata | KinesisStreamMetadata | NextjsMetadata | QueueMetadata | StaticSiteMetadata | TableMetadata | TopicMetadata | WebSocketApiMetadata | GraphQLApiMetadata | RDSMetadata;
40
+ export type RDSMetadata = ExtractMetadata<RDS>;
41
+ export type Metadata = ApiMetadata | ApiGatewayV1ApiMetadata | AuthMetadata | AppSyncApiMetadata | BucketMetadata | CronMetadata | EventBusMetadata | FunctionMetadata | KinesisStreamMetadata | NextjsMetadata | QueueMetadata | StaticSiteMetadata | TableMetadata | TopicMetadata | WebSocketApiMetadata | GraphQLApiMetadata | RDSMetadata;
42
42
  export {};
@@ -16,7 +16,7 @@ export interface NextjsSiteProps extends Omit<SsrSiteProps, "edge"> {
16
16
  * ```
17
17
  */
18
18
  export declare class NextjsSite extends SsrSite {
19
- constructor(scope: Construct, id: string, props: NextjsSiteProps);
19
+ constructor(scope: Construct, id: string, props?: NextjsSiteProps);
20
20
  protected initBuildConfig(): {
21
21
  serverBuildOutputFile: string;
22
22
  clientBuildOutputDir: string;
@@ -134,7 +134,7 @@ export interface RDSProps {
134
134
  secret?: secretsManager.ISecret;
135
135
  };
136
136
  }
137
- export declare type RDSEngineType = RDSProps["engine"];
137
+ export type RDSEngineType = RDSProps["engine"];
138
138
  export interface RDSCdkServerlessClusterProps extends Omit<rds.ServerlessClusterProps, "vpc" | "engine" | "defaultDatabaseName" | "scaling"> {
139
139
  vpc?: ec2.IVpc;
140
140
  }
@@ -1,7 +1,7 @@
1
1
  import { Construct } from "constructs";
2
2
  import { StaticSite, StaticSiteProps } from "./StaticSite.js";
3
3
  import { SSTConstruct } from "./Construct.js";
4
- export declare type ReactStaticSiteProps = StaticSiteProps;
4
+ export type ReactStaticSiteProps = StaticSiteProps;
5
5
  /**
6
6
  * The `ReactStaticSite` construct is a higher level CDK construct that makes it easy to create a React single page app.
7
7
  *
@@ -16,5 +16,5 @@ export declare type ReactStaticSiteProps = StaticSiteProps;
16
16
  * ```
17
17
  */
18
18
  export declare class ReactStaticSite extends StaticSite implements SSTConstruct {
19
- constructor(scope: Construct, id: string, props: ReactStaticSiteProps);
19
+ constructor(scope: Construct, id: string, props?: ReactStaticSiteProps);
20
20
  }
@@ -19,7 +19,8 @@ import { StaticSite } from "./StaticSite.js";
19
19
  */
20
20
  export class ReactStaticSite extends StaticSite {
21
21
  constructor(scope, id, props) {
22
- const { path: sitePath, environment } = props || {};
22
+ const { path: pathRaw, environment } = props || {};
23
+ const sitePath = pathRaw || ".";
23
24
  // Validate environment
24
25
  Object.keys(environment || {}).forEach((key) => {
25
26
  if (!key.startsWith("REACT_APP_")) {
@@ -10,7 +10,7 @@ import { EdgeFunction } from "./EdgeFunction.js";
10
10
  import { BaseSiteDomainProps, BaseSiteCdkDistributionProps } from "./BaseSite.js";
11
11
  import { Permissions } from "./util/permission.js";
12
12
  import { FunctionBindingProps } from "./util/functionBinding.js";
13
- export declare type SsrBuildConfig = {
13
+ export type SsrBuildConfig = {
14
14
  serverBuildOutputFile: string;
15
15
  clientBuildOutputDir: string;
16
16
  clientBuildVersionedSubDir: string;
@@ -28,8 +28,9 @@ export interface SsrSiteProps {
28
28
  edge?: boolean;
29
29
  /**
30
30
  * Path to the directory where the app is located.
31
+ * @default "."
31
32
  */
32
- path: string;
33
+ path?: string;
33
34
  /**
34
35
  * The command for building the website
35
36
  * @default `npm run build`
@@ -161,7 +162,9 @@ export declare class SsrSite extends Construct implements SSTConstruct {
161
162
  */
162
163
  certificate?: acm.ICertificate;
163
164
  };
164
- protected props: SsrSiteProps;
165
+ protected props: Omit<SsrSiteProps, "path"> & {
166
+ path: string;
167
+ };
165
168
  /**
166
169
  * Determines if a placeholder site should be deployed instead. We will set
167
170
  * this to `true` by default when performing local development, although the
@@ -176,7 +179,7 @@ export declare class SsrSite extends Construct implements SSTConstruct {
176
179
  private serverLambdaForEdge?;
177
180
  protected serverLambdaForRegional?: lambda.Function;
178
181
  private awsCliLayer;
179
- constructor(scope: Construct, id: string, props: SsrSiteProps);
182
+ constructor(scope: Construct, id: string, props?: SsrSiteProps);
180
183
  /**
181
184
  * The CloudFront URL of the website.
182
185
  */
@@ -60,13 +60,13 @@ export class SsrSite extends Construct {
60
60
  serverLambdaForRegional;
61
61
  awsCliLayer;
62
62
  constructor(scope, id, props) {
63
- super(scope, props.cdk?.id || id);
64
- this.id = id;
63
+ super(scope, props?.cdk?.id || id);
65
64
  const app = scope.node.root;
65
+ this.id = id;
66
+ this.props = { path: ".", ...props };
66
67
  this.isPlaceholder =
67
- (app.local || app.skipBuild) && !props.disablePlaceholder;
68
+ (app.local || app.skipBuild) && !this.props.disablePlaceholder;
68
69
  this.sstBuildDir = useProject().paths.artifacts;
69
- this.props = props;
70
70
  this.cdk = {};
71
71
  this.awsCliLayer = new AwsCliLayer(this, "AwsCliLayer");
72
72
  this.validateSiteExists();
@@ -79,7 +79,7 @@ export class SsrSite extends Construct {
79
79
  // Create Bucket which will be utilised to contain the statics
80
80
  this.cdk.bucket = this.createS3Bucket();
81
81
  // Create Server functions
82
- if (props.edge) {
82
+ if (this.props.edge) {
83
83
  this.serverLambdaForEdge = this.createFunctionForEdge();
84
84
  this.createFunctionPermissionsForEdge();
85
85
  }
@@ -99,7 +99,7 @@ export class SsrSite extends Construct {
99
99
  const s3deployCR = this.createS3Deployment(assets);
100
100
  // Create CloudFront
101
101
  this.validateCloudFrontDistributionSettings();
102
- if (props.edge) {
102
+ if (this.props.edge) {
103
103
  this.cdk.distribution = this.isPlaceholder
104
104
  ? this.createCloudFrontDistributionForStub()
105
105
  : this.createCloudFrontDistributionForEdge();
@@ -5,7 +5,7 @@ import { FunctionProps, Function as Fn } from "./Function.js";
5
5
  import * as Config from "./Config.js";
6
6
  import { SSTConstruct } from "./Construct.js";
7
7
  import { Permissions } from "./util/permission.js";
8
- export declare type StackProps = cdk.StackProps;
8
+ export type StackProps = cdk.StackProps;
9
9
  /**
10
10
  * The Stack construct extends cdk.Stack. It automatically prefixes the stack names with the stage and app name to ensure that they can be deployed to multiple regions in the same AWS account. It also ensure that the stack uses the same AWS profile and region as the app. They're defined using functions that return resources that can be imported by other stacks.
11
11
  *
@@ -14,7 +14,7 @@ export interface StaticSiteFileOptions {
14
14
  export interface StaticSiteProps {
15
15
  /**
16
16
  * Path to the directory where the website source is located.
17
- *
17
+ * @default "."
18
18
  * @example
19
19
  * ```js
20
20
  * new StaticSite(stack, "Site", {
@@ -22,7 +22,7 @@ export interface StaticSiteProps {
22
22
  * });
23
23
  * ```
24
24
  */
25
- path: string;
25
+ path?: string;
26
26
  /**
27
27
  * The name of the index page (e.g. "index.html") of the website.
28
28
  * @default "index.html"
@@ -300,7 +300,7 @@ export declare class StaticSite extends Construct implements SSTConstruct {
300
300
  private assets;
301
301
  private filenamesAsset?;
302
302
  private awsCliLayer;
303
- constructor(scope: Construct, id: string, props: StaticSiteProps);
303
+ constructor(scope: Construct, id: string, props?: StaticSiteProps);
304
304
  /**
305
305
  * The CloudFront URL of the website.
306
306
  */
@@ -51,19 +51,19 @@ export class StaticSite extends Construct {
51
51
  filenamesAsset;
52
52
  awsCliLayer;
53
53
  constructor(scope, id, props) {
54
- super(scope, props.cdk?.id || id);
54
+ super(scope, props?.cdk?.id || id);
55
+ const app = scope.node.root;
55
56
  this.id = id;
56
- const root = scope.node.root;
57
+ this.props = { path: ".", ...props };
58
+ this.cdk = {};
57
59
  // Local development or skip build => stub asset
58
60
  this.isPlaceholder =
59
- (root.local || root.skipBuild) && !props.disablePlaceholder;
60
- const fileSizeLimit = root.isRunningSSTTest()
61
+ (app.local || app.skipBuild) && !this.props.disablePlaceholder;
62
+ const fileSizeLimit = app.isRunningSSTTest()
61
63
  ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
62
64
  // @ts-ignore: "sstTestFileSizeLimitOverride" not exposed in props
63
- props.sstTestFileSizeLimitOverride || 200
65
+ this.props.sstTestFileSizeLimitOverride || 200
64
66
  : 200;
65
- this.props = props;
66
- this.cdk = {};
67
67
  this.awsCliLayer = new AwsCliLayer(this, "AwsCliLayer");
68
68
  this.registerSiteEnvironment();
69
69
  // Validate input
@@ -80,7 +80,7 @@ export interface TableGlobalIndexProps {
80
80
  index?: Omit<dynamodb.GlobalSecondaryIndexProps, "indexName" | "partitionKey" | "sortKey">;
81
81
  };
82
82
  }
83
- declare type TableFieldType = Lowercase<keyof typeof dynamodb.AttributeType>;
83
+ type TableFieldType = Lowercase<keyof typeof dynamodb.AttributeType>;
84
84
  export interface TableProps {
85
85
  /**
86
86
  * An object defining the fields of the table. Key is the name of the field and the value is the type.
@@ -28,5 +28,5 @@ export interface ViteStaticSiteProps extends StaticSiteProps {
28
28
  * ```
29
29
  */
30
30
  export declare class ViteStaticSite extends StaticSite {
31
- constructor(scope: Construct, id: string, props: ViteStaticSiteProps);
31
+ constructor(scope: Construct, id: string, props?: ViteStaticSiteProps);
32
32
  }
@@ -19,7 +19,8 @@ import { StaticSite } from "./StaticSite.js";
19
19
  */
20
20
  export class ViteStaticSite extends StaticSite {
21
21
  constructor(scope, id, props) {
22
- const { path: sitePath, environment, typesPath } = props || {};
22
+ const { path: pathRaw, environment, typesPath } = props || {};
23
+ const sitePath = pathRaw || ".";
23
24
  // generate buildCommand
24
25
  let defaultBuildCommand = "npm run build";
25
26
  if (fs.existsSync(path.join(sitePath, "yarn.lock"))) {
@@ -1,4 +1,4 @@
1
- declare type Task = () => Promise<void>;
1
+ type Task = () => Promise<void>;
2
2
  export declare const useDeferredTasks: () => {
3
3
  add(task: Task): void;
4
4
  run(): Promise<unknown>;
@@ -6,7 +6,7 @@ export interface AccessLogProps {
6
6
  destinationArn?: string;
7
7
  retention?: Lowercase<keyof typeof logs.RetentionDays>;
8
8
  }
9
- export declare type AccessLogData = {
9
+ export type AccessLogData = {
10
10
  logGroup: logs.LogGroup | undefined;
11
11
  format: apig.AccessLogFormat;
12
12
  destination: apig.LogGroupLogDestination;
@@ -1,3 +1,3 @@
1
1
  import { Duration as CDKDuration } from "aws-cdk-lib";
2
- export declare type Duration = `${number} ${"second" | "seconds" | "minute" | "minutes" | "hour" | "hours" | "day" | "days"}`;
2
+ export type Duration = `${number} ${"second" | "seconds" | "minute" | "minutes" | "hour" | "hours" | "day" | "days"}`;
3
3
  export declare function toCdkDuration(duration: Duration): CDKDuration;
@@ -1,8 +1,8 @@
1
1
  import { IConstruct } from "constructs";
2
2
  import * as iam from "aws-cdk-lib/aws-iam";
3
- export declare type Permissions = "*" | Permission[];
4
- declare type SupportedPermissions = "execute-api" | "appsync" | "dynamodb" | "sns" | "sqs" | "events" | "kinesis" | "s3" | "rds-data" | "secretsmanager" | "lambda" | "ssm";
5
- declare type Permission = SupportedPermissions | Omit<string, SupportedPermissions> | IConstruct | [IConstruct, string] | iam.PolicyStatement;
3
+ export type Permissions = "*" | Permission[];
4
+ type SupportedPermissions = "execute-api" | "appsync" | "dynamodb" | "sns" | "sqs" | "events" | "kinesis" | "s3" | "rds-data" | "secretsmanager" | "lambda" | "ssm";
5
+ type Permission = SupportedPermissions | Omit<string, SupportedPermissions> | IConstruct | [IConstruct, string] | iam.PolicyStatement;
6
6
  export declare function attachPermissionsToRole(role: iam.Role, permissions: Permissions): void;
7
7
  export declare function attachPermissionsToPolicy(policy: iam.Policy, permissions: Permissions): void;
8
8
  export {};
@@ -1,3 +1,3 @@
1
1
  import * as cdk from "aws-cdk-lib";
2
- export declare type Size = `${number} ${"MB" | "GB"}`;
2
+ export type Size = `${number} ${"MB" | "GB"}`;
3
3
  export declare function toCdkSize(size: Size): cdk.Size;
@@ -9,7 +9,7 @@ export interface Handlers {
9
9
  response: SQSBatchResponse;
10
10
  };
11
11
  }
12
- declare type HandlerTypes = keyof Handlers;
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
- declare type Config = RegionInputConfig & RetryInputConfig & AwsAuthInputConfig & HostHeaderConditionConfig;
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>;
@@ -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 declare type Adapter = () => Promise<APIGatewayProxyStructuredResultV2>;
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 ("clientSecret" in config) {
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
  });