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