@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/dist/esm/index.js CHANGED
@@ -26,6 +26,7 @@ var createAuthTemplate = ({
26
26
  Resources: {
27
27
  [CognitoUserPoolLogicalId]: {
28
28
  Type: "AWS::Cognito::UserPool",
29
+ DeletionPolicy: "Retain",
29
30
  Properties: {
30
31
  AutoVerifiedAttributes,
31
32
  Policies: {
package/dist/index.js CHANGED
@@ -52,6 +52,7 @@ var createAuthTemplate = ({
52
52
  Resources: {
53
53
  [CognitoUserPoolLogicalId]: {
54
54
  Type: "AWS::Cognito::UserPool",
55
+ DeletionPolicy: "Retain",
55
56
  Properties: {
56
57
  AutoVerifiedAttributes,
57
58
  Policies: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/cloud-auth",
3
- "version": "0.7.0",
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.0"
12
+ "@ttoss/cloudformation": "^0.6.2"
13
13
  },
14
14
  "devDependencies": {
15
- "@ttoss/config": "^1.28.2",
16
- "@types/jest": "^29.4.0",
17
- "jest": "^29.4.3",
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": "ff8bed71bb39e2e7d7385f8bb4a1bfda3553cb5c"
23
+ "gitHead": "2f241b7126c460eeaea3eba6445aa139411d4b19"
24
24
  }
package/src/template.ts CHANGED
@@ -61,6 +61,7 @@ export const createAuthTemplate = ({
61
61
  Resources: {
62
62
  [CognitoUserPoolLogicalId]: {
63
63
  Type: 'AWS::Cognito::UserPool',
64
+ DeletionPolicy: 'Retain',
64
65
  Properties: {
65
66
  AutoVerifiedAttributes,
66
67
  Policies: {
@@ -1,64 +1,73 @@
1
1
  import { createAuthTemplate } from '../../src';
2
2
 
3
- test('do not add schema if not provided', () => {
4
- const template = createAuthTemplate();
5
- expect(template.Resources.CognitoUserPool.Properties.Schema).toBeUndefined();
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
- const schema = [
10
- {
11
- attributeDataType: 'String' as const,
12
- developerOnlyAttribute: false,
13
- mutable: true,
14
- name: 'email',
15
- required: true,
16
- stringAttributeConstraints: {
17
- maxLength: '2048',
18
- minLength: '0',
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
- const template = createAuthTemplate({ schema });
24
- expect(template.Resources.CognitoUserPool.Properties.Schema).toEqual([
25
- {
26
- AttributeDataType: 'String',
27
- DeveloperOnlyAttribute: false,
28
- Mutable: true,
29
- Name: 'email',
30
- Required: true,
31
- StringAttributeConstraints: {
32
- MaxLength: '2048',
33
- MinLength: '0',
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.each([[], null, false])(
54
- 'should have autoVerifiedAttributes undefined: %p',
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])(