@resistdesign/voltra 3.0.0-alpha.17 → 3.0.0-alpha.18
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/iac/packs/auth/user-management.d.ts +36 -13
- package/iac/packs/auth.d.ts +39 -21
- package/iac/packs/index.js +92 -90
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Configuration for adding Cognito user management resources.
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
type AddUserManagementConfigBase = {
|
|
5
5
|
/**
|
|
6
6
|
* Base id for Cognito resources.
|
|
7
7
|
*/
|
|
@@ -14,18 +14,6 @@ export type AddUserManagementConfig = {
|
|
|
14
14
|
* IAM role name for unauthenticated users.
|
|
15
15
|
*/
|
|
16
16
|
unauthRoleName: string;
|
|
17
|
-
/**
|
|
18
|
-
* Base domain name for the user pool.
|
|
19
|
-
*/
|
|
20
|
-
domainName: any;
|
|
21
|
-
/**
|
|
22
|
-
* Hosted zone id for DNS records.
|
|
23
|
-
*/
|
|
24
|
-
hostedZoneId: any;
|
|
25
|
-
/**
|
|
26
|
-
* SSL certificate ARN for the user pool domain.
|
|
27
|
-
*/
|
|
28
|
-
sslCertificateArn: any;
|
|
29
17
|
/**
|
|
30
18
|
* OAuth callback URLs.
|
|
31
19
|
*/
|
|
@@ -47,6 +35,40 @@ export type AddUserManagementConfig = {
|
|
|
47
35
|
*/
|
|
48
36
|
apiStageName?: any;
|
|
49
37
|
};
|
|
38
|
+
type AddUserManagementConfigWithDomain = AddUserManagementConfigBase & {
|
|
39
|
+
/**
|
|
40
|
+
* Enable a custom Cognito user pool domain and associated Route53 records.
|
|
41
|
+
*
|
|
42
|
+
* Defaults to `true`.
|
|
43
|
+
*/
|
|
44
|
+
enableUserPoolDomain?: true;
|
|
45
|
+
/**
|
|
46
|
+
* Base domain name for the user pool.
|
|
47
|
+
*/
|
|
48
|
+
domainName: any;
|
|
49
|
+
/**
|
|
50
|
+
* Hosted zone id for DNS records.
|
|
51
|
+
*/
|
|
52
|
+
hostedZoneId: any;
|
|
53
|
+
/**
|
|
54
|
+
* SSL certificate ARN for the user pool domain.
|
|
55
|
+
*/
|
|
56
|
+
sslCertificateArn: any;
|
|
57
|
+
};
|
|
58
|
+
type AddUserManagementConfigWithoutDomain = AddUserManagementConfigBase & {
|
|
59
|
+
/**
|
|
60
|
+
* Disable custom Cognito user pool domain resources.
|
|
61
|
+
*/
|
|
62
|
+
enableUserPoolDomain: false;
|
|
63
|
+
domainName?: never;
|
|
64
|
+
hostedZoneId?: never;
|
|
65
|
+
sslCertificateArn?: never;
|
|
66
|
+
baseDomainRecordAliasTargetDNSName?: never;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Configuration for {@link addUserManagement}.
|
|
70
|
+
*/
|
|
71
|
+
export type AddUserManagementConfig = AddUserManagementConfigWithDomain | AddUserManagementConfigWithoutDomain;
|
|
50
72
|
/**
|
|
51
73
|
* Add Cognito user management resources to a template.
|
|
52
74
|
*
|
|
@@ -55,3 +77,4 @@ export type AddUserManagementConfig = {
|
|
|
55
77
|
* @group Resource Packs
|
|
56
78
|
*/
|
|
57
79
|
export declare const addUserManagement: import("../..").ResourcePackApplier<AddUserManagementConfig>;
|
|
80
|
+
export {};
|
package/iac/packs/auth.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Configuration for the auth pack.
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
type AddAuthConfigBase = {
|
|
5
5
|
/**
|
|
6
6
|
* Cognito user pool resource id.
|
|
7
7
|
*/
|
|
@@ -14,22 +14,6 @@ export type AddAuthConfig = {
|
|
|
14
14
|
* IAM role name for unauthenticated users.
|
|
15
15
|
*/
|
|
16
16
|
unauthRoleName: string;
|
|
17
|
-
/**
|
|
18
|
-
* Parameter name for Route53 hosted zone id.
|
|
19
|
-
*/
|
|
20
|
-
hostedZoneIdParameterName: string;
|
|
21
|
-
/**
|
|
22
|
-
* Parameter name for base domain.
|
|
23
|
-
*/
|
|
24
|
-
domainNameParameterName: string;
|
|
25
|
-
/**
|
|
26
|
-
* SSL certificate resource id for the user pool domain.
|
|
27
|
-
*/
|
|
28
|
-
sslCertificateId: string;
|
|
29
|
-
/**
|
|
30
|
-
* CloudFront distribution id for the main CDN.
|
|
31
|
-
*/
|
|
32
|
-
mainCDNCloudFrontId: string;
|
|
33
17
|
/**
|
|
34
18
|
* API Gateway REST API id for the backend.
|
|
35
19
|
*/
|
|
@@ -55,14 +39,48 @@ export type AddAuthConfig = {
|
|
|
55
39
|
*/
|
|
56
40
|
logoutUrls: any[];
|
|
57
41
|
};
|
|
42
|
+
type AddAuthConfigWithUserPoolDomain = AddAuthConfigBase & {
|
|
43
|
+
/**
|
|
44
|
+
* Enable a custom Cognito user pool domain and associated Route53 records.
|
|
45
|
+
*
|
|
46
|
+
* Defaults to `true`.
|
|
47
|
+
*/
|
|
48
|
+
enableUserPoolDomain?: true;
|
|
49
|
+
/**
|
|
50
|
+
* Parameter name for Route53 hosted zone id.
|
|
51
|
+
*/
|
|
52
|
+
hostedZoneIdParameterName: string;
|
|
53
|
+
/**
|
|
54
|
+
* Parameter name for base domain.
|
|
55
|
+
*/
|
|
56
|
+
domainNameParameterName: string;
|
|
57
|
+
/**
|
|
58
|
+
* SSL certificate resource id for the user pool domain.
|
|
59
|
+
*/
|
|
60
|
+
sslCertificateId: string;
|
|
61
|
+
/**
|
|
62
|
+
* CloudFront distribution id for the main CDN.
|
|
63
|
+
*/
|
|
64
|
+
mainCDNCloudFrontId: string;
|
|
65
|
+
};
|
|
66
|
+
type AddAuthConfigWithoutUserPoolDomain = AddAuthConfigBase & {
|
|
67
|
+
/**
|
|
68
|
+
* Disable custom Cognito user pool domain resources.
|
|
69
|
+
*/
|
|
70
|
+
enableUserPoolDomain: false;
|
|
71
|
+
hostedZoneIdParameterName?: never;
|
|
72
|
+
domainNameParameterName?: never;
|
|
73
|
+
sslCertificateId?: never;
|
|
74
|
+
mainCDNCloudFrontId?: never;
|
|
75
|
+
};
|
|
58
76
|
/**
|
|
59
|
-
*
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
* */
|
|
77
|
+
* Configuration for {@link addAuth}.
|
|
78
|
+
*/
|
|
79
|
+
export type AddAuthConfig = AddAuthConfigWithUserPoolDomain | AddAuthConfigWithoutUserPoolDomain;
|
|
63
80
|
/**
|
|
64
81
|
* Add auth resources including user management and an admin group.
|
|
65
82
|
*
|
|
66
83
|
* @group Resource Packs
|
|
67
84
|
*/
|
|
68
85
|
export declare const addAuth: import("..").ResourcePackApplier<AddAuthConfig>;
|
|
86
|
+
export {};
|
package/iac/packs/index.js
CHANGED
|
@@ -170,19 +170,16 @@ var createResourcePack = (creator) => (params, template) => {
|
|
|
170
170
|
|
|
171
171
|
// src/iac/packs/auth/user-management.ts
|
|
172
172
|
var addUserManagement = createResourcePack(
|
|
173
|
-
({
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
apiGatewayRESTAPIId,
|
|
184
|
-
apiStageName
|
|
185
|
-
}) => {
|
|
173
|
+
(config) => {
|
|
174
|
+
const {
|
|
175
|
+
id,
|
|
176
|
+
authRoleName,
|
|
177
|
+
unauthRoleName,
|
|
178
|
+
callbackUrls,
|
|
179
|
+
logoutUrls,
|
|
180
|
+
apiGatewayRESTAPIId,
|
|
181
|
+
apiStageName
|
|
182
|
+
} = config;
|
|
186
183
|
const apiRoleConfig = apiGatewayRESTAPIId && apiStageName ? {
|
|
187
184
|
[`${id}IdentityPoolRoles`]: {
|
|
188
185
|
Type: "AWS::Cognito::IdentityPoolRoleAttachment",
|
|
@@ -317,6 +314,63 @@ var addUserManagement = createResourcePack(
|
|
|
317
314
|
}
|
|
318
315
|
}
|
|
319
316
|
} : {};
|
|
317
|
+
const userPoolDomainConfig = config.enableUserPoolDomain === false ? {} : {
|
|
318
|
+
[`${id}BaseDomainRecord`]: !!config.baseDomainRecordAliasTargetDNSName ? {
|
|
319
|
+
Type: "AWS::Route53::RecordSet",
|
|
320
|
+
DeletionPolicy: "Delete",
|
|
321
|
+
Properties: {
|
|
322
|
+
HostedZoneId: config.hostedZoneId,
|
|
323
|
+
Type: "A",
|
|
324
|
+
Name: config.domainName,
|
|
325
|
+
AliasTarget: {
|
|
326
|
+
HostedZoneId: "Z2FDTNDATAQYW2",
|
|
327
|
+
DNSName: config.baseDomainRecordAliasTargetDNSName
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
} : void 0,
|
|
331
|
+
[`${id}DomainRecord`]: {
|
|
332
|
+
Type: "AWS::Route53::RecordSet",
|
|
333
|
+
DeletionPolicy: "Delete",
|
|
334
|
+
Properties: {
|
|
335
|
+
HostedZoneId: config.hostedZoneId,
|
|
336
|
+
Type: "A",
|
|
337
|
+
Name: {
|
|
338
|
+
"Fn::Sub": [
|
|
339
|
+
"auth.${BaseDomainName}",
|
|
340
|
+
{
|
|
341
|
+
BaseDomainName: config.domainName
|
|
342
|
+
}
|
|
343
|
+
]
|
|
344
|
+
},
|
|
345
|
+
AliasTarget: {
|
|
346
|
+
HostedZoneId: "Z2FDTNDATAQYW2",
|
|
347
|
+
DNSName: {
|
|
348
|
+
"Fn::GetAtt": [`${id}Domain`, "CloudFrontDistribution"]
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
[`${id}Domain`]: {
|
|
354
|
+
Type: "AWS::Cognito::UserPoolDomain",
|
|
355
|
+
DependsOn: !!config.baseDomainRecordAliasTargetDNSName ? `${id}BaseDomainRecord` : void 0,
|
|
356
|
+
Properties: {
|
|
357
|
+
Domain: {
|
|
358
|
+
"Fn::Sub": [
|
|
359
|
+
"auth.${BaseDomainName}",
|
|
360
|
+
{
|
|
361
|
+
BaseDomainName: config.domainName
|
|
362
|
+
}
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
UserPoolId: {
|
|
366
|
+
Ref: id
|
|
367
|
+
},
|
|
368
|
+
CustomDomainConfig: {
|
|
369
|
+
CertificateArn: config.sslCertificateArn
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
};
|
|
320
374
|
return {
|
|
321
375
|
Resources: {
|
|
322
376
|
[id]: {
|
|
@@ -370,61 +424,6 @@ var addUserManagement = createResourcePack(
|
|
|
370
424
|
}
|
|
371
425
|
}
|
|
372
426
|
},
|
|
373
|
-
[`${id}BaseDomainRecord`]: !!baseDomainRecordAliasTargetDNSName ? {
|
|
374
|
-
Type: "AWS::Route53::RecordSet",
|
|
375
|
-
DeletionPolicy: "Delete",
|
|
376
|
-
Properties: {
|
|
377
|
-
HostedZoneId: hostedZoneId,
|
|
378
|
-
Type: "A",
|
|
379
|
-
Name: domainName,
|
|
380
|
-
AliasTarget: {
|
|
381
|
-
HostedZoneId: "Z2FDTNDATAQYW2",
|
|
382
|
-
DNSName: baseDomainRecordAliasTargetDNSName
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
} : void 0,
|
|
386
|
-
[`${id}DomainRecord`]: {
|
|
387
|
-
Type: "AWS::Route53::RecordSet",
|
|
388
|
-
DeletionPolicy: "Delete",
|
|
389
|
-
Properties: {
|
|
390
|
-
HostedZoneId: hostedZoneId,
|
|
391
|
-
Type: "A",
|
|
392
|
-
Name: {
|
|
393
|
-
"Fn::Sub": [
|
|
394
|
-
"auth.${BaseDomainName}",
|
|
395
|
-
{
|
|
396
|
-
BaseDomainName: domainName
|
|
397
|
-
}
|
|
398
|
-
]
|
|
399
|
-
},
|
|
400
|
-
AliasTarget: {
|
|
401
|
-
HostedZoneId: "Z2FDTNDATAQYW2",
|
|
402
|
-
DNSName: {
|
|
403
|
-
"Fn::GetAtt": [`${id}Domain`, "CloudFrontDistribution"]
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
},
|
|
408
|
-
[`${id}Domain`]: {
|
|
409
|
-
Type: "AWS::Cognito::UserPoolDomain",
|
|
410
|
-
DependsOn: !!baseDomainRecordAliasTargetDNSName ? `${id}BaseDomainRecord` : void 0,
|
|
411
|
-
Properties: {
|
|
412
|
-
Domain: {
|
|
413
|
-
"Fn::Sub": [
|
|
414
|
-
"auth.${BaseDomainName}",
|
|
415
|
-
{
|
|
416
|
-
BaseDomainName: domainName
|
|
417
|
-
}
|
|
418
|
-
]
|
|
419
|
-
},
|
|
420
|
-
UserPoolId: {
|
|
421
|
-
Ref: id
|
|
422
|
-
},
|
|
423
|
-
CustomDomainConfig: {
|
|
424
|
-
CertificateArn: sslCertificateArn
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
427
|
[`${id}Client`]: {
|
|
429
428
|
Type: "AWS::Cognito::UserPoolClient",
|
|
430
429
|
Properties: {
|
|
@@ -470,6 +469,7 @@ var addUserManagement = createResourcePack(
|
|
|
470
469
|
]
|
|
471
470
|
}
|
|
472
471
|
},
|
|
472
|
+
...userPoolDomainConfig,
|
|
473
473
|
...apiRoleConfig
|
|
474
474
|
}
|
|
475
475
|
};
|
|
@@ -563,43 +563,45 @@ var SimpleCFT = class {
|
|
|
563
563
|
};
|
|
564
564
|
|
|
565
565
|
// src/iac/packs/auth.ts
|
|
566
|
-
var addAuth = createResourcePack(
|
|
567
|
-
|
|
566
|
+
var addAuth = createResourcePack((config) => {
|
|
567
|
+
const {
|
|
568
568
|
userManagementId,
|
|
569
569
|
authRoleName,
|
|
570
570
|
unauthRoleName,
|
|
571
|
-
hostedZoneIdParameterName,
|
|
572
|
-
domainNameParameterName,
|
|
573
|
-
sslCertificateId,
|
|
574
571
|
callbackUrls,
|
|
575
572
|
logoutUrls,
|
|
576
|
-
mainCDNCloudFrontId,
|
|
577
573
|
apiCloudFunctionGatewayId,
|
|
578
574
|
apiStageName,
|
|
579
575
|
adminGroupId,
|
|
580
576
|
userManagementAdminGroupName
|
|
581
|
-
}
|
|
577
|
+
} = config;
|
|
578
|
+
return new SimpleCFT().applyPack(addUserManagement, {
|
|
582
579
|
id: userManagementId,
|
|
583
580
|
authRoleName,
|
|
584
581
|
unauthRoleName,
|
|
585
|
-
domainName: {
|
|
586
|
-
Ref: domainNameParameterName
|
|
587
|
-
},
|
|
588
|
-
hostedZoneId: {
|
|
589
|
-
Ref: hostedZoneIdParameterName
|
|
590
|
-
},
|
|
591
|
-
sslCertificateArn: {
|
|
592
|
-
Ref: sslCertificateId
|
|
593
|
-
},
|
|
594
582
|
callbackUrls,
|
|
595
583
|
logoutUrls,
|
|
596
|
-
baseDomainRecordAliasTargetDNSName: {
|
|
597
|
-
"Fn::GetAtt": [mainCDNCloudFrontId, "DomainName"]
|
|
598
|
-
},
|
|
599
584
|
apiGatewayRESTAPIId: {
|
|
600
585
|
Ref: apiCloudFunctionGatewayId
|
|
601
586
|
},
|
|
602
|
-
apiStageName
|
|
587
|
+
apiStageName,
|
|
588
|
+
...config.enableUserPoolDomain === false ? {
|
|
589
|
+
enableUserPoolDomain: false
|
|
590
|
+
} : {
|
|
591
|
+
enableUserPoolDomain: true,
|
|
592
|
+
domainName: {
|
|
593
|
+
Ref: config.domainNameParameterName
|
|
594
|
+
},
|
|
595
|
+
hostedZoneId: {
|
|
596
|
+
Ref: config.hostedZoneIdParameterName
|
|
597
|
+
},
|
|
598
|
+
sslCertificateArn: {
|
|
599
|
+
Ref: config.sslCertificateId
|
|
600
|
+
},
|
|
601
|
+
baseDomainRecordAliasTargetDNSName: {
|
|
602
|
+
"Fn::GetAtt": [config.mainCDNCloudFrontId, "DomainName"]
|
|
603
|
+
}
|
|
604
|
+
}
|
|
603
605
|
}).patch({
|
|
604
606
|
Resources: {
|
|
605
607
|
[adminGroupId]: {
|
|
@@ -613,8 +615,8 @@ var addAuth = createResourcePack(
|
|
|
613
615
|
}
|
|
614
616
|
}
|
|
615
617
|
}
|
|
616
|
-
}).template
|
|
617
|
-
);
|
|
618
|
+
}).template;
|
|
619
|
+
});
|
|
618
620
|
|
|
619
621
|
// src/iac/packs/build.ts
|
|
620
622
|
var DEFAULT_BUILD_PIPELINE_REPO_PROVIDER = "GitHub";
|