sst 2.26.2 → 2.26.4

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/cli/commands/types.js +3 -7
  2. package/constructs/Api.js +2 -0
  3. package/constructs/ApiGatewayV1Api.js +2 -0
  4. package/constructs/App.d.ts +3 -1
  5. package/constructs/App.js +63 -62
  6. package/constructs/AppSyncApi.js +2 -0
  7. package/constructs/AstroSite.d.ts +50 -11
  8. package/constructs/AstroSite.js +69 -51
  9. package/constructs/Auth.js +2 -0
  10. package/constructs/Bucket.js +2 -0
  11. package/constructs/Cognito.js +2 -0
  12. package/constructs/Cron.js +2 -0
  13. package/constructs/EdgeFunction.d.ts +3 -4
  14. package/constructs/EdgeFunction.js +13 -9
  15. package/constructs/EventBus.js +2 -0
  16. package/constructs/Function.d.ts +5 -1
  17. package/constructs/Function.js +8 -6
  18. package/constructs/Job.js +3 -3
  19. package/constructs/KinesisStream.js +2 -0
  20. package/constructs/NextjsSite.d.ts +84 -22
  21. package/constructs/NextjsSite.js +150 -254
  22. package/constructs/Parameter.js +2 -0
  23. package/constructs/Queue.js +2 -0
  24. package/constructs/RDS.js +5 -4
  25. package/constructs/RemixSite.d.ts +65 -11
  26. package/constructs/RemixSite.js +112 -71
  27. package/constructs/Script.js +2 -0
  28. package/constructs/Secret.js +2 -0
  29. package/constructs/Service.js +4 -3
  30. package/constructs/SolidStartSite.d.ts +48 -9
  31. package/constructs/SolidStartSite.js +68 -40
  32. package/constructs/SsrFunction.d.ts +4 -5
  33. package/constructs/SsrFunction.js +18 -13
  34. package/constructs/SsrSite.d.ts +74 -68
  35. package/constructs/SsrSite.js +657 -682
  36. package/constructs/StaticSite.js +2 -0
  37. package/constructs/SvelteKitSite.d.ts +80 -12
  38. package/constructs/SvelteKitSite.js +90 -64
  39. package/constructs/Table.js +2 -0
  40. package/constructs/Topic.js +2 -0
  41. package/constructs/WebSocketApi.js +2 -0
  42. package/constructs/deprecated/NextjsSite.js +1 -0
  43. package/constructs/future/Auth.js +1 -0
  44. package/package.json +1 -1
  45. package/support/remix-site-function/edge-server.js +2 -4
  46. package/support/remix-site-function/regional-server.js +2 -4
@@ -1,28 +1,44 @@
1
1
  import { Construct } from "constructs";
2
2
  import { Bucket, BucketProps, IBucket } from "aws-cdk-lib/aws-s3";
3
- import { FunctionProps as CdkFunctionProps } from "aws-cdk-lib/aws-lambda";
4
- import { ICachePolicy, IResponseHeadersPolicy, BehaviorOptions, CachePolicy, Function as CfFunction, FunctionEventType as CfFunctionEventType } from "aws-cdk-lib/aws-cloudfront";
5
- import { Distribution, DistributionDomainProps } from "./Distribution.js";
3
+ import { Function as CdkFunction, FunctionProps as CdkFunctionProps } from "aws-cdk-lib/aws-lambda";
4
+ import { ICachePolicy, IResponseHeadersPolicy, IDistribution } from "aws-cdk-lib/aws-cloudfront";
5
+ import { DistributionDomainProps } from "./Distribution.js";
6
6
  import { SSTConstruct } from "./Construct.js";
7
7
  import { NodeJSProps, FunctionProps } from "./Function.js";
8
- import { SsrFunction } from "./SsrFunction.js";
9
- import { EdgeFunction } from "./EdgeFunction.js";
8
+ import { SsrFunction, SsrFunctionProps } from "./SsrFunction.js";
9
+ import { EdgeFunction, EdgeFunctionProps } from "./EdgeFunction.js";
10
10
  import { BaseSiteFileOptions, BaseSiteReplaceProps, BaseSiteCdkDistributionProps } from "./BaseSite.js";
11
11
  import { Size } from "./util/size.js";
12
12
  import { Duration } from "./util/duration.js";
13
13
  import { Permissions } from "./util/permission.js";
14
14
  import { FunctionBindingProps } from "./util/functionBinding.js";
15
- export type SsrBuildConfig = {
16
- typesPath: string;
17
- serverBuildOutputFile: string;
18
- serverCFFunctionInjection?: string;
19
- clientBuildOutputDir: string;
20
- clientBuildVersionedSubDir: string;
21
- clientBuildS3KeyPrefix?: string;
22
- clientCFFunctionInjection?: string;
23
- prerenderedBuildOutputDir?: string;
24
- prerenderedBuildS3KeyPrefix?: string;
25
- warmerFunctionAssetPath?: string;
15
+ type CloudFrontFunctionConfig = {
16
+ constructId: string;
17
+ injections: string[];
18
+ };
19
+ type EdgeFunctionConfig = {
20
+ constructId: string;
21
+ function: EdgeFunctionProps;
22
+ };
23
+ type FunctionOriginConfig = {
24
+ type: "function";
25
+ constructId: string;
26
+ function: SsrFunctionProps;
27
+ streaming?: boolean;
28
+ };
29
+ type ImageOptimizationFunctionOriginConfig = {
30
+ type: "image-optimization-function";
31
+ function: CdkFunctionProps;
32
+ };
33
+ type S3OriginConfig = {
34
+ type: "s3";
35
+ originPath?: string;
36
+ copy: {
37
+ from: string;
38
+ to: string;
39
+ cached: boolean;
40
+ versionedSubDir?: string;
41
+ }[];
26
42
  };
27
43
  export interface SsrSiteNodeJSProps extends NodeJSProps {
28
44
  }
@@ -184,7 +200,7 @@ export interface SsrSiteProps {
184
200
  */
185
201
  id?: string;
186
202
  /**
187
- * Allows you to override default settings this construct uses internally to ceate the bucket
203
+ * Allows you to override default settings this construct uses internally to create the bucket
188
204
  */
189
205
  bucket?: BucketProps | IBucket;
190
206
  /**
@@ -298,20 +314,12 @@ export declare abstract class SsrSite extends Construct implements SSTConstruct
298
314
  readonly id: string;
299
315
  protected props: SsrSiteNormalizedProps;
300
316
  protected doNotDeploy: boolean;
301
- protected buildConfig: SsrBuildConfig;
302
- protected deferredTaskCallbacks: (() => void)[];
303
- protected serverLambdaForEdge?: EdgeFunction;
304
- protected serverLambdaForRegional?: SsrFunction;
305
- private serverLambdaForDev?;
306
- private serverUrlSigningFunction?;
317
+ protected typesPath: string;
307
318
  protected bucket: Bucket;
308
- private serverCfFunction?;
309
- private serverBehaviorCachePolicy?;
310
- private serverBehaviorOriginRequestPolicy?;
311
- private staticCfFunction?;
312
- private s3Origin;
319
+ protected serverFunction?: EdgeFunction | SsrFunction;
320
+ private serverFunctionForDev?;
313
321
  private distribution;
314
- constructor(scope: Construct, id: string, props?: SsrSiteProps);
322
+ constructor(scope: Construct, id: string, rawProps?: SsrSiteProps);
315
323
  /**
316
324
  * The CloudFront URL of the website.
317
325
  */
@@ -325,9 +333,9 @@ export declare abstract class SsrSite extends Construct implements SSTConstruct
325
333
  * The internally created CDK resources.
326
334
  */
327
335
  get cdk(): {
328
- function: import("aws-cdk-lib/aws-lambda").IFunction | undefined;
336
+ function: import("aws-cdk-lib/aws-lambda").IFunction | CdkFunction | undefined;
329
337
  bucket: Bucket;
330
- distribution: import("aws-cdk-lib/aws-cloudfront").IDistribution;
338
+ distribution: IDistribution;
331
339
  hostedZone: import("aws-cdk-lib/aws-route53").IHostedZone | undefined;
332
340
  certificate: import("aws-cdk-lib/aws-certificatemanager").ICertificate | undefined;
333
341
  } | undefined;
@@ -357,43 +365,41 @@ export declare abstract class SsrSite extends Construct implements SSTConstruct
357
365
  abstract getConstructMetadata(): ReturnType<SSTConstruct["getConstructMetadata"]>;
358
366
  /** @internal */
359
367
  getFunctionBinding(): FunctionBindingProps;
360
- protected initBuildConfig(): SsrBuildConfig;
361
- private buildApp;
362
- protected validateBuildOutput(): void;
363
- private runBuild;
364
- private createS3Assets;
365
- private createS3AssetFileOptions;
366
- private createS3Bucket;
367
- private createS3Deployment;
368
- protected createFunctionForRegional(): SsrFunction;
369
- protected createFunctionForEdge(): EdgeFunction;
370
- protected createFunctionForDev(): SsrFunction;
371
- private grantServerS3Permissions;
372
- private grantServerCloudFrontPermissions;
373
- private createWarmer;
374
- private createCloudFrontS3Origin;
375
- protected createCloudFrontDistributionForRegional(): Distribution;
376
- protected createCloudFrontDistributionForEdge(): Distribution;
377
- protected buildDefaultBehaviorForRegional(): BehaviorOptions;
378
- protected buildDefaultBehaviorForEdge(): BehaviorOptions;
379
- protected addStaticFileBehaviors(): void;
380
- protected useServerBehaviorFunctionAssociations(): {
381
- eventType: CfFunctionEventType;
382
- function: CfFunction;
383
- }[];
384
- protected useStaticBehaviorFunctionAssociations(): {
385
- eventType: CfFunctionEventType;
386
- function: CfFunction;
387
- }[];
388
- protected useServerUrlSigningFunction(): EdgeFunction;
389
- protected useServerBehaviorCachePolicy(allowedHeaders?: string[]): CachePolicy;
390
- private useServerBehaviorOriginRequestPolicy;
391
- private getS3ContentReplaceValues;
392
- private validateSiteExists;
393
- private validateTimeout;
394
- private writeTypesFile;
395
- protected generateBuildId(): string;
396
- protected supportsStreaming(): boolean;
368
+ protected useCloudFrontFunctionHostHeaderInjection(): string;
369
+ protected abstract plan(bucket: Bucket): ReturnType<typeof this.validatePlan>;
370
+ protected validatePlan<CloudFrontFunctions extends Record<string, CloudFrontFunctionConfig>, EdgeFunctions extends Record<string, EdgeFunctionConfig>, Origins extends Record<string, FunctionOriginConfig | ImageOptimizationFunctionOriginConfig | S3OriginConfig>>(input: {
371
+ cloudFrontFunctions?: CloudFrontFunctions;
372
+ edgeFunctions?: EdgeFunctions;
373
+ origins: Origins;
374
+ behaviors: {
375
+ cacheType: "server" | "static";
376
+ pattern?: string;
377
+ origin: keyof Origins;
378
+ cfFunction?: keyof CloudFrontFunctions;
379
+ edgeFunction?: keyof EdgeFunctions;
380
+ }[];
381
+ cachePolicyAllowedHeaders?: string[];
382
+ buildId?: string;
383
+ warmerConfig?: {
384
+ function: string;
385
+ };
386
+ }): {
387
+ cloudFrontFunctions?: CloudFrontFunctions | undefined;
388
+ edgeFunctions?: EdgeFunctions | undefined;
389
+ origins: Origins;
390
+ behaviors: {
391
+ cacheType: "server" | "static";
392
+ pattern?: string;
393
+ origin: keyof Origins;
394
+ cfFunction?: keyof CloudFrontFunctions;
395
+ edgeFunction?: keyof EdgeFunctions;
396
+ }[];
397
+ cachePolicyAllowedHeaders?: string[] | undefined;
398
+ buildId?: string | undefined;
399
+ warmerConfig?: {
400
+ function: string;
401
+ } | undefined;
402
+ };
397
403
  }
398
404
  export declare const useSites: () => {
399
405
  add(stack: string, name: string, type: string, props: SsrSiteNormalizedProps): void;