@uniorganization/uni-lib 4.0.23 → 4.0.25
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/entities/service-center.entity.d.ts +1 -1
- package/dist/entities/service-center.entity.js +1 -1
- package/dist/modules/common/index.d.ts +1 -0
- package/dist/modules/common/index.js +1 -0
- package/dist/modules/common/jwt-auth.guard.d.ts +4 -1
- package/dist/modules/common/jwt-auth.guard.js +16 -2
- package/dist/modules/common/skip-jwt-auth.decorator.d.ts +2 -0
- package/dist/modules/common/skip-jwt-auth.decorator.js +7 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Point } from 'geojson';
|
|
2
2
|
import { Users } from './usr.entity';
|
|
3
3
|
import { ServiceCenterPhoneEntity } from './service-center-phone.entity';
|
|
4
|
-
import { ServiceCenterStatus } from '
|
|
4
|
+
import { ServiceCenterStatus } from '../enums/service-center-status.enum';
|
|
5
5
|
export declare class ServiceCenterEntity {
|
|
6
6
|
id: number;
|
|
7
7
|
servicerAccount: string;
|
|
@@ -13,7 +13,7 @@ exports.ServiceCenterEntity = void 0;
|
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const usr_entity_1 = require("./usr.entity");
|
|
15
15
|
const service_center_phone_entity_1 = require("./service-center-phone.entity");
|
|
16
|
-
const service_center_status_enum_1 = require("
|
|
16
|
+
const service_center_status_enum_1 = require("../enums/service-center-status.enum");
|
|
17
17
|
let ServiceCenterEntity = class ServiceCenterEntity {
|
|
18
18
|
};
|
|
19
19
|
exports.ServiceCenterEntity = ServiceCenterEntity;
|
|
@@ -2,6 +2,7 @@ export * from './common.module';
|
|
|
2
2
|
export * from './jwt-auth.guard';
|
|
3
3
|
export * from './jwt.strategy';
|
|
4
4
|
export * from './logged-user.decorator';
|
|
5
|
+
export * from './skip-jwt-auth.decorator';
|
|
5
6
|
export * from './shared-db.module';
|
|
6
7
|
export * from './shared-db-connection.provider';
|
|
7
8
|
export * from './shared-db-repositories.provider';
|
|
@@ -18,6 +18,7 @@ __exportStar(require("./common.module"), exports);
|
|
|
18
18
|
__exportStar(require("./jwt-auth.guard"), exports);
|
|
19
19
|
__exportStar(require("./jwt.strategy"), exports);
|
|
20
20
|
__exportStar(require("./logged-user.decorator"), exports);
|
|
21
|
+
__exportStar(require("./skip-jwt-auth.decorator"), exports);
|
|
21
22
|
__exportStar(require("./shared-db.module"), exports);
|
|
22
23
|
__exportStar(require("./shared-db-connection.provider"), exports);
|
|
23
24
|
__exportStar(require("./shared-db-repositories.provider"), exports);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { Reflector } from '@nestjs/core';
|
|
1
2
|
declare const JwtAuthGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
|
|
2
3
|
export declare class JwtAuthGuard extends JwtAuthGuard_base {
|
|
3
|
-
|
|
4
|
+
private readonly reflector;
|
|
5
|
+
constructor(reflector: Reflector);
|
|
6
|
+
handleRequest(err: any, user: any, info: any, context: any): any;
|
|
4
7
|
}
|
|
5
8
|
export {};
|
|
@@ -5,12 +5,25 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
8
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
12
|
exports.JwtAuthGuard = void 0;
|
|
10
13
|
const common_1 = require("@nestjs/common");
|
|
14
|
+
const core_1 = require("@nestjs/core");
|
|
11
15
|
const passport_1 = require("@nestjs/passport");
|
|
16
|
+
const skip_jwt_auth_decorator_1 = require("./skip-jwt-auth.decorator");
|
|
12
17
|
let JwtAuthGuard = class JwtAuthGuard extends (0, passport_1.AuthGuard)('jwt') {
|
|
13
|
-
|
|
18
|
+
constructor(reflector) {
|
|
19
|
+
super();
|
|
20
|
+
this.reflector = reflector;
|
|
21
|
+
}
|
|
22
|
+
handleRequest(err, user, info, context) {
|
|
23
|
+
const shouldSkip = this.reflector.getAllAndOverride(skip_jwt_auth_decorator_1.SKIP_JWT_AUTH_KEY, [context.getHandler(), context.getClass()]);
|
|
24
|
+
if (shouldSkip) {
|
|
25
|
+
return user || true;
|
|
26
|
+
}
|
|
14
27
|
const enableJWT = JSON.parse(process.env.JWT_ENABLE);
|
|
15
28
|
if (enableJWT) {
|
|
16
29
|
if (err || !user) {
|
|
@@ -22,5 +35,6 @@ let JwtAuthGuard = class JwtAuthGuard extends (0, passport_1.AuthGuard)('jwt') {
|
|
|
22
35
|
};
|
|
23
36
|
exports.JwtAuthGuard = JwtAuthGuard;
|
|
24
37
|
exports.JwtAuthGuard = JwtAuthGuard = __decorate([
|
|
25
|
-
(0, common_1.Injectable)()
|
|
38
|
+
(0, common_1.Injectable)(),
|
|
39
|
+
__metadata("design:paramtypes", [core_1.Reflector])
|
|
26
40
|
], JwtAuthGuard);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SkipJwtAuth = exports.SKIP_JWT_AUTH_KEY = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
exports.SKIP_JWT_AUTH_KEY = 'skipJwtAuth';
|
|
6
|
+
const SkipJwtAuth = () => (0, common_1.SetMetadata)(exports.SKIP_JWT_AUTH_KEY, true);
|
|
7
|
+
exports.SkipJwtAuth = SkipJwtAuth;
|