@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.
Files changed (126) hide show
  1. package/LICENSE-THIRD-PARTY +1554 -3241
  2. package/generators.json +1 -13
  3. package/package.json +14 -14
  4. package/src/cloudscape-website/app/README.md +84 -48
  5. package/src/cloudscape-website/app/__snapshots__/generator.spec.ts.snap +168 -233
  6. package/src/cloudscape-website/app/files/app/README.md.template +44 -0
  7. package/src/cloudscape-website/app/files/app/src/layouts/App/index.tsx.template +40 -43
  8. package/src/cloudscape-website/app/files/app/src/layouts/App/navitems.ts.template +3 -3
  9. package/src/cloudscape-website/app/files/app/src/layouts/Routes/index.tsx.template +4 -6
  10. package/src/cloudscape-website/app/files/app/src/main.tsx.template +7 -10
  11. package/src/cloudscape-website/app/files/app/src/pages/Home/index.tsx.template +0 -2
  12. package/src/cloudscape-website/app/files/common/constructs/src/app/static-websites/__websiteNameKebabCase__.ts.template +13 -0
  13. package/src/cloudscape-website/app/files/common/constructs/src/{__websiteNameKebabCase__ → core}/static-website.ts.template +79 -144
  14. package/src/cloudscape-website/app/generator.js +90 -74
  15. package/src/cloudscape-website/app/generator.js.map +1 -1
  16. package/src/cloudscape-website/app/schema.d.ts +3 -5
  17. package/src/cloudscape-website/app/schema.json +1 -24
  18. package/src/cloudscape-website/cognito-auth/README.md +53 -32
  19. package/src/cloudscape-website/cognito-auth/__snapshots__/generator.spec.ts.snap +162 -124
  20. package/src/cloudscape-website/cognito-auth/files/app/components/CognitoAuth/index.tsx.template +53 -39
  21. package/src/cloudscape-website/cognito-auth/files/common/constructs/src/core/user-identity.ts.template +168 -0
  22. package/src/cloudscape-website/cognito-auth/generator.js +130 -47
  23. package/src/cloudscape-website/cognito-auth/generator.js.map +1 -1
  24. package/src/cloudscape-website/cognito-auth/schema.d.ts +1 -0
  25. package/src/cloudscape-website/cognito-auth/schema.json +7 -1
  26. package/src/cloudscape-website/runtime-config/__snapshots__/generator.spec.ts.snap +20 -15
  27. package/src/cloudscape-website/runtime-config/files/app/components/RuntimeConfig/index.tsx.template +7 -10
  28. package/src/cloudscape-website/runtime-config/files/app/hooks/useRuntimeConfig.tsx.template +13 -0
  29. package/src/cloudscape-website/runtime-config/generator.js +4 -2
  30. package/src/cloudscape-website/runtime-config/generator.js.map +1 -1
  31. package/src/infra/app/README.md +71 -46
  32. package/src/infra/app/__snapshots__/generator.spec.ts.snap +184 -305
  33. package/src/infra/app/files/app/README.md.template +76 -0
  34. package/src/infra/app/files/app/src/main.ts.template +18 -0
  35. package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/aws-prototyping.guard +1282 -0
  36. package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/cfn-nag.guard +6839 -0
  37. package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/hipaa-security.guard +2807 -0
  38. package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/nist-csf.guard +2585 -0
  39. package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/pci-dss-3-2-1.guard +2236 -0
  40. package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/wa-reliability-pillar.guard +885 -0
  41. package/src/infra/app/files/common/constructs/src/core/cfn-guard-rules/wa-security-pillar.guard +2205 -0
  42. package/src/infra/app/files/common/constructs/src/core/cfn-guard.ts.template +63 -0
  43. package/src/infra/app/generator.js +36 -7
  44. package/src/infra/app/generator.js.map +1 -1
  45. package/src/infra/app/schema.d.ts +10 -1
  46. package/src/infra/app/schema.json +16 -8
  47. package/src/trpc/backend/README.md +102 -80
  48. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +42 -19
  49. package/src/trpc/backend/files/backend/README.md.template +33 -0
  50. package/src/trpc/backend/files/common/constructs/src/app/trpc-apis/__apiNameKebabCase__.ts.template +18 -0
  51. package/src/trpc/backend/files/common/constructs/src/{__apiNameKebabCase__/index.ts.template → core/trpc-api.ts.template} +12 -16
  52. package/src/trpc/backend/files/schema/README.md.template +33 -0
  53. package/src/trpc/backend/generator.js +30 -44
  54. package/src/trpc/backend/generator.js.map +1 -1
  55. package/src/trpc/backend/schema.d.ts +3 -1
  56. package/src/trpc/backend/schema.json +8 -13
  57. package/src/trpc/react/README.md +46 -66
  58. package/src/trpc/react/__snapshots__/generator.spec.ts.snap +104 -65
  59. package/src/trpc/react/files/src/components/TrpcClients/IsolatedTrpcProvider.tsx.template +75 -0
  60. package/src/trpc/react/files/src/components/TrpcClients/TrpcApis.tsx.template +1 -0
  61. package/src/trpc/react/files/src/components/TrpcClients/TrpcClientProviders.tsx.template +10 -0
  62. package/src/trpc/react/files/src/components/TrpcClients/index.tsx.template +5 -0
  63. package/src/trpc/react/files/src/hooks/useSigV4.tsx.template +38 -0
  64. package/src/trpc/react/files/src/hooks/use__apiNameClassName__.tsx.template +3 -0
  65. package/src/trpc/react/generator.js +124 -25
  66. package/src/trpc/react/generator.js.map +1 -1
  67. package/src/trpc/react/schema.json +2 -2
  68. package/src/ts/lib/__snapshots__/generator.spec.ts.snap +47 -93
  69. package/src/ts/lib/eslint.d.ts +1 -2
  70. package/src/ts/lib/eslint.js +62 -21
  71. package/src/ts/lib/eslint.js.map +1 -1
  72. package/src/ts/lib/files/README.md.template +33 -0
  73. package/src/ts/lib/generator.js +44 -5
  74. package/src/ts/lib/generator.js.map +1 -1
  75. package/src/ts/lib/schema.d.ts +1 -4
  76. package/src/ts/lib/schema.json +2 -21
  77. package/src/ts/lib/ts-project-utils.js +3 -18
  78. package/src/ts/lib/ts-project-utils.js.map +1 -1
  79. package/src/ts/lib/vitest.js +12 -0
  80. package/src/ts/lib/vitest.js.map +1 -1
  81. package/src/utils/ast.d.ts +13 -0
  82. package/src/utils/ast.js +102 -0
  83. package/src/utils/ast.js.map +1 -0
  84. package/src/utils/files/common/constructs/src/app/index.ts.template +0 -0
  85. package/src/utils/files/common/constructs/src/{runtime-config → core}/runtime-config.ts.template +3 -5
  86. package/src/utils/files/common/constructs/src/index.ts.template +2 -1
  87. package/src/utils/files/common/readme/README.md.template +33 -0
  88. package/src/utils/files/common/types/src/runtime-config.ts.template +2 -13
  89. package/src/utils/format.d.ts +1 -1
  90. package/src/utils/format.js +2 -2
  91. package/src/utils/format.js.map +1 -1
  92. package/src/utils/names.d.ts +2 -0
  93. package/src/utils/names.js +27 -0
  94. package/src/utils/names.js.map +1 -0
  95. package/src/utils/npm-scope.js.map +1 -1
  96. package/src/utils/paths.js.map +1 -1
  97. package/src/utils/shared-constructs.js +37 -4
  98. package/src/utils/shared-constructs.js.map +1 -1
  99. package/src/utils/test.d.ts +2 -0
  100. package/src/utils/test.js +19 -0
  101. package/src/utils/test.js.map +1 -0
  102. package/src/utils/versions.d.ts +15 -9
  103. package/src/utils/versions.js +14 -8
  104. package/src/utils/versions.js.map +1 -1
  105. package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/cloudfront-web-acl.ts.template +0 -317
  106. package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/index.ts.template +0 -4
  107. package/src/cloudscape-website/app/files/common/constructs/src/__websiteNameKebabCase__/webacl_event_handler/index.ts.template +0 -301
  108. package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/index.ts.template +0 -4
  109. package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/user-identity.ts.template +0 -66
  110. package/src/cloudscape-website/cognito-auth/files/common/constructs/src/identity/userpool-with-mfa.ts.template +0 -70
  111. package/src/gitlab/generator.d.ts +0 -8
  112. package/src/gitlab/generator.js +0 -16
  113. package/src/gitlab/generator.js.map +0 -1
  114. package/src/gitlab/schema.d.ts +0 -9
  115. package/src/gitlab/schema.json +0 -52
  116. package/src/infra/app/files/src/main.ts.template +0 -37
  117. package/src/trpc/react/files/src/components/TRPCClientProvider/index.tsx.template +0 -34
  118. package/src/trpc/react/files/src/hooks/useTrpc.tsx.template +0 -5
  119. package/src/ts/cjs-to-esm/generator.d.ts +0 -12
  120. package/src/ts/cjs-to-esm/generator.js +0 -189
  121. package/src/ts/cjs-to-esm/generator.js.map +0 -1
  122. package/src/ts/cjs-to-esm/schema.d.ts +0 -9
  123. package/src/ts/cjs-to-esm/schema.json +0 -28
  124. /package/src/infra/app/files/{cdk.json → app/cdk.json} +0 -0
  125. /package/src/infra/app/files/{src → app/src}/stacks/application-stack.ts.template +0 -0
  126. /package/src/utils/files/common/constructs/src/{runtime-config → core}/index.ts.template +0 -0
@@ -1,301 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
2
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
3
- /*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved.
4
- SPDX-License-Identifier: Apache-2.0 */
5
- import { CreateIPSetCommandOutput, Rule, WAFUnavailableEntityException, WAFV2 } from "@aws-sdk/client-wafv2"; // eslint-disable-line
6
-
7
- const DELIMITER = ":";
8
- const SCOPE = "CLOUDFRONT";
9
- const client = new WAFV2({
10
- region: "us-east-1",
11
- customUserAgent: "aws-pdk/static-website/waf",
12
- });
13
-
14
- const MAX_CREATE_RETRY = 10;
15
- const RETRY_INTERVAL = 2000;
16
-
17
- /**
18
- * Handler for creating a WAF V2 ACL in US-EAST-1.
19
- */
20
- export const onEvent = async (event: any) => {
21
- const { ID, MANAGED_RULES, CIDR_ALLOW_LIST } = event.ResourceProperties;
22
- const [WEB_ACL_ID, IP_SET_ID] = event.PhysicalResourceId
23
- ? event.PhysicalResourceId.split(DELIMITER)
24
- : [];
25
- let response = {};
26
-
27
- switch (event.RequestType) {
28
- case "Create":
29
- response = await createWaf(ID, MANAGED_RULES, CIDR_ALLOW_LIST);
30
- break;
31
- case "Update":
32
- response = await updateWaf(
33
- WEB_ACL_ID,
34
- IP_SET_ID,
35
- ID,
36
- getIpSetName(ID),
37
- MANAGED_RULES,
38
- CIDR_ALLOW_LIST
39
- );
40
- break;
41
- case "Delete":
42
- response = await deleteWaf(WEB_ACL_ID, IP_SET_ID, ID, getIpSetName(ID));
43
- break;
44
- default:
45
- throw new Error(`Invalid RequestType: ${event.RequestType}`);
46
- }
47
-
48
- return response;
49
- };
50
-
51
- /**
52
- * Generates the name of the IP Set.
53
- *
54
- * @param id param passed in.
55
- * @returns name of IP Set.
56
- */
57
- const getIpSetName = (id: string) => `${id}-IPSet`;
58
-
59
- /**
60
- * Returns a set of rules to apply.
61
- *
62
- * @param ipSetArn ip set arn
63
- * @param ipSetName ip set name
64
- * @param managedRules managed rules
65
- * @param cidrAllowList cidr allow list
66
- * @returns set of rules to apply.
67
- */
68
- const getWafRules = (
69
- ipSetArn: string,
70
- ipSetName: string,
71
- managedRules?: any,
72
- cidrAllowList?: any
73
- ): Array<Rule> => {
74
- const rules: Array<Rule> = [];
75
-
76
- if (cidrAllowList) {
77
- rules.push({
78
- Name: ipSetName,
79
- Priority: 1,
80
- VisibilityConfig: {
81
- MetricName: ipSetName,
82
- CloudWatchMetricsEnabled: true,
83
- SampledRequestsEnabled: true,
84
- },
85
- Action: {
86
- Block: {},
87
- },
88
- Statement: {
89
- NotStatement: {
90
- Statement: {
91
- IPSetReferenceStatement: {
92
- ARN: ipSetArn,
93
- },
94
- },
95
- },
96
- },
97
- });
98
- }
99
-
100
- if (managedRules) {
101
- rules.push(
102
- ...managedRules
103
- .map((r: any) => ({ VendorName: r.vendor, Name: r.name }))
104
- .map((rule: any, Priority: any) => ({
105
- Name: `${rule.VendorName}-${rule.Name}`,
106
- Priority,
107
- Statement: { ManagedRuleGroupStatement: rule },
108
- OverrideAction: { None: {} },
109
- VisibilityConfig: {
110
- MetricName: `${rule.VendorName}-${rule.Name}`,
111
- CloudWatchMetricsEnabled: true,
112
- SampledRequestsEnabled: true,
113
- },
114
- }))
115
- );
116
- }
117
-
118
- return rules;
119
- };
120
-
121
- const createWaf = async (
122
- id: string,
123
- managedRules?: any,
124
- cidrAllowList?: any
125
- ) => {
126
- const ipSetName = getIpSetName(id);
127
- const createIpSetResponse = await client.createIPSet({
128
- Name: ipSetName,
129
- Scope: SCOPE,
130
- Addresses: cidrAllowList?.cidrRanges ?? [],
131
- IPAddressVersion: cidrAllowList?.cidrType ?? "IPV4",
132
- });
133
-
134
- const createWebAclResponse = await createWafAcl(
135
- id,
136
- ipSetName,
137
- createIpSetResponse,
138
- managedRules,
139
- cidrAllowList
140
- );
141
-
142
- return {
143
- PhysicalResourceId: `${createWebAclResponse.Summary?.Id}${DELIMITER}${createIpSetResponse.Summary?.Id}`,
144
- Data: {
145
- WebAclArn: createWebAclResponse.Summary?.ARN,
146
- WebAclId: createWebAclResponse.Summary?.Id,
147
- IPSetArn: createIpSetResponse.Summary?.ARN,
148
- IPSetId: createIpSetResponse.Summary?.Id,
149
- },
150
- };
151
- };
152
-
153
- const createWafAcl = async (
154
- id: string,
155
- ipSetName: string,
156
- createIpSetResponse: CreateIPSetCommandOutput,
157
- managedRules?: any,
158
- cidrAllowList?: any
159
- ) => {
160
- let counter = 0;
161
-
162
- while (true) {
163
- try {
164
- const createWebAclResponse = await client.createWebACL({
165
- Name: id,
166
- DefaultAction: { Allow: {} },
167
- Scope: SCOPE,
168
- VisibilityConfig: {
169
- CloudWatchMetricsEnabled: true,
170
- MetricName: id,
171
- SampledRequestsEnabled: true,
172
- },
173
- Rules: getWafRules(
174
- createIpSetResponse.Summary!.ARN!,
175
- ipSetName,
176
- managedRules,
177
- cidrAllowList
178
- ),
179
- });
180
-
181
- return createWebAclResponse;
182
- } catch (e) {
183
- if (
184
- e instanceof WAFUnavailableEntityException &&
185
- counter < MAX_CREATE_RETRY
186
- ) {
187
- counter++;
188
- console.log(
189
- `Received error: ${e.message}; Waiting for retrying ${counter}`
190
- );
191
- await sleep(RETRY_INTERVAL);
192
- continue;
193
- }
194
-
195
- throw e;
196
- }
197
- }
198
- };
199
-
200
- const updateWaf = async (
201
- webAclId: string,
202
- ipSetId: string,
203
- id: string,
204
- ipSetName: string,
205
- managedRules?: any,
206
- cidrAllowList?: any
207
- ) => {
208
- const getIpSetResponse = await client.getIPSet({
209
- Id: ipSetId,
210
- Name: ipSetName,
211
- Scope: SCOPE,
212
- });
213
-
214
- await client.updateIPSet({
215
- Id: ipSetId,
216
- Name: ipSetName,
217
- Addresses: cidrAllowList?.cidrRanges ?? [],
218
- Scope: SCOPE,
219
- LockToken: getIpSetResponse.LockToken!,
220
- });
221
-
222
- const getWebAclResponse = await client.getWebACL({
223
- Id: webAclId,
224
- Name: id,
225
- Scope: SCOPE,
226
- });
227
-
228
- await client.updateWebACL({
229
- Name: id,
230
- DefaultAction: { Allow: {} },
231
- Scope: SCOPE,
232
- VisibilityConfig: {
233
- CloudWatchMetricsEnabled: true,
234
- MetricName: id,
235
- SampledRequestsEnabled: true,
236
- },
237
- Rules: getWafRules(
238
- getIpSetResponse.IPSet?.ARN!,
239
- ipSetName,
240
- managedRules,
241
- cidrAllowList
242
- ),
243
- Id: getWebAclResponse.WebACL?.Id!,
244
- LockToken: getWebAclResponse.LockToken!,
245
- });
246
-
247
- return {
248
- Data: {
249
- WebAclArn: getWebAclResponse.WebACL?.ARN,
250
- WebAclId: getWebAclResponse.WebACL?.Id,
251
- IPSetArn: getIpSetResponse.IPSet?.ARN,
252
- IPSetId: getIpSetResponse.IPSet?.Id,
253
- },
254
- };
255
- };
256
-
257
- const deleteWaf = async (
258
- webAclId: string,
259
- ipSetId: string,
260
- id: string,
261
- ipSetName: string
262
- ) => {
263
- const getWebAclResponse = await client.getWebACL({
264
- Id: webAclId,
265
- Name: id,
266
- Scope: SCOPE,
267
- });
268
-
269
- await client.deleteWebACL({
270
- Id: webAclId,
271
- Name: id,
272
- Scope: SCOPE,
273
- LockToken: getWebAclResponse.LockToken!,
274
- });
275
-
276
- const getIpSetResponse = await client.getIPSet({
277
- Id: ipSetId,
278
- Name: ipSetName,
279
- Scope: SCOPE,
280
- });
281
-
282
- await client.deleteIPSet({
283
- Id: ipSetId,
284
- Name: ipSetName,
285
- Scope: SCOPE,
286
- LockToken: getIpSetResponse.LockToken!,
287
- });
288
-
289
- return {
290
- Data: {
291
- WebAclArn: getWebAclResponse.WebACL?.ARN,
292
- WebAclId: getWebAclResponse.WebACL?.Id,
293
- IPSetArn: getIpSetResponse.IPSet?.ARN,
294
- IPSetId: getIpSetResponse.IPSet?.Id,
295
- },
296
- };
297
- };
298
-
299
- const sleep = async (duration: number) => {
300
- return new Promise((resolve) => setTimeout(resolve, duration));
301
- };
@@ -1,4 +0,0 @@
1
- /*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved.
2
- SPDX-License-Identifier: Apache-2.0 */
3
- export * from './user-identity.js';
4
- export * from './userpool-with-mfa.js';
@@ -1,66 +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 {
4
- IdentityPool,
5
- UserPoolAuthenticationProvider,
6
- } from '@aws-cdk/aws-cognito-identitypool-alpha';
7
- import { CfnOutput, Stack } from 'aws-cdk-lib';
8
- import { UserPool, UserPoolClient } from 'aws-cdk-lib/aws-cognito';
9
- import { Construct } from 'constructs';
10
- import { UserPoolWithMfa } from './userpool-with-mfa.js';
11
- import { RuntimeConfig } from '../runtime-config/index.js';
12
-
13
- const WEB_CLIENT_ID = 'WebClient';
14
-
15
- /**
16
- * Creates a UserPool and Identity Pool with sane defaults configured intended for usage from a web client.
17
- */
18
- export class UserIdentity extends Construct {
19
- public readonly identityPool: IdentityPool;
20
- public readonly userPool: UserPool;
21
- public readonly userPoolClient: UserPoolClient;
22
-
23
- constructor(scope: Construct, id: string) {
24
- super(scope, id);
25
-
26
- // Unless explicitly stated, created a default Cognito User Pool and Web Client.
27
- this.userPool = new UserPoolWithMfa(this, 'UserPool');
28
-
29
- this.identityPool = new IdentityPool(this, 'IdentityPool');
30
-
31
- const existingClient = this.userPool.node.children.find(
32
- (e) => e.node.id === WEB_CLIENT_ID && e instanceof UserPoolClient
33
- ) as UserPoolClient | undefined;
34
-
35
- this.userPoolClient =
36
- existingClient ??
37
- this.userPool.addClient(WEB_CLIENT_ID, {
38
- authFlows: {
39
- userPassword: true,
40
- userSrp: true,
41
- },
42
- });
43
-
44
- this.identityPool.addUserPoolAuthentication(
45
- new UserPoolAuthenticationProvider({
46
- userPool: this.userPool,
47
- userPoolClient: this.userPoolClient,
48
- })
49
- );
50
-
51
- new CfnOutput(this, `${id}-UserPoolId`, {
52
- value: this.userPool.userPoolId,
53
- });
54
-
55
- new CfnOutput(this, `${id}-IdentityPoolId`, {
56
- value: this.identityPool.identityPoolId,
57
- });
58
-
59
- RuntimeConfig.ensure(this).config.cognitoProps = {
60
- region: Stack.of(this).region,
61
- identityPoolId: this.identityPool.identityPoolId,
62
- userPoolId: this.userPool?.userPoolId,
63
- userPoolWebClientId: this.userPoolClient?.userPoolClientId,
64
- };
65
- }
66
- }
@@ -1,70 +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 { PDKNag } from '@aws/pdk/pdk-nag';
4
- import { Duration, Stack } from 'aws-cdk-lib';
5
- import {
6
- AccountRecovery,
7
- AdvancedSecurityMode,
8
- Mfa,
9
- UserPool,
10
- } from 'aws-cdk-lib/aws-cognito';
11
- import { Construct } from 'constructs';
12
-
13
- /**
14
- * Configures a UserPool with MFA across SMS/TOTP using sane defaults.
15
- */
16
- export class UserPoolWithMfa extends UserPool {
17
- constructor(scope: Construct, id: string) {
18
- super(scope, id, {
19
- deletionProtection: true,
20
- passwordPolicy: {
21
- minLength: 8,
22
- requireLowercase: true,
23
- requireUppercase: true,
24
- requireDigits: true,
25
- requireSymbols: true,
26
- tempPasswordValidity: Duration.days(3),
27
- },
28
- mfa: Mfa.REQUIRED,
29
- mfaSecondFactor: { sms: true, otp: true },
30
- signInCaseSensitive: false,
31
- advancedSecurityMode: AdvancedSecurityMode.ENFORCED,
32
- signInAliases: { username: true, email: true },
33
- accountRecovery: AccountRecovery.EMAIL_ONLY,
34
- selfSignUpEnabled: <%= allowSignup %>,
35
- standardAttributes: {
36
- phoneNumber: { required: false },
37
- email: { required: true },
38
- givenName: { required: true },
39
- familyName: { required: true },
40
- },
41
- autoVerify: {
42
- email: true,
43
- phone: true,
44
- },
45
- keepOriginal: {
46
- email: true,
47
- phone: true,
48
- },
49
- });
50
-
51
- const stack = Stack.of(this);
52
-
53
- ['AwsSolutions-IAM5', 'AwsPrototyping-IAMNoWildcardPermissions'].forEach(
54
- (RuleId) => {
55
- PDKNag.addResourceSuppressionsByPathNoThrow(
56
- stack,
57
- `${PDKNag.getStackPrefix(stack)}${id}/UserPool/smsRole/Resource`,
58
- [
59
- {
60
- id: RuleId,
61
- reason:
62
- 'MFA requires sending a text to a users phone number which cannot be known at deployment time.',
63
- appliesTo: ['Resource::*'],
64
- },
65
- ]
66
- );
67
- }
68
- );
69
- }
70
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { Tree } from '@nx/devkit';
6
- import { GitlabGeneratorSchema } from './schema';
7
- export declare function gitlabGenerator(tree: Tree, options: GitlabGeneratorSchema): Promise<void>;
8
- export default gitlabGenerator;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.gitlabGenerator = gitlabGenerator;
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 devkit_1 = require("@nx/devkit");
10
- function gitlabGenerator(tree, options) {
11
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), '.', options);
13
- });
14
- }
15
- exports.default = gitlabGenerator;
16
- //# sourceMappingURL=generator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../packages/nx-plugin/src/gitlab/generator.ts"],"names":[],"mappings":";;AAOA,0CAKC;;AAZD;;;GAGG;AACH,uCAAoE;AAGpE,SAAsB,eAAe,CACnC,IAAU,EACV,OAA8B;;QAE9B,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;CAAA;AAED,kBAAe,eAAe,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- export interface GitlabGeneratorSchema {
6
- infraProject: string;
7
- roleArn: string;
8
- region: string;
9
- }
@@ -1,52 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "$id": "Gitlab",
4
- "title": "",
5
- "type": "object",
6
- "properties": {
7
- "infraProject": {
8
- "description": "The infrastructure project.",
9
- "type": "string",
10
- "alias": "dir",
11
- "x-priority": "important",
12
- "x-prompt": "the infrastructure project",
13
- "x-dropdown": "projects"
14
- },
15
- "roleArn": {
16
- "description": "The role ARN to assume.",
17
- "type": "string",
18
- "x-priority": "important",
19
- "x-prompt": "the role ARN to assume"
20
- },
21
- "region": {
22
- "description": "The region to deploy into.",
23
- "type": "string",
24
- "x-priority": "important",
25
- "x-prompt": {
26
- "message": "Which region would you like to deploy into?",
27
- "type": "list",
28
- "items": [
29
- { "value": "us-east-1", "label": "us-east-1" },
30
- { "value": "us-east-2", "label": "us-east-2" },
31
- { "value": "us-west-1", "label": "us-west-1" },
32
- { "value": "us-west-2", "label": "us-west-2" },
33
- { "value": "ca-central-1", "label": "ca-central-1" },
34
- { "value": "eu-west-1", "label": "eu-west-1" },
35
- { "value": "eu-central-1", "label": "eu-central-1" },
36
- { "value": "eu-west-2", "label": "eu-west-2" },
37
- { "value": "eu-west-3", "label": "eu-west-3" },
38
- { "value": "eu-north-1", "label": "eu-north-1" },
39
- { "value": "ap-northeast-1", "label": "ap-northeast-1" },
40
- { "value": "ap-northeast-2", "label": "ap-northeast-2" },
41
- { "value": "ap-southeast-1", "label": "ap-southeast-1" },
42
- { "value": "ap-southeast-2", "label": "ap-southeast-2" },
43
- { "value": "ap-south-1", "label": "ap-south-1" },
44
- { "value": "sa-east-1", "label": "sa-east-1" },
45
- { "value": "us-gov-west-1", "label": "us-gov-west-1" },
46
- { "value": "us-gov-east-1", "label": "us-gov-east-1" }
47
- ]
48
- }
49
- }
50
- },
51
- "required": ["infraProject", "roleArn", "region"]
52
- }
@@ -1,37 +0,0 @@
1
- import { CdkGraph, FilterPreset, Filters } from '@aws/pdk/cdk-graph';
2
- import { CdkGraphDiagramPlugin } from '@aws/pdk/cdk-graph-plugin-diagram';
3
- import { CdkGraphThreatComposerPlugin } from '@aws/pdk/cdk-graph-plugin-threat-composer';
4
- import { AwsPrototypingChecks, PDKNag } from '@aws/pdk/pdk-nag';
5
- import { ApplicationStack } from './stacks/application-stack.js';
6
-
7
- /* eslint-disable @typescript-eslint/no-floating-promises */
8
- (async () => {
9
- const app = PDKNag.app({
10
- nagPacks: [new AwsPrototypingChecks()],
11
- });
12
-
13
- // Use this to deploy your own sandbox environment (assumes your CLI credentials)
14
- new ApplicationStack(app, '<%= name %>-sandbox', {
15
- env: {
16
- account: process.env.CDK_DEFAULT_ACCOUNT,
17
- region: process.env.CDK_DEFAULT_REGION,
18
- },
19
- });
20
-
21
- const graph = new CdkGraph(app, {
22
- plugins: [
23
- new CdkGraphDiagramPlugin({
24
- defaults: {
25
- filterPlan: {
26
- preset: FilterPreset.COMPACT,
27
- filters: [{ store: Filters.pruneCustomResources() }],
28
- },
29
- },
30
- }),
31
- new CdkGraphThreatComposerPlugin(),
32
- ],
33
- });
34
-
35
- app.synth();
36
- await graph.report();
37
- })();
@@ -1,34 +0,0 @@
1
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
2
- import { httpBatchLink } from '@trpc/react-query';
3
- import { useContext, useState, FC } from 'react';
4
- import { useTrpc } from '../../hooks/useTrpc';
5
- import { RuntimeConfigContext } from '../RuntimeConfig';
6
- <% if(auth === 'IAM') { %> import useSigV4Client from "@aws-northstar/ui/components/CognitoAuth/hooks/useSigv4Client"; <% } %>
7
-
8
- const TRPCClientProvider: FC<any> = ({ children }) => {
9
- const trpc = useTrpc();
10
- const runtimeContext = useContext(RuntimeConfigContext);
11
- const [queryClient] = useState(() => new QueryClient());
12
- <% if(auth === 'IAM') { %> const sigv4Client = useSigV4Client(); <% } %>
13
-
14
- const [trpcClient] = useState(() =>
15
- trpc.createClient({
16
- links: [
17
- httpBatchLink({
18
- url: runtimeContext?.trpcApis?.['<%= apiName %>']!,
19
- <% if(auth === 'IAM') { %> fetch: sigv4Client <% } %>
20
- })
21
- ],
22
- }),
23
- );
24
-
25
- return (
26
- <trpc.Provider client={trpcClient} queryClient={queryClient}>
27
- <QueryClientProvider client={queryClient}>
28
- {children}
29
- </QueryClientProvider>
30
- </trpc.Provider>
31
- );
32
- };
33
-
34
- export default TRPCClientProvider;
@@ -1,5 +0,0 @@
1
- import type { AppRouter } from '<%= backendProjectAlias %>';
2
- import { createTRPCReact } from '@trpc/react-query';
3
-
4
- const trpc = createTRPCReact<AppRouter>();
5
- export const useTrpc = () => trpc;
@@ -1,12 +0,0 @@
1
- /**
2
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- * SPDX-License-Identifier: Apache-2.0
4
- */
5
- import { Tree } from '@nx/devkit';
6
- import { CjsToEsmGeneratorSchema } from './schema';
7
- export declare function cjsToEsm(tree: Tree, relativePathInTree: string, options?: {
8
- include?: string[];
9
- exclude?: string[];
10
- }): void;
11
- export declare function cjsToEsmGenerator(tree: Tree, options: CjsToEsmGeneratorSchema): Promise<void>;
12
- export default cjsToEsmGenerator;