@fy-stack/app-construct 0.0.128 → 0.0.129

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.d.ts CHANGED
@@ -3,6 +3,7 @@ export { NextAppRouterConstruct } from './lib/next-app-router-construct';
3
3
  export { NextPagesExportConstruct } from './lib/next-pages-export-construct';
4
4
  export { NodeApiConstruct } from './lib/node-api-construct';
5
5
  export { NodeAppConstruct } from './lib/node-app-construct';
6
+ export { StaticWebsiteConstruct } from './lib/static-website-construct';
6
7
  export type { AppConstruct, AppProperties } from "./lib/types";
7
8
  export { lambdaAttach } from "./lib/utils/lambda-attach";
8
9
  export { lambdaGrant } from "./lib/utils/lambda-grant";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lambdaGrant = exports.lambdaAttach = exports.NodeAppConstruct = exports.NodeApiConstruct = exports.NextPagesExportConstruct = exports.NextAppRouterConstruct = exports.ImageAppConstruct = void 0;
3
+ exports.lambdaGrant = exports.lambdaAttach = exports.StaticWebsiteConstruct = exports.NodeAppConstruct = exports.NodeApiConstruct = exports.NextPagesExportConstruct = exports.NextAppRouterConstruct = exports.ImageAppConstruct = void 0;
4
4
  var image_app_construct_1 = require("./lib/image-app-construct");
5
5
  Object.defineProperty(exports, "ImageAppConstruct", { enumerable: true, get: function () { return image_app_construct_1.ImageAppConstruct; } });
6
6
  var next_app_router_construct_1 = require("./lib/next-app-router-construct");
@@ -11,6 +11,8 @@ var node_api_construct_1 = require("./lib/node-api-construct");
11
11
  Object.defineProperty(exports, "NodeApiConstruct", { enumerable: true, get: function () { return node_api_construct_1.NodeApiConstruct; } });
12
12
  var node_app_construct_1 = require("./lib/node-app-construct");
13
13
  Object.defineProperty(exports, "NodeAppConstruct", { enumerable: true, get: function () { return node_app_construct_1.NodeAppConstruct; } });
14
+ var static_website_construct_1 = require("./lib/static-website-construct");
15
+ Object.defineProperty(exports, "StaticWebsiteConstruct", { enumerable: true, get: function () { return static_website_construct_1.StaticWebsiteConstruct; } });
14
16
  var lambda_attach_1 = require("./lib/utils/lambda-attach");
15
17
  Object.defineProperty(exports, "lambdaAttach", { enumerable: true, get: function () { return lambda_attach_1.lambdaAttach; } });
16
18
  var lambda_grant_1 = require("./lib/utils/lambda-grant");
@@ -14,6 +14,7 @@ export declare class ImageAppConstruct extends Construct implements AppConstruct
14
14
  grant(...grantables: Grantable[]): void;
15
15
  subscription(props: SubscriptionProps): ITopicSubscription;
16
16
  cloudfront(path: string): Record<string, BehaviorOptions>;
17
+ cloudfrontPolicy(distributionId: string): void;
17
18
  api(path: string): Record<string, HttpRouteIntegration>;
18
19
  }
19
20
  //# sourceMappingURL=image-app-construct.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"image-app-construct.d.ts","sourceRoot":"","sources":["../../src/lib/image-app-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAG,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAEL,eAAe,EAKhB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAEL,QAAQ,EAIT,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAK5E,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAKtD,qBAAa,iBACX,SAAQ,SACR,YAAW,YAAY;IAEhB,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;gBAEpB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IA2B9D,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI;IAIpD,KAAK,CAAC,GAAG,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI;IAIvC,YAAY,CAAC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AAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;CAGxD"}
@@ -65,6 +65,9 @@ class ImageAppConstruct extends constructs_1.Construct {
65
65
  };
66
66
  return { [`${path}/*`]: apiBehavior };
67
67
  }
68
+ cloudfrontPolicy(distributionId) {
69
+ throw new Error("cloudfrontPolicy not implemented");
70
+ }
68
71
  api(path) {
69
72
  return (0, lambda_api_1.lambdaApi)(this.function, path);
70
73
  }
@@ -12,6 +12,7 @@ export declare class NextAppRouterConstruct extends Construct implements AppCons
12
12
  private readonly static;
13
13
  constructor(scope: Construct, id: string, props: AppProperties);
14
14
  cloudfront(path: string): Record<string, cloudfront.BehaviorOptions>;
15
+ cloudfrontPolicy(distributionId: string): void;
15
16
  api(): Record<string, HttpRouteIntegration>;
16
17
  attach(attachable: Record<string, Attachable>): void;
17
18
  grant(...grants: Grantable[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"next-app-router-construct.d.ts","sourceRoot":"","sources":["../../src/lib/next-app-router-construct.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAEzD,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAIjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAItD,qBAAa,sBAAuB,SAAQ,SAAU,YAAW,YAAY;IACpE,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,E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,aAAa;IAiE9D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC;IAmDpE,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAI3C,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,IAAI,kBAAkB;CAGnC"}
@@ -84,7 +84,7 @@ class NextAppRouterConstruct extends constructs_1.Construct {
84
84
  compress: true,
85
85
  viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
86
86
  };
87
- const appCachePolicy = new cloudfront.CachePolicy(this, "ImagePolicy", {
87
+ const imageCachePolicy = new cloudfront.CachePolicy(this, "ImagePolicy", {
88
88
  queryStringBehavior: cloudfront.CacheQueryStringBehavior.all(),
89
89
  maxTtl: cdk.Duration.days(365),
90
90
  enableAcceptEncodingGzip: true,
@@ -104,13 +104,16 @@ class NextAppRouterConstruct extends constructs_1.Construct {
104
104
  [`${path}/*`]: appBehaviour,
105
105
  [`${path}/_next/image`]: {
106
106
  ...appBehaviour,
107
- cachePolicy: appCachePolicy,
107
+ cachePolicy: imageCachePolicy,
108
108
  allowedMethods: cloudfront.AllowedMethods.ALLOW_GET_HEAD,
109
109
  },
110
110
  [`${path}/_next/*`]: staticBehavior,
111
111
  [`${path}/*.ico`]: staticBehavior,
112
112
  };
113
113
  }
114
+ cloudfrontPolicy(distributionId) {
115
+ throw new Error(`cloudfrontPolicy not supported for ${this}`);
116
+ }
114
117
  api() {
115
118
  throw new Error('api not supported for this construct');
116
119
  }
@@ -8,6 +8,7 @@ export declare class NextPagesExportConstruct extends Construct implements AppCo
8
8
  private readonly static;
9
9
  constructor(scope: Construct, id: string, props: AppProperties);
10
10
  cloudfront(path: string): Record<string, cloudfront.BehaviorOptions>;
11
+ cloudfrontPolicy(distributionId: string): void;
11
12
  api(): Record<string, HttpRouteIntegration>;
12
13
  attach(attachable: Record<string, Attachable>): void;
13
14
  grant(...grants: Grantable[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"next-pages-export-construct.d.ts","sourceRoot":"","sources":["../../src/lib/next-pages-export-construct.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAIzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEtD,qBAAa,wBAAyB,SAAQ,SAAU,YAAW,YAAY;IAC7E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;gBAEvB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IAiC9D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC;IAmBpE,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAI3C,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,IAAI,kBAAkB;CAGnC"}
1
+ {"version":3,"file":"next-pages-export-construct.d.ts","sourceRoot":"","sources":["../../src/lib/next-pages-export-construct.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAIzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEtD,qBAAa,wBAAyB,SAAQ,SAAU,YAAW,YAAY;IAC7E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;gBAEvB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IAiC9D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC;IAmBpE,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAI3C,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,IAAI,kBAAkB;CAGnC"}
@@ -54,6 +54,9 @@ class NextPagesExportConstruct extends constructs_1.Construct {
54
54
  [`${path}/*`]: staticBehavior,
55
55
  };
56
56
  }
57
+ cloudfrontPolicy(distributionId) {
58
+ throw new Error(`cloudfrontPolicy not supported for ${this}`);
59
+ }
57
60
  api() {
58
61
  throw new Error('api not supported for this construct');
59
62
  }
@@ -23,6 +23,7 @@ export declare class NodeApiConstruct extends Construct implements AppConstruct
23
23
  responseHeadersPolicy: cdk.aws_cloudfront.IResponseHeadersPolicy;
24
24
  };
25
25
  };
26
+ cloudfrontPolicy(distributionId: string): void;
26
27
  api(path: string): {
27
28
  [x: string]: cdk.aws_apigatewayv2_integrations.HttpUrlIntegration;
28
29
  };
@@ -1 +1 @@
1
- {"version":3,"file":"node-api-construct.d.ts","sourceRoot":"","sources":["../../src/lib/node-api-construct.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAGnC,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAKtD,qBAAa,gBAAiB,SAAQ,SAAU,YAAW,YAAY;IAC9D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;gBAExB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IAgD9D,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB;IAI1D,UAAU,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;;IAqBvB,GAAG,CAAC,IAAI,EAAE,MAAM;;;CAGjB"}
1
+ {"version":3,"file":"node-api-construct.d.ts","sourceRoot":"","sources":["../../src/lib/node-api-construct.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAGnC,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAKtD,qBAAa,gBAAiB,SAAQ,SAAU,YAAW,YAAY;IAC9D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;gBAExB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IAgD9D,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB;IAI1D,UAAU,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;;IAqBvB,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,CAAC,IAAI,EAAE,MAAM;;;CAGjB"}
@@ -76,6 +76,9 @@ class NodeApiConstruct extends constructs_1.Construct {
76
76
  };
77
77
  return { [`${path}/*`]: apiBehavior };
78
78
  }
79
+ cloudfrontPolicy(distributionId) {
80
+ throw new Error(`cloudfrontPolicy not supported for ${this}`);
81
+ }
79
82
  api(path) {
80
83
  return (0, lambda_api_1.lambdaApi)(this.function, path);
81
84
  }
@@ -14,6 +14,7 @@ export declare class NodeAppConstruct extends Construct implements AppConstruct
14
14
  grant(...grants: Grantable[]): void;
15
15
  subscription(props: SubscriptionProps): ITopicSubscription;
16
16
  cloudfront(path: string): Record<string, BehaviorOptions>;
17
+ cloudfrontPolicy(distributionId: string): void;
17
18
  api(path: string): Record<string, HttpRouteIntegration>;
18
19
  }
19
20
  //# sourceMappingURL=node-app-construct.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node-app-construct.d.ts","sourceRoot":"","sources":["../../src/lib/node-app-construct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ACzE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAKtD,qBAAa,gBAAiB,SAAQ,SAAU,YAAW,YAAY;IAC9D,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC;gBAExB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IA8B9D,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB;IAO1D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC;IAIzD,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;CAUxD"}
@@ -51,6 +51,9 @@ class NodeAppConstruct extends constructs_1.Construct {
51
51
  cloudfront(path) {
52
52
  throw new Error(`cloudfront not supported for ${this}`);
53
53
  }
54
+ cloudfrontPolicy(distributionId) {
55
+ throw new Error(`cloudfrontPolicy not supported for ${this}`);
56
+ }
54
57
  api(path) {
55
58
  this.function.addEnvironment('BASE_PATH', path);
56
59
  const integration = new aws_apigatewayv2_integrations_1.HttpLambdaIntegration('AppIntegration', this.function);
@@ -0,0 +1,17 @@
1
+ import { AppConstruct, AppProperties } from './types';
2
+ import { HttpRouteIntegration } from 'aws-cdk-lib/aws-apigatewayv2';
3
+ import { Attachable, Grantable } from '@fy-stack/types';
4
+ import { ITopicSubscription } from 'aws-cdk-lib/aws-sns';
5
+ import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
6
+ import { Construct } from 'constructs';
7
+ export declare class ReactStaticConstruct extends Construct implements AppConstruct {
8
+ private readonly static;
9
+ constructor(scope: Construct, id: string, props: AppProperties);
10
+ cloudfront(path: string): Record<string, cloudfront.BehaviorOptions>;
11
+ cloudfrontPolicy(distributionId: string): void;
12
+ api(): Record<string, HttpRouteIntegration>;
13
+ attach(attachable: Record<string, Attachable>): void;
14
+ grant(...grants: Grantable[]): void;
15
+ subscription(): ITopicSubscription;
16
+ }
17
+ //# sourceMappingURL=react-static-construct.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-static-construct.d.ts","sourceRoot":"","sources":["../../src/lib/react-static-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAIzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,qBAAa,oBAAqB,SAAQ,SAAU,YAAW,YAAY;IACzE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;gBAEvB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IA0B9D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC;IAmBpE,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAI3C,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,IAAI,kBAAkB;CAGnC"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReactStaticConstruct = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const cloudfront = tslib_1.__importStar(require("aws-cdk-lib/aws-cloudfront"));
6
+ const cloudfrontOrigin = tslib_1.__importStar(require("aws-cdk-lib/aws-cloudfront-origins"));
7
+ const s3 = tslib_1.__importStar(require("aws-cdk-lib/aws-s3"));
8
+ const s3Deploy = tslib_1.__importStar(require("aws-cdk-lib/aws-s3-deployment"));
9
+ const constructs_1 = require("constructs");
10
+ const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
11
+ class ReactStaticConstruct extends constructs_1.Construct {
12
+ static;
13
+ constructor(scope, id, props) {
14
+ super(scope, id);
15
+ this.static = new s3.Bucket(this, `StaticBucket`, {
16
+ removalPolicy: cdk.RemovalPolicy.DESTROY,
17
+ autoDeleteObjects: true,
18
+ blockPublicAccess: s3.BlockPublicAccess.BLOCK_ACLS,
19
+ publicReadAccess: true,
20
+ websiteIndexDocument: 'index.html',
21
+ websiteErrorDocument: 'index.html',
22
+ cors: [
23
+ {
24
+ allowedHeaders: ['*'],
25
+ allowedOrigins: ['*'],
26
+ allowedMethods: [s3.HttpMethods.GET, s3.HttpMethods.HEAD],
27
+ },
28
+ ],
29
+ });
30
+ new s3Deploy.BucketDeployment(this, `StaticDeployment`, {
31
+ destinationBucket: this.static,
32
+ sources: [s3Deploy.Source.asset(props.output),],
33
+ retainOnDelete: false,
34
+ });
35
+ }
36
+ cloudfront(path) {
37
+ const staticOrigin = new cloudfrontOrigin.S3StaticWebsiteOrigin(this.static);
38
+ const staticBehavior = {
39
+ origin: staticOrigin,
40
+ cachePolicy: cloudfront.CachePolicy.CACHING_OPTIMIZED,
41
+ allowedMethods: cloudfront.AllowedMethods.ALLOW_GET_HEAD,
42
+ cachedMethods: cloudfront.CachedMethods.CACHE_GET_HEAD,
43
+ compress: true,
44
+ viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
45
+ };
46
+ return {
47
+ [`${path}/*`]: staticBehavior,
48
+ };
49
+ }
50
+ cloudfrontPolicy(distributionId) {
51
+ throw new Error(`cloudfrontPolicy not supported for ${this}`);
52
+ }
53
+ api() {
54
+ throw new Error('api not supported for this construct');
55
+ }
56
+ attach(attachable) {
57
+ throw new Error('attach not supported for this construct');
58
+ }
59
+ grant(...grants) {
60
+ throw new Error('grant not supported for this construct');
61
+ }
62
+ subscription() {
63
+ throw new Error(`subscription not supported for ${this}`);
64
+ }
65
+ }
66
+ exports.ReactStaticConstruct = ReactStaticConstruct;
@@ -0,0 +1,17 @@
1
+ import { AppConstruct, AppProperties } from './types';
2
+ import { HttpRouteIntegration } from 'aws-cdk-lib/aws-apigatewayv2';
3
+ import { Attachable, Grantable } from '@fy-stack/types';
4
+ import { ITopicSubscription } from 'aws-cdk-lib/aws-sns';
5
+ import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
6
+ import { Construct } from 'constructs';
7
+ export declare class StaticWebsiteConstruct extends Construct implements AppConstruct {
8
+ private readonly static;
9
+ constructor(scope: Construct, id: string, props: AppProperties);
10
+ cloudfront(path: string): Record<string, cloudfront.BehaviorOptions>;
11
+ cloudfrontPolicy(distributionId: string): void;
12
+ api(): Record<string, HttpRouteIntegration>;
13
+ attach(attachable: Record<string, Attachable>): void;
14
+ grant(...grants: Grantable[]): void;
15
+ subscription(): ITopicSubscription;
16
+ }
17
+ //# sourceMappingURL=static-website-construct.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"static-website-construct.d.ts","sourceRoot":"","sources":["../../src/lib/static-website-construct.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AAIzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,qBAAa,sBAAuB,SAAQ,SAAU,YAAW,YAAY;IAC3E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;gBAEvB,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa;IA0B9D,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC;IAmBpE,gBAAgB,CAAC,cAAc,EAAE,MAAM;IAIvC,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAI3C,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAI7C,KAAK,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE;IAI5B,YAAY,IAAI,kBAAkB;CAGnC"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StaticWebsiteConstruct = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const cloudfront = tslib_1.__importStar(require("aws-cdk-lib/aws-cloudfront"));
6
+ const cloudfrontOrigin = tslib_1.__importStar(require("aws-cdk-lib/aws-cloudfront-origins"));
7
+ const s3 = tslib_1.__importStar(require("aws-cdk-lib/aws-s3"));
8
+ const s3Deploy = tslib_1.__importStar(require("aws-cdk-lib/aws-s3-deployment"));
9
+ const constructs_1 = require("constructs");
10
+ const cdk = tslib_1.__importStar(require("aws-cdk-lib"));
11
+ class StaticWebsiteConstruct extends constructs_1.Construct {
12
+ static;
13
+ constructor(scope, id, props) {
14
+ super(scope, id);
15
+ this.static = new s3.Bucket(this, `StaticBucket`, {
16
+ removalPolicy: cdk.RemovalPolicy.DESTROY,
17
+ autoDeleteObjects: true,
18
+ blockPublicAccess: s3.BlockPublicAccess.BLOCK_ACLS,
19
+ publicReadAccess: true,
20
+ websiteIndexDocument: 'index.html',
21
+ websiteErrorDocument: 'index.html',
22
+ cors: [
23
+ {
24
+ allowedHeaders: ['*'],
25
+ allowedOrigins: ['*'],
26
+ allowedMethods: [s3.HttpMethods.GET, s3.HttpMethods.HEAD],
27
+ },
28
+ ],
29
+ });
30
+ new s3Deploy.BucketDeployment(this, `StaticDeployment`, {
31
+ destinationBucket: this.static,
32
+ sources: [s3Deploy.Source.asset(props.output),],
33
+ retainOnDelete: false,
34
+ });
35
+ }
36
+ cloudfront(path) {
37
+ const staticOrigin = new cloudfrontOrigin.S3StaticWebsiteOrigin(this.static);
38
+ const staticBehavior = {
39
+ origin: staticOrigin,
40
+ cachePolicy: cloudfront.CachePolicy.CACHING_OPTIMIZED,
41
+ allowedMethods: cloudfront.AllowedMethods.ALLOW_GET_HEAD,
42
+ cachedMethods: cloudfront.CachedMethods.CACHE_GET_HEAD,
43
+ compress: true,
44
+ viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
45
+ };
46
+ return {
47
+ [`${path}/*`]: staticBehavior,
48
+ };
49
+ }
50
+ cloudfrontPolicy(distributionId) {
51
+ throw new Error(`cloudfrontPolicy not supported for ${this}`);
52
+ }
53
+ api() {
54
+ throw new Error('api not supported for this construct');
55
+ }
56
+ attach(attachable) {
57
+ throw new Error('attach not supported for this construct');
58
+ }
59
+ grant(...grants) {
60
+ throw new Error('grant not supported for this construct');
61
+ }
62
+ subscription() {
63
+ throw new Error(`subscription not supported for ${this}`);
64
+ }
65
+ }
66
+ exports.StaticWebsiteConstruct = StaticWebsiteConstruct;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@fy-stack/app-construct",
3
- "version": "0.0.128",
3
+ "version": "0.0.129",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
- "@fy-stack/types": "0.0.128"
6
+ "@fy-stack/types": "0.0.129"
7
7
  },
8
8
  "peerDependencies": {
9
9
  "aws-cdk-lib": "2.166.0",