@ttoss/cloud-auth 0.7.0 → 0.7.2
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 +15 -13
- package/CHANGELOG.md +10 -0
- package/coverage/clover.xml +131 -130
- 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 +146 -143
- package/coverage/lcov.info +136 -135
- package/dist/esm/index.js +1 -0
- package/dist/index.js +1 -0
- package/package.json +6 -6
- package/src/template.ts +1 -0
- package/tests/unit/template.test.ts +61 -52
package/dist/esm/index.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/cloud-auth",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
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.6.
|
|
12
|
+
"@ttoss/cloudformation": "^0.6.2"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@ttoss/config": "^1.28.
|
|
16
|
-
"@types/jest": "^29.4.
|
|
17
|
-
"jest": "^29.
|
|
15
|
+
"@ttoss/config": "^1.28.4",
|
|
16
|
+
"@types/jest": "^29.4.4",
|
|
17
|
+
"jest": "^29.5.0",
|
|
18
18
|
"typescript": "^4.9.5"
|
|
19
19
|
},
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "2f241b7126c460eeaea3eba6445aa139411d4b19"
|
|
24
24
|
}
|
package/src/template.ts
CHANGED
|
@@ -1,64 +1,73 @@
|
|
|
1
1
|
import { createAuthTemplate } from '../../src';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
describe('user pool', () => {
|
|
4
|
+
test('do not add schema if not provided', () => {
|
|
5
|
+
const template = createAuthTemplate();
|
|
6
|
+
expect(
|
|
7
|
+
template.Resources.CognitoUserPool.Properties.Schema
|
|
8
|
+
).toBeUndefined();
|
|
9
|
+
});
|
|
7
10
|
|
|
8
|
-
test('add schema if provided', () => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
test('add schema if provided', () => {
|
|
12
|
+
const schema = [
|
|
13
|
+
{
|
|
14
|
+
attributeDataType: 'String' as const,
|
|
15
|
+
developerOnlyAttribute: false,
|
|
16
|
+
mutable: true,
|
|
17
|
+
name: 'email',
|
|
18
|
+
required: true,
|
|
19
|
+
stringAttributeConstraints: {
|
|
20
|
+
maxLength: '2048',
|
|
21
|
+
minLength: '0',
|
|
22
|
+
},
|
|
19
23
|
},
|
|
20
|
-
|
|
21
|
-
];
|
|
24
|
+
];
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
const template = createAuthTemplate({ schema });
|
|
27
|
+
expect(template.Resources.CognitoUserPool.Properties.Schema).toEqual([
|
|
28
|
+
{
|
|
29
|
+
AttributeDataType: 'String',
|
|
30
|
+
DeveloperOnlyAttribute: false,
|
|
31
|
+
Mutable: true,
|
|
32
|
+
Name: 'email',
|
|
33
|
+
Required: true,
|
|
34
|
+
StringAttributeConstraints: {
|
|
35
|
+
MaxLength: '2048',
|
|
36
|
+
MinLength: '0',
|
|
37
|
+
},
|
|
34
38
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test('should have autoVerifiedAttributes equal email by default', () => {
|
|
40
|
-
const template = createAuthTemplate();
|
|
41
|
-
expect(
|
|
42
|
-
template.Resources.CognitoUserPool.Properties.AutoVerifiedAttributes
|
|
43
|
-
).toEqual(['email']);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test('default usernameAttributes should be email', () => {
|
|
47
|
-
const template = createAuthTemplate();
|
|
48
|
-
expect(
|
|
49
|
-
template.Resources.CognitoUserPool.Properties.UsernameAttributes
|
|
50
|
-
).toEqual(['email']);
|
|
51
|
-
});
|
|
39
|
+
]);
|
|
40
|
+
});
|
|
52
41
|
|
|
53
|
-
test
|
|
54
|
-
|
|
55
|
-
(autoVerifiedAttributes: any) => {
|
|
56
|
-
const template = createAuthTemplate({ autoVerifiedAttributes });
|
|
42
|
+
test('should have autoVerifiedAttributes equal email by default', () => {
|
|
43
|
+
const template = createAuthTemplate();
|
|
57
44
|
expect(
|
|
58
45
|
template.Resources.CognitoUserPool.Properties.AutoVerifiedAttributes
|
|
59
|
-
).toEqual([]);
|
|
60
|
-
}
|
|
61
|
-
|
|
46
|
+
).toEqual(['email']);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('default usernameAttributes should be email', () => {
|
|
50
|
+
const template = createAuthTemplate();
|
|
51
|
+
expect(
|
|
52
|
+
template.Resources.CognitoUserPool.Properties.UsernameAttributes
|
|
53
|
+
).toEqual(['email']);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test.each([[], null, false])(
|
|
57
|
+
'should have autoVerifiedAttributes undefined: %p',
|
|
58
|
+
(autoVerifiedAttributes: any) => {
|
|
59
|
+
const template = createAuthTemplate({ autoVerifiedAttributes });
|
|
60
|
+
expect(
|
|
61
|
+
template.Resources.CognitoUserPool.Properties.AutoVerifiedAttributes
|
|
62
|
+
).toEqual([]);
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
test('should retain user pool', () => {
|
|
67
|
+
const template = createAuthTemplate();
|
|
68
|
+
expect(template.Resources.CognitoUserPool.DeletionPolicy).toEqual('Retain');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
62
71
|
|
|
63
72
|
describe('identity pool', () => {
|
|
64
73
|
test.each([false, undefined])(
|