@ts-cloud/core 0.5.4 → 0.5.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/dist/index.js CHANGED
@@ -45833,7 +45833,7 @@ function composeServerlessAppTemplate(opts) {
45833
45833
  ...app.assetDomain ? {
45834
45834
  Aliases: [app.assetDomain],
45835
45835
  ViewerCertificate: {
45836
- AcmCertificateArn: app.assetCertificateArn,
45836
+ AcmCertificateArn: app.assetCertificateArn ?? Fn2.ref("AssetsCertificate"),
45837
45837
  SslSupportMethod: "sni-only",
45838
45838
  MinimumProtocolVersion: "TLSv1.2_2021"
45839
45839
  }
@@ -45842,8 +45842,20 @@ function composeServerlessAppTemplate(opts) {
45842
45842
  }
45843
45843
  };
45844
45844
  if (app.assetDomain) {
45845
- if (!app.assetCertificateArn)
45846
- throw new Error("serverless app: `assetDomain` requires `assetCertificateArn` (a us-east-1 ACM cert — CloudFront only accepts certs from us-east-1).");
45845
+ if (!app.assetCertificateArn) {
45846
+ if (!app.hostedZoneId)
45847
+ throw new Error("serverless app: `assetDomain` requires either `assetCertificateArn` (a us-east-1 ACM cert) or `hostedZoneId` (to auto-issue + validate one). CloudFront only accepts certs from us-east-1.");
45848
+ if (region !== "us-east-1")
45849
+ throw new Error(`serverless app: auto-issuing an asset-domain cert needs a us-east-1 app (CloudFront certs must be us-east-1); this app is in ${region}. Supply a pre-issued us-east-1 \`assetCertificateArn\` instead.`);
45850
+ resources.AssetsCertificate = {
45851
+ Type: "AWS::CertificateManager::Certificate",
45852
+ Properties: {
45853
+ DomainName: app.assetDomain,
45854
+ ValidationMethod: "DNS",
45855
+ DomainValidationOptions: [{ DomainName: app.assetDomain, HostedZoneId: app.hostedZoneId }]
45856
+ }
45857
+ };
45858
+ }
45847
45859
  if (app.hostedZoneId) {
45848
45860
  resources.AssetsDomainRecord = {
45849
45861
  Type: "AWS::Route53::RecordSet",
package/dist/types.d.ts CHANGED
@@ -1692,10 +1692,16 @@ export interface ServerlessAppConfig {
1692
1692
  assets?: string;
1693
1693
  /**
1694
1694
  * Serve assets from a custom CDN host instead of the default CloudFront domain
1695
- * (Vapor `asset-domain`). Requires a us-east-1 ACM cert via assetCertificateArn.
1695
+ * (Vapor `asset-domain`). CloudFront needs a us-east-1 ACM cert: supply one via
1696
+ * {@link assetCertificateArn}, or give {@link hostedZoneId} and (for a us-east-1
1697
+ * app) ts-cloud auto-issues + DNS-validates one.
1696
1698
  */
1697
1699
  assetDomain?: string;
1698
- /** us-east-1 ACM certificate ARN for {@link assetDomain} (CloudFront requirement). */
1700
+ /**
1701
+ * us-east-1 ACM certificate ARN for {@link assetDomain} (CloudFront requirement).
1702
+ * Optional when {@link hostedZoneId} is set and the app is in us-east-1 — the
1703
+ * cert is then auto-issued and DNS-validated.
1704
+ */
1699
1705
  assetCertificateArn?: string;
1700
1706
  /** Include dotfiles when uploading assets (Vapor `dot-files-as-assets`). @default false */
1701
1707
  dotFilesAsAssets?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-cloud/core",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "type": "module",
5
5
  "description": "Core CloudFormation generation library for ts-cloud",
6
6
  "author": "Chris Breuer <chris@stacksjs.com>",
@@ -31,7 +31,7 @@
31
31
  "typecheck": "tsc --noEmit"
32
32
  },
33
33
  "dependencies": {
34
- "@ts-cloud/aws-types": "0.5.4"
34
+ "@ts-cloud/aws-types": "0.5.5"
35
35
  },
36
36
  "devDependencies": {
37
37
  "typescript": "^5.9.3"