@tomei/sso 0.8.10 → 0.8.11

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 (169) 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 -5
  7. package/Jenkinsfile +57 -57
  8. package/README.md +23 -23
  9. package/__tests__/unit/components/login-history/login-history.repository.spec.ts +95 -95
  10. package/__tests__/unit/components/login-user/login-user.spec.ts +731 -731
  11. package/__tests__/unit/components/login-user/user.repository.spec.ts +81 -81
  12. package/__tests__/unit/components/password-hash/password-hash.service.spec.ts +31 -31
  13. package/__tests__/unit/components/system/system.repository.spec.ts +88 -88
  14. package/__tests__/unit/components/system-access/system-access.repository.spec.ts +78 -78
  15. package/__tests__/unit/redis-client/redis.service.spec.ts +23 -23
  16. package/__tests__/unit/session/session.service.spec.ts +47 -47
  17. package/create-sso-user.sql +39 -39
  18. package/dist/__tests__/unit/redis-client/redis.service.spec.d.ts +1 -1
  19. package/dist/__tests__/unit/redis-client/redis.service.spec.js +31 -31
  20. package/dist/__tests__/unit/session/session.service.spec.d.ts +1 -1
  21. package/dist/__tests__/unit/session/session.service.spec.js +54 -54
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +17 -17
  24. package/dist/src/components/index.d.ts +7 -7
  25. package/dist/src/components/index.js +23 -23
  26. package/dist/src/components/login-history/index.d.ts +1 -1
  27. package/dist/src/components/login-history/index.js +17 -17
  28. package/dist/src/components/login-history/login-history.repository.d.ts +5 -5
  29. package/dist/src/components/login-history/login-history.repository.js +11 -11
  30. package/dist/src/components/login-user/index.d.ts +3 -3
  31. package/dist/src/components/login-user/index.js +19 -19
  32. package/dist/src/components/login-user/interfaces/index.d.ts +1 -1
  33. package/dist/src/components/login-user/interfaces/index.js +17 -17
  34. package/dist/src/components/login-user/interfaces/user-info.interface.d.ts +9 -9
  35. package/dist/src/components/login-user/interfaces/user-info.interface.js +2 -2
  36. package/dist/src/components/login-user/login-user.d.ts +44 -44
  37. package/dist/src/components/login-user/login-user.js +416 -414
  38. package/dist/src/components/login-user/login-user.js.map +1 -1
  39. package/dist/src/components/login-user/user.repository.d.ts +5 -5
  40. package/dist/src/components/login-user/user.repository.js +11 -11
  41. package/dist/src/components/password-hash/index.d.ts +2 -2
  42. package/dist/src/components/password-hash/index.js +18 -18
  43. package/dist/src/components/password-hash/interfaces/index.d.ts +1 -1
  44. package/dist/src/components/password-hash/interfaces/index.js +17 -17
  45. package/dist/src/components/password-hash/interfaces/password-hash-service.interface.d.ts +4 -4
  46. package/dist/src/components/password-hash/interfaces/password-hash-service.interface.js +2 -2
  47. package/dist/src/components/password-hash/password-hash.service.d.ts +6 -6
  48. package/dist/src/components/password-hash/password-hash.service.js +27 -27
  49. package/dist/src/components/system/index.d.ts +1 -1
  50. package/dist/src/components/system/index.js +17 -17
  51. package/dist/src/components/system/system.repository.d.ts +5 -5
  52. package/dist/src/components/system/system.repository.js +11 -11
  53. package/dist/src/components/system-access/index.d.ts +1 -1
  54. package/dist/src/components/system-access/index.js +17 -17
  55. package/dist/src/components/system-access/system-access.repository.d.ts +5 -5
  56. package/dist/src/components/system-access/system-access.repository.js +11 -11
  57. package/dist/src/components/user-group/index.d.ts +1 -1
  58. package/dist/src/components/user-group/index.js +17 -17
  59. package/dist/src/components/user-group/user-group.repository.d.ts +5 -5
  60. package/dist/src/components/user-group/user-group.repository.js +11 -11
  61. package/dist/src/components/user-user-group/index.d.ts +1 -1
  62. package/dist/src/components/user-user-group/index.js +17 -17
  63. package/dist/src/components/user-user-group/user-user-group.repository.d.ts +5 -5
  64. package/dist/src/components/user-user-group/user-user-group.repository.js +11 -11
  65. package/dist/src/database.d.ts +4 -4
  66. package/dist/src/database.js +14 -14
  67. package/dist/src/index.d.ts +5 -5
  68. package/dist/src/index.js +23 -23
  69. package/dist/src/interfaces/index.d.ts +2 -2
  70. package/dist/src/interfaces/index.js +18 -18
  71. package/dist/src/interfaces/system-login.interface.d.ts +6 -6
  72. package/dist/src/interfaces/system-login.interface.js +2 -2
  73. package/dist/src/interfaces/user-session.interface.d.ts +4 -4
  74. package/dist/src/interfaces/user-session.interface.js +2 -2
  75. package/dist/src/models/authorization-code.entity.d.ts +14 -14
  76. package/dist/src/models/authorization-code.entity.js +85 -85
  77. package/dist/src/models/bearer-token.entity.d.ts +11 -11
  78. package/dist/src/models/bearer-token.entity.js +71 -71
  79. package/dist/src/models/building-type.entity.d.ts +7 -7
  80. package/dist/src/models/building-type.entity.js +49 -49
  81. package/dist/src/models/building.entity.d.ts +39 -39
  82. package/dist/src/models/building.entity.js +250 -250
  83. package/dist/src/models/city.entity.d.ts +11 -11
  84. package/dist/src/models/city.entity.js +71 -71
  85. package/dist/src/models/company.entity.d.ts +18 -18
  86. package/dist/src/models/company.entity.js +113 -113
  87. package/dist/src/models/country.entity.d.ts +15 -15
  88. package/dist/src/models/country.entity.js +91 -91
  89. package/dist/src/models/department.entity.d.ts +19 -19
  90. package/dist/src/models/department.entity.js +111 -111
  91. package/dist/src/models/group-role-privilege.entity.d.ts +17 -17
  92. package/dist/src/models/group-role-privilege.entity.js +89 -89
  93. package/dist/src/models/group-system-access.entity.d.ts +11 -11
  94. package/dist/src/models/group-system-access.entity.js +61 -61
  95. package/dist/src/models/group-system-privilege.entity.d.ts +11 -11
  96. package/dist/src/models/group-system-privilege.entity.js +61 -61
  97. package/dist/src/models/group-system-role.entity.d.ts +11 -11
  98. package/dist/src/models/group-system-role.entity.js +61 -61
  99. package/dist/src/models/login-history.entity.d.ts +12 -12
  100. package/dist/src/models/login-history.entity.js +69 -69
  101. package/dist/src/models/oauth-token.entity.d.ts +14 -14
  102. package/dist/src/models/oauth-token.entity.js +85 -85
  103. package/dist/src/models/role.entity.d.ts +17 -17
  104. package/dist/src/models/role.entity.js +101 -101
  105. package/dist/src/models/staff-type.entity.d.ts +7 -7
  106. package/dist/src/models/staff-type.entity.js +49 -49
  107. package/dist/src/models/staff.entity.d.ts +39 -39
  108. package/dist/src/models/staff.entity.js +249 -249
  109. package/dist/src/models/state.entity.d.ts +10 -10
  110. package/dist/src/models/state.entity.js +63 -63
  111. package/dist/src/models/system-accesss.entity.d.ts +6 -6
  112. package/dist/src/models/system-accesss.entity.js +50 -50
  113. package/dist/src/models/system-privilege.entity.d.ts +16 -16
  114. package/dist/src/models/system-privilege.entity.js +89 -89
  115. package/dist/src/models/system-role-privilege.entity.d.ts +11 -11
  116. package/dist/src/models/system-role-privilege.entity.js +59 -59
  117. package/dist/src/models/system-role.entity.d.ts +11 -11
  118. package/dist/src/models/system-role.entity.js +82 -82
  119. package/dist/src/models/system.entity.d.ts +19 -19
  120. package/dist/src/models/system.entity.js +145 -145
  121. package/dist/src/models/user-group.entity.d.ts +23 -23
  122. package/dist/src/models/user-group.entity.js +139 -139
  123. package/dist/src/models/user-role.entity.d.ts +12 -12
  124. package/dist/src/models/user-role.entity.js +72 -72
  125. package/dist/src/models/user-system-privileges.entity.d.ts +13 -13
  126. package/dist/src/models/user-system-privileges.entity.js +88 -88
  127. package/dist/src/models/user-system-role.entity.d.ts +11 -11
  128. package/dist/src/models/user-system-role.entity.js +59 -59
  129. package/dist/src/models/user-user-group.entity.d.ts +14 -14
  130. package/dist/src/models/user-user-group.entity.js +72 -72
  131. package/dist/src/models/user.entity.d.ts +30 -30
  132. package/dist/src/models/user.entity.js +130 -130
  133. package/dist/src/prisma-client/__mocks__/prisma.d.ts +3 -0
  134. package/dist/src/prisma-client/__mocks__/prisma.js +14 -0
  135. package/dist/src/prisma-client/__mocks__/prisma.js.map +1 -0
  136. package/dist/src/prisma-client/client.d.ts +3 -0
  137. package/dist/src/prisma-client/client.js +6 -0
  138. package/dist/src/prisma-client/client.js.map +1 -0
  139. package/dist/src/prisma-client/index.d.ts +1 -0
  140. package/dist/src/prisma-client/index.js +18 -0
  141. package/dist/src/prisma-client/index.js.map +1 -0
  142. package/dist/src/redis-client/__mocks__/jest-initial-setup.d.ts +1 -1
  143. package/dist/src/redis-client/__mocks__/jest-initial-setup.js +4 -4
  144. package/dist/src/redis-client/__mocks__/redis-mock.d.ts +2 -2
  145. package/dist/src/redis-client/__mocks__/redis-mock.js +22 -22
  146. package/dist/src/redis-client/index.d.ts +1 -1
  147. package/dist/src/redis-client/index.js +17 -17
  148. package/dist/src/redis-client/redis.service.d.ts +7 -7
  149. package/dist/src/redis-client/redis.service.js +55 -55
  150. package/dist/src/session/index.d.ts +2 -2
  151. package/dist/src/session/index.js +18 -18
  152. package/dist/src/session/interfaces/index.d.ts +1 -1
  153. package/dist/src/session/interfaces/index.js +17 -17
  154. package/dist/src/session/interfaces/session-service.interface.d.ts +6 -6
  155. package/dist/src/session/interfaces/session-service.interface.js +2 -2
  156. package/dist/src/session/session.service.d.ts +10 -10
  157. package/dist/src/session/session.service.js +63 -63
  158. package/dist/tsconfig.tsbuildinfo +1 -1
  159. package/jest.config.js +14 -14
  160. package/migrations/01-alter-system-privilege-table.js +13 -13
  161. package/migrations/02-alter-user-group-table.js +78 -78
  162. package/migrations/03-alter-user-system-privilege-table.js +38 -38
  163. package/migrations/04-create-user-user-group-table.js +55 -55
  164. package/migrations/05-create-login-history-table.js +49 -49
  165. package/package.json +77 -77
  166. package/sampledotenv +7 -7
  167. package/src/components/login-user/login-user.ts +4 -6
  168. package/tsconfig.build.json +5 -5
  169. package/tsconfig.json +23 -23
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=
@@ -1,7 +1,6 @@
1
- import { ObjectBase, IPerson, IAddress } from '@tomei/general';
1
+ import { IAddress, LoginUserBase } from '@tomei/general';
2
2
  import { ISessionService } from '../../session/interfaces/session-service.interface';
3
3
  import { IUserInfo } from './interfaces/user-info.interface';
4
- // import { IPasswordHashService } from '../password-hash/interfaces/password-hash-service.interface';
5
4
  import { UserRepository } from './user.repository';
6
5
  import { SystemRepository } from '../system/system.repository';
7
6
  import { SystemAccessRepository } from '../system-access/system-access.repository';
@@ -10,7 +9,6 @@ import { UserUserGroupRepository } from '../user-user-group/user-user-group.repo
10
9
  import { PasswordHashService } from '../password-hash/password-hash.service';
11
10
  import { SessionService } from '../../session/session.service';
12
11
  import { UserGroupRepository } from '../user-group/user-group.repository';
13
- import * as nodemailer from 'nodemailer';
14
12
  import { SMTPMailer } from '@tomei/mailer';
15
13
  import { ISystemLogin } from '../../../src/interfaces/system-login.interface';
16
14
  import Staff from '../../models/staff.entity';
@@ -20,7 +18,7 @@ import GroupSystemPrivilege from '../../models/group-system-privilege.entity';
20
18
  import GroupRolePrivilege from '../../models/group-role-privilege.entity';
21
19
  import UserGroup from '../../models/user-group.entity';
22
20
 
23
- export class LoginUser extends ObjectBase implements IPerson {
21
+ export class LoginUser extends LoginUserBase {
24
22
  FullName: string;
25
23
  IDNo: string;
26
24
  IDType: string;
@@ -44,13 +42,13 @@ export class LoginUser extends ObjectBase implements IPerson {
44
42
  private static _UserGroupRepository = new UserGroupRepository();
45
43
  private _dbTransaction: any;
46
44
 
47
- getDetails(): {
45
+ async getDetails(): Promise<{
48
46
  FullName: string;
49
47
  IDNo: string;
50
48
  IDType: string;
51
49
  Email: string;
52
50
  ContactNo: string;
53
- } {
51
+ }> {
54
52
  return {
55
53
  FullName: this.FullName,
56
54
  IDNo: this.IDNo,
@@ -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
+ }