oak-domain 4.0.1 → 4.0.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 +25 -25
- package/lib/base-app-domain/ActionAuth/Schema.d.ts +186 -186
- package/lib/base-app-domain/ActionAuth/Storage.js +39 -39
- 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 +28 -28
- package/lib/base-app-domain/I18n/Schema.d.ts +129 -129
- package/lib/base-app-domain/I18n/Schema.js +2 -2
- package/lib/base-app-domain/I18n/Storage.d.ts +3 -3
- package/lib/base-app-domain/I18n/Storage.js +59 -59
- 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 +136 -136
- package/lib/base-app-domain/Modi/Storage.js +63 -63
- package/lib/base-app-domain/ModiEntity/Schema.d.ts +384 -384
- package/lib/base-app-domain/ModiEntity/Storage.js +30 -30
- package/lib/base-app-domain/Oper/Schema.d.ts +153 -153
- package/lib/base-app-domain/Oper/Storage.js +38 -38
- package/lib/base-app-domain/OperEntity/Schema.d.ts +373 -373
- package/lib/base-app-domain/OperEntity/Storage.js +30 -30
- package/lib/base-app-domain/Path/Schema.d.ts +149 -149
- package/lib/base-app-domain/Path/Schema.js +2 -2
- package/lib/base-app-domain/Path/Storage.d.ts +3 -3
- package/lib/base-app-domain/Path/Storage.js +54 -54
- package/lib/base-app-domain/Relation/Schema.d.ts +188 -188
- package/lib/base-app-domain/Relation/Storage.js +54 -54
- package/lib/base-app-domain/Relation.d.ts +2 -2
- package/lib/base-app-domain/Relation.js +4 -4
- package/lib/base-app-domain/RelationAuth/Schema.d.ts +214 -214
- package/lib/base-app-domain/RelationAuth/Storage.js +44 -44
- package/lib/base-app-domain/Storage.js +31 -31
- 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 +210 -210
- package/lib/base-app-domain/User/Storage.js +33 -33
- package/lib/base-app-domain/UserEntityClaim/Schema.d.ts +264 -264
- package/lib/base-app-domain/UserEntityClaim/Schema.js +2 -2
- package/lib/base-app-domain/UserEntityClaim/Storage.d.ts +3 -3
- package/lib/base-app-domain/UserEntityClaim/Storage.js +37 -37
- package/lib/base-app-domain/UserEntityGrant/Schema.d.ts +131 -131
- package/lib/base-app-domain/UserEntityGrant/Storage.js +25 -25
- package/lib/base-app-domain/UserRelation/Schema.d.ts +208 -208
- package/lib/base-app-domain/UserRelation/Storage.js +56 -56
- package/lib/base-app-domain/_SubQuery.d.ts +142 -142
- package/lib/base-app-domain/index.d.ts +4 -4
- package/lib/base-app-domain/index.js +7 -7
- package/lib/checkers/index.d.ts +5 -5
- package/lib/checkers/index.js +13 -13
- package/lib/compiler/entities.d.ts +2 -2
- package/lib/compiler/entities.js +7 -7
- package/lib/compiler/env.d.ts +13 -13
- package/lib/compiler/env.js +45 -45
- package/lib/compiler/localeBuilder.d.ts +27 -27
- package/lib/compiler/localeBuilder.js +37 -8
- package/lib/compiler/routerBuilder.d.ts +1 -0
- package/lib/compiler/routerBuilder.js +257 -0
- package/lib/compiler/schemalBuilder.d.ts +27 -27
- package/lib/compiler/schemalBuilder.js +3565 -3565
- package/lib/entities/ActionAuth.d.ts +10 -10
- package/lib/entities/ActionAuth.js +31 -31
- package/lib/entities/I18n.d.ts +9 -9
- package/lib/entities/I18n.js +36 -36
- package/lib/entities/Modi.js +49 -49
- package/lib/entities/ModiEntity.js +18 -18
- package/lib/entities/Oper.js +21 -21
- package/lib/entities/OperEntity.js +18 -18
- package/lib/entities/Path.d.ts +8 -8
- package/lib/entities/Path.js +35 -35
- package/lib/entities/Relation.d.ts +8 -8
- package/lib/entities/Relation.js +35 -35
- package/lib/entities/RelationAuth.d.ts +8 -8
- package/lib/entities/RelationAuth.js +34 -34
- package/lib/entities/User.js +31 -31
- package/lib/entities/UserEntityClaim.d.ts +13 -13
- package/lib/entities/UserEntityClaim.js +17 -17
- package/lib/entities/UserEntityGrant.d.ts +9 -9
- package/lib/entities/UserEntityGrant.js +15 -15
- package/lib/entities/UserRelation.d.ts +10 -10
- package/lib/entities/UserRelation.js +38 -38
- package/lib/index.d.ts +23 -23
- package/lib/index.js +37 -37
- package/lib/store/AsyncRowStore.d.ts +65 -65
- package/lib/store/AsyncRowStore.js +176 -176
- package/lib/store/CascadeStore.d.ts +4 -1
- package/lib/store/CascadeStore.js +9 -1
- package/lib/store/RelationAuth.d.ts +96 -96
- package/lib/store/RelationAuth.js +1336 -1336
- package/lib/store/SyncRowStore.d.ts +29 -29
- package/lib/store/SyncRowStore.js +50 -50
- package/lib/store/TriggerExecutor.d.ts +41 -41
- package/lib/store/TriggerExecutor.js +1 -1
- package/lib/store/actionAuth.d.ts +4 -4
- package/lib/store/actionAuth.js +25 -25
- package/lib/store/actionDef.d.ts +10 -10
- package/lib/store/actionDef.js +4 -4
- package/lib/store/checker.d.ts +26 -26
- package/lib/store/checker.js +487 -487
- package/lib/store/filter.d.ts +85 -85
- package/lib/store/filter.js +1652 -1652
- package/lib/store/modi.d.ts +13 -13
- package/lib/store/modi.js +254 -254
- package/lib/store/relation.d.ts +12 -12
- package/lib/store/relation.js +67 -67
- package/lib/timers/oper.d.ts +18 -18
- package/lib/timers/oper.js +57 -57
- package/lib/timers/vaccum.d.ts +20 -20
- package/lib/timers/vaccum.js +111 -111
- package/lib/triggers/index.d.ts +5 -5
- package/lib/triggers/index.js +8 -8
- package/lib/types/Action.d.ts +20 -20
- package/lib/types/AppLoader.d.ts +17 -17
- package/lib/types/AppLoader.js +10 -10
- package/lib/types/Auth.d.ts +70 -70
- package/lib/types/Cluster.d.ts +5 -5
- package/lib/types/Cluster.js +2 -2
- package/lib/types/Connector.d.ts +38 -38
- package/lib/types/Connector.js +2 -2
- package/lib/types/DataType.d.ts +25 -25
- package/lib/types/DataType.js +6 -6
- package/lib/types/Demand.d.ts +89 -89
- package/lib/types/Demand.js +10 -10
- package/lib/types/Endpoint.d.ts +11 -11
- package/lib/types/Entity.d.ts +209 -209
- package/lib/types/Entity.js +15 -15
- package/lib/types/EntityDesc.d.ts +9 -9
- package/lib/types/EntityDesc.js +2 -2
- package/lib/types/Environment.d.ts +90 -90
- package/lib/types/Environment.js +2 -2
- package/lib/types/Exception.d.ts +147 -147
- package/lib/types/Exception.js +406 -406
- package/lib/types/Expression.d.ts +163 -163
- package/lib/types/Expression.js +397 -397
- package/lib/types/Geo.d.ts +18 -18
- package/lib/types/Locale.d.ts +25 -25
- package/lib/types/Logger.d.ts +6 -6
- package/lib/types/Polyfill.d.ts +24 -24
- package/lib/types/Port.d.ts +18 -18
- package/lib/types/RowStore.d.ts +19 -19
- package/lib/types/RowStore.js +33 -33
- package/lib/types/Storage.d.ts +58 -58
- package/lib/types/Style.d.ts +11 -11
- package/lib/types/Timer.d.ts +20 -20
- package/lib/types/Trigger.d.ts +118 -118
- package/lib/types/Trigger.js +35 -35
- package/lib/types/Watcher.d.ts +19 -19
- package/lib/types/index.d.ts +26 -26
- package/lib/types/index.js +29 -29
- package/lib/types/schema/DataTypes.d.ts +34 -34
- package/lib/utils/SimpleConnector.d.ts +64 -64
- package/lib/utils/SimpleConnector.js +1 -1
- package/lib/utils/assert.d.ts +1 -0
- package/lib/utils/assert.js +9 -9
- package/lib/utils/concurrent.d.ts +15 -15
- package/lib/utils/concurrent.js +63 -63
- package/lib/utils/date.js +18 -18
- package/lib/utils/domain.d.ts +1 -1
- package/lib/utils/domain.js +11 -11
- package/lib/utils/geo.js +24 -24
- package/lib/utils/lodash.d.ts +24 -24
- package/lib/utils/lodash.js +46 -46
- package/lib/utils/mask.js +34 -34
- package/lib/utils/money.d.ts +6 -6
- package/lib/utils/money.js +51 -51
- package/lib/utils/projection.d.ts +4 -4
- package/lib/utils/projection.js +15 -15
- package/lib/utils/random/random.js +19 -19
- package/lib/utils/random/random.mp.js +14 -14
- package/lib/utils/random/random.native.d.ts +1 -1
- package/lib/utils/random/random.native.js +14 -14
- package/lib/utils/random/random.web.js +11 -11
- package/lib/utils/string.d.ts +28 -28
- package/lib/utils/string.js +69 -69
- package/lib/utils/url/index.d.ts +7 -7
- package/lib/utils/url/index.js +8 -8
- package/lib/utils/url/index.mp.d.ts +3 -3
- package/lib/utils/url/index.mp.js +8 -8
- package/lib/utils/url/index.native.d.ts +12 -12
- package/lib/utils/url/index.native.js +7 -7
- package/lib/utils/url/index.web.d.ts +12 -12
- package/lib/utils/url/index.web.js +7 -7
- package/lib/utils/url/whatwg-url/index.d.ts +3 -3
- package/lib/utils/url/whatwg-url/index.js +16 -16
- package/lib/utils/url/whatwg-url/lib/URL-impl.d.ts +20 -20
- package/lib/utils/url/whatwg-url/lib/URL-impl.js +175 -175
- package/lib/utils/url/whatwg-url/lib/URL.d.ts +1 -1
- package/lib/utils/url/whatwg-url/lib/URL.js +298 -298
- package/lib/utils/url/whatwg-url/lib/URLSearchParams-impl.d.ts +19 -19
- package/lib/utils/url/whatwg-url/lib/URLSearchParams-impl.js +126 -126
- package/lib/utils/url/whatwg-url/lib/URLSearchParams.d.ts +1 -1
- package/lib/utils/url/whatwg-url/lib/URLSearchParams.js +426 -426
- package/lib/utils/url/whatwg-url/lib/infra.d.ts +12 -12
- package/lib/utils/url/whatwg-url/lib/infra.js +25 -25
- package/lib/utils/url/whatwg-url/lib/url-state-machine.d.ts +24 -24
- package/lib/utils/url/whatwg-url/lib/url-state-machine.js +1238 -1238
- package/lib/utils/url/whatwg-url/lib/urlencoded.d.ts +15 -15
- package/lib/utils/url/whatwg-url/lib/urlencoded.js +162 -162
- package/lib/utils/url/whatwg-url/lib/utils.d.ts +37 -37
- package/lib/utils/url/whatwg-url/lib/utils.js +101 -101
- package/lib/utils/uuid.d.ts +17 -17
- package/lib/utils/uuid.js +218 -218
- package/lib/utils/validator.d.ts +26 -26
- package/lib/utils/validator.js +131 -131
- package/lib/utils/version.js +21 -21
- package/package.json +2 -1
package/lib/types/Exception.js
CHANGED
|
@@ -1,406 +1,406 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeException = exports.OakExternalException = exports.OakPreConditionUnsetException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakUserInvisibleException = exports.OakUserUnpermittedException = exports.OakAttrNotNullException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakServerProxyException = exports.OakNetworkException = exports.OakUserException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakNoRelationDefException = exports.OakImportDataParseException = exports.OakUniqueViolationException = exports.OakDataException = exports.OakException = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
|
-
class OakException extends Error {
|
|
7
|
-
opRecord;
|
|
8
|
-
constructor(message) {
|
|
9
|
-
super(message);
|
|
10
|
-
this.name = new.target.name;
|
|
11
|
-
if (typeof Error.captureStackTrace === 'function') {
|
|
12
|
-
Error.captureStackTrace(this, new.target);
|
|
13
|
-
}
|
|
14
|
-
if (typeof Object.setPrototypeOf === 'function') {
|
|
15
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
this.__proto__ = new.target.prototype;
|
|
19
|
-
}
|
|
20
|
-
this.opRecord = {
|
|
21
|
-
a: 's',
|
|
22
|
-
d: {},
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
addData(entity, rows) {
|
|
26
|
-
const { d } = this.opRecord;
|
|
27
|
-
const addSingleRow = (rowRoot, row) => {
|
|
28
|
-
const { id } = row;
|
|
29
|
-
if (rowRoot[id]) {
|
|
30
|
-
Object.assign(rowRoot[id], row);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
rowRoot[id] = row;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
if (!d[entity]) {
|
|
37
|
-
d[entity] = {};
|
|
38
|
-
}
|
|
39
|
-
rows.forEach(row => addSingleRow(d[entity], row));
|
|
40
|
-
}
|
|
41
|
-
setOpRecords(opRecord) {
|
|
42
|
-
this.opRecord = opRecord;
|
|
43
|
-
}
|
|
44
|
-
toString() {
|
|
45
|
-
return JSON.stringify({
|
|
46
|
-
name: this.constructor.name,
|
|
47
|
-
message: this.message,
|
|
48
|
-
opRecord: this.opRecord,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.OakException = OakException;
|
|
53
|
-
class OakDataException extends OakException {
|
|
54
|
-
}
|
|
55
|
-
exports.OakDataException = OakDataException;
|
|
56
|
-
class OakUniqueViolationException extends OakException {
|
|
57
|
-
rows;
|
|
58
|
-
constructor(rows, message) {
|
|
59
|
-
super(message || '您更新的数据违反了唯一性约束');
|
|
60
|
-
this.rows = rows;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.OakUniqueViolationException = OakUniqueViolationException;
|
|
64
|
-
class OakImportDataParseException extends OakException {
|
|
65
|
-
line;
|
|
66
|
-
header;
|
|
67
|
-
// message必传,描述具体错误的数据内容
|
|
68
|
-
constructor(message, line, header) {
|
|
69
|
-
super(message);
|
|
70
|
-
this.line = line;
|
|
71
|
-
this.header = header;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
exports.OakImportDataParseException = OakImportDataParseException;
|
|
75
|
-
class OakNoRelationDefException extends OakDataException {
|
|
76
|
-
entity;
|
|
77
|
-
actions;
|
|
78
|
-
constructor(entity, actions, msg) {
|
|
79
|
-
super(msg || `对象${entity}的操作${actions.join(',')}找不到有效的relation定义`);
|
|
80
|
-
this.entity = entity;
|
|
81
|
-
this.actions = actions;
|
|
82
|
-
}
|
|
83
|
-
toString() {
|
|
84
|
-
return JSON.stringify({
|
|
85
|
-
name: this.constructor.name,
|
|
86
|
-
message: this.message,
|
|
87
|
-
entity: this.entity,
|
|
88
|
-
action: this.actions,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
exports.OakNoRelationDefException = OakNoRelationDefException;
|
|
93
|
-
class OakOperExistedException extends OakDataException {
|
|
94
|
-
}
|
|
95
|
-
exports.OakOperExistedException = OakOperExistedException;
|
|
96
|
-
class OakRowUnexistedException extends OakDataException {
|
|
97
|
-
rows;
|
|
98
|
-
// 指定主键查询时却发现行不存在,一般发生在缓存中
|
|
99
|
-
constructor(rows) {
|
|
100
|
-
super(`查询${rows.map(ele => ele.entity).join(',')}对象时发现了空指针,请检查数据一致性`);
|
|
101
|
-
this.rows = rows;
|
|
102
|
-
}
|
|
103
|
-
toString() {
|
|
104
|
-
return JSON.stringify({ rows: this.rows });
|
|
105
|
-
}
|
|
106
|
-
getRows() {
|
|
107
|
-
return this.rows;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
exports.OakRowUnexistedException = OakRowUnexistedException;
|
|
111
|
-
/**
|
|
112
|
-
* 可接受的、由用户操作造成的异常
|
|
113
|
-
*/
|
|
114
|
-
class OakUserException extends OakException {
|
|
115
|
-
}
|
|
116
|
-
exports.OakUserException = OakUserException;
|
|
117
|
-
;
|
|
118
|
-
/**
|
|
119
|
-
* 网络中断异常
|
|
120
|
-
*/
|
|
121
|
-
class OakNetworkException extends OakException {
|
|
122
|
-
}
|
|
123
|
-
exports.OakNetworkException = OakNetworkException;
|
|
124
|
-
//
|
|
125
|
-
class OakServerProxyException extends OakException {
|
|
126
|
-
}
|
|
127
|
-
exports.OakServerProxyException = OakServerProxyException;
|
|
128
|
-
// 在系统更新数据时,以下三个异常应按规范依次抛出。
|
|
129
|
-
/**
|
|
130
|
-
* 数据不一致异常,系统认为现有的数据不允许相应的动作时抛此异常
|
|
131
|
-
*
|
|
132
|
-
*/
|
|
133
|
-
class OakRowInconsistencyException extends OakUserException {
|
|
134
|
-
constructor(data, message) {
|
|
135
|
-
super(message);
|
|
136
|
-
(0, assert_1.default)(!data, '现在使用addData接口来传数据');
|
|
137
|
-
}
|
|
138
|
-
toString() {
|
|
139
|
-
return JSON.stringify({
|
|
140
|
-
name: this.constructor.name,
|
|
141
|
-
message: this.message,
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
exports.OakRowInconsistencyException = OakRowInconsistencyException;
|
|
146
|
-
;
|
|
147
|
-
/**
|
|
148
|
-
* 当输入的数据非法时抛此异常,attributes表示非法的属性
|
|
149
|
-
*/
|
|
150
|
-
class OakInputIllegalException extends OakUserException {
|
|
151
|
-
attributes;
|
|
152
|
-
entity;
|
|
153
|
-
constructor(entity, attributes, message) {
|
|
154
|
-
super(message);
|
|
155
|
-
this.entity = entity;
|
|
156
|
-
this.attributes = attributes;
|
|
157
|
-
}
|
|
158
|
-
getEntity() {
|
|
159
|
-
return this.entity;
|
|
160
|
-
}
|
|
161
|
-
getAttributes() {
|
|
162
|
-
return this.attributes;
|
|
163
|
-
}
|
|
164
|
-
addAttributesPrefix(prefix) {
|
|
165
|
-
this.attributes = this.attributes.map(ele => `${prefix}.${ele}`);
|
|
166
|
-
}
|
|
167
|
-
toString() {
|
|
168
|
-
return JSON.stringify({
|
|
169
|
-
entity: this.entity,
|
|
170
|
-
name: this.constructor.name,
|
|
171
|
-
message: this.message,
|
|
172
|
-
attributes: this.attributes,
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
exports.OakInputIllegalException = OakInputIllegalException;
|
|
177
|
-
;
|
|
178
|
-
/**
|
|
179
|
-
* 属性为空时抛的异常
|
|
180
|
-
*/
|
|
181
|
-
class OakAttrNotNullException extends OakInputIllegalException {
|
|
182
|
-
constructor(entity, attributes, message) {
|
|
183
|
-
super(entity, attributes, message || '属性不允许为空');
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
exports.OakAttrNotNullException = OakAttrNotNullException;
|
|
187
|
-
/**
|
|
188
|
-
* 用户权限不够时抛的异常
|
|
189
|
-
*/
|
|
190
|
-
class OakUserUnpermittedException extends OakUserException {
|
|
191
|
-
}
|
|
192
|
-
exports.OakUserUnpermittedException = OakUserUnpermittedException;
|
|
193
|
-
;
|
|
194
|
-
/**
|
|
195
|
-
* 用户查询权限不够抛出异常
|
|
196
|
-
*/
|
|
197
|
-
class OakUserInvisibleException extends OakUserException {
|
|
198
|
-
}
|
|
199
|
-
exports.OakUserInvisibleException = OakUserInvisibleException;
|
|
200
|
-
;
|
|
201
|
-
/**
|
|
202
|
-
* 用户未登录抛的异常
|
|
203
|
-
*/
|
|
204
|
-
class OakUnloggedInException extends OakUserException {
|
|
205
|
-
constructor(message) {
|
|
206
|
-
super(message || '您尚未登录');
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
exports.OakUnloggedInException = OakUnloggedInException;
|
|
210
|
-
;
|
|
211
|
-
/**
|
|
212
|
-
* 用户未登录抛的异常
|
|
213
|
-
*/
|
|
214
|
-
class OakRowLockedException extends OakUserException {
|
|
215
|
-
constructor(message) {
|
|
216
|
-
super(message || '该行数据正在被更新中,请稍后再试');
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
exports.OakRowLockedException = OakRowLockedException;
|
|
220
|
-
;
|
|
221
|
-
/**
|
|
222
|
-
* 要插入行时,发现已经有相同的行数据
|
|
223
|
-
*/
|
|
224
|
-
class OakCongruentRowExists extends OakUserException {
|
|
225
|
-
data;
|
|
226
|
-
entity;
|
|
227
|
-
constructor(entity, data, message) {
|
|
228
|
-
super(message);
|
|
229
|
-
this.data = data;
|
|
230
|
-
this.entity = entity;
|
|
231
|
-
}
|
|
232
|
-
getData() {
|
|
233
|
-
return this.data;
|
|
234
|
-
}
|
|
235
|
-
getEntity() {
|
|
236
|
-
return this.entity;
|
|
237
|
-
}
|
|
238
|
-
toString() {
|
|
239
|
-
return JSON.stringify({
|
|
240
|
-
name: this.constructor.name,
|
|
241
|
-
message: this.message,
|
|
242
|
-
data: this.data,
|
|
243
|
-
entity: this.entity,
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
exports.OakCongruentRowExists = OakCongruentRowExists;
|
|
248
|
-
/**
|
|
249
|
-
* 死锁抛的异常
|
|
250
|
-
*/
|
|
251
|
-
class OakDeadlock extends OakUserException {
|
|
252
|
-
constructor(message) {
|
|
253
|
-
super(message || '发现死锁');
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
exports.OakDeadlock = OakDeadlock;
|
|
257
|
-
;
|
|
258
|
-
/**
|
|
259
|
-
* 前置条件不满足抛的异常
|
|
260
|
-
*/
|
|
261
|
-
class OakPreConditionUnsetException extends OakUserException {
|
|
262
|
-
entity;
|
|
263
|
-
code;
|
|
264
|
-
constructor(message, entity, code) {
|
|
265
|
-
super(message || '前置条件不满足');
|
|
266
|
-
this.entity = entity,
|
|
267
|
-
this.code = code;
|
|
268
|
-
}
|
|
269
|
-
toString() {
|
|
270
|
-
return JSON.stringify({
|
|
271
|
-
name: this.constructor.name,
|
|
272
|
-
message: this.message,
|
|
273
|
-
code: this.code,
|
|
274
|
-
entity: this.entity,
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
exports.OakPreConditionUnsetException = OakPreConditionUnsetException;
|
|
279
|
-
/**
|
|
280
|
-
* 调用外部接口抛出的异常
|
|
281
|
-
*/
|
|
282
|
-
class OakExternalException extends OakUserException {
|
|
283
|
-
code;
|
|
284
|
-
source;
|
|
285
|
-
data;
|
|
286
|
-
constructor(source, code, message, data) {
|
|
287
|
-
super(message);
|
|
288
|
-
this.code = code;
|
|
289
|
-
this.source = source;
|
|
290
|
-
this.data = data;
|
|
291
|
-
}
|
|
292
|
-
toString() {
|
|
293
|
-
return JSON.stringify({
|
|
294
|
-
code: this.code,
|
|
295
|
-
message: this.message,
|
|
296
|
-
source: this.source,
|
|
297
|
-
data: this.data,
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
exports.OakExternalException = OakExternalException;
|
|
302
|
-
function makeException(data) {
|
|
303
|
-
const { name } = data;
|
|
304
|
-
switch (name) {
|
|
305
|
-
case 'OakException': {
|
|
306
|
-
const e = new OakException(data.message);
|
|
307
|
-
e.setOpRecords(data.opRecords);
|
|
308
|
-
return e;
|
|
309
|
-
}
|
|
310
|
-
case 'OakUserException': {
|
|
311
|
-
const e = new OakUserException(data.message);
|
|
312
|
-
e.setOpRecords(data.opRecords);
|
|
313
|
-
return e;
|
|
314
|
-
}
|
|
315
|
-
case 'OakRowInconsistencyException': {
|
|
316
|
-
const e = new OakRowInconsistencyException(data.data, data.message);
|
|
317
|
-
e.setOpRecords(data.opRecords);
|
|
318
|
-
return e;
|
|
319
|
-
}
|
|
320
|
-
case 'OakInputIllegalException': {
|
|
321
|
-
const e = new OakInputIllegalException(data.entity, data.attributes, data.message);
|
|
322
|
-
e.setOpRecords(data.opRecords);
|
|
323
|
-
return e;
|
|
324
|
-
}
|
|
325
|
-
case 'OakUserUnpermittedException': {
|
|
326
|
-
const e = new OakUserUnpermittedException(data.message);
|
|
327
|
-
e.setOpRecords(data.opRecords);
|
|
328
|
-
return e;
|
|
329
|
-
}
|
|
330
|
-
case 'OakUserInvisibleException': {
|
|
331
|
-
const e = new OakUserInvisibleException(data.message);
|
|
332
|
-
e.setOpRecords(data.opRecords);
|
|
333
|
-
return e;
|
|
334
|
-
}
|
|
335
|
-
case 'OakUnloggedInException': {
|
|
336
|
-
const e = new OakUnloggedInException(data.message);
|
|
337
|
-
e.setOpRecords(data.opRecords);
|
|
338
|
-
return e;
|
|
339
|
-
}
|
|
340
|
-
case 'OakCongruentRowExists': {
|
|
341
|
-
const e = new OakCongruentRowExists(data.entity, data.data, data.message);
|
|
342
|
-
e.setOpRecords(data.opRecords);
|
|
343
|
-
return e;
|
|
344
|
-
}
|
|
345
|
-
case 'OakRowLockedException': {
|
|
346
|
-
const e = new OakRowLockedException(data.message);
|
|
347
|
-
e.setOpRecords(data.opRecords);
|
|
348
|
-
return e;
|
|
349
|
-
}
|
|
350
|
-
case 'OakRowUnexistedException': {
|
|
351
|
-
const e = new OakRowUnexistedException(data.rows);
|
|
352
|
-
e.setOpRecords(data.opRecords);
|
|
353
|
-
return e;
|
|
354
|
-
}
|
|
355
|
-
case 'OakDeadlock': {
|
|
356
|
-
const e = new OakDeadlock(data.message);
|
|
357
|
-
e.setOpRecords(data.opRecords);
|
|
358
|
-
return e;
|
|
359
|
-
}
|
|
360
|
-
case 'OakDataException': {
|
|
361
|
-
const e = new OakDataException(data.message);
|
|
362
|
-
e.setOpRecords(data.opRecords);
|
|
363
|
-
return e;
|
|
364
|
-
}
|
|
365
|
-
case 'OakNoRelationDefException': {
|
|
366
|
-
const e = new OakNoRelationDefException(data.entity, data.action, data.message);
|
|
367
|
-
e.setOpRecords(data.opRecords);
|
|
368
|
-
return e;
|
|
369
|
-
}
|
|
370
|
-
case 'OakUniqueViolationException': {
|
|
371
|
-
const e = new OakUniqueViolationException(data.rows, data.message);
|
|
372
|
-
e.setOpRecords(data.opRecords);
|
|
373
|
-
return e;
|
|
374
|
-
}
|
|
375
|
-
case 'OakImportDataParseException': {
|
|
376
|
-
const e = new OakImportDataParseException(data.message, data.line, data.header);
|
|
377
|
-
e.setOpRecords(data.opRecords);
|
|
378
|
-
return e;
|
|
379
|
-
}
|
|
380
|
-
case 'OakPreConditionUnsetException': {
|
|
381
|
-
const e = new OakPreConditionUnsetException(data.message, data.entity, data.code);
|
|
382
|
-
e.setOpRecords(data.opRecords);
|
|
383
|
-
return e;
|
|
384
|
-
}
|
|
385
|
-
case 'OakAttrNotNullException': {
|
|
386
|
-
const e = new OakAttrNotNullException(data.entity, data.attributes, data.message);
|
|
387
|
-
e.setOpRecords(data.opRecords);
|
|
388
|
-
return e;
|
|
389
|
-
}
|
|
390
|
-
case 'OakExternalException': {
|
|
391
|
-
const e = new OakExternalException(data.source, data.code, data.message, data.data);
|
|
392
|
-
return e;
|
|
393
|
-
}
|
|
394
|
-
case 'OakNetworkException': {
|
|
395
|
-
const e = new OakNetworkException(data.message);
|
|
396
|
-
return e;
|
|
397
|
-
}
|
|
398
|
-
case 'OakServerProxyException': {
|
|
399
|
-
const e = new OakServerProxyException(data.message);
|
|
400
|
-
return e;
|
|
401
|
-
}
|
|
402
|
-
default:
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
exports.makeException = makeException;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeException = exports.OakExternalException = exports.OakPreConditionUnsetException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakUserInvisibleException = exports.OakUserUnpermittedException = exports.OakAttrNotNullException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakServerProxyException = exports.OakNetworkException = exports.OakUserException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakNoRelationDefException = exports.OakImportDataParseException = exports.OakUniqueViolationException = exports.OakDataException = exports.OakException = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
|
+
class OakException extends Error {
|
|
7
|
+
opRecord;
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = new.target.name;
|
|
11
|
+
if (typeof Error.captureStackTrace === 'function') {
|
|
12
|
+
Error.captureStackTrace(this, new.target);
|
|
13
|
+
}
|
|
14
|
+
if (typeof Object.setPrototypeOf === 'function') {
|
|
15
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
this.__proto__ = new.target.prototype;
|
|
19
|
+
}
|
|
20
|
+
this.opRecord = {
|
|
21
|
+
a: 's',
|
|
22
|
+
d: {},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
addData(entity, rows) {
|
|
26
|
+
const { d } = this.opRecord;
|
|
27
|
+
const addSingleRow = (rowRoot, row) => {
|
|
28
|
+
const { id } = row;
|
|
29
|
+
if (rowRoot[id]) {
|
|
30
|
+
Object.assign(rowRoot[id], row);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
rowRoot[id] = row;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
if (!d[entity]) {
|
|
37
|
+
d[entity] = {};
|
|
38
|
+
}
|
|
39
|
+
rows.forEach(row => addSingleRow(d[entity], row));
|
|
40
|
+
}
|
|
41
|
+
setOpRecords(opRecord) {
|
|
42
|
+
this.opRecord = opRecord;
|
|
43
|
+
}
|
|
44
|
+
toString() {
|
|
45
|
+
return JSON.stringify({
|
|
46
|
+
name: this.constructor.name,
|
|
47
|
+
message: this.message,
|
|
48
|
+
opRecord: this.opRecord,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.OakException = OakException;
|
|
53
|
+
class OakDataException extends OakException {
|
|
54
|
+
}
|
|
55
|
+
exports.OakDataException = OakDataException;
|
|
56
|
+
class OakUniqueViolationException extends OakException {
|
|
57
|
+
rows;
|
|
58
|
+
constructor(rows, message) {
|
|
59
|
+
super(message || '您更新的数据违反了唯一性约束');
|
|
60
|
+
this.rows = rows;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.OakUniqueViolationException = OakUniqueViolationException;
|
|
64
|
+
class OakImportDataParseException extends OakException {
|
|
65
|
+
line;
|
|
66
|
+
header;
|
|
67
|
+
// message必传,描述具体错误的数据内容
|
|
68
|
+
constructor(message, line, header) {
|
|
69
|
+
super(message);
|
|
70
|
+
this.line = line;
|
|
71
|
+
this.header = header;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.OakImportDataParseException = OakImportDataParseException;
|
|
75
|
+
class OakNoRelationDefException extends OakDataException {
|
|
76
|
+
entity;
|
|
77
|
+
actions;
|
|
78
|
+
constructor(entity, actions, msg) {
|
|
79
|
+
super(msg || `对象${entity}的操作${actions.join(',')}找不到有效的relation定义`);
|
|
80
|
+
this.entity = entity;
|
|
81
|
+
this.actions = actions;
|
|
82
|
+
}
|
|
83
|
+
toString() {
|
|
84
|
+
return JSON.stringify({
|
|
85
|
+
name: this.constructor.name,
|
|
86
|
+
message: this.message,
|
|
87
|
+
entity: this.entity,
|
|
88
|
+
action: this.actions,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.OakNoRelationDefException = OakNoRelationDefException;
|
|
93
|
+
class OakOperExistedException extends OakDataException {
|
|
94
|
+
}
|
|
95
|
+
exports.OakOperExistedException = OakOperExistedException;
|
|
96
|
+
class OakRowUnexistedException extends OakDataException {
|
|
97
|
+
rows;
|
|
98
|
+
// 指定主键查询时却发现行不存在,一般发生在缓存中
|
|
99
|
+
constructor(rows) {
|
|
100
|
+
super(`查询${rows.map(ele => ele.entity).join(',')}对象时发现了空指针,请检查数据一致性`);
|
|
101
|
+
this.rows = rows;
|
|
102
|
+
}
|
|
103
|
+
toString() {
|
|
104
|
+
return JSON.stringify({ rows: this.rows });
|
|
105
|
+
}
|
|
106
|
+
getRows() {
|
|
107
|
+
return this.rows;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.OakRowUnexistedException = OakRowUnexistedException;
|
|
111
|
+
/**
|
|
112
|
+
* 可接受的、由用户操作造成的异常
|
|
113
|
+
*/
|
|
114
|
+
class OakUserException extends OakException {
|
|
115
|
+
}
|
|
116
|
+
exports.OakUserException = OakUserException;
|
|
117
|
+
;
|
|
118
|
+
/**
|
|
119
|
+
* 网络中断异常
|
|
120
|
+
*/
|
|
121
|
+
class OakNetworkException extends OakException {
|
|
122
|
+
}
|
|
123
|
+
exports.OakNetworkException = OakNetworkException;
|
|
124
|
+
//
|
|
125
|
+
class OakServerProxyException extends OakException {
|
|
126
|
+
}
|
|
127
|
+
exports.OakServerProxyException = OakServerProxyException;
|
|
128
|
+
// 在系统更新数据时,以下三个异常应按规范依次抛出。
|
|
129
|
+
/**
|
|
130
|
+
* 数据不一致异常,系统认为现有的数据不允许相应的动作时抛此异常
|
|
131
|
+
*
|
|
132
|
+
*/
|
|
133
|
+
class OakRowInconsistencyException extends OakUserException {
|
|
134
|
+
constructor(data, message) {
|
|
135
|
+
super(message);
|
|
136
|
+
(0, assert_1.default)(!data, '现在使用addData接口来传数据');
|
|
137
|
+
}
|
|
138
|
+
toString() {
|
|
139
|
+
return JSON.stringify({
|
|
140
|
+
name: this.constructor.name,
|
|
141
|
+
message: this.message,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.OakRowInconsistencyException = OakRowInconsistencyException;
|
|
146
|
+
;
|
|
147
|
+
/**
|
|
148
|
+
* 当输入的数据非法时抛此异常,attributes表示非法的属性
|
|
149
|
+
*/
|
|
150
|
+
class OakInputIllegalException extends OakUserException {
|
|
151
|
+
attributes;
|
|
152
|
+
entity;
|
|
153
|
+
constructor(entity, attributes, message) {
|
|
154
|
+
super(message);
|
|
155
|
+
this.entity = entity;
|
|
156
|
+
this.attributes = attributes;
|
|
157
|
+
}
|
|
158
|
+
getEntity() {
|
|
159
|
+
return this.entity;
|
|
160
|
+
}
|
|
161
|
+
getAttributes() {
|
|
162
|
+
return this.attributes;
|
|
163
|
+
}
|
|
164
|
+
addAttributesPrefix(prefix) {
|
|
165
|
+
this.attributes = this.attributes.map(ele => `${prefix}.${ele}`);
|
|
166
|
+
}
|
|
167
|
+
toString() {
|
|
168
|
+
return JSON.stringify({
|
|
169
|
+
entity: this.entity,
|
|
170
|
+
name: this.constructor.name,
|
|
171
|
+
message: this.message,
|
|
172
|
+
attributes: this.attributes,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.OakInputIllegalException = OakInputIllegalException;
|
|
177
|
+
;
|
|
178
|
+
/**
|
|
179
|
+
* 属性为空时抛的异常
|
|
180
|
+
*/
|
|
181
|
+
class OakAttrNotNullException extends OakInputIllegalException {
|
|
182
|
+
constructor(entity, attributes, message) {
|
|
183
|
+
super(entity, attributes, message || '属性不允许为空');
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
exports.OakAttrNotNullException = OakAttrNotNullException;
|
|
187
|
+
/**
|
|
188
|
+
* 用户权限不够时抛的异常
|
|
189
|
+
*/
|
|
190
|
+
class OakUserUnpermittedException extends OakUserException {
|
|
191
|
+
}
|
|
192
|
+
exports.OakUserUnpermittedException = OakUserUnpermittedException;
|
|
193
|
+
;
|
|
194
|
+
/**
|
|
195
|
+
* 用户查询权限不够抛出异常
|
|
196
|
+
*/
|
|
197
|
+
class OakUserInvisibleException extends OakUserException {
|
|
198
|
+
}
|
|
199
|
+
exports.OakUserInvisibleException = OakUserInvisibleException;
|
|
200
|
+
;
|
|
201
|
+
/**
|
|
202
|
+
* 用户未登录抛的异常
|
|
203
|
+
*/
|
|
204
|
+
class OakUnloggedInException extends OakUserException {
|
|
205
|
+
constructor(message) {
|
|
206
|
+
super(message || '您尚未登录');
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
exports.OakUnloggedInException = OakUnloggedInException;
|
|
210
|
+
;
|
|
211
|
+
/**
|
|
212
|
+
* 用户未登录抛的异常
|
|
213
|
+
*/
|
|
214
|
+
class OakRowLockedException extends OakUserException {
|
|
215
|
+
constructor(message) {
|
|
216
|
+
super(message || '该行数据正在被更新中,请稍后再试');
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
exports.OakRowLockedException = OakRowLockedException;
|
|
220
|
+
;
|
|
221
|
+
/**
|
|
222
|
+
* 要插入行时,发现已经有相同的行数据
|
|
223
|
+
*/
|
|
224
|
+
class OakCongruentRowExists extends OakUserException {
|
|
225
|
+
data;
|
|
226
|
+
entity;
|
|
227
|
+
constructor(entity, data, message) {
|
|
228
|
+
super(message);
|
|
229
|
+
this.data = data;
|
|
230
|
+
this.entity = entity;
|
|
231
|
+
}
|
|
232
|
+
getData() {
|
|
233
|
+
return this.data;
|
|
234
|
+
}
|
|
235
|
+
getEntity() {
|
|
236
|
+
return this.entity;
|
|
237
|
+
}
|
|
238
|
+
toString() {
|
|
239
|
+
return JSON.stringify({
|
|
240
|
+
name: this.constructor.name,
|
|
241
|
+
message: this.message,
|
|
242
|
+
data: this.data,
|
|
243
|
+
entity: this.entity,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
exports.OakCongruentRowExists = OakCongruentRowExists;
|
|
248
|
+
/**
|
|
249
|
+
* 死锁抛的异常
|
|
250
|
+
*/
|
|
251
|
+
class OakDeadlock extends OakUserException {
|
|
252
|
+
constructor(message) {
|
|
253
|
+
super(message || '发现死锁');
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
exports.OakDeadlock = OakDeadlock;
|
|
257
|
+
;
|
|
258
|
+
/**
|
|
259
|
+
* 前置条件不满足抛的异常
|
|
260
|
+
*/
|
|
261
|
+
class OakPreConditionUnsetException extends OakUserException {
|
|
262
|
+
entity;
|
|
263
|
+
code;
|
|
264
|
+
constructor(message, entity, code) {
|
|
265
|
+
super(message || '前置条件不满足');
|
|
266
|
+
this.entity = entity,
|
|
267
|
+
this.code = code;
|
|
268
|
+
}
|
|
269
|
+
toString() {
|
|
270
|
+
return JSON.stringify({
|
|
271
|
+
name: this.constructor.name,
|
|
272
|
+
message: this.message,
|
|
273
|
+
code: this.code,
|
|
274
|
+
entity: this.entity,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
exports.OakPreConditionUnsetException = OakPreConditionUnsetException;
|
|
279
|
+
/**
|
|
280
|
+
* 调用外部接口抛出的异常
|
|
281
|
+
*/
|
|
282
|
+
class OakExternalException extends OakUserException {
|
|
283
|
+
code;
|
|
284
|
+
source;
|
|
285
|
+
data;
|
|
286
|
+
constructor(source, code, message, data) {
|
|
287
|
+
super(message);
|
|
288
|
+
this.code = code;
|
|
289
|
+
this.source = source;
|
|
290
|
+
this.data = data;
|
|
291
|
+
}
|
|
292
|
+
toString() {
|
|
293
|
+
return JSON.stringify({
|
|
294
|
+
code: this.code,
|
|
295
|
+
message: this.message,
|
|
296
|
+
source: this.source,
|
|
297
|
+
data: this.data,
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
exports.OakExternalException = OakExternalException;
|
|
302
|
+
function makeException(data) {
|
|
303
|
+
const { name } = data;
|
|
304
|
+
switch (name) {
|
|
305
|
+
case 'OakException': {
|
|
306
|
+
const e = new OakException(data.message);
|
|
307
|
+
e.setOpRecords(data.opRecords);
|
|
308
|
+
return e;
|
|
309
|
+
}
|
|
310
|
+
case 'OakUserException': {
|
|
311
|
+
const e = new OakUserException(data.message);
|
|
312
|
+
e.setOpRecords(data.opRecords);
|
|
313
|
+
return e;
|
|
314
|
+
}
|
|
315
|
+
case 'OakRowInconsistencyException': {
|
|
316
|
+
const e = new OakRowInconsistencyException(data.data, data.message);
|
|
317
|
+
e.setOpRecords(data.opRecords);
|
|
318
|
+
return e;
|
|
319
|
+
}
|
|
320
|
+
case 'OakInputIllegalException': {
|
|
321
|
+
const e = new OakInputIllegalException(data.entity, data.attributes, data.message);
|
|
322
|
+
e.setOpRecords(data.opRecords);
|
|
323
|
+
return e;
|
|
324
|
+
}
|
|
325
|
+
case 'OakUserUnpermittedException': {
|
|
326
|
+
const e = new OakUserUnpermittedException(data.message);
|
|
327
|
+
e.setOpRecords(data.opRecords);
|
|
328
|
+
return e;
|
|
329
|
+
}
|
|
330
|
+
case 'OakUserInvisibleException': {
|
|
331
|
+
const e = new OakUserInvisibleException(data.message);
|
|
332
|
+
e.setOpRecords(data.opRecords);
|
|
333
|
+
return e;
|
|
334
|
+
}
|
|
335
|
+
case 'OakUnloggedInException': {
|
|
336
|
+
const e = new OakUnloggedInException(data.message);
|
|
337
|
+
e.setOpRecords(data.opRecords);
|
|
338
|
+
return e;
|
|
339
|
+
}
|
|
340
|
+
case 'OakCongruentRowExists': {
|
|
341
|
+
const e = new OakCongruentRowExists(data.entity, data.data, data.message);
|
|
342
|
+
e.setOpRecords(data.opRecords);
|
|
343
|
+
return e;
|
|
344
|
+
}
|
|
345
|
+
case 'OakRowLockedException': {
|
|
346
|
+
const e = new OakRowLockedException(data.message);
|
|
347
|
+
e.setOpRecords(data.opRecords);
|
|
348
|
+
return e;
|
|
349
|
+
}
|
|
350
|
+
case 'OakRowUnexistedException': {
|
|
351
|
+
const e = new OakRowUnexistedException(data.rows);
|
|
352
|
+
e.setOpRecords(data.opRecords);
|
|
353
|
+
return e;
|
|
354
|
+
}
|
|
355
|
+
case 'OakDeadlock': {
|
|
356
|
+
const e = new OakDeadlock(data.message);
|
|
357
|
+
e.setOpRecords(data.opRecords);
|
|
358
|
+
return e;
|
|
359
|
+
}
|
|
360
|
+
case 'OakDataException': {
|
|
361
|
+
const e = new OakDataException(data.message);
|
|
362
|
+
e.setOpRecords(data.opRecords);
|
|
363
|
+
return e;
|
|
364
|
+
}
|
|
365
|
+
case 'OakNoRelationDefException': {
|
|
366
|
+
const e = new OakNoRelationDefException(data.entity, data.action, data.message);
|
|
367
|
+
e.setOpRecords(data.opRecords);
|
|
368
|
+
return e;
|
|
369
|
+
}
|
|
370
|
+
case 'OakUniqueViolationException': {
|
|
371
|
+
const e = new OakUniqueViolationException(data.rows, data.message);
|
|
372
|
+
e.setOpRecords(data.opRecords);
|
|
373
|
+
return e;
|
|
374
|
+
}
|
|
375
|
+
case 'OakImportDataParseException': {
|
|
376
|
+
const e = new OakImportDataParseException(data.message, data.line, data.header);
|
|
377
|
+
e.setOpRecords(data.opRecords);
|
|
378
|
+
return e;
|
|
379
|
+
}
|
|
380
|
+
case 'OakPreConditionUnsetException': {
|
|
381
|
+
const e = new OakPreConditionUnsetException(data.message, data.entity, data.code);
|
|
382
|
+
e.setOpRecords(data.opRecords);
|
|
383
|
+
return e;
|
|
384
|
+
}
|
|
385
|
+
case 'OakAttrNotNullException': {
|
|
386
|
+
const e = new OakAttrNotNullException(data.entity, data.attributes, data.message);
|
|
387
|
+
e.setOpRecords(data.opRecords);
|
|
388
|
+
return e;
|
|
389
|
+
}
|
|
390
|
+
case 'OakExternalException': {
|
|
391
|
+
const e = new OakExternalException(data.source, data.code, data.message, data.data);
|
|
392
|
+
return e;
|
|
393
|
+
}
|
|
394
|
+
case 'OakNetworkException': {
|
|
395
|
+
const e = new OakNetworkException(data.message);
|
|
396
|
+
return e;
|
|
397
|
+
}
|
|
398
|
+
case 'OakServerProxyException': {
|
|
399
|
+
const e = new OakServerProxyException(data.message);
|
|
400
|
+
return e;
|
|
401
|
+
}
|
|
402
|
+
default:
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
exports.makeException = makeException;
|