@tomei/sso 0.15.2 → 0.15.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.
- 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 +39 -39
- package/dist/src/components/building/building.js +128 -128
- package/dist/src/components/building/building.repository.d.ts +6 -6
- package/dist/src/components/building/building.repository.js +37 -37
- package/dist/src/components/building/index.d.ts +2 -2
- package/dist/src/components/building/index.js +18 -18
- package/dist/src/components/building-type/building-type.repository.d.ts +5 -5
- package/dist/src/components/building-type/building-type.repository.js +11 -11
- package/dist/src/components/building-type/index.d.ts +1 -1
- package/dist/src/components/building-type/index.js +17 -17
- package/dist/src/components/index.d.ts +10 -10
- package/dist/src/components/index.js +26 -26
- 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 +47 -46
- package/dist/src/components/login-user/login-user.js +431 -430
- 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/staff/index.d.ts +2 -2
- package/dist/src/components/staff/index.js +18 -18
- package/dist/src/components/staff/staff.d.ts +50 -49
- package/dist/src/components/staff/staff.js +101 -101
- package/dist/src/components/staff/staff.js.map +1 -1
- package/dist/src/components/staff/staff.repository.d.ts +6 -6
- package/dist/src/components/staff/staff.repository.js +37 -37
- 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 +13 -13
- package/dist/src/models/country.entity.js +75 -75
- 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 +79 -79
- package/sampledotenv +7 -7
- package/src/components/login-user/login-user.ts +1 -0
- package/src/components/staff/staff.ts +1 -0
- package/tsconfig.build.json +5 -5
- package/tsconfig.json +23 -23
@@ -1 +1 @@
|
|
1
|
-
export {};
|
1
|
+
export {};
|
@@ -1,38 +1,38 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
const password_hash_service_1 = require("../../../../src/components/password-hash/password-hash.service");
|
13
|
-
jest.mock('argon2', () => {
|
14
|
-
return {
|
15
|
-
hash: jest.fn((passowrd) => {
|
16
|
-
return `hash${passowrd}`;
|
17
|
-
}),
|
18
|
-
verify: jest.fn().mockResolvedValue(true)
|
19
|
-
};
|
20
|
-
});
|
21
|
-
describe('password-hash.service', () => {
|
22
|
-
const passwordHashService = new password_hash_service_1.PasswordHashService();
|
23
|
-
afterEach(() => {
|
24
|
-
jest.clearAllMocks();
|
25
|
-
});
|
26
|
-
it('should return hash password', () => __awaiter(void 0, void 0, void 0, function* () {
|
27
|
-
const password = 'password';
|
28
|
-
const hash = yield passwordHashService.hashPassword(password);
|
29
|
-
expect(hash).toEqual('hashpassword');
|
30
|
-
}));
|
31
|
-
it('should return true when verify password', () => __awaiter(void 0, void 0, void 0, function* () {
|
32
|
-
const password = 'password';
|
33
|
-
const hash = 'hashpassword10';
|
34
|
-
const result = yield passwordHashService.verify(password, hash);
|
35
|
-
expect(result).toEqual(true);
|
36
|
-
}));
|
37
|
-
});
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const password_hash_service_1 = require("../../../../src/components/password-hash/password-hash.service");
|
13
|
+
jest.mock('argon2', () => {
|
14
|
+
return {
|
15
|
+
hash: jest.fn((passowrd) => {
|
16
|
+
return `hash${passowrd}`;
|
17
|
+
}),
|
18
|
+
verify: jest.fn().mockResolvedValue(true)
|
19
|
+
};
|
20
|
+
});
|
21
|
+
describe('password-hash.service', () => {
|
22
|
+
const passwordHashService = new password_hash_service_1.PasswordHashService();
|
23
|
+
afterEach(() => {
|
24
|
+
jest.clearAllMocks();
|
25
|
+
});
|
26
|
+
it('should return hash password', () => __awaiter(void 0, void 0, void 0, function* () {
|
27
|
+
const password = 'password';
|
28
|
+
const hash = yield passwordHashService.hashPassword(password);
|
29
|
+
expect(hash).toEqual('hashpassword');
|
30
|
+
}));
|
31
|
+
it('should return true when verify password', () => __awaiter(void 0, void 0, void 0, function* () {
|
32
|
+
const password = 'password';
|
33
|
+
const hash = 'hashpassword10';
|
34
|
+
const result = yield passwordHashService.verify(password, hash);
|
35
|
+
expect(result).toEqual(true);
|
36
|
+
}));
|
37
|
+
});
|
38
38
|
//# sourceMappingURL=password-hash.service.spec.js.map
|
@@ -1 +1 @@
|
|
1
|
-
export {};
|
1
|
+
export {};
|
@@ -1,32 +1,32 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
const redis_service_1 = require("../../../src/redis-client/redis.service");
|
13
|
-
require('dotenv').config();
|
14
|
-
describe('redis.service', () => {
|
15
|
-
afterEach(() => {
|
16
|
-
jest.restoreAllMocks();
|
17
|
-
});
|
18
|
-
it('should return redis service when instansiated', () => __awaiter(void 0, void 0, void 0, function* () {
|
19
|
-
const redisService = yield redis_service_1.RedisService.init();
|
20
|
-
expect(redisService).toBeDefined();
|
21
|
-
}));
|
22
|
-
it('should able to write and read redis', () => __awaiter(void 0, void 0, void 0, function* () {
|
23
|
-
const data = {
|
24
|
-
test: 'test'
|
25
|
-
};
|
26
|
-
const redisService = yield redis_service_1.RedisService.init();
|
27
|
-
yield redisService.set("test", data, 60 * 60 * 24 * 1);
|
28
|
-
const result = yield redisService.get("test");
|
29
|
-
expect(result).toEqual(JSON.stringify(data));
|
30
|
-
}));
|
31
|
-
});
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const redis_service_1 = require("../../../src/redis-client/redis.service");
|
13
|
+
require('dotenv').config();
|
14
|
+
describe('redis.service', () => {
|
15
|
+
afterEach(() => {
|
16
|
+
jest.restoreAllMocks();
|
17
|
+
});
|
18
|
+
it('should return redis service when instansiated', () => __awaiter(void 0, void 0, void 0, function* () {
|
19
|
+
const redisService = yield redis_service_1.RedisService.init();
|
20
|
+
expect(redisService).toBeDefined();
|
21
|
+
}));
|
22
|
+
it('should able to write and read redis', () => __awaiter(void 0, void 0, void 0, function* () {
|
23
|
+
const data = {
|
24
|
+
test: 'test'
|
25
|
+
};
|
26
|
+
const redisService = yield redis_service_1.RedisService.init();
|
27
|
+
yield redisService.set("test", data, 60 * 60 * 24 * 1);
|
28
|
+
const result = yield redisService.get("test");
|
29
|
+
expect(result).toEqual(JSON.stringify(data));
|
30
|
+
}));
|
31
|
+
});
|
32
32
|
//# sourceMappingURL=redis.service.spec.js.map
|
@@ -1 +1 @@
|
|
1
|
-
export {};
|
1
|
+
export {};
|
@@ -1,55 +1,55 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
const session_service_1 = require("../../../src/session/session.service");
|
13
|
-
require('dotenv').config();
|
14
|
-
describe('session.service', () => {
|
15
|
-
it('should return session service when instansiated', () => __awaiter(void 0, void 0, void 0, function* () {
|
16
|
-
const sessionService = yield session_service_1.SessionService.init();
|
17
|
-
expect(sessionService).toBeDefined();
|
18
|
-
}));
|
19
|
-
it('should able to write session data', () => __awaiter(void 0, void 0, void 0, function* () {
|
20
|
-
const data = {
|
21
|
-
systemLogins: [
|
22
|
-
{
|
23
|
-
id: '1',
|
24
|
-
code: 'EZC',
|
25
|
-
sessionId: 'test1',
|
26
|
-
privileges: ['PRIVILEGE1', 'PRIVILEGE2'],
|
27
|
-
},
|
28
|
-
],
|
29
|
-
};
|
30
|
-
const sessionService = yield session_service_1.SessionService.init();
|
31
|
-
yield sessionService.setUserSession("1", data);
|
32
|
-
const result = yield sessionService.retrieveUserSession("1");
|
33
|
-
expect(result).toEqual(data);
|
34
|
-
}));
|
35
|
-
it('should able to refresh session data', () => __awaiter(void 0, void 0, void 0, function* () {
|
36
|
-
const setUserSession = jest.spyOn(session_service_1.SessionService.prototype, 'setUserSession');
|
37
|
-
const retrieveUserSession = jest.spyOn(session_service_1.SessionService.prototype, 'retrieveUserSession');
|
38
|
-
const data = {
|
39
|
-
systemLogins: [
|
40
|
-
{
|
41
|
-
id: '1',
|
42
|
-
code: 'EZC',
|
43
|
-
sessionId: 'test1',
|
44
|
-
privileges: ['PRIVILEGE1', 'PRIVILEGE2'],
|
45
|
-
},
|
46
|
-
],
|
47
|
-
};
|
48
|
-
const sessionService = yield session_service_1.SessionService.init();
|
49
|
-
yield sessionService.setUserSession("1", data);
|
50
|
-
yield sessionService.refreshDuration("1");
|
51
|
-
expect(setUserSession).toBeCalledTimes(2);
|
52
|
-
expect(retrieveUserSession).toBeCalledTimes(1);
|
53
|
-
}));
|
54
|
-
});
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const session_service_1 = require("../../../src/session/session.service");
|
13
|
+
require('dotenv').config();
|
14
|
+
describe('session.service', () => {
|
15
|
+
it('should return session service when instansiated', () => __awaiter(void 0, void 0, void 0, function* () {
|
16
|
+
const sessionService = yield session_service_1.SessionService.init();
|
17
|
+
expect(sessionService).toBeDefined();
|
18
|
+
}));
|
19
|
+
it('should able to write session data', () => __awaiter(void 0, void 0, void 0, function* () {
|
20
|
+
const data = {
|
21
|
+
systemLogins: [
|
22
|
+
{
|
23
|
+
id: '1',
|
24
|
+
code: 'EZC',
|
25
|
+
sessionId: 'test1',
|
26
|
+
privileges: ['PRIVILEGE1', 'PRIVILEGE2'],
|
27
|
+
},
|
28
|
+
],
|
29
|
+
};
|
30
|
+
const sessionService = yield session_service_1.SessionService.init();
|
31
|
+
yield sessionService.setUserSession("1", data);
|
32
|
+
const result = yield sessionService.retrieveUserSession("1");
|
33
|
+
expect(result).toEqual(data);
|
34
|
+
}));
|
35
|
+
it('should able to refresh session data', () => __awaiter(void 0, void 0, void 0, function* () {
|
36
|
+
const setUserSession = jest.spyOn(session_service_1.SessionService.prototype, 'setUserSession');
|
37
|
+
const retrieveUserSession = jest.spyOn(session_service_1.SessionService.prototype, 'retrieveUserSession');
|
38
|
+
const data = {
|
39
|
+
systemLogins: [
|
40
|
+
{
|
41
|
+
id: '1',
|
42
|
+
code: 'EZC',
|
43
|
+
sessionId: 'test1',
|
44
|
+
privileges: ['PRIVILEGE1', 'PRIVILEGE2'],
|
45
|
+
},
|
46
|
+
],
|
47
|
+
};
|
48
|
+
const sessionService = yield session_service_1.SessionService.init();
|
49
|
+
yield sessionService.setUserSession("1", data);
|
50
|
+
yield sessionService.refreshDuration("1");
|
51
|
+
expect(setUserSession).toBeCalledTimes(2);
|
52
|
+
expect(retrieveUserSession).toBeCalledTimes(1);
|
53
|
+
}));
|
54
|
+
});
|
55
55
|
//# sourceMappingURL=session.service.spec.js.map
|
@@ -1,6 +1,6 @@
|
|
1
|
-
describe('SystemPrivilege', () => {
|
2
|
-
it('should be true', () => {
|
3
|
-
expect(true).toBe(true);
|
4
|
-
});
|
5
|
-
});
|
1
|
+
describe('SystemPrivilege', () => {
|
2
|
+
it('should be true', () => {
|
3
|
+
expect(true).toBe(true);
|
4
|
+
});
|
5
|
+
});
|
6
6
|
//# sourceMappingURL=system-privilage.spec.js.map
|
package/dist/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export * from './src';
|
1
|
+
export * from './src';
|
package/dist/index.js
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
-
};
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
__exportStar(require("./src"), exports);
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./src"), exports);
|
18
18
|
//# sourceMappingURL=index.js.map
|
@@ -1,39 +1,39 @@
|
|
1
|
-
import { LoginUser } from '../../..';
|
2
|
-
export declare class Building {
|
3
|
-
id: number;
|
4
|
-
name: string;
|
5
|
-
code: string;
|
6
|
-
building_type_id: number;
|
7
|
-
status: string;
|
8
|
-
email: string;
|
9
|
-
mobile: string;
|
10
|
-
phone: string;
|
11
|
-
address: string;
|
12
|
-
postcode: string;
|
13
|
-
longitude: number;
|
14
|
-
latitude: number;
|
15
|
-
country_id: number;
|
16
|
-
state: string;
|
17
|
-
city: string;
|
18
|
-
brand: string;
|
19
|
-
area_staff_id: string;
|
20
|
-
opening_date: any;
|
21
|
-
ceased_date: any;
|
22
|
-
opening_hours: any;
|
23
|
-
image: string;
|
24
|
-
private _created_by_id;
|
25
|
-
private _updated_by_id;
|
26
|
-
private _created_at;
|
27
|
-
private _updated_at;
|
28
|
-
private _BuildingTypeId;
|
29
|
-
private _BuildingType;
|
30
|
-
private static _Repo;
|
31
|
-
private _RepoBuildingType;
|
32
|
-
private constructor();
|
33
|
-
static init(dbTransaction: any, code?: string): Promise<Building | undefined>;
|
34
|
-
getBuildingType(loginUser: LoginUser, dbTransaction?: any): Promise<{
|
35
|
-
BuildingTypeId: number;
|
36
|
-
BuildingType: string;
|
37
|
-
}>;
|
38
|
-
static findAll(loginUser: LoginUser, dbTransaction: any, page?: number, rows?: number, search?: {}): Promise<any>;
|
39
|
-
}
|
1
|
+
import { LoginUser } from '../../..';
|
2
|
+
export declare class Building {
|
3
|
+
id: number;
|
4
|
+
name: string;
|
5
|
+
code: string;
|
6
|
+
building_type_id: number;
|
7
|
+
status: string;
|
8
|
+
email: string;
|
9
|
+
mobile: string;
|
10
|
+
phone: string;
|
11
|
+
address: string;
|
12
|
+
postcode: string;
|
13
|
+
longitude: number;
|
14
|
+
latitude: number;
|
15
|
+
country_id: number;
|
16
|
+
state: string;
|
17
|
+
city: string;
|
18
|
+
brand: string;
|
19
|
+
area_staff_id: string;
|
20
|
+
opening_date: any;
|
21
|
+
ceased_date: any;
|
22
|
+
opening_hours: any;
|
23
|
+
image: string;
|
24
|
+
private _created_by_id;
|
25
|
+
private _updated_by_id;
|
26
|
+
private _created_at;
|
27
|
+
private _updated_at;
|
28
|
+
private _BuildingTypeId;
|
29
|
+
private _BuildingType;
|
30
|
+
private static _Repo;
|
31
|
+
private _RepoBuildingType;
|
32
|
+
private constructor();
|
33
|
+
static init(dbTransaction: any, code?: string): Promise<Building | undefined>;
|
34
|
+
getBuildingType(loginUser: LoginUser, dbTransaction?: any): Promise<{
|
35
|
+
BuildingTypeId: number;
|
36
|
+
BuildingType: string;
|
37
|
+
}>;
|
38
|
+
static findAll(loginUser: LoginUser, dbTransaction: any, page?: number, rows?: number, search?: {}): Promise<any>;
|
39
|
+
}
|