@akdev1l/constructs 0.0.2 → 0.0.4

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,12 +1,15 @@
1
- import { Duration, aws_iam as iam, } from 'aws-cdk-lib';
2
- import { Construct } from 'constructs';
3
- export class GithubAccessProvider extends Construct {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GithubAccessProvider = void 0;
4
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
5
+ const constructs_1 = require("constructs");
6
+ class GithubAccessProvider extends constructs_1.Construct {
4
7
  static GITHUB_DOMAIN = 'https://token.actions.githubusercontent.com';
5
8
  provider;
6
9
  role;
7
10
  constructor(scope, id, props) {
8
11
  super(scope, id);
9
- this.provider = new iam.OpenIdConnectProvider(this, 'GithubActionsProvider', {
12
+ this.provider = new aws_cdk_lib_1.aws_iam.OpenIdConnectProvider(this, 'GithubActionsProvider', {
10
13
  url: GithubAccessProvider.GITHUB_DOMAIN,
11
14
  clientIds: ['sts.amazonaws.com'],
12
15
  });
@@ -19,12 +22,13 @@ export class GithubAccessProvider extends Construct {
19
22
  'token.actions.githubusercontent.com:aud': 'sts.amazonaws.com',
20
23
  },
21
24
  };
22
- this.role = new iam.Role(this, 'GithubActionsRole', {
25
+ this.role = new aws_cdk_lib_1.aws_iam.Role(this, 'GithubActionsRole', {
23
26
  roleName: 'GithubActions',
24
- assumedBy: new iam.WebIdentityPrincipal(this.provider.openIdConnectProviderArn, conditions),
27
+ assumedBy: new aws_cdk_lib_1.aws_iam.WebIdentityPrincipal(this.provider.openIdConnectProviderArn, conditions),
25
28
  description: `Access for deployment from repo ${props.repo}`,
26
- maxSessionDuration: Duration.hours(2),
29
+ maxSessionDuration: aws_cdk_lib_1.Duration.hours(2),
27
30
  });
28
31
  }
29
32
  }
33
+ exports.GithubAccessProvider = GithubAccessProvider;
30
34
  //# sourceMappingURL=access-provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"access-provider.js","sourceRoot":"","sources":["../../../src/github/access-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,OAAO,IAAI,GAAG,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAMvC,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IACzC,MAAM,CAAC,aAAa,GAAG,6CAA6C,CAAC;IAEpE,QAAQ,CAA4B;IACpC,IAAI,CAAW;IAExB,YAAY,KAAgB,EAAE,EAAU,EAAE,KAAgC;QACxE,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjB,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,CAAC,qBAAqB,CAAC,IAAI,EAAE,uBAAuB,EAAE;YAC3E,GAAG,EAAE,oBAAoB,CAAC,aAAa;YACvC,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,wBAAwB,EAAE;gBACxB,yCAAyC,EAAE,6CAA6C;gBACxF,yCAAyC,EAAE,mBAAmB;aAC/D;SACF,CAAC;QAEF,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,mBAAmB,EAAE;YAClD,QAAQ,EAAE,eAAe;YACzB,SAAS,EAAE,IAAI,GAAG,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,wBAAwB,EAAE,UAAU,CAAC;YAC3F,WAAW,EAAE,mCAAmC,KAAK,CAAC,IAAI,EAAE;YAC5D,kBAAkB,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;SACtC,CAAC,CAAC;IACL,CAAC"}
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,EAAE,KAAgC;QACxE,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEjB,IAAI,CAAC,QAAQ,GAAG,IAAI,qBAAG,CAAC,qBAAqB,CAAC,IAAI,EAAE,uBAAuB,EAAE;YAC3E,GAAG,EAAE,oBAAoB,CAAC,aAAa;YACvC,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,wBAAwB,EAAE;gBACxB,yCAAyC,EAAE,6CAA6C;gBACxF,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;IACL,CAAC;;AA9BH,oDA+BC"}
@@ -1,2 +1,18 @@
1
- export * from './access-provider';
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("./access-provider"), exports);
2
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/github/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/github/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC"}
@@ -1,2 +1,18 @@
1
- export * from './github';
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("./github"), exports);
2
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@akdev1l/constructs",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "CDK Constructs",
5
5
  "private": false,
6
+ "files": [
7
+ "build/dist"
8
+ ],
6
9
  "exports": {
7
10
  ".": {
8
11
  "types": "./build/dist/index.d.ts",
@@ -23,7 +26,7 @@
23
26
  },
24
27
  "license": "GPL-3.0",
25
28
  "author": "akdev1l",
26
- "type": "module",
29
+ "type": "commonjs",
27
30
  "main": "build/index.js",
28
31
  "scripts": {
29
32
  "prepublish": "npm run release",
package/eslint.config.ts DELETED
@@ -1,17 +0,0 @@
1
- import js from "@eslint/js";
2
- import globals from "globals";
3
- import tseslint from "typescript-eslint";
4
- import { defineConfig } from "eslint/config";
5
-
6
- export default defineConfig([
7
- {
8
- files: ["{src,test}/**/*.{js,mjs,cjs,ts,mts,cts}"],
9
- plugins: { js },
10
- extends: ["js/recommended"],
11
- languageOptions: { globals: globals.browser }
12
- },
13
- {
14
- ignores: ["build/**/*.{t,j}s"],
15
- },
16
- tseslint.configs.recommended,
17
- ]);
package/jest.config.js DELETED
@@ -1,17 +0,0 @@
1
- import { createDefaultPreset } from "ts-jest";
2
-
3
- const tsJestTransformCfg = createDefaultPreset({
4
- useESM: true,
5
- }).transform;
6
-
7
- export default {
8
- testEnvironment: "node",
9
- extensionsToTreatAsEsm: [".ts"],
10
- roots: ['<rootDir>/src'],
11
- moduleNameMapper: {
12
- '^@akdev1l/constructs$': '<rootDir>/src/index.ts'
13
- },
14
- transform: {
15
- ...tsJestTransformCfg,
16
- },
17
- };
@@ -1,18 +0,0 @@
1
- import { App, Stack } from 'aws-cdk-lib';
2
- import { GithubAccessProvider } from '../access-provider';
3
- import { describe, it, expect } from '@jest/globals';
4
-
5
- describe('Github Access Provider', () => {
6
- const app = new App();
7
- const stack = new Stack(app, 'stack', {});
8
-
9
- it('can build access provider', () => {
10
- const githubProvider = new GithubAccessProvider(stack, 'GithubProvider', {
11
- repo: 'akdev1l/cdk-constructs',
12
- });
13
-
14
- expect(githubProvider).not.toBeNull();
15
- expect(githubProvider.provider).not.toBeNull();
16
- expect(githubProvider.role).not.toBeNull();
17
- });
18
- });
@@ -1,42 +0,0 @@
1
- import {
2
- Duration,
3
- aws_iam as iam,
4
- } from 'aws-cdk-lib';
5
- import { Construct } from 'constructs';
6
-
7
- export interface GithubAccessProviderProps {
8
- repo: string;
9
- }
10
-
11
- export class GithubAccessProvider extends Construct {
12
- private static GITHUB_DOMAIN = 'https://token.actions.githubusercontent.com';
13
-
14
- readonly provider: iam.OpenIdConnectProvider;
15
- readonly role: iam.Role;
16
-
17
- constructor(scope: Construct, id: string, props: GithubAccessProviderProps) {
18
- super(scope, id);
19
-
20
- this.provider = new iam.OpenIdConnectProvider(this, 'GithubActionsProvider', {
21
- url: GithubAccessProvider.GITHUB_DOMAIN,
22
- clientIds: ['sts.amazonaws.com'],
23
- });
24
-
25
- const conditions: iam.Conditions = {
26
- StringLike: {
27
- [`${GithubAccessProvider.GITHUB_DOMAIN}:sub`]: `repo:${props.repo}`,
28
- },
29
- ForAllValuesStringEquals: {
30
- 'token.actions.githubusercontent.com:iss': 'https://token.actions.githubusercontent.com',
31
- 'token.actions.githubusercontent.com:aud': 'sts.amazonaws.com',
32
- },
33
- };
34
-
35
- this.role = new iam.Role(this, 'GithubActionsRole', {
36
- roleName: 'GithubActions',
37
- assumedBy: new iam.WebIdentityPrincipal(this.provider.openIdConnectProviderArn, conditions),
38
- description: `Access for deployment from repo ${props.repo}`,
39
- maxSessionDuration: Duration.hours(2),
40
- });
41
- }
42
- }
@@ -1 +0,0 @@
1
- export * from './access-provider';
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './github';
package/tsconfig.json DELETED
@@ -1,47 +0,0 @@
1
- {
2
- // Visit https://aka.ms/tsconfig to read more about this file
3
- "compilerOptions": {
4
- // File Layout
5
- "rootDir": "./src",
6
- "outDir": "./build/dist",
7
-
8
- // Environment Settings
9
- // See also https://aka.ms/tsconfig/module
10
- "module": "esnext",
11
- "target": "esnext",
12
- "types": [],
13
- // For nodejs:
14
- // "lib": ["esnext"],
15
- // "types": ["node"],
16
- // and npm install -D @types/node
17
-
18
- // Other Outputs
19
- "sourceMap": true,
20
- "declaration": true,
21
- "declarationMap": true,
22
-
23
- // Stricter Typechecking Options
24
- "noUncheckedIndexedAccess": true,
25
- "exactOptionalPropertyTypes": true,
26
-
27
- // Style Options
28
- // "noImplicitReturns": true,
29
- // "noImplicitOverride": true,
30
- // "noUnusedLocals": true,
31
- // "noUnusedParameters": true,
32
- // "noFallthroughCasesInSwitch": true,
33
- // "noPropertyAccessFromIndexSignature": true,
34
-
35
- // Recommended Options
36
- "moduleResolution": "bundler",
37
- "strict": true,
38
- "jsx": "react-jsx",
39
- "verbatimModuleSyntax": true,
40
- "isolatedModules": true,
41
- "noUncheckedSideEffectImports": true,
42
- "moduleDetection": "force",
43
- "skipLibCheck": true,
44
- },
45
- "include": ["src"],
46
- "exclude": ["**/__tests__"]
47
- }