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