plac-micro-common 1.3.56 → 1.3.57
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/http/decorators/index.d.ts +1 -0
- package/dist/http/decorators/index.js +1 -0
- package/dist/http/decorators/public.decorator.d.ts +2 -0
- package/dist/http/decorators/public.decorator.js +7 -0
- package/dist/http/guards/jwt_auth.guard.d.ts +3 -1
- package/dist/http/guards/jwt_auth.guard.js +12 -2
- package/dist/utils/frontend/data.util.d.ts +1 -1
- package/dist/utils/frontend/data.util.js +2 -2
- package/package.json +1 -1
|
@@ -18,4 +18,5 @@ __exportStar(require("./client_ctx.decorator"), exports);
|
|
|
18
18
|
__exportStar(require("./current_app.decorator"), exports);
|
|
19
19
|
__exportStar(require("./current_app_client.decorator"), exports);
|
|
20
20
|
__exportStar(require("./current_access_token.decorator"), exports);
|
|
21
|
+
__exportStar(require("./public.decorator"), exports);
|
|
21
22
|
__exportStar(require("./require_permission.decorator"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Public = exports.IS_PUBLIC_KEY = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
exports.IS_PUBLIC_KEY = "isPublic";
|
|
6
|
+
const Public = () => (0, common_1.SetMetadata)(exports.IS_PUBLIC_KEY, true);
|
|
7
|
+
exports.Public = Public;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { CanActivate, ExecutionContext } from "@nestjs/common";
|
|
2
|
+
import { Reflector } from "@nestjs/core";
|
|
2
3
|
import { JwtVerifierService } from "../services/jwt_verifier.service";
|
|
3
4
|
export declare class JwtAuthGuard implements CanActivate {
|
|
4
5
|
private readonly jwtVerifier;
|
|
5
|
-
|
|
6
|
+
private readonly reflector;
|
|
7
|
+
constructor(jwtVerifier: JwtVerifierService, reflector: Reflector);
|
|
6
8
|
canActivate(context: ExecutionContext): boolean;
|
|
7
9
|
}
|
|
@@ -11,12 +11,21 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.JwtAuthGuard = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
|
+
const core_1 = require("@nestjs/core");
|
|
14
15
|
const jwt_verifier_service_1 = require("../services/jwt_verifier.service");
|
|
16
|
+
const public_decorator_1 = require("../decorators/public.decorator");
|
|
15
17
|
let JwtAuthGuard = class JwtAuthGuard {
|
|
16
|
-
constructor(jwtVerifier) {
|
|
18
|
+
constructor(jwtVerifier, reflector) {
|
|
17
19
|
this.jwtVerifier = jwtVerifier;
|
|
20
|
+
this.reflector = reflector;
|
|
18
21
|
}
|
|
19
22
|
canActivate(context) {
|
|
23
|
+
const isPublic = this.reflector.getAllAndOverride(public_decorator_1.IS_PUBLIC_KEY, [
|
|
24
|
+
context.getHandler(),
|
|
25
|
+
context.getClass(),
|
|
26
|
+
]);
|
|
27
|
+
if (isPublic)
|
|
28
|
+
return true;
|
|
20
29
|
const req = context.switchToHttp().getRequest();
|
|
21
30
|
const authHeader = req.headers["authorization"];
|
|
22
31
|
if (typeof authHeader !== "string") {
|
|
@@ -46,5 +55,6 @@ let JwtAuthGuard = class JwtAuthGuard {
|
|
|
46
55
|
exports.JwtAuthGuard = JwtAuthGuard;
|
|
47
56
|
exports.JwtAuthGuard = JwtAuthGuard = __decorate([
|
|
48
57
|
(0, common_1.Injectable)(),
|
|
49
|
-
__metadata("design:paramtypes", [jwt_verifier_service_1.JwtVerifierService
|
|
58
|
+
__metadata("design:paramtypes", [jwt_verifier_service_1.JwtVerifierService,
|
|
59
|
+
core_1.Reflector])
|
|
50
60
|
], JwtAuthGuard);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AddressType, AppDocumentType, ApplicationActionType, AppPhLaRelation, ContactType, Gender, IdentifierType } from "../../types";
|
|
2
2
|
export declare function getGenderDesc(val: Gender): "Male" | "Female";
|
|
3
|
-
export declare function getAppPhLaRelationDesc(val: AppPhLaRelation): "
|
|
3
|
+
export declare function getAppPhLaRelationDesc(val: AppPhLaRelation): "PH = LA" | "PH != LA";
|
|
4
4
|
export declare function getIdentifierTypeDesc(val: IdentifierType): "Other" | "National ID" | "Passport" | "Birth Certificate" | "Tax ID" | "Company Registration";
|
|
5
5
|
export declare function getContactTypeDesc(val: ContactType): "Other" | "Phone Number" | "Email" | "Website" | "Social Media";
|
|
6
6
|
export declare function getAddressTypeDesc(val: AddressType): "Other" | "Home" | "Work" | "Billing";
|
|
@@ -21,9 +21,9 @@ function getGenderDesc(val) {
|
|
|
21
21
|
function getAppPhLaRelationDesc(val) {
|
|
22
22
|
switch (val) {
|
|
23
23
|
case types_1.AppPhLaRelation.SamePerson:
|
|
24
|
-
return "
|
|
24
|
+
return "PH = LA";
|
|
25
25
|
case types_1.AppPhLaRelation.DifferentPerson:
|
|
26
|
-
return "
|
|
26
|
+
return "PH != LA";
|
|
27
27
|
default:
|
|
28
28
|
return val;
|
|
29
29
|
}
|