@akdev1l/constructs 0.0.6 → 0.0.8

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 +1 @@
1
- {"version":3,"file":"access-provider.d.ts","sourceRoot":"","sources":["../../../src/github/access-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,IAAI,GAAG,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,oBAAqB,SAAQ,SAAS;IACjD,OAAO,CAAC,MAAM,CAAC,aAAa,CAAiD;IAE7E,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,qBAAqB,CAAC;IAC7C,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;gBAEZ,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,yBAAyB;CAyB3E"}
1
+ {"version":3,"file":"access-provider.d.ts","sourceRoot":"","sources":["../../../src/github/access-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,IAAI,GAAG,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,oBAAqB,SAAQ,SAAS;IACjD,OAAO,CAAC,MAAM,CAAC,aAAa,CAAyC;IAErE,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,qBAAqB,CAAC;IAC7C,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;gBAEZ,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,yBAAyB;CAyB3E"}
@@ -4,21 +4,20 @@ exports.GithubAccessProvider = void 0;
4
4
  const aws_cdk_lib_1 = require("aws-cdk-lib");
5
5
  const constructs_1 = require("constructs");
6
6
  class GithubAccessProvider extends constructs_1.Construct {
7
- static GITHUB_DOMAIN = 'https://token.actions.githubusercontent.com';
7
+ static GITHUB_DOMAIN = 'token.actions.githubusercontent.com';
8
8
  provider;
9
9
  role;
10
10
  constructor(scope, id, props) {
11
11
  super(scope, id);
12
12
  this.provider = new aws_cdk_lib_1.aws_iam.OpenIdConnectProvider(this, 'GithubActionsProvider', {
13
- url: GithubAccessProvider.GITHUB_DOMAIN,
13
+ url: `https://${GithubAccessProvider.GITHUB_DOMAIN}`,
14
14
  clientIds: ['sts.amazonaws.com'],
15
15
  });
16
16
  const conditions = {
17
17
  StringLike: {
18
- [`${GithubAccessProvider.GITHUB_DOMAIN}:sub`]: [`repo:${props.repo}`],
18
+ [`${GithubAccessProvider.GITHUB_DOMAIN}:sub`]: `repo:${props.repo}`,
19
19
  },
20
20
  StringEquals: {
21
- 'token.actions.githubusercontent.com:iss': 'https://token.actions.githubusercontent.com',
22
21
  'token.actions.githubusercontent.com:aud': 'sts.amazonaws.com',
23
22
  },
24
23
  };
@@ -28,6 +27,7 @@ class GithubAccessProvider extends constructs_1.Construct {
28
27
  description: `Access for deployment from repo ${props.repo}`,
29
28
  maxSessionDuration: aws_cdk_lib_1.Duration.hours(2),
30
29
  });
30
+ this.role.addManagedPolicy(aws_cdk_lib_1.aws_iam.ManagedPolicy.fromAwsManagedPolicyName('AdministratorAccess'));
31
31
  }
32
32
  }
33
33
  exports.GithubAccessProvider = GithubAccessProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"access-provider.js","sourceRoot":"","sources":["../../../src/github/access-provider.ts"],"names":[],"mappings":";;;AAAA,6CAGqB;AACrB,2CAAuC;AAMvC,MAAa,oBAAqB,SAAQ,sBAAS;IACzC,MAAM,CAAC,aAAa,GAAG,6CAA6C,CAAC;IAEpE,QAAQ,CAA4B;IACpC,IAAI,CAAW;IAExB,YAAY,KAAgB,EAAE,EAAU,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G,CAAC,qBAAqB,CAAC,IAAI,EAAE,uBAAuB,EAAE;YAC3E,GAAG,EAAE,WAAW,oBAAoB,CAAC,aAAa,EAAE;YACpD,SAAS,EAAE,CAAC,mBAAmB,CAAC;SACjC,CAAC,CAAC;QAEH,MAAM,UAAU,GAAmB;YACjC,UAAU,EAAE;gBACV,CAAC,GAAG,oBAAoB,CAAC,aAAa,MAAM,CAAC,EAAE,QAAQ,KAAK,CAAC,IAAI,EAAE;aACpE;YACD,YAAY,EAAE;gBACZ,yCAAyC,EAAE,mBAAmB;aAC/D;SACF,CAAC;QAEF,IAAI,CAAC,IAAI,GAAG,IAAI,qBAAG,CAAC,IAAI,CAAC,IAAI,EAAE,mBAAmB,EAAE;YAClD,QAAQ,EAAE,eAAe;YACzB,SAAS,EAAE,IAAI,qBAAG,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,wBAAwB,EAAE,UAAU,CAAC;YAC3F,WAAW,EAAE,mCAAmC,KAAK,CAAC,IAAI,EAAE;YAC5D,kBAAkB,EAAE,sBAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;SACtC,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,qBAAG,CAAC,aAAa,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAChG,CAAC;;AA9BH,oDA+BC"}
@@ -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 * 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';
4
+ import { Construct } from 'constructs';
5
+ export interface SinglePageApplicationProps {
6
+ package: string;
7
+ }
8
+ export declare class SinglePageApplication extends Construct {
9
+ readonly bucket: s3.Bucket;
10
+ readonly deployment: s3deploy.BucketDeployment;
11
+ readonly cdn: cloudfront.CloudFrontWebDistribution;
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,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"}
@@ -0,0 +1,82 @@
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 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"));
41
+ const constructs_1 = require("constructs");
42
+ class SinglePageApplication extends constructs_1.Construct {
43
+ bucket;
44
+ deployment;
45
+ cdn;
46
+ constructor(scope, id, props) {
47
+ super(scope, id);
48
+ // Create an S3 bucket for hosting the SPA
49
+ this.bucket = new s3.Bucket(this, 'DeploymentBucket', {
50
+ websiteIndexDocument: 'index.html',
51
+ websiteErrorDocument: 'error.html',
52
+ publicReadAccess: false, // Allow public access to the files
53
+ removalPolicy: cdk.RemovalPolicy.DESTROY, // Automatically delete bucket when stack is deleted
54
+ });
55
+ // 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
58
+ destinationBucket: this.bucket,
59
+ });
60
+ const oai = new cloudfront.OriginAccessIdentity(this, 'OriginAccessIdentity', {
61
+ comment: 'OAI for accessing the S3 bucket securely',
62
+ });
63
+ // 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
+ ],
78
+ });
79
+ }
80
+ }
81
+ exports.SinglePageApplication = SinglePageApplication;
82
+ //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akdev1l/constructs",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "CDK Constructs",
5
5
  "private": false,
6
6
  "files": [