@pristine-ts/jwt 0.0.275 → 0.0.277
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.jwtPayload = void 0;
|
|
4
|
+
const common_1 = require("@pristine-ts/common");
|
|
4
5
|
/**
|
|
5
6
|
* This decorator can be used to inject the decoded JWT payload of a request in a parameter of a method in a controller.
|
|
6
7
|
*/
|
|
@@ -18,26 +19,11 @@ const jwtPayload = () => {
|
|
|
18
19
|
* The index of the parameter for which the decorator is used.
|
|
19
20
|
*/
|
|
20
21
|
parameterIndex) => {
|
|
21
|
-
// Verify that the object target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] exists or we create it.
|
|
22
|
-
// This object is a convention defined by Pristine on where to save controller method parameter decorator information and is used in the router to retrieve that information.
|
|
23
|
-
if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
|
|
24
|
-
target.constructor.prototype["__metadata__"] = {};
|
|
25
|
-
}
|
|
26
|
-
if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
|
|
27
|
-
target.constructor.prototype["__metadata__"]["methods"] = {};
|
|
28
|
-
}
|
|
29
|
-
if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
|
|
30
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
|
|
31
|
-
}
|
|
32
|
-
if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("arguments") === false) {
|
|
33
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] = [];
|
|
34
|
-
}
|
|
35
22
|
// Set the type of method parameter. Each decorator has it's own type.
|
|
36
23
|
const methodParameter = {
|
|
37
24
|
type: "jwtPayload"
|
|
38
25
|
};
|
|
39
|
-
|
|
40
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"][parameterIndex] = methodParameter;
|
|
26
|
+
common_1.MetadataUtil.setMethodParameterArgumentMetadata(target, propertyKey, parameterIndex, methodParameter);
|
|
41
27
|
};
|
|
42
28
|
};
|
|
43
29
|
exports.jwtPayload = jwtPayload;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt-payload.decorators.js","sourceRoot":"","sources":["../../../../src/decorators/jwt-payload.decorators.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"jwt-payload.decorators.js","sourceRoot":"","sources":["../../../../src/decorators/jwt-payload.decorators.ts"],"names":[],"mappings":";;;AACA,gDAAiD;AAEjD;;GAEG;AACI,MAAM,UAAU,GAAG,GAAG,EAAE;IAC3B,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,EAAE;QACA,sEAAsE;QACtE,MAAM,eAAe,GAAiC;YAClD,IAAI,EAAE,YAAY;SACrB,CAAC;QAEF,qBAAY,CAAC,kCAAkC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;IAC1G,CAAC,CAAA;AACL,CAAC,CAAC;AAxBW,QAAA,UAAU,cAwBrB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MetadataUtil } from "@pristine-ts/common";
|
|
1
2
|
/**
|
|
2
3
|
* This decorator can be used to inject the decoded JWT payload of a request in a parameter of a method in a controller.
|
|
3
4
|
*/
|
|
@@ -15,26 +16,11 @@ export const jwtPayload = () => {
|
|
|
15
16
|
* The index of the parameter for which the decorator is used.
|
|
16
17
|
*/
|
|
17
18
|
parameterIndex) => {
|
|
18
|
-
// Verify that the object target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] exists or we create it.
|
|
19
|
-
// This object is a convention defined by Pristine on where to save controller method parameter decorator information and is used in the router to retrieve that information.
|
|
20
|
-
if (target.constructor.prototype.hasOwnProperty("__metadata__") === false) {
|
|
21
|
-
target.constructor.prototype["__metadata__"] = {};
|
|
22
|
-
}
|
|
23
|
-
if (target.constructor.prototype["__metadata__"].hasOwnProperty("methods") === false) {
|
|
24
|
-
target.constructor.prototype["__metadata__"]["methods"] = {};
|
|
25
|
-
}
|
|
26
|
-
if (target.constructor.prototype["__metadata__"]["methods"].hasOwnProperty(propertyKey) === false) {
|
|
27
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey] = {};
|
|
28
|
-
}
|
|
29
|
-
if (target.constructor.prototype["__metadata__"]["methods"][propertyKey].hasOwnProperty("arguments") === false) {
|
|
30
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"] = [];
|
|
31
|
-
}
|
|
32
19
|
// Set the type of method parameter. Each decorator has it's own type.
|
|
33
20
|
const methodParameter = {
|
|
34
21
|
type: "jwtPayload"
|
|
35
22
|
};
|
|
36
|
-
|
|
37
|
-
target.constructor.prototype["__metadata__"]["methods"][propertyKey]["arguments"][parameterIndex] = methodParameter;
|
|
23
|
+
MetadataUtil.setMethodParameterArgumentMetadata(target, propertyKey, parameterIndex, methodParameter);
|
|
38
24
|
};
|
|
39
25
|
};
|
|
40
26
|
//# sourceMappingURL=jwt-payload.decorators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt-payload.decorators.js","sourceRoot":"","sources":["../../../../src/decorators/jwt-payload.decorators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jwt-payload.decorators.js","sourceRoot":"","sources":["../../../../src/decorators/jwt-payload.decorators.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC3B,OAAO;IACH;;OAEG;IACH,MAAW;IAEX;;OAEG;IACH,WAA4B;IAE5B;;OAEG;IACH,cAAsB,EACxB,EAAE;QACA,sEAAsE;QACtE,MAAM,eAAe,GAAiC;YAClD,IAAI,EAAE,YAAY;SACrB,CAAC;QAEF,YAAY,CAAC,kCAAkC,CAAC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;IAC1G,CAAC,CAAA;AACL,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pristine-ts/jwt",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.277",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/lib/esm/jwt.module.js",
|
|
6
6
|
"main": "dist/lib/cjs/jwt.module.js",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@pristine-ts/common": "^0.0.
|
|
24
|
-
"@pristine-ts/networking": "^0.0.
|
|
25
|
-
"@pristine-ts/security": "^0.0.
|
|
23
|
+
"@pristine-ts/common": "^0.0.277",
|
|
24
|
+
"@pristine-ts/networking": "^0.0.277",
|
|
25
|
+
"@pristine-ts/security": "^0.0.277",
|
|
26
26
|
"jsonwebtoken": "^9.0.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"src/*.{js,ts}"
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "8282d5272a93ffb4fb7e35c6ce7a36dbab5da5b2"
|
|
66
66
|
}
|