oak-domain 5.1.17 → 5.1.19
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/data/i18n.js +1 -0
- package/lib/store/AsyncRowStore.d.ts +2 -1
- package/lib/types/Exception.d.ts +24 -21
- package/lib/types/Exception.js +76 -66
- package/lib/types/Trigger.d.ts +2 -2
- package/lib/utils/version.d.ts +7 -1
- package/lib/utils/version.js +13 -3
- package/package.json +1 -1
package/lib/data/i18n.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { EntityDict, RowStore, OperateOption, OperationResult, SelectOption, Context, TxnOption, OpRecord, AggregationResult, ClusterInfo } from "../types";
|
|
2
|
+
import { EntityDict, RowStore, OperateOption, OperationResult, SelectOption, Context, TxnOption, OpRecord, AggregationResult, ClusterInfo, OakException } from "../types";
|
|
3
3
|
import { EntityDict as BaseEntityDict } from '../base-app-domain';
|
|
4
4
|
import { IncomingHttpHeaders } from "http";
|
|
5
5
|
/**
|
|
@@ -61,6 +61,7 @@ export declare abstract class AsyncContext<ED extends EntityDict & BaseEntityDic
|
|
|
61
61
|
abstract initialize(data?: any, later?: boolean): Promise<void>;
|
|
62
62
|
abstract allowUserUpdate(): boolean;
|
|
63
63
|
abstract openRootMode(): () => void;
|
|
64
|
+
abstract tryDeduceException(err: Error): Promise<OakException<any> | void>;
|
|
64
65
|
}
|
|
65
66
|
export interface AsyncRowStore<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>> extends RowStore<ED> {
|
|
66
67
|
operate<T extends keyof ED, OP extends OperateOption>(entity: T, operation: ED[T]['Operation'], context: Cxt, option: OP): Promise<OperationResult<ED>>;
|
package/lib/types/Exception.d.ts
CHANGED
|
@@ -3,15 +3,15 @@ import { EntityDict, OpRecord } from "./Entity";
|
|
|
3
3
|
import { EntityDict as BaseEntityDict } from '../base-app-domain';
|
|
4
4
|
export declare class OakException<ED extends EntityDict & BaseEntityDict> extends Error {
|
|
5
5
|
opRecords: OpRecord<ED>[];
|
|
6
|
-
|
|
6
|
+
_module?: string;
|
|
7
7
|
params?: Record<string, any>;
|
|
8
|
-
constructor(message?: string,
|
|
8
|
+
constructor(message?: string, _module?: string, params?: Record<string, any>);
|
|
9
9
|
addData<T extends keyof ED>(entity: T, rows: Partial<ED[T]['Schema']>[], schema: StorageSchema<ED>): void;
|
|
10
10
|
setOpRecords(opRecords: OpRecord<ED>[]): void;
|
|
11
11
|
getSerialData(): {
|
|
12
12
|
name: string;
|
|
13
13
|
message: string;
|
|
14
|
-
|
|
14
|
+
_module: string | undefined;
|
|
15
15
|
opRecords: OpRecord<ED>[];
|
|
16
16
|
tag1: string | undefined;
|
|
17
17
|
tag2: boolean | undefined;
|
|
@@ -34,7 +34,7 @@ export declare class OakDataException<ED extends EntityDict & BaseEntityDict> ex
|
|
|
34
34
|
export declare class OakNoRelationDefException<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakDataException<ED> {
|
|
35
35
|
entity: T;
|
|
36
36
|
actions: ED[T]['Action'][];
|
|
37
|
-
constructor(entity: T, actions: ED[T]['Action'][], msg?: string,
|
|
37
|
+
constructor(entity: T, actions: ED[T]['Action'][], msg?: string, _module?: string, params?: Record<string, any>);
|
|
38
38
|
toString(): string;
|
|
39
39
|
}
|
|
40
40
|
export declare class OakOperExistedException<ED extends EntityDict & BaseEntityDict> extends OakDataException<ED> {
|
|
@@ -44,7 +44,7 @@ export declare class OakRowUnexistedException<ED extends EntityDict & BaseEntity
|
|
|
44
44
|
constructor(rows: Array<{
|
|
45
45
|
entity: any;
|
|
46
46
|
selection: any;
|
|
47
|
-
}>, msg?: string,
|
|
47
|
+
}>, msg?: string, _module?: string, params?: Record<string, any>);
|
|
48
48
|
toString(): string;
|
|
49
49
|
getRows(): {
|
|
50
50
|
entity: any;
|
|
@@ -64,12 +64,12 @@ export declare class OakUniqueViolationException<ED extends EntityDict & BaseEnt
|
|
|
64
64
|
constructor(rows: Array<{
|
|
65
65
|
id?: string;
|
|
66
66
|
attrs: string[];
|
|
67
|
-
}>, message?: string,
|
|
67
|
+
}>, message?: string, _module?: string, params?: Record<string, any>);
|
|
68
68
|
}
|
|
69
69
|
export declare class OakImportDataParseException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
70
70
|
line: number;
|
|
71
71
|
header?: string;
|
|
72
|
-
constructor(message: string, line: number, header?: string,
|
|
72
|
+
constructor(message: string, line: number, header?: string, _module?: string, params?: Record<string, any>);
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* 网络中断异常
|
|
@@ -81,7 +81,7 @@ export declare class OakServerProxyException<ED extends EntityDict & BaseEntityD
|
|
|
81
81
|
export declare class OakClockDriftException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
|
|
82
82
|
}
|
|
83
83
|
export declare class OakSignatureVerificationException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
|
|
84
|
-
constructor(message?: string,
|
|
84
|
+
constructor(message?: string, _module?: string, params?: Record<string, any>);
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* 数据不一致异常,系统认为现有的数据不允许相应的动作时抛此异常
|
|
@@ -96,7 +96,7 @@ export declare class OakRowInconsistencyException<ED extends EntityDict & BaseEn
|
|
|
96
96
|
export declare class OakInputIllegalException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
97
97
|
private attributes;
|
|
98
98
|
private entity;
|
|
99
|
-
constructor(entity: keyof ED, attributes: string[], message?: string,
|
|
99
|
+
constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record<string, any>);
|
|
100
100
|
getEntity(): keyof ED;
|
|
101
101
|
getAttributes(): string[];
|
|
102
102
|
addAttributesPrefix(prefix: string): void;
|
|
@@ -106,13 +106,13 @@ export declare class OakInputIllegalException<ED extends EntityDict & BaseEntity
|
|
|
106
106
|
* 属性为空时抛的异常
|
|
107
107
|
*/
|
|
108
108
|
export declare class OakAttrNotNullException<ED extends EntityDict & BaseEntityDict> extends OakInputIllegalException<ED> {
|
|
109
|
-
constructor(entity: keyof ED, attributes: string[], message?: string,
|
|
109
|
+
constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record<string, any>);
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
112
|
* 属性不允许更新抛的异常,前端可以用这个异常来处理update时对应属性的露出
|
|
113
113
|
*/
|
|
114
114
|
export declare class OakAttrCantUpdateException<ED extends EntityDict & BaseEntityDict> extends OakInputIllegalException<ED> {
|
|
115
|
-
constructor(entity: keyof ED, attributes: string[], message?: string,
|
|
115
|
+
constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record<string, any>);
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* 用户权限不够时抛的异常
|
|
@@ -120,7 +120,7 @@ export declare class OakAttrCantUpdateException<ED extends EntityDict & BaseEnti
|
|
|
120
120
|
export declare class OakOperationUnpermittedException<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakUserException<ED> {
|
|
121
121
|
private entity;
|
|
122
122
|
private operation;
|
|
123
|
-
constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], message?: string,
|
|
123
|
+
constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], message?: string, _module?: string, params?: Record<string, any>);
|
|
124
124
|
toString(): string;
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
@@ -129,20 +129,20 @@ export declare class OakOperationUnpermittedException<ED extends EntityDict & Ba
|
|
|
129
129
|
export declare class OakDataInvisibleException<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakUserException<ED> {
|
|
130
130
|
private entity;
|
|
131
131
|
private operation;
|
|
132
|
-
constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], message?: string,
|
|
132
|
+
constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], message?: string, _module?: string, params?: Record<string, any>);
|
|
133
133
|
toString(): string;
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* 用户未登录抛的异常
|
|
137
137
|
*/
|
|
138
138
|
export declare class OakUnloggedInException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
139
|
-
constructor(message?: string,
|
|
139
|
+
constructor(message?: string, _module?: string, params?: Record<string, any>);
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
142
|
* 行数据被锁抛的异常
|
|
143
143
|
*/
|
|
144
144
|
export declare class OakRowLockedException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
145
|
-
constructor(message?: string,
|
|
145
|
+
constructor(message?: string, _module?: string, params?: Record<string, any>);
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
148
|
* 要插入行时,发现已经有相同的行数据
|
|
@@ -150,7 +150,7 @@ export declare class OakRowLockedException<ED extends EntityDict & BaseEntityDic
|
|
|
150
150
|
export declare class OakCongruentRowExists<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakUserException<ED> {
|
|
151
151
|
private data;
|
|
152
152
|
private entity;
|
|
153
|
-
constructor(entity: T, data: ED[T]['OpSchema'], message?: string,
|
|
153
|
+
constructor(entity: T, data: ED[T]['OpSchema'], message?: string, _module?: string, params?: Record<string, any>);
|
|
154
154
|
getData(): ED[T]["OpSchema"];
|
|
155
155
|
getEntity(): T;
|
|
156
156
|
toString(): string;
|
|
@@ -159,7 +159,7 @@ export declare class OakCongruentRowExists<ED extends EntityDict & BaseEntityDic
|
|
|
159
159
|
* 死锁抛的异常
|
|
160
160
|
*/
|
|
161
161
|
export declare class OakDeadlock<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
162
|
-
constructor(message?: string,
|
|
162
|
+
constructor(message?: string, _module?: string, params?: Record<string, any>);
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
165
|
* 前置条件不满足抛的异常
|
|
@@ -167,7 +167,7 @@ export declare class OakDeadlock<ED extends EntityDict & BaseEntityDict> extends
|
|
|
167
167
|
export declare class OakPreConditionUnsetException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
168
168
|
entity?: keyof ED;
|
|
169
169
|
code?: string;
|
|
170
|
-
constructor(message?: string, entity?: keyof ED, code?: string,
|
|
170
|
+
constructor(message?: string, entity?: keyof ED, code?: string, _module?: string, params?: Record<string, any>);
|
|
171
171
|
toString(): string;
|
|
172
172
|
}
|
|
173
173
|
/**
|
|
@@ -177,19 +177,22 @@ export declare class OakExternalException<ED extends EntityDict & BaseEntityDict
|
|
|
177
177
|
code?: string;
|
|
178
178
|
source: string;
|
|
179
179
|
data?: any;
|
|
180
|
-
constructor(source: string, code?: string, message?: string, data?: any,
|
|
180
|
+
constructor(source: string, code?: string, message?: string, data?: any, _module?: string, params?: Record<string, any>);
|
|
181
181
|
toString(): string;
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
184
|
* socket连接异常
|
|
185
185
|
*/
|
|
186
186
|
export declare class OakSocketConnectException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
187
|
-
constructor(message?: string,
|
|
187
|
+
constructor(message?: string, _module?: string, params?: Record<string, any>);
|
|
188
|
+
}
|
|
189
|
+
export declare class OakApplicationHasToUpgrade<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
190
|
+
constructor(message?: string, _module?: string, params?: Record<string, any>);
|
|
188
191
|
}
|
|
189
192
|
export declare function makeException<ED extends EntityDict & BaseEntityDict>(data: {
|
|
190
193
|
name: string;
|
|
191
194
|
message?: string;
|
|
192
|
-
|
|
195
|
+
_module?: string;
|
|
193
196
|
params?: Record<string, any>;
|
|
194
197
|
opRecords: OpRecord<ED>[];
|
|
195
198
|
[A: string]: any;
|
package/lib/types/Exception.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeException = exports.OakSocketConnectException = exports.OakExternalException = exports.OakPreConditionUnsetException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakDataInvisibleException = exports.OakOperationUnpermittedException = exports.OakAttrCantUpdateException = exports.OakAttrNotNullException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakSignatureVerificationException = exports.OakClockDriftException = exports.OakServerProxyException = exports.OakNetworkException = exports.OakImportDataParseException = exports.OakUniqueViolationException = exports.OakUserException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakNoRelationDefException = exports.OakDataException = exports.OakPartialSuccess = exports.OakMakeSureByMySelfException = exports.OakRequestTimeoutException = exports.OakException = void 0;
|
|
3
|
+
exports.makeException = exports.OakApplicationHasToUpgrade = exports.OakSocketConnectException = exports.OakExternalException = exports.OakPreConditionUnsetException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakDataInvisibleException = exports.OakOperationUnpermittedException = exports.OakAttrCantUpdateException = exports.OakAttrNotNullException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakSignatureVerificationException = exports.OakClockDriftException = exports.OakServerProxyException = exports.OakNetworkException = exports.OakImportDataParseException = exports.OakUniqueViolationException = exports.OakUserException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakNoRelationDefException = exports.OakDataException = exports.OakPartialSuccess = exports.OakMakeSureByMySelfException = exports.OakRequestTimeoutException = exports.OakException = void 0;
|
|
4
4
|
const relation_1 = require("../store/relation");
|
|
5
5
|
const lodash_1 = require("../utils/lodash");
|
|
6
6
|
class OakException extends Error {
|
|
7
7
|
opRecords;
|
|
8
|
-
|
|
8
|
+
_module;
|
|
9
9
|
params;
|
|
10
|
-
constructor(message,
|
|
10
|
+
constructor(message, _module, params) {
|
|
11
11
|
super(message);
|
|
12
|
-
this.
|
|
12
|
+
this._module = _module;
|
|
13
13
|
this.params = params;
|
|
14
14
|
this.name = new.target.name;
|
|
15
15
|
if (typeof Error.captureStackTrace === 'function') {
|
|
@@ -79,7 +79,7 @@ class OakException extends Error {
|
|
|
79
79
|
return {
|
|
80
80
|
name: this.constructor.name,
|
|
81
81
|
message: this.message,
|
|
82
|
-
|
|
82
|
+
_module: this._module,
|
|
83
83
|
opRecords: this.opRecords,
|
|
84
84
|
tag1: this.tag1,
|
|
85
85
|
tag2: this.tag2,
|
|
@@ -116,8 +116,8 @@ exports.OakDataException = OakDataException;
|
|
|
116
116
|
class OakNoRelationDefException extends OakDataException {
|
|
117
117
|
entity;
|
|
118
118
|
actions;
|
|
119
|
-
constructor(entity, actions, msg,
|
|
120
|
-
super(msg || 'error::noRelationDef',
|
|
119
|
+
constructor(entity, actions, msg, _module, params) {
|
|
120
|
+
super(msg || 'error::noRelationDef', _module || 'oak-domain', params || {
|
|
121
121
|
entity,
|
|
122
122
|
actions: actions.join(',')
|
|
123
123
|
});
|
|
@@ -140,8 +140,8 @@ exports.OakOperExistedException = OakOperExistedException;
|
|
|
140
140
|
class OakRowUnexistedException extends OakDataException {
|
|
141
141
|
rows;
|
|
142
142
|
// 指定主键查询时却发现行不存在,一般发生在缓存中
|
|
143
|
-
constructor(rows, msg,
|
|
144
|
-
super(msg || 'error::rowUnexisted',
|
|
143
|
+
constructor(rows, msg, _module, params) {
|
|
144
|
+
super(msg || 'error::rowUnexisted', _module || 'oak-domain', params || {
|
|
145
145
|
entity: rows[0].entity,
|
|
146
146
|
});
|
|
147
147
|
this.rows = rows;
|
|
@@ -167,8 +167,8 @@ exports.OakUserException = OakUserException;
|
|
|
167
167
|
;
|
|
168
168
|
class OakUniqueViolationException extends OakUserException {
|
|
169
169
|
rows;
|
|
170
|
-
constructor(rows, message,
|
|
171
|
-
super(message || 'error::uniqViolation',
|
|
170
|
+
constructor(rows, message, _module, params) {
|
|
171
|
+
super(message || 'error::uniqViolation', _module || 'oak-domain', params);
|
|
172
172
|
this.rows = rows;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
@@ -177,8 +177,8 @@ class OakImportDataParseException extends OakUserException {
|
|
|
177
177
|
line;
|
|
178
178
|
header;
|
|
179
179
|
// message必传,描述具体错误的数据内容
|
|
180
|
-
constructor(message, line, header,
|
|
181
|
-
super(message || 'error::importedDataParseError',
|
|
180
|
+
constructor(message, line, header, _module, params) {
|
|
181
|
+
super(message || 'error::importedDataParseError', _module || 'oak-domain', params);
|
|
182
182
|
this.line = line;
|
|
183
183
|
this.header = header;
|
|
184
184
|
}
|
|
@@ -200,8 +200,8 @@ class OakClockDriftException extends OakException {
|
|
|
200
200
|
exports.OakClockDriftException = OakClockDriftException;
|
|
201
201
|
// 验签失败
|
|
202
202
|
class OakSignatureVerificationException extends OakException {
|
|
203
|
-
constructor(message,
|
|
204
|
-
super(message || 'error::signatureFailed',
|
|
203
|
+
constructor(message, _module, params) {
|
|
204
|
+
super(message || 'error::signatureFailed', _module || 'oak-domain', params);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
exports.OakSignatureVerificationException = OakSignatureVerificationException;
|
|
@@ -224,8 +224,8 @@ exports.OakRowInconsistencyException = OakRowInconsistencyException;
|
|
|
224
224
|
class OakInputIllegalException extends OakUserException {
|
|
225
225
|
attributes;
|
|
226
226
|
entity;
|
|
227
|
-
constructor(entity, attributes, message,
|
|
228
|
-
super(message,
|
|
227
|
+
constructor(entity, attributes, message, _module, params) {
|
|
228
|
+
super(message, _module, params);
|
|
229
229
|
this.entity = entity;
|
|
230
230
|
this.attributes = attributes;
|
|
231
231
|
}
|
|
@@ -253,8 +253,8 @@ exports.OakInputIllegalException = OakInputIllegalException;
|
|
|
253
253
|
* 属性为空时抛的异常
|
|
254
254
|
*/
|
|
255
255
|
class OakAttrNotNullException extends OakInputIllegalException {
|
|
256
|
-
constructor(entity, attributes, message,
|
|
257
|
-
super(entity, attributes, message || 'error::attributesNull',
|
|
256
|
+
constructor(entity, attributes, message, _module, params) {
|
|
257
|
+
super(entity, attributes, message || 'error::attributesNull', _module || 'oak-domain', params);
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
exports.OakAttrNotNullException = OakAttrNotNullException;
|
|
@@ -262,8 +262,8 @@ exports.OakAttrNotNullException = OakAttrNotNullException;
|
|
|
262
262
|
* 属性不允许更新抛的异常,前端可以用这个异常来处理update时对应属性的露出
|
|
263
263
|
*/
|
|
264
264
|
class OakAttrCantUpdateException extends OakInputIllegalException {
|
|
265
|
-
constructor(entity, attributes, message,
|
|
266
|
-
super(entity, attributes, message || 'error::attributesCantUpdate',
|
|
265
|
+
constructor(entity, attributes, message, _module, params) {
|
|
266
|
+
super(entity, attributes, message || 'error::attributesCantUpdate', _module || 'oak-domain', params);
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
exports.OakAttrCantUpdateException = OakAttrCantUpdateException;
|
|
@@ -273,8 +273,8 @@ exports.OakAttrCantUpdateException = OakAttrCantUpdateException;
|
|
|
273
273
|
class OakOperationUnpermittedException extends OakUserException {
|
|
274
274
|
entity;
|
|
275
275
|
operation;
|
|
276
|
-
constructor(entity, operation, message,
|
|
277
|
-
super(message || 'error::operationUnpermitted',
|
|
276
|
+
constructor(entity, operation, message, _module, params) {
|
|
277
|
+
super(message || 'error::operationUnpermitted', _module || 'oak-domain', params);
|
|
278
278
|
this.entity = entity;
|
|
279
279
|
this.operation = operation;
|
|
280
280
|
}
|
|
@@ -295,8 +295,8 @@ exports.OakOperationUnpermittedException = OakOperationUnpermittedException;
|
|
|
295
295
|
class OakDataInvisibleException extends OakUserException {
|
|
296
296
|
entity;
|
|
297
297
|
operation;
|
|
298
|
-
constructor(entity, operation, message,
|
|
299
|
-
super(message || 'error::dataInvisible',
|
|
298
|
+
constructor(entity, operation, message, _module, params) {
|
|
299
|
+
super(message || 'error::dataInvisible', _module || 'oak-domain', params);
|
|
300
300
|
this.entity = entity;
|
|
301
301
|
this.operation = operation;
|
|
302
302
|
}
|
|
@@ -315,8 +315,8 @@ exports.OakDataInvisibleException = OakDataInvisibleException;
|
|
|
315
315
|
* 用户未登录抛的异常
|
|
316
316
|
*/
|
|
317
317
|
class OakUnloggedInException extends OakUserException {
|
|
318
|
-
constructor(message,
|
|
319
|
-
super(message || 'error::unLoggedIn',
|
|
318
|
+
constructor(message, _module, params) {
|
|
319
|
+
super(message || 'error::unLoggedIn', _module || 'oak-domain', params);
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
exports.OakUnloggedInException = OakUnloggedInException;
|
|
@@ -325,8 +325,8 @@ exports.OakUnloggedInException = OakUnloggedInException;
|
|
|
325
325
|
* 行数据被锁抛的异常
|
|
326
326
|
*/
|
|
327
327
|
class OakRowLockedException extends OakUserException {
|
|
328
|
-
constructor(message,
|
|
329
|
-
super(message || 'error::rowLocked',
|
|
328
|
+
constructor(message, _module, params) {
|
|
329
|
+
super(message || 'error::rowLocked', _module || 'oak-domain', params);
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
332
|
exports.OakRowLockedException = OakRowLockedException;
|
|
@@ -337,8 +337,8 @@ exports.OakRowLockedException = OakRowLockedException;
|
|
|
337
337
|
class OakCongruentRowExists extends OakUserException {
|
|
338
338
|
data;
|
|
339
339
|
entity;
|
|
340
|
-
constructor(entity, data, message,
|
|
341
|
-
super(message || 'error::congrentRowExists',
|
|
340
|
+
constructor(entity, data, message, _module, params) {
|
|
341
|
+
super(message || 'error::congrentRowExists', _module || 'oak-domain', params);
|
|
342
342
|
this.data = data;
|
|
343
343
|
this.entity = entity;
|
|
344
344
|
}
|
|
@@ -362,8 +362,8 @@ exports.OakCongruentRowExists = OakCongruentRowExists;
|
|
|
362
362
|
* 死锁抛的异常
|
|
363
363
|
*/
|
|
364
364
|
class OakDeadlock extends OakUserException {
|
|
365
|
-
constructor(message,
|
|
366
|
-
super(message || 'error::deadlock',
|
|
365
|
+
constructor(message, _module, params) {
|
|
366
|
+
super(message || 'error::deadlock', _module || 'oak-domain', params);
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
exports.OakDeadlock = OakDeadlock;
|
|
@@ -374,8 +374,8 @@ exports.OakDeadlock = OakDeadlock;
|
|
|
374
374
|
class OakPreConditionUnsetException extends OakUserException {
|
|
375
375
|
entity;
|
|
376
376
|
code;
|
|
377
|
-
constructor(message, entity, code,
|
|
378
|
-
super(message || 'error::preconditionUnset',
|
|
377
|
+
constructor(message, entity, code, _module, params) {
|
|
378
|
+
super(message || 'error::preconditionUnset', _module || 'oak-domain', params);
|
|
379
379
|
this.entity = entity,
|
|
380
380
|
this.code = code;
|
|
381
381
|
}
|
|
@@ -396,8 +396,8 @@ class OakExternalException extends OakUserException {
|
|
|
396
396
|
code;
|
|
397
397
|
source;
|
|
398
398
|
data;
|
|
399
|
-
constructor(source, code, message, data,
|
|
400
|
-
super(message || 'error::externalException',
|
|
399
|
+
constructor(source, code, message, data, _module, params) {
|
|
400
|
+
super(message || 'error::externalException', _module || 'oak-domain', params);
|
|
401
401
|
this.code = code;
|
|
402
402
|
this.source = source;
|
|
403
403
|
this.data = data;
|
|
@@ -417,118 +417,128 @@ exports.OakExternalException = OakExternalException;
|
|
|
417
417
|
* socket连接异常
|
|
418
418
|
*/
|
|
419
419
|
class OakSocketConnectException extends OakUserException {
|
|
420
|
-
constructor(message,
|
|
421
|
-
super(message || 'error::socketConnectException',
|
|
420
|
+
constructor(message, _module, params) {
|
|
421
|
+
super(message || 'error::socketConnectException', _module || 'oak-domain', params);
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
exports.OakSocketConnectException = OakSocketConnectException;
|
|
425
425
|
;
|
|
426
|
+
class OakApplicationHasToUpgrade extends OakUserException {
|
|
427
|
+
constructor(message, _module, params) {
|
|
428
|
+
super(message || 'error::applicationHasToUpgrade', _module || 'oak-domain', params);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
exports.OakApplicationHasToUpgrade = OakApplicationHasToUpgrade;
|
|
426
432
|
function makeException(data) {
|
|
427
|
-
const { name, message,
|
|
433
|
+
const { name, message, _module, params } = data;
|
|
428
434
|
let e = undefined;
|
|
429
435
|
switch (name) {
|
|
430
436
|
case 'OakException': {
|
|
431
|
-
e = new OakException(message,
|
|
437
|
+
e = new OakException(message, _module, params);
|
|
432
438
|
break;
|
|
433
439
|
}
|
|
434
440
|
case 'OakUserException': {
|
|
435
|
-
e = new OakUserException(message,
|
|
441
|
+
e = new OakUserException(message, _module, params);
|
|
436
442
|
break;
|
|
437
443
|
}
|
|
438
444
|
case 'OakRowInconsistencyException': {
|
|
439
|
-
e = new OakRowInconsistencyException(message,
|
|
445
|
+
e = new OakRowInconsistencyException(message, _module, params);
|
|
440
446
|
break;
|
|
441
447
|
}
|
|
442
448
|
case 'OakInputIllegalException': {
|
|
443
|
-
e = new OakInputIllegalException(data.entity, data.attributes, message,
|
|
449
|
+
e = new OakInputIllegalException(data.entity, data.attributes, message, _module, params);
|
|
444
450
|
break;
|
|
445
451
|
}
|
|
446
452
|
case 'OakAttrCantUpdateException': {
|
|
447
|
-
e = new OakAttrCantUpdateException(data.entity, data.attributes, message,
|
|
453
|
+
e = new OakAttrCantUpdateException(data.entity, data.attributes, message, _module, params);
|
|
448
454
|
break;
|
|
449
455
|
}
|
|
450
456
|
case 'OakOperationUnpermittedException': {
|
|
451
|
-
e = new OakOperationUnpermittedException(data.entity, data.operation, message,
|
|
457
|
+
e = new OakOperationUnpermittedException(data.entity, data.operation, message, _module, params);
|
|
452
458
|
break;
|
|
453
459
|
}
|
|
454
460
|
case 'OakDataInvisibleException': {
|
|
455
|
-
e = new OakDataInvisibleException(data.entity, data.operation, message,
|
|
461
|
+
e = new OakDataInvisibleException(data.entity, data.operation, message, _module, params);
|
|
456
462
|
break;
|
|
457
463
|
}
|
|
458
464
|
case 'OakUnloggedInException': {
|
|
459
|
-
e = new OakUnloggedInException(message,
|
|
465
|
+
e = new OakUnloggedInException(message, _module, params);
|
|
460
466
|
break;
|
|
461
467
|
}
|
|
462
468
|
case 'OakCongruentRowExists': {
|
|
463
|
-
e = new OakCongruentRowExists(data.entity, data.data, message,
|
|
469
|
+
e = new OakCongruentRowExists(data.entity, data.data, message, _module, params);
|
|
464
470
|
break;
|
|
465
471
|
}
|
|
466
472
|
case 'OakRowLockedException': {
|
|
467
|
-
e = new OakRowLockedException(message,
|
|
473
|
+
e = new OakRowLockedException(message, _module, params);
|
|
468
474
|
break;
|
|
469
475
|
}
|
|
470
476
|
case 'OakRowUnexistedException': {
|
|
471
|
-
e = new OakRowUnexistedException(data.rows, message,
|
|
477
|
+
e = new OakRowUnexistedException(data.rows, message, _module, params);
|
|
472
478
|
break;
|
|
473
479
|
}
|
|
474
480
|
case 'OakDeadlock': {
|
|
475
|
-
e = new OakDeadlock(message,
|
|
481
|
+
e = new OakDeadlock(message, _module, params);
|
|
476
482
|
break;
|
|
477
483
|
}
|
|
478
484
|
case 'OakDataException': {
|
|
479
|
-
e = new OakDataException(message,
|
|
485
|
+
e = new OakDataException(message, _module, params);
|
|
480
486
|
break;
|
|
481
487
|
}
|
|
482
488
|
case 'OakNoRelationDefException': {
|
|
483
|
-
e = new OakNoRelationDefException(data.entity, data.action, message,
|
|
489
|
+
e = new OakNoRelationDefException(data.entity, data.action, message, _module, params);
|
|
484
490
|
break;
|
|
485
491
|
}
|
|
486
492
|
case 'OakUniqueViolationException': {
|
|
487
|
-
e = new OakUniqueViolationException(data.rows, message,
|
|
493
|
+
e = new OakUniqueViolationException(data.rows, message, _module, params);
|
|
488
494
|
break;
|
|
489
495
|
}
|
|
490
496
|
case 'OakImportDataParseException': {
|
|
491
|
-
e = new OakImportDataParseException(message, data.line, data.header,
|
|
497
|
+
e = new OakImportDataParseException(message, data.line, data.header, _module, params);
|
|
492
498
|
break;
|
|
493
499
|
}
|
|
494
500
|
case 'OakPreConditionUnsetException': {
|
|
495
|
-
e = new OakPreConditionUnsetException(message, data.entity, data.code,
|
|
501
|
+
e = new OakPreConditionUnsetException(message, data.entity, data.code, _module, params);
|
|
496
502
|
break;
|
|
497
503
|
}
|
|
498
504
|
case 'OakAttrNotNullException': {
|
|
499
|
-
e = new OakAttrNotNullException(data.entity, data.attributes, message,
|
|
505
|
+
e = new OakAttrNotNullException(data.entity, data.attributes, message, _module, params);
|
|
500
506
|
break;
|
|
501
507
|
}
|
|
502
508
|
case 'OakExternalException': {
|
|
503
|
-
e = new OakExternalException(data.source, data.code, message, data.data,
|
|
509
|
+
e = new OakExternalException(data.source, data.code, message, data.data, _module, params);
|
|
504
510
|
break;
|
|
505
511
|
}
|
|
506
512
|
case 'OakNetworkException': {
|
|
507
|
-
e = new OakNetworkException(message,
|
|
513
|
+
e = new OakNetworkException(message, _module, params);
|
|
508
514
|
break;
|
|
509
515
|
}
|
|
510
516
|
case 'OakClockDriftException': {
|
|
511
|
-
e = new OakClockDriftException(message,
|
|
517
|
+
e = new OakClockDriftException(message, _module, params);
|
|
512
518
|
break;
|
|
513
519
|
}
|
|
514
520
|
case 'OakServerProxyException': {
|
|
515
|
-
e = new OakServerProxyException(message,
|
|
521
|
+
e = new OakServerProxyException(message, _module, params);
|
|
516
522
|
break;
|
|
517
523
|
}
|
|
518
524
|
case 'OakSocketConnectException': {
|
|
519
|
-
e = new OakSocketConnectException(message,
|
|
525
|
+
e = new OakSocketConnectException(message, _module, params);
|
|
520
526
|
break;
|
|
521
527
|
}
|
|
522
528
|
case 'OakPartialSuccess': {
|
|
523
|
-
e = new OakPartialSuccess(message,
|
|
529
|
+
e = new OakPartialSuccess(message, _module, params);
|
|
524
530
|
break;
|
|
525
531
|
}
|
|
526
532
|
case 'OakRequestTimeoutException': {
|
|
527
|
-
e = new OakRequestTimeoutException(message,
|
|
533
|
+
e = new OakRequestTimeoutException(message, _module, params);
|
|
528
534
|
break;
|
|
529
535
|
}
|
|
530
536
|
case 'OakSignatureVerificationException': {
|
|
531
|
-
e = new OakSignatureVerificationException(message,
|
|
537
|
+
e = new OakSignatureVerificationException(message, _module, params);
|
|
538
|
+
break;
|
|
539
|
+
}
|
|
540
|
+
case 'OakApplicationHasToUpgrade': {
|
|
541
|
+
e = new OakApplicationHasToUpgrade(message, _module, params);
|
|
532
542
|
break;
|
|
533
543
|
}
|
|
534
544
|
default:
|
package/lib/types/Trigger.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SelectOption, CheckerType } from ".";
|
|
2
|
-
import {
|
|
2
|
+
import { ExcludeUpdateAction } from "../actions/action";
|
|
3
3
|
import { AsyncContext } from "../store/AsyncRowStore";
|
|
4
4
|
import { SyncContext } from "../store/SyncRowStore";
|
|
5
5
|
import { EntityDict, OperateOption } from "../types/Entity";
|
|
@@ -56,7 +56,7 @@ export type CreateTrigger<ED extends EntityDict & BaseEntityDict, T extends keyo
|
|
|
56
56
|
* 只要有,就会触发trigger。要注意的是这个条件是exists而不是all
|
|
57
57
|
*/
|
|
58
58
|
export interface UpdateTriggerBase<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED> | SyncContext<ED>> extends TriggerBase<ED, T> {
|
|
59
|
-
action: Exclude<ED[T]['Action'],
|
|
59
|
+
action: Exclude<ED[T]['Action'], ExcludeUpdateAction> | Array<Exclude<ED[T]['Action'], ExcludeUpdateAction>>;
|
|
60
60
|
attributes?: keyof ED[T]['OpSchema'] | Array<keyof ED[T]['OpSchema']>;
|
|
61
61
|
mt?: ModiTurn;
|
|
62
62
|
check?: (operation: ED[T]['Update']) => boolean;
|
package/lib/utils/version.d.ts
CHANGED
|
@@ -4,4 +4,10 @@
|
|
|
4
4
|
* @param reqVersion 比较版本
|
|
5
5
|
* @returns
|
|
6
6
|
*/
|
|
7
|
-
export declare
|
|
7
|
+
export declare function compareVersion(curVersion: string, reqVersion: string): number;
|
|
8
|
+
/**
|
|
9
|
+
* 是不是一个有效的版本号
|
|
10
|
+
* @param version
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export declare function isVersion(version: string): boolean;
|
package/lib/utils/version.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compareVersion = void 0;
|
|
3
|
+
exports.isVersion = exports.compareVersion = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* 版本比较
|
|
6
6
|
* @param curVersion 当前版本
|
|
7
7
|
* @param reqVersion 比较版本
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
function compareVersion(curVersion, reqVersion) {
|
|
11
11
|
const v1 = curVersion.split('.');
|
|
12
12
|
const v2 = reqVersion.split('.');
|
|
13
13
|
for (let i = 0; i < Math.max(v1.length, v2.length); i++) {
|
|
@@ -17,5 +17,15 @@ const compareVersion = (curVersion, reqVersion) => {
|
|
|
17
17
|
return num1 - num2;
|
|
18
18
|
}
|
|
19
19
|
return 0;
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
exports.compareVersion = compareVersion;
|
|
22
|
+
;
|
|
23
|
+
/**
|
|
24
|
+
* 是不是一个有效的版本号
|
|
25
|
+
* @param version
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
function isVersion(version) {
|
|
29
|
+
return /([1-9][0-9]*|[0-9])\.([1-9][0-9]*|[0-9])*\.([1-9][0-9]*|[0-9])*(\-[0-9A-Za-z-](\.[0-9A-Za-z-])*)*/g.test(version);
|
|
30
|
+
}
|
|
31
|
+
exports.isVersion = isVersion;
|