@akdev1l/constructs 0.0.7 → 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,2 +1,3 @@
1
1
  export * from './github';
2
+ export * from './web';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC"}
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./github"), exports);
18
+ __exportStar(require("./web"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,wCAAsB"}
@@ -0,0 +1,2 @@
1
+ export * from './single-page-application';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/web/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./single-page-application"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/web/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C"}
@@ -0,0 +1,14 @@
1
+ import { aws_certificatemanager as acm, aws_cloudfront as cloudfront, aws_s3 as s3, aws_s3_deployment as s3deploy } from 'aws-cdk-lib';
2
+ import { Construct } from 'constructs';
3
+ export interface SinglePageApplicationProps {
4
+ package: string;
5
+ certificate: acm.Certificate;
6
+ domain: string;
7
+ }
8
+ export declare class SinglePageApplication extends Construct {
9
+ readonly bucket: s3.Bucket;
10
+ readonly deployment: s3deploy.BucketDeployment;
11
+ readonly cdn: cloudfront.Distribution;
12
+ constructor(scope: Construct, id: string, props: SinglePageApplicationProps);
13
+ }
14
+ //# sourceMappingURL=single-page-application.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.SinglePageApplication = void 0;
37
+ const cdk = __importStar(require("aws-cdk-lib"));
38
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
39
+ const constructs_1 = require("constructs");
40
+ class SinglePageApplication extends constructs_1.Construct {
41
+ bucket;
42
+ deployment;
43
+ cdn;
44
+ constructor(scope, id, props) {
45
+ super(scope, id);
46
+ // Create an S3 bucket for hosting the SPA
47
+ this.bucket = new aws_cdk_lib_1.aws_s3.Bucket(this, 'DeploymentBucket', {
48
+ websiteIndexDocument: 'index.html',
49
+ websiteErrorDocument: 'error.html',
50
+ publicReadAccess: false, // Allow public access to the files
51
+ removalPolicy: cdk.RemovalPolicy.DESTROY, // Automatically delete bucket when stack is deleted
52
+ });
53
+ // Deploy the SPA files from the installed npm package to S3
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
56
+ destinationBucket: this.bucket,
57
+ });
58
+ const oai = new aws_cdk_lib_1.aws_cloudfront.OriginAccessIdentity(this, 'OriginAccessIdentity', {
59
+ comment: 'OAI for accessing the S3 bucket securely',
60
+ });
61
+ // Create a CloudFront distribution for CDN
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,
71
+ });
72
+ }
73
+ }
74
+ exports.SinglePageApplication = SinglePageApplication;
75
+ //# sourceMappingURL=single-page-application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"single-page-application.js","sourceRoot":"","sources":["../../../src/web/single-page-application.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;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AC,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.7",
3
+ "version": "0.0.9",
4
4
  "description": "CDK Constructs",
5
5
  "private": false,
6
6
  "files": [