chyz 2.0.0-rc.8 → 2.0.1-rc.1
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.d.ts +73 -56
- package/BaseChyz.d.ts.map +1 -1
- package/BaseChyz.js +569 -404
- package/README.md +1 -1
- package/base/ActionFilter.d.ts +32 -32
- package/base/ActionFilter.d.ts.map +1 -1
- package/base/ActionFilter.js +82 -82
- package/base/BadRequestHttpException.d.ts +6 -0
- package/base/BadRequestHttpException.d.ts.map +1 -0
- package/base/BadRequestHttpException.js +17 -0
- package/base/BaseError.d.ts +43 -10
- package/base/BaseError.d.ts.map +1 -1
- package/base/BaseError.js +58 -26
- package/base/Behavior.d.ts +3 -3
- package/base/Behavior.js +7 -7
- package/base/CBaseObject.d.ts +4 -4
- package/base/CBaseObject.d.ts.map +1 -1
- package/base/CBaseObject.js +16 -16
- package/base/CEvents.d.ts +13 -0
- package/base/CEvents.d.ts.map +1 -0
- package/base/CEvents.js +24 -0
- package/base/CRequest.d.ts +1 -1
- package/base/CRequest.js +10 -10
- package/base/CWebController.d.ts +43 -43
- package/base/CWebController.d.ts.map +1 -1
- package/base/CWebController.js +81 -74
- package/base/Component.d.ts +20 -20
- package/base/Component.d.ts.map +1 -1
- package/base/Component.js +57 -57
- package/base/Configurable.d.ts +2 -2
- package/base/Configurable.js +8 -8
- package/base/DataErrorDbException.d.ts +5 -5
- package/base/DataErrorDbException.d.ts.map +1 -1
- package/base/DataErrorDbException.js +17 -17
- package/base/DbConnection.d.ts +12 -12
- package/base/DbConnection.js +53 -53
- package/base/ForbiddenHttpException.d.ts +4 -4
- package/base/ForbiddenHttpException.d.ts.map +1 -1
- package/base/ForbiddenHttpException.js +16 -16
- package/base/InvalidArgumentException.d.ts +5 -5
- package/base/InvalidArgumentException.d.ts.map +1 -1
- package/base/InvalidArgumentException.js +17 -17
- package/base/InvalidConfigException.d.ts +5 -5
- package/base/InvalidConfigException.d.ts.map +1 -1
- package/base/InvalidConfigException.js +17 -17
- package/base/Logs.d.ts +21 -21
- package/base/Logs.d.ts.map +1 -1
- package/base/Logs.js +57 -57
- package/base/Model.d.ts +301 -298
- package/base/Model.d.ts.map +1 -1
- package/base/Model.js +545 -507
- package/base/ModelManager.d.ts +1 -1
- package/base/ModelManager.js +19 -19
- package/base/NotFoundHttpException.d.ts +5 -5
- package/base/NotFoundHttpException.d.ts.map +1 -1
- package/base/NotFoundHttpException.js +17 -17
- package/base/RestClient.d.ts +6 -6
- package/base/RestClient.d.ts.map +1 -1
- package/base/RestClient.js +25 -25
- package/base/UnauthorizedHttpException.d.ts +5 -5
- package/base/UnauthorizedHttpException.d.ts.map +1 -1
- package/base/UnauthorizedHttpException.js +17 -17
- package/base/ValidationHttpException.d.ts +5 -5
- package/base/ValidationHttpException.d.ts.map +1 -1
- package/base/ValidationHttpException.js +17 -17
- package/base/db/Exception.d.ts +6 -6
- package/base/db/Exception.js +15 -15
- package/base/index.d.ts +19 -18
- package/base/index.d.ts.map +1 -1
- package/base/index.js +41 -39
- package/decorator/Middleware.d.ts +3 -3
- package/decorator/Middleware.js +11 -11
- package/decorator/controller.d.ts +2 -2
- package/decorator/controller.js +24 -24
- package/decorator/delete.d.ts +3 -0
- package/decorator/delete.d.ts.map +1 -0
- package/decorator/delete.js +36 -0
- package/decorator/enums/ControllerDecoratorParams.d.ts +5 -5
- package/decorator/enums/ControllerDecoratorParams.js +9 -9
- package/decorator/get.d.ts +2 -2
- package/decorator/get.js +36 -36
- package/decorator/index.d.ts +5 -3
- package/decorator/index.d.ts.map +1 -1
- package/decorator/index.js +13 -9
- package/decorator/post.d.ts +2 -2
- package/decorator/post.js +36 -36
- package/decorator/put.d.ts +3 -0
- package/decorator/put.d.ts.map +1 -0
- package/decorator/put.js +36 -0
- package/filters/AccessControl.d.ts +12 -12
- package/filters/AccessControl.d.ts.map +1 -1
- package/filters/AccessControl.js +83 -83
- package/filters/AccessRule.d.ts +82 -82
- package/filters/AccessRule.d.ts.map +1 -1
- package/filters/AccessRule.js +136 -137
- package/filters/auth/AuthInterface.d.ts +25 -25
- package/filters/auth/AuthInterface.js +2 -2
- package/filters/auth/AuthMethod.d.ts +37 -37
- package/filters/auth/AuthMethod.d.ts.map +1 -1
- package/filters/auth/AuthMethod.js +82 -82
- package/filters/auth/HttpBasicAuth.d.ts +23 -22
- package/filters/auth/HttpBasicAuth.d.ts.map +1 -1
- package/filters/auth/HttpBasicAuth.js +78 -72
- package/filters/auth/HttpBearerAuth.d.ts +17 -17
- package/filters/auth/HttpBearerAuth.d.ts.map +1 -1
- package/filters/auth/HttpBearerAuth.js +33 -32
- package/filters/auth/HttpHeaderAuth.d.ts +18 -14
- package/filters/auth/HttpHeaderAuth.d.ts.map +1 -1
- package/filters/auth/HttpHeaderAuth.js +64 -57
- package/filters/auth/JwtHttpBearerAuth.d.ts +20 -20
- package/filters/auth/JwtHttpBearerAuth.d.ts.map +1 -1
- package/filters/auth/JwtHttpBearerAuth.js +87 -81
- package/filters/auth/KeyCloakHttpBearerAuth.d.ts +22 -22
- package/filters/auth/KeyCloakHttpBearerAuth.js +116 -116
- package/filters/auth/index.d.ts +4 -4
- package/filters/auth/index.js +11 -11
- package/filters/index.d.ts +2 -2
- package/filters/index.js +7 -7
- package/index.d.ts +28 -21
- package/index.d.ts.map +1 -1
- package/index.js +71 -60
- package/model/RouteDefinition.d.ts +6 -6
- package/model/RouteDefinition.js +8 -8
- package/package.json +22 -24
- package/rbac/AuthAssignment.d.ts +18 -18
- package/rbac/AuthAssignment.js +44 -44
- package/rbac/AuthItem.d.ts +26 -26
- package/rbac/AuthItem.js +51 -51
- package/rbac/AuthItemChild.d.ts +18 -18
- package/rbac/AuthItemChild.js +43 -43
- package/rbac/AuthManager.d.ts +111 -111
- package/rbac/AuthManager.d.ts.map +1 -1
- package/rbac/AuthManager.js +356 -355
- package/rbac/index.d.ts +5 -0
- package/rbac/index.d.ts.map +1 -0
- package/rbac/index.js +28 -0
- package/requiments/Glob.d.ts +2 -2
- package/requiments/Glob.js +10 -10
- package/requiments/ReflectUtil.js +24 -24
- package/requiments/Utils.d.ts +1 -8
- package/requiments/Utils.d.ts.map +1 -1
- package/requiments/Utils.js +115 -112
- package/validators/BooleanValidator.js +1 -1
- package/validators/CompareValidator.js +1 -1
- package/validators/DateValidator.js +1 -1
- package/validators/EmailValidator.js +1 -1
- package/validators/Validator.d.ts +17 -17
- package/validators/Validator.js +27 -27
- package/web/IdentityInterface.d.ts +55 -54
- package/web/IdentityInterface.d.ts.map +1 -1
- package/web/IdentityInterface.js +8 -8
- package/web/WebUser.d.ts +71 -71
- package/web/WebUser.js +165 -165
package/README.md
CHANGED
package/base/ActionFilter.d.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
/// <reference types="express" />
|
|
2
|
-
import { Request, Response } from "../index";
|
|
3
|
-
import { CBaseObject } from "./CBaseObject";
|
|
4
|
-
export declare class ActionFilter extends CBaseObject {
|
|
5
|
-
only: any;
|
|
6
|
-
/**
|
|
7
|
-
* @var array list of action IDs that this filter should not apply to.
|
|
8
|
-
* @see only
|
|
9
|
-
*/
|
|
10
|
-
except: never[];
|
|
11
|
-
init(): void;
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @param route
|
|
15
|
-
* @param req
|
|
16
|
-
* @param res
|
|
17
|
-
*/
|
|
18
|
-
beforeFilter(route: any, req: Request, res: Response): Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* This method is invoked right before an action is to be executed (after all possible filters.)
|
|
21
|
-
* You may override this method to do last-minute preparation for the action.
|
|
22
|
-
* @param Action $action the action to be executed.
|
|
23
|
-
* @return bool whether the action should continue to be executed.
|
|
24
|
-
*/
|
|
25
|
-
beforeAction(route: any, req: Request, res: Response): Promise<boolean>;
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param action
|
|
29
|
-
* @protected
|
|
30
|
-
*/
|
|
31
|
-
protected isActive(action: any): boolean;
|
|
32
|
-
}
|
|
1
|
+
/// <reference types="express" />
|
|
2
|
+
import { Request, Response } from "../index";
|
|
3
|
+
import { CBaseObject } from "./CBaseObject";
|
|
4
|
+
export declare class ActionFilter extends CBaseObject {
|
|
5
|
+
only: any;
|
|
6
|
+
/**
|
|
7
|
+
* @var array list of action IDs that this filter should not apply to.
|
|
8
|
+
* @see only
|
|
9
|
+
*/
|
|
10
|
+
except: never[];
|
|
11
|
+
init(): void;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param route
|
|
15
|
+
* @param req
|
|
16
|
+
* @param res
|
|
17
|
+
*/
|
|
18
|
+
beforeFilter(route: any, req: Request, res: Response): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* This method is invoked right before an action is to be executed (after all possible filters.)
|
|
21
|
+
* You may override this method to do last-minute preparation for the action.
|
|
22
|
+
* @param Action $action the action to be executed.
|
|
23
|
+
* @return bool whether the action should continue to be executed.
|
|
24
|
+
*/
|
|
25
|
+
beforeAction(route: any, req: Request, res: Response): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param action
|
|
29
|
+
* @protected
|
|
30
|
+
*/
|
|
31
|
+
protected isActive(action: any): boolean;
|
|
32
|
+
}
|
|
33
33
|
//# sourceMappingURL=ActionFilter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionFilter.d.ts","sourceRoot":"","sources":["../../src/base/ActionFilter.ts"],"names":[],"mappings":";AAMA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAA;AAEzC,qBAAa,YAAa,SAAQ,WAAW;IAElC,IAAI,EAAE,GAAG,CAAC;IAEjB;;;OAGG;IACI,MAAM,UAAM;IAGZ,IAAI;IAIX;;;;;OAKG;IACU,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAQjE;;;;;OAKG;IACU,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAIjE;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG;
|
|
1
|
+
{"version":3,"file":"ActionFilter.d.ts","sourceRoot":"","sources":["../../src/base/ActionFilter.ts"],"names":[],"mappings":";AAMA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAA;AAEzC,qBAAa,YAAa,SAAQ,WAAW;IAElC,IAAI,EAAE,GAAG,CAAC;IAEjB;;;OAGG;IACI,MAAM,UAAM;IAGZ,IAAI;IAIX;;;;;OAKG;IACU,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAQjE;;;;;OAKG;IACU,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ;IAIjE;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG;CA2BjC"}
|
package/base/ActionFilter.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ActionFilter = void 0;
|
|
13
|
-
const Utils_1 = require("../requiments/Utils");
|
|
14
|
-
const CBaseObject_1 = require("./CBaseObject");
|
|
15
|
-
class ActionFilter extends CBaseObject_1.CBaseObject {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
/**
|
|
19
|
-
* @var array list of action IDs that this filter should not apply to.
|
|
20
|
-
* @see only
|
|
21
|
-
*/
|
|
22
|
-
this.except = [];
|
|
23
|
-
}
|
|
24
|
-
init() {
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param route
|
|
29
|
-
* @param req
|
|
30
|
-
* @param res
|
|
31
|
-
*/
|
|
32
|
-
beforeFilter(route, req, res) {
|
|
33
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
if (!this.isActive(route)) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
yield this.beforeAction(route, req, res);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* This method is invoked right before an action is to be executed (after all possible filters.)
|
|
42
|
-
* You may override this method to do last-minute preparation for the action.
|
|
43
|
-
* @param Action $action the action to be executed.
|
|
44
|
-
* @return bool whether the action should continue to be executed.
|
|
45
|
-
*/
|
|
46
|
-
beforeAction(route, req, res) {
|
|
47
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
return true;
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
* @param action
|
|
54
|
-
* @protected
|
|
55
|
-
*/
|
|
56
|
-
isActive(action) {
|
|
57
|
-
let id = action.id;
|
|
58
|
-
let onlyMatch = false;
|
|
59
|
-
let exceptMatch = false;
|
|
60
|
-
if (Utils_1.Utils.isEmpty(this.only)) {
|
|
61
|
-
onlyMatch = true;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
onlyMatch = false;
|
|
65
|
-
for (const onlyKey of this.only) {
|
|
66
|
-
if (Utils_1.Utils.matchWildcard(action.id, onlyKey)) {
|
|
67
|
-
onlyMatch = true;
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
for (const exceptKey in this.except) {
|
|
73
|
-
let pattern = this.except[exceptKey];
|
|
74
|
-
let match = id.match(pattern);
|
|
75
|
-
if (match && match.length > 0) {
|
|
76
|
-
exceptMatch = true;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return !exceptMatch && onlyMatch;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.ActionFilter = ActionFilter;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ActionFilter = void 0;
|
|
13
|
+
const Utils_1 = require("../requiments/Utils");
|
|
14
|
+
const CBaseObject_1 = require("./CBaseObject");
|
|
15
|
+
class ActionFilter extends CBaseObject_1.CBaseObject {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
/**
|
|
19
|
+
* @var array list of action IDs that this filter should not apply to.
|
|
20
|
+
* @see only
|
|
21
|
+
*/
|
|
22
|
+
this.except = [];
|
|
23
|
+
}
|
|
24
|
+
init() {
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param route
|
|
29
|
+
* @param req
|
|
30
|
+
* @param res
|
|
31
|
+
*/
|
|
32
|
+
beforeFilter(route, req, res) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
if (!this.isActive(route)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
yield this.beforeAction(route, req, res);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* This method is invoked right before an action is to be executed (after all possible filters.)
|
|
42
|
+
* You may override this method to do last-minute preparation for the action.
|
|
43
|
+
* @param Action $action the action to be executed.
|
|
44
|
+
* @return bool whether the action should continue to be executed.
|
|
45
|
+
*/
|
|
46
|
+
beforeAction(route, req, res) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
return true;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @param action
|
|
54
|
+
* @protected
|
|
55
|
+
*/
|
|
56
|
+
isActive(action) {
|
|
57
|
+
let id = action.id;
|
|
58
|
+
let onlyMatch = false;
|
|
59
|
+
let exceptMatch = false;
|
|
60
|
+
if (Utils_1.Utils.isEmpty(this.only)) {
|
|
61
|
+
onlyMatch = true;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
onlyMatch = false;
|
|
65
|
+
for (const onlyKey of this.only) {
|
|
66
|
+
if (Utils_1.Utils.matchWildcard(action.id, onlyKey)) {
|
|
67
|
+
onlyMatch = true;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
for (const exceptKey in this.except) {
|
|
73
|
+
let pattern = this.except[exceptKey];
|
|
74
|
+
let match = id.match(pattern);
|
|
75
|
+
if (match && match.length > 0) {
|
|
76
|
+
exceptMatch = true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return !exceptMatch && onlyMatch;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.ActionFilter = ActionFilter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BadRequestHttpException.d.ts","sourceRoot":"","sources":["../../src/base/BadRequestHttpException.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,qBAAa,uBAAwB,SAAQ,SAAS;IAC7B,OAAO,EAAE,MAAM;gBAAf,OAAO,EAAE,MAAM;CAGvC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
4
|
+
* Author: Cihan Ozturk
|
|
5
|
+
* E-mail: cihan@chy.com.tr
|
|
6
|
+
* Github:https://github.com/cihan53/
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.BadRequestHttpException = void 0;
|
|
10
|
+
const BaseError_1 = require("./BaseError");
|
|
11
|
+
class BadRequestHttpException extends BaseError_1.BaseError {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message, 400);
|
|
14
|
+
this.message = message;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.BadRequestHttpException = BadRequestHttpException;
|
package/base/BaseError.d.ts
CHANGED
|
@@ -1,11 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 10.4 Client Error 4xx ............................................65
|
|
3
|
+
* 10.4.1 400 Bad Request .........................................65
|
|
4
|
+
* 10.4.2 401 Unauthorized ........................................66
|
|
5
|
+
* 10.4.3 402 Payment Required ....................................66
|
|
6
|
+
* 10.4.4 403 Forbidden ...........................................66
|
|
7
|
+
* 10.4.5 404 Not Found ...........................................66
|
|
8
|
+
* 10.4.6 405 Method Not Allowed ..................................66
|
|
9
|
+
* 10.4.7 406 Not Acceptable ......................................67
|
|
10
|
+
* 10.4.8 407 Proxy Authentication Required .......................67
|
|
11
|
+
* 10.4.9 408 Request Timeout .....................................67
|
|
12
|
+
* 10.4.10 409 Conflict ............................................67
|
|
13
|
+
* 10.4.11 410 Gone ................................................68
|
|
14
|
+
* 10.4.12 411 Length Required .....................................68
|
|
15
|
+
* 10.4.13 412 Precondition Failed .................................68
|
|
16
|
+
* 10.4.14 413 Request Entity Too Large ............................69
|
|
17
|
+
* 10.4.15 414 Request-URI Too Long ................................69
|
|
18
|
+
* 10.4.16 415 Unsupported Media Type ..............................69
|
|
19
|
+
* 10.4.17 416 Requested Range Not Satisfiable .....................69
|
|
20
|
+
* 10.4.18 417 Expectation Failed ..................................70
|
|
21
|
+
*/
|
|
22
|
+
export declare class BaseError extends Error {
|
|
23
|
+
statusCode: number;
|
|
24
|
+
orginal: any;
|
|
25
|
+
private readonly success;
|
|
26
|
+
constructor(message: any, statusCode?: number);
|
|
27
|
+
toString(): string;
|
|
28
|
+
toJSON(): {
|
|
29
|
+
success: boolean;
|
|
30
|
+
code: number;
|
|
31
|
+
name: string;
|
|
32
|
+
message: string;
|
|
33
|
+
stack: string | undefined;
|
|
34
|
+
orginal: any;
|
|
35
|
+
} | {
|
|
36
|
+
success: boolean;
|
|
37
|
+
code: number;
|
|
38
|
+
name: string;
|
|
39
|
+
message: string;
|
|
40
|
+
stack?: undefined;
|
|
41
|
+
orginal?: undefined;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
11
44
|
//# sourceMappingURL=BaseError.d.ts.map
|
package/base/BaseError.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseError.d.ts","sourceRoot":"","sources":["../../src/base/BaseError.ts"],"names":[],"mappings":"AASA,qBAAa,SAAU,SAAQ,KAAK;IAChC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"BaseError.d.ts","sourceRoot":"","sources":["../../src/base/BaseError.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAEtB,OAAO,EAAE,GAAG,EAAE,UAAU,SAAM;IAW1C,QAAQ;IAIR,MAAM;;;;;;;;;;;;;;;CAcT"}
|
package/base/BaseError.js
CHANGED
|
@@ -1,26 +1,58 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
4
|
-
* Author: Cihan Ozturk
|
|
5
|
-
* E-mail: cihan@chy.com.tr
|
|
6
|
-
* Github:https://github.com/cihan53/
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.BaseError = void 0;
|
|
10
|
-
const Utils_1 = require("../requiments/Utils");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
4
|
+
* Author: Cihan Ozturk
|
|
5
|
+
* E-mail: cihan@chy.com.tr
|
|
6
|
+
* Github:https://github.com/cihan53/
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.BaseError = void 0;
|
|
10
|
+
const Utils_1 = require("../requiments/Utils");
|
|
11
|
+
/**
|
|
12
|
+
* 10.4 Client Error 4xx ............................................65
|
|
13
|
+
* 10.4.1 400 Bad Request .........................................65
|
|
14
|
+
* 10.4.2 401 Unauthorized ........................................66
|
|
15
|
+
* 10.4.3 402 Payment Required ....................................66
|
|
16
|
+
* 10.4.4 403 Forbidden ...........................................66
|
|
17
|
+
* 10.4.5 404 Not Found ...........................................66
|
|
18
|
+
* 10.4.6 405 Method Not Allowed ..................................66
|
|
19
|
+
* 10.4.7 406 Not Acceptable ......................................67
|
|
20
|
+
* 10.4.8 407 Proxy Authentication Required .......................67
|
|
21
|
+
* 10.4.9 408 Request Timeout .....................................67
|
|
22
|
+
* 10.4.10 409 Conflict ............................................67
|
|
23
|
+
* 10.4.11 410 Gone ................................................68
|
|
24
|
+
* 10.4.12 411 Length Required .....................................68
|
|
25
|
+
* 10.4.13 412 Precondition Failed .................................68
|
|
26
|
+
* 10.4.14 413 Request Entity Too Large ............................69
|
|
27
|
+
* 10.4.15 414 Request-URI Too Long ................................69
|
|
28
|
+
* 10.4.16 415 Unsupported Media Type ..............................69
|
|
29
|
+
* 10.4.17 416 Requested Range Not Satisfiable .....................69
|
|
30
|
+
* 10.4.18 417 Expectation Failed ..................................70
|
|
31
|
+
*/
|
|
32
|
+
class BaseError extends Error {
|
|
33
|
+
constructor(message, statusCode = 500) {
|
|
34
|
+
super(message);
|
|
35
|
+
this.success = false;
|
|
36
|
+
this.message = Utils_1.Utils.isString(message) ? message : JSON.stringify(message);
|
|
37
|
+
this.name = this.constructor.name; // good practice
|
|
38
|
+
this.statusCode = statusCode; // error code for responding to client
|
|
39
|
+
//Error.captureStackTrace(this)
|
|
40
|
+
this.orginal = Utils_1.Utils.isString(message) ? message : message;
|
|
41
|
+
}
|
|
42
|
+
toString() {
|
|
43
|
+
return `${this.name}[${this.statusCode}] ${this.message}`;
|
|
44
|
+
}
|
|
45
|
+
toJSON() {
|
|
46
|
+
if (process.env.NODE_ENV == "development" || process.env.NODE_ENV == "dev") {
|
|
47
|
+
return { success: this.success, code: this === null || this === void 0 ? void 0 : this.statusCode, name: this.name.toString(),
|
|
48
|
+
message: this.message.toString(),
|
|
49
|
+
stack: this.stack,
|
|
50
|
+
orginal: this.orginal };
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return { success: this.success, code: this === null || this === void 0 ? void 0 : this.statusCode, name: this.name.toString(),
|
|
54
|
+
message: this.message.toString() };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.BaseError = BaseError;
|
package/base/Behavior.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CBaseObject } from "./CBaseObject";
|
|
2
|
-
export declare class Behavior extends CBaseObject {
|
|
3
|
-
}
|
|
1
|
+
import { CBaseObject } from "./CBaseObject";
|
|
2
|
+
export declare class Behavior extends CBaseObject {
|
|
3
|
+
}
|
|
4
4
|
//# sourceMappingURL=Behavior.d.ts.map
|
package/base/Behavior.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Behavior = void 0;
|
|
4
|
-
const CBaseObject_1 = require("./CBaseObject");
|
|
5
|
-
class Behavior extends CBaseObject_1.CBaseObject {
|
|
6
|
-
}
|
|
7
|
-
exports.Behavior = Behavior;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Behavior = void 0;
|
|
4
|
+
const CBaseObject_1 = require("./CBaseObject");
|
|
5
|
+
class Behavior extends CBaseObject_1.CBaseObject {
|
|
6
|
+
}
|
|
7
|
+
exports.Behavior = Behavior;
|
package/base/CBaseObject.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Configurable } from "./Configurable";
|
|
2
|
-
export declare class CBaseObject implements Configurable {
|
|
3
|
-
init(): void;
|
|
4
|
-
}
|
|
1
|
+
import { Configurable } from "./Configurable";
|
|
2
|
+
export declare class CBaseObject implements Configurable {
|
|
3
|
+
init(): void;
|
|
4
|
+
}
|
|
5
5
|
//# sourceMappingURL=CBaseObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CBaseObject.d.ts","sourceRoot":"","sources":["../../src/base/CBaseObject.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CBaseObject.d.ts","sourceRoot":"","sources":["../../src/base/CBaseObject.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAG5C,qBAAa,WAAY,YAAW,YAAY;IAErC,IAAI;CAGd"}
|
package/base/CBaseObject.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
4
|
-
* Author: Cihan Ozturk
|
|
5
|
-
* E-mail: cihan@chy.com.tr
|
|
6
|
-
* Github:https://github.com/cihan53/
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.CBaseObject = void 0;
|
|
10
|
-
const index_1 = require("../index");
|
|
11
|
-
class CBaseObject {
|
|
12
|
-
init() {
|
|
13
|
-
index_1.BaseChyz.debug("BaseObject init.....");
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.CBaseObject = CBaseObject;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2021. Chy Bilgisayar Bilisim
|
|
4
|
+
* Author: Cihan Ozturk
|
|
5
|
+
* E-mail: cihan@chy.com.tr
|
|
6
|
+
* Github:https://github.com/cihan53/
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CBaseObject = void 0;
|
|
10
|
+
const index_1 = require("../index");
|
|
11
|
+
class CBaseObject {
|
|
12
|
+
init() {
|
|
13
|
+
index_1.BaseChyz.debug("BaseObject init.....");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.CBaseObject = CBaseObject;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum CEvents {
|
|
2
|
+
ON_INIT_BEFORE = "oninitbefore",
|
|
3
|
+
ON_INIT_AFTER = "oninitafter",
|
|
4
|
+
ON_MIDDLEWARE = "onmiddleware",
|
|
5
|
+
ON_BEFORE_START = "onbeforestart",
|
|
6
|
+
ON_AFTER_START = "onafterestart",
|
|
7
|
+
ON_START = "onstart",
|
|
8
|
+
ON_BEFORE_ACTION = "onbeferoaction",
|
|
9
|
+
ON_AFTER_ACTION = "onafteraction",
|
|
10
|
+
ON_DB_CONNECTION = "ondbconnection",
|
|
11
|
+
ON_DB_DISCONNECT = "ondbdisconnect"
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=CEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CEvents.d.ts","sourceRoot":"","sources":["../../src/base/CEvents.ts"],"names":[],"mappings":"AAQA,oBAAY,OAAO;IACf,cAAc,iBAAe;IAC7B,aAAa,gBAAc;IAC3B,aAAa,iBAAe;IAC5B,eAAe,kBAAkB;IACjC,cAAc,kBAAkB;IAChC,QAAQ,YAAY;IAEpB,gBAAgB,mBAAmB;IACnC,eAAe,kBAAkB;IAEjC,gBAAgB,mBAAiB;IACjC,gBAAgB,mBAAiB;CAGpC"}
|
package/base/CEvents.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CEvents = void 0;
|
|
4
|
+
/*
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2023.. Chy Bilgisayar Bilisim
|
|
7
|
+
* Author: Cihan Ozturk
|
|
8
|
+
* E-mail: cihan@chy.com.tr
|
|
9
|
+
* Github:https://github.com/cihan53/
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
var CEvents;
|
|
13
|
+
(function (CEvents) {
|
|
14
|
+
CEvents["ON_INIT_BEFORE"] = "oninitbefore";
|
|
15
|
+
CEvents["ON_INIT_AFTER"] = "oninitafter";
|
|
16
|
+
CEvents["ON_MIDDLEWARE"] = "onmiddleware";
|
|
17
|
+
CEvents["ON_BEFORE_START"] = "onbeforestart";
|
|
18
|
+
CEvents["ON_AFTER_START"] = "onafterestart";
|
|
19
|
+
CEvents["ON_START"] = "onstart";
|
|
20
|
+
CEvents["ON_BEFORE_ACTION"] = "onbeferoaction";
|
|
21
|
+
CEvents["ON_AFTER_ACTION"] = "onafteraction";
|
|
22
|
+
CEvents["ON_DB_CONNECTION"] = "ondbconnection";
|
|
23
|
+
CEvents["ON_DB_DISCONNECT"] = "ondbdisconnect";
|
|
24
|
+
})(CEvents = exports.CEvents || (exports.CEvents = {}));
|
package/base/CRequest.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Request, Response, NextFunction } from "express";
|
|
1
|
+
export { Request, Response, NextFunction } from "express";
|
|
2
2
|
//# sourceMappingURL=CRequest.d.ts.map
|
package/base/CRequest.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2022.. Chy Bilgisayar Bilisim
|
|
5
|
-
* Author: Cihan Ozturk
|
|
6
|
-
* E-mail: cihan@chy.com.tr
|
|
7
|
-
* Github:https://github.com/cihan53/
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022.. Chy Bilgisayar Bilisim
|
|
5
|
+
* Author: Cihan Ozturk
|
|
6
|
+
* E-mail: cihan@chy.com.tr
|
|
7
|
+
* Github:https://github.com/cihan53/
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|