@tomei/sso 0.16.1 → 0.16.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.
Files changed (31) 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/building/building.d.ts +10 -3
  16. package/dist/src/components/staff/staff.js +1 -1
  17. package/dist/src/components/staff/staff.js.map +1 -1
  18. package/dist/src/models/user.entity.d.ts +16 -6
  19. package/dist/tsconfig.tsbuildinfo +1 -1
  20. package/jest.config.js +13 -13
  21. package/migrations/01-alter-system-privilege-table.js +13 -13
  22. package/migrations/02-alter-user-group-table.js +78 -78
  23. package/migrations/03-alter-user-system-privilege-table.js +38 -38
  24. package/migrations/20240314080603-create-user-table.js +108 -108
  25. package/migrations/20240314080604-create-user-user-group-table.js +55 -55
  26. package/migrations/20240314080605-create-login-history-table.js +49 -49
  27. package/package.json +80 -80
  28. package/sampledotenv +7 -7
  29. package/src/components/staff/staff.ts +3 -1
  30. package/tsconfig.build.json +5 -5
  31. package/tsconfig.json +23 -23
@@ -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_User',
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_User',
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,80 +1,80 @@
1
- {
2
- "name": "@tomei/sso",
3
- "version": "0.16.1",
4
- "description": "Tomei SSO Package",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "start:dev": "tsc -w",
8
- "build": "tsc",
9
- "prepare": "husky install",
10
- "format": "prettier --write \"src/**/*.ts\"",
11
- "lint": "npx eslint . --fix",
12
- "test": "jest --forceExit --detectOpenHandles"
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "git+ssh://git@gitlab.com/tomei-package/sso.git"
17
- },
18
- "keywords": [
19
- "tomei",
20
- "sso"
21
- ],
22
- "author": "Tomei",
23
- "license": "ISC",
24
- "bugs": {
25
- "url": "https://gitlab.com/tomei-package/sso/issues"
26
- },
27
- "homepage": "https://gitlab.com/tomei-package/sso#readme",
28
- "devDependencies": {
29
- "@commitlint/cli": "^17.6.3",
30
- "@commitlint/config-conventional": "^17.6.3",
31
- "@tsconfig/node18": "^2.0.1",
32
- "@types/bcrypt": "^5.0.0",
33
- "@types/jest": "^29.5.2",
34
- "@types/node": "^18.17.5",
35
- "@types/redis": "^4.0.11",
36
- "@types/validator": "^13.11.1",
37
- "@typescript-eslint/eslint-plugin": "^5.33.0",
38
- "dotenv": "^16.1.4",
39
- "eslint": "^8.40.0",
40
- "eslint-config-prettier": "^8.5.0",
41
- "eslint-plugin-prettier": "^4.2.1",
42
- "husky": "^8.0.3",
43
- "jest": "^29.5.0",
44
- "jest-mock-extended": "^3.0.4",
45
- "lint-staged": "^13.2.2",
46
- "prettier": "^2.7.1",
47
- "prisma": "^4.14.0",
48
- "redis-mock": "^0.56.3",
49
- "sequelize-cli": "^6.6.2",
50
- "ts-jest": "^29.1.0",
51
- "ts-node": "^10.9.1",
52
- "tsc-watch": "^5.0.3",
53
- "tsconfig-paths": "^4.0.0",
54
- "tslint": "^6.1.3",
55
- "typescript": "^4.7.4"
56
- },
57
- "publishConfig": {
58
- "access": "public"
59
- },
60
- "peerDependencies": {
61
- "@tomei/config": "^0.3.9",
62
- "@tomei/general": "^0.10.6",
63
- "@tomei/mailer": "^0.5.11",
64
- "@types/jest": "^29.5.2",
65
- "argon2": "^0.30.3",
66
- "cls-hooked": "^4.2.2",
67
- "cuid": "^3.0.0",
68
- "nodemailer": "^6.9.3",
69
- "redis": "^4.6.7",
70
- "reflect-metadata": "^0.1.13",
71
- "sequelize": "^6.32.1",
72
- "sequelize-typescript": "^2.1.5"
73
- },
74
- "lint-staged": {
75
- "*/**/*.{js,ts,tsx}": [
76
- "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
77
- "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
78
- ]
79
- }
80
- }
1
+ {
2
+ "name": "@tomei/sso",
3
+ "version": "0.16.2",
4
+ "description": "Tomei SSO Package",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "start:dev": "tsc -w",
8
+ "build": "tsc",
9
+ "prepare": "husky install",
10
+ "format": "prettier --write \"src/**/*.ts\"",
11
+ "lint": "npx eslint . --fix",
12
+ "test": "jest --forceExit --detectOpenHandles"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+ssh://git@gitlab.com/tomei-package/sso.git"
17
+ },
18
+ "keywords": [
19
+ "tomei",
20
+ "sso"
21
+ ],
22
+ "author": "Tomei",
23
+ "license": "ISC",
24
+ "bugs": {
25
+ "url": "https://gitlab.com/tomei-package/sso/issues"
26
+ },
27
+ "homepage": "https://gitlab.com/tomei-package/sso#readme",
28
+ "devDependencies": {
29
+ "@commitlint/cli": "^17.6.3",
30
+ "@commitlint/config-conventional": "^17.6.3",
31
+ "@tsconfig/node18": "^2.0.1",
32
+ "@types/bcrypt": "^5.0.0",
33
+ "@types/jest": "^29.5.2",
34
+ "@types/node": "^18.17.5",
35
+ "@types/redis": "^4.0.11",
36
+ "@types/validator": "^13.11.1",
37
+ "@typescript-eslint/eslint-plugin": "^5.33.0",
38
+ "dotenv": "^16.1.4",
39
+ "eslint": "^8.40.0",
40
+ "eslint-config-prettier": "^8.5.0",
41
+ "eslint-plugin-prettier": "^4.2.1",
42
+ "husky": "^8.0.3",
43
+ "jest": "^29.5.0",
44
+ "jest-mock-extended": "^3.0.4",
45
+ "lint-staged": "^13.2.2",
46
+ "prettier": "^2.7.1",
47
+ "prisma": "^4.14.0",
48
+ "redis-mock": "^0.56.3",
49
+ "sequelize-cli": "^6.6.2",
50
+ "ts-jest": "^29.1.0",
51
+ "ts-node": "^10.9.1",
52
+ "tsc-watch": "^5.0.3",
53
+ "tsconfig-paths": "^4.0.0",
54
+ "tslint": "^6.1.3",
55
+ "typescript": "^4.7.4"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public"
59
+ },
60
+ "peerDependencies": {
61
+ "@tomei/config": "^0.3.9",
62
+ "@tomei/general": "^0.10.6",
63
+ "@tomei/mailer": "^0.5.11",
64
+ "@types/jest": "^29.5.2",
65
+ "argon2": "^0.30.3",
66
+ "cls-hooked": "^4.2.2",
67
+ "cuid": "^3.0.0",
68
+ "nodemailer": "^6.9.3",
69
+ "redis": "^4.6.7",
70
+ "reflect-metadata": "^0.1.13",
71
+ "sequelize": "^6.32.1",
72
+ "sequelize-typescript": "^2.1.5"
73
+ },
74
+ "lint-staged": {
75
+ "*/**/*.{js,ts,tsx}": [
76
+ "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
77
+ "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
78
+ ]
79
+ }
80
+ }
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=
@@ -64,7 +64,9 @@ export class Staff extends ObjectBase implements IPerson {
64
64
  private constructor(staffInfo) {
65
65
  super();
66
66
  if (staffInfo) {
67
- this.ObjectId = staffInfo.id;
67
+ // needed to implement objectBase
68
+ this.ObjectId = staffInfo.staff_id;
69
+
68
70
  this.UserId = staffInfo.user_id;
69
71
  this.StaffId = staffInfo.staff_id;
70
72
  this.FullName = staffInfo.full_name;
@@ -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
+ }