ecrs-auth-core 1.0.71 → 1.0.73
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/dist/auth.controller.js +207 -207
- package/dist/auth.service.js +361 -361
- package/dist/entities/work-profile.entity.js +11 -11
- package/dist/guards/api-key.guard.js +1 -0
- package/dist/index.d.ts +31 -31
- package/dist/index.js +54 -54
- package/dist/interfaces/auth-core-options.interface.d.ts +38 -38
- package/package.json +1 -1
|
@@ -47,19 +47,19 @@ __decorate([
|
|
|
47
47
|
__metadata("design:type", Number)
|
|
48
48
|
], EmployeeWorkProfileEntity.prototype, "id", void 0);
|
|
49
49
|
__decorate([
|
|
50
|
-
(0, typeorm_1.Column)({ name: 'employee_id', type: 'int' }),
|
|
50
|
+
(0, typeorm_1.Column)({ name: 'employee_id', type: 'int', nullable: true }),
|
|
51
51
|
__metadata("design:type", Number)
|
|
52
52
|
], EmployeeWorkProfileEntity.prototype, "employee_id", void 0);
|
|
53
53
|
__decorate([
|
|
54
|
-
(0, typeorm_1.Column)({ name: 'department_id', type: 'int' }),
|
|
54
|
+
(0, typeorm_1.Column)({ name: 'department_id', type: 'int', nullable: true }),
|
|
55
55
|
__metadata("design:type", Number)
|
|
56
56
|
], EmployeeWorkProfileEntity.prototype, "department_id", void 0);
|
|
57
57
|
__decorate([
|
|
58
|
-
(0, typeorm_1.Column)({ name: 'designation_id', type: 'int' }),
|
|
58
|
+
(0, typeorm_1.Column)({ name: 'designation_id', type: 'int', nullable: true }),
|
|
59
59
|
__metadata("design:type", Number)
|
|
60
60
|
], EmployeeWorkProfileEntity.prototype, "designation_id", void 0);
|
|
61
61
|
__decorate([
|
|
62
|
-
(0, typeorm_1.Column)({ type: 'enum', enum: EmployeeType, nullable:
|
|
62
|
+
(0, typeorm_1.Column)({ type: 'enum', enum: EmployeeType, nullable: true }),
|
|
63
63
|
__metadata("design:type", String)
|
|
64
64
|
], EmployeeWorkProfileEntity.prototype, "employee_type", void 0);
|
|
65
65
|
__decorate([
|
|
@@ -76,7 +76,7 @@ __decorate([
|
|
|
76
76
|
__metadata("design:type", Number)
|
|
77
77
|
], EmployeeWorkProfileEntity.prototype, "shift_id", void 0);
|
|
78
78
|
__decorate([
|
|
79
|
-
(0, typeorm_1.Column)({ name: 'role_id', type: 'int' }),
|
|
79
|
+
(0, typeorm_1.Column)({ name: 'role_id', type: 'int', nullable: true }),
|
|
80
80
|
__metadata("design:type", Number)
|
|
81
81
|
], EmployeeWorkProfileEntity.prototype, "role_id", void 0);
|
|
82
82
|
__decorate([
|
|
@@ -92,7 +92,7 @@ __decorate([
|
|
|
92
92
|
__metadata("design:type", Object)
|
|
93
93
|
], EmployeeWorkProfileEntity.prototype, "l2_manager_id", void 0);
|
|
94
94
|
__decorate([
|
|
95
|
-
(0, typeorm_1.Column)({ type: 'date', nullable:
|
|
95
|
+
(0, typeorm_1.Column)({ type: 'date', nullable: true }),
|
|
96
96
|
__metadata("design:type", Date)
|
|
97
97
|
], EmployeeWorkProfileEntity.prototype, "joining_date", void 0);
|
|
98
98
|
__decorate([
|
|
@@ -108,14 +108,14 @@ __decorate([
|
|
|
108
108
|
__metadata("design:type", Number)
|
|
109
109
|
], EmployeeWorkProfileEntity.prototype, "dispatch_center_id", void 0);
|
|
110
110
|
__decorate([
|
|
111
|
-
(0, typeorm_1.Column)({ name: 'cost_center_id', type: 'int' }),
|
|
111
|
+
(0, typeorm_1.Column)({ name: 'cost_center_id', type: 'int', nullable: true }),
|
|
112
112
|
__metadata("design:type", Number)
|
|
113
113
|
], EmployeeWorkProfileEntity.prototype, "cost_center_id", void 0);
|
|
114
114
|
__decorate([
|
|
115
115
|
(0, typeorm_1.Column)({
|
|
116
116
|
type: 'enum',
|
|
117
117
|
enum: WeekOffType,
|
|
118
|
-
nullable:
|
|
118
|
+
nullable: true,
|
|
119
119
|
}),
|
|
120
120
|
__metadata("design:type", String)
|
|
121
121
|
], EmployeeWorkProfileEntity.prototype, "week_off_type", void 0);
|
|
@@ -123,7 +123,7 @@ __decorate([
|
|
|
123
123
|
(0, typeorm_1.Column)({
|
|
124
124
|
type: 'enum',
|
|
125
125
|
enum: WeekOffBasedOn,
|
|
126
|
-
nullable:
|
|
126
|
+
nullable: true,
|
|
127
127
|
}),
|
|
128
128
|
__metadata("design:type", String)
|
|
129
129
|
], EmployeeWorkProfileEntity.prototype, "week_off_based_on", void 0);
|
|
@@ -136,7 +136,7 @@ __decorate([
|
|
|
136
136
|
__metadata("design:type", String)
|
|
137
137
|
], EmployeeWorkProfileEntity.prototype, "linkedInProfile", void 0);
|
|
138
138
|
__decorate([
|
|
139
|
-
(0, typeorm_1.CreateDateColumn)({ type: 'timestamp' }),
|
|
139
|
+
(0, typeorm_1.CreateDateColumn)({ type: 'timestamp', nullable: true }),
|
|
140
140
|
__metadata("design:type", Date)
|
|
141
141
|
], EmployeeWorkProfileEntity.prototype, "created_at", void 0);
|
|
142
142
|
__decorate([
|
|
@@ -144,7 +144,7 @@ __decorate([
|
|
|
144
144
|
__metadata("design:type", Number)
|
|
145
145
|
], EmployeeWorkProfileEntity.prototype, "created_by", void 0);
|
|
146
146
|
__decorate([
|
|
147
|
-
(0, typeorm_1.UpdateDateColumn)({ type: 'timestamp' }),
|
|
147
|
+
(0, typeorm_1.UpdateDateColumn)({ type: 'timestamp', nullable: true }),
|
|
148
148
|
__metadata("design:type", Date)
|
|
149
149
|
], EmployeeWorkProfileEntity.prototype, "updated_at", void 0);
|
|
150
150
|
__decorate([
|
|
@@ -73,6 +73,7 @@ let ApiKeyGuard = class ApiKeyGuard {
|
|
|
73
73
|
const record = await this.apiKeyRepo.findOne({
|
|
74
74
|
where: { key: apiKey, isActive: true },
|
|
75
75
|
});
|
|
76
|
+
console.log(`🔑 Validating API key: ${apiKey}`);
|
|
76
77
|
if (!record) {
|
|
77
78
|
return { valid: false, message: 'API key not found or inactive' };
|
|
78
79
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
export * from './auth.module';
|
|
2
|
-
export * from './auth.service';
|
|
3
|
-
export * from './dtos/login.dto';
|
|
4
|
-
export * from './dtos/login-response.dto';
|
|
5
|
-
export * from './decorators/current-user.decorator';
|
|
6
|
-
export * from './decorators/feature.decorator';
|
|
7
|
-
export * from './decorators/has-permission.decorator';
|
|
8
|
-
export * from './decorators/roles.decorator';
|
|
9
|
-
export * from './decorators/route-permission.decorator';
|
|
10
|
-
export * from './decorators/api-key.decorator';
|
|
11
|
-
export * from './guards/module.guard';
|
|
12
|
-
export * from './guards/roles.guard';
|
|
13
|
-
export * from './guards/feature.guard';
|
|
14
|
-
export * from './guards/route.guard';
|
|
15
|
-
export * from './guards/permission.guard';
|
|
16
|
-
export * from './guards/api-key.guard';
|
|
17
|
-
export * from './jwt/jwt.guard';
|
|
18
|
-
export * from './jwt/jwt.strategy';
|
|
19
|
-
export * from './interfaces/auth-core-options.interface';
|
|
20
|
-
export * from './entities/user.entity';
|
|
21
|
-
export * from './entities/role.entity';
|
|
22
|
-
export * from './entities/module.entity';
|
|
23
|
-
export * from './entities/feature.entity';
|
|
24
|
-
export * from './entities/module-route.entity';
|
|
25
|
-
export * from './entities/user-feature-access.entity';
|
|
26
|
-
export * from './entities/user-module-access.entity';
|
|
27
|
-
export * from './entities/module-screen-permission.entity';
|
|
28
|
-
export * from './entities/api-key.entity';
|
|
29
|
-
export * from './entities/user-last-login.entity';
|
|
30
|
-
export * from './entities/ip-access.entity';
|
|
31
|
-
export * from './entities/work-profile.entity';
|
|
1
|
+
export * from './auth.module';
|
|
2
|
+
export * from './auth.service';
|
|
3
|
+
export * from './dtos/login.dto';
|
|
4
|
+
export * from './dtos/login-response.dto';
|
|
5
|
+
export * from './decorators/current-user.decorator';
|
|
6
|
+
export * from './decorators/feature.decorator';
|
|
7
|
+
export * from './decorators/has-permission.decorator';
|
|
8
|
+
export * from './decorators/roles.decorator';
|
|
9
|
+
export * from './decorators/route-permission.decorator';
|
|
10
|
+
export * from './decorators/api-key.decorator';
|
|
11
|
+
export * from './guards/module.guard';
|
|
12
|
+
export * from './guards/roles.guard';
|
|
13
|
+
export * from './guards/feature.guard';
|
|
14
|
+
export * from './guards/route.guard';
|
|
15
|
+
export * from './guards/permission.guard';
|
|
16
|
+
export * from './guards/api-key.guard';
|
|
17
|
+
export * from './jwt/jwt.guard';
|
|
18
|
+
export * from './jwt/jwt.strategy';
|
|
19
|
+
export * from './interfaces/auth-core-options.interface';
|
|
20
|
+
export * from './entities/user.entity';
|
|
21
|
+
export * from './entities/role.entity';
|
|
22
|
+
export * from './entities/module.entity';
|
|
23
|
+
export * from './entities/feature.entity';
|
|
24
|
+
export * from './entities/module-route.entity';
|
|
25
|
+
export * from './entities/user-feature-access.entity';
|
|
26
|
+
export * from './entities/user-module-access.entity';
|
|
27
|
+
export * from './entities/module-screen-permission.entity';
|
|
28
|
+
export * from './entities/api-key.entity';
|
|
29
|
+
export * from './entities/user-last-login.entity';
|
|
30
|
+
export * from './entities/ip-access.entity';
|
|
31
|
+
export * from './entities/work-profile.entity';
|
package/dist/index.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// src/index.ts
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
__exportStar(require("./auth.module"), exports);
|
|
19
|
-
__exportStar(require("./auth.service"), exports);
|
|
20
|
-
// DTOs
|
|
21
|
-
__exportStar(require("./dtos/login.dto"), exports);
|
|
22
|
-
__exportStar(require("./dtos/login-response.dto"), exports);
|
|
23
|
-
// Decorators
|
|
24
|
-
__exportStar(require("./decorators/current-user.decorator"), exports);
|
|
25
|
-
__exportStar(require("./decorators/feature.decorator"), exports);
|
|
26
|
-
__exportStar(require("./decorators/has-permission.decorator"), exports);
|
|
27
|
-
__exportStar(require("./decorators/roles.decorator"), exports);
|
|
28
|
-
__exportStar(require("./decorators/route-permission.decorator"), exports);
|
|
29
|
-
__exportStar(require("./decorators/api-key.decorator"), exports);
|
|
30
|
-
// Guards
|
|
31
|
-
__exportStar(require("./guards/module.guard"), exports);
|
|
32
|
-
__exportStar(require("./guards/roles.guard"), exports);
|
|
33
|
-
__exportStar(require("./guards/feature.guard"), exports);
|
|
34
|
-
__exportStar(require("./guards/route.guard"), exports);
|
|
35
|
-
__exportStar(require("./guards/permission.guard"), exports);
|
|
36
|
-
__exportStar(require("./guards/api-key.guard"), exports);
|
|
37
|
-
// JWT
|
|
38
|
-
__exportStar(require("./jwt/jwt.guard"), exports);
|
|
39
|
-
__exportStar(require("./jwt/jwt.strategy"), exports);
|
|
40
|
-
// Interfaces
|
|
41
|
-
__exportStar(require("./interfaces/auth-core-options.interface"), exports);
|
|
42
|
-
// ✅ Entities
|
|
43
|
-
__exportStar(require("./entities/user.entity"), exports);
|
|
44
|
-
__exportStar(require("./entities/role.entity"), exports);
|
|
45
|
-
__exportStar(require("./entities/module.entity"), exports);
|
|
46
|
-
__exportStar(require("./entities/feature.entity"), exports);
|
|
47
|
-
__exportStar(require("./entities/module-route.entity"), exports);
|
|
48
|
-
__exportStar(require("./entities/user-feature-access.entity"), exports);
|
|
49
|
-
__exportStar(require("./entities/user-module-access.entity"), exports);
|
|
50
|
-
__exportStar(require("./entities/module-screen-permission.entity"), exports);
|
|
51
|
-
__exportStar(require("./entities/api-key.entity"), exports);
|
|
52
|
-
__exportStar(require("./entities/user-last-login.entity"), exports);
|
|
53
|
-
__exportStar(require("./entities/ip-access.entity"), exports);
|
|
54
|
-
__exportStar(require("./entities/work-profile.entity"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/index.ts
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
__exportStar(require("./auth.module"), exports);
|
|
19
|
+
__exportStar(require("./auth.service"), exports);
|
|
20
|
+
// DTOs
|
|
21
|
+
__exportStar(require("./dtos/login.dto"), exports);
|
|
22
|
+
__exportStar(require("./dtos/login-response.dto"), exports);
|
|
23
|
+
// Decorators
|
|
24
|
+
__exportStar(require("./decorators/current-user.decorator"), exports);
|
|
25
|
+
__exportStar(require("./decorators/feature.decorator"), exports);
|
|
26
|
+
__exportStar(require("./decorators/has-permission.decorator"), exports);
|
|
27
|
+
__exportStar(require("./decorators/roles.decorator"), exports);
|
|
28
|
+
__exportStar(require("./decorators/route-permission.decorator"), exports);
|
|
29
|
+
__exportStar(require("./decorators/api-key.decorator"), exports);
|
|
30
|
+
// Guards
|
|
31
|
+
__exportStar(require("./guards/module.guard"), exports);
|
|
32
|
+
__exportStar(require("./guards/roles.guard"), exports);
|
|
33
|
+
__exportStar(require("./guards/feature.guard"), exports);
|
|
34
|
+
__exportStar(require("./guards/route.guard"), exports);
|
|
35
|
+
__exportStar(require("./guards/permission.guard"), exports);
|
|
36
|
+
__exportStar(require("./guards/api-key.guard"), exports);
|
|
37
|
+
// JWT
|
|
38
|
+
__exportStar(require("./jwt/jwt.guard"), exports);
|
|
39
|
+
__exportStar(require("./jwt/jwt.strategy"), exports);
|
|
40
|
+
// Interfaces
|
|
41
|
+
__exportStar(require("./interfaces/auth-core-options.interface"), exports);
|
|
42
|
+
// ✅ Entities
|
|
43
|
+
__exportStar(require("./entities/user.entity"), exports);
|
|
44
|
+
__exportStar(require("./entities/role.entity"), exports);
|
|
45
|
+
__exportStar(require("./entities/module.entity"), exports);
|
|
46
|
+
__exportStar(require("./entities/feature.entity"), exports);
|
|
47
|
+
__exportStar(require("./entities/module-route.entity"), exports);
|
|
48
|
+
__exportStar(require("./entities/user-feature-access.entity"), exports);
|
|
49
|
+
__exportStar(require("./entities/user-module-access.entity"), exports);
|
|
50
|
+
__exportStar(require("./entities/module-screen-permission.entity"), exports);
|
|
51
|
+
__exportStar(require("./entities/api-key.entity"), exports);
|
|
52
|
+
__exportStar(require("./entities/user-last-login.entity"), exports);
|
|
53
|
+
__exportStar(require("./entities/ip-access.entity"), exports);
|
|
54
|
+
__exportStar(require("./entities/work-profile.entity"), exports);
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { Repository } from 'typeorm';
|
|
2
|
-
import { User } from '../entities/user.entity';
|
|
3
|
-
import { Role } from '../entities/role.entity';
|
|
4
|
-
import { Module } from '../entities/module.entity';
|
|
5
|
-
import { Feature } from '../entities/feature.entity';
|
|
6
|
-
import { ModuleRoute } from '../entities/module-route.entity';
|
|
7
|
-
import { UserFeatureAccess } from '../entities/user-feature-access.entity';
|
|
8
|
-
import { UserModuleAccess } from '../entities/user-module-access.entity';
|
|
9
|
-
import { ModuleScreenPermission } from '../entities/module-screen-permission.entity';
|
|
10
|
-
import { ApiKeyEntity } from '../entities/api-key.entity';
|
|
11
|
-
import { UserLastLoginEntity } from '../entities/user-last-login.entity';
|
|
12
|
-
import { EmployeeIPAccessEntity } from '../entities/ip-access.entity';
|
|
13
|
-
import { EmployeeWorkProfileEntity } from '../entities/work-profile.entity';
|
|
14
|
-
export interface Repositories {
|
|
15
|
-
userRepo: Repository<User>;
|
|
16
|
-
roleRepo: Repository<Role>;
|
|
17
|
-
moduleRepo: Repository<Module>;
|
|
18
|
-
featureAccessRepo: Repository<UserFeatureAccess>;
|
|
19
|
-
screenPermissionRepo: Repository<ModuleScreenPermission>;
|
|
20
|
-
featureRepo: Repository<Feature>;
|
|
21
|
-
routeRepo: Repository<ModuleRoute>;
|
|
22
|
-
moduleAccessRepo: Repository<UserModuleAccess>;
|
|
23
|
-
apiKeyRepo?: Repository<ApiKeyEntity>;
|
|
24
|
-
ipRestrictionsRepo?: Repository<EmployeeIPAccessEntity>;
|
|
25
|
-
userLastLoginRepo?: Repository<UserLastLoginEntity>;
|
|
26
|
-
employeeWorkProfileRepo?: Repository<EmployeeWorkProfileEntity>;
|
|
27
|
-
}
|
|
28
|
-
export interface AuthModuleConfig {
|
|
29
|
-
enable2FA?: boolean;
|
|
30
|
-
tokenIssuer?: string;
|
|
31
|
-
[key: string]: any;
|
|
32
|
-
}
|
|
33
|
-
export interface AuthCoreOptions {
|
|
34
|
-
jwtSecret: string;
|
|
35
|
-
jwtExpiresIn: string;
|
|
36
|
-
repositories: Repositories;
|
|
37
|
-
moduleConfig?: AuthModuleConfig;
|
|
38
|
-
}
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { User } from '../entities/user.entity';
|
|
3
|
+
import { Role } from '../entities/role.entity';
|
|
4
|
+
import { Module } from '../entities/module.entity';
|
|
5
|
+
import { Feature } from '../entities/feature.entity';
|
|
6
|
+
import { ModuleRoute } from '../entities/module-route.entity';
|
|
7
|
+
import { UserFeatureAccess } from '../entities/user-feature-access.entity';
|
|
8
|
+
import { UserModuleAccess } from '../entities/user-module-access.entity';
|
|
9
|
+
import { ModuleScreenPermission } from '../entities/module-screen-permission.entity';
|
|
10
|
+
import { ApiKeyEntity } from '../entities/api-key.entity';
|
|
11
|
+
import { UserLastLoginEntity } from '../entities/user-last-login.entity';
|
|
12
|
+
import { EmployeeIPAccessEntity } from '../entities/ip-access.entity';
|
|
13
|
+
import { EmployeeWorkProfileEntity } from '../entities/work-profile.entity';
|
|
14
|
+
export interface Repositories {
|
|
15
|
+
userRepo: Repository<User>;
|
|
16
|
+
roleRepo: Repository<Role>;
|
|
17
|
+
moduleRepo: Repository<Module>;
|
|
18
|
+
featureAccessRepo: Repository<UserFeatureAccess>;
|
|
19
|
+
screenPermissionRepo: Repository<ModuleScreenPermission>;
|
|
20
|
+
featureRepo: Repository<Feature>;
|
|
21
|
+
routeRepo: Repository<ModuleRoute>;
|
|
22
|
+
moduleAccessRepo: Repository<UserModuleAccess>;
|
|
23
|
+
apiKeyRepo?: Repository<ApiKeyEntity>;
|
|
24
|
+
ipRestrictionsRepo?: Repository<EmployeeIPAccessEntity>;
|
|
25
|
+
userLastLoginRepo?: Repository<UserLastLoginEntity>;
|
|
26
|
+
employeeWorkProfileRepo?: Repository<EmployeeWorkProfileEntity>;
|
|
27
|
+
}
|
|
28
|
+
export interface AuthModuleConfig {
|
|
29
|
+
enable2FA?: boolean;
|
|
30
|
+
tokenIssuer?: string;
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}
|
|
33
|
+
export interface AuthCoreOptions {
|
|
34
|
+
jwtSecret: string;
|
|
35
|
+
jwtExpiresIn: string;
|
|
36
|
+
repositories: Repositories;
|
|
37
|
+
moduleConfig?: AuthModuleConfig;
|
|
38
|
+
}
|