@akdev1l/constructs 0.0.8 → 0.0.9

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.
@@ -1,14 +1,14 @@
1
- import * as s3 from 'aws-cdk-lib/aws-s3';
2
- import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment';
3
- import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
1
+ import { aws_certificatemanager as acm, aws_cloudfront as cloudfront, aws_s3 as s3, aws_s3_deployment as s3deploy } from 'aws-cdk-lib';
4
2
  import { Construct } from 'constructs';
5
3
  export interface SinglePageApplicationProps {
6
4
  package: string;
5
+ certificate: acm.Certificate;
6
+ domain: string;
7
7
  }
8
8
  export declare class SinglePageApplication extends Construct {
9
9
  readonly bucket: s3.Bucket;
10
10
  readonly deployment: s3deploy.BucketDeployment;
11
- readonly cdn: cloudfront.CloudFrontWebDistribution;
11
+ readonly cdn: cloudfront.Distribution;
12
12
  constructor(scope: Construct, id: string, props: SinglePageApplicationProps);
13
13
  }
14
14
  //# sourceMappingURL=single-page-application.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"single-page-application.d.ts","sourceRoot":"","sources":["../../../src/web/single-page-application.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAC;AAC1D,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,qBAAsB,SAAQ,SAAS;IAClD,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,gBAAgB,CAAC;IAC/C,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,yBAAyB,CAAC;gBAEvC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,0BAA0B;CAqC5E"}
1
+ {"version":3,"file":"single-page-application.d.ts","sourceRoot":"","sources":["../../../src/web/single-page-application.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,IAAI,GAAG,EAC7B,cAAc,IAAI,UAAU,EAE5B,MAAM,IAAI,EAAE,EACZ,iBAAiB,IAAI,QAAQ,EAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,qBAAsB,SAAQ,SAAS;IAClD,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,gBAAgB,CAAC;IAC/C,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,YAAY,CAAC;gBAE1B,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,0BAA0B;CAgC5E"}
@@ -35,9 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.SinglePageApplication = void 0;
37
37
  const cdk = __importStar(require("aws-cdk-lib"));
38
- const s3 = __importStar(require("aws-cdk-lib/aws-s3"));
39
- const s3deploy = __importStar(require("aws-cdk-lib/aws-s3-deployment"));
40
- const cloudfront = __importStar(require("aws-cdk-lib/aws-cloudfront"));
38
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
41
39
  const constructs_1 = require("constructs");
42
40
  class SinglePageApplication extends constructs_1.Construct {
43
41
  bucket;
@@ -46,35 +44,30 @@ class SinglePageApplication extends constructs_1.Construct {
46
44
  constructor(scope, id, props) {
47
45
  super(scope, id);
48
46
  // Create an S3 bucket for hosting the SPA
49
- this.bucket = new s3.Bucket(this, 'DeploymentBucket', {
47
+ this.bucket = new aws_cdk_lib_1.aws_s3.Bucket(this, 'DeploymentBucket', {
50
48
  websiteIndexDocument: 'index.html',
51
49
  websiteErrorDocument: 'error.html',
52
50
  publicReadAccess: false, // Allow public access to the files
53
51
  removalPolicy: cdk.RemovalPolicy.DESTROY, // Automatically delete bucket when stack is deleted
54
52
  });
55
53
  // Deploy the SPA files from the installed npm package to S3
56
- this.deployment = new s3deploy.BucketDeployment(this, 'Deployment', {
57
- sources: [s3deploy.Source.asset(`./node_modules/${props.package}/build`)], // Path to the built SPA files
54
+ this.deployment = new aws_cdk_lib_1.aws_s3_deployment.BucketDeployment(this, 'Deployment', {
55
+ sources: [aws_cdk_lib_1.aws_s3_deployment.Source.asset(`./node_modules/${props.package}/build`)], // Path to the built SPA files
58
56
  destinationBucket: this.bucket,
59
57
  });
60
- const oai = new cloudfront.OriginAccessIdentity(this, 'OriginAccessIdentity', {
58
+ const oai = new aws_cdk_lib_1.aws_cloudfront.OriginAccessIdentity(this, 'OriginAccessIdentity', {
61
59
  comment: 'OAI for accessing the S3 bucket securely',
62
60
  });
63
61
  // Create a CloudFront distribution for CDN
64
- this.cdn = new cloudfront.CloudFrontWebDistribution(this, 'ContentDeliveryNetwork', {
65
- originConfigs: [
66
- {
67
- s3OriginSource: {
68
- s3BucketSource: this.bucket,
69
- originAccessIdentity: oai,
70
- },
71
- behaviors: [
72
- {
73
- isDefaultBehavior: true,
74
- },
75
- ],
76
- },
77
- ],
62
+ this.cdn = new aws_cdk_lib_1.aws_cloudfront.Distribution(this, 'ContentDeliveryNetwork', {
63
+ defaultBehavior: {
64
+ origin: new aws_cdk_lib_1.aws_cloudfront_origins.S3Origin(this.bucket, {
65
+ originAccessIdentity: oai,
66
+ }),
67
+ viewerProtocolPolicy: aws_cdk_lib_1.aws_cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
68
+ },
69
+ domainNames: [props.domain],
70
+ certificate: props.certificate,
78
71
  });
79
72
  }
80
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"single-page-application.js","sourceRoot":"","sources":["../../../src/web/single-page-application.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,uDAAyC;AACzC,wEAA0D;AAC1D,uEAAyD;AACzD,2CAAuC;AAMvC,MAAa,qBAAsB,SAAQ,sBAAS;IACzC,MAAM,CAAY;IAClB,UAAU,CAA4B;IACtC,GAAG,CAAuC;IAEnD,YAAY,KAAgB,EAAE,EAAU,EAAE,KAAiC;QACzE,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjB,0CAA0C;QAC1C,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE;YACpD,oBAAoB,EAAE,YAAY;YAClC,oBAAoB,EAAE,YAAY;YAClC,gBAAgB,EAAE,KAAK,EAAE,mCAAmC;YAC5D,aAAa,EAAE,GAAG,CAAC,aAAa,CAAC,OAAO,EAAE,oDAAoD;SAC/F,CAAC,CAAC;QAEH,4DAA4D;QAC5D,IAAI,CAAC,UAAU,GAAG,IAAI,QAAQ,CAAC,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE;YAClE,OAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC,EAAE,8BAA8B;YACzG,iBAAiB,EAAE,IAAI,CAAC,MAAM;SAC/B,CAAC,CAAC;QAEH,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,oBAAoB,CAAC,IAAI,EAAE,sBAAsB,EAAE;YAC5E,OAAO,EAAE,0CAA0C;SACpD,CAAC,CAAC;QACH,2CAA2C;QAC3C,IAAI,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,yBAAyB,CAAC,IAAI,EAAE,wBAAwB,EAAE;YAClF,aAAa,EAAE;gBACb;oBACE,cAAc,EAAE;wBACd,cAAc,EAAE,IAAI,CAAC,MAAM;wBAC3B,oBAAoB,EAAE,GAAG;qBAC1B;oBACD,SAAS,EAAE;wBACT;4BACE,iBAAiB,EAAE,IAAI;yBACxB;qBACF;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF;AA1CD,sDA0CC"}
1
+ {"version":3,"file":"single-page-application.js","sourceRoot":"","sources":["../../../src/web/single-page-application.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,6CAMqB;AACrB,2CAAuC;AAQvC,MAAa,qBAAsB,SAAQ,sBAAS;IACzC,MAAM,CAAY;IAClB,UAAU,CAA4B;IACtC,GAAG,CAA0B;IAEtC,YAAY,KAAgB,EAAE,EAAU,EAAE,KAAiC;QACzE,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjB,0CAA0C;QAC1C,IAAI,CAAC,MAAM,GAAG,IAAI,oBAAE,CAAC,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE;YACpD,oBAAoB,EAAE,YAAY;YAClC,oBAAoB,EAAE,YAAY;YAClC,gBAAgB,EAAE,KAAK,EAAE,mCAAmC;YAC5D,aAAa,EAAE,GAAG,CAAC,aAAa,CAAC,OAAO,EAAE,oDAAoD;SAC/F,CAAC,CAAC;QAEH,4DAA4D;QAC5D,IAAI,CAAC,UAAU,GAAG,IAAI,+BAAQ,CAAC,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE;YAClE,OAAO,EAAE,CAAC,+BAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC,EAAE,8BAA8B;YACzG,iBAAiB,EAAE,IAAI,CAAC,MAAM;SAC/B,CAAC,CAAC;QAEH,MAAM,GAAG,GAAG,IAAI,4BAAU,CAAC,oBAAoB,CAAC,IAAI,EAAE,sBAAsB,EAAE;YAC5E,OAAO,EAAE,0CAA0C;SACpD,CAAC,CAAC;QACH,2CAA2C;QAC3C,IAAI,CAAC,GAAG,GAAG,IAAI,4BAAU,CAAC,YAAY,CAAC,IAAI,EAAE,wBAAwB,EAAE;YACrE,eAAe,EAAE;gBACf,MAAM,EAAE,IAAI,oCAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE;oBACnD,oBAAoB,EAAE,GAAG;iBAC1B,CAAC;gBACF,oBAAoB,EAAE,4BAAU,CAAC,oBAAoB,CAAC,iBAAiB;aACxE;YACD,WAAW,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;YAC3B,WAAW,EAAE,KAAK,CAAC,WAAW;SAC/B,CAAC,CAAC;IACL,CAAC;CACF;AArCD,sDAqCC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akdev1l/constructs",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "CDK Constructs",
5
5
  "private": false,
6
6
  "files": [