@tomei/sso 0.11.7 → 0.14.0
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/.commitlintrc.json +22 -22
- package/.eslintrc +16 -16
- package/.eslintrc.js +35 -35
- package/.husky/commit-msg +15 -15
- package/.husky/pre-commit +7 -7
- package/.prettierrc +4 -4
- package/Jenkinsfile +57 -57
- package/README.md +23 -23
- package/__tests__/unit/components/login-user/login-user.spec.ts +742 -742
- package/__tests__/unit/components/password-hash/password-hash.service.spec.ts +31 -31
- package/__tests__/unit/redis-client/redis.service.spec.ts +23 -23
- package/__tests__/unit/session/session.service.spec.ts +47 -47
- package/__tests__/unit/system-privilege/system-privilage.spec.ts +91 -91
- package/create-sso-user.sql +39 -39
- package/dist/__tests__/unit/components/login-user/login-user.spec.d.ts +1 -1
- package/dist/__tests__/unit/components/login-user/login-user.spec.js +662 -662
- package/dist/__tests__/unit/components/password-hash/password-hash.service.spec.d.ts +1 -1
- package/dist/__tests__/unit/components/password-hash/password-hash.service.spec.js +37 -37
- package/dist/__tests__/unit/redis-client/redis.service.spec.d.ts +1 -1
- package/dist/__tests__/unit/redis-client/redis.service.spec.js +31 -31
- package/dist/__tests__/unit/session/session.service.spec.d.ts +1 -1
- package/dist/__tests__/unit/session/session.service.spec.js +54 -54
- package/dist/__tests__/unit/system-privilege/system-privilage.spec.js +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -17
- package/dist/src/components/building/building.d.ts +38 -0
- package/dist/src/components/building/building.js +92 -0
- package/dist/src/components/building/building.js.map +1 -0
- package/dist/src/components/building/building.repository.d.ts +5 -0
- package/dist/src/components/building/building.repository.js +12 -0
- package/dist/src/components/building/building.repository.js.map +1 -0
- package/dist/src/components/building/index.d.ts +2 -0
- package/dist/src/components/building/index.js +19 -0
- package/dist/src/components/building/index.js.map +1 -0
- package/dist/src/components/building-type/building-type.repository.d.ts +5 -0
- package/dist/src/components/building-type/building-type.repository.js +12 -0
- package/dist/src/components/building-type/building-type.repository.js.map +1 -0
- package/dist/src/components/building-type/index.d.ts +1 -0
- package/dist/src/{prisma-client → components/building-type}/index.js +17 -17
- package/dist/src/components/building-type/index.js.map +1 -0
- package/dist/src/components/index.d.ts +9 -7
- package/dist/src/components/index.js +25 -23
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/login-history/index.d.ts +1 -1
- package/dist/src/components/login-history/index.js +17 -17
- package/dist/src/components/login-history/login-history.repository.d.ts +5 -5
- package/dist/src/components/login-history/login-history.repository.js +11 -11
- package/dist/src/components/login-user/index.d.ts +3 -3
- package/dist/src/components/login-user/index.js +19 -19
- package/dist/src/components/login-user/interfaces/index.d.ts +1 -1
- package/dist/src/components/login-user/interfaces/index.js +17 -17
- package/dist/src/components/login-user/interfaces/user-info.interface.d.ts +9 -9
- package/dist/src/components/login-user/interfaces/user-info.interface.js +2 -2
- package/dist/src/components/login-user/login-user.d.ts +46 -45
- package/dist/src/components/login-user/login-user.js +430 -414
- package/dist/src/components/login-user/login-user.js.map +1 -1
- package/dist/src/components/login-user/user.repository.d.ts +5 -5
- package/dist/src/components/login-user/user.repository.js +11 -11
- package/dist/src/components/password-hash/index.d.ts +2 -2
- package/dist/src/components/password-hash/index.js +18 -18
- package/dist/src/components/password-hash/interfaces/index.d.ts +1 -1
- package/dist/src/components/password-hash/interfaces/index.js +17 -17
- package/dist/src/components/password-hash/interfaces/password-hash-service.interface.d.ts +4 -4
- package/dist/src/components/password-hash/interfaces/password-hash-service.interface.js +2 -2
- package/dist/src/components/password-hash/password-hash.service.d.ts +6 -6
- package/dist/src/components/password-hash/password-hash.service.js +27 -27
- package/dist/src/components/system/index.d.ts +1 -1
- package/dist/src/components/system/index.js +17 -17
- package/dist/src/components/system/system.repository.d.ts +5 -5
- package/dist/src/components/system/system.repository.js +11 -11
- package/dist/src/components/system-access/index.d.ts +1 -1
- package/dist/src/components/system-access/index.js +17 -17
- package/dist/src/components/system-access/system-access.repository.d.ts +5 -5
- package/dist/src/components/system-access/system-access.repository.js +11 -11
- package/dist/src/components/system-privilege/privilege.d.ts +6 -6
- package/dist/src/components/system-privilege/privilege.js +76 -76
- package/dist/src/components/system-privilege/system-privilege.repository.d.ts +6 -6
- package/dist/src/components/system-privilege/system-privilege.repository.js +34 -34
- package/dist/src/components/user-group/index.d.ts +1 -1
- package/dist/src/components/user-group/index.js +17 -17
- package/dist/src/components/user-group/user-group.repository.d.ts +5 -5
- package/dist/src/components/user-group/user-group.repository.js +11 -11
- package/dist/src/components/user-user-group/index.d.ts +1 -1
- package/dist/src/components/user-user-group/index.js +17 -17
- package/dist/src/components/user-user-group/user-user-group.repository.d.ts +5 -5
- package/dist/src/components/user-user-group/user-user-group.repository.js +11 -11
- package/dist/src/database.d.ts +4 -4
- package/dist/src/database.js +14 -14
- package/dist/src/index.d.ts +5 -5
- package/dist/src/index.js +23 -23
- package/dist/src/interfaces/index.d.ts +2 -2
- package/dist/src/interfaces/index.js +18 -18
- package/dist/src/interfaces/system-login.interface.d.ts +6 -6
- package/dist/src/interfaces/system-login.interface.js +2 -2
- package/dist/src/interfaces/user-session.interface.d.ts +4 -4
- package/dist/src/interfaces/user-session.interface.js +2 -2
- package/dist/src/models/authorization-code.entity.d.ts +14 -14
- package/dist/src/models/authorization-code.entity.js +85 -85
- package/dist/src/models/bearer-token.entity.d.ts +11 -11
- package/dist/src/models/bearer-token.entity.js +71 -71
- package/dist/src/models/building-type.entity.d.ts +7 -7
- package/dist/src/models/building-type.entity.js +49 -49
- package/dist/src/models/building.entity.d.ts +39 -39
- package/dist/src/models/building.entity.js +250 -250
- package/dist/src/models/city.entity.d.ts +11 -11
- package/dist/src/models/city.entity.js +71 -71
- package/dist/src/models/company.entity.d.ts +18 -18
- package/dist/src/models/company.entity.js +113 -113
- package/dist/src/models/country.entity.d.ts +15 -15
- package/dist/src/models/country.entity.js +91 -91
- package/dist/src/models/department.entity.d.ts +19 -19
- package/dist/src/models/department.entity.js +111 -111
- package/dist/src/models/group-role-privilege.entity.d.ts +17 -17
- package/dist/src/models/group-role-privilege.entity.js +89 -89
- package/dist/src/models/group-system-access.entity.d.ts +11 -11
- package/dist/src/models/group-system-access.entity.js +61 -61
- package/dist/src/models/group-system-privilege.entity.d.ts +11 -11
- package/dist/src/models/group-system-privilege.entity.js +61 -61
- package/dist/src/models/group-system-role.entity.d.ts +11 -11
- package/dist/src/models/group-system-role.entity.js +61 -61
- package/dist/src/models/login-history.entity.d.ts +12 -12
- package/dist/src/models/login-history.entity.js +69 -69
- package/dist/src/models/oauth-token.entity.d.ts +14 -14
- package/dist/src/models/oauth-token.entity.js +85 -85
- package/dist/src/models/role.entity.d.ts +17 -17
- package/dist/src/models/role.entity.js +101 -101
- package/dist/src/models/staff-type.entity.d.ts +7 -7
- package/dist/src/models/staff-type.entity.js +49 -49
- package/dist/src/models/staff.entity.d.ts +39 -39
- package/dist/src/models/staff.entity.js +249 -249
- package/dist/src/models/state.entity.d.ts +10 -10
- package/dist/src/models/state.entity.js +63 -63
- package/dist/src/models/system-accesss.entity.d.ts +6 -6
- package/dist/src/models/system-accesss.entity.js +50 -50
- package/dist/src/models/system-privilege.entity.d.ts +16 -16
- package/dist/src/models/system-privilege.entity.js +89 -89
- package/dist/src/models/system-role-privilege.entity.d.ts +11 -11
- package/dist/src/models/system-role-privilege.entity.js +59 -59
- package/dist/src/models/system-role.entity.d.ts +11 -11
- package/dist/src/models/system-role.entity.js +82 -82
- package/dist/src/models/system.entity.d.ts +19 -19
- package/dist/src/models/system.entity.js +145 -145
- package/dist/src/models/user-group.entity.d.ts +23 -23
- package/dist/src/models/user-group.entity.js +139 -139
- package/dist/src/models/user-role.entity.d.ts +12 -12
- package/dist/src/models/user-role.entity.js +72 -72
- package/dist/src/models/user-system-privileges.entity.d.ts +13 -13
- package/dist/src/models/user-system-privileges.entity.js +88 -88
- package/dist/src/models/user-system-role.entity.d.ts +11 -11
- package/dist/src/models/user-system-role.entity.js +59 -59
- package/dist/src/models/user-user-group.entity.d.ts +14 -14
- package/dist/src/models/user-user-group.entity.js +72 -72
- package/dist/src/models/user.entity.d.ts +30 -30
- package/dist/src/models/user.entity.js +130 -130
- package/dist/src/redis-client/__mocks__/jest-initial-setup.d.ts +1 -1
- package/dist/src/redis-client/__mocks__/jest-initial-setup.js +4 -4
- package/dist/src/redis-client/__mocks__/redis-mock.d.ts +2 -2
- package/dist/src/redis-client/__mocks__/redis-mock.js +22 -22
- package/dist/src/redis-client/index.d.ts +1 -1
- package/dist/src/redis-client/index.js +17 -17
- package/dist/src/redis-client/redis.service.d.ts +7 -7
- package/dist/src/redis-client/redis.service.js +60 -60
- package/dist/src/session/index.d.ts +2 -2
- package/dist/src/session/index.js +18 -18
- package/dist/src/session/interfaces/index.d.ts +1 -1
- package/dist/src/session/interfaces/index.js +17 -17
- package/dist/src/session/interfaces/session-service.interface.d.ts +6 -6
- package/dist/src/session/interfaces/session-service.interface.js +2 -2
- package/dist/src/session/session.service.d.ts +10 -10
- package/dist/src/session/session.service.js +62 -62
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/jest.config.js +13 -13
- package/migrations/01-alter-system-privilege-table.js +13 -13
- package/migrations/02-alter-user-group-table.js +78 -78
- package/migrations/03-alter-user-system-privilege-table.js +38 -38
- package/migrations/04-create-user-user-group-table.js +55 -55
- package/migrations/05-create-login-history-table.js +49 -49
- package/package.json +2 -2
- package/sampledotenv +7 -7
- package/src/components/building/building.repository.ts +11 -0
- package/src/components/building/building.ts +119 -0
- package/src/components/building/index.ts +3 -0
- package/src/components/building-type/building-type.repository.ts +11 -0
- package/src/components/building-type/index.ts +2 -0
- package/src/components/index.ts +2 -0
- package/src/components/login-user/login-user.ts +18 -0
- package/src/models/building-type.entity.ts +1 -1
- package/tsconfig.build.json +5 -5
- package/tsconfig.json +23 -23
- package/dist/__tests__/unit/components/login-history/login-history.repository.spec.d.ts +0 -0
- package/dist/__tests__/unit/components/login-history/login-history.repository.spec.js +0 -1
- package/dist/__tests__/unit/components/login-history/login-history.repository.spec.js.map +0 -1
- package/dist/__tests__/unit/components/login-user/user.repository.spec.d.ts +0 -0
- package/dist/__tests__/unit/components/login-user/user.repository.spec.js +0 -1
- package/dist/__tests__/unit/components/login-user/user.repository.spec.js.map +0 -1
- package/dist/__tests__/unit/components/system/system.repository.spec.d.ts +0 -0
- package/dist/__tests__/unit/components/system/system.repository.spec.js +0 -1
- package/dist/__tests__/unit/components/system/system.repository.spec.js.map +0 -1
- package/dist/__tests__/unit/components/system-access/system-access.repository.spec.d.ts +0 -0
- package/dist/__tests__/unit/components/system-access/system-access.repository.spec.js +0 -1
- package/dist/__tests__/unit/components/system-access/system-access.repository.spec.js.map +0 -1
- package/dist/src/prisma-client/__mocks__/prisma.d.ts +0 -3
- package/dist/src/prisma-client/__mocks__/prisma.js +0 -14
- package/dist/src/prisma-client/__mocks__/prisma.js.map +0 -1
- package/dist/src/prisma-client/client.d.ts +0 -3
- package/dist/src/prisma-client/client.js +0 -6
- package/dist/src/prisma-client/client.js.map +0 -1
- package/dist/src/prisma-client/index.d.ts +0 -1
- package/dist/src/prisma-client/index.js.map +0 -1
@@ -0,0 +1,11 @@
|
|
1
|
+
import BuildingType from '../../models/building-type.entity';
|
2
|
+
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
|
3
|
+
|
4
|
+
export class BuildingTypeRepository
|
5
|
+
extends RepositoryBase<BuildingType>
|
6
|
+
implements IRepositoryBase<BuildingType>
|
7
|
+
{
|
8
|
+
constructor() {
|
9
|
+
super(BuildingType);
|
10
|
+
}
|
11
|
+
}
|
package/src/components/index.ts
CHANGED
@@ -535,4 +535,22 @@ export class LoginUser extends LoginUserBase {
|
|
535
535
|
throw error;
|
536
536
|
}
|
537
537
|
}
|
538
|
+
|
539
|
+
async logout(systemCode: string) {
|
540
|
+
try {
|
541
|
+
if (!this.ObjectId) {
|
542
|
+
throw new Error('ObjectId(UserId) is not set');
|
543
|
+
}
|
544
|
+
const userSession = await this._SessionService.retrieveUserSession(
|
545
|
+
this.ObjectId,
|
546
|
+
);
|
547
|
+
const index = userSession.systemLogins.findIndex(
|
548
|
+
(system) => system.code === systemCode,
|
549
|
+
);
|
550
|
+
userSession.systemLogins.splice(index, 1);
|
551
|
+
this._SessionService.setUserSession(this.ObjectId, userSession);
|
552
|
+
} catch (error) {
|
553
|
+
throw error;
|
554
|
+
}
|
555
|
+
}
|
538
556
|
}
|
package/tsconfig.build.json
CHANGED
@@ -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
|
+
}
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
//# sourceMappingURL=login-history.repository.spec.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"login-history.repository.spec.js","sourceRoot":"","sources":["../../../../../__tests__/unit/components/login-history/login-history.repository.spec.ts"],"names":[],"mappings":""}
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
//# sourceMappingURL=user.repository.spec.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"user.repository.spec.js","sourceRoot":"","sources":["../../../../../__tests__/unit/components/login-user/user.repository.spec.ts"],"names":[],"mappings":""}
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
//# sourceMappingURL=system.repository.spec.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"system.repository.spec.js","sourceRoot":"","sources":["../../../../../__tests__/unit/components/system/system.repository.spec.ts"],"names":[],"mappings":""}
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
//# sourceMappingURL=system-access.repository.spec.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"system-access.repository.spec.js","sourceRoot":"","sources":["../../../../../__tests__/unit/components/system-access/system-access.repository.spec.ts"],"names":[],"mappings":""}
|
@@ -1,3 +0,0 @@
|
|
1
|
-
import { PrismaClient } from '@prisma/client';
|
2
|
-
import { DeepMockProxy } from 'jest-mock-extended';
|
3
|
-
export declare const prismaMock: DeepMockProxy<PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, import(".prisma/client").Prisma.RejectOnNotFound | import(".prisma/client").Prisma.RejectPerOperation | undefined>>;
|
@@ -1,14 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.prismaMock = void 0;
|
4
|
-
const jest_mock_extended_1 = require("jest-mock-extended");
|
5
|
-
const client_1 = require("../client");
|
6
|
-
jest.mock('../client', () => ({
|
7
|
-
__esModule: true,
|
8
|
-
default: (0, jest_mock_extended_1.mockDeep)(),
|
9
|
-
}));
|
10
|
-
beforeEach(() => {
|
11
|
-
(0, jest_mock_extended_1.mockReset)(exports.prismaMock);
|
12
|
-
});
|
13
|
-
exports.prismaMock = client_1.default;
|
14
|
-
//# sourceMappingURL=prisma.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"prisma.js","sourceRoot":"","sources":["../../../../src/prisma-client/__mocks__/prisma.ts"],"names":[],"mappings":";;;AACA,2DAAwE;AAExE,sCAA+B;AAE/B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5B,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,IAAA,6BAAQ,GAAgB;CAClC,CAAC,CAAC,CAAC;AAEJ,UAAU,CAAC,GAAG,EAAE;IACd,IAAA,8BAAS,EAAC,kBAAU,CAAC,CAAC;AACxB,CAAC,CAAC,CAAC;AAEU,QAAA,UAAU,GAAG,gBAAgD,CAAC"}
|
@@ -1,3 +0,0 @@
|
|
1
|
-
import { PrismaClient } from '@prisma/client';
|
2
|
-
declare const prisma: PrismaClient<import(".prisma/client").Prisma.PrismaClientOptions, never, import(".prisma/client").Prisma.RejectOnNotFound | import(".prisma/client").Prisma.RejectPerOperation | undefined>;
|
3
|
-
export default prisma;
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/prisma-client/client.ts"],"names":[],"mappings":";;AAAA,2CAA8C;AAC9C,MAAM,MAAM,GAAG,IAAI,qBAAY,EAAE,CAAC;AAClC,kBAAe,MAAM,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
export * from './client';
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/prisma-client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
|