@tomei/sso 0.16.2 → 0.16.4

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 (43) 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/src/components/login-user/interfaces/user-info.interface.d.ts +2 -1
  16. package/dist/src/components/login-user/login-user.d.ts +2 -1
  17. package/dist/src/components/login-user/login-user.js.map +1 -1
  18. package/dist/src/enum/index.d.ts +1 -0
  19. package/dist/src/enum/index.js +1 -0
  20. package/dist/src/enum/index.js.map +1 -1
  21. package/dist/src/enum/user-status.enum.d.ts +7 -0
  22. package/dist/src/enum/user-status.enum.js +12 -0
  23. package/dist/src/enum/user-status.enum.js.map +1 -0
  24. package/dist/src/models/user.entity.d.ts +2 -1
  25. package/dist/src/models/user.entity.js +1 -0
  26. package/dist/src/models/user.entity.js.map +1 -1
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/jest.config.js +13 -13
  29. package/migrations/20240314080603-create-user-table.js +108 -108
  30. package/migrations/20240314080604-create-user-user-group-table.js +55 -55
  31. package/migrations/20240314080605-create-login-history-table.js +49 -49
  32. package/package.json +80 -80
  33. package/sampledotenv +7 -7
  34. package/src/components/login-user/interfaces/user-info.interface.ts +2 -1
  35. package/src/components/login-user/login-user.ts +4 -3
  36. package/src/enum/index.ts +1 -0
  37. package/src/enum/user-status.enum.ts +7 -0
  38. package/src/models/user.entity.ts +2 -2
  39. package/tsconfig.build.json +5 -5
  40. package/tsconfig.json +23 -23
  41. package/migrations/01-alter-system-privilege-table.js +0 -13
  42. package/migrations/02-alter-user-group-table.js +0 -78
  43. package/migrations/03-alter-user-system-privilege-table.js +0 -38
package/src/enum/index.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from './yn.enum';
2
+ export * from './user-status.enum';
@@ -0,0 +1,7 @@
1
+ export enum UserStatus {
2
+ ACTIVE = 'Active',
3
+ INACTIVE = 'Inactive',
4
+ LOCKED = 'Locked',
5
+ SUSPENDED = 'Suspended',
6
+ DELETED = 'Deleted',
7
+ }
@@ -11,7 +11,6 @@ import {
11
11
  Table,
12
12
  UpdatedAt,
13
13
  } from 'sequelize-typescript';
14
- import UserGroup from './user-group.entity';
15
14
  import Staff from './staff.entity';
16
15
  import BearerToken from './bearer-token.entity';
17
16
  import OAuthToken from './oauth-token.entity';
@@ -24,6 +23,7 @@ import UserSystemRole from './user-system-role.entity';
24
23
  import SystemPrivilege from './system-privilege.entity';
25
24
  import UserSystemPrivileges from './user-system-privileges.entity';
26
25
  import { YN } from '../enum/yn.enum';
26
+ import { UserStatus } from '../enum/user-status.enum';
27
27
 
28
28
  @Table({
29
29
  tableName: 'sso_User',
@@ -55,7 +55,7 @@ export default class User extends Model {
55
55
  allowNull: false,
56
56
  type: DataType.STRING,
57
57
  })
58
- Status: string;
58
+ Status: UserStatus;
59
59
 
60
60
  @Column({
61
61
  allowNull: false,
@@ -1,6 +1,6 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "include": ["**/*.ts"],
4
- "exclude": ["node_modules", "__tests__", "dist", "**/*spec.ts"]
5
- }
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": ["**/*.ts"],
4
+ "exclude": ["node_modules", "__tests__", "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
+ }
@@ -1,13 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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';