@fy-stack/cdn-construct 0.0.124 → 0.0.126

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/README.md CHANGED
@@ -1,7 +1,19 @@
1
- # cdn-construct
2
1
 
3
- This library was generated with [Nx](https://nx.dev).
2
+ # CDN Construct Documentation
4
3
 
5
- ## Building
4
+ ## `CDNConstruct`
5
+
6
+ The `CDNConstruct` class is a custom AWS CDK construct that sets up a CloudFront distribution based on the provided routing and resource configurations.
7
+
8
+ - **Properties**
9
+ - `distribution: cloudfront.Distribution`
10
+ - The CloudFront distribution managed by this construct.
11
+
12
+ - **Constructor**
13
+ - `constructor(scope: Construct, id: string, props: CDNConstructProps)`
14
+ - Initializes the CDN construct with a unique identifier and configuration options defined by `CDNConstructProps`.
15
+ - **Parameters**
16
+ - `scope`: The scope in which this construct is defined.
17
+ - `id`: The unique identifier for this construct.
18
+ - `props`: Properties required to set up the CDN construct, including route mappings and resource configurations.
6
19
 
7
- Run `nx build cdn-construct` to build the library.
@@ -1,6 +1,10 @@
1
1
  import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
2
2
  import { Construct } from 'constructs';
3
3
  import { CDNConstructProps } from './types';
4
+ /**
5
+ * CDNConstruct is a custom construct that sets up a CloudFront distribution
6
+ * based on provided routing and resource configurations.
7
+ */
4
8
  export declare class CDNConstruct extends Construct {
5
9
  distribution: cloudfront.Distribution;
6
10
  constructor(scope: Construct, id: string, props: CDNConstructProps);
@@ -1 +1 @@
1
- {"version":3,"file":"cdn-construct.d.ts","sourceRoot":"","sources":["../../src/lib/cdn-construct.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,qBAAa,YAAa,SAAQ,SAAS;IAClC,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC;gBAEjC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB;CAsDnE"}
1
+ {"version":3,"file":"cdn-construct.d.ts","sourceRoot":"","sources":["../../src/lib/cdn-construct.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;;GAGG;AACH,qBAAa,YAAa,SAAQ,SAAS;IAClC,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC;gBAEjC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB;CAkCnE"}
@@ -4,6 +4,10 @@ exports.CDNConstruct = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const cloudfront = tslib_1.__importStar(require("aws-cdk-lib/aws-cloudfront"));
6
6
  const constructs_1 = require("constructs");
7
+ /**
8
+ * CDNConstruct is a custom construct that sets up a CloudFront distribution
9
+ * based on provided routing and resource configurations.
10
+ */
7
11
  class CDNConstruct extends constructs_1.Construct {
8
12
  distribution;
9
13
  constructor(scope, id, props) {
@@ -29,25 +33,6 @@ class CDNConstruct extends constructs_1.Construct {
29
33
  additionalBehaviors,
30
34
  priceClass: cloudfront.PriceClass.PRICE_CLASS_100,
31
35
  });
32
- /*if (props.storage && uploadEnabled) {
33
- props.storage.bucket.addToResourcePolicy(
34
- new iam.PolicyStatement({
35
- effect: iam.Effect.ALLOW,
36
- actions: ['s3:GetObject'],
37
- principals: [new iam.ServicePrincipal('cloudfront.amazonaws.com')],
38
- resources: ['arn:aws:s3:::' + props.storage.bucket.bucketName + '/!*'],
39
- conditions: {
40
- StringEquals: {
41
- 'AWS:SourceArn':
42
- 'arn:aws:cloudfront::' +
43
- account +
44
- ':distribution/' +
45
- this.distribution.distributionId,
46
- },
47
- },
48
- })
49
- );
50
- }*/
51
36
  }
52
37
  }
53
38
  exports.CDNConstruct = CDNConstruct;
@@ -1,6 +1,12 @@
1
1
  import type { CDNResource, ResourceRef } from '@fy-stack/types';
2
2
  export interface CDNConstructProps {
3
+ /**
4
+ * A mapping of route paths to resource references
5
+ * */
3
6
  routes: Record<string, ResourceRef>;
7
+ /**
8
+ * An optional mapping of resource names to CDN resources.
9
+ * */
4
10
  resources?: Record<string, CDNResource | undefined>;
5
11
  }
6
12
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC,CAAC;CACrD"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,WAAW,iBAAiB;IAChC;;SAEK;IACL,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACpC;;SAEK;IACL,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC,CAAC;CACrD"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@fy-stack/cdn-construct",
3
- "version": "0.0.124",
3
+ "version": "0.0.126",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
- "@fy-stack/types": "0.0.124"
6
+ "@fy-stack/types": "0.0.126"
7
7
  },
8
8
  "peerDependencies": {
9
- "aws-cdk-lib": "2.164.1",
9
+ "aws-cdk-lib": "2.166.0",
10
10
  "constructs": "10.4.2"
11
11
  },
12
12
  "type": "commonjs",