@tomei/sso 0.11.4 → 0.11.6

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 (187) hide show
  1. package/.commitlintrc.json +22 -22
  2. package/.eslintrc +16 -16
  3. package/.eslintrc.js +35 -35
  4. package/.husky/commit-msg +15 -15
  5. package/.husky/pre-commit +7 -7
  6. package/.prettierrc +4 -4
  7. package/Jenkinsfile +57 -57
  8. package/README.md +23 -23
  9. package/__tests__/unit/components/login-user/login-user.spec.ts +742 -742
  10. package/__tests__/unit/components/password-hash/password-hash.service.spec.ts +31 -31
  11. package/__tests__/unit/redis-client/redis.service.spec.ts +23 -23
  12. package/__tests__/unit/session/session.service.spec.ts +47 -47
  13. package/__tests__/unit/system-privilege/system-privilage.spec.ts +91 -91
  14. package/create-sso-user.sql +39 -39
  15. package/dist/__tests__/unit/components/login-history/login-history.repository.spec.d.ts +0 -0
  16. package/dist/__tests__/unit/components/login-history/login-history.repository.spec.js +1 -0
  17. package/dist/__tests__/unit/components/login-history/login-history.repository.spec.js.map +1 -0
  18. package/dist/__tests__/unit/components/login-user/login-user.spec.d.ts +1 -1
  19. package/dist/__tests__/unit/components/login-user/login-user.spec.js +662 -662
  20. package/dist/__tests__/unit/components/login-user/user.repository.spec.d.ts +0 -0
  21. package/dist/__tests__/unit/components/login-user/user.repository.spec.js +1 -0
  22. package/dist/__tests__/unit/components/login-user/user.repository.spec.js.map +1 -0
  23. package/dist/__tests__/unit/components/password-hash/password-hash.service.spec.d.ts +1 -1
  24. package/dist/__tests__/unit/components/password-hash/password-hash.service.spec.js +37 -37
  25. package/dist/__tests__/unit/components/system/system.repository.spec.d.ts +0 -0
  26. package/dist/__tests__/unit/components/system/system.repository.spec.js +1 -0
  27. package/dist/__tests__/unit/components/system/system.repository.spec.js.map +1 -0
  28. package/dist/__tests__/unit/components/system-access/system-access.repository.spec.d.ts +0 -0
  29. package/dist/__tests__/unit/components/system-access/system-access.repository.spec.js +1 -0
  30. package/dist/__tests__/unit/components/system-access/system-access.repository.spec.js.map +1 -0
  31. package/dist/__tests__/unit/redis-client/redis.service.spec.d.ts +1 -1
  32. package/dist/__tests__/unit/redis-client/redis.service.spec.js +31 -31
  33. package/dist/__tests__/unit/session/session.service.spec.d.ts +1 -1
  34. package/dist/__tests__/unit/session/session.service.spec.js +54 -54
  35. package/dist/__tests__/unit/system-privilege/system-privilage.spec.js +5 -5
  36. package/dist/index.d.ts +1 -1
  37. package/dist/index.js +17 -17
  38. package/dist/src/components/index.d.ts +7 -7
  39. package/dist/src/components/index.js +23 -23
  40. package/dist/src/components/login-history/index.d.ts +1 -1
  41. package/dist/src/components/login-history/index.js +17 -17
  42. package/dist/src/components/login-history/login-history.repository.d.ts +5 -5
  43. package/dist/src/components/login-history/login-history.repository.js +11 -11
  44. package/dist/src/components/login-user/index.d.ts +3 -3
  45. package/dist/src/components/login-user/index.js +19 -19
  46. package/dist/src/components/login-user/interfaces/index.d.ts +1 -1
  47. package/dist/src/components/login-user/interfaces/index.js +17 -17
  48. package/dist/src/components/login-user/interfaces/user-info.interface.d.ts +9 -9
  49. package/dist/src/components/login-user/interfaces/user-info.interface.js +2 -2
  50. package/dist/src/components/login-user/login-user.d.ts +45 -45
  51. package/dist/src/components/login-user/login-user.js +414 -415
  52. package/dist/src/components/login-user/login-user.js.map +1 -1
  53. package/dist/src/components/login-user/user.repository.d.ts +5 -5
  54. package/dist/src/components/login-user/user.repository.js +11 -11
  55. package/dist/src/components/password-hash/index.d.ts +2 -2
  56. package/dist/src/components/password-hash/index.js +18 -18
  57. package/dist/src/components/password-hash/interfaces/index.d.ts +1 -1
  58. package/dist/src/components/password-hash/interfaces/index.js +17 -17
  59. package/dist/src/components/password-hash/interfaces/password-hash-service.interface.d.ts +4 -4
  60. package/dist/src/components/password-hash/interfaces/password-hash-service.interface.js +2 -2
  61. package/dist/src/components/password-hash/password-hash.service.d.ts +6 -6
  62. package/dist/src/components/password-hash/password-hash.service.js +27 -27
  63. package/dist/src/components/system/index.d.ts +1 -1
  64. package/dist/src/components/system/index.js +17 -17
  65. package/dist/src/components/system/system.repository.d.ts +5 -5
  66. package/dist/src/components/system/system.repository.js +11 -11
  67. package/dist/src/components/system-access/index.d.ts +1 -1
  68. package/dist/src/components/system-access/index.js +17 -17
  69. package/dist/src/components/system-access/system-access.repository.d.ts +5 -5
  70. package/dist/src/components/system-access/system-access.repository.js +11 -11
  71. package/dist/src/components/system-privilege/privilege.d.ts +6 -6
  72. package/dist/src/components/system-privilege/privilege.js +76 -76
  73. package/dist/src/components/system-privilege/system-privilege.repository.d.ts +6 -6
  74. package/dist/src/components/system-privilege/system-privilege.repository.js +34 -34
  75. package/dist/src/components/user-group/index.d.ts +1 -1
  76. package/dist/src/components/user-group/index.js +17 -17
  77. package/dist/src/components/user-group/user-group.repository.d.ts +5 -5
  78. package/dist/src/components/user-group/user-group.repository.js +11 -11
  79. package/dist/src/components/user-user-group/index.d.ts +1 -1
  80. package/dist/src/components/user-user-group/index.js +17 -17
  81. package/dist/src/components/user-user-group/user-user-group.repository.d.ts +5 -5
  82. package/dist/src/components/user-user-group/user-user-group.repository.js +11 -11
  83. package/dist/src/database.d.ts +4 -4
  84. package/dist/src/database.js +14 -14
  85. package/dist/src/index.d.ts +5 -5
  86. package/dist/src/index.js +23 -23
  87. package/dist/src/interfaces/index.d.ts +2 -2
  88. package/dist/src/interfaces/index.js +18 -18
  89. package/dist/src/interfaces/system-login.interface.d.ts +6 -6
  90. package/dist/src/interfaces/system-login.interface.js +2 -2
  91. package/dist/src/interfaces/user-session.interface.d.ts +4 -4
  92. package/dist/src/interfaces/user-session.interface.js +2 -2
  93. package/dist/src/models/authorization-code.entity.d.ts +14 -14
  94. package/dist/src/models/authorization-code.entity.js +85 -85
  95. package/dist/src/models/bearer-token.entity.d.ts +11 -11
  96. package/dist/src/models/bearer-token.entity.js +71 -71
  97. package/dist/src/models/building-type.entity.d.ts +7 -7
  98. package/dist/src/models/building-type.entity.js +49 -49
  99. package/dist/src/models/building.entity.d.ts +39 -39
  100. package/dist/src/models/building.entity.js +250 -250
  101. package/dist/src/models/city.entity.d.ts +11 -11
  102. package/dist/src/models/city.entity.js +71 -71
  103. package/dist/src/models/company.entity.d.ts +18 -18
  104. package/dist/src/models/company.entity.js +113 -113
  105. package/dist/src/models/country.entity.d.ts +15 -15
  106. package/dist/src/models/country.entity.js +91 -91
  107. package/dist/src/models/department.entity.d.ts +19 -19
  108. package/dist/src/models/department.entity.js +111 -111
  109. package/dist/src/models/group-role-privilege.entity.d.ts +17 -17
  110. package/dist/src/models/group-role-privilege.entity.js +89 -89
  111. package/dist/src/models/group-system-access.entity.d.ts +11 -11
  112. package/dist/src/models/group-system-access.entity.js +61 -61
  113. package/dist/src/models/group-system-privilege.entity.d.ts +11 -11
  114. package/dist/src/models/group-system-privilege.entity.js +61 -61
  115. package/dist/src/models/group-system-role.entity.d.ts +11 -11
  116. package/dist/src/models/group-system-role.entity.js +61 -61
  117. package/dist/src/models/login-history.entity.d.ts +12 -12
  118. package/dist/src/models/login-history.entity.js +69 -69
  119. package/dist/src/models/oauth-token.entity.d.ts +14 -14
  120. package/dist/src/models/oauth-token.entity.js +85 -85
  121. package/dist/src/models/role.entity.d.ts +17 -17
  122. package/dist/src/models/role.entity.js +101 -101
  123. package/dist/src/models/staff-type.entity.d.ts +7 -7
  124. package/dist/src/models/staff-type.entity.js +49 -49
  125. package/dist/src/models/staff.entity.d.ts +39 -39
  126. package/dist/src/models/staff.entity.js +249 -249
  127. package/dist/src/models/state.entity.d.ts +10 -10
  128. package/dist/src/models/state.entity.js +63 -63
  129. package/dist/src/models/system-accesss.entity.d.ts +6 -6
  130. package/dist/src/models/system-accesss.entity.js +50 -50
  131. package/dist/src/models/system-privilege.entity.d.ts +16 -16
  132. package/dist/src/models/system-privilege.entity.js +89 -89
  133. package/dist/src/models/system-role-privilege.entity.d.ts +11 -11
  134. package/dist/src/models/system-role-privilege.entity.js +59 -59
  135. package/dist/src/models/system-role.entity.d.ts +11 -11
  136. package/dist/src/models/system-role.entity.js +82 -82
  137. package/dist/src/models/system.entity.d.ts +19 -19
  138. package/dist/src/models/system.entity.js +145 -145
  139. package/dist/src/models/user-group.entity.d.ts +23 -23
  140. package/dist/src/models/user-group.entity.js +139 -139
  141. package/dist/src/models/user-role.entity.d.ts +12 -12
  142. package/dist/src/models/user-role.entity.js +72 -72
  143. package/dist/src/models/user-system-privileges.entity.d.ts +13 -13
  144. package/dist/src/models/user-system-privileges.entity.js +88 -88
  145. package/dist/src/models/user-system-role.entity.d.ts +11 -11
  146. package/dist/src/models/user-system-role.entity.js +59 -59
  147. package/dist/src/models/user-user-group.entity.d.ts +14 -14
  148. package/dist/src/models/user-user-group.entity.js +72 -72
  149. package/dist/src/models/user.entity.d.ts +30 -30
  150. package/dist/src/models/user.entity.js +130 -130
  151. package/dist/src/prisma-client/__mocks__/prisma.d.ts +3 -0
  152. package/dist/src/prisma-client/__mocks__/prisma.js +14 -0
  153. package/dist/src/prisma-client/__mocks__/prisma.js.map +1 -0
  154. package/dist/src/prisma-client/client.d.ts +3 -0
  155. package/dist/src/prisma-client/client.js +6 -0
  156. package/dist/src/prisma-client/client.js.map +1 -0
  157. package/dist/src/prisma-client/index.d.ts +1 -0
  158. package/dist/src/prisma-client/index.js +18 -0
  159. package/dist/src/prisma-client/index.js.map +1 -0
  160. package/dist/src/redis-client/__mocks__/jest-initial-setup.d.ts +1 -1
  161. package/dist/src/redis-client/__mocks__/jest-initial-setup.js +4 -4
  162. package/dist/src/redis-client/__mocks__/redis-mock.d.ts +2 -2
  163. package/dist/src/redis-client/__mocks__/redis-mock.js +22 -22
  164. package/dist/src/redis-client/index.d.ts +1 -1
  165. package/dist/src/redis-client/index.js +17 -17
  166. package/dist/src/redis-client/redis.service.d.ts +7 -7
  167. package/dist/src/redis-client/redis.service.js +60 -60
  168. package/dist/src/session/index.d.ts +2 -2
  169. package/dist/src/session/index.js +18 -18
  170. package/dist/src/session/interfaces/index.d.ts +1 -1
  171. package/dist/src/session/interfaces/index.js +17 -17
  172. package/dist/src/session/interfaces/session-service.interface.d.ts +6 -6
  173. package/dist/src/session/interfaces/session-service.interface.js +2 -2
  174. package/dist/src/session/session.service.d.ts +10 -10
  175. package/dist/src/session/session.service.js +62 -62
  176. package/dist/tsconfig.tsbuildinfo +1 -1
  177. package/jest.config.js +13 -13
  178. package/migrations/01-alter-system-privilege-table.js +13 -13
  179. package/migrations/02-alter-user-group-table.js +78 -78
  180. package/migrations/03-alter-user-system-privilege-table.js +38 -38
  181. package/migrations/04-create-user-user-group-table.js +55 -55
  182. package/migrations/05-create-login-history-table.js +49 -49
  183. package/package.json +5 -7
  184. package/sampledotenv +7 -7
  185. package/src/components/login-user/login-user.ts +1 -1
  186. package/tsconfig.build.json +5 -5
  187. package/tsconfig.json +23 -23
package/jest.config.js CHANGED
@@ -1,14 +1,14 @@
1
- /** @type {import('ts-jest').JestConfigWithTsJest} */
2
- module.exports = {
3
- clearMocks: true,
4
- preset: 'ts-jest',
5
- testTimeout: 20000,
6
- coverageDirectory: "coverage",
7
- testEnvironment: 'node',
8
- "modulePathIgnorePatterns": [
9
- "<rootDir>/dist"
10
- ],
11
- setupFilesAfterEnv: [
12
- '<rootDir>/src/redis-client/__mocks__/jest-initial-setup.ts',
13
- ]
1
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
2
+ module.exports = {
3
+ clearMocks: true,
4
+ preset: 'ts-jest',
5
+ testTimeout: 20000,
6
+ coverageDirectory: "coverage",
7
+ testEnvironment: 'node',
8
+ "modulePathIgnorePatterns": [
9
+ "<rootDir>/dist"
10
+ ],
11
+ setupFilesAfterEnv: [
12
+ '<rootDir>/src/redis-client/__mocks__/jest-initial-setup.ts',
13
+ ]
14
14
  };
@@ -1,13 +1,13 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- async up(queryInterface, Sequelize) {
5
- await queryInterface.addColumn('sso_systemPrivilege','Module', {
6
- type: Sequelize.STRING(200),
7
- })
8
- },
9
-
10
- async down(queryInterface) {
11
- queryInterface.removeColumn('sso_systemPrivilege','Module')
12
- },
13
- };
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ async up(queryInterface, Sequelize) {
5
+ await queryInterface.addColumn('sso_systemPrivilege','Module', {
6
+ type: Sequelize.STRING(200),
7
+ })
8
+ },
9
+
10
+ async down(queryInterface) {
11
+ queryInterface.removeColumn('sso_systemPrivilege','Module')
12
+ },
13
+ };
@@ -1,78 +1,78 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- up: async (queryInterface, Sequelize) => {
5
- return queryInterface.sequelize.transaction(async (t) => {
6
- return await Promise.all([
7
- queryInterface.addColumn(
8
- 'sso_usergroup',
9
- 'AllowInheritFromParentYN',
10
- {
11
- type: Sequelize.ENUM(['Y', 'N']),
12
- defaultValue: 'N',
13
- },
14
- { transaction: t },
15
- ),
16
- queryInterface.addColumn(
17
- 'sso_usergroup',
18
- 'FullPath',
19
- {
20
- type: Sequelize.STRING(1000),
21
- allowNull: true,
22
- },
23
- { transaction: t },
24
- ),
25
- queryInterface.addColumn(
26
- 'sso_usergroup',
27
- 'GroupLevel',
28
- {
29
- type: Sequelize.INTEGER,
30
- allowNull: false,
31
- defaultValue: 0,
32
- },
33
- { transaction: t },
34
- ),
35
- queryInterface.addColumn(
36
- 'sso_usergroup',
37
- 'GroupType',
38
- {
39
- type: Sequelize.STRING(10),
40
- allowNull: true,
41
- },
42
- { transaction: t },
43
- ),
44
- queryInterface.addColumn(
45
- 'sso_usergroup',
46
- 'ParentGroupCode',
47
- {
48
- type: Sequelize.STRING(10),
49
- allowNull: true,
50
- },
51
- { transaction: t },
52
- ),
53
- queryInterface.addColumn(
54
- 'sso_usergroup',
55
- 'PersonInCharge',
56
- {
57
- type: Sequelize.STRING(100),
58
- allowNull: true,
59
- },
60
- { transaction: t },
61
- ),
62
- ]);
63
- });
64
- },
65
-
66
- down: async (queryInterface) => {
67
- return queryInterface.sequelize.transaction(async (t) => {
68
- return await Promise.all([
69
- queryInterface.removeColumn('sso_usergroup', 'AllowInheritFromParentYN', { transaction: t }),
70
- queryInterface.removeColumn('sso_usergroup', 'FullPath', { transaction: t }),
71
- queryInterface.removeColumn('sso_usergroup', 'GroupLevel', { transaction: t }),
72
- queryInterface.removeColumn('sso_usergroup', 'GroupType', { transaction: t }),
73
- queryInterface.removeColumn('sso_usergroup', 'ParentGroupCode', { transaction: t }),
74
- queryInterface.removeColumn('sso_usergroup', 'PersonInCharge', { transaction: t }),
75
- ]);
76
- });
77
- },
78
- };
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ return queryInterface.sequelize.transaction(async (t) => {
6
+ return await Promise.all([
7
+ queryInterface.addColumn(
8
+ 'sso_usergroup',
9
+ 'AllowInheritFromParentYN',
10
+ {
11
+ type: Sequelize.ENUM(['Y', 'N']),
12
+ defaultValue: 'N',
13
+ },
14
+ { transaction: t },
15
+ ),
16
+ queryInterface.addColumn(
17
+ 'sso_usergroup',
18
+ 'FullPath',
19
+ {
20
+ type: Sequelize.STRING(1000),
21
+ allowNull: true,
22
+ },
23
+ { transaction: t },
24
+ ),
25
+ queryInterface.addColumn(
26
+ 'sso_usergroup',
27
+ 'GroupLevel',
28
+ {
29
+ type: Sequelize.INTEGER,
30
+ allowNull: false,
31
+ defaultValue: 0,
32
+ },
33
+ { transaction: t },
34
+ ),
35
+ queryInterface.addColumn(
36
+ 'sso_usergroup',
37
+ 'GroupType',
38
+ {
39
+ type: Sequelize.STRING(10),
40
+ allowNull: true,
41
+ },
42
+ { transaction: t },
43
+ ),
44
+ queryInterface.addColumn(
45
+ 'sso_usergroup',
46
+ 'ParentGroupCode',
47
+ {
48
+ type: Sequelize.STRING(10),
49
+ allowNull: true,
50
+ },
51
+ { transaction: t },
52
+ ),
53
+ queryInterface.addColumn(
54
+ 'sso_usergroup',
55
+ 'PersonInCharge',
56
+ {
57
+ type: Sequelize.STRING(100),
58
+ allowNull: true,
59
+ },
60
+ { transaction: t },
61
+ ),
62
+ ]);
63
+ });
64
+ },
65
+
66
+ down: async (queryInterface) => {
67
+ return queryInterface.sequelize.transaction(async (t) => {
68
+ return await Promise.all([
69
+ queryInterface.removeColumn('sso_usergroup', 'AllowInheritFromParentYN', { transaction: t }),
70
+ queryInterface.removeColumn('sso_usergroup', 'FullPath', { transaction: t }),
71
+ queryInterface.removeColumn('sso_usergroup', 'GroupLevel', { transaction: t }),
72
+ queryInterface.removeColumn('sso_usergroup', 'GroupType', { transaction: t }),
73
+ queryInterface.removeColumn('sso_usergroup', 'ParentGroupCode', { transaction: t }),
74
+ queryInterface.removeColumn('sso_usergroup', 'PersonInCharge', { transaction: t }),
75
+ ]);
76
+ });
77
+ },
78
+ };
@@ -1,38 +1,38 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- up: async (queryInterface, Sequelize) => {
5
- return queryInterface.sequelize.transaction(async (t) => {
6
- return await Promise.all([
7
- queryInterface.addColumn(
8
- 'sso_usersystemprivilege',
9
- 'IsInheritedYN',
10
- {
11
- type: Sequelize.ENUM(['Y', 'N']),
12
- defaultValue: 'N',
13
- },
14
- { transaction: t },
15
- ),
16
- queryInterface.addColumn(
17
- 'sso_usersystemprivilege',
18
- 'IsRevokedYN',
19
- {
20
- type: Sequelize.ENUM(['Y', 'N']),
21
- defaultValue: 'N',
22
- },
23
- { transaction: t },
24
- ),
25
- ]);
26
- });
27
- },
28
-
29
- down: async (queryInterface) => {
30
- return queryInterface.sequelize.transaction(async (t) => {
31
- return await Promise.all([
32
- queryInterface.removeColumn('sso_usersystemprivilege', 'IsInheritedYN', { transaction: t }),
33
- queryInterface.removeColumn('sso_usersystemprivilege', 'IsRevokedYN', { transaction: t }),
34
- ]);
35
- });
36
- },
37
- };
38
- 'use strict';
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ return queryInterface.sequelize.transaction(async (t) => {
6
+ return await Promise.all([
7
+ queryInterface.addColumn(
8
+ 'sso_usersystemprivilege',
9
+ 'IsInheritedYN',
10
+ {
11
+ type: Sequelize.ENUM(['Y', 'N']),
12
+ defaultValue: 'N',
13
+ },
14
+ { transaction: t },
15
+ ),
16
+ queryInterface.addColumn(
17
+ 'sso_usersystemprivilege',
18
+ 'IsRevokedYN',
19
+ {
20
+ type: Sequelize.ENUM(['Y', 'N']),
21
+ defaultValue: 'N',
22
+ },
23
+ { transaction: t },
24
+ ),
25
+ ]);
26
+ });
27
+ },
28
+
29
+ down: async (queryInterface) => {
30
+ return queryInterface.sequelize.transaction(async (t) => {
31
+ return await Promise.all([
32
+ queryInterface.removeColumn('sso_usersystemprivilege', 'IsInheritedYN', { transaction: t }),
33
+ queryInterface.removeColumn('sso_usersystemprivilege', 'IsRevokedYN', { transaction: t }),
34
+ ]);
35
+ });
36
+ },
37
+ };
38
+ 'use strict';
@@ -1,55 +1,55 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- up: async (queryInterface, Sequelize) => {
5
- queryInterface.createTable('sso_UserUserGroup', {
6
- UserId: {
7
- primaryKey: true,
8
- type: Sequelize.INTEGER,
9
- allowNull: false,
10
- references: {
11
- model: 'sso_users',
12
- key: 'id',
13
- },
14
- onDelete: 'CASCADE',
15
- onUpdate: 'CASCADE',
16
- },
17
- GroupCode: {
18
- primaryKey: true,
19
- type: Sequelize.STRING(191),
20
- allowNull: false,
21
- references: {
22
- model: 'sso_usergroup',
23
- key: 'GroupCode',
24
- },
25
- onDelete: 'CASCADE',
26
- onUpdate: 'CASCADE',
27
- },
28
- SystemId: {
29
- type: Sequelize.INTEGER,
30
- allowNull: true,
31
- references: {
32
- model: 'sso_systems',
33
- key: 'id',
34
- },
35
- onDelete: 'CASCADE',
36
- onUpdate: 'CASCADE',
37
- },
38
- CreatedAt: {
39
- allowNull: false,
40
- defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
41
- type: Sequelize.DATE,
42
- },
43
- UpdatedAt: {
44
- allowNull: false,
45
- defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
46
- type: Sequelize.DATE,
47
- },
48
- });
49
-
50
- },
51
-
52
- down: async (queryInterface) => {
53
- await queryInterface.dropTable('sso_UserUserGroup');
54
- },
55
- };
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ queryInterface.createTable('sso_UserUserGroup', {
6
+ UserId: {
7
+ primaryKey: true,
8
+ type: Sequelize.INTEGER,
9
+ allowNull: false,
10
+ references: {
11
+ model: 'sso_users',
12
+ key: 'id',
13
+ },
14
+ onDelete: 'CASCADE',
15
+ onUpdate: 'CASCADE',
16
+ },
17
+ GroupCode: {
18
+ primaryKey: true,
19
+ type: Sequelize.STRING(191),
20
+ allowNull: false,
21
+ references: {
22
+ model: 'sso_usergroup',
23
+ key: 'GroupCode',
24
+ },
25
+ onDelete: 'CASCADE',
26
+ onUpdate: 'CASCADE',
27
+ },
28
+ SystemId: {
29
+ type: Sequelize.INTEGER,
30
+ allowNull: true,
31
+ references: {
32
+ model: 'sso_systems',
33
+ key: 'id',
34
+ },
35
+ onDelete: 'CASCADE',
36
+ onUpdate: 'CASCADE',
37
+ },
38
+ CreatedAt: {
39
+ allowNull: false,
40
+ defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
41
+ type: Sequelize.DATE,
42
+ },
43
+ UpdatedAt: {
44
+ allowNull: false,
45
+ defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
46
+ type: Sequelize.DATE,
47
+ },
48
+ });
49
+
50
+ },
51
+
52
+ down: async (queryInterface) => {
53
+ await queryInterface.dropTable('sso_UserUserGroup');
54
+ },
55
+ };
@@ -1,49 +1,49 @@
1
- 'use strict';
2
-
3
-
4
- module.exports = {
5
- up: async (queryInterface, Sequelize) => {
6
- queryInterface.createTable('sso_LoginHistories', {
7
- Id: {
8
- primaryKey: true,
9
- autoIncrement: true,
10
- type: Sequelize.INTEGER,
11
- allowNull: false,
12
- },
13
- UserId: {
14
- type: Sequelize.INTEGER,
15
- allowNull: false,
16
- references: {
17
- model: 'sso_users',
18
- key: 'id',
19
- },
20
- onDelete: 'CASCADE',
21
- onUpdate: 'CASCADE',
22
- },
23
- SystemId: {
24
- type: Sequelize.INTEGER,
25
- allowNull: false,
26
- references: {
27
- model: 'sso_systems',
28
- key: 'id',
29
- },
30
- onDelete: 'CASCADE',
31
- onUpdate: 'CASCADE',
32
- },
33
- OriginIP: {
34
- type: Sequelize.STRING(191),
35
- allowNull: false,
36
- },
37
- CreatedAt: {
38
- type: Sequelize.DATE(3),
39
- allowNull: false,
40
- defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
41
- },
42
- });
43
-
44
- },
45
-
46
- down: async (queryInterface) => {
47
- await queryInterface.dropTable('sso_LoginHistories');
48
- },
49
- };
1
+ 'use strict';
2
+
3
+
4
+ module.exports = {
5
+ up: async (queryInterface, Sequelize) => {
6
+ queryInterface.createTable('sso_LoginHistories', {
7
+ Id: {
8
+ primaryKey: true,
9
+ autoIncrement: true,
10
+ type: Sequelize.INTEGER,
11
+ allowNull: false,
12
+ },
13
+ UserId: {
14
+ type: Sequelize.INTEGER,
15
+ allowNull: false,
16
+ references: {
17
+ model: 'sso_users',
18
+ key: 'id',
19
+ },
20
+ onDelete: 'CASCADE',
21
+ onUpdate: 'CASCADE',
22
+ },
23
+ SystemId: {
24
+ type: Sequelize.INTEGER,
25
+ allowNull: false,
26
+ references: {
27
+ model: 'sso_systems',
28
+ key: 'id',
29
+ },
30
+ onDelete: 'CASCADE',
31
+ onUpdate: 'CASCADE',
32
+ },
33
+ OriginIP: {
34
+ type: Sequelize.STRING(191),
35
+ allowNull: false,
36
+ },
37
+ CreatedAt: {
38
+ type: Sequelize.DATE(3),
39
+ allowNull: false,
40
+ defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'),
41
+ },
42
+ });
43
+
44
+ },
45
+
46
+ down: async (queryInterface) => {
47
+ await queryInterface.dropTable('sso_LoginHistories');
48
+ },
49
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/sso",
3
- "version": "0.11.4",
3
+ "version": "0.11.6",
4
4
  "description": "Tomei SSO Package",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -57,11 +57,13 @@
57
57
  "access": "public"
58
58
  },
59
59
  "peerDependencies": {
60
- "@tomei/general": "^0.4.3",
61
- "@tomei/mailer": "^0.5.3",
60
+ "@tomei/config": "^0.2.2",
61
+ "@tomei/general": "^0.5.1",
62
+ "@tomei/mailer": "^0.5.5",
62
63
  "@types/jest": "^29.5.2",
63
64
  "argon2": "^0.30.3",
64
65
  "cls-hooked": "^4.2.2",
66
+ "cuid": "^3.0.0",
65
67
  "nodemailer": "^6.9.3",
66
68
  "redis": "^4.6.7",
67
69
  "reflect-metadata": "^0.1.13",
@@ -73,9 +75,5 @@
73
75
  "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
74
76
  "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
75
77
  ]
76
- },
77
- "dependencies": {
78
- "@tomei/config": "^0.2.0",
79
- "cuid": "^3.0.0"
80
78
  }
81
79
  }
package/sampledotenv CHANGED
@@ -1,8 +1,8 @@
1
- DATABASE_URL=
2
- SHADOW_DATABASE_URL=
3
- REDIS_URL=
4
- REDIS_PASSWORD=
5
- SMTP_HOST=
6
- SMTP_PORT=
7
- EMAIL_SENDER=
1
+ DATABASE_URL=
2
+ SHADOW_DATABASE_URL=
3
+ REDIS_URL=
4
+ REDIS_PASSWORD=
5
+ SMTP_HOST=
6
+ SMTP_PORT=
7
+ EMAIL_SENDER=
8
8
  EMAIL_PASSWORD=
@@ -190,7 +190,7 @@ export class LoginUser extends LoginUserBase {
190
190
  //validate system access
191
191
  await this.checkSystemAccess(this.ObjectId, system.id);
192
192
  // alert user if new login
193
- await this.alertNewLogin(this.ObjectId, system.id.toString(), ipAddress);
193
+ // await this.alertNewLogin(this.ObjectId, system.id.toString(), ipAddress);
194
194
 
195
195
  // fetch user session if exists
196
196
  const userSession = await this._SessionService.retrieveUserSession(
@@ -1,6 +1,6 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "include": ["**/*.ts"],
4
- "exclude": ["node_modules", "__test__", "dist", "**/*spec.ts"]
5
- }
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": ["**/*.ts"],
4
+ "exclude": ["node_modules", "__test__", "dist", "**/*spec.ts"]
5
+ }
6
6
 
package/tsconfig.json CHANGED
@@ -1,23 +1,23 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "declaration": true,
5
- "removeComments": true,
6
- "emitDecoratorMetadata": true,
7
- "experimentalDecorators": true,
8
- "allowSyntheticDefaultImports": true,
9
- "moduleResolution": "node",
10
- "target": "es6",
11
- "sourceMap": true,
12
- "outDir": "./dist",
13
- "baseUrl": "./src",
14
- "rootDir": "./",
15
- "incremental": true,
16
- "skipLibCheck": true,
17
- "noImplicitAny": false,
18
- "strictBindCallApply": false,
19
- "forceConsistentCasingInFileNames": false,
20
- "noFallthroughCasesInSwitch": false,
21
- "strictNullChecks": true,
22
- },
23
- }
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "declaration": true,
5
+ "removeComments": true,
6
+ "emitDecoratorMetadata": true,
7
+ "experimentalDecorators": true,
8
+ "allowSyntheticDefaultImports": true,
9
+ "moduleResolution": "node",
10
+ "target": "es6",
11
+ "sourceMap": true,
12
+ "outDir": "./dist",
13
+ "baseUrl": "./src",
14
+ "rootDir": "./",
15
+ "incremental": true,
16
+ "skipLibCheck": true,
17
+ "noImplicitAny": false,
18
+ "strictBindCallApply": false,
19
+ "forceConsistentCasingInFileNames": false,
20
+ "noFallthroughCasesInSwitch": false,
21
+ "strictNullChecks": true,
22
+ },
23
+ }