@aitianyu.cn/types 0.0.11 → 0.0.13
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/lib/index.js +54 -54
- package/dist/lib/types/AreaCode.js +269 -269
- package/dist/lib/types/Exception.js +19 -19
- package/dist/lib/types/Logs.js +20 -20
- package/dist/lib/types/Object.js +3 -3
- package/dist/lib/types/PathBase.js +109 -109
- package/dist/lib/types/Security.js +10 -10
- package/dist/lib/types/TMap.js +138 -138
- package/dist/lib/types/Types.js +3 -3
- package/dist/lib/types/index.js +17 -17
- package/dist/lib/utilities/coding/Error.js +44 -44
- package/dist/lib/utilities/coding/Path.js +198 -198
- package/dist/lib/utilities/coding/index.js +10 -10
- package/dist/lib/utilities/core/Errors.js +86 -86
- package/dist/lib/utilities/core/Language.js +559 -559
- package/dist/lib/utilities/core/Log.js +108 -108
- package/dist/lib/utilities/core/TypeConvertion.js +25 -25
- package/dist/lib/utilities/core/index.js +21 -21
- package/dist/lib/utilities/core/interface/ITJSON.js +3 -0
- package/dist/lib/utilities/core/interface/ITianyuType.js +3 -0
- package/dist/lib/utilities/core/object/ArrayHelper.js +35 -35
- package/dist/lib/utilities/core/object/Calculater.js +230 -230
- package/dist/lib/utilities/core/object/Helper.js +201 -201
- package/dist/lib/utilities/core/object/StringHelper.js +22 -22
- package/dist/lib/utilities/core/type/TArray.js +7 -0
- package/dist/lib/utilities/core/type/TBoolean.js +7 -0
- package/dist/lib/utilities/core/type/TJSON.js +7 -0
- package/dist/lib/utilities/core/type/TNumber.js +7 -0
- package/dist/lib/utilities/core/type/TObject.js +7 -0
- package/dist/lib/utilities/core/type/TString.js +7 -0
- package/dist/lib/utilities/security/Guid.js +20 -20
- package/dist/lib/utilities/security/Hash.js +15 -15
- package/dist/lib/utilities/security/index.js +8 -8
- package/dist/types/index.d.ts +21 -21
- package/dist/types/types/AreaCode.d.ts +135 -135
- package/dist/types/types/Exception.d.ts +11 -11
- package/dist/types/types/Logs.d.ts +64 -64
- package/dist/types/types/Object.d.ts +18 -18
- package/dist/types/types/PathBase.d.ts +76 -76
- package/dist/types/types/Security.d.ts +23 -23
- package/dist/types/types/TMap.d.ts +80 -80
- package/dist/types/types/Types.d.ts +25 -20
- package/dist/types/types/index.d.ts +9 -9
- package/dist/types/utilities/coding/Error.d.ts +27 -27
- package/dist/types/utilities/coding/Path.d.ts +61 -61
- package/dist/types/utilities/coding/index.d.ts +3 -3
- package/dist/types/utilities/core/Errors.d.ts +47 -47
- package/dist/types/utilities/core/Language.d.ts +17 -17
- package/dist/types/utilities/core/Log.d.ts +12 -12
- package/dist/types/utilities/core/TypeConvertion.d.ts +2 -2
- package/dist/types/utilities/core/index.d.ts +6 -6
- package/dist/types/utilities/core/interface/ITJSON.d.ts +5 -0
- package/dist/types/utilities/core/interface/ITianyuType.d.ts +5 -0
- package/dist/types/utilities/core/object/ArrayHelper.d.ts +11 -11
- package/dist/types/utilities/core/object/Calculater.d.ts +22 -22
- package/dist/types/utilities/core/object/Helper.d.ts +39 -39
- package/dist/types/utilities/core/object/StringHelper.d.ts +4 -4
- package/dist/types/utilities/core/type/TArray.d.ts +3 -0
- package/dist/types/utilities/core/type/TBoolean.d.ts +3 -0
- package/dist/types/utilities/core/type/TJSON.d.ts +3 -0
- package/dist/types/utilities/core/type/TNumber.d.ts +3 -0
- package/dist/types/utilities/core/type/TObject.d.ts +3 -0
- package/dist/types/utilities/core/type/TString.d.ts +3 -0
- package/dist/types/utilities/security/Guid.d.ts +3 -3
- package/dist/types/utilities/security/Hash.d.ts +3 -3
- package/dist/types/utilities/security/index.d.ts +3 -3
- package/package.json +51 -51
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
import { ObjectDiffMap } from "../../../types/Object";
|
|
3
|
-
/** Object Calculation Manager of Tianyu to provide data changes delta calculation and merge */
|
|
4
|
-
export declare class ObjectCalculater {
|
|
5
|
-
/**
|
|
6
|
-
* Compare two objects and get the delta changes between the two objects
|
|
7
|
-
*
|
|
8
|
-
* @param previous the previous object
|
|
9
|
-
* @param newest the newest object
|
|
10
|
-
* @returns return the defferents map
|
|
11
|
-
*/
|
|
12
|
-
static calculateDiff(previous: any, newest: any): ObjectDiffMap;
|
|
13
|
-
/**
|
|
14
|
-
* Merge the object value status from one to another one following with the object different maps
|
|
15
|
-
*
|
|
16
|
-
* @param value the raw value(status)
|
|
17
|
-
* @param diffs the value changed status map array, contains multiply status maps and the status merge will be one by one.
|
|
18
|
-
* @param strict a boolean value used to whether the program needs a strict status check to avoid some data errors
|
|
19
|
-
* @returns return a new value status
|
|
20
|
-
*/
|
|
21
|
-
static mergeDiff(value: any, diffs: ObjectDiffMap[], strict?: boolean): any;
|
|
22
|
-
}
|
|
1
|
+
/**@format */
|
|
2
|
+
import { ObjectDiffMap } from "../../../types/Object";
|
|
3
|
+
/** Object Calculation Manager of Tianyu to provide data changes delta calculation and merge */
|
|
4
|
+
export declare class ObjectCalculater {
|
|
5
|
+
/**
|
|
6
|
+
* Compare two objects and get the delta changes between the two objects
|
|
7
|
+
*
|
|
8
|
+
* @param previous the previous object
|
|
9
|
+
* @param newest the newest object
|
|
10
|
+
* @returns return the defferents map
|
|
11
|
+
*/
|
|
12
|
+
static calculateDiff(previous: any, newest: any): ObjectDiffMap;
|
|
13
|
+
/**
|
|
14
|
+
* Merge the object value status from one to another one following with the object different maps
|
|
15
|
+
*
|
|
16
|
+
* @param value the raw value(status)
|
|
17
|
+
* @param diffs the value changed status map array, contains multiply status maps and the status merge will be one by one.
|
|
18
|
+
* @param strict a boolean value used to whether the program needs a strict status check to avoid some data errors
|
|
19
|
+
* @returns return a new value status
|
|
20
|
+
*/
|
|
21
|
+
static mergeDiff(value: any, diffs: ObjectDiffMap[], strict?: boolean): any;
|
|
22
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
/** Object Helper of Tianyu to provide data type checking, objects comparing, validation, data clone and other functions */
|
|
3
|
-
export declare class ObjectHelper {
|
|
4
|
-
/**
|
|
5
|
-
* check whether the specified value does extend from nodejs native type
|
|
6
|
-
*
|
|
7
|
-
* @param {any} value supported value type of tianyu store
|
|
8
|
-
* @returns {boolean} return true if the value is based on type number, string, boolean, function, otherwise false
|
|
9
|
-
*/
|
|
10
|
-
static isSimpleDataType(value: any): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* get a deep copy from source
|
|
13
|
-
*
|
|
14
|
-
* @param {any} sources the specified source value
|
|
15
|
-
* @returns {any} return a new value that is independent from sources
|
|
16
|
-
*/
|
|
17
|
-
static clone(source: any): any;
|
|
18
|
-
private static _clone;
|
|
19
|
-
private static _cloneArray;
|
|
20
|
-
private static _cloneRecordType;
|
|
21
|
-
/**
|
|
22
|
-
* Check the object whether can be stringified
|
|
23
|
-
*
|
|
24
|
-
* @param obj be checked object
|
|
25
|
-
* @returns return true is valid, otherwise false
|
|
26
|
-
*/
|
|
27
|
-
static validateSerializable(obj: any): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Compare two or more objects are the same or different
|
|
30
|
-
*
|
|
31
|
-
* @param objs the objects which need to be compared
|
|
32
|
-
* @returns same - if all the objects are same, different - if at least one object is not same to other objects
|
|
33
|
-
* @description if there are only one parameter or no parameter is provided, same result will be returned
|
|
34
|
-
*/
|
|
35
|
-
static compareObjects(...objs: any): "same" | "different";
|
|
36
|
-
private static _compareSimpleType;
|
|
37
|
-
private static _compareArrayType;
|
|
38
|
-
private static _compareObjectType;
|
|
39
|
-
}
|
|
1
|
+
/**@format */
|
|
2
|
+
/** Object Helper of Tianyu to provide data type checking, objects comparing, validation, data clone and other functions */
|
|
3
|
+
export declare class ObjectHelper {
|
|
4
|
+
/**
|
|
5
|
+
* check whether the specified value does extend from nodejs native type
|
|
6
|
+
*
|
|
7
|
+
* @param {any} value supported value type of tianyu store
|
|
8
|
+
* @returns {boolean} return true if the value is based on type number, string, boolean, function, otherwise false
|
|
9
|
+
*/
|
|
10
|
+
static isSimpleDataType(value: any): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* get a deep copy from source
|
|
13
|
+
*
|
|
14
|
+
* @param {any} sources the specified source value
|
|
15
|
+
* @returns {any} return a new value that is independent from sources
|
|
16
|
+
*/
|
|
17
|
+
static clone(source: any): any;
|
|
18
|
+
private static _clone;
|
|
19
|
+
private static _cloneArray;
|
|
20
|
+
private static _cloneRecordType;
|
|
21
|
+
/**
|
|
22
|
+
* Check the object whether can be stringified
|
|
23
|
+
*
|
|
24
|
+
* @param obj be checked object
|
|
25
|
+
* @returns return true is valid, otherwise false
|
|
26
|
+
*/
|
|
27
|
+
static validateSerializable(obj: any): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Compare two or more objects are the same or different
|
|
30
|
+
*
|
|
31
|
+
* @param objs the objects which need to be compared
|
|
32
|
+
* @returns same - if all the objects are same, different - if at least one object is not same to other objects
|
|
33
|
+
* @description if there are only one parameter or no parameter is provided, same result will be returned
|
|
34
|
+
*/
|
|
35
|
+
static compareObjects(...objs: any): "same" | "different";
|
|
36
|
+
private static _compareSimpleType;
|
|
37
|
+
private static _compareArrayType;
|
|
38
|
+
private static _compareObjectType;
|
|
39
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
export declare class StringHelper {
|
|
3
|
-
static format(source: string, args?: (string | number)[] | string): string;
|
|
4
|
-
}
|
|
1
|
+
/**@format */
|
|
2
|
+
export declare class StringHelper {
|
|
3
|
+
static format(source: string, args?: (string | number)[] | string): string;
|
|
4
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
/** Generate a Guid value string */
|
|
3
|
-
export declare function guid(): string;
|
|
1
|
+
/**@format */
|
|
2
|
+
/** Generate a Guid value string */
|
|
3
|
+
export declare function guid(): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
/** Generate a hash code number of the string */
|
|
3
|
-
export declare function hash(source: string): number;
|
|
1
|
+
/**@format */
|
|
2
|
+
/** Generate a hash code number of the string */
|
|
3
|
+
export declare function hash(source: string): number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/**@format */
|
|
2
|
-
export { guid } from "./Guid";
|
|
3
|
-
export { hash } from "./Hash";
|
|
1
|
+
/**@format */
|
|
2
|
+
export { guid } from "./Guid";
|
|
3
|
+
export { hash } from "./Hash";
|
package/package.json
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@aitianyu.cn/types",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"private": false,
|
|
5
|
-
"description": "Common modules (types, functions, classes) for aitianyu",
|
|
6
|
-
"main": "./dist/lib/index.js",
|
|
7
|
-
"types": "./dist/types/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": "./dist/lib/index.js",
|
|
10
|
-
"./types": "./dist/lib/types/index.js",
|
|
11
|
-
"./coding": "./dist/lib/utilities/coding/index.js",
|
|
12
|
-
"./core": "./dist/lib/utilities/core/index.js",
|
|
13
|
-
"./security": "./dist/lib/utilities/security/index.js"
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"dist"
|
|
17
|
-
],
|
|
18
|
-
"type": "commonjs",
|
|
19
|
-
"keywords": [
|
|
20
|
-
"aitianyu.cn",
|
|
21
|
-
"base type",
|
|
22
|
-
"common lib"
|
|
23
|
-
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"start": "ts-node packages/index.ts",
|
|
26
|
-
"build": "npm run before-build && npm run compiler && npm run copy-lib && npm run copy-types && npm run after-build",
|
|
27
|
-
"compiler": "tsc && tsc-alias",
|
|
28
|
-
"copy-lib": "copyfiles -u 2 \"build/src/**/*.js\" \"dist/lib\"",
|
|
29
|
-
"copy-types": "copyfiles -u 2 \"build/src/**/*.d.ts\" \"dist/types\"",
|
|
30
|
-
"before-build": "rimraf ./dist ./build",
|
|
31
|
-
"after-build": "rimraf ./build",
|
|
32
|
-
"test": "jest --no-cache --verbose",
|
|
33
|
-
"test-all": "jest --no-cache --verbose --coverage",
|
|
34
|
-
"test-coverage": "jest --no-cache --coverage"
|
|
35
|
-
},
|
|
36
|
-
"author": "dev@aitianyu.cn",
|
|
37
|
-
"license": "ISC",
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@types/jest": "^29.2.4",
|
|
40
|
-
"@types/node": "^18.11.15",
|
|
41
|
-
"copyfiles": "^2.4.1",
|
|
42
|
-
"jest": "^29.3.1",
|
|
43
|
-
"jest-html-reporters": "^3.0.11",
|
|
44
|
-
"perf_hooks": "0.0.1",
|
|
45
|
-
"rimraf": "^3.0.2",
|
|
46
|
-
"ts-jest": "^29.0.3",
|
|
47
|
-
"ts-node": "^10.9.1",
|
|
48
|
-
"tsc-alias": "^1.8.2",
|
|
49
|
-
"typescript": "^4.9.3"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@aitianyu.cn/types",
|
|
3
|
+
"version": "0.0.13",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Common modules (types, functions, classes) for aitianyu",
|
|
6
|
+
"main": "./dist/lib/index.js",
|
|
7
|
+
"types": "./dist/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/lib/index.js",
|
|
10
|
+
"./types": "./dist/lib/types/index.js",
|
|
11
|
+
"./coding": "./dist/lib/utilities/coding/index.js",
|
|
12
|
+
"./core": "./dist/lib/utilities/core/index.js",
|
|
13
|
+
"./security": "./dist/lib/utilities/security/index.js"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"type": "commonjs",
|
|
19
|
+
"keywords": [
|
|
20
|
+
"aitianyu.cn",
|
|
21
|
+
"base type",
|
|
22
|
+
"common lib"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"start": "ts-node packages/index.ts",
|
|
26
|
+
"build": "npm run before-build && npm run compiler && npm run copy-lib && npm run copy-types && npm run after-build",
|
|
27
|
+
"compiler": "tsc && tsc-alias",
|
|
28
|
+
"copy-lib": "copyfiles -u 2 \"build/src/**/*.js\" \"dist/lib\"",
|
|
29
|
+
"copy-types": "copyfiles -u 2 \"build/src/**/*.d.ts\" \"dist/types\"",
|
|
30
|
+
"before-build": "rimraf ./dist ./build",
|
|
31
|
+
"after-build": "rimraf ./build",
|
|
32
|
+
"test": "jest --no-cache --verbose",
|
|
33
|
+
"test-all": "jest --no-cache --verbose --coverage",
|
|
34
|
+
"test-coverage": "jest --no-cache --coverage"
|
|
35
|
+
},
|
|
36
|
+
"author": "dev@aitianyu.cn",
|
|
37
|
+
"license": "ISC",
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/jest": "^29.2.4",
|
|
40
|
+
"@types/node": "^18.11.15",
|
|
41
|
+
"copyfiles": "^2.4.1",
|
|
42
|
+
"jest": "^29.3.1",
|
|
43
|
+
"jest-html-reporters": "^3.0.11",
|
|
44
|
+
"perf_hooks": "0.0.1",
|
|
45
|
+
"rimraf": "^3.0.2",
|
|
46
|
+
"ts-jest": "^29.0.3",
|
|
47
|
+
"ts-node": "^10.9.1",
|
|
48
|
+
"tsc-alias": "^1.8.2",
|
|
49
|
+
"typescript": "^4.9.3"
|
|
50
|
+
}
|
|
51
|
+
}
|