utiller 1.0.411 → 1.0.412
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/lib/exceptioner/ERRORs.js +192 -1
- package/lib/exceptioner/index.js +39 -1
- package/lib/index.js +30 -1
- package/lib/pooller/index.js +1117 -1
- package/lib/utiller/index.js +3531 -1
- package/lib/utiller/nodeutiller.js +1090 -3
- package/package.json +4 -3
- package/template/sample.package.json +1 -1
- package/template/sample.terser.config.js +46 -0
- package/lib/words/index.js +0 -1
|
@@ -1 +1,192 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/***
|
|
8
|
+
* 2XXX api io
|
|
9
|
+
* 3XXX databases
|
|
10
|
+
* 4XXX pooller
|
|
11
|
+
* 8XXX file IO,Utiller
|
|
12
|
+
* 9XXX commons
|
|
13
|
+
* 7XXX ui experience
|
|
14
|
+
* 6XXX puppter=>browser
|
|
15
|
+
*/
|
|
16
|
+
const ERRORs = {
|
|
17
|
+
2001: {
|
|
18
|
+
message: 'update item, id is required'
|
|
19
|
+
},
|
|
20
|
+
3001: {
|
|
21
|
+
message: `get table error`
|
|
22
|
+
},
|
|
23
|
+
3002: {
|
|
24
|
+
message: `show schema error`
|
|
25
|
+
},
|
|
26
|
+
3003: {
|
|
27
|
+
message: `get object schema stmt error`
|
|
28
|
+
},
|
|
29
|
+
3004: {
|
|
30
|
+
message: `lazy insert`
|
|
31
|
+
},
|
|
32
|
+
3005: {
|
|
33
|
+
message: `drop all fail`
|
|
34
|
+
},
|
|
35
|
+
3006: {
|
|
36
|
+
message: `delete record error`
|
|
37
|
+
},
|
|
38
|
+
3007: {
|
|
39
|
+
message: `drop table error`
|
|
40
|
+
},
|
|
41
|
+
3008: {
|
|
42
|
+
message: `orderBy,order SQLRules Error`
|
|
43
|
+
},
|
|
44
|
+
3009: {
|
|
45
|
+
message: `createTableAndIndex, create table fail`
|
|
46
|
+
},
|
|
47
|
+
3010: {
|
|
48
|
+
message: `alter columns fail`
|
|
49
|
+
},
|
|
50
|
+
3011: {
|
|
51
|
+
message: `update record fail`
|
|
52
|
+
},
|
|
53
|
+
3012: {
|
|
54
|
+
message: `create index fail`
|
|
55
|
+
},
|
|
56
|
+
3013: {
|
|
57
|
+
message: `create table fail`
|
|
58
|
+
},
|
|
59
|
+
3014: {
|
|
60
|
+
message: `insertRecord`
|
|
61
|
+
},
|
|
62
|
+
3015: {
|
|
63
|
+
message: `fetch indexes error`
|
|
64
|
+
},
|
|
65
|
+
3016: {
|
|
66
|
+
message: `more than 1 unique_index in table`
|
|
67
|
+
},
|
|
68
|
+
4001: {
|
|
69
|
+
message: `priority state is wrong`
|
|
70
|
+
},
|
|
71
|
+
4002: {
|
|
72
|
+
message: `task type isn't function`
|
|
73
|
+
},
|
|
74
|
+
4003: {
|
|
75
|
+
message: `task type isn't array`
|
|
76
|
+
},
|
|
77
|
+
4004: {
|
|
78
|
+
message: `task not exist when try to delete`
|
|
79
|
+
},
|
|
80
|
+
4005: {
|
|
81
|
+
message: `state not valid`
|
|
82
|
+
},
|
|
83
|
+
4006: {
|
|
84
|
+
message: `task param should be async function`
|
|
85
|
+
},
|
|
86
|
+
4007: {
|
|
87
|
+
message: `除了runByTask以外, getTaskInfoDependOnPriority() 不能走到這裡, taskQueue裡面不能沒有Task`
|
|
88
|
+
},
|
|
89
|
+
4008: {
|
|
90
|
+
message: `如果要用runInBackground的task發生Error,就必須設定 backgoundtasklistener,不能讓task發生錯誤而沒有紀錄`
|
|
91
|
+
},
|
|
92
|
+
4009: {
|
|
93
|
+
message: `如果走到了這一層, 代表 Pooller runInBackGround() 在無預期的狀況下被停止了, 代表assign task throw ERROR, 請善用setTaskFailHandler()`
|
|
94
|
+
},
|
|
95
|
+
4010: {
|
|
96
|
+
message: `assign task timeout happen`
|
|
97
|
+
},
|
|
98
|
+
4011: {
|
|
99
|
+
message: `不能走到這裡, 目前被動式的機制只支援runByEachTask, runByParams`
|
|
100
|
+
},
|
|
101
|
+
8001: {
|
|
102
|
+
message: `append file fail`
|
|
103
|
+
},
|
|
104
|
+
8002: {
|
|
105
|
+
message: `open dir fail`
|
|
106
|
+
},
|
|
107
|
+
8003: {
|
|
108
|
+
message: `not file nor dictionary,should get it`
|
|
109
|
+
},
|
|
110
|
+
8004: {
|
|
111
|
+
message: `package exist in current path`
|
|
112
|
+
},
|
|
113
|
+
8005: {
|
|
114
|
+
message: `input name is not valid`
|
|
115
|
+
},
|
|
116
|
+
8006: {
|
|
117
|
+
message: `file exists when trying to copy`
|
|
118
|
+
},
|
|
119
|
+
8007: {
|
|
120
|
+
message: `alias exist in shell script`
|
|
121
|
+
},
|
|
122
|
+
8008: {
|
|
123
|
+
message: `persist folder fail`
|
|
124
|
+
},
|
|
125
|
+
8009: {
|
|
126
|
+
message: `copy folder should be exist`
|
|
127
|
+
},
|
|
128
|
+
8010: {
|
|
129
|
+
message: `the key can't exceed the length of 22`
|
|
130
|
+
},
|
|
131
|
+
8011: {
|
|
132
|
+
message: `beautify class fail,but let it pass`
|
|
133
|
+
},
|
|
134
|
+
8012: {
|
|
135
|
+
message: `incest props should define view,type either`
|
|
136
|
+
},
|
|
137
|
+
8013: {
|
|
138
|
+
message: `render view type is out of condition, check why`
|
|
139
|
+
},
|
|
140
|
+
8014: {
|
|
141
|
+
message: `type is not supported`
|
|
142
|
+
},
|
|
143
|
+
8015: {
|
|
144
|
+
message: `build firestore error`
|
|
145
|
+
},
|
|
146
|
+
8016: {
|
|
147
|
+
message: `class generator is necessary!!!`
|
|
148
|
+
},
|
|
149
|
+
8017: {
|
|
150
|
+
message: `className type is not valid!`
|
|
151
|
+
},
|
|
152
|
+
8018: {
|
|
153
|
+
message: `this platform is not supported`
|
|
154
|
+
},
|
|
155
|
+
8019: {
|
|
156
|
+
message: `find no source.js file`
|
|
157
|
+
},
|
|
158
|
+
8020: {
|
|
159
|
+
message: `package.json has something wrong`
|
|
160
|
+
},
|
|
161
|
+
9999: {
|
|
162
|
+
message: `super stupid error`
|
|
163
|
+
},
|
|
164
|
+
7001: {
|
|
165
|
+
message: `state is wrong`
|
|
166
|
+
},
|
|
167
|
+
7002: {
|
|
168
|
+
message: `initial should be override`
|
|
169
|
+
},
|
|
170
|
+
7003: {
|
|
171
|
+
message: `css style duplicated defined`
|
|
172
|
+
},
|
|
173
|
+
7004: {
|
|
174
|
+
message: `there's no ref target`
|
|
175
|
+
},
|
|
176
|
+
7005: {
|
|
177
|
+
message: `can't happen this param type`
|
|
178
|
+
},
|
|
179
|
+
7006: {
|
|
180
|
+
message: `view must instance of BaseComponent,otherwise found no root cause`
|
|
181
|
+
},
|
|
182
|
+
7007: {
|
|
183
|
+
message: `result result should be either succeed or fail`
|
|
184
|
+
},
|
|
185
|
+
7008: {
|
|
186
|
+
message: `in array can't be empty, otherwise it get abnormal next page`
|
|
187
|
+
},
|
|
188
|
+
6001: {
|
|
189
|
+
message: `single page work fail`
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
var _default = exports.default = ERRORs;
|
package/lib/exceptioner/index.js
CHANGED
|
@@ -1 +1,39 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _configerer = require("configerer");
|
|
9
|
+
var _ERRORs = _interopRequireDefault(require("./ERRORs"));
|
|
10
|
+
var _index = require("../index.js");
|
|
11
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
12
|
+
class MyException extends Error {
|
|
13
|
+
constructor(code, ...infos) {
|
|
14
|
+
const error = _ERRORs.default[code];
|
|
15
|
+
if (error === undefined) {
|
|
16
|
+
throw new MyException(9999, `code ''${code}'' is not define in ERRORs.js`);
|
|
17
|
+
}
|
|
18
|
+
super(`${error.message}`);
|
|
19
|
+
this.uid = _index.utiller === undefined ? '777Debug777' : _index.utiller.getRandomValue(0, 100000000000);
|
|
20
|
+
this.code = code;
|
|
21
|
+
this.infos = '';
|
|
22
|
+
this._msg = error.message;
|
|
23
|
+
for (const info of infos) {
|
|
24
|
+
if (info !== undefined) this.infos += '##' + ' ' + `${_index.utiller === undefined ? `777Debug777-${info}` : _index.utiller.getAttrValueInSequence(info, 'message', 'msg')}`;
|
|
25
|
+
}
|
|
26
|
+
this.message = `UID:${this.uid} CODE:${this.code} REASON:${this._msg} INFO:${this.infos}`;
|
|
27
|
+
if (_configerer.configerer.MODULE_MSG.SHOW_ERROR) _index.utiller.appendError(this.message);
|
|
28
|
+
}
|
|
29
|
+
static msg(msg) {
|
|
30
|
+
return JSON.stringify(msg);
|
|
31
|
+
}
|
|
32
|
+
getErrorCode() {
|
|
33
|
+
return this.code;
|
|
34
|
+
}
|
|
35
|
+
isConstraintError() {
|
|
36
|
+
return this.message && this.message.indexOf(`SQLITE_CONSTRAINT`) > 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
var _default = exports.default = MyException;
|
package/lib/index.js
CHANGED
|
@@ -1 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "exceptioner", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _exceptioner.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "pooller", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _pooller.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
exports.utiller = void 0;
|
|
20
|
+
var _exceptioner = _interopRequireDefault(require("./exceptioner"));
|
|
21
|
+
var _pooller = _interopRequireDefault(require("./pooller"));
|
|
22
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
23
|
+
let instance = exports.utiller = undefined;
|
|
24
|
+
if (process !== undefined && !_lodash.default.isUndefined(process.version) && !_lodash.default.isEmpty(process.version)) {
|
|
25
|
+
const self = require('./utiller/nodeutiller');
|
|
26
|
+
exports.utiller = instance = new self.default();
|
|
27
|
+
} else {
|
|
28
|
+
const self = require('./utiller/index');
|
|
29
|
+
exports.utiller = instance = new self.default();
|
|
30
|
+
}
|