chyz 2.0.1-rc.5 → 2.0.1-rc.6
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/BaseChyz.js +41 -31
- package/README.md +518 -518
- package/base/CEvents.js +1 -1
- package/base/Model.js +6 -6
- package/base/RestClient.js +2 -2
- package/decorator/Middleware.js +1 -2
- package/decorator/controller.d.ts.map +1 -1
- package/decorator/delete.d.ts.map +1 -1
- package/decorator/enums/ControllerDecoratorParams.js +1 -1
- package/decorator/get.d.ts.map +1 -1
- package/decorator/post.d.ts.map +1 -1
- package/decorator/put.d.ts.map +1 -1
- package/filters/AccessControl.js +1 -1
- package/filters/auth/AuthMethod.js +1 -1
- package/filters/auth/HttpBasicAuth.js +3 -2
- package/filters/auth/JwtHttpBearerAuth.js +3 -2
- package/log/config/log4js.json +55 -55
- package/package.json +63 -62
- package/rbac/AuthManager.js +3 -3
- package/validators/Validator.js +1 -1
- package/web/WebUser.js +4 -4
package/base/CEvents.js
CHANGED
|
@@ -21,4 +21,4 @@ var CEvents;
|
|
|
21
21
|
CEvents["ON_AFTER_ACTION"] = "onafteraction";
|
|
22
22
|
CEvents["ON_DB_CONNECTION"] = "ondbconnection";
|
|
23
23
|
CEvents["ON_DB_DISCONNECT"] = "ondbdisconnect";
|
|
24
|
-
})(CEvents
|
|
24
|
+
})(CEvents || (exports.CEvents = CEvents = {}));
|
package/base/Model.js
CHANGED
|
@@ -217,8 +217,8 @@ class Model extends Component_1.Component {
|
|
|
217
217
|
model() {
|
|
218
218
|
return this._model;
|
|
219
219
|
}
|
|
220
|
-
save(
|
|
221
|
-
return __awaiter(this,
|
|
220
|
+
save() {
|
|
221
|
+
return __awaiter(this, arguments, void 0, function* (params = {}, options = {}) {
|
|
222
222
|
this.errors = {};
|
|
223
223
|
// now instantiate an object
|
|
224
224
|
let p = Object.assign(params, this._attributes);
|
|
@@ -251,8 +251,8 @@ class Model extends Component_1.Component {
|
|
|
251
251
|
return result;
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
|
-
bulkCreate(
|
|
255
|
-
return __awaiter(this,
|
|
254
|
+
bulkCreate() {
|
|
255
|
+
return __awaiter(this, arguments, void 0, function* (params = {}, options = {}) {
|
|
256
256
|
this.errors = {};
|
|
257
257
|
// now instantiate an object
|
|
258
258
|
let p = Object.assign(params, this._attributes);
|
|
@@ -459,8 +459,8 @@ class Model extends Component_1.Component {
|
|
|
459
459
|
* @param query
|
|
460
460
|
* @param options
|
|
461
461
|
*/
|
|
462
|
-
rawQuery(
|
|
463
|
-
return __awaiter(this,
|
|
462
|
+
rawQuery(query_1) {
|
|
463
|
+
return __awaiter(this, arguments, void 0, function* (query, options = { type: sequelize_1.QueryTypes.SELECT, nest: true }) {
|
|
464
464
|
this.errors = {};
|
|
465
465
|
return yield this.model().query(query, options);
|
|
466
466
|
});
|
package/base/RestClient.js
CHANGED
|
@@ -13,10 +13,10 @@ const Component_1 = require("./Component");
|
|
|
13
13
|
const axios = require('axios');
|
|
14
14
|
class RestClient extends Component_1.Component {
|
|
15
15
|
post(url, args, headers) {
|
|
16
|
-
return axios.post(url, args, headers);
|
|
16
|
+
return axios.post(url, Object.assign(Object.assign({}, args), { headers: headers }));
|
|
17
17
|
}
|
|
18
18
|
get(url, args, headers) {
|
|
19
|
-
return axios.get(url, args, headers);
|
|
19
|
+
return axios.get(url, Object.assign(Object.assign({}, args), { headers: headers }));
|
|
20
20
|
}
|
|
21
21
|
Rest(params) {
|
|
22
22
|
return axios(params);
|
package/decorator/Middleware.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Middleware =
|
|
3
|
+
exports.Middleware = Middleware;
|
|
4
4
|
require("reflect-metadata");
|
|
5
5
|
const ControllerDecoratorParams_1 = require("./enums/ControllerDecoratorParams");
|
|
6
6
|
function Middleware(middlewares) {
|
|
@@ -8,4 +8,3 @@ function Middleware(middlewares) {
|
|
|
8
8
|
Reflect.defineMetadata(ControllerDecoratorParams_1.ControllerDecoratorParams.Middleware, middlewares, target, propertyKey);
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
exports.Middleware = Middleware;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/decorator/controller.ts"],"names":[],"mappings":"AAQA,OAAQ,kBAAkB,CAAC;AAC3B,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/decorator/controller.ts"],"names":[],"mappings":"AAQA,OAAQ,kBAAkB,CAAC;AAC3B,eAAO,MAAM,UAAU,GAAI,SAAQ,MAAW,KAAG,cAYhD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/decorator/delete.ts"],"names":[],"mappings":"AAOA,OAAQ,kBAAkB,CAAC;AAG3B,eAAO,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/decorator/delete.ts"],"names":[],"mappings":"AAOA,OAAQ,kBAAkB,CAAC;AAG3B,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,KAAG,eAyBlC,CAAC"}
|
|
@@ -6,4 +6,4 @@ var ControllerDecoratorParams;
|
|
|
6
6
|
ControllerDecoratorParams["Path"] = "path";
|
|
7
7
|
ControllerDecoratorParams["Method"] = "method";
|
|
8
8
|
ControllerDecoratorParams["Middleware"] = "middleware";
|
|
9
|
-
})(ControllerDecoratorParams
|
|
9
|
+
})(ControllerDecoratorParams || (exports.ControllerDecoratorParams = ControllerDecoratorParams = {}));
|
package/decorator/get.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../src/decorator/get.ts"],"names":[],"mappings":"AAOA,OAAO,kBAAkB,CAAC;AAG1B,eAAO,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../src/decorator/get.ts"],"names":[],"mappings":"AAOA,OAAO,kBAAkB,CAAC;AAG1B,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,KAAG,eA0BlC,CAAC"}
|
package/decorator/post.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../src/decorator/post.ts"],"names":[],"mappings":"AAOA,OAAQ,kBAAkB,CAAC;AAG3B,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../src/decorator/post.ts"],"names":[],"mappings":"AAOA,OAAQ,kBAAkB,CAAC;AAG3B,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,KAAG,eAyBnC,CAAC"}
|
package/decorator/put.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"put.d.ts","sourceRoot":"","sources":["../../src/decorator/put.ts"],"names":[],"mappings":"AAOA,OAAQ,kBAAkB,CAAC;AAG3B,eAAO,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"put.d.ts","sourceRoot":"","sources":["../../src/decorator/put.ts"],"names":[],"mappings":"AAOA,OAAQ,kBAAkB,CAAC;AAG3B,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,KAAG,eAyBlC,CAAC"}
|
package/filters/AccessControl.js
CHANGED
|
@@ -41,8 +41,8 @@ class AccessControl extends base_2.ActionFilter {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
beforeAction(action, request, res) {
|
|
44
|
-
var _a, _b;
|
|
45
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
var _a, _b;
|
|
46
46
|
let allow;
|
|
47
47
|
// @ts-ignore
|
|
48
48
|
let user = (_a = request.user) !== null && _a !== void 0 ? _a : this.user;
|
|
@@ -31,8 +31,8 @@ class AuthMethod extends base_1.ActionFilter {
|
|
|
31
31
|
* @param response
|
|
32
32
|
*/
|
|
33
33
|
beforeAction(action, request, response) {
|
|
34
|
-
var _a;
|
|
35
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
var _a;
|
|
36
36
|
let identity = yield this.authenticate((_a = this.user) !== null && _a !== void 0 ? _a : new WebUser_1.WebUser(), request, response);
|
|
37
37
|
// @ts-ignore
|
|
38
38
|
request.identity = identity;
|
|
@@ -47,7 +47,8 @@ class HttpBasicAuth extends AuthMethod_1.AuthMethod {
|
|
|
47
47
|
this.user = (_a = BaseChyz_1.default.getComponent("user")) !== null && _a !== void 0 ? _a : null;
|
|
48
48
|
}
|
|
49
49
|
authenticate(user, request, response) {
|
|
50
|
-
|
|
50
|
+
var arguments_1 = arguments;
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
52
|
let autHeader = this.getHeaderByKey(request.headers, this.header);
|
|
52
53
|
if (autHeader == null || (autHeader = this.patternCheck(autHeader, this.pattern)) == null) {
|
|
53
54
|
return this.fail(response);
|
|
@@ -57,7 +58,7 @@ class HttpBasicAuth extends AuthMethod_1.AuthMethod {
|
|
|
57
58
|
let buff = new Buffer(autHeader[1], "base64");
|
|
58
59
|
let basicauth = buff.toString().split(":");
|
|
59
60
|
if (this.auth != null) {
|
|
60
|
-
identity = yield this.auth(autHeader[1], ...
|
|
61
|
+
identity = yield this.auth(autHeader[1], ...arguments_1, basicauth);
|
|
61
62
|
}
|
|
62
63
|
else {
|
|
63
64
|
identity = yield user.loginByAccessToken(basicauth, "HttpBasicAuth");
|
|
@@ -45,7 +45,8 @@ class JwtHttpBearerAuth extends HttpBearerAuth_1.HttpBearerAuth {
|
|
|
45
45
|
this.user = (_a = BaseChyz_1.default.getComponent("user")) !== null && _a !== void 0 ? _a : null;
|
|
46
46
|
}
|
|
47
47
|
authenticate(user, request, response) {
|
|
48
|
-
|
|
48
|
+
var arguments_1 = arguments;
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
50
|
let autHeader = this.getHeaderByKey(request.headers, this.header);
|
|
50
51
|
if (autHeader == null || (autHeader = this.patternCheck(autHeader, this.pattern)) == null) {
|
|
51
52
|
return null;
|
|
@@ -65,7 +66,7 @@ class JwtHttpBearerAuth extends HttpBearerAuth_1.HttpBearerAuth {
|
|
|
65
66
|
}
|
|
66
67
|
if (token !== null) {
|
|
67
68
|
if (this.auth != null) {
|
|
68
|
-
identity = yield this.auth(autHeader[1], ...
|
|
69
|
+
identity = yield this.auth(autHeader[1], ...arguments_1);
|
|
69
70
|
}
|
|
70
71
|
else {
|
|
71
72
|
identity = yield user.loginByAccessToken(autHeader[1], "JwtHttpBearerAuth");
|
package/log/config/log4js.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"appenders": {
|
|
3
|
-
"access": {
|
|
4
|
-
"type": "dateFile",
|
|
5
|
-
"filename": "log/access.log",
|
|
6
|
-
"pattern": "-yyyy-MM-dd",
|
|
7
|
-
"category": "http",
|
|
8
|
-
"layout": {
|
|
9
|
-
"type": "pattern",
|
|
10
|
-
"pattern": "[%d{yyyy-MM-ddThh.mm.ss.SSS}] [%p] %c [%l] [%f] - %m"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"app": {
|
|
14
|
-
"type": "file",
|
|
15
|
-
"filename": "log/app.log",
|
|
16
|
-
"maxLogSize": 10485760,
|
|
17
|
-
"numBackups": 3,
|
|
18
|
-
"layout": {
|
|
19
|
-
"type": "pattern",
|
|
20
|
-
"pattern": "[%d{yyyy-MM-ddThh.mm.ss.SSS}] [%p] %c [%l] [%f] - %m"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"errorFile": {
|
|
24
|
-
"type": "file",
|
|
25
|
-
"filename": "log/errors.log",
|
|
26
|
-
"layout": {
|
|
27
|
-
"type": "pattern",
|
|
28
|
-
"pattern": "[%d{yyyy-MM-ddThh.mm.ss.SSS}] [%p] %c [%l] [%f] - %m"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"errors": {
|
|
32
|
-
"type": "logLevelFilter",
|
|
33
|
-
"level": "ERROR",
|
|
34
|
-
"appender": "errorFile",
|
|
35
|
-
"layout": {
|
|
36
|
-
"type": "pattern",
|
|
37
|
-
"pattern": "[%d{yyyy-MM-ddThh.mm.ss.SSS}] [%p] %c [%l] [%f] - %m"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"console": {
|
|
41
|
-
"type": "stdout"
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"categories": {
|
|
45
|
-
"default": {
|
|
46
|
-
"appenders": ["console","app" ,"errors" ],
|
|
47
|
-
"level": "INFO",
|
|
48
|
-
"enableCallStack": true
|
|
49
|
-
},
|
|
50
|
-
"http": {
|
|
51
|
-
"level": "INFO",
|
|
52
|
-
"appenders": [ "access" ]
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"appenders": {
|
|
3
|
+
"access": {
|
|
4
|
+
"type": "dateFile",
|
|
5
|
+
"filename": "log/access.log",
|
|
6
|
+
"pattern": "-yyyy-MM-dd",
|
|
7
|
+
"category": "http",
|
|
8
|
+
"layout": {
|
|
9
|
+
"type": "pattern",
|
|
10
|
+
"pattern": "[%d{yyyy-MM-ddThh.mm.ss.SSS}] [%p] %c [%l] [%f] - %m"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"app": {
|
|
14
|
+
"type": "file",
|
|
15
|
+
"filename": "log/app.log",
|
|
16
|
+
"maxLogSize": 10485760,
|
|
17
|
+
"numBackups": 3,
|
|
18
|
+
"layout": {
|
|
19
|
+
"type": "pattern",
|
|
20
|
+
"pattern": "[%d{yyyy-MM-ddThh.mm.ss.SSS}] [%p] %c [%l] [%f] - %m"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"errorFile": {
|
|
24
|
+
"type": "file",
|
|
25
|
+
"filename": "log/errors.log",
|
|
26
|
+
"layout": {
|
|
27
|
+
"type": "pattern",
|
|
28
|
+
"pattern": "[%d{yyyy-MM-ddThh.mm.ss.SSS}] [%p] %c [%l] [%f] - %m"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"errors": {
|
|
32
|
+
"type": "logLevelFilter",
|
|
33
|
+
"level": "ERROR",
|
|
34
|
+
"appender": "errorFile",
|
|
35
|
+
"layout": {
|
|
36
|
+
"type": "pattern",
|
|
37
|
+
"pattern": "[%d{yyyy-MM-ddThh.mm.ss.SSS}] [%p] %c [%l] [%f] - %m"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"console": {
|
|
41
|
+
"type": "stdout"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"categories": {
|
|
45
|
+
"default": {
|
|
46
|
+
"appenders": ["console","app" ,"errors" ],
|
|
47
|
+
"level": "INFO",
|
|
48
|
+
"enableCallStack": true
|
|
49
|
+
},
|
|
50
|
+
"http": {
|
|
51
|
+
"level": "INFO",
|
|
52
|
+
"appenders": [ "access" ]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
package/package.json
CHANGED
|
@@ -1,62 +1,63 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "chyz",
|
|
3
|
-
"version": "2.0.1-rc.
|
|
4
|
-
"description": "Nodejs Micro service Framework",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
|
-
"postversion": "git push && git push --tags"
|
|
8
|
-
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/cihan53/Chy-Nodejs-Framework.git"
|
|
12
|
-
},
|
|
13
|
-
"author": "Cihan Ozturk",
|
|
14
|
-
"license": "MIT",
|
|
15
|
-
"bugs": {
|
|
16
|
-
"url": "https://github.com/cihan53/Chy-Nodejs-Framework/issues"
|
|
17
|
-
},
|
|
18
|
-
"homepage": "https://github.com/cihan53/Chy-Nodejs-Framework#readme",
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@types/compression": "^1.7.5",
|
|
21
|
-
"axios": "^1.3.5",
|
|
22
|
-
"babel-plugin-transform-decorators-legacy": "^1.3.5",
|
|
23
|
-
"body-parser": "^1.20.2",
|
|
24
|
-
"compression": "^1.7.4",
|
|
25
|
-
"core-js": "^3.30.1",
|
|
26
|
-
"cors": "^2.8.5",
|
|
27
|
-
"dayjs": "^1.11.7",
|
|
28
|
-
"dotenv-flow": "^3.2.0",
|
|
29
|
-
"express": "^4.18.2",
|
|
30
|
-
"express-session": "^1.17.3",
|
|
31
|
-
"glob": "^10.0.0",
|
|
32
|
-
"ip": "^1.1.8",
|
|
33
|
-
"jsonwebtoken": "^9.0.0",
|
|
34
|
-
"lodash": "^4.17.21",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"pg
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"sequelize
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"@types/
|
|
49
|
-
"@types/
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "chyz",
|
|
3
|
+
"version": "2.0.1-rc.6",
|
|
4
|
+
"description": "Nodejs Micro service Framework",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
|
+
"postversion": "git push && git push --tags"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/cihan53/Chy-Nodejs-Framework.git"
|
|
12
|
+
},
|
|
13
|
+
"author": "Cihan Ozturk",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/cihan53/Chy-Nodejs-Framework/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/cihan53/Chy-Nodejs-Framework#readme",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@types/compression": "^1.7.5",
|
|
21
|
+
"axios": "^1.3.5",
|
|
22
|
+
"babel-plugin-transform-decorators-legacy": "^1.3.5",
|
|
23
|
+
"body-parser": "^1.20.2",
|
|
24
|
+
"compression": "^1.7.4",
|
|
25
|
+
"core-js": "^3.30.1",
|
|
26
|
+
"cors": "^2.8.5",
|
|
27
|
+
"dayjs": "^1.11.7",
|
|
28
|
+
"dotenv-flow": "^3.2.0",
|
|
29
|
+
"express": "^4.18.2",
|
|
30
|
+
"express-session": "^1.17.3",
|
|
31
|
+
"glob": "^10.0.0",
|
|
32
|
+
"ip": "^1.1.8",
|
|
33
|
+
"jsonwebtoken": "^9.0.0",
|
|
34
|
+
"lodash": "^4.17.21",
|
|
35
|
+
"lodash-uuid": "^0.0.3",
|
|
36
|
+
"log4js": "^6.9.1",
|
|
37
|
+
"method-override": "^3.0.0",
|
|
38
|
+
"passport": "^0.6.0",
|
|
39
|
+
"pg": "^8.10.0",
|
|
40
|
+
"pg-hstore": "^2.3.4",
|
|
41
|
+
"reflect-metadata": "^0.1.13",
|
|
42
|
+
"sequelize": "^6.31.0",
|
|
43
|
+
"sequelize-transparent-cache": "^2.3.0",
|
|
44
|
+
"tslib": "^2.5.0",
|
|
45
|
+
"validate.js": "^0.13.1"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/express": "^4.17.17",
|
|
49
|
+
"@types/node": "^18.15.11",
|
|
50
|
+
"@types/validator": "^13.7.15",
|
|
51
|
+
"nodemon": "^2.0.22",
|
|
52
|
+
"ts-node": "^10.9.1",
|
|
53
|
+
"typescript": "^5.0.4"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [
|
|
56
|
+
"Framework",
|
|
57
|
+
"RespAPI",
|
|
58
|
+
"microservice",
|
|
59
|
+
"micro service",
|
|
60
|
+
"easy configuration",
|
|
61
|
+
"Rbac support"
|
|
62
|
+
]
|
|
63
|
+
}
|
package/rbac/AuthManager.js
CHANGED
|
@@ -25,8 +25,8 @@ class AuthManager extends base_1.Component {
|
|
|
25
25
|
/**
|
|
26
26
|
*
|
|
27
27
|
*/
|
|
28
|
-
checkAccess(
|
|
29
|
-
return __awaiter(this,
|
|
28
|
+
checkAccess(userId_1, permissionName_1) {
|
|
29
|
+
return __awaiter(this, arguments, void 0, function* (userId, permissionName, params = []) {
|
|
30
30
|
let assignments;
|
|
31
31
|
if (!userId)
|
|
32
32
|
return false;
|
|
@@ -351,6 +351,6 @@ class AuthManager extends base_1.Component {
|
|
|
351
351
|
return Utils_1.Utils.isEmpty(assignments) && Utils_1.Utils.isEmpty(this.defaultRoles);
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
+
exports.AuthManager = AuthManager;
|
|
354
355
|
AuthManager.TYPE_ROLE = 1;
|
|
355
356
|
AuthManager.TYPE_PERMISSION = 2;
|
|
356
|
-
exports.AuthManager = AuthManager;
|
package/validators/Validator.js
CHANGED
|
@@ -20,8 +20,8 @@ class Validator extends base_1.Component {
|
|
|
20
20
|
static createValidator(type, model, attributes, params = []) {
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
exports.Validator = Validator;
|
|
23
24
|
Validator.builtInValidators = {
|
|
24
25
|
'boolean': '',
|
|
25
26
|
'email': '',
|
|
26
27
|
};
|
|
27
|
-
exports.Validator = Validator;
|
package/web/WebUser.js
CHANGED
|
@@ -69,8 +69,8 @@ class WebUser extends Component_1.Component {
|
|
|
69
69
|
* @param token
|
|
70
70
|
* @param type
|
|
71
71
|
*/
|
|
72
|
-
loginByAccessToken(
|
|
73
|
-
return __awaiter(this,
|
|
72
|
+
loginByAccessToken(token_1) {
|
|
73
|
+
return __awaiter(this, arguments, void 0, function* (token, type = null) {
|
|
74
74
|
let $class = this.identityClass;
|
|
75
75
|
if ($class.findIdentityByAccessToken) {
|
|
76
76
|
this.identity = yield $class.findIdentityByAccessToken(token, type);
|
|
@@ -130,8 +130,8 @@ class WebUser extends Component_1.Component {
|
|
|
130
130
|
//
|
|
131
131
|
// return $access;
|
|
132
132
|
// }
|
|
133
|
-
can(
|
|
134
|
-
return __awaiter(this,
|
|
133
|
+
can(permissionName_1) {
|
|
134
|
+
return __awaiter(this, arguments, void 0, function* (permissionName, params = [], allowCaching = true) {
|
|
135
135
|
let access;
|
|
136
136
|
let accessChecker;
|
|
137
137
|
if ((accessChecker = this.getAccessChecker()) == null)
|