@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,198 +1,198 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**@format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Path = void 0;
|
|
5
|
-
const PathBase_1 = require("../../types/PathBase");
|
|
6
|
-
const Error_1 = require("./Error");
|
|
7
|
-
const __charInDirValidation = {
|
|
8
|
-
"/": { file: false, dir: false },
|
|
9
|
-
".": { file: true, dir: false },
|
|
10
|
-
};
|
|
11
|
-
function _dirNameChecker(dir) {
|
|
12
|
-
if (!dir)
|
|
13
|
-
return "drop";
|
|
14
|
-
for (const ch of dir) {
|
|
15
|
-
const validation = __charInDirValidation[ch];
|
|
16
|
-
if (validation && !validation.dir) {
|
|
17
|
-
return "invalid";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return "valid";
|
|
21
|
-
}
|
|
22
|
-
function _dirFileTypeChecker(src) {
|
|
23
|
-
if (!src)
|
|
24
|
-
return "drop";
|
|
25
|
-
let dirType = false;
|
|
26
|
-
let fileType = false;
|
|
27
|
-
for (const char of src) {
|
|
28
|
-
const validation = __charInDirValidation[char];
|
|
29
|
-
if (dirType) {
|
|
30
|
-
if (validation && !validation.dir)
|
|
31
|
-
return "invalid";
|
|
32
|
-
}
|
|
33
|
-
else if (fileType) {
|
|
34
|
-
if (validation && !validation.file)
|
|
35
|
-
return "invalid";
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
if (validation) {
|
|
39
|
-
if (validation.dir && !validation.file)
|
|
40
|
-
dirType = true;
|
|
41
|
-
else if (!validation.dir && validation.file)
|
|
42
|
-
fileType = true;
|
|
43
|
-
else if (!validation.dir && !validation.file)
|
|
44
|
-
return "invalid";
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if ((!dirType && !fileType) || dirType)
|
|
49
|
-
return "directory";
|
|
50
|
-
else
|
|
51
|
-
return "file";
|
|
52
|
-
}
|
|
53
|
-
function _parsePathFromString(src) {
|
|
54
|
-
const path = {
|
|
55
|
-
dirs: [],
|
|
56
|
-
file: undefined,
|
|
57
|
-
type: "directory",
|
|
58
|
-
};
|
|
59
|
-
if (!src) {
|
|
60
|
-
return path;
|
|
61
|
-
}
|
|
62
|
-
const prsedSrc = src.trim();
|
|
63
|
-
const srcSplit = prsedSrc.split("/");
|
|
64
|
-
if (srcSplit.length === 0) {
|
|
65
|
-
return path;
|
|
66
|
-
}
|
|
67
|
-
for (let i = 0; i < srcSplit.length - 1; ++i) {
|
|
68
|
-
const dir = srcSplit[i];
|
|
69
|
-
const validation = _dirNameChecker(dir);
|
|
70
|
-
if (validation === "invalid") {
|
|
71
|
-
throw new Error_1.PathDirectoryValidationFailException(dir);
|
|
72
|
-
}
|
|
73
|
-
if (validation === "valid") {
|
|
74
|
-
path.dirs.push(dir);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
const lastDir = srcSplit[srcSplit.length - 1];
|
|
78
|
-
const dirType = _dirFileTypeChecker(lastDir);
|
|
79
|
-
if (dirType === "directory") {
|
|
80
|
-
path.dirs.push(lastDir);
|
|
81
|
-
}
|
|
82
|
-
else if (dirType === "file") {
|
|
83
|
-
path.file = lastDir;
|
|
84
|
-
path.type = "file";
|
|
85
|
-
}
|
|
86
|
-
return path;
|
|
87
|
-
}
|
|
88
|
-
/** Path */
|
|
89
|
-
class Path extends PathBase_1.PathBase {
|
|
90
|
-
_type;
|
|
91
|
-
_file;
|
|
92
|
-
/**
|
|
93
|
-
* Create a new Path instance
|
|
94
|
-
*
|
|
95
|
-
* @param dirs the directory names
|
|
96
|
-
* @param type indicate which type the Path is
|
|
97
|
-
* @param file the file name if the type is file
|
|
98
|
-
*/
|
|
99
|
-
constructor(dirs, type, file) {
|
|
100
|
-
super();
|
|
101
|
-
if (typeof dirs === "string") {
|
|
102
|
-
const parsePath = _parsePathFromString(dirs);
|
|
103
|
-
if (type && type != parsePath.type) {
|
|
104
|
-
throw new Error_1.PathDirAndFileConvertInvaild(dirs, parsePath.type);
|
|
105
|
-
}
|
|
106
|
-
this._dirs = parsePath.dirs;
|
|
107
|
-
type = parsePath.type;
|
|
108
|
-
file = parsePath.file;
|
|
109
|
-
}
|
|
110
|
-
else if (Array.isArray(dirs)) {
|
|
111
|
-
this._dirs = dirs;
|
|
112
|
-
}
|
|
113
|
-
this._type = type || (file && "file") || "directory";
|
|
114
|
-
this._file = file;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Convert the path to a string
|
|
118
|
-
*
|
|
119
|
-
* @returns return the string
|
|
120
|
-
*/
|
|
121
|
-
toString() {
|
|
122
|
-
if (this.getType() === "file" && !!!this.getFile()) {
|
|
123
|
-
throw new Error_1.PathProcessorSourceLostException();
|
|
124
|
-
}
|
|
125
|
-
if (this.length() === 0 && !!!this.getFile()) {
|
|
126
|
-
return "";
|
|
127
|
-
}
|
|
128
|
-
const dirs = [];
|
|
129
|
-
for (const dirItem of this._dirs) {
|
|
130
|
-
const validation = _dirNameChecker(dirItem);
|
|
131
|
-
if (validation === "invalid") {
|
|
132
|
-
throw new Error_1.PathDirectoryValidationFailException(dirItem);
|
|
133
|
-
}
|
|
134
|
-
if (validation === "valid") {
|
|
135
|
-
dirs.push(dirItem);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
const file = this.getFile();
|
|
139
|
-
if (!!file)
|
|
140
|
-
dirs.push(file);
|
|
141
|
-
if (dirs.length === 0) {
|
|
142
|
-
return "";
|
|
143
|
-
}
|
|
144
|
-
return dirs.join("/");
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Set the target type
|
|
148
|
-
*
|
|
149
|
-
* @param type new type
|
|
150
|
-
*/
|
|
151
|
-
setType(type) {
|
|
152
|
-
this._type = type;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Get the path type of current instance
|
|
156
|
-
*
|
|
157
|
-
* @returns return the path type
|
|
158
|
-
*/
|
|
159
|
-
getType() {
|
|
160
|
-
return this._type;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Set the path file name
|
|
164
|
-
*
|
|
165
|
-
* @param file the new file name
|
|
166
|
-
* @returns return the old file name
|
|
167
|
-
*/
|
|
168
|
-
setFile(file) {
|
|
169
|
-
const oldFile = this._file;
|
|
170
|
-
this._file = file;
|
|
171
|
-
return oldFile;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Get the file name of current instance
|
|
175
|
-
*
|
|
176
|
-
* @returns return the file name
|
|
177
|
-
*/
|
|
178
|
-
getFile() {
|
|
179
|
-
return this._file;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* IComparable impl to get a string what equals to current instance
|
|
183
|
-
*
|
|
184
|
-
* @returns return the string
|
|
185
|
-
*/
|
|
186
|
-
getString() {
|
|
187
|
-
return this.toString();
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Get a hash code of current instance
|
|
191
|
-
*
|
|
192
|
-
* @returns always return 0
|
|
193
|
-
*/
|
|
194
|
-
getHashCode() {
|
|
195
|
-
return 0;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
exports.Path = Path;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**@format */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Path = void 0;
|
|
5
|
+
const PathBase_1 = require("../../types/PathBase");
|
|
6
|
+
const Error_1 = require("./Error");
|
|
7
|
+
const __charInDirValidation = {
|
|
8
|
+
"/": { file: false, dir: false },
|
|
9
|
+
".": { file: true, dir: false },
|
|
10
|
+
};
|
|
11
|
+
function _dirNameChecker(dir) {
|
|
12
|
+
if (!dir)
|
|
13
|
+
return "drop";
|
|
14
|
+
for (const ch of dir) {
|
|
15
|
+
const validation = __charInDirValidation[ch];
|
|
16
|
+
if (validation && !validation.dir) {
|
|
17
|
+
return "invalid";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return "valid";
|
|
21
|
+
}
|
|
22
|
+
function _dirFileTypeChecker(src) {
|
|
23
|
+
if (!src)
|
|
24
|
+
return "drop";
|
|
25
|
+
let dirType = false;
|
|
26
|
+
let fileType = false;
|
|
27
|
+
for (const char of src) {
|
|
28
|
+
const validation = __charInDirValidation[char];
|
|
29
|
+
if (dirType) {
|
|
30
|
+
if (validation && !validation.dir)
|
|
31
|
+
return "invalid";
|
|
32
|
+
}
|
|
33
|
+
else if (fileType) {
|
|
34
|
+
if (validation && !validation.file)
|
|
35
|
+
return "invalid";
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
if (validation) {
|
|
39
|
+
if (validation.dir && !validation.file)
|
|
40
|
+
dirType = true;
|
|
41
|
+
else if (!validation.dir && validation.file)
|
|
42
|
+
fileType = true;
|
|
43
|
+
else if (!validation.dir && !validation.file)
|
|
44
|
+
return "invalid";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if ((!dirType && !fileType) || dirType)
|
|
49
|
+
return "directory";
|
|
50
|
+
else
|
|
51
|
+
return "file";
|
|
52
|
+
}
|
|
53
|
+
function _parsePathFromString(src) {
|
|
54
|
+
const path = {
|
|
55
|
+
dirs: [],
|
|
56
|
+
file: undefined,
|
|
57
|
+
type: "directory",
|
|
58
|
+
};
|
|
59
|
+
if (!src) {
|
|
60
|
+
return path;
|
|
61
|
+
}
|
|
62
|
+
const prsedSrc = src.trim();
|
|
63
|
+
const srcSplit = prsedSrc.split("/");
|
|
64
|
+
if (srcSplit.length === 0) {
|
|
65
|
+
return path;
|
|
66
|
+
}
|
|
67
|
+
for (let i = 0; i < srcSplit.length - 1; ++i) {
|
|
68
|
+
const dir = srcSplit[i];
|
|
69
|
+
const validation = _dirNameChecker(dir);
|
|
70
|
+
if (validation === "invalid") {
|
|
71
|
+
throw new Error_1.PathDirectoryValidationFailException(dir);
|
|
72
|
+
}
|
|
73
|
+
if (validation === "valid") {
|
|
74
|
+
path.dirs.push(dir);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const lastDir = srcSplit[srcSplit.length - 1];
|
|
78
|
+
const dirType = _dirFileTypeChecker(lastDir);
|
|
79
|
+
if (dirType === "directory") {
|
|
80
|
+
path.dirs.push(lastDir);
|
|
81
|
+
}
|
|
82
|
+
else if (dirType === "file") {
|
|
83
|
+
path.file = lastDir;
|
|
84
|
+
path.type = "file";
|
|
85
|
+
}
|
|
86
|
+
return path;
|
|
87
|
+
}
|
|
88
|
+
/** Path */
|
|
89
|
+
class Path extends PathBase_1.PathBase {
|
|
90
|
+
_type;
|
|
91
|
+
_file;
|
|
92
|
+
/**
|
|
93
|
+
* Create a new Path instance
|
|
94
|
+
*
|
|
95
|
+
* @param dirs the directory names
|
|
96
|
+
* @param type indicate which type the Path is
|
|
97
|
+
* @param file the file name if the type is file
|
|
98
|
+
*/
|
|
99
|
+
constructor(dirs, type, file) {
|
|
100
|
+
super();
|
|
101
|
+
if (typeof dirs === "string") {
|
|
102
|
+
const parsePath = _parsePathFromString(dirs);
|
|
103
|
+
if (type && type != parsePath.type) {
|
|
104
|
+
throw new Error_1.PathDirAndFileConvertInvaild(dirs, parsePath.type);
|
|
105
|
+
}
|
|
106
|
+
this._dirs = parsePath.dirs;
|
|
107
|
+
type = parsePath.type;
|
|
108
|
+
file = parsePath.file;
|
|
109
|
+
}
|
|
110
|
+
else if (Array.isArray(dirs)) {
|
|
111
|
+
this._dirs = dirs;
|
|
112
|
+
}
|
|
113
|
+
this._type = type || (file && "file") || "directory";
|
|
114
|
+
this._file = file;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Convert the path to a string
|
|
118
|
+
*
|
|
119
|
+
* @returns return the string
|
|
120
|
+
*/
|
|
121
|
+
toString() {
|
|
122
|
+
if (this.getType() === "file" && !!!this.getFile()) {
|
|
123
|
+
throw new Error_1.PathProcessorSourceLostException();
|
|
124
|
+
}
|
|
125
|
+
if (this.length() === 0 && !!!this.getFile()) {
|
|
126
|
+
return "";
|
|
127
|
+
}
|
|
128
|
+
const dirs = [];
|
|
129
|
+
for (const dirItem of this._dirs) {
|
|
130
|
+
const validation = _dirNameChecker(dirItem);
|
|
131
|
+
if (validation === "invalid") {
|
|
132
|
+
throw new Error_1.PathDirectoryValidationFailException(dirItem);
|
|
133
|
+
}
|
|
134
|
+
if (validation === "valid") {
|
|
135
|
+
dirs.push(dirItem);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const file = this.getFile();
|
|
139
|
+
if (!!file)
|
|
140
|
+
dirs.push(file);
|
|
141
|
+
if (dirs.length === 0) {
|
|
142
|
+
return "";
|
|
143
|
+
}
|
|
144
|
+
return dirs.join("/");
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Set the target type
|
|
148
|
+
*
|
|
149
|
+
* @param type new type
|
|
150
|
+
*/
|
|
151
|
+
setType(type) {
|
|
152
|
+
this._type = type;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Get the path type of current instance
|
|
156
|
+
*
|
|
157
|
+
* @returns return the path type
|
|
158
|
+
*/
|
|
159
|
+
getType() {
|
|
160
|
+
return this._type;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Set the path file name
|
|
164
|
+
*
|
|
165
|
+
* @param file the new file name
|
|
166
|
+
* @returns return the old file name
|
|
167
|
+
*/
|
|
168
|
+
setFile(file) {
|
|
169
|
+
const oldFile = this._file;
|
|
170
|
+
this._file = file;
|
|
171
|
+
return oldFile;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Get the file name of current instance
|
|
175
|
+
*
|
|
176
|
+
* @returns return the file name
|
|
177
|
+
*/
|
|
178
|
+
getFile() {
|
|
179
|
+
return this._file;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* IComparable impl to get a string what equals to current instance
|
|
183
|
+
*
|
|
184
|
+
* @returns return the string
|
|
185
|
+
*/
|
|
186
|
+
getString() {
|
|
187
|
+
return this.toString();
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Get a hash code of current instance
|
|
191
|
+
*
|
|
192
|
+
* @returns always return 0
|
|
193
|
+
*/
|
|
194
|
+
getHashCode() {
|
|
195
|
+
return 0;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
exports.Path = Path;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**@format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Path = exports.PathDirAndFileConvertInvaild = exports.PathDirectoryValidationFailException = exports.PathProcessorSourceLostException = void 0;
|
|
5
|
-
var Error_1 = require("./Error");
|
|
6
|
-
Object.defineProperty(exports, "PathProcessorSourceLostException", { enumerable: true, get: function () { return Error_1.PathProcessorSourceLostException; } });
|
|
7
|
-
Object.defineProperty(exports, "PathDirectoryValidationFailException", { enumerable: true, get: function () { return Error_1.PathDirectoryValidationFailException; } });
|
|
8
|
-
Object.defineProperty(exports, "PathDirAndFileConvertInvaild", { enumerable: true, get: function () { return Error_1.PathDirAndFileConvertInvaild; } });
|
|
9
|
-
var Path_1 = require("./Path");
|
|
10
|
-
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return Path_1.Path; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
/**@format */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Path = exports.PathDirAndFileConvertInvaild = exports.PathDirectoryValidationFailException = exports.PathProcessorSourceLostException = void 0;
|
|
5
|
+
var Error_1 = require("./Error");
|
|
6
|
+
Object.defineProperty(exports, "PathProcessorSourceLostException", { enumerable: true, get: function () { return Error_1.PathProcessorSourceLostException; } });
|
|
7
|
+
Object.defineProperty(exports, "PathDirectoryValidationFailException", { enumerable: true, get: function () { return Error_1.PathDirectoryValidationFailException; } });
|
|
8
|
+
Object.defineProperty(exports, "PathDirAndFileConvertInvaild", { enumerable: true, get: function () { return Error_1.PathDirAndFileConvertInvaild; } });
|
|
9
|
+
var Path_1 = require("./Path");
|
|
10
|
+
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return Path_1.Path; } });
|
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**@format */
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.ObjectDiffMergeFailedException = exports.ObjectDiffApplyInvalidStatusException = exports.ObjectMergeStatusCheckFailedException = exports.ObjectCloneFunctionNotSupportException = exports.ArgumentNullOrEmptyException = void 0;
|
|
5
|
-
const Exception_1 = require("../../types/Exception");
|
|
6
|
-
/** Argument null exception */
|
|
7
|
-
class ArgumentNullOrEmptyException extends Exception_1.Exception {
|
|
8
|
-
constructor(msg) {
|
|
9
|
-
super(msg);
|
|
10
|
-
}
|
|
11
|
-
toString() {
|
|
12
|
-
return `参数错误 - 指定的参数 ( ${this.message} ) 为空`;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.ArgumentNullOrEmptyException = ArgumentNullOrEmptyException;
|
|
16
|
-
/**
|
|
17
|
-
* Object Clone:
|
|
18
|
-
* Function type is not supported.
|
|
19
|
-
* Exception will be thrown if try to clone a function type object
|
|
20
|
-
*/
|
|
21
|
-
class ObjectCloneFunctionNotSupportException extends Exception_1.Exception {
|
|
22
|
-
constructor() {
|
|
23
|
-
super();
|
|
24
|
-
}
|
|
25
|
-
toString() {
|
|
26
|
-
return `不支持的类型 - 正在克隆为Function类型不支持`;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.ObjectCloneFunctionNotSupportException = ObjectCloneFunctionNotSupportException;
|
|
30
|
-
/**
|
|
31
|
-
* Object Clone:
|
|
32
|
-
* Object different status could not be matched.
|
|
33
|
-
* Exception will be thrown if the object diff could not to be merged
|
|
34
|
-
*/
|
|
35
|
-
class ObjectMergeStatusCheckFailedException extends Exception_1.Exception {
|
|
36
|
-
status;
|
|
37
|
-
path;
|
|
38
|
-
constructor(path, status) {
|
|
39
|
-
super();
|
|
40
|
-
this.path = path;
|
|
41
|
-
this.status = status === "add" ? "新增" : status === "del" ? "删除" : "修改";
|
|
42
|
-
}
|
|
43
|
-
toString() {
|
|
44
|
-
return `错误的合并状态 - ${this.status} 路径 ${this.path} 前后状态不一致`;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.ObjectMergeStatusCheckFailedException = ObjectMergeStatusCheckFailedException;
|
|
48
|
-
/**
|
|
49
|
-
* Object Clone:
|
|
50
|
-
* Object different status could not be applied.
|
|
51
|
-
* Exception will be thrown if the object diff could not to be applied
|
|
52
|
-
*/
|
|
53
|
-
class ObjectDiffApplyInvalidStatusException extends Exception_1.Exception {
|
|
54
|
-
value;
|
|
55
|
-
constructor(value) {
|
|
56
|
-
super();
|
|
57
|
-
this.value = value;
|
|
58
|
-
}
|
|
59
|
-
toString() {
|
|
60
|
-
let v2s = "";
|
|
61
|
-
try {
|
|
62
|
-
v2s = JSON.stringify(this.value);
|
|
63
|
-
}
|
|
64
|
-
finally {
|
|
65
|
-
v2s = v2s || `[${(typeof this.value).toString()}]`;
|
|
66
|
-
}
|
|
67
|
-
return `无效的状态 - 值 ${v2s} 不能应用指定的状态`;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.ObjectDiffApplyInvalidStatusException = ObjectDiffApplyInvalidStatusException;
|
|
71
|
-
/**
|
|
72
|
-
* Object Clone:
|
|
73
|
-
* Object different merge failed.
|
|
74
|
-
* Exception will be thrown if the object element could not be accessed
|
|
75
|
-
*/
|
|
76
|
-
class ObjectDiffMergeFailedException extends Exception_1.Exception {
|
|
77
|
-
path;
|
|
78
|
-
constructor(path) {
|
|
79
|
-
super();
|
|
80
|
-
this.path = path;
|
|
81
|
-
}
|
|
82
|
-
toString() {
|
|
83
|
-
return `对象合并遇到问题 - 路径 ${this.path} 存在无法访问的对象`;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
exports.ObjectDiffMergeFailedException = ObjectDiffMergeFailedException;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**@format */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ObjectDiffMergeFailedException = exports.ObjectDiffApplyInvalidStatusException = exports.ObjectMergeStatusCheckFailedException = exports.ObjectCloneFunctionNotSupportException = exports.ArgumentNullOrEmptyException = void 0;
|
|
5
|
+
const Exception_1 = require("../../types/Exception");
|
|
6
|
+
/** Argument null exception */
|
|
7
|
+
class ArgumentNullOrEmptyException extends Exception_1.Exception {
|
|
8
|
+
constructor(msg) {
|
|
9
|
+
super(msg);
|
|
10
|
+
}
|
|
11
|
+
toString() {
|
|
12
|
+
return `参数错误 - 指定的参数 ( ${this.message} ) 为空`;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ArgumentNullOrEmptyException = ArgumentNullOrEmptyException;
|
|
16
|
+
/**
|
|
17
|
+
* Object Clone:
|
|
18
|
+
* Function type is not supported.
|
|
19
|
+
* Exception will be thrown if try to clone a function type object
|
|
20
|
+
*/
|
|
21
|
+
class ObjectCloneFunctionNotSupportException extends Exception_1.Exception {
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
}
|
|
25
|
+
toString() {
|
|
26
|
+
return `不支持的类型 - 正在克隆为Function类型不支持`;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ObjectCloneFunctionNotSupportException = ObjectCloneFunctionNotSupportException;
|
|
30
|
+
/**
|
|
31
|
+
* Object Clone:
|
|
32
|
+
* Object different status could not be matched.
|
|
33
|
+
* Exception will be thrown if the object diff could not to be merged
|
|
34
|
+
*/
|
|
35
|
+
class ObjectMergeStatusCheckFailedException extends Exception_1.Exception {
|
|
36
|
+
status;
|
|
37
|
+
path;
|
|
38
|
+
constructor(path, status) {
|
|
39
|
+
super();
|
|
40
|
+
this.path = path;
|
|
41
|
+
this.status = status === "add" ? "新增" : status === "del" ? "删除" : "修改";
|
|
42
|
+
}
|
|
43
|
+
toString() {
|
|
44
|
+
return `错误的合并状态 - ${this.status} 路径 ${this.path} 前后状态不一致`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.ObjectMergeStatusCheckFailedException = ObjectMergeStatusCheckFailedException;
|
|
48
|
+
/**
|
|
49
|
+
* Object Clone:
|
|
50
|
+
* Object different status could not be applied.
|
|
51
|
+
* Exception will be thrown if the object diff could not to be applied
|
|
52
|
+
*/
|
|
53
|
+
class ObjectDiffApplyInvalidStatusException extends Exception_1.Exception {
|
|
54
|
+
value;
|
|
55
|
+
constructor(value) {
|
|
56
|
+
super();
|
|
57
|
+
this.value = value;
|
|
58
|
+
}
|
|
59
|
+
toString() {
|
|
60
|
+
let v2s = "";
|
|
61
|
+
try {
|
|
62
|
+
v2s = JSON.stringify(this.value);
|
|
63
|
+
}
|
|
64
|
+
finally {
|
|
65
|
+
v2s = v2s || `[${(typeof this.value).toString()}]`;
|
|
66
|
+
}
|
|
67
|
+
return `无效的状态 - 值 ${v2s} 不能应用指定的状态`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.ObjectDiffApplyInvalidStatusException = ObjectDiffApplyInvalidStatusException;
|
|
71
|
+
/**
|
|
72
|
+
* Object Clone:
|
|
73
|
+
* Object different merge failed.
|
|
74
|
+
* Exception will be thrown if the object element could not be accessed
|
|
75
|
+
*/
|
|
76
|
+
class ObjectDiffMergeFailedException extends Exception_1.Exception {
|
|
77
|
+
path;
|
|
78
|
+
constructor(path) {
|
|
79
|
+
super();
|
|
80
|
+
this.path = path;
|
|
81
|
+
}
|
|
82
|
+
toString() {
|
|
83
|
+
return `对象合并遇到问题 - 路径 ${this.path} 存在无法访问的对象`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.ObjectDiffMergeFailedException = ObjectDiffMergeFailedException;
|