oak-domain 5.1.16 → 5.1.18
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/base-app-domain/ActionAuth/Schema.d.ts +19 -171
- package/lib/base-app-domain/ActionAuth/Schema.js +2 -0
- package/lib/base-app-domain/ActionAuth/_baseSchema.d.ts +44 -0
- package/lib/base-app-domain/ActionAuth/_baseSchema.js +2 -0
- package/lib/base-app-domain/EntityDict.d.ts +695 -14
- package/lib/base-app-domain/I18n/Schema.d.ts +19 -129
- package/lib/base-app-domain/I18n/Schema.js +2 -0
- package/lib/base-app-domain/I18n/_baseSchema.d.ts +51 -0
- package/lib/base-app-domain/I18n/_baseSchema.js +2 -0
- package/lib/base-app-domain/Log/Schema.d.ts +19 -141
- package/lib/base-app-domain/Log/Schema.js +2 -0
- package/lib/base-app-domain/Log/Style.d.ts +2 -2
- package/lib/base-app-domain/Log/_baseSchema.d.ts +44 -0
- package/lib/base-app-domain/Log/_baseSchema.js +2 -0
- package/lib/base-app-domain/Modi/Schema.d.ts +19 -130
- package/lib/base-app-domain/Modi/Schema.js +2 -0
- package/lib/base-app-domain/Modi/Style.d.ts +2 -2
- package/lib/base-app-domain/Modi/_baseSchema.d.ts +61 -0
- package/lib/base-app-domain/Modi/_baseSchema.js +2 -0
- package/lib/base-app-domain/ModiEntity/Schema.d.ts +19 -367
- package/lib/base-app-domain/ModiEntity/Schema.js +2 -0
- package/lib/base-app-domain/ModiEntity/Storage.js +1 -2
- package/lib/base-app-domain/ModiEntity/_baseSchema.d.ts +44 -0
- package/lib/base-app-domain/ModiEntity/_baseSchema.js +2 -0
- package/lib/base-app-domain/Oper/Schema.d.ts +19 -201
- package/lib/base-app-domain/Oper/Schema.js +2 -0
- package/lib/base-app-domain/Oper/Style.d.ts +2 -2
- package/lib/base-app-domain/Oper/_baseSchema.d.ts +67 -0
- package/lib/base-app-domain/Oper/_baseSchema.js +2 -0
- package/lib/base-app-domain/OperEntity/Schema.d.ts +19 -367
- package/lib/base-app-domain/OperEntity/Schema.js +2 -0
- package/lib/base-app-domain/OperEntity/Storage.js +1 -2
- package/lib/base-app-domain/OperEntity/_baseSchema.d.ts +44 -0
- package/lib/base-app-domain/OperEntity/_baseSchema.js +2 -0
- package/lib/base-app-domain/Path/Schema.d.ts +19 -157
- package/lib/base-app-domain/Path/Schema.js +2 -0
- package/lib/base-app-domain/Path/_baseSchema.d.ts +52 -0
- package/lib/base-app-domain/Path/_baseSchema.js +2 -0
- package/lib/base-app-domain/Relation/Schema.d.ts +19 -198
- package/lib/base-app-domain/Relation/Schema.js +2 -0
- package/lib/base-app-domain/Relation/_baseSchema.d.ts +48 -0
- package/lib/base-app-domain/Relation/_baseSchema.js +2 -0
- package/lib/base-app-domain/RelationAuth/Schema.d.ts +19 -199
- package/lib/base-app-domain/RelationAuth/Schema.js +2 -0
- package/lib/base-app-domain/RelationAuth/_baseSchema.d.ts +41 -0
- package/lib/base-app-domain/RelationAuth/_baseSchema.js +2 -0
- package/lib/base-app-domain/User/Schema.d.ts +19 -222
- package/lib/base-app-domain/User/Schema.js +2 -0
- package/lib/base-app-domain/User/Style.d.ts +2 -2
- package/lib/base-app-domain/User/_baseSchema.d.ts +53 -0
- package/lib/base-app-domain/User/_baseSchema.js +2 -0
- package/lib/base-app-domain/UserEntityClaim/Schema.d.ts +19 -264
- package/lib/base-app-domain/UserEntityClaim/Schema.js +2 -0
- package/lib/base-app-domain/UserEntityClaim/_baseSchema.d.ts +49 -0
- package/lib/base-app-domain/UserEntityClaim/_baseSchema.js +2 -0
- package/lib/base-app-domain/UserEntityGrant/Schema.d.ts +19 -136
- package/lib/base-app-domain/UserEntityGrant/Schema.js +2 -0
- package/lib/base-app-domain/UserEntityGrant/_baseSchema.d.ts +46 -0
- package/lib/base-app-domain/UserEntityGrant/_baseSchema.js +2 -0
- package/lib/base-app-domain/UserRelation/Schema.d.ts +19 -212
- package/lib/base-app-domain/UserRelation/Schema.js +2 -0
- package/lib/base-app-domain/UserRelation/_baseSchema.d.ts +47 -0
- package/lib/base-app-domain/UserRelation/_baseSchema.js +2 -0
- package/lib/compiler/localeBuilder.d.ts +1 -0
- package/lib/compiler/localeBuilder.js +9 -2
- package/lib/compiler/schemalBuilder.d.ts +1 -0
- package/lib/compiler/schemalBuilder.js +1368 -186
- package/lib/data/i18n.d.ts +3 -0
- package/lib/data/i18n.js +32 -0
- package/lib/store/CascadeStore.d.ts +3 -3
- package/lib/store/CascadeStore.js +28 -27
- package/lib/store/RelationAuth.d.ts +1 -1
- package/lib/store/RelationAuth.js +6 -6
- package/lib/store/TriggerExecutor.js +11 -5
- package/lib/store/checker.js +1 -1
- package/lib/store/filter.d.ts +11 -11
- package/lib/store/filter.js +14 -8
- package/lib/store/modi.d.ts +2 -2
- package/lib/store/triggers.js +14 -14
- package/lib/timers/vaccum.d.ts +1 -1
- package/lib/types/Auth.d.ts +4 -4
- package/lib/types/Cluster.d.ts +1 -0
- package/lib/types/Configuration.d.ts +9 -0
- package/lib/types/Entity.d.ts +5 -1
- package/lib/types/EntityDesc.d.ts +1 -1
- package/lib/types/Exception.d.ts +26 -21
- package/lib/types/Exception.js +81 -71
- package/lib/types/Expression.d.ts +4 -1
- package/lib/types/Port.d.ts +1 -1
- package/lib/types/Trigger.d.ts +1 -1
- package/lib/types/Watcher.d.ts +3 -3
- package/lib/utils/projection.d.ts +2 -2
- package/lib/utils/relationPath.d.ts +4 -4
- package/lib/utils/relationPath.js +1 -1
- package/lib/utils/validator.d.ts +2 -2
- package/package.json +2 -2
package/lib/types/Exception.d.ts
CHANGED
|
@@ -3,12 +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
|
+
params?: Record<string, any>;
|
|
8
|
+
constructor(message?: string, _module?: string, params?: Record<string, any>);
|
|
7
9
|
addData<T extends keyof ED>(entity: T, rows: Partial<ED[T]['Schema']>[], schema: StorageSchema<ED>): void;
|
|
8
10
|
setOpRecords(opRecords: OpRecord<ED>[]): void;
|
|
9
11
|
getSerialData(): {
|
|
10
12
|
name: string;
|
|
11
13
|
message: string;
|
|
14
|
+
_module: string | undefined;
|
|
12
15
|
opRecords: OpRecord<ED>[];
|
|
13
16
|
tag1: string | undefined;
|
|
14
17
|
tag2: boolean | undefined;
|
|
@@ -20,7 +23,7 @@ export declare class OakException<ED extends EntityDict & BaseEntityDict> extend
|
|
|
20
23
|
tag3?: any;
|
|
21
24
|
}
|
|
22
25
|
export declare class OakRequestTimeoutException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
|
|
23
|
-
constructor(message?: string);
|
|
26
|
+
constructor(message?: string, ns?: string, params?: Record<string, any>);
|
|
24
27
|
}
|
|
25
28
|
export declare class OakMakeSureByMySelfException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
|
|
26
29
|
}
|
|
@@ -31,7 +34,7 @@ export declare class OakDataException<ED extends EntityDict & BaseEntityDict> ex
|
|
|
31
34
|
export declare class OakNoRelationDefException<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakDataException<ED> {
|
|
32
35
|
entity: T;
|
|
33
36
|
actions: ED[T]['Action'][];
|
|
34
|
-
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>);
|
|
35
38
|
toString(): string;
|
|
36
39
|
}
|
|
37
40
|
export declare class OakOperExistedException<ED extends EntityDict & BaseEntityDict> extends OakDataException<ED> {
|
|
@@ -41,7 +44,7 @@ export declare class OakRowUnexistedException<ED extends EntityDict & BaseEntity
|
|
|
41
44
|
constructor(rows: Array<{
|
|
42
45
|
entity: any;
|
|
43
46
|
selection: any;
|
|
44
|
-
}>);
|
|
47
|
+
}>, msg?: string, _module?: string, params?: Record<string, any>);
|
|
45
48
|
toString(): string;
|
|
46
49
|
getRows(): {
|
|
47
50
|
entity: any;
|
|
@@ -61,12 +64,12 @@ export declare class OakUniqueViolationException<ED extends EntityDict & BaseEnt
|
|
|
61
64
|
constructor(rows: Array<{
|
|
62
65
|
id?: string;
|
|
63
66
|
attrs: string[];
|
|
64
|
-
}>, message?: string);
|
|
67
|
+
}>, message?: string, _module?: string, params?: Record<string, any>);
|
|
65
68
|
}
|
|
66
69
|
export declare class OakImportDataParseException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
67
70
|
line: number;
|
|
68
71
|
header?: string;
|
|
69
|
-
constructor(message: string, line: number, header?: string);
|
|
72
|
+
constructor(message: string, line: number, header?: string, _module?: string, params?: Record<string, any>);
|
|
70
73
|
}
|
|
71
74
|
/**
|
|
72
75
|
* 网络中断异常
|
|
@@ -78,7 +81,7 @@ export declare class OakServerProxyException<ED extends EntityDict & BaseEntityD
|
|
|
78
81
|
export declare class OakClockDriftException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
|
|
79
82
|
}
|
|
80
83
|
export declare class OakSignatureVerificationException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
|
|
81
|
-
constructor(message?: string);
|
|
84
|
+
constructor(message?: string, _module?: string, params?: Record<string, any>);
|
|
82
85
|
}
|
|
83
86
|
/**
|
|
84
87
|
* 数据不一致异常,系统认为现有的数据不允许相应的动作时抛此异常
|
|
@@ -93,7 +96,7 @@ export declare class OakRowInconsistencyException<ED extends EntityDict & BaseEn
|
|
|
93
96
|
export declare class OakInputIllegalException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
94
97
|
private attributes;
|
|
95
98
|
private entity;
|
|
96
|
-
constructor(entity: keyof ED, attributes: string[], message?: string);
|
|
99
|
+
constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record<string, any>);
|
|
97
100
|
getEntity(): keyof ED;
|
|
98
101
|
getAttributes(): string[];
|
|
99
102
|
addAttributesPrefix(prefix: string): void;
|
|
@@ -103,43 +106,43 @@ export declare class OakInputIllegalException<ED extends EntityDict & BaseEntity
|
|
|
103
106
|
* 属性为空时抛的异常
|
|
104
107
|
*/
|
|
105
108
|
export declare class OakAttrNotNullException<ED extends EntityDict & BaseEntityDict> extends OakInputIllegalException<ED> {
|
|
106
|
-
constructor(entity: keyof ED, attributes: string[], message?: string);
|
|
109
|
+
constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record<string, any>);
|
|
107
110
|
}
|
|
108
111
|
/**
|
|
109
112
|
* 属性不允许更新抛的异常,前端可以用这个异常来处理update时对应属性的露出
|
|
110
113
|
*/
|
|
111
114
|
export declare class OakAttrCantUpdateException<ED extends EntityDict & BaseEntityDict> extends OakInputIllegalException<ED> {
|
|
112
|
-
constructor(entity: keyof ED, attributes: string[], message?: string);
|
|
115
|
+
constructor(entity: keyof ED, attributes: string[], message?: string, _module?: string, params?: Record<string, any>);
|
|
113
116
|
}
|
|
114
117
|
/**
|
|
115
118
|
* 用户权限不够时抛的异常
|
|
116
119
|
*/
|
|
117
|
-
export declare class
|
|
120
|
+
export declare class OakOperationUnpermittedException<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakUserException<ED> {
|
|
118
121
|
private entity;
|
|
119
122
|
private operation;
|
|
120
|
-
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>);
|
|
121
124
|
toString(): string;
|
|
122
125
|
}
|
|
123
126
|
/**
|
|
124
127
|
* 用户查询权限不够抛出异常
|
|
125
128
|
*/
|
|
126
|
-
export declare class
|
|
129
|
+
export declare class OakDataInvisibleException<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakUserException<ED> {
|
|
127
130
|
private entity;
|
|
128
131
|
private operation;
|
|
129
|
-
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>);
|
|
130
133
|
toString(): string;
|
|
131
134
|
}
|
|
132
135
|
/**
|
|
133
136
|
* 用户未登录抛的异常
|
|
134
137
|
*/
|
|
135
138
|
export declare class OakUnloggedInException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
136
|
-
constructor(message?: string);
|
|
139
|
+
constructor(message?: string, _module?: string, params?: Record<string, any>);
|
|
137
140
|
}
|
|
138
141
|
/**
|
|
139
142
|
* 行数据被锁抛的异常
|
|
140
143
|
*/
|
|
141
144
|
export declare class OakRowLockedException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
142
|
-
constructor(message?: string);
|
|
145
|
+
constructor(message?: string, _module?: string, params?: Record<string, any>);
|
|
143
146
|
}
|
|
144
147
|
/**
|
|
145
148
|
* 要插入行时,发现已经有相同的行数据
|
|
@@ -147,7 +150,7 @@ export declare class OakRowLockedException<ED extends EntityDict & BaseEntityDic
|
|
|
147
150
|
export declare class OakCongruentRowExists<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakUserException<ED> {
|
|
148
151
|
private data;
|
|
149
152
|
private entity;
|
|
150
|
-
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>);
|
|
151
154
|
getData(): ED[T]["OpSchema"];
|
|
152
155
|
getEntity(): T;
|
|
153
156
|
toString(): string;
|
|
@@ -156,7 +159,7 @@ export declare class OakCongruentRowExists<ED extends EntityDict & BaseEntityDic
|
|
|
156
159
|
* 死锁抛的异常
|
|
157
160
|
*/
|
|
158
161
|
export declare class OakDeadlock<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
159
|
-
constructor(message?: string
|
|
162
|
+
constructor(message?: string, _module?: string, params?: Record<string, any>);
|
|
160
163
|
}
|
|
161
164
|
/**
|
|
162
165
|
* 前置条件不满足抛的异常
|
|
@@ -164,7 +167,7 @@ export declare class OakDeadlock<ED extends EntityDict & BaseEntityDict> extends
|
|
|
164
167
|
export declare class OakPreConditionUnsetException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
165
168
|
entity?: keyof ED;
|
|
166
169
|
code?: string;
|
|
167
|
-
constructor(message?: string
|
|
170
|
+
constructor(message?: string, entity?: keyof ED, code?: string, _module?: string, params?: Record<string, any>);
|
|
168
171
|
toString(): string;
|
|
169
172
|
}
|
|
170
173
|
/**
|
|
@@ -174,18 +177,20 @@ export declare class OakExternalException<ED extends EntityDict & BaseEntityDict
|
|
|
174
177
|
code?: string;
|
|
175
178
|
source: string;
|
|
176
179
|
data?: any;
|
|
177
|
-
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>);
|
|
178
181
|
toString(): string;
|
|
179
182
|
}
|
|
180
183
|
/**
|
|
181
184
|
* socket连接异常
|
|
182
185
|
*/
|
|
183
186
|
export declare class OakSocketConnectException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
184
|
-
constructor(message?: string);
|
|
187
|
+
constructor(message?: string, _module?: string, params?: Record<string, any>);
|
|
185
188
|
}
|
|
186
189
|
export declare function makeException<ED extends EntityDict & BaseEntityDict>(data: {
|
|
187
190
|
name: string;
|
|
188
191
|
message?: string;
|
|
192
|
+
_module?: string;
|
|
193
|
+
params?: Record<string, any>;
|
|
189
194
|
opRecords: OpRecord<ED>[];
|
|
190
195
|
[A: string]: any;
|
|
191
196
|
}): OakException<ED> | undefined;
|
package/lib/types/Exception.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
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.
|
|
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;
|
|
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
|
+
params;
|
|
10
|
+
constructor(message, _module, params) {
|
|
9
11
|
super(message);
|
|
12
|
+
this._module = _module;
|
|
13
|
+
this.params = params;
|
|
10
14
|
this.name = new.target.name;
|
|
11
15
|
if (typeof Error.captureStackTrace === 'function') {
|
|
12
16
|
Error.captureStackTrace(this, new.target);
|
|
@@ -75,6 +79,7 @@ class OakException extends Error {
|
|
|
75
79
|
return {
|
|
76
80
|
name: this.constructor.name,
|
|
77
81
|
message: this.message,
|
|
82
|
+
_module: this._module,
|
|
78
83
|
opRecords: this.opRecords,
|
|
79
84
|
tag1: this.tag1,
|
|
80
85
|
tag2: this.tag2,
|
|
@@ -92,8 +97,8 @@ class OakException extends Error {
|
|
|
92
97
|
exports.OakException = OakException;
|
|
93
98
|
// 请求超时
|
|
94
99
|
class OakRequestTimeoutException extends OakException {
|
|
95
|
-
constructor(message) {
|
|
96
|
-
super(message || '
|
|
100
|
+
constructor(message, ns, params) {
|
|
101
|
+
super(message || 'error::requestTimeout', ns || 'oak-domain', params);
|
|
97
102
|
}
|
|
98
103
|
}
|
|
99
104
|
exports.OakRequestTimeoutException = OakRequestTimeoutException;
|
|
@@ -111,8 +116,11 @@ exports.OakDataException = OakDataException;
|
|
|
111
116
|
class OakNoRelationDefException extends OakDataException {
|
|
112
117
|
entity;
|
|
113
118
|
actions;
|
|
114
|
-
constructor(entity, actions, msg) {
|
|
115
|
-
super(msg ||
|
|
119
|
+
constructor(entity, actions, msg, _module, params) {
|
|
120
|
+
super(msg || 'error::noRelationDef', _module || 'oak-domain', params || {
|
|
121
|
+
entity,
|
|
122
|
+
actions: actions.join(',')
|
|
123
|
+
});
|
|
116
124
|
this.entity = entity;
|
|
117
125
|
this.actions = actions;
|
|
118
126
|
}
|
|
@@ -132,8 +140,10 @@ exports.OakOperExistedException = OakOperExistedException;
|
|
|
132
140
|
class OakRowUnexistedException extends OakDataException {
|
|
133
141
|
rows;
|
|
134
142
|
// 指定主键查询时却发现行不存在,一般发生在缓存中
|
|
135
|
-
constructor(rows) {
|
|
136
|
-
super(
|
|
143
|
+
constructor(rows, msg, _module, params) {
|
|
144
|
+
super(msg || 'error::rowUnexisted', _module || 'oak-domain', params || {
|
|
145
|
+
entity: rows[0].entity,
|
|
146
|
+
});
|
|
137
147
|
this.rows = rows;
|
|
138
148
|
}
|
|
139
149
|
toString() {
|
|
@@ -157,8 +167,8 @@ exports.OakUserException = OakUserException;
|
|
|
157
167
|
;
|
|
158
168
|
class OakUniqueViolationException extends OakUserException {
|
|
159
169
|
rows;
|
|
160
|
-
constructor(rows, message) {
|
|
161
|
-
super(message || '
|
|
170
|
+
constructor(rows, message, _module, params) {
|
|
171
|
+
super(message || 'error::uniqViolation', _module || 'oak-domain', params);
|
|
162
172
|
this.rows = rows;
|
|
163
173
|
}
|
|
164
174
|
}
|
|
@@ -167,8 +177,8 @@ class OakImportDataParseException extends OakUserException {
|
|
|
167
177
|
line;
|
|
168
178
|
header;
|
|
169
179
|
// message必传,描述具体错误的数据内容
|
|
170
|
-
constructor(message, line, header) {
|
|
171
|
-
super(message);
|
|
180
|
+
constructor(message, line, header, _module, params) {
|
|
181
|
+
super(message || 'error::importedDataParseError', _module || 'oak-domain', params);
|
|
172
182
|
this.line = line;
|
|
173
183
|
this.header = header;
|
|
174
184
|
}
|
|
@@ -190,8 +200,8 @@ class OakClockDriftException extends OakException {
|
|
|
190
200
|
exports.OakClockDriftException = OakClockDriftException;
|
|
191
201
|
// 验签失败
|
|
192
202
|
class OakSignatureVerificationException extends OakException {
|
|
193
|
-
constructor(message) {
|
|
194
|
-
super(message || '
|
|
203
|
+
constructor(message, _module, params) {
|
|
204
|
+
super(message || 'error::signatureFailed', _module || 'oak-domain', params);
|
|
195
205
|
}
|
|
196
206
|
}
|
|
197
207
|
exports.OakSignatureVerificationException = OakSignatureVerificationException;
|
|
@@ -214,8 +224,8 @@ exports.OakRowInconsistencyException = OakRowInconsistencyException;
|
|
|
214
224
|
class OakInputIllegalException extends OakUserException {
|
|
215
225
|
attributes;
|
|
216
226
|
entity;
|
|
217
|
-
constructor(entity, attributes, message) {
|
|
218
|
-
super(message);
|
|
227
|
+
constructor(entity, attributes, message, _module, params) {
|
|
228
|
+
super(message, _module, params);
|
|
219
229
|
this.entity = entity;
|
|
220
230
|
this.attributes = attributes;
|
|
221
231
|
}
|
|
@@ -243,8 +253,8 @@ exports.OakInputIllegalException = OakInputIllegalException;
|
|
|
243
253
|
* 属性为空时抛的异常
|
|
244
254
|
*/
|
|
245
255
|
class OakAttrNotNullException extends OakInputIllegalException {
|
|
246
|
-
constructor(entity, attributes, message) {
|
|
247
|
-
super(entity, attributes, message ||
|
|
256
|
+
constructor(entity, attributes, message, _module, params) {
|
|
257
|
+
super(entity, attributes, message || 'error::attributesNull', _module || 'oak-domain', params);
|
|
248
258
|
}
|
|
249
259
|
}
|
|
250
260
|
exports.OakAttrNotNullException = OakAttrNotNullException;
|
|
@@ -252,19 +262,19 @@ exports.OakAttrNotNullException = OakAttrNotNullException;
|
|
|
252
262
|
* 属性不允许更新抛的异常,前端可以用这个异常来处理update时对应属性的露出
|
|
253
263
|
*/
|
|
254
264
|
class OakAttrCantUpdateException extends OakInputIllegalException {
|
|
255
|
-
constructor(entity, attributes, message) {
|
|
256
|
-
super(entity, attributes, message ||
|
|
265
|
+
constructor(entity, attributes, message, _module, params) {
|
|
266
|
+
super(entity, attributes, message || 'error::attributesCantUpdate', _module || 'oak-domain', params);
|
|
257
267
|
}
|
|
258
268
|
}
|
|
259
269
|
exports.OakAttrCantUpdateException = OakAttrCantUpdateException;
|
|
260
270
|
/**
|
|
261
271
|
* 用户权限不够时抛的异常
|
|
262
272
|
*/
|
|
263
|
-
class
|
|
273
|
+
class OakOperationUnpermittedException extends OakUserException {
|
|
264
274
|
entity;
|
|
265
275
|
operation;
|
|
266
|
-
constructor(entity, operation, message) {
|
|
267
|
-
super(message || '
|
|
276
|
+
constructor(entity, operation, message, _module, params) {
|
|
277
|
+
super(message || 'error::operationUnpermitted', _module || 'oak-domain', params);
|
|
268
278
|
this.entity = entity;
|
|
269
279
|
this.operation = operation;
|
|
270
280
|
}
|
|
@@ -277,16 +287,16 @@ class OakUserUnpermittedException extends OakUserException {
|
|
|
277
287
|
});
|
|
278
288
|
}
|
|
279
289
|
}
|
|
280
|
-
exports.
|
|
290
|
+
exports.OakOperationUnpermittedException = OakOperationUnpermittedException;
|
|
281
291
|
;
|
|
282
292
|
/**
|
|
283
293
|
* 用户查询权限不够抛出异常
|
|
284
294
|
*/
|
|
285
|
-
class
|
|
295
|
+
class OakDataInvisibleException extends OakUserException {
|
|
286
296
|
entity;
|
|
287
297
|
operation;
|
|
288
|
-
constructor(entity, operation, message) {
|
|
289
|
-
super(message || '
|
|
298
|
+
constructor(entity, operation, message, _module, params) {
|
|
299
|
+
super(message || 'error::dataInvisible', _module || 'oak-domain', params);
|
|
290
300
|
this.entity = entity;
|
|
291
301
|
this.operation = operation;
|
|
292
302
|
}
|
|
@@ -299,14 +309,14 @@ class OakUserInvisibleException extends OakUserException {
|
|
|
299
309
|
});
|
|
300
310
|
}
|
|
301
311
|
}
|
|
302
|
-
exports.
|
|
312
|
+
exports.OakDataInvisibleException = OakDataInvisibleException;
|
|
303
313
|
;
|
|
304
314
|
/**
|
|
305
315
|
* 用户未登录抛的异常
|
|
306
316
|
*/
|
|
307
317
|
class OakUnloggedInException extends OakUserException {
|
|
308
|
-
constructor(message) {
|
|
309
|
-
super(message || '
|
|
318
|
+
constructor(message, _module, params) {
|
|
319
|
+
super(message || 'error::unLoggedIn', _module || 'oak-domain', params);
|
|
310
320
|
}
|
|
311
321
|
}
|
|
312
322
|
exports.OakUnloggedInException = OakUnloggedInException;
|
|
@@ -315,8 +325,8 @@ exports.OakUnloggedInException = OakUnloggedInException;
|
|
|
315
325
|
* 行数据被锁抛的异常
|
|
316
326
|
*/
|
|
317
327
|
class OakRowLockedException extends OakUserException {
|
|
318
|
-
constructor(message) {
|
|
319
|
-
super(message || '
|
|
328
|
+
constructor(message, _module, params) {
|
|
329
|
+
super(message || 'error::rowLocked', _module || 'oak-domain', params);
|
|
320
330
|
}
|
|
321
331
|
}
|
|
322
332
|
exports.OakRowLockedException = OakRowLockedException;
|
|
@@ -327,8 +337,8 @@ exports.OakRowLockedException = OakRowLockedException;
|
|
|
327
337
|
class OakCongruentRowExists extends OakUserException {
|
|
328
338
|
data;
|
|
329
339
|
entity;
|
|
330
|
-
constructor(entity, data, message) {
|
|
331
|
-
super(message);
|
|
340
|
+
constructor(entity, data, message, _module, params) {
|
|
341
|
+
super(message || 'error::congrentRowExists', _module || 'oak-domain', params);
|
|
332
342
|
this.data = data;
|
|
333
343
|
this.entity = entity;
|
|
334
344
|
}
|
|
@@ -352,8 +362,8 @@ exports.OakCongruentRowExists = OakCongruentRowExists;
|
|
|
352
362
|
* 死锁抛的异常
|
|
353
363
|
*/
|
|
354
364
|
class OakDeadlock extends OakUserException {
|
|
355
|
-
constructor(message) {
|
|
356
|
-
super(message || '
|
|
365
|
+
constructor(message, _module, params) {
|
|
366
|
+
super(message || 'error::deadlock', _module || 'oak-domain', params);
|
|
357
367
|
}
|
|
358
368
|
}
|
|
359
369
|
exports.OakDeadlock = OakDeadlock;
|
|
@@ -364,8 +374,8 @@ exports.OakDeadlock = OakDeadlock;
|
|
|
364
374
|
class OakPreConditionUnsetException extends OakUserException {
|
|
365
375
|
entity;
|
|
366
376
|
code;
|
|
367
|
-
constructor(message, entity, code) {
|
|
368
|
-
super(message || '
|
|
377
|
+
constructor(message, entity, code, _module, params) {
|
|
378
|
+
super(message || 'error::preconditionUnset', _module || 'oak-domain', params);
|
|
369
379
|
this.entity = entity,
|
|
370
380
|
this.code = code;
|
|
371
381
|
}
|
|
@@ -386,8 +396,8 @@ class OakExternalException extends OakUserException {
|
|
|
386
396
|
code;
|
|
387
397
|
source;
|
|
388
398
|
data;
|
|
389
|
-
constructor(source, code, message, data) {
|
|
390
|
-
super(message);
|
|
399
|
+
constructor(source, code, message, data, _module, params) {
|
|
400
|
+
super(message || 'error::externalException', _module || 'oak-domain', params);
|
|
391
401
|
this.code = code;
|
|
392
402
|
this.source = source;
|
|
393
403
|
this.data = data;
|
|
@@ -407,118 +417,118 @@ exports.OakExternalException = OakExternalException;
|
|
|
407
417
|
* socket连接异常
|
|
408
418
|
*/
|
|
409
419
|
class OakSocketConnectException extends OakUserException {
|
|
410
|
-
constructor(message) {
|
|
411
|
-
super(message || '
|
|
420
|
+
constructor(message, _module, params) {
|
|
421
|
+
super(message || 'error::socketConnectException', _module || 'oak-domain', params);
|
|
412
422
|
}
|
|
413
423
|
}
|
|
414
424
|
exports.OakSocketConnectException = OakSocketConnectException;
|
|
415
425
|
;
|
|
416
426
|
function makeException(data) {
|
|
417
|
-
const { name } = data;
|
|
427
|
+
const { name, message, _module, params } = data;
|
|
418
428
|
let e = undefined;
|
|
419
429
|
switch (name) {
|
|
420
430
|
case 'OakException': {
|
|
421
|
-
e = new OakException(
|
|
431
|
+
e = new OakException(message, _module, params);
|
|
422
432
|
break;
|
|
423
433
|
}
|
|
424
434
|
case 'OakUserException': {
|
|
425
|
-
e = new OakUserException(
|
|
435
|
+
e = new OakUserException(message, _module, params);
|
|
426
436
|
break;
|
|
427
437
|
}
|
|
428
438
|
case 'OakRowInconsistencyException': {
|
|
429
|
-
e = new OakRowInconsistencyException(
|
|
439
|
+
e = new OakRowInconsistencyException(message, _module, params);
|
|
430
440
|
break;
|
|
431
441
|
}
|
|
432
442
|
case 'OakInputIllegalException': {
|
|
433
|
-
e = new OakInputIllegalException(data.entity, data.attributes,
|
|
443
|
+
e = new OakInputIllegalException(data.entity, data.attributes, message, _module, params);
|
|
434
444
|
break;
|
|
435
445
|
}
|
|
436
446
|
case 'OakAttrCantUpdateException': {
|
|
437
|
-
e = new OakAttrCantUpdateException(data.entity, data.attributes,
|
|
447
|
+
e = new OakAttrCantUpdateException(data.entity, data.attributes, message, _module, params);
|
|
438
448
|
break;
|
|
439
449
|
}
|
|
440
|
-
case '
|
|
441
|
-
e = new
|
|
450
|
+
case 'OakOperationUnpermittedException': {
|
|
451
|
+
e = new OakOperationUnpermittedException(data.entity, data.operation, message, _module, params);
|
|
442
452
|
break;
|
|
443
453
|
}
|
|
444
|
-
case '
|
|
445
|
-
e = new
|
|
454
|
+
case 'OakDataInvisibleException': {
|
|
455
|
+
e = new OakDataInvisibleException(data.entity, data.operation, message, _module, params);
|
|
446
456
|
break;
|
|
447
457
|
}
|
|
448
458
|
case 'OakUnloggedInException': {
|
|
449
|
-
e = new OakUnloggedInException(
|
|
459
|
+
e = new OakUnloggedInException(message, _module, params);
|
|
450
460
|
break;
|
|
451
461
|
}
|
|
452
462
|
case 'OakCongruentRowExists': {
|
|
453
|
-
e = new OakCongruentRowExists(data.entity, data.data,
|
|
463
|
+
e = new OakCongruentRowExists(data.entity, data.data, message, _module, params);
|
|
454
464
|
break;
|
|
455
465
|
}
|
|
456
466
|
case 'OakRowLockedException': {
|
|
457
|
-
e = new OakRowLockedException(
|
|
467
|
+
e = new OakRowLockedException(message, _module, params);
|
|
458
468
|
break;
|
|
459
469
|
}
|
|
460
470
|
case 'OakRowUnexistedException': {
|
|
461
|
-
e = new OakRowUnexistedException(data.rows);
|
|
471
|
+
e = new OakRowUnexistedException(data.rows, message, _module, params);
|
|
462
472
|
break;
|
|
463
473
|
}
|
|
464
474
|
case 'OakDeadlock': {
|
|
465
|
-
e = new OakDeadlock(
|
|
475
|
+
e = new OakDeadlock(message, _module, params);
|
|
466
476
|
break;
|
|
467
477
|
}
|
|
468
478
|
case 'OakDataException': {
|
|
469
|
-
e = new OakDataException(
|
|
479
|
+
e = new OakDataException(message, _module, params);
|
|
470
480
|
break;
|
|
471
481
|
}
|
|
472
482
|
case 'OakNoRelationDefException': {
|
|
473
|
-
e = new OakNoRelationDefException(data.entity, data.action,
|
|
483
|
+
e = new OakNoRelationDefException(data.entity, data.action, message, _module, params);
|
|
474
484
|
break;
|
|
475
485
|
}
|
|
476
486
|
case 'OakUniqueViolationException': {
|
|
477
|
-
e = new OakUniqueViolationException(data.rows,
|
|
487
|
+
e = new OakUniqueViolationException(data.rows, message, _module, params);
|
|
478
488
|
break;
|
|
479
489
|
}
|
|
480
490
|
case 'OakImportDataParseException': {
|
|
481
|
-
e = new OakImportDataParseException(
|
|
491
|
+
e = new OakImportDataParseException(message, data.line, data.header, _module, params);
|
|
482
492
|
break;
|
|
483
493
|
}
|
|
484
494
|
case 'OakPreConditionUnsetException': {
|
|
485
|
-
e = new OakPreConditionUnsetException(
|
|
495
|
+
e = new OakPreConditionUnsetException(message, data.entity, data.code, _module, params);
|
|
486
496
|
break;
|
|
487
497
|
}
|
|
488
498
|
case 'OakAttrNotNullException': {
|
|
489
|
-
e = new OakAttrNotNullException(data.entity, data.attributes,
|
|
499
|
+
e = new OakAttrNotNullException(data.entity, data.attributes, message, _module, params);
|
|
490
500
|
break;
|
|
491
501
|
}
|
|
492
502
|
case 'OakExternalException': {
|
|
493
|
-
e = new OakExternalException(data.source, data.code,
|
|
503
|
+
e = new OakExternalException(data.source, data.code, message, data.data, _module, params);
|
|
494
504
|
break;
|
|
495
505
|
}
|
|
496
506
|
case 'OakNetworkException': {
|
|
497
|
-
e = new OakNetworkException(
|
|
507
|
+
e = new OakNetworkException(message, _module, params);
|
|
498
508
|
break;
|
|
499
509
|
}
|
|
500
510
|
case 'OakClockDriftException': {
|
|
501
|
-
e = new OakClockDriftException(
|
|
511
|
+
e = new OakClockDriftException(message, _module, params);
|
|
502
512
|
break;
|
|
503
513
|
}
|
|
504
514
|
case 'OakServerProxyException': {
|
|
505
|
-
e = new OakServerProxyException(
|
|
515
|
+
e = new OakServerProxyException(message, _module, params);
|
|
506
516
|
break;
|
|
507
517
|
}
|
|
508
518
|
case 'OakSocketConnectException': {
|
|
509
|
-
e = new OakSocketConnectException(
|
|
519
|
+
e = new OakSocketConnectException(message, _module, params);
|
|
510
520
|
break;
|
|
511
521
|
}
|
|
512
522
|
case 'OakPartialSuccess': {
|
|
513
|
-
e = new OakPartialSuccess(
|
|
523
|
+
e = new OakPartialSuccess(message, _module, params);
|
|
514
524
|
break;
|
|
515
525
|
}
|
|
516
526
|
case 'OakRequestTimeoutException': {
|
|
517
|
-
e = new OakRequestTimeoutException(
|
|
527
|
+
e = new OakRequestTimeoutException(message, _module, params);
|
|
518
528
|
break;
|
|
519
529
|
}
|
|
520
530
|
case 'OakSignatureVerificationException': {
|
|
521
|
-
e = new OakSignatureVerificationException(
|
|
531
|
+
e = new OakSignatureVerificationException(message, _module, params);
|
|
522
532
|
break;
|
|
523
533
|
}
|
|
524
534
|
default:
|
|
@@ -27,10 +27,13 @@ interface Floor<A> {
|
|
|
27
27
|
interface Ceil<A> {
|
|
28
28
|
$ceil: MathType<A>;
|
|
29
29
|
}
|
|
30
|
+
interface Pow<A> {
|
|
31
|
+
$pow: [MathType<A>, MathType<A>];
|
|
32
|
+
}
|
|
30
33
|
interface Mod<A> {
|
|
31
34
|
$mod: [MathType<A>, MathType<A>];
|
|
32
35
|
}
|
|
33
|
-
type MathExpression<A> = Add<A> | Subtract<A> | Multiply<A> | Divide<A> | Abs<A> | Round<A> | Floor<A> | Ceil<A> | Mod<A>;
|
|
36
|
+
type MathExpression<A> = Add<A> | Subtract<A> | Multiply<A> | Divide<A> | Abs<A> | Round<A> | Floor<A> | Ceil<A> | Pow<A> | Mod<A>;
|
|
34
37
|
type CmpType<A> = RefOrExpression<A> | string | number;
|
|
35
38
|
interface Gt<A> {
|
|
36
39
|
$gt: [CmpType<A>, CmpType<A>];
|
package/lib/types/Port.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type Exportation<ED extends EntityDict & BaseEntityDict, T extends keyof
|
|
|
5
5
|
name: string;
|
|
6
6
|
id: string;
|
|
7
7
|
entity: T;
|
|
8
|
-
projection: ED[T]['
|
|
8
|
+
projection: ED[T]['Projection'];
|
|
9
9
|
headers?: K[];
|
|
10
10
|
makeHeaders?: (dataList: Partial<ED[T]['Schema']>[]) => string[];
|
|
11
11
|
fn: (data: ED[T]['Schema'], context?: Cxt, properties?: Record<string, any>) => Promise<Partial<Record<string, string | number | boolean | null>>> | Partial<Record<string, string | number | boolean | null>>;
|
package/lib/types/Trigger.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export interface UpdateTriggerBase<ED extends EntityDict & BaseEntityDict, T ext
|
|
|
60
60
|
attributes?: keyof ED[T]['OpSchema'] | Array<keyof ED[T]['OpSchema']>;
|
|
61
61
|
mt?: ModiTurn;
|
|
62
62
|
check?: (operation: ED[T]['Update']) => boolean;
|
|
63
|
-
filter?: ED[T]['
|
|
63
|
+
filter?: ED[T]['Filter'] | ((operation: ED[T]['Update'], context: Cxt, option: OperateOption) => ED[T]['Filter'] | Promise<ED[T]['Filter']>);
|
|
64
64
|
}
|
|
65
65
|
export interface UpdateTriggerInTxn<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED> | SyncContext<ED>> extends UpdateTriggerBase<ED, T, Cxt> {
|
|
66
66
|
when: 'before' | 'after';
|
package/lib/types/Watcher.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ type ActionData<ED extends EntityDict & BaseEntityDict, T extends keyof ED> = ED
|
|
|
6
6
|
export interface BBWatcher<ED extends EntityDict & BaseEntityDict, T extends keyof ED> {
|
|
7
7
|
name: string;
|
|
8
8
|
entity: T;
|
|
9
|
-
filter: ED[T]['
|
|
9
|
+
filter: ED[T]['Filter'] | (() => ED[T]['Filter']);
|
|
10
10
|
action: Omit<ED[T]['Action'], 'create' | ReadOnlyAction>;
|
|
11
11
|
actionData: ActionData<ED, T> | (() => Promise<ActionData<ED, T>>);
|
|
12
12
|
singleton?: true;
|
|
@@ -14,8 +14,8 @@ export interface BBWatcher<ED extends EntityDict & BaseEntityDict, T extends key
|
|
|
14
14
|
export interface WBWatcher<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>> {
|
|
15
15
|
name: string;
|
|
16
16
|
entity: T;
|
|
17
|
-
filter: ED[T]['
|
|
18
|
-
projection: ED[T]['
|
|
17
|
+
filter: ED[T]['Filter'] | (() => Promise<ED[T]['Filter']>);
|
|
18
|
+
projection: ED[T]['Projection'] | (() => Promise<ED[T]['Projection']>);
|
|
19
19
|
fn: (context: Cxt, data: Partial<ED[T]['Schema']>[]) => Promise<OperationResult<ED>>;
|
|
20
20
|
forUpdate?: true;
|
|
21
21
|
singleton?: true;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EntityDict } from '../types/Entity';
|
|
2
2
|
import { EntityDict as BaseEntityDict } from '../base-app-domain';
|
|
3
3
|
import { StorageSchema } from '../types/Storage';
|
|
4
|
-
export declare function makeProjection<ED extends BaseEntityDict & EntityDict, T extends keyof ED>(entity: T, schema: StorageSchema<ED>): ED[T]["
|
|
5
|
-
export declare function traverseProjection<ED extends BaseEntityDict & EntityDict, T extends keyof ED>(entity: T, schema: StorageSchema<ED>, projection: ED[T]['
|
|
4
|
+
export declare function makeProjection<ED extends BaseEntityDict & EntityDict, T extends keyof ED>(entity: T, schema: StorageSchema<ED>): ED[T]["Projection"];
|
|
5
|
+
export declare function traverseProjection<ED extends BaseEntityDict & EntityDict, T extends keyof ED>(entity: T, schema: StorageSchema<ED>, projection: ED[T]['Projection'], callback: <T2 extends keyof ED>(entity2: T2, projection2: ED[T2]['Projection']) => void): void;
|