oak-domain 2.5.2 → 2.6.2
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/actions/action.d.ts +16 -16
- package/lib/actions/action.js +17 -17
- package/lib/actions/relation.d.ts +5 -5
- package/lib/actions/relation.js +38 -38
- package/lib/base-app-domain/ActionDefDict.d.ts +8 -8
- package/lib/base-app-domain/ActionDefDict.js +9 -9
- package/lib/base-app-domain/EntityDict.d.ts +14 -14
- package/lib/base-app-domain/EntityDict.js +2 -2
- package/lib/base-app-domain/Modi/Action.d.ts +10 -10
- package/lib/base-app-domain/Modi/Action.js +14 -14
- package/lib/base-app-domain/Modi/Schema.d.ts +146 -146
- package/lib/base-app-domain/Modi/Schema.js +2 -2
- package/lib/base-app-domain/Modi/Storage.d.ts +3 -3
- package/lib/base-app-domain/Modi/Storage.js +60 -60
- package/lib/base-app-domain/ModiEntity/Schema.d.ts +189 -189
- package/lib/base-app-domain/ModiEntity/Schema.js +2 -2
- package/lib/base-app-domain/ModiEntity/Storage.d.ts +3 -3
- package/lib/base-app-domain/ModiEntity/Storage.js +27 -27
- package/lib/base-app-domain/Oper/Schema.d.ts +144 -144
- package/lib/base-app-domain/Oper/Schema.js +2 -2
- package/lib/base-app-domain/Oper/Storage.d.ts +3 -3
- package/lib/base-app-domain/Oper/Storage.js +29 -29
- package/lib/base-app-domain/OperEntity/Schema.d.ts +205 -205
- package/lib/base-app-domain/OperEntity/Schema.js +2 -2
- package/lib/base-app-domain/OperEntity/Storage.d.ts +3 -3
- package/lib/base-app-domain/OperEntity/Storage.js +27 -27
- package/lib/base-app-domain/Storage.d.ts +3 -3
- package/lib/base-app-domain/Storage.js +17 -17
- package/lib/base-app-domain/User/Action.d.ts +10 -10
- package/lib/base-app-domain/User/Action.js +12 -12
- package/lib/base-app-domain/User/Schema.d.ts +180 -180
- package/lib/base-app-domain/User/Schema.js +2 -2
- package/lib/base-app-domain/User/Storage.d.ts +3 -3
- package/lib/base-app-domain/User/Storage.js +36 -36
- package/lib/base-app-domain/UserEntityGrant/Schema.d.ts +121 -121
- package/lib/base-app-domain/UserEntityGrant/Schema.js +2 -2
- package/lib/base-app-domain/UserEntityGrant/Storage.d.ts +3 -3
- package/lib/base-app-domain/UserEntityGrant/Storage.js +28 -28
- package/lib/base-app-domain/_SubQuery.d.ts +44 -44
- package/lib/base-app-domain/_SubQuery.js +2 -2
- package/lib/base-app-domain/index.d.ts +3 -3
- package/lib/base-app-domain/index.js +6 -6
- package/lib/checkers/index.d.ts +5 -5
- package/lib/checkers/index.js +16 -16
- package/lib/compiler/env.d.ts +11 -11
- package/lib/compiler/env.js +39 -39
- package/lib/compiler/schemalBuilder.d.ts +2 -2
- package/lib/compiler/schemalBuilder.js +3355 -3355
- package/lib/compiler/uiBuilder.d.ts +1 -1
- package/lib/compiler/uiBuilder.js +3 -3
- package/lib/entities/Modi.d.ts +11 -11
- package/lib/entities/Modi.js +46 -46
- package/lib/entities/ModiEntity.d.ts +8 -8
- package/lib/entities/ModiEntity.js +15 -15
- package/lib/entities/Oper.d.ts +10 -10
- package/lib/entities/Oper.js +17 -17
- package/lib/entities/OperEntity.d.ts +8 -8
- package/lib/entities/OperEntity.js +15 -15
- package/lib/entities/User.d.ts +8 -8
- package/lib/entities/User.js +28 -28
- package/lib/entities/UserEntityGrant.d.ts +7 -7
- package/lib/entities/UserEntityGrant.js +12 -12
- package/lib/store/AsyncRowStore.d.ts +51 -48
- package/lib/store/AsyncRowStore.js +189 -183
- package/lib/store/CascadeStore.d.ts +91 -91
- package/lib/store/CascadeStore.js +1634 -1603
- package/lib/store/SyncRowStore.d.ts +29 -29
- package/lib/store/SyncRowStore.js +48 -48
- package/lib/store/TriggerExecutor.d.ts +32 -32
- package/lib/store/TriggerExecutor.js +532 -532
- package/lib/store/actionDef.d.ts +9 -9
- package/lib/store/actionDef.js +333 -333
- package/lib/store/checker.d.ts +26 -26
- package/lib/store/checker.js +829 -867
- package/lib/store/filter.d.ts +109 -109
- package/lib/store/filter.js +893 -893
- package/lib/store/modi.d.ts +13 -13
- package/lib/store/modi.js +216 -216
- package/lib/store/relation.d.ts +13 -13
- package/lib/store/relation.js +66 -66
- package/lib/store/selection.d.ts +19 -7
- package/lib/store/selection.js +265 -238
- package/lib/triggers/index.d.ts +6 -6
- package/lib/triggers/index.js +11 -11
- package/lib/triggers/modi.d.ts +5 -5
- package/lib/triggers/modi.js +72 -72
- package/lib/types/Action.d.ts +20 -20
- package/lib/types/Action.js +2 -2
- package/lib/types/AppLoader.d.ts +11 -11
- package/lib/types/AppLoader.js +10 -10
- package/lib/types/Aspect.d.ts +13 -12
- package/lib/types/Aspect.js +4 -4
- package/lib/types/Auth.d.ts +69 -69
- package/lib/types/Auth.js +2 -2
- package/lib/types/Connector.d.ts +27 -26
- package/lib/types/Connector.js +9 -9
- package/lib/types/Context.d.ts +7 -7
- package/lib/types/Context.js +3 -3
- package/lib/types/DataType.d.ts +18 -18
- package/lib/types/DataType.js +5 -5
- package/lib/types/Demand.d.ts +77 -77
- package/lib/types/Demand.js +9 -9
- package/lib/types/Endpoint.d.ts +11 -11
- package/lib/types/Endpoint.js +3 -3
- package/lib/types/Entity.d.ts +183 -183
- package/lib/types/Entity.js +14 -14
- package/lib/types/Exception.d.ts +100 -98
- package/lib/types/Exception.js +327 -283
- package/lib/types/Expression.d.ts +163 -163
- package/lib/types/Expression.js +427 -427
- package/lib/types/Geo.d.ts +18 -18
- package/lib/types/Geo.js +2 -2
- package/lib/types/Locale.d.ts +24 -24
- package/lib/types/Locale.js +2 -2
- package/lib/types/Logger.d.ts +5 -5
- package/lib/types/Logger.js +3 -3
- package/lib/types/Polyfill.d.ts +23 -23
- package/lib/types/Polyfill.js +2 -2
- package/lib/types/Port.d.ts +17 -17
- package/lib/types/Port.js +2 -2
- package/lib/types/RowStore.d.ts +12 -12
- package/lib/types/RowStore.js +34 -34
- package/lib/types/Storage.d.ts +56 -56
- package/lib/types/Storage.js +2 -2
- package/lib/types/Timer.d.ts +13 -13
- package/lib/types/Timer.js +2 -2
- package/lib/types/Trigger.d.ts +109 -109
- package/lib/types/Trigger.js +49 -49
- package/lib/types/Txn.d.ts +2 -2
- package/lib/types/Txn.js +3 -3
- package/lib/types/Watcher.d.ts +19 -19
- package/lib/types/Watcher.js +4 -4
- package/lib/types/index.d.ts +21 -21
- package/lib/types/index.js +24 -24
- package/lib/types/schema/DataTypes.d.ts +32 -32
- package/lib/types/schema/DataTypes.js +3 -3
- package/lib/utils/SimpleConnector.d.ts +35 -30
- package/lib/utils/SimpleConnector.js +134 -117
- package/lib/utils/assert.d.ts +5 -5
- package/lib/utils/assert.js +9 -9
- package/lib/utils/concurrent.d.ts +15 -15
- package/lib/utils/concurrent.js +89 -89
- package/lib/utils/cron.d.ts +1 -1
- package/lib/utils/cron.js +18 -18
- package/lib/utils/date.d.ts +1 -1
- package/lib/utils/date.js +18 -18
- package/lib/utils/geo.d.ts +4 -4
- package/lib/utils/geo.js +24 -24
- package/lib/utils/lodash.d.ts +20 -20
- package/lib/utils/lodash.js +55 -55
- package/lib/utils/random/random.d.ts +1 -1
- package/lib/utils/random/random.js +24 -24
- package/lib/utils/random/random.mp.d.ts +1 -1
- package/lib/utils/random/random.mp.js +25 -25
- package/lib/utils/random/random.web.d.ts +1 -1
- package/lib/utils/random/random.web.js +17 -17
- package/lib/utils/string.d.ts +22 -22
- package/lib/utils/string.js +70 -70
- package/lib/utils/url.d.ts +1 -0
- package/lib/utils/url.js +12 -0
- package/lib/utils/uuid.d.ts +12 -12
- package/lib/utils/uuid.js +194 -194
- package/lib/utils/validator.d.ts +23 -23
- package/lib/utils/validator.js +123 -123
- package/package.json +48 -48
- package/src/entities/Modi.ts +68 -68
- package/src/entities/ModiEntity.ts +24 -24
- package/src/entities/Oper.ts +28 -28
- package/src/entities/OperEntity.ts +24 -24
- package/src/entities/User.ts +44 -44
- package/src/entities/UserEntityGrant.ts +24 -24
package/lib/types/Exception.js
CHANGED
|
@@ -1,283 +1,327 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakUserUnpermittedException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakUserException = exports.OakExternalException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakImportDataParseException = exports.OakUniqueViolationException = exports.OakDataException = exports.OakException = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
_this
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return
|
|
82
|
-
}
|
|
83
|
-
return
|
|
84
|
-
}(
|
|
85
|
-
exports.
|
|
86
|
-
var
|
|
87
|
-
tslib_1.__extends(
|
|
88
|
-
function
|
|
89
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
90
|
-
}
|
|
91
|
-
return
|
|
92
|
-
}(
|
|
93
|
-
exports.
|
|
94
|
-
var
|
|
95
|
-
tslib_1.__extends(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
*
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
_this
|
|
137
|
-
|
|
138
|
-
return _this;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
return this
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
case '
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
return
|
|
272
|
-
}
|
|
273
|
-
case '
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakUserUnpermittedException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakUserException = exports.OakExternalException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakImportDataParseException = exports.OakUniqueViolationException = exports.OakDataException = exports.OakException = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
|
+
var OakException = /** @class */ (function (_super) {
|
|
7
|
+
tslib_1.__extends(OakException, _super);
|
|
8
|
+
function OakException(message) {
|
|
9
|
+
var _newTarget = this.constructor;
|
|
10
|
+
var _this = _super.call(this, message) || this;
|
|
11
|
+
_this.name = _newTarget.name;
|
|
12
|
+
if (typeof Error.captureStackTrace === 'function') {
|
|
13
|
+
Error.captureStackTrace(_this, _newTarget);
|
|
14
|
+
}
|
|
15
|
+
if (typeof Object.setPrototypeOf === 'function') {
|
|
16
|
+
Object.setPrototypeOf(_this, _newTarget.prototype);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
_this.__proto__ = _newTarget.prototype;
|
|
20
|
+
}
|
|
21
|
+
_this.opRecord = {
|
|
22
|
+
a: 's',
|
|
23
|
+
d: {},
|
|
24
|
+
};
|
|
25
|
+
return _this;
|
|
26
|
+
}
|
|
27
|
+
OakException.prototype.addData = function (entity, rows) {
|
|
28
|
+
var d = this.opRecord.d;
|
|
29
|
+
var addSingleRow = function (rowRoot, row) {
|
|
30
|
+
var id = row.id;
|
|
31
|
+
if (rowRoot[id]) {
|
|
32
|
+
Object.assign(rowRoot[id], row);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
rowRoot[id] = row;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
if (!d[entity]) {
|
|
39
|
+
d[entity] = {};
|
|
40
|
+
}
|
|
41
|
+
rows.forEach(function (row) { return addSingleRow(d[entity], row); });
|
|
42
|
+
};
|
|
43
|
+
OakException.prototype.setOpRecords = function (opRecord) {
|
|
44
|
+
this.opRecord = opRecord;
|
|
45
|
+
};
|
|
46
|
+
OakException.prototype.toString = function () {
|
|
47
|
+
return JSON.stringify({
|
|
48
|
+
name: this.constructor.name,
|
|
49
|
+
message: this.message,
|
|
50
|
+
opRecord: this.opRecord,
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
return OakException;
|
|
54
|
+
}(Error));
|
|
55
|
+
exports.OakException = OakException;
|
|
56
|
+
var OakDataException = /** @class */ (function (_super) {
|
|
57
|
+
tslib_1.__extends(OakDataException, _super);
|
|
58
|
+
function OakDataException() {
|
|
59
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
60
|
+
}
|
|
61
|
+
return OakDataException;
|
|
62
|
+
}(OakException));
|
|
63
|
+
exports.OakDataException = OakDataException;
|
|
64
|
+
var OakUniqueViolationException = /** @class */ (function (_super) {
|
|
65
|
+
tslib_1.__extends(OakUniqueViolationException, _super);
|
|
66
|
+
function OakUniqueViolationException(rows, message) {
|
|
67
|
+
var _this = _super.call(this, message || '您更新的数据违反了唯一性约束') || this;
|
|
68
|
+
_this.rows = rows;
|
|
69
|
+
return _this;
|
|
70
|
+
}
|
|
71
|
+
return OakUniqueViolationException;
|
|
72
|
+
}(OakException));
|
|
73
|
+
exports.OakUniqueViolationException = OakUniqueViolationException;
|
|
74
|
+
var OakImportDataParseException = /** @class */ (function (_super) {
|
|
75
|
+
tslib_1.__extends(OakImportDataParseException, _super);
|
|
76
|
+
// message必传,描述具体错误的数据内容
|
|
77
|
+
function OakImportDataParseException(message, line, header) {
|
|
78
|
+
var _this = _super.call(this, message) || this;
|
|
79
|
+
_this.line = line;
|
|
80
|
+
_this.header = header;
|
|
81
|
+
return _this;
|
|
82
|
+
}
|
|
83
|
+
return OakImportDataParseException;
|
|
84
|
+
}(OakException));
|
|
85
|
+
exports.OakImportDataParseException = OakImportDataParseException;
|
|
86
|
+
var OakOperExistedException = /** @class */ (function (_super) {
|
|
87
|
+
tslib_1.__extends(OakOperExistedException, _super);
|
|
88
|
+
function OakOperExistedException() {
|
|
89
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
90
|
+
}
|
|
91
|
+
return OakOperExistedException;
|
|
92
|
+
}(OakDataException));
|
|
93
|
+
exports.OakOperExistedException = OakOperExistedException;
|
|
94
|
+
var OakRowUnexistedException = /** @class */ (function (_super) {
|
|
95
|
+
tslib_1.__extends(OakRowUnexistedException, _super);
|
|
96
|
+
// 指定主键查询时却发现行不存在,一般发生在缓存中
|
|
97
|
+
function OakRowUnexistedException(rows) {
|
|
98
|
+
var _this = _super.call(this, "\u67E5\u8BE2".concat(rows.map(function (ele) { return ele.entity; }).join(','), "\u5BF9\u8C61\u65F6\u53D1\u73B0\u4E86\u7A7A\u6307\u9488\uFF0C\u8BF7\u68C0\u67E5\u6570\u636E\u4E00\u81F4\u6027")) || this;
|
|
99
|
+
_this.rows = rows;
|
|
100
|
+
return _this;
|
|
101
|
+
}
|
|
102
|
+
OakRowUnexistedException.prototype.toString = function () {
|
|
103
|
+
return JSON.stringify({ rows: this.rows });
|
|
104
|
+
};
|
|
105
|
+
OakRowUnexistedException.prototype.getRows = function () {
|
|
106
|
+
return this.rows;
|
|
107
|
+
};
|
|
108
|
+
return OakRowUnexistedException;
|
|
109
|
+
}(OakDataException));
|
|
110
|
+
exports.OakRowUnexistedException = OakRowUnexistedException;
|
|
111
|
+
var OakExternalException = /** @class */ (function (_super) {
|
|
112
|
+
tslib_1.__extends(OakExternalException, _super);
|
|
113
|
+
function OakExternalException() {
|
|
114
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
115
|
+
}
|
|
116
|
+
return OakExternalException;
|
|
117
|
+
}(Error));
|
|
118
|
+
exports.OakExternalException = OakExternalException;
|
|
119
|
+
var OakUserException = /** @class */ (function (_super) {
|
|
120
|
+
tslib_1.__extends(OakUserException, _super);
|
|
121
|
+
function OakUserException() {
|
|
122
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
123
|
+
}
|
|
124
|
+
return OakUserException;
|
|
125
|
+
}(OakException));
|
|
126
|
+
exports.OakUserException = OakUserException;
|
|
127
|
+
;
|
|
128
|
+
// 在系统更新数据时,以下三个异常应按规范依次抛出。
|
|
129
|
+
/**
|
|
130
|
+
* 数据不一致异常,系统认为现有的数据不允许相应的动作时抛此异常
|
|
131
|
+
*
|
|
132
|
+
*/
|
|
133
|
+
var OakRowInconsistencyException = /** @class */ (function (_super) {
|
|
134
|
+
tslib_1.__extends(OakRowInconsistencyException, _super);
|
|
135
|
+
function OakRowInconsistencyException(data, message) {
|
|
136
|
+
var _this = _super.call(this, message) || this;
|
|
137
|
+
(0, assert_1.default)(!data, '现在使用addData接口来传数据');
|
|
138
|
+
return _this;
|
|
139
|
+
}
|
|
140
|
+
OakRowInconsistencyException.prototype.toString = function () {
|
|
141
|
+
return JSON.stringify({
|
|
142
|
+
name: this.constructor.name,
|
|
143
|
+
message: this.message,
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
return OakRowInconsistencyException;
|
|
147
|
+
}(OakUserException));
|
|
148
|
+
exports.OakRowInconsistencyException = OakRowInconsistencyException;
|
|
149
|
+
;
|
|
150
|
+
/**
|
|
151
|
+
* 当输入的数据非法时抛此异常,attributes表示非法的属性
|
|
152
|
+
*/
|
|
153
|
+
var OakInputIllegalException = /** @class */ (function (_super) {
|
|
154
|
+
tslib_1.__extends(OakInputIllegalException, _super);
|
|
155
|
+
function OakInputIllegalException(entity, attributes, message) {
|
|
156
|
+
var _this = _super.call(this, message) || this;
|
|
157
|
+
_this.entity = entity;
|
|
158
|
+
_this.attributes = attributes;
|
|
159
|
+
return _this;
|
|
160
|
+
}
|
|
161
|
+
OakInputIllegalException.prototype.getEntity = function () {
|
|
162
|
+
return this.entity;
|
|
163
|
+
};
|
|
164
|
+
OakInputIllegalException.prototype.getAttributes = function () {
|
|
165
|
+
return this.attributes;
|
|
166
|
+
};
|
|
167
|
+
OakInputIllegalException.prototype.addAttributesPrefix = function (prefix) {
|
|
168
|
+
this.attributes = this.attributes.map(function (ele) { return "".concat(prefix, ".").concat(ele); });
|
|
169
|
+
};
|
|
170
|
+
OakInputIllegalException.prototype.toString = function () {
|
|
171
|
+
return JSON.stringify({
|
|
172
|
+
entity: this.entity,
|
|
173
|
+
name: this.constructor.name,
|
|
174
|
+
message: this.message,
|
|
175
|
+
attributes: this.attributes,
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
return OakInputIllegalException;
|
|
179
|
+
}(OakUserException));
|
|
180
|
+
exports.OakInputIllegalException = OakInputIllegalException;
|
|
181
|
+
;
|
|
182
|
+
/**
|
|
183
|
+
* 用户权限不够时抛的异常
|
|
184
|
+
*/
|
|
185
|
+
var OakUserUnpermittedException = /** @class */ (function (_super) {
|
|
186
|
+
tslib_1.__extends(OakUserUnpermittedException, _super);
|
|
187
|
+
function OakUserUnpermittedException() {
|
|
188
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
189
|
+
}
|
|
190
|
+
return OakUserUnpermittedException;
|
|
191
|
+
}(OakUserException));
|
|
192
|
+
exports.OakUserUnpermittedException = OakUserUnpermittedException;
|
|
193
|
+
;
|
|
194
|
+
/**
|
|
195
|
+
* 用户未登录抛的异常
|
|
196
|
+
*/
|
|
197
|
+
var OakUnloggedInException = /** @class */ (function (_super) {
|
|
198
|
+
tslib_1.__extends(OakUnloggedInException, _super);
|
|
199
|
+
function OakUnloggedInException(message) {
|
|
200
|
+
return _super.call(this, message || '您尚未登录') || this;
|
|
201
|
+
}
|
|
202
|
+
return OakUnloggedInException;
|
|
203
|
+
}(OakUserException));
|
|
204
|
+
exports.OakUnloggedInException = OakUnloggedInException;
|
|
205
|
+
;
|
|
206
|
+
/**
|
|
207
|
+
* 用户未登录抛的异常
|
|
208
|
+
*/
|
|
209
|
+
var OakRowLockedException = /** @class */ (function (_super) {
|
|
210
|
+
tslib_1.__extends(OakRowLockedException, _super);
|
|
211
|
+
function OakRowLockedException(message) {
|
|
212
|
+
return _super.call(this, message || '该行数据正在被更新中,请稍后再试') || this;
|
|
213
|
+
}
|
|
214
|
+
return OakRowLockedException;
|
|
215
|
+
}(OakUserException));
|
|
216
|
+
exports.OakRowLockedException = OakRowLockedException;
|
|
217
|
+
;
|
|
218
|
+
/**
|
|
219
|
+
* 要插入行时,发现已经有相同的行数据
|
|
220
|
+
*/
|
|
221
|
+
var OakCongruentRowExists = /** @class */ (function (_super) {
|
|
222
|
+
tslib_1.__extends(OakCongruentRowExists, _super);
|
|
223
|
+
function OakCongruentRowExists(entity, data, message) {
|
|
224
|
+
var _this = _super.call(this, message) || this;
|
|
225
|
+
_this.data = data;
|
|
226
|
+
_this.entity = entity;
|
|
227
|
+
return _this;
|
|
228
|
+
}
|
|
229
|
+
OakCongruentRowExists.prototype.getData = function () {
|
|
230
|
+
return this.data;
|
|
231
|
+
};
|
|
232
|
+
OakCongruentRowExists.prototype.getEntity = function () {
|
|
233
|
+
return this.entity;
|
|
234
|
+
};
|
|
235
|
+
OakCongruentRowExists.prototype.toString = function () {
|
|
236
|
+
return JSON.stringify({
|
|
237
|
+
name: this.constructor.name,
|
|
238
|
+
message: this.message,
|
|
239
|
+
data: this.data,
|
|
240
|
+
entity: this.entity,
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
return OakCongruentRowExists;
|
|
244
|
+
}(OakUserException));
|
|
245
|
+
exports.OakCongruentRowExists = OakCongruentRowExists;
|
|
246
|
+
var OakDeadlock = /** @class */ (function (_super) {
|
|
247
|
+
tslib_1.__extends(OakDeadlock, _super);
|
|
248
|
+
function OakDeadlock(message) {
|
|
249
|
+
return _super.call(this, message || '发现死锁') || this;
|
|
250
|
+
}
|
|
251
|
+
return OakDeadlock;
|
|
252
|
+
}(OakUserException));
|
|
253
|
+
exports.OakDeadlock = OakDeadlock;
|
|
254
|
+
;
|
|
255
|
+
function makeException(data) {
|
|
256
|
+
var name = data.name;
|
|
257
|
+
switch (name) {
|
|
258
|
+
case 'OakException': {
|
|
259
|
+
var e = new OakException(data.message);
|
|
260
|
+
e.setOpRecords(data.opRecords);
|
|
261
|
+
return e;
|
|
262
|
+
}
|
|
263
|
+
case 'OakUserException': {
|
|
264
|
+
var e = new OakUserException(data.message);
|
|
265
|
+
e.setOpRecords(data.opRecords);
|
|
266
|
+
return e;
|
|
267
|
+
}
|
|
268
|
+
case 'OakRowInconsistencyException': {
|
|
269
|
+
var e = new OakRowInconsistencyException(data.data, data.message);
|
|
270
|
+
e.setOpRecords(data.opRecords);
|
|
271
|
+
return e;
|
|
272
|
+
}
|
|
273
|
+
case 'OakInputIllegalException': {
|
|
274
|
+
var e = new OakInputIllegalException(data.entity, data.attributes, data.message);
|
|
275
|
+
e.setOpRecords(data.opRecords);
|
|
276
|
+
return e;
|
|
277
|
+
}
|
|
278
|
+
case 'OakUserUnpermittedException': {
|
|
279
|
+
var e = new OakUserUnpermittedException(data.message);
|
|
280
|
+
e.setOpRecords(data.opRecords);
|
|
281
|
+
return e;
|
|
282
|
+
}
|
|
283
|
+
case 'OakUnloggedInException': {
|
|
284
|
+
var e = new OakUnloggedInException(data.message);
|
|
285
|
+
e.setOpRecords(data.opRecords);
|
|
286
|
+
return e;
|
|
287
|
+
}
|
|
288
|
+
case 'OakCongruentRowExists': {
|
|
289
|
+
var e = new OakCongruentRowExists(data.entity, data.data, data.message);
|
|
290
|
+
e.setOpRecords(data.opRecords);
|
|
291
|
+
return e;
|
|
292
|
+
}
|
|
293
|
+
case 'OakRowLockedException': {
|
|
294
|
+
var e = new OakRowLockedException(data.message);
|
|
295
|
+
e.setOpRecords(data.opRecords);
|
|
296
|
+
return e;
|
|
297
|
+
}
|
|
298
|
+
case 'OakRowUnexistedException': {
|
|
299
|
+
var e = new OakRowUnexistedException(data.rows);
|
|
300
|
+
e.setOpRecords(data.opRecords);
|
|
301
|
+
return e;
|
|
302
|
+
}
|
|
303
|
+
case 'OakDeadlock': {
|
|
304
|
+
var e = new OakDeadlock(data.message);
|
|
305
|
+
e.setOpRecords(data.opRecords);
|
|
306
|
+
return e;
|
|
307
|
+
}
|
|
308
|
+
case 'OakDataException': {
|
|
309
|
+
var e = new OakDataException(data.message);
|
|
310
|
+
e.setOpRecords(data.opRecords);
|
|
311
|
+
return e;
|
|
312
|
+
}
|
|
313
|
+
case 'OakUniqueViolationException': {
|
|
314
|
+
var e = new OakUniqueViolationException(data.rows, data.message);
|
|
315
|
+
e.setOpRecords(data.opRecords);
|
|
316
|
+
return e;
|
|
317
|
+
}
|
|
318
|
+
case 'OakImportDataParseException': {
|
|
319
|
+
var e = new OakImportDataParseException(data.message, data.line, data.header);
|
|
320
|
+
e.setOpRecords(data.opRecords);
|
|
321
|
+
return e;
|
|
322
|
+
}
|
|
323
|
+
default:
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
exports.makeException = makeException;
|