@ttoss/cloud-auth 0.4.0 → 0.6.0
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/.turbo/turbo-build.log +5 -5
- package/.turbo/turbo-test.log +13 -12
- package/CHANGELOG.md +12 -0
- package/coverage/clover.xml +163 -161
- package/coverage/coverage-final.json +1 -1
- package/coverage/lcov-report/config.ts.html +1 -1
- package/coverage/lcov-report/index.html +10 -10
- package/coverage/lcov-report/index.ts.html +1 -1
- package/coverage/lcov-report/template.ts.html +158 -152
- package/coverage/lcov.info +169 -167
- package/dist/esm/index.js +4 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -3
- package/package.json +6 -6
- package/src/template.ts +4 -2
- package/tests/unit/template.test.ts +8 -1
package/coverage/lcov.info
CHANGED
|
@@ -31,7 +31,7 @@ SF:src/template.ts
|
|
|
31
31
|
FN:16,createAuthTemplate
|
|
32
32
|
FNF:1
|
|
33
33
|
FNH:1
|
|
34
|
-
FNDA:
|
|
34
|
+
FNDA:12,createAuthTemplate
|
|
35
35
|
DA:1,1
|
|
36
36
|
DA:2,1
|
|
37
37
|
DA:3,1
|
|
@@ -48,140 +48,140 @@ DA:13,1
|
|
|
48
48
|
DA:14,1
|
|
49
49
|
DA:15,1
|
|
50
50
|
DA:16,1
|
|
51
|
-
DA:17,
|
|
52
|
-
DA:18,
|
|
53
|
-
DA:19,
|
|
54
|
-
DA:20,
|
|
55
|
-
DA:21,
|
|
56
|
-
DA:22,
|
|
57
|
-
DA:23,
|
|
58
|
-
DA:24,
|
|
59
|
-
DA:25,
|
|
60
|
-
DA:26,
|
|
61
|
-
DA:27,
|
|
62
|
-
DA:28,
|
|
63
|
-
DA:29,
|
|
64
|
-
DA:30,
|
|
65
|
-
DA:31,
|
|
66
|
-
DA:32,
|
|
67
|
-
DA:33,
|
|
68
|
-
DA:34,
|
|
69
|
-
DA:35,
|
|
70
|
-
DA:36,
|
|
71
|
-
DA:37,
|
|
72
|
-
DA:38,
|
|
73
|
-
DA:39,
|
|
74
|
-
DA:40,
|
|
75
|
-
DA:41,
|
|
76
|
-
DA:42,
|
|
77
|
-
DA:43,
|
|
78
|
-
DA:44,
|
|
79
|
-
DA:45,
|
|
80
|
-
DA:46,
|
|
81
|
-
DA:47,
|
|
82
|
-
DA:48,
|
|
83
|
-
DA:49,
|
|
84
|
-
DA:50,
|
|
85
|
-
DA:51,
|
|
86
|
-
DA:52,
|
|
87
|
-
DA:53,
|
|
88
|
-
DA:54,
|
|
89
|
-
DA:55,
|
|
90
|
-
DA:56,
|
|
91
|
-
DA:57,
|
|
92
|
-
DA:58,
|
|
93
|
-
DA:59,
|
|
94
|
-
DA:60,
|
|
95
|
-
DA:61,
|
|
96
|
-
DA:62,
|
|
97
|
-
DA:63,
|
|
98
|
-
DA:64,
|
|
99
|
-
DA:65,
|
|
100
|
-
DA:66,
|
|
101
|
-
DA:67,
|
|
102
|
-
DA:68,
|
|
103
|
-
DA:69,
|
|
104
|
-
DA:70,
|
|
105
|
-
DA:71,
|
|
106
|
-
DA:72,
|
|
107
|
-
DA:73,
|
|
108
|
-
DA:74,
|
|
109
|
-
DA:75,
|
|
110
|
-
DA:76,
|
|
111
|
-
DA:77,
|
|
112
|
-
DA:78,
|
|
113
|
-
DA:79,
|
|
114
|
-
DA:80,
|
|
115
|
-
DA:81,
|
|
116
|
-
DA:82,
|
|
117
|
-
DA:83,
|
|
118
|
-
DA:84,
|
|
119
|
-
DA:85,
|
|
120
|
-
DA:86,
|
|
121
|
-
DA:87,
|
|
122
|
-
DA:88,
|
|
123
|
-
DA:89,
|
|
124
|
-
DA:90,
|
|
125
|
-
DA:91,
|
|
126
|
-
DA:92,
|
|
127
|
-
DA:93,
|
|
128
|
-
DA:94,
|
|
129
|
-
DA:95,
|
|
130
|
-
DA:96,
|
|
131
|
-
DA:97,
|
|
132
|
-
DA:98,
|
|
133
|
-
DA:99,
|
|
134
|
-
DA:100,
|
|
135
|
-
DA:101,
|
|
136
|
-
DA:102,
|
|
137
|
-
DA:103,
|
|
138
|
-
DA:104,
|
|
139
|
-
DA:105,
|
|
140
|
-
DA:106,
|
|
141
|
-
DA:107,
|
|
142
|
-
DA:108,
|
|
143
|
-
DA:109,
|
|
144
|
-
DA:110,
|
|
145
|
-
DA:111,
|
|
146
|
-
DA:112,
|
|
147
|
-
DA:113,
|
|
148
|
-
DA:114,
|
|
149
|
-
DA:115,
|
|
150
|
-
DA:116,
|
|
151
|
-
DA:117,
|
|
152
|
-
DA:118,
|
|
153
|
-
DA:119,
|
|
154
|
-
DA:120,
|
|
155
|
-
DA:121,
|
|
156
|
-
DA:122,
|
|
157
|
-
DA:123,
|
|
158
|
-
DA:124,
|
|
159
|
-
DA:125,
|
|
160
|
-
DA:126,
|
|
161
|
-
DA:127,
|
|
162
|
-
DA:128,
|
|
163
|
-
DA:129,
|
|
164
|
-
DA:130,
|
|
165
|
-
DA:131,
|
|
166
|
-
DA:132,
|
|
167
|
-
DA:133,
|
|
168
|
-
DA:134,
|
|
169
|
-
DA:135,
|
|
170
|
-
DA:136,
|
|
171
|
-
DA:137,
|
|
172
|
-
DA:138,
|
|
173
|
-
DA:139,
|
|
174
|
-
DA:140,
|
|
175
|
-
DA:141,
|
|
176
|
-
DA:142,
|
|
177
|
-
DA:143,
|
|
178
|
-
DA:144,
|
|
179
|
-
DA:145,
|
|
180
|
-
DA:146,
|
|
181
|
-
DA:147,
|
|
182
|
-
DA:148,
|
|
183
|
-
DA:149,
|
|
184
|
-
DA:150,
|
|
51
|
+
DA:17,12
|
|
52
|
+
DA:18,12
|
|
53
|
+
DA:19,12
|
|
54
|
+
DA:20,12
|
|
55
|
+
DA:21,12
|
|
56
|
+
DA:22,12
|
|
57
|
+
DA:23,12
|
|
58
|
+
DA:24,12
|
|
59
|
+
DA:25,12
|
|
60
|
+
DA:26,12
|
|
61
|
+
DA:27,12
|
|
62
|
+
DA:28,12
|
|
63
|
+
DA:29,12
|
|
64
|
+
DA:30,12
|
|
65
|
+
DA:31,12
|
|
66
|
+
DA:32,12
|
|
67
|
+
DA:33,12
|
|
68
|
+
DA:34,12
|
|
69
|
+
DA:35,12
|
|
70
|
+
DA:36,12
|
|
71
|
+
DA:37,12
|
|
72
|
+
DA:38,12
|
|
73
|
+
DA:39,12
|
|
74
|
+
DA:40,12
|
|
75
|
+
DA:41,12
|
|
76
|
+
DA:42,12
|
|
77
|
+
DA:43,12
|
|
78
|
+
DA:44,12
|
|
79
|
+
DA:45,12
|
|
80
|
+
DA:46,12
|
|
81
|
+
DA:47,12
|
|
82
|
+
DA:48,12
|
|
83
|
+
DA:49,12
|
|
84
|
+
DA:50,12
|
|
85
|
+
DA:51,9
|
|
86
|
+
DA:52,12
|
|
87
|
+
DA:53,12
|
|
88
|
+
DA:54,12
|
|
89
|
+
DA:55,12
|
|
90
|
+
DA:56,12
|
|
91
|
+
DA:57,12
|
|
92
|
+
DA:58,12
|
|
93
|
+
DA:59,12
|
|
94
|
+
DA:60,12
|
|
95
|
+
DA:61,12
|
|
96
|
+
DA:62,12
|
|
97
|
+
DA:63,12
|
|
98
|
+
DA:64,12
|
|
99
|
+
DA:65,12
|
|
100
|
+
DA:66,12
|
|
101
|
+
DA:67,12
|
|
102
|
+
DA:68,12
|
|
103
|
+
DA:69,12
|
|
104
|
+
DA:70,12
|
|
105
|
+
DA:71,12
|
|
106
|
+
DA:72,12
|
|
107
|
+
DA:73,12
|
|
108
|
+
DA:74,12
|
|
109
|
+
DA:75,12
|
|
110
|
+
DA:76,12
|
|
111
|
+
DA:77,12
|
|
112
|
+
DA:78,12
|
|
113
|
+
DA:79,12
|
|
114
|
+
DA:80,12
|
|
115
|
+
DA:81,12
|
|
116
|
+
DA:82,12
|
|
117
|
+
DA:83,12
|
|
118
|
+
DA:84,12
|
|
119
|
+
DA:85,12
|
|
120
|
+
DA:86,12
|
|
121
|
+
DA:87,12
|
|
122
|
+
DA:88,12
|
|
123
|
+
DA:89,12
|
|
124
|
+
DA:90,12
|
|
125
|
+
DA:91,12
|
|
126
|
+
DA:92,12
|
|
127
|
+
DA:93,12
|
|
128
|
+
DA:94,12
|
|
129
|
+
DA:95,12
|
|
130
|
+
DA:96,12
|
|
131
|
+
DA:97,12
|
|
132
|
+
DA:98,12
|
|
133
|
+
DA:99,12
|
|
134
|
+
DA:100,12
|
|
135
|
+
DA:101,12
|
|
136
|
+
DA:102,12
|
|
137
|
+
DA:103,12
|
|
138
|
+
DA:104,12
|
|
139
|
+
DA:105,12
|
|
140
|
+
DA:106,12
|
|
141
|
+
DA:107,12
|
|
142
|
+
DA:108,12
|
|
143
|
+
DA:109,12
|
|
144
|
+
DA:110,12
|
|
145
|
+
DA:111,12
|
|
146
|
+
DA:112,12
|
|
147
|
+
DA:113,12
|
|
148
|
+
DA:114,12
|
|
149
|
+
DA:115,12
|
|
150
|
+
DA:116,12
|
|
151
|
+
DA:117,12
|
|
152
|
+
DA:118,12
|
|
153
|
+
DA:119,12
|
|
154
|
+
DA:120,12
|
|
155
|
+
DA:121,12
|
|
156
|
+
DA:122,12
|
|
157
|
+
DA:123,12
|
|
158
|
+
DA:124,12
|
|
159
|
+
DA:125,12
|
|
160
|
+
DA:126,12
|
|
161
|
+
DA:127,12
|
|
162
|
+
DA:128,12
|
|
163
|
+
DA:129,12
|
|
164
|
+
DA:130,11
|
|
165
|
+
DA:131,11
|
|
166
|
+
DA:132,11
|
|
167
|
+
DA:133,11
|
|
168
|
+
DA:134,11
|
|
169
|
+
DA:135,11
|
|
170
|
+
DA:136,11
|
|
171
|
+
DA:137,11
|
|
172
|
+
DA:138,11
|
|
173
|
+
DA:139,11
|
|
174
|
+
DA:140,11
|
|
175
|
+
DA:141,11
|
|
176
|
+
DA:142,11
|
|
177
|
+
DA:143,11
|
|
178
|
+
DA:144,11
|
|
179
|
+
DA:145,11
|
|
180
|
+
DA:146,11
|
|
181
|
+
DA:147,11
|
|
182
|
+
DA:148,11
|
|
183
|
+
DA:149,11
|
|
184
|
+
DA:150,11
|
|
185
185
|
DA:151,1
|
|
186
186
|
DA:152,1
|
|
187
187
|
DA:153,1
|
|
@@ -193,43 +193,45 @@ DA:158,1
|
|
|
193
193
|
DA:159,1
|
|
194
194
|
DA:160,1
|
|
195
195
|
DA:161,1
|
|
196
|
-
DA:162,
|
|
197
|
-
DA:163,
|
|
198
|
-
DA:164,
|
|
199
|
-
DA:165,
|
|
200
|
-
DA:166,
|
|
201
|
-
DA:167,
|
|
202
|
-
DA:168,
|
|
203
|
-
DA:169,
|
|
204
|
-
DA:170,
|
|
205
|
-
DA:171,
|
|
206
|
-
DA:172,
|
|
207
|
-
DA:173,
|
|
208
|
-
DA:174,
|
|
209
|
-
DA:175,
|
|
210
|
-
DA:176,
|
|
211
|
-
DA:177,
|
|
212
|
-
DA:178,
|
|
213
|
-
DA:179,
|
|
214
|
-
DA:180,
|
|
215
|
-
DA:181,
|
|
196
|
+
DA:162,1
|
|
197
|
+
DA:163,1
|
|
198
|
+
DA:164,11
|
|
199
|
+
DA:165,11
|
|
200
|
+
DA:166,0
|
|
201
|
+
DA:167,0
|
|
202
|
+
DA:168,11
|
|
203
|
+
DA:169,11
|
|
204
|
+
DA:170,11
|
|
205
|
+
DA:171,11
|
|
206
|
+
DA:172,11
|
|
207
|
+
DA:173,11
|
|
208
|
+
DA:174,11
|
|
209
|
+
DA:175,11
|
|
210
|
+
DA:176,11
|
|
211
|
+
DA:177,11
|
|
212
|
+
DA:178,11
|
|
213
|
+
DA:179,11
|
|
214
|
+
DA:180,11
|
|
215
|
+
DA:181,11
|
|
216
216
|
DA:182,11
|
|
217
217
|
DA:183,11
|
|
218
|
-
DA:184,
|
|
219
|
-
DA:185,
|
|
220
|
-
DA:186,
|
|
218
|
+
DA:184,12
|
|
219
|
+
DA:185,12
|
|
220
|
+
DA:186,12
|
|
221
221
|
DA:187,1
|
|
222
222
|
DA:188,1
|
|
223
223
|
DA:189,1
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
BRDA:
|
|
229
|
-
BRDA:50,
|
|
230
|
-
BRDA:
|
|
231
|
-
BRDA:
|
|
232
|
-
BRDA:
|
|
224
|
+
DA:190,1
|
|
225
|
+
DA:191,1
|
|
226
|
+
LF:191
|
|
227
|
+
LH:189
|
|
228
|
+
BRDA:16,0,0,12
|
|
229
|
+
BRDA:50,1,0,10
|
|
230
|
+
BRDA:51,2,0,9
|
|
231
|
+
BRDA:52,3,0,3
|
|
232
|
+
BRDA:129,4,0,11
|
|
233
|
+
BRDA:150,5,0,1
|
|
234
|
+
BRDA:165,6,0,0
|
|
233
235
|
BRF:7
|
|
234
236
|
BRH:6
|
|
235
237
|
end_of_record
|
package/dist/esm/index.js
CHANGED
|
@@ -11,9 +11,10 @@ var createAuthTemplate = ({
|
|
|
11
11
|
autoVerifiedAttributes = ["email"],
|
|
12
12
|
identityPool = true,
|
|
13
13
|
roles,
|
|
14
|
-
schema
|
|
14
|
+
schema,
|
|
15
|
+
usernameAttributes = ["email"]
|
|
15
16
|
} = {}) => {
|
|
16
|
-
const AutoVerifiedAttributes = Array.isArray(autoVerifiedAttributes) && autoVerifiedAttributes.length > 0 ? autoVerifiedAttributes :
|
|
17
|
+
const AutoVerifiedAttributes = Array.isArray(autoVerifiedAttributes) && autoVerifiedAttributes.length > 0 ? autoVerifiedAttributes : [];
|
|
17
18
|
const template = {
|
|
18
19
|
AWSTemplateFormatVersion: "2010-09-09",
|
|
19
20
|
Resources: {
|
|
@@ -32,7 +33,7 @@ var createAuthTemplate = ({
|
|
|
32
33
|
}
|
|
33
34
|
},
|
|
34
35
|
Schema: schema,
|
|
35
|
-
UsernameAttributes:
|
|
36
|
+
UsernameAttributes: usernameAttributes,
|
|
36
37
|
UsernameConfiguration: {
|
|
37
38
|
CaseSensitive: false
|
|
38
39
|
},
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ type Role = string | {
|
|
|
6
6
|
'Fn::ImportValue': string;
|
|
7
7
|
};
|
|
8
8
|
declare const createAuthTemplate: {
|
|
9
|
-
({ autoVerifiedAttributes, identityPool, roles, schema, }?: {
|
|
9
|
+
({ autoVerifiedAttributes, identityPool, roles, schema, usernameAttributes, }?: {
|
|
10
10
|
autoVerifiedAttributes?: false | ("email" | "phone_number")[] | null | undefined;
|
|
11
11
|
identityPool?: boolean | undefined;
|
|
12
12
|
roles?: {
|
|
@@ -31,6 +31,7 @@ declare const createAuthTemplate: {
|
|
|
31
31
|
MinLength: string;
|
|
32
32
|
} | undefined;
|
|
33
33
|
}[] | undefined;
|
|
34
|
+
usernameAttributes?: ("email" | "phone_number")[] | null | undefined;
|
|
34
35
|
}): CloudFormationTemplate;
|
|
35
36
|
CognitoUserPoolLogicalId: string;
|
|
36
37
|
CognitoUserPoolClientLogicalId: string;
|
package/dist/index.js
CHANGED
|
@@ -37,9 +37,10 @@ var createAuthTemplate = ({
|
|
|
37
37
|
autoVerifiedAttributes = ["email"],
|
|
38
38
|
identityPool = true,
|
|
39
39
|
roles,
|
|
40
|
-
schema
|
|
40
|
+
schema,
|
|
41
|
+
usernameAttributes = ["email"]
|
|
41
42
|
} = {}) => {
|
|
42
|
-
const AutoVerifiedAttributes = Array.isArray(autoVerifiedAttributes) && autoVerifiedAttributes.length > 0 ? autoVerifiedAttributes :
|
|
43
|
+
const AutoVerifiedAttributes = Array.isArray(autoVerifiedAttributes) && autoVerifiedAttributes.length > 0 ? autoVerifiedAttributes : [];
|
|
43
44
|
const template = {
|
|
44
45
|
AWSTemplateFormatVersion: "2010-09-09",
|
|
45
46
|
Resources: {
|
|
@@ -58,7 +59,7 @@ var createAuthTemplate = ({
|
|
|
58
59
|
}
|
|
59
60
|
},
|
|
60
61
|
Schema: schema,
|
|
61
|
-
UsernameAttributes:
|
|
62
|
+
UsernameAttributes: usernameAttributes,
|
|
62
63
|
UsernameConfiguration: {
|
|
63
64
|
CaseSensitive: false
|
|
64
65
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/cloud-auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
},
|
|
10
10
|
"typings": "./dist/index.d.ts",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@ttoss/cloudformation": "^0.
|
|
12
|
+
"@ttoss/cloudformation": "^0.5.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@ttoss/config": "^1.
|
|
16
|
-
"@types/jest": "^29.
|
|
17
|
-
"jest": "^29.
|
|
15
|
+
"@ttoss/config": "^1.28.0",
|
|
16
|
+
"@types/jest": "^29.4.0",
|
|
17
|
+
"jest": "^29.4.1",
|
|
18
18
|
"typescript": "^4.9.4"
|
|
19
19
|
},
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "7852c1c6c570e30cd03a603902f45fb4849c7701"
|
|
24
24
|
}
|
package/src/template.ts
CHANGED
|
@@ -18,6 +18,7 @@ export const createAuthTemplate = ({
|
|
|
18
18
|
identityPool = true,
|
|
19
19
|
roles,
|
|
20
20
|
schema,
|
|
21
|
+
usernameAttributes = ['email'],
|
|
21
22
|
}: {
|
|
22
23
|
autoVerifiedAttributes?: Array<'email' | 'phone_number'> | null | false;
|
|
23
24
|
identityPool?: boolean;
|
|
@@ -43,11 +44,12 @@ export const createAuthTemplate = ({
|
|
|
43
44
|
MinLength: string;
|
|
44
45
|
};
|
|
45
46
|
}[];
|
|
47
|
+
usernameAttributes?: Array<'email' | 'phone_number'> | null;
|
|
46
48
|
} = {}) => {
|
|
47
49
|
const AutoVerifiedAttributes =
|
|
48
50
|
Array.isArray(autoVerifiedAttributes) && autoVerifiedAttributes.length > 0
|
|
49
51
|
? autoVerifiedAttributes
|
|
50
|
-
:
|
|
52
|
+
: [];
|
|
51
53
|
|
|
52
54
|
const template: CloudFormationTemplate = {
|
|
53
55
|
AWSTemplateFormatVersion: '2010-09-09',
|
|
@@ -67,7 +69,7 @@ export const createAuthTemplate = ({
|
|
|
67
69
|
},
|
|
68
70
|
},
|
|
69
71
|
Schema: schema,
|
|
70
|
-
UsernameAttributes:
|
|
72
|
+
UsernameAttributes: usernameAttributes,
|
|
71
73
|
UsernameConfiguration: {
|
|
72
74
|
CaseSensitive: false,
|
|
73
75
|
},
|
|
@@ -37,7 +37,7 @@ test.each([[], null, false])(
|
|
|
37
37
|
const template = createAuthTemplate({ autoVerifiedAttributes });
|
|
38
38
|
expect(
|
|
39
39
|
template.Resources.CognitoUserPool.Properties.AutoVerifiedAttributes
|
|
40
|
-
).
|
|
40
|
+
).toEqual([]);
|
|
41
41
|
}
|
|
42
42
|
);
|
|
43
43
|
|
|
@@ -71,3 +71,10 @@ test('should not have identity pool role attachment without roles', () => {
|
|
|
71
71
|
const template = createAuthTemplate();
|
|
72
72
|
expect(template.Resources.CognitoIdentityPoolRoleAttachment).toBeUndefined();
|
|
73
73
|
});
|
|
74
|
+
|
|
75
|
+
test('default usernameAttributes should be email', () => {
|
|
76
|
+
const template = createAuthTemplate();
|
|
77
|
+
expect(
|
|
78
|
+
template.Resources.CognitoUserPool.Properties.UsernameAttributes
|
|
79
|
+
).toEqual(['email']);
|
|
80
|
+
});
|