sst 2.43.3 → 2.43.5

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.js CHANGED
@@ -18,6 +18,7 @@ import { Stacks } from "./stacks/index.js";
18
18
  import { lazy } from "./util/lazy.js";
19
19
  const CDK_STACK_NAME = "CDKToolkit";
20
20
  const SST_STACK_NAME = "SSTBootstrap";
21
+ const SST_STACK_DESCRIPTION = "This stack includes resources needed to deploy SST apps into this environment";
21
22
  const OUTPUT_VERSION = "Version";
22
23
  const OUTPUT_BUCKET = "BucketName";
23
24
  const LATEST_VERSION = "7.3";
@@ -72,7 +73,7 @@ async function loadCDKStatus() {
72
73
  return { status: "bootstrap" };
73
74
  }
74
75
  // Check CDK bootstrap stack is up to date
75
- // note: there is no a programmatical way to get the minimal required version
76
+ // note: there is no a programmatic way to get the minimal required version
76
77
  // of CDK bootstrap stack. We are going to hardcode it to 14 for now,
77
78
  // which is the latest version as of CDK v2.62.2
78
79
  let version;
@@ -155,10 +156,12 @@ export async function bootstrapSST(cdkBucket) {
155
156
  // Create bootstrap stack
156
157
  const app = new App();
157
158
  const stackName = bootstrap?.stackName || SST_STACK_NAME;
159
+ const stackDescription = bootstrap?.stackDescription || SST_STACK_DESCRIPTION;
158
160
  const stack = new Stack(app, stackName, {
159
161
  env: {
160
162
  region,
161
163
  },
164
+ description: stackDescription,
162
165
  synthesizer: new DefaultStackSynthesizer({
163
166
  qualifier: cdk?.qualifier,
164
167
  bootstrapStackVersionSsmParameter: cdk?.bootstrapStackVersionSsmParameter,
@@ -205,6 +205,7 @@ export declare class RDS extends Construct implements SSTConstruct {
205
205
  };
206
206
  /** @internal */
207
207
  getBindings(): BindingProps;
208
+ runMigrations(migrations: string, database?: string): void;
208
209
  private validateRequiredProps;
209
210
  private validateCDKPropWhenIsConstruct;
210
211
  private validateCDKPropWhenIsClusterProps;
package/constructs/RDS.js CHANGED
@@ -59,9 +59,7 @@ export class RDS extends Construct {
59
59
  }
60
60
  // Create the migrator function
61
61
  if (migrations) {
62
- this.validateMigrationsFileExists(migrations);
63
- this.createMigrationsFunction(migrations);
64
- this.createMigrationCustomResource(migrations);
62
+ this.runMigrations(migrations);
65
63
  }
66
64
  const app = this.node.root;
67
65
  app.registerTypes(this);
@@ -150,6 +148,11 @@ export class RDS extends Construct {
150
148
  },
151
149
  };
152
150
  }
151
+ runMigrations(migrations, database) {
152
+ this.validateMigrationsFileExists(migrations);
153
+ this.createMigrationsFunction(migrations);
154
+ this.createMigrationCustomResource(migrations, database);
155
+ }
153
156
  validateRequiredProps(props) {
154
157
  if (!props.engine) {
155
158
  throw new Error(`Missing "engine" in the "${this.node.id}" RDS`);
@@ -335,7 +338,7 @@ export class RDS extends Construct {
335
338
  this.migratorFunction._overrideMetadataHandler =
336
339
  "rds-migrator/index.handler";
337
340
  }
338
- createMigrationCustomResource(migrations) {
341
+ createMigrationCustomResource(migrations, database) {
339
342
  const app = this.node.root;
340
343
  // Create custom resource handler
341
344
  const handler = new Function(this, "MigrationHandler", {
@@ -367,7 +370,7 @@ export class RDS extends Construct {
367
370
  properties: {
368
371
  UserCreateFunction: app.mode === "dev" ? undefined : this.migratorFunction?.functionName,
369
372
  UserUpdateFunction: app.mode === "dev" ? undefined : this.migratorFunction?.functionName,
370
- UserParams: JSON.stringify({}),
373
+ UserParams: JSON.stringify({ database }),
371
374
  MigrationsHash: hash,
372
375
  },
373
376
  });
@@ -1,6 +1,6 @@
1
1
  import { Construct } from "constructs";
2
2
  import { DockerCacheOption } from "aws-cdk-lib/core";
3
- import { DistributionProps } from "aws-cdk-lib/aws-cloudfront";
3
+ import { DistributionProps, ICachePolicy } from "aws-cdk-lib/aws-cloudfront";
4
4
  import { DistributionDomainProps } from "./Distribution.js";
5
5
  import { SSTConstruct } from "./Construct.js";
6
6
  import { Permissions } from "./util/permission.js";
@@ -443,6 +443,21 @@ export interface ServiceProps {
443
443
  * ```
444
444
  */
445
445
  vpc?: IVpc;
446
+ /**
447
+ * By default, SST creates a CloudFront cache policy. Pass in a value to override the default policy.
448
+ *
449
+ * @example
450
+ * ```js
451
+ * import { CachePolicy } from "aws-cdk-lib/aws-cloudfront";
452
+ *
453
+ * {
454
+ * cdk: {
455
+ * cachePolicy: CachePolicy.fromCachePolicyId(stack, "CachePolicy", "83da9c7e-98b4-4e11-a168-04f0df8e2c65"),
456
+ * }
457
+ * }
458
+ * ```
459
+ */
460
+ cachePolicy?: ICachePolicy;
446
461
  };
447
462
  }
448
463
  type ServiceNormalizedProps = ServiceProps & {
@@ -510,17 +510,18 @@ export class Service extends Construct {
510
510
  // Do not create distribution if disabled or if ALB was not created (ie. disabled)
511
511
  if (!alb || cdk?.cloudfrontDistribution === false)
512
512
  return;
513
- const cachePolicy = new CachePolicy(this, "CachePolicy", {
514
- queryStringBehavior: CacheQueryStringBehavior.all(),
515
- headerBehavior: CacheHeaderBehavior.none(),
516
- cookieBehavior: CacheCookieBehavior.none(),
517
- defaultTtl: CdkDuration.days(0),
518
- maxTtl: CdkDuration.days(365),
519
- minTtl: CdkDuration.days(0),
520
- enableAcceptEncodingBrotli: true,
521
- enableAcceptEncodingGzip: true,
522
- comment: "SST server response cache policy",
523
- });
513
+ const cachePolicy = cdk?.cachePolicy ??
514
+ new CachePolicy(this, "CachePolicy", {
515
+ queryStringBehavior: CacheQueryStringBehavior.all(),
516
+ headerBehavior: CacheHeaderBehavior.none(),
517
+ cookieBehavior: CacheCookieBehavior.none(),
518
+ defaultTtl: CdkDuration.days(0),
519
+ maxTtl: CdkDuration.days(365),
520
+ minTtl: CdkDuration.days(0),
521
+ enableAcceptEncodingBrotli: true,
522
+ enableAcceptEncodingGzip: true,
523
+ comment: "SST server response cache policy",
524
+ });
524
525
  return new Distribution(this, "CDN", {
525
526
  customDomain,
526
527
  cdk: {
@@ -3,6 +3,7 @@ interface LinkConfig {
3
3
  onLink: (link: string, claims: Record<string, any>) => Promise<APIGatewayProxyStructuredResultV2>;
4
4
  onSuccess: (claims: Record<string, any>) => Promise<APIGatewayProxyStructuredResultV2>;
5
5
  onError: () => Promise<APIGatewayProxyStructuredResultV2>;
6
+ expiresInMs?: number;
6
7
  }
7
8
  export declare const LinkAdapter: (config: LinkConfig) => () => Promise<APIGatewayProxyStructuredResultV2>;
8
9
  export {};
@@ -4,7 +4,7 @@ import { createAdapter } from "./adapter.js";
4
4
  import { getPrivateKey, getPublicKey } from "../auth.js";
5
5
  export const LinkAdapter = /* @__PURE__ */ createAdapter((config) => {
6
6
  const signer = createSigner({
7
- expiresIn: 1000 * 60 * 10,
7
+ expiresIn: config.expiresInMs || 1000 * 60 * 10,
8
8
  key: getPrivateKey(),
9
9
  algorithm: "RS512",
10
10
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.43.3",
4
+ "version": "2.43.5",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
@@ -118,7 +118,7 @@
118
118
  "@types/ws": "^8.5.3",
119
119
  "@types/yargs": "^17.0.13",
120
120
  "archiver": "^5.3.1",
121
- "astro-sst": "2.43.3",
121
+ "astro-sst": "2.43.5",
122
122
  "async": "^3.2.4",
123
123
  "tsx": "^3.12.1",
124
124
  "typescript": "^5.2.2",
package/project.d.ts CHANGED
@@ -19,6 +19,7 @@ export interface ConfigOptions {
19
19
  bootstrap?: {
20
20
  useCdkBucket?: boolean;
21
21
  stackName?: string;
22
+ stackDescription?: string;
22
23
  bucketName?: string;
23
24
  tags?: Record<string, string>;
24
25
  };
@@ -208,13 +208,16 @@ export const useNodeHandler = () => {
208
208
  }));
209
209
  const cmd = [
210
210
  "npm install",
211
- "--platform=linux",
212
211
  "--omit=dev",
213
212
  "--no-optional",
214
213
  "--force",
214
+ "--platform=linux",
215
215
  input.props.architecture === "arm_64"
216
216
  ? "--arch=arm64"
217
217
  : "--arch=x64",
218
+ // support npm versions 10 and above
219
+ "--os=linux",
220
+ input.props.architecture === "arm_64" ? "--cpu=arm64" : "--cpu=x64",
218
221
  ];
219
222
  if (installPackages.includes("sharp")) {
220
223
  /**
@@ -4,6 +4,6 @@ ARG IMAGE=amazon/aws-sam-cli-build-image-python3.7
4
4
  FROM $IMAGE
5
5
 
6
6
  # Ensure rsync is installed
7
- RUN yum -q list installed rsync &>/dev/null || yum install -y rsync
7
+ RUN yum -q list installed rsync &>/dev/null || yum install -y rsync || dnf repoquery --installed rsync &>/dev/null || dnf install -y rsync
8
8
 
9
9
  CMD [ "python" ]
@@ -4,7 +4,7 @@ ARG IMAGE=amazon/aws-sam-cli-build-image-python3.7
4
4
  FROM $IMAGE
5
5
 
6
6
  # Ensure rsync is installed
7
- RUN yum -q list installed rsync &>/dev/null || yum install -y rsync
7
+ RUN yum -q list installed rsync &>/dev/null || yum install -y rsync || dnf repoquery --installed rsync &>/dev/null || dnf install -y rsync
8
8
 
9
9
  # Upgrade pip (required by cryptography v3.4 and above, which is a dependency of poetry)
10
10
  RUN pip install --upgrade pip
@@ -4,7 +4,7 @@ ARG IMAGE=amazon/aws-sam-cli-build-image-python3.7
4
4
  FROM $IMAGE
5
5
 
6
6
  # Ensure rsync is installed
7
- RUN yum -q list installed rsync &>/dev/null || yum install -y rsync
7
+ RUN yum -q list installed rsync &>/dev/null || yum install -y rsync || dnf repoquery --installed rsync &>/dev/null || dnf install -y rsync
8
8
 
9
9
  # Upgrade pip (required by cryptography v3.4 and above, which is a dependency of poetry)
10
10
  RUN pip install --upgrade pip
@@ -3776,7 +3776,7 @@ var queryStringToQueryParameterBag = (queryString) => {
3776
3776
  const key = split[0];
3777
3777
  const value = split[1];
3778
3778
  if (query[key] === void 0 || query[key] === null) {
3779
- query[key] = value ? decodeURIComponent(value) : null;
3779
+ query[key] = value ? decodeURIComponent(value) : "";
3780
3780
  continue;
3781
3781
  }
3782
3782
  if (value === void 0 || value === "") {