chyz 2.0.0-rc.27 → 2.0.0-rc.29
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 +1 -0
- package/BaseChyz.d.ts.map +1 -1
- package/BaseChyz.js +19 -0
- package/base/RestClient.d.ts +2 -2
- package/base/RestClient.d.ts.map +1 -1
- package/filters/auth/JwtHttpBearerAuth.d.ts.map +1 -1
- package/filters/auth/JwtHttpBearerAuth.js +9 -3
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +20 -20
- package/package.json +12 -12
- package/requiments/Utils.d.ts.map +1 -1
- package/requiments/Utils.js +12 -0
package/BaseChyz.d.ts
CHANGED
package/BaseChyz.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseChyz.d.ts","sourceRoot":"","sources":["../src/BaseChyz.ts"],"names":[],"mappings":"AAcA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseChyz.d.ts","sourceRoot":"","sources":["../src/BaseChyz.ts"],"names":[],"mappings":"AAcA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AAyHjC,MAAM,CAAC,OAAO,OAAO,QAAQ;IACzB,OAAO,CAAC,MAAM,CAAuB;IACrC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,SAAS,EAAE,GAAG,CAAS;IAC9B,OAAO,CAAC,KAAK,CAAgB;IAC7B,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC;IACf,MAAM,CAAC,IAAI,EAAE,GAAG,CAAS;IACzB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACnB,MAAM,CAAC,IAAI,EAAE,IAAI,CAAc;IAC/B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAiB;IACzC,OAAO,CAAC,eAAe,CAAwB;IAC/C,OAAO,CAAC,MAAM,CAAC,WAAW,CAA4B;IACtD,OAAc,UAAU,EAAE,GAAG,CAAK;IAClC,OAAc,WAAW,EAAE,GAAG,CAAK;IACnC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAU;IAGtC,MAAM,KAAK,YAAY,IAAI,GAAG,CAE7B;IAED,MAAM,KAAK,YAAY,CAAC,KAAK,EAAE,GAAG,EAEjC;IAED,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,IAAI,cAAc,CAAC,KAAK,EAAE,MAAM,EAE/B;IAED;;OAEG;IACH,IAAI;IAmCJ;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;OAIG;IACH,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAGD,MAAM,KAAK,QAAQ,IAAI,GAAG,CAEzB;IAED,MAAM,KAAK,QAAQ,CAAC,KAAK,EAAE,GAAG,EAE7B;IAED,GAAG,CAAC,MAAM,GAAE,GAAQ,GAAG,QAAQ;WAqDjB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAInB,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAInB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAIpB,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAKpB,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE;WAItB,CAAC,CAAC,IAAI,EAAE,MAAM;IAKrB,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG;IAKrD,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG;IAUxD,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG;WAQ7C,YAAY,CAAC,GAAG,EAAE,GAAG;WAKrB,cAAc,CAAC,GAAG,EAAE,GAAG;IAIrC;;OAEG;IACG,UAAU;IAyBhB;;OAEG;IACG,cAAc;IA4Eb,UAAU;IAwDV,KAAK;CA2Bf"}
|
package/BaseChyz.js
CHANGED
|
@@ -80,8 +80,14 @@ const validate = require('validate.js');
|
|
|
80
80
|
const dayjs = require('dayjs');
|
|
81
81
|
const utc = require('dayjs/plugin/utc');
|
|
82
82
|
const relative = require('dayjs/plugin/relativeTime');
|
|
83
|
+
const calendar_1 = __importDefault(require("dayjs/plugin/calendar"));
|
|
84
|
+
const weekOfYear_1 = __importDefault(require("dayjs/plugin/weekOfYear"));
|
|
85
|
+
const isTomorrow_1 = __importDefault(require("dayjs/plugin/isTomorrow"));
|
|
83
86
|
dayjs.extend(utc);
|
|
84
87
|
dayjs.extend(relative);
|
|
88
|
+
dayjs.extend(isTomorrow_1.default);
|
|
89
|
+
dayjs.extend(calendar_1.default);
|
|
90
|
+
dayjs.extend(weekOfYear_1.default);
|
|
85
91
|
/**
|
|
86
92
|
* Use
|
|
87
93
|
* selectedBox: {
|
|
@@ -118,6 +124,18 @@ validate.validators.tokenString = (items, itemConstraints) => {
|
|
|
118
124
|
}, {});
|
|
119
125
|
return Utils_1.Utils.isEmpty(arrayItemErrors) ? null : { errors: arrayItemErrors };
|
|
120
126
|
};
|
|
127
|
+
validate.validators.extend(validate.validators.validators.datetime, {
|
|
128
|
+
parse: function (value, options) {
|
|
129
|
+
// console.log(value,parse(value, 'DD/MM/YYYY'),options)
|
|
130
|
+
// return +dayjs.utc(parse(value, 'DD/MM/YYYY'));
|
|
131
|
+
return +dayjs(value).utc();
|
|
132
|
+
},
|
|
133
|
+
// Input is a unix timestamp
|
|
134
|
+
format: function (value, options) {
|
|
135
|
+
var format = options.dateOnly ? "YYYY-MM-DD" : "YYYY-MM-DD hh:mm:ss";
|
|
136
|
+
return dayjs(value).utc().format(format);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
121
139
|
validate.extend(validate.validators.datetime, {
|
|
122
140
|
// The value is guaranteed not to be null or undefined but otherwise it
|
|
123
141
|
// could be anything.
|
|
@@ -462,6 +480,7 @@ class BaseChyz {
|
|
|
462
480
|
}
|
|
463
481
|
exports.default = BaseChyz;
|
|
464
482
|
BaseChyz.propvider = Server;
|
|
483
|
+
BaseChyz.date = dayjs;
|
|
465
484
|
BaseChyz.logs = new Logs_1.Logs();
|
|
466
485
|
BaseChyz._validate = validate;
|
|
467
486
|
BaseChyz.controllers = [];
|
package/base/RestClient.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Component } from "./Component";
|
|
2
2
|
export declare class RestClient extends Component {
|
|
3
|
-
post(url: string, args?: any
|
|
4
|
-
get(url: string, args?: any
|
|
3
|
+
post(url: string, args?: any, headers?: any): any;
|
|
4
|
+
get(url: string, args?: any, headers?: any): any;
|
|
5
5
|
Rest(params: any): any;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=RestClient.d.ts.map
|
package/base/RestClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RestClient.d.ts","sourceRoot":"","sources":["../../src/base/RestClient.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAItC,qBAAa,UAAW,SAAQ,SAAS;IAC9B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"RestClient.d.ts","sourceRoot":"","sources":["../../src/base/RestClient.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAItC,qBAAa,UAAW,SAAQ,SAAS;IAC9B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAC,OAAO,CAAC,EAAC,GAAG;IAIzC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAC,OAAO,CAAC,EAAC,GAAG;IAIxC,IAAI,CAAC,MAAM,EAAE,GAAG;CAG1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JwtHttpBearerAuth.d.ts","sourceRoot":"","sources":["../../../src/filters/auth/JwtHttpBearerAuth.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"JwtHttpBearerAuth.d.ts","sourceRoot":"","sources":["../../../src/filters/auth/JwtHttpBearerAuth.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAC,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAI1C,qBAAa,iBAAkB,SAAQ,cAAc;IACjD;;;OAGG;IACI,GAAG,SAAQ;IACX,IAAI,EAAE,GAAG,CAAQ;IAGxB;;OAEG;IACI,IAAI,IAAI,IAAI;IAWN,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ;IAuC7E;;OAEG;IACI,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAKxC"}
|
|
@@ -52,9 +52,15 @@ class JwtHttpBearerAuth extends HttpBearerAuth_1.HttpBearerAuth {
|
|
|
52
52
|
}
|
|
53
53
|
let identity = null;
|
|
54
54
|
let token = null;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
try {
|
|
56
|
+
token = JsonWebToken.decode(autHeader[1], { complete: true });
|
|
57
|
+
if (!token) {
|
|
58
|
+
BaseChyz_1.default.warning("Your request was made with invalid or expired JSON Web Token.");
|
|
59
|
+
this.fail(response);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
BaseChyz_1.default.warning("Your request was made with invalid or expired JSON Web Token.", autHeader, request.path);
|
|
58
64
|
this.fail(response);
|
|
59
65
|
}
|
|
60
66
|
if (token !== null) {
|
package/index.d.ts
CHANGED
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,QAAQ,2BAA2B,CAAC;IACvC,UAAU,OAAO;QACb,QAAQ,EAAE,GAAG,CAAC;KACjB;CACJ;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,QAAQ,2BAA2B,CAAC;IACvC,UAAU,OAAO;QACb,QAAQ,EAAE,GAAG,CAAC;KACjB;CACJ;AAED,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAC;AAGlC;;GAEG;AACH,QAAA,MAAM,IAAI,UAAiB,CAAC;AAC5B,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,CAAA;AAC7B,OAAO,EACH,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,KAAK,EACL,YAAY,EACZ,OAAO,EACV,MAAM,QAAQ,CAAC;AAChB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AAEnC,eAAe,IAAI,CAAC"}
|
package/index.js
CHANGED
|
@@ -26,34 +26,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
exports.CEvents = exports.ModelManager = exports.Model = exports.ValidationHttpException = exports.DataErrorDbException = exports.UnauthorizedHttpException = exports.NotFoundHttpException = exports.InvalidArgumentException = exports.InvalidConfigException = exports.ForbiddenHttpException = exports.DbConnection = exports.CWebController = exports.Component = exports.Behavior = exports.BaseError = exports.ActionFilter = exports.Logs = exports.RestClient = exports.BaseChyz = exports.WebUser = void 0;
|
|
29
|
-
const RestClient_1 = require("./base/RestClient");
|
|
30
|
-
Object.defineProperty(exports, "RestClient", { enumerable: true, get: function () { return RestClient_1.RestClient; } });
|
|
31
29
|
const BaseChyz_1 = __importDefault(require("./BaseChyz"));
|
|
32
30
|
exports.BaseChyz = BaseChyz_1.default;
|
|
31
|
+
const base_1 = require("./base");
|
|
32
|
+
Object.defineProperty(exports, "RestClient", { enumerable: true, get: function () { return base_1.RestClient; } });
|
|
33
33
|
/**
|
|
34
34
|
*
|
|
35
35
|
*/
|
|
36
36
|
const Chyz = new BaseChyz_1.default();
|
|
37
37
|
var WebUser_1 = require("./web/WebUser");
|
|
38
38
|
Object.defineProperty(exports, "WebUser", { enumerable: true, get: function () { return WebUser_1.WebUser; } });
|
|
39
|
-
var
|
|
40
|
-
Object.defineProperty(exports, "Logs", { enumerable: true, get: function () { return
|
|
41
|
-
Object.defineProperty(exports, "ActionFilter", { enumerable: true, get: function () { return
|
|
42
|
-
Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return
|
|
43
|
-
Object.defineProperty(exports, "Behavior", { enumerable: true, get: function () { return
|
|
44
|
-
Object.defineProperty(exports, "Component", { enumerable: true, get: function () { return
|
|
45
|
-
Object.defineProperty(exports, "CWebController", { enumerable: true, get: function () { return
|
|
46
|
-
Object.defineProperty(exports, "DbConnection", { enumerable: true, get: function () { return
|
|
47
|
-
Object.defineProperty(exports, "ForbiddenHttpException", { enumerable: true, get: function () { return
|
|
48
|
-
Object.defineProperty(exports, "InvalidConfigException", { enumerable: true, get: function () { return
|
|
49
|
-
Object.defineProperty(exports, "InvalidArgumentException", { enumerable: true, get: function () { return
|
|
50
|
-
Object.defineProperty(exports, "NotFoundHttpException", { enumerable: true, get: function () { return
|
|
51
|
-
Object.defineProperty(exports, "UnauthorizedHttpException", { enumerable: true, get: function () { return
|
|
52
|
-
Object.defineProperty(exports, "DataErrorDbException", { enumerable: true, get: function () { return
|
|
53
|
-
Object.defineProperty(exports, "ValidationHttpException", { enumerable: true, get: function () { return
|
|
54
|
-
Object.defineProperty(exports, "Model", { enumerable: true, get: function () { return
|
|
55
|
-
Object.defineProperty(exports, "ModelManager", { enumerable: true, get: function () { return
|
|
56
|
-
Object.defineProperty(exports, "CEvents", { enumerable: true, get: function () { return
|
|
39
|
+
var base_2 = require("./base");
|
|
40
|
+
Object.defineProperty(exports, "Logs", { enumerable: true, get: function () { return base_2.Logs; } });
|
|
41
|
+
Object.defineProperty(exports, "ActionFilter", { enumerable: true, get: function () { return base_2.ActionFilter; } });
|
|
42
|
+
Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return base_2.BaseError; } });
|
|
43
|
+
Object.defineProperty(exports, "Behavior", { enumerable: true, get: function () { return base_2.Behavior; } });
|
|
44
|
+
Object.defineProperty(exports, "Component", { enumerable: true, get: function () { return base_2.Component; } });
|
|
45
|
+
Object.defineProperty(exports, "CWebController", { enumerable: true, get: function () { return base_2.CWebController; } });
|
|
46
|
+
Object.defineProperty(exports, "DbConnection", { enumerable: true, get: function () { return base_2.DbConnection; } });
|
|
47
|
+
Object.defineProperty(exports, "ForbiddenHttpException", { enumerable: true, get: function () { return base_2.ForbiddenHttpException; } });
|
|
48
|
+
Object.defineProperty(exports, "InvalidConfigException", { enumerable: true, get: function () { return base_2.InvalidConfigException; } });
|
|
49
|
+
Object.defineProperty(exports, "InvalidArgumentException", { enumerable: true, get: function () { return base_2.InvalidArgumentException; } });
|
|
50
|
+
Object.defineProperty(exports, "NotFoundHttpException", { enumerable: true, get: function () { return base_2.NotFoundHttpException; } });
|
|
51
|
+
Object.defineProperty(exports, "UnauthorizedHttpException", { enumerable: true, get: function () { return base_2.UnauthorizedHttpException; } });
|
|
52
|
+
Object.defineProperty(exports, "DataErrorDbException", { enumerable: true, get: function () { return base_2.DataErrorDbException; } });
|
|
53
|
+
Object.defineProperty(exports, "ValidationHttpException", { enumerable: true, get: function () { return base_2.ValidationHttpException; } });
|
|
54
|
+
Object.defineProperty(exports, "Model", { enumerable: true, get: function () { return base_2.Model; } });
|
|
55
|
+
Object.defineProperty(exports, "ModelManager", { enumerable: true, get: function () { return base_2.ModelManager; } });
|
|
56
|
+
Object.defineProperty(exports, "CEvents", { enumerable: true, get: function () { return base_2.CEvents; } });
|
|
57
57
|
__exportStar(require("./filters"), exports);
|
|
58
58
|
__exportStar(require("./filters/auth"), exports);
|
|
59
59
|
__exportStar(require("./decorator"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chyz",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.29",
|
|
4
4
|
"description": "Nodejs Micro service Framework",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -20,27 +20,27 @@
|
|
|
20
20
|
"ts-node": "^10.2.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"axios": "^
|
|
23
|
+
"axios": "^1.3.5",
|
|
24
24
|
"babel-plugin-transform-decorators-legacy": "^1.3.5",
|
|
25
|
-
"body-parser": "^1.
|
|
25
|
+
"body-parser": "^1.20.2",
|
|
26
26
|
"compression": "^1.7.4",
|
|
27
|
-
"core-js": "^3.
|
|
27
|
+
"core-js": "^3.30.1",
|
|
28
28
|
"dotenv-flow": "^3.2.0",
|
|
29
|
-
"express": "^4.
|
|
30
|
-
"express-session": "^1.17.
|
|
31
|
-
"glob": "^
|
|
32
|
-
"ip": "^1.1.
|
|
29
|
+
"express": "^4.18.2",
|
|
30
|
+
"express-session": "^1.17.3",
|
|
31
|
+
"glob": "^10.0.0",
|
|
32
|
+
"ip": "^1.1.8",
|
|
33
33
|
"jsonwebtoken": "^9.0.0",
|
|
34
34
|
"lodash": "^4.17.21",
|
|
35
|
-
"log4js": "^6.
|
|
35
|
+
"log4js": "^6.9.1",
|
|
36
36
|
"method-override": "^3.0.0",
|
|
37
37
|
"passport": "^0.6.0",
|
|
38
|
-
"pg": "^8.
|
|
38
|
+
"pg": "^8.10.0",
|
|
39
39
|
"pg-hstore": "^2.3.4",
|
|
40
40
|
"reflect-metadata": "^0.1.13",
|
|
41
|
-
"sequelize": "^6.
|
|
41
|
+
"sequelize": "^6.31.0",
|
|
42
42
|
"sequelize-transparent-cache": "^2.3.0",
|
|
43
|
-
"tslib": "^2.
|
|
43
|
+
"tslib": "^2.5.0",
|
|
44
44
|
"validate.js": "^0.13.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../src/requiments/Utils.ts"],"names":[],"mappings":"AAkGA;;;GAGG;AACH,QAAA,MAAM,CAAC,SAAmB,MAAM,WAE/B,CAAA;
|
|
1
|
+
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../src/requiments/Utils.ts"],"names":[],"mappings":"AAkGA;;;GAGG;AACH,QAAA,MAAM,CAAC,SAAmB,MAAM,WAE/B,CAAA;AAaD,eAAO,MAAM,KAAK,KASjB,CAAA;AACD,OAAO,EAAC,CAAC,EAAC,CAAA;AACV,eAAe,CAAC,CAAC"}
|
package/requiments/Utils.js
CHANGED
|
@@ -104,10 +104,22 @@ const t = function (text) {
|
|
|
104
104
|
return text;
|
|
105
105
|
};
|
|
106
106
|
exports.t = t;
|
|
107
|
+
/**
|
|
108
|
+
* random string genrate
|
|
109
|
+
* @param length
|
|
110
|
+
* @param randomString
|
|
111
|
+
*/
|
|
112
|
+
const generateRandomString = function (length, randomString = "") {
|
|
113
|
+
randomString += Math.random().toString(20).substr(2, length);
|
|
114
|
+
if (randomString.length > length)
|
|
115
|
+
return randomString.slice(0, length);
|
|
116
|
+
return generateRandomString(length, randomString);
|
|
117
|
+
};
|
|
107
118
|
exports.Utils = Object.assign({ findKeyValue,
|
|
108
119
|
createObject,
|
|
109
120
|
sleep,
|
|
110
121
|
matchWildcard,
|
|
111
122
|
toQuery,
|
|
123
|
+
generateRandomString,
|
|
112
124
|
t }, _);
|
|
113
125
|
exports.default = t;
|