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