@aws/nx-plugin 0.1.6 → 0.2.1
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/LICENSE-THIRD-PARTY +1554 -3241
- package/generators.json +1 -13
- package/package.json +14 -14
- package/src/cloudscape-website/app/README.md +84 -48
- package/src/cloudscape-website/app/__snapshots__/generator.spec.ts.snap +168 -233
- package/src/cloudscape-website/app/files/app/README.md.template +44 -0
- package/src/cloudscape-website/app/files/app/src/layouts/App/index.tsx.template +40 -43
- package/src/cloudscape-website/app/files/app/src/layouts/App/navitems.ts.template +3 -3
- package/src/cloudscape-website/app/files/app/src/layouts/Routes/index.tsx.template +4 -6
- package/src/cloudscape-website/app/files/app/src/main.tsx.template +7 -10
- package/src/cloudscape-website/app/files/app/src/pages/Home/index.tsx.template +0 -2
- package/src/cloudscape-website/app/files/common/constructs/src/app/static-websites/__websiteNameKebabCase__.ts.template +13 -0
- package/src/cloudscape-website/app/files/common/constructs/src/{__websiteNameKebabCase__ → core}/static-website.ts.template +79 -144
- package/src/cloudscape-website/app/generator.js +90 -74
- package/src/cloudscape-website/app/generator.js.map +1 -1
- package/src/cloudscape-website/app/schema.d.ts +3 -5
- package/src/cloudscape-website/app/schema.json +1 -24
- package/src/cloudscape-website/cognito-auth/README.md +53 -32
- package/src/cloudscape-website/cognito-auth/__snapshots__/generator.spec.ts.snap +162 -124
- package/src/cloudscape-website/cognito-auth/files/app/components/CognitoAuth/index.tsx.template +53 -39
- package/src/cloudscape-website/cognito-auth/files/common/constructs/src/core/user-identity.ts.template +168 -0
- package/src/cloudscape-website/cognito-auth/generator.js +130 -47
- package/src/cloudscape-website/cognito-auth/generator.js.map +1 -1
- package/src/cloudscape-website/cognito-auth/schema.d.ts +1 -0
- package/src/cloudscape-website/cognito-auth/schema.json +7 -1
- package/src/cloudscape-website/runtime-config/__snapshots__/generator.spec.ts.snap +20 -15
- package/src/cloudscape-website/runtime-config/files/app/components/RuntimeConfig/index.tsx.template +7 -10
- package/src/cloudscape-website/runtime-config/files/app/hooks/useRuntimeConfig.tsx.template +13 -0
- package/src/cloudscape-website/runtime-config/generator.js +4 -2
- package/src/cloudscape-website/runtime-config/generator.js.map +1 -1
- package/src/infra/app/README.md +71 -46
- package/src/infra/app/__snapshots__/generator.spec.ts.snap +184 -305
- package/src/infra/app/files/app/README.md.template +76 -0
- package/src/infra/app/files/app/src/main.ts.template +18 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/aws-prototyping.guard +1282 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/cfn-nag.guard +6839 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/hipaa-security.guard +2807 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/nist-csf.guard +2585 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/pci-dss-3-2-1.guard +2236 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/wa-reliability-pillar.guard +885 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/wa-security-pillar.guard +2205 -0
- package/src/infra/app/files/common/constructs/src/core/cfn-guard.ts.template +63 -0
- package/src/infra/app/generator.js +36 -7
- package/src/infra/app/generator.js.map +1 -1
- package/src/infra/app/schema.d.ts +10 -1
- package/src/infra/app/schema.json +16 -8
- package/src/trpc/backend/README.md +102 -80
- package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +42 -19
- package/src/trpc/backend/files/backend/README.md.template +33 -0
- package/src/trpc/backend/files/common/constructs/src/app/trpc-apis/__apiNameKebabCase__.ts.template +18 -0
- package/src/trpc/backend/files/common/constructs/src/{__apiNameKebabCase__/index.ts.template → core/trpc-api.ts.template} +12 -16
- package/src/trpc/backend/files/schema/README.md.template +33 -0
- package/src/trpc/backend/generator.js +30 -44
- package/src/trpc/backend/generator.js.map +1 -1
- package/src/trpc/backend/schema.d.ts +3 -1
- package/src/trpc/backend/schema.json +8 -13
- package/src/trpc/react/README.md +46 -66
- package/src/trpc/react/__snapshots__/generator.spec.ts.snap +104 -65
- package/src/trpc/react/files/src/components/TrpcClients/IsolatedTrpcProvider.tsx.template +75 -0
- package/src/trpc/react/files/src/components/TrpcClients/TrpcApis.tsx.template +1 -0
- package/src/trpc/react/files/src/components/TrpcClients/TrpcClientProviders.tsx.template +10 -0
- package/src/trpc/react/files/src/components/TrpcClients/index.tsx.template +5 -0
- package/src/trpc/react/files/src/hooks/useSigV4.tsx.template +38 -0
- package/src/trpc/react/files/src/hooks/use__apiNameClassName__.tsx.template +3 -0
- package/src/trpc/react/generator.js +124 -25
- package/src/trpc/react/generator.js.map +1 -1
- package/src/trpc/react/schema.json +2 -2
- package/src/ts/lib/__snapshots__/generator.spec.ts.snap +47 -93
- package/src/ts/lib/eslint.d.ts +1 -2
- package/src/ts/lib/eslint.js +62 -21
- package/src/ts/lib/eslint.js.map +1 -1
- package/src/ts/lib/files/README.md.template +33 -0
- package/src/ts/lib/generator.js +44 -5
- package/src/ts/lib/generator.js.map +1 -1
- package/src/ts/lib/schema.d.ts +1 -4
- package/src/ts/lib/schema.json +2 -21
- package/src/ts/lib/ts-project-utils.js +3 -18
- package/src/ts/lib/ts-project-utils.js.map +1 -1
- package/src/ts/lib/vitest.js +12 -0
- package/src/ts/lib/vitest.js.map +1 -1
- package/src/utils/ast.d.ts +13 -0
- package/src/utils/ast.js +102 -0
- package/src/utils/ast.js.map +1 -0
- package/src/utils/files/common/constructs/src/app/index.ts.template +0 -0
- package/src/utils/files/common/constructs/src/{runtime-config → core}/runtime-config.ts.template +3 -5
- package/src/utils/files/common/constructs/src/index.ts.template +2 -1
- package/src/utils/files/common/readme/README.md.template +33 -0
- package/src/utils/files/common/types/src/runtime-config.ts.template +2 -13
- package/src/utils/format.d.ts +1 -1
- package/src/utils/format.js +2 -2
- package/src/utils/format.js.map +1 -1
- package/src/utils/names.d.ts +2 -0
- package/src/utils/names.js +27 -0
- package/src/utils/names.js.map +1 -0
- package/src/utils/npm-scope.js.map +1 -1
- package/src/utils/paths.js.map +1 -1
- package/src/utils/shared-constructs.js +37 -4
- package/src/utils/shared-constructs.js.map +1 -1
- package/src/utils/test.d.ts +2 -0
- package/src/utils/test.js +19 -0
- package/src/utils/test.js.map +1 -0
- package/src/utils/versions.d.ts +15 -9
- package/src/utils/versions.js +14 -8
- package/src/utils/versions.js.map +1 -1
- package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/cloudfront-web-acl.ts.template +0 -317
- package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/index.ts.template +0 -4
- package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/webacl_event_handler/index.ts.template +0 -301
- package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/index.ts.template +0 -4
- package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/user-identity.ts.template +0 -66
- package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/userpool-with-mfa.ts.template +0 -70
- package/src/gitlab/generator.d.ts +0 -8
- package/src/gitlab/generator.js +0 -16
- package/src/gitlab/generator.js.map +0 -1
- package/src/gitlab/schema.d.ts +0 -9
- package/src/gitlab/schema.json +0 -52
- package/src/infra/app/files/src/main.ts.template +0 -37
- package/src/trpc/react/files/src/components/TRPCClientProvider/index.tsx.template +0 -34
- package/src/trpc/react/files/src/hooks/useTrpc.tsx.template +0 -5
- package/src/ts/cjs-to-esm/generator.d.ts +0 -12
- package/src/ts/cjs-to-esm/generator.js +0 -189
- package/src/ts/cjs-to-esm/generator.js.map +0 -1
- package/src/ts/cjs-to-esm/schema.d.ts +0 -9
- package/src/ts/cjs-to-esm/schema.json +0 -28
- /package/src/infra/app/files/{cdk.json → app/cdk.json} +0 -0
- /package/src/infra/app/files/{src → app/src}/stacks/application-stack.ts.template +0 -0
- /package/src/utils/files/common/constructs/src/{runtime-config → core}/index.ts.template +0 -0
|
@@ -11,6 +11,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
11
11
|
const npm_scope_1 = require("./npm-scope");
|
|
12
12
|
const generator_1 = tslib_1.__importDefault(require("../ts/lib/generator"));
|
|
13
13
|
const versions_1 = require("./versions");
|
|
14
|
+
const format_1 = require("./format");
|
|
14
15
|
exports.PACKAGES_DIR = 'packages';
|
|
15
16
|
exports.TYPE_DEFINITIONS_NAME = 'common-types';
|
|
16
17
|
exports.SHARED_CONSTRUCTS_NAME = 'common-constructs';
|
|
@@ -19,30 +20,62 @@ exports.SHARED_CONSTRUCTS_DIR = 'common/constructs';
|
|
|
19
20
|
function sharedConstructsGenerator(tree) {
|
|
20
21
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
22
|
const npmScopePrefix = (0, npm_scope_1.getNpmScopePrefix)(tree);
|
|
23
|
+
updateGitignore(tree);
|
|
22
24
|
if (!tree.exists((0, devkit_1.joinPathFragments)(exports.PACKAGES_DIR, exports.TYPE_DEFINITIONS_DIR, 'project.json'))) {
|
|
23
25
|
yield (0, generator_1.default)(tree, {
|
|
24
26
|
name: exports.TYPE_DEFINITIONS_NAME,
|
|
25
27
|
directory: exports.PACKAGES_DIR,
|
|
26
28
|
subDirectory: exports.TYPE_DEFINITIONS_DIR,
|
|
27
|
-
unitTestRunner: 'none',
|
|
28
29
|
});
|
|
29
30
|
tree.delete((0, devkit_1.joinPathFragments)(exports.PACKAGES_DIR, exports.TYPE_DEFINITIONS_DIR, 'src'));
|
|
30
|
-
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files', exports.TYPE_DEFINITIONS_DIR), (0, devkit_1.joinPathFragments)(exports.PACKAGES_DIR, exports.TYPE_DEFINITIONS_DIR), {
|
|
31
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files', exports.TYPE_DEFINITIONS_DIR, 'src'), (0, devkit_1.joinPathFragments)(exports.PACKAGES_DIR, exports.TYPE_DEFINITIONS_DIR, 'src'), {
|
|
32
|
+
npmScopePrefix,
|
|
33
|
+
}, {
|
|
34
|
+
overwriteStrategy: devkit_1.OverwriteStrategy.KeepExisting,
|
|
35
|
+
});
|
|
36
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files', 'common', 'readme'), (0, devkit_1.joinPathFragments)(exports.PACKAGES_DIR, exports.TYPE_DEFINITIONS_DIR), {
|
|
37
|
+
fullyQualifiedName: `${npmScopePrefix}${exports.TYPE_DEFINITIONS_NAME}`,
|
|
38
|
+
name: exports.TYPE_DEFINITIONS_NAME,
|
|
39
|
+
pkgMgrCmd: (0, devkit_1.getPackageManagerCommand)().exec,
|
|
40
|
+
}, {
|
|
41
|
+
overwriteStrategy: devkit_1.OverwriteStrategy.Overwrite,
|
|
42
|
+
});
|
|
43
|
+
(0, format_1.formatFilesInSubtree)(tree);
|
|
31
44
|
}
|
|
32
45
|
if (!tree.exists((0, devkit_1.joinPathFragments)(exports.PACKAGES_DIR, exports.SHARED_CONSTRUCTS_DIR, 'project.json'))) {
|
|
33
46
|
yield (0, generator_1.default)(tree, {
|
|
34
47
|
name: exports.SHARED_CONSTRUCTS_NAME,
|
|
35
48
|
directory: exports.PACKAGES_DIR,
|
|
36
49
|
subDirectory: exports.SHARED_CONSTRUCTS_DIR,
|
|
37
|
-
unitTestRunner: 'none',
|
|
38
50
|
});
|
|
39
51
|
tree.delete((0, devkit_1.joinPathFragments)(exports.PACKAGES_DIR, exports.SHARED_CONSTRUCTS_DIR, 'src'));
|
|
40
|
-
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files', exports.SHARED_CONSTRUCTS_DIR), (0, devkit_1.joinPathFragments)(exports.PACKAGES_DIR, exports.SHARED_CONSTRUCTS_DIR), {
|
|
52
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files', exports.SHARED_CONSTRUCTS_DIR, 'src'), (0, devkit_1.joinPathFragments)(exports.PACKAGES_DIR, exports.SHARED_CONSTRUCTS_DIR, 'src'), {
|
|
41
53
|
npmScopePrefix,
|
|
42
54
|
scopeAlias: (0, npm_scope_1.toScopeAlias)(npmScopePrefix),
|
|
55
|
+
}, {
|
|
56
|
+
overwriteStrategy: devkit_1.OverwriteStrategy.KeepExisting,
|
|
57
|
+
});
|
|
58
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files', 'common', 'readme'), (0, devkit_1.joinPathFragments)(exports.PACKAGES_DIR, exports.SHARED_CONSTRUCTS_DIR), {
|
|
59
|
+
fullyQualifiedName: `${npmScopePrefix}${exports.SHARED_CONSTRUCTS_NAME}`,
|
|
60
|
+
name: exports.SHARED_CONSTRUCTS_NAME,
|
|
61
|
+
pkgMgrCmd: (0, devkit_1.getPackageManagerCommand)().exec,
|
|
62
|
+
}, {
|
|
63
|
+
overwriteStrategy: devkit_1.OverwriteStrategy.Overwrite,
|
|
43
64
|
});
|
|
44
65
|
(0, devkit_1.addDependenciesToPackageJson)(tree, (0, versions_1.withVersions)(['constructs', 'aws-cdk-lib']), {});
|
|
66
|
+
(0, format_1.formatFilesInSubtree)(tree);
|
|
45
67
|
}
|
|
46
68
|
});
|
|
47
69
|
}
|
|
70
|
+
const updateGitignore = (tree) => {
|
|
71
|
+
const gitignore = tree.exists('.gitignore')
|
|
72
|
+
? tree.read('.gitignore', 'utf-8')
|
|
73
|
+
: '';
|
|
74
|
+
const regex = /runtime-config.json/gm;
|
|
75
|
+
const hasRuntimeConfig = regex.test(gitignore !== null && gitignore !== void 0 ? gitignore : '');
|
|
76
|
+
if (hasRuntimeConfig) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
tree.write('.gitignore', `${gitignore}\n\nruntime-config.json`);
|
|
80
|
+
};
|
|
48
81
|
//# sourceMappingURL=shared-constructs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-constructs.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/utils/shared-constructs.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"shared-constructs.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/utils/shared-constructs.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTreeUsingTsSolutionSetup = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
const vitest_1 = require("vitest");
|
|
10
|
+
const testing_1 = require("@nx/devkit/testing");
|
|
11
|
+
const ts_solution_setup_1 = tslib_1.__importDefault(require("@nx/js/src/utils/typescript/ts-solution-setup"));
|
|
12
|
+
const createTreeUsingTsSolutionSetup = () => {
|
|
13
|
+
vitest_1.vi.spyOn(ts_solution_setup_1.default, 'isUsingTsSolutionSetup').mockImplementation(() => true);
|
|
14
|
+
const tree = (0, testing_1.createTreeWithEmptyWorkspace)();
|
|
15
|
+
tree.write('tsconfig.json', '{}');
|
|
16
|
+
return tree;
|
|
17
|
+
};
|
|
18
|
+
exports.createTreeUsingTsSolutionSetup = createTreeUsingTsSolutionSetup;
|
|
19
|
+
//# sourceMappingURL=test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/utils/test.ts"],"names":[],"mappings":";;;;AAAA;;;GAGG;AACH,mCAA4B;AAC5B,gDAAkE;AAElE,8GAA0E;AAEnE,MAAM,8BAA8B,GAAG,GAAS,EAAE;IACvD,WAAE,CAAC,KAAK,CAAC,2BAAa,EAAE,wBAAwB,CAAC,CAAC,kBAAkB,CAClE,GAAG,EAAE,CAAC,IAAI,CACX,CAAC;IAEF,MAAM,IAAI,GAAG,IAAA,sCAA4B,GAAE,CAAC;IAE5C,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AATW,QAAA,8BAA8B,kCASzC"}
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -3,27 +3,33 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
export declare const VERSIONS: {
|
|
6
|
+
readonly '@cdklabs/cdk-validator-cfnguard': "^0.0.60";
|
|
6
7
|
readonly '@aws-cdk/aws-cognito-identitypool-alpha': "^2.166.0-alpha.0";
|
|
7
|
-
readonly '@aws-
|
|
8
|
-
readonly '@aws-sdk/
|
|
9
|
-
readonly '@aws/pdk': "^0.25.7";
|
|
8
|
+
readonly '@aws-sdk/client-cognito-identity': "^3.721.0";
|
|
9
|
+
readonly '@aws-sdk/credential-provider-cognito-identity': "^3.721.0";
|
|
10
10
|
readonly '@aws-lambda-powertools/logger': "^2.11.0";
|
|
11
11
|
readonly '@aws-lambda-powertools/metrics': "^2.11.0";
|
|
12
12
|
readonly '@aws-lambda-powertools/tracer': "^2.11.0";
|
|
13
13
|
readonly '@cloudscape-design/board-components': "^3.0.84";
|
|
14
14
|
readonly '@cloudscape-design/components': "^3.0.823";
|
|
15
|
+
readonly '@cloudscape-design/global-styles': "^1.0.34";
|
|
15
16
|
readonly '@tanstack/react-query': "^5.59.20";
|
|
16
|
-
readonly '@trpc/react-query': "11.0.0-rc.
|
|
17
|
-
readonly '@trpc/client': "11.0.0-rc.
|
|
18
|
-
readonly '@trpc/server': "11.0.0-rc.
|
|
17
|
+
readonly '@trpc/react-query': "11.0.0-rc.700";
|
|
18
|
+
readonly '@trpc/client': "11.0.0-rc.700";
|
|
19
|
+
readonly '@trpc/server': "11.0.0-rc.700";
|
|
19
20
|
readonly '@types/aws-lambda': "^8.10.145";
|
|
21
|
+
readonly aws4fetch: "^1.0.20";
|
|
20
22
|
readonly 'aws-cdk': "^2.166.0";
|
|
21
23
|
readonly 'aws-cdk-lib': "^2.166.0";
|
|
22
24
|
readonly 'aws-xray-sdk-core': "^3.10.2";
|
|
23
|
-
readonly 'cdk-
|
|
25
|
+
readonly 'cdk-app-cli': "^0.0.427";
|
|
24
26
|
readonly constructs: "^10.4.2";
|
|
25
27
|
readonly esbuild: "^0.24.0";
|
|
26
|
-
readonly '
|
|
28
|
+
readonly 'eslint-plugin-prettier': "^5.2.2";
|
|
29
|
+
readonly 'oidc-client-ts': "^3.1.0";
|
|
30
|
+
readonly prettier: "^3.4.2";
|
|
31
|
+
readonly 'react-oidc-context': "^3.2.0";
|
|
32
|
+
readonly 'react-router-dom': "^7.1.1";
|
|
27
33
|
readonly 'source-map-support': "^0.5.21";
|
|
28
34
|
readonly tsx: "^4.19.2";
|
|
29
35
|
readonly zod: "^3.23.8";
|
|
@@ -32,5 +38,5 @@ export declare const VERSIONS: {
|
|
|
32
38
|
* Add versions to the given dependencies
|
|
33
39
|
*/
|
|
34
40
|
export declare const withVersions: (deps: (keyof typeof VERSIONS)[]) => {
|
|
35
|
-
[k: string]: "^
|
|
41
|
+
[k: string]: "^0.0.60" | "^2.166.0-alpha.0" | "^3.721.0" | "^2.11.0" | "^3.0.84" | "^3.0.823" | "^1.0.34" | "^5.59.20" | "11.0.0-rc.700" | "^8.10.145" | "^1.0.20" | "^2.166.0" | "^3.10.2" | "^0.0.427" | "^10.4.2" | "^0.24.0" | "^5.2.2" | "^3.1.0" | "^3.4.2" | "^3.2.0" | "^7.1.1" | "^0.5.21" | "^4.19.2" | "^3.23.8";
|
|
36
42
|
};
|
package/src/utils/versions.js
CHANGED
|
@@ -6,27 +6,33 @@ exports.withVersions = exports.VERSIONS = void 0;
|
|
|
6
6
|
* SPDX-License-Identifier: Apache-2.0
|
|
7
7
|
*/
|
|
8
8
|
exports.VERSIONS = {
|
|
9
|
+
'@cdklabs/cdk-validator-cfnguard': '^0.0.60',
|
|
9
10
|
'@aws-cdk/aws-cognito-identitypool-alpha': '^2.166.0-alpha.0',
|
|
10
|
-
'@aws-
|
|
11
|
-
'@aws-sdk/
|
|
12
|
-
'@aws/pdk': '^0.25.7',
|
|
11
|
+
'@aws-sdk/client-cognito-identity': '^3.721.0',
|
|
12
|
+
'@aws-sdk/credential-provider-cognito-identity': '^3.721.0',
|
|
13
13
|
'@aws-lambda-powertools/logger': '^2.11.0',
|
|
14
14
|
'@aws-lambda-powertools/metrics': '^2.11.0',
|
|
15
15
|
'@aws-lambda-powertools/tracer': '^2.11.0',
|
|
16
16
|
'@cloudscape-design/board-components': '^3.0.84',
|
|
17
17
|
'@cloudscape-design/components': '^3.0.823',
|
|
18
|
+
'@cloudscape-design/global-styles': '^1.0.34',
|
|
18
19
|
'@tanstack/react-query': '^5.59.20',
|
|
19
|
-
'@trpc/react-query': '11.0.0-rc.
|
|
20
|
-
'@trpc/client': '11.0.0-rc.
|
|
21
|
-
'@trpc/server': '11.0.0-rc.
|
|
20
|
+
'@trpc/react-query': '11.0.0-rc.700',
|
|
21
|
+
'@trpc/client': '11.0.0-rc.700',
|
|
22
|
+
'@trpc/server': '11.0.0-rc.700',
|
|
22
23
|
'@types/aws-lambda': '^8.10.145',
|
|
24
|
+
aws4fetch: '^1.0.20',
|
|
23
25
|
'aws-cdk': '^2.166.0',
|
|
24
26
|
'aws-cdk-lib': '^2.166.0',
|
|
25
27
|
'aws-xray-sdk-core': '^3.10.2',
|
|
26
|
-
'cdk-
|
|
28
|
+
'cdk-app-cli': '^0.0.427',
|
|
27
29
|
constructs: '^10.4.2',
|
|
28
30
|
esbuild: '^0.24.0',
|
|
29
|
-
'
|
|
31
|
+
'eslint-plugin-prettier': '^5.2.2',
|
|
32
|
+
'oidc-client-ts': '^3.1.0',
|
|
33
|
+
prettier: '^3.4.2',
|
|
34
|
+
'react-oidc-context': '^3.2.0',
|
|
35
|
+
'react-router-dom': '^7.1.1',
|
|
30
36
|
'source-map-support': '^0.5.21',
|
|
31
37
|
tsx: '^4.19.2',
|
|
32
38
|
zod: '^3.23.8',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/utils/versions.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,QAAQ,GAAG;IACtB,
|
|
1
|
+
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/utils/versions.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,QAAQ,GAAG;IACtB,iCAAiC,EAAE,SAAS;IAC5C,yCAAyC,EAAE,kBAAkB;IAC7D,kCAAkC,EAAE,UAAU;IAC9C,+CAA+C,EAAE,UAAU;IAC3D,+BAA+B,EAAE,SAAS;IAC1C,gCAAgC,EAAE,SAAS;IAC3C,+BAA+B,EAAE,SAAS;IAC1C,qCAAqC,EAAE,SAAS;IAChD,+BAA+B,EAAE,UAAU;IAC3C,kCAAkC,EAAE,SAAS;IAC7C,uBAAuB,EAAE,UAAU;IACnC,mBAAmB,EAAE,eAAe;IACpC,cAAc,EAAE,eAAe;IAC/B,cAAc,EAAE,eAAe;IAC/B,mBAAmB,EAAE,WAAW;IAChC,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,UAAU;IACrB,aAAa,EAAE,UAAU;IACzB,mBAAmB,EAAE,SAAS;IAC9B,aAAa,EAAE,UAAU;IACzB,UAAU,EAAE,SAAS;IACrB,OAAO,EAAE,SAAS;IAClB,wBAAwB,EAAE,QAAQ;IAClC,gBAAgB,EAAE,QAAQ;IAC1B,QAAQ,EAAE,QAAQ;IAClB,oBAAoB,EAAE,QAAQ;IAC9B,kBAAkB,EAAE,QAAQ;IAC5B,oBAAoB,EAAE,SAAS;IAC/B,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;CACN,CAAC;AACX;;GAEG;AACI,MAAM,YAAY,GAAG,CAAC,IAA+B,EAAE,EAAE,CAC9D,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,gBAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AADjD,QAAA,YAAY,gBACqC"}
|
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
SPDX-License-Identifier: Apache-2.0 */
|
|
3
|
-
import * as url from "url";
|
|
4
|
-
import { PDKNag } from "@aws/pdk/pdk-nag";
|
|
5
|
-
import { CustomResource, Duration, Stack } from "aws-cdk-lib";
|
|
6
|
-
import {
|
|
7
|
-
Effect,
|
|
8
|
-
PolicyDocument,
|
|
9
|
-
PolicyStatement,
|
|
10
|
-
Role,
|
|
11
|
-
ServicePrincipal,
|
|
12
|
-
} from "aws-cdk-lib/aws-iam";
|
|
13
|
-
import { Runtime } from "aws-cdk-lib/aws-lambda";
|
|
14
|
-
import { Provider } from "aws-cdk-lib/custom-resources";
|
|
15
|
-
import { NagSuppressions } from "cdk-nag";
|
|
16
|
-
import { Construct } from "constructs";
|
|
17
|
-
import { NodejsFunction } from "aws-cdk-lib/aws-lambda-nodejs";
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Represents a WAF V2 managed rule.
|
|
21
|
-
*/
|
|
22
|
-
export interface ManagedRule {
|
|
23
|
-
/**
|
|
24
|
-
* The name of the managed rule group vendor. You use this, along with the rule group name, to identify the rule group.
|
|
25
|
-
*/
|
|
26
|
-
readonly vendor: string;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The name of the managed rule group. You use this, along with the vendor name, to identify the rule group.
|
|
30
|
-
*/
|
|
31
|
-
readonly name: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Type of Cidr.
|
|
36
|
-
*/
|
|
37
|
-
export type CidrType = "IPV4" | "IPV6";
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Representation of a CIDR range.
|
|
41
|
-
*/
|
|
42
|
-
export interface CidrAllowList {
|
|
43
|
-
/**
|
|
44
|
-
* Type of CIDR range.
|
|
45
|
-
*/
|
|
46
|
-
readonly cidrType: CidrType;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Specify an IPv4 address by using CIDR notation. For example:
|
|
50
|
-
* To configure AWS WAF to allow, block, or count requests that originated from the IP address 192.0.2.44, specify 192.0.2.44/32 .
|
|
51
|
-
* To configure AWS WAF to allow, block, or count requests that originated from IP addresses from 192.0.2.0 to 192.0.2.255, specify 192.0.2.0/24 .
|
|
52
|
-
*
|
|
53
|
-
* For more information about CIDR notation, see the Wikipedia entry Classless Inter-Domain Routing .
|
|
54
|
-
*
|
|
55
|
-
* Specify an IPv6 address by using CIDR notation. For example:
|
|
56
|
-
* To configure AWS WAF to allow, block, or count requests that originated from the IP address 1111:0000:0000:0000:0000:0000:0000:0111, specify 1111:0000:0000:0000:0000:0000:0000:0111/128 .
|
|
57
|
-
* To configure AWS WAF to allow, block, or count requests that originated from IP addresses 1111:0000:0000:0000:0000:0000:0000:0000 to 1111:0000:0000:0000:ffff:ffff:ffff:ffff, specify 1111:0000:0000:0000:0000:0000:0000:0000/64 .
|
|
58
|
-
*/
|
|
59
|
-
readonly cidrRanges: string[];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Properties to configure the web acl.
|
|
64
|
-
*/
|
|
65
|
-
export interface CloudFrontWebAclProps {
|
|
66
|
-
/**
|
|
67
|
-
* List of managed rules to apply to the web acl.
|
|
68
|
-
*
|
|
69
|
-
* @default - [{ vendor: "AWS", name: "AWSManagedRulesCommonRuleSet" }]
|
|
70
|
-
*/
|
|
71
|
-
readonly managedRules?: ManagedRule[];
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* List of cidr ranges to allow.
|
|
75
|
-
*
|
|
76
|
-
* @default - undefined
|
|
77
|
-
*/
|
|
78
|
-
readonly cidrAllowList?: CidrAllowList;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Set to true to prevent creation of a web acl for the static website
|
|
82
|
-
* @default false
|
|
83
|
-
*/
|
|
84
|
-
readonly disable?: boolean;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* This construct creates a WAFv2 Web ACL for cloudfront in the us-east-1 region (required for cloudfront) no matter the
|
|
89
|
-
* region of the parent cdk stack.
|
|
90
|
-
*/
|
|
91
|
-
export class CloudfrontWebAcl extends Construct {
|
|
92
|
-
public readonly webAclId: string;
|
|
93
|
-
public readonly webAclArn: string;
|
|
94
|
-
|
|
95
|
-
constructor(scope: Construct, id: string, props?: CloudFrontWebAclProps) {
|
|
96
|
-
super(scope, id);
|
|
97
|
-
|
|
98
|
-
const stack = Stack.of(this);
|
|
99
|
-
const aclName = `${stack.stackName}-${id}-${this.node.addr.slice(-4)}`;
|
|
100
|
-
const onEventHandler = this.createOnEventHandler(stack, aclName);
|
|
101
|
-
const customResource = this.createAclCustomResource(
|
|
102
|
-
stack,
|
|
103
|
-
aclName,
|
|
104
|
-
onEventHandler,
|
|
105
|
-
props
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
this.webAclId = customResource.getAttString("WebAclId");
|
|
109
|
-
this.webAclArn = customResource.getAttString("WebAclArn");
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Creates an event handler for managing an ACL in us-east-1.
|
|
114
|
-
*
|
|
115
|
-
* @param stack containing Stack instance.
|
|
116
|
-
* @param aclName name of the ACL to manage.
|
|
117
|
-
* @private
|
|
118
|
-
*/
|
|
119
|
-
private createOnEventHandler(stack: Stack, aclName: string): NodejsFunction {
|
|
120
|
-
// NB without manually defining a name, the cdk generated name for the Provider function can become too long and
|
|
121
|
-
// deployments fail. This is because the Provider's name references the onEvent handler name and appends "-Provider"
|
|
122
|
-
// rather than being generated by cdk and truncated appropriately
|
|
123
|
-
const onEventHandlerName = `${PDKNag.getStackPrefix(stack)
|
|
124
|
-
.split("/")
|
|
125
|
-
.join("-")}AclEvent-${this.node.addr.slice(-6)}`;
|
|
126
|
-
const onEventHandlerRole = new Role(this, "OnEventHandlerRole", {
|
|
127
|
-
assumedBy: new ServicePrincipal("lambda.amazonaws.com"),
|
|
128
|
-
inlinePolicies: {
|
|
129
|
-
logs: new PolicyDocument({
|
|
130
|
-
statements: [
|
|
131
|
-
new PolicyStatement({
|
|
132
|
-
effect: Effect.ALLOW,
|
|
133
|
-
actions: [
|
|
134
|
-
"logs:CreateLogGroup",
|
|
135
|
-
"logs:CreateLogStream",
|
|
136
|
-
"logs:PutLogEvents",
|
|
137
|
-
],
|
|
138
|
-
resources: [
|
|
139
|
-
`arn:aws:logs:${stack.region}:${stack.account}:log-group:/aws/lambda/${onEventHandlerName}`,
|
|
140
|
-
`arn:aws:logs:${stack.region}:${stack.account}:log-group:/aws/lambda/${onEventHandlerName}:*`,
|
|
141
|
-
],
|
|
142
|
-
}),
|
|
143
|
-
],
|
|
144
|
-
}),
|
|
145
|
-
wafv2: new PolicyDocument({
|
|
146
|
-
statements: [
|
|
147
|
-
new PolicyStatement({
|
|
148
|
-
effect: Effect.ALLOW,
|
|
149
|
-
actions: [
|
|
150
|
-
"wafv2:CreateWebACL",
|
|
151
|
-
"wafv2:DeleteWebACL",
|
|
152
|
-
"wafv2:UpdateWebACL",
|
|
153
|
-
"wafv2:GetWebACL",
|
|
154
|
-
],
|
|
155
|
-
resources: [
|
|
156
|
-
`arn:aws:wafv2:us-east-1:${stack.account}:global/ipset/${aclName}-IPSet/*`,
|
|
157
|
-
`arn:aws:wafv2:us-east-1:${stack.account}:global/webacl/${aclName}/*`,
|
|
158
|
-
`arn:aws:wafv2:us-east-1:${stack.account}:global/managedruleset/*/*`,
|
|
159
|
-
],
|
|
160
|
-
}),
|
|
161
|
-
new PolicyStatement({
|
|
162
|
-
effect: Effect.ALLOW,
|
|
163
|
-
actions: [
|
|
164
|
-
"wafv2:CreateIPSet",
|
|
165
|
-
"wafv2:DeleteIPSet",
|
|
166
|
-
"wafv2:UpdateIPSet",
|
|
167
|
-
"wafv2:GetIPSet",
|
|
168
|
-
],
|
|
169
|
-
resources: [
|
|
170
|
-
`arn:aws:wafv2:us-east-1:${stack.account}:global/ipset/${aclName}-IPSet/*`,
|
|
171
|
-
],
|
|
172
|
-
}),
|
|
173
|
-
],
|
|
174
|
-
}),
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
const onEventHandler = new NodejsFunction(
|
|
179
|
-
this,
|
|
180
|
-
"CloudfrontWebAclOnEventHandler",
|
|
181
|
-
{
|
|
182
|
-
entry: url.fileURLToPath(new URL('./webacl_event_handler/index.ts', import.meta.url)),
|
|
183
|
-
role: onEventHandlerRole,
|
|
184
|
-
functionName: onEventHandlerName,
|
|
185
|
-
handler: "onEvent",
|
|
186
|
-
runtime: Runtime.NODEJS_18_X,
|
|
187
|
-
timeout: Duration.seconds(300),
|
|
188
|
-
}
|
|
189
|
-
);
|
|
190
|
-
|
|
191
|
-
["AwsSolutions-IAM5", "AwsPrototyping-IAMNoWildcardPermissions"].forEach(
|
|
192
|
-
(RuleId) => {
|
|
193
|
-
NagSuppressions.addResourceSuppressions(
|
|
194
|
-
onEventHandlerRole,
|
|
195
|
-
[
|
|
196
|
-
{
|
|
197
|
-
id: RuleId,
|
|
198
|
-
reason:
|
|
199
|
-
"WafV2 resources have been scoped down to the ACL/IPSet level, however * is still needed as resource id's are created just in time.",
|
|
200
|
-
appliesTo: [
|
|
201
|
-
{
|
|
202
|
-
regex: `/^Resource::arn:aws:wafv2:us-east-1:${PDKNag.getStackAccountRegex(
|
|
203
|
-
stack
|
|
204
|
-
)}:global/(.*)$/g`,
|
|
205
|
-
},
|
|
206
|
-
],
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
id: RuleId,
|
|
210
|
-
reason:
|
|
211
|
-
"Cloudwatch resources have been scoped down to the LogGroup level, however * is still needed as stream names are created just in time.",
|
|
212
|
-
appliesTo: [
|
|
213
|
-
{
|
|
214
|
-
regex: `/^Resource::arn:aws:logs:${PDKNag.getStackRegionRegex(
|
|
215
|
-
stack
|
|
216
|
-
)}:${PDKNag.getStackAccountRegex(
|
|
217
|
-
stack
|
|
218
|
-
)}:log-group:/aws/lambda/${onEventHandlerName}:*/g`,
|
|
219
|
-
},
|
|
220
|
-
],
|
|
221
|
-
},
|
|
222
|
-
],
|
|
223
|
-
true
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
);
|
|
227
|
-
|
|
228
|
-
return onEventHandler;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Creates a Custom resource to manage the deployment of the ACL.
|
|
233
|
-
*
|
|
234
|
-
* @param stack containing Stack instance.
|
|
235
|
-
* @param aclName name of the ACL to manage.
|
|
236
|
-
* @param onEventHandler event handler to use for deployment.
|
|
237
|
-
* @param props user provided properties for configuring the ACL.
|
|
238
|
-
* @private
|
|
239
|
-
*/
|
|
240
|
-
private createAclCustomResource(
|
|
241
|
-
stack: Stack,
|
|
242
|
-
aclName: string,
|
|
243
|
-
onEventHandler: NodejsFunction,
|
|
244
|
-
props?: CloudFrontWebAclProps
|
|
245
|
-
): CustomResource {
|
|
246
|
-
const providerFunctionName = `${onEventHandler.functionName}-Provider`;
|
|
247
|
-
const providerRole = new Role(this, "CloudfrontWebAclProviderRole", {
|
|
248
|
-
assumedBy: new ServicePrincipal("lambda.amazonaws.com"),
|
|
249
|
-
inlinePolicies: {
|
|
250
|
-
logs: new PolicyDocument({
|
|
251
|
-
statements: [
|
|
252
|
-
new PolicyStatement({
|
|
253
|
-
effect: Effect.ALLOW,
|
|
254
|
-
actions: [
|
|
255
|
-
"logs:CreateLogGroup",
|
|
256
|
-
"logs:CreateLogStream",
|
|
257
|
-
"logs:PutLogEvents",
|
|
258
|
-
],
|
|
259
|
-
resources: [
|
|
260
|
-
`arn:aws:logs:${stack.region}:${stack.account}:log-group:/aws/lambda/${providerFunctionName}`,
|
|
261
|
-
`arn:aws:logs:${stack.region}:${stack.account}:log-group:/aws/lambda/${providerFunctionName}:*`,
|
|
262
|
-
],
|
|
263
|
-
}),
|
|
264
|
-
],
|
|
265
|
-
}),
|
|
266
|
-
},
|
|
267
|
-
});
|
|
268
|
-
const provider = new Provider(this, "CloudfrontAclProvider", {
|
|
269
|
-
onEventHandler,
|
|
270
|
-
role: providerRole,
|
|
271
|
-
providerFunctionName,
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
["AwsSolutions-IAM5", "AwsPrototyping-IAMNoWildcardPermissions"].forEach(
|
|
275
|
-
(RuleId) => {
|
|
276
|
-
NagSuppressions.addResourceSuppressions(
|
|
277
|
-
providerRole,
|
|
278
|
-
[
|
|
279
|
-
{
|
|
280
|
-
id: RuleId,
|
|
281
|
-
reason:
|
|
282
|
-
"Cloudwatch resources have been scoped down to the LogGroup level, however * is still needed as stream names are created just in time.",
|
|
283
|
-
},
|
|
284
|
-
],
|
|
285
|
-
true
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
);
|
|
289
|
-
|
|
290
|
-
["AwsSolutions-L1", "AwsPrototyping-LambdaLatestVersion"].forEach(
|
|
291
|
-
(RuleId) => {
|
|
292
|
-
NagSuppressions.addResourceSuppressions(
|
|
293
|
-
provider,
|
|
294
|
-
[
|
|
295
|
-
{
|
|
296
|
-
id: RuleId,
|
|
297
|
-
reason:
|
|
298
|
-
"Latest runtime cannot be configured. CDK will need to upgrade the Provider construct accordingly.",
|
|
299
|
-
},
|
|
300
|
-
],
|
|
301
|
-
true
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
);
|
|
305
|
-
|
|
306
|
-
return new CustomResource(this, "CFAclCustomResource", {
|
|
307
|
-
serviceToken: provider.serviceToken,
|
|
308
|
-
properties: {
|
|
309
|
-
ID: aclName,
|
|
310
|
-
MANAGED_RULES: props?.managedRules ?? [
|
|
311
|
-
{ vendor: "AWS", name: "AWSManagedRulesCommonRuleSet" },
|
|
312
|
-
],
|
|
313
|
-
CIDR_ALLOW_LIST: props?.cidrAllowList,
|
|
314
|
-
},
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
}
|