oak-domain 5.1.11 → 5.1.13
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/store/CascadeStore.js +3 -2
- package/lib/store/projection.d.ts +2 -0
- package/lib/store/projection.js +15 -0
- package/lib/store/relation.js +1 -1
- package/lib/types/Configuration.d.ts +11 -13
- package/lib/types/Exception.d.ts +3 -0
- package/lib/types/Exception.js +12 -1
- package/lib/types/Sync.d.ts +1 -0
- package/lib/utils/SimpleConnector.d.ts +1 -0
- package/lib/utils/SimpleConnector.js +21 -9
- package/package.json +1 -1
|
@@ -247,7 +247,8 @@ class CascadeStore extends RowStore_1.RowStore {
|
|
|
247
247
|
assignNecessaryProjectionAttrs(projectionNode, necessaryAttrs);
|
|
248
248
|
}
|
|
249
249
|
// 如果对象中指向一对多的Modi,此时加上指向Modi的projection
|
|
250
|
-
|
|
250
|
+
// 此逻辑关闭,用户自己撰写去取modi by Xc 20241207
|
|
251
|
+
/* if (this.getSchema()[entity2].toModi) {
|
|
251
252
|
Object.assign(projectionNode, {
|
|
252
253
|
modi$entity: {
|
|
253
254
|
$entity: 'modi',
|
|
@@ -268,7 +269,7 @@ class CascadeStore extends RowStore_1.RowStore {
|
|
|
268
269
|
},
|
|
269
270
|
}
|
|
270
271
|
});
|
|
271
|
-
}
|
|
272
|
+
} */
|
|
272
273
|
// 如果对象上有relation关系,在此将本用户相关的relation和actionAuth全部取出
|
|
273
274
|
// 还要将actionAuth上没有relation关系但destEntity为本对象的行也全部取出,这些是指向userId的可能路径
|
|
274
275
|
// 放在这里有点怪异,暂先这样
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fullModi = void 0;
|
|
4
|
+
exports.fullModi = {
|
|
5
|
+
id: 1,
|
|
6
|
+
targetEntity: 1,
|
|
7
|
+
entity: 1,
|
|
8
|
+
entityId: 1,
|
|
9
|
+
action: 1,
|
|
10
|
+
iState: 1,
|
|
11
|
+
data: 1,
|
|
12
|
+
filter: 1,
|
|
13
|
+
$$createAt$$: 1,
|
|
14
|
+
$$updateAt$$: 1,
|
|
15
|
+
};
|
package/lib/store/relation.js
CHANGED
|
@@ -35,7 +35,16 @@ export type ServerConfiguration = {
|
|
|
35
35
|
};
|
|
36
36
|
internalExceptionMask?: string;
|
|
37
37
|
koaBody?: {
|
|
38
|
-
|
|
38
|
+
multipart?: boolean;
|
|
39
|
+
formidable?: {
|
|
40
|
+
maxFileSize?: number;
|
|
41
|
+
maxFields?: number;
|
|
42
|
+
maxFieldsSize?: number;
|
|
43
|
+
uploadDir?: string;
|
|
44
|
+
keepExtensions?: boolean;
|
|
45
|
+
hashAlgorithm?: string;
|
|
46
|
+
multiples?: boolean;
|
|
47
|
+
};
|
|
39
48
|
};
|
|
40
49
|
};
|
|
41
50
|
/**
|
|
@@ -56,6 +65,7 @@ export type AccessConfiguration = {
|
|
|
56
65
|
path?: string;
|
|
57
66
|
};
|
|
58
67
|
timeout?: number;
|
|
68
|
+
clockDriftDuration?: number;
|
|
59
69
|
};
|
|
60
70
|
/**
|
|
61
71
|
* 业务逻辑的通用配置
|
|
@@ -78,15 +88,3 @@ export type DependencyConfiguration = string[];
|
|
|
78
88
|
export type RenderConfiguration<ED extends BaseEntityDict & EntityDict> = {
|
|
79
89
|
styleDict: StyleDict<ED>;
|
|
80
90
|
};
|
|
81
|
-
/**
|
|
82
|
-
* 编译环境配置
|
|
83
|
-
*/
|
|
84
|
-
export type CompilerConfiguration = {
|
|
85
|
-
webpack?: {
|
|
86
|
-
resolve?: {
|
|
87
|
-
alias?: Record<string, string>;
|
|
88
|
-
fallback?: Record<string, string | false>;
|
|
89
|
-
};
|
|
90
|
-
extraOakModules?: (string | RegExp)[];
|
|
91
|
-
};
|
|
92
|
-
};
|
package/lib/types/Exception.d.ts
CHANGED
|
@@ -77,6 +77,9 @@ export declare class OakServerProxyException<ED extends EntityDict & BaseEntityD
|
|
|
77
77
|
}
|
|
78
78
|
export declare class OakClockDriftException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
|
|
79
79
|
}
|
|
80
|
+
export declare class OakSignatureVerificationException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
|
|
81
|
+
constructor(message?: string);
|
|
82
|
+
}
|
|
80
83
|
/**
|
|
81
84
|
* 数据不一致异常,系统认为现有的数据不允许相应的动作时抛此异常
|
|
82
85
|
*
|
package/lib/types/Exception.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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.OakUserInvisibleException = exports.OakUserUnpermittedException = exports.OakAttrCantUpdateException = exports.OakAttrNotNullException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = 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.OakSocketConnectException = exports.OakExternalException = exports.OakPreConditionUnsetException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakUserInvisibleException = exports.OakUserUnpermittedException = 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 {
|
|
@@ -188,6 +188,13 @@ exports.OakServerProxyException = OakServerProxyException;
|
|
|
188
188
|
class OakClockDriftException extends OakException {
|
|
189
189
|
}
|
|
190
190
|
exports.OakClockDriftException = OakClockDriftException;
|
|
191
|
+
// 验签失败
|
|
192
|
+
class OakSignatureVerificationException extends OakException {
|
|
193
|
+
constructor(message) {
|
|
194
|
+
super(message || '验签失败');
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
exports.OakSignatureVerificationException = OakSignatureVerificationException;
|
|
191
198
|
// 在系统更新数据时,以下三个异常应按规范依次抛出。
|
|
192
199
|
/**
|
|
193
200
|
* 数据不一致异常,系统认为现有的数据不允许相应的动作时抛此异常
|
|
@@ -510,6 +517,10 @@ function makeException(data) {
|
|
|
510
517
|
e = new OakRequestTimeoutException(data.message);
|
|
511
518
|
break;
|
|
512
519
|
}
|
|
520
|
+
case 'OakSignatureVerificationException': {
|
|
521
|
+
e = new OakSignatureVerificationException(data.message);
|
|
522
|
+
break;
|
|
523
|
+
}
|
|
513
524
|
default:
|
|
514
525
|
return;
|
|
515
526
|
}
|
package/lib/types/Sync.d.ts
CHANGED
|
@@ -77,6 +77,7 @@ export interface SyncRemoteConfig<ED extends EntityDict & BaseEntityDict, Cxt ex
|
|
|
77
77
|
reason: Error;
|
|
78
78
|
}, context: Cxt) => Promise<void>;
|
|
79
79
|
timeout?: number;
|
|
80
|
+
clockDriftDuration?: number;
|
|
80
81
|
}
|
|
81
82
|
export interface SyncSelfConfigBase<ED extends EntityDict & BaseEntityDict> {
|
|
82
83
|
endpoint?: string;
|
|
@@ -18,6 +18,7 @@ export default class SimpleConnector<ED extends EntityDict & BaseEntityDict, Fro
|
|
|
18
18
|
private configuration;
|
|
19
19
|
private makeException;
|
|
20
20
|
private timeout;
|
|
21
|
+
private clockDriftDuration;
|
|
21
22
|
constructor(configuration: AccessConfiguration, makeException: (exceptionData: any) => OakException<ED>);
|
|
22
23
|
getCorsHeader(): string[];
|
|
23
24
|
protected makeHeadersAndBody(name: string, data: any, context?: FrontCxt): Promise<{
|
|
@@ -19,10 +19,12 @@ class SimpleConnector {
|
|
|
19
19
|
configuration;
|
|
20
20
|
makeException;
|
|
21
21
|
timeout;
|
|
22
|
+
clockDriftDuration;
|
|
22
23
|
constructor(configuration, makeException) {
|
|
23
24
|
this.configuration = configuration;
|
|
24
|
-
const { routerPrefixes, http, timeout } = configuration;
|
|
25
|
+
const { routerPrefixes, http, timeout, clockDriftDuration } = configuration;
|
|
25
26
|
this.timeout = timeout || 5000;
|
|
27
|
+
this.clockDriftDuration = clockDriftDuration || 10000;
|
|
26
28
|
const { ssl, hostname, port, path } = http;
|
|
27
29
|
const protocol = ssl ? 'https:' : 'http:';
|
|
28
30
|
let serverUrl = `${protocol}//${hostname}`;
|
|
@@ -77,7 +79,7 @@ class SimpleConnector {
|
|
|
77
79
|
async parseAspectResult(response) {
|
|
78
80
|
if (response.status > 299) {
|
|
79
81
|
const err = new types_1.OakServerProxyException(`网络请求返回status是${response.status}`);
|
|
80
|
-
throw err;
|
|
82
|
+
throw this.makeException(err);
|
|
81
83
|
}
|
|
82
84
|
const message = response.headers.get('oak-message');
|
|
83
85
|
const responseType = response.headers.get('Content-Type') ||
|
|
@@ -118,7 +120,14 @@ class SimpleConnector {
|
|
|
118
120
|
}
|
|
119
121
|
catch (err) {
|
|
120
122
|
// fetch返回异常一定是网络异常
|
|
121
|
-
|
|
123
|
+
let exception = err;
|
|
124
|
+
if (err instanceof types_1.OakRequestTimeoutException) {
|
|
125
|
+
exception = new types_1.OakNetworkException(`接口请求超时`);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
exception = new types_1.OakNetworkException(`接口请求时发生网络异常`);
|
|
129
|
+
}
|
|
130
|
+
throw this.makeException(exception);
|
|
122
131
|
}
|
|
123
132
|
return this.parseAspectResult(response);
|
|
124
133
|
}
|
|
@@ -140,11 +149,18 @@ class SimpleConnector {
|
|
|
140
149
|
response = await this.fetchWithTimeout(this.serverSubscribePointUrl, {}, this.timeout);
|
|
141
150
|
}
|
|
142
151
|
catch (err) {
|
|
143
|
-
|
|
152
|
+
let exception = err;
|
|
153
|
+
if (err instanceof types_1.OakRequestTimeoutException) {
|
|
154
|
+
exception = new types_1.OakNetworkException(`接口请求超时`);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
exception = new types_1.OakNetworkException(`接口请求时发生网络异常`);
|
|
158
|
+
}
|
|
159
|
+
throw this.makeException(exception);
|
|
144
160
|
}
|
|
145
161
|
if (response.status > 299) {
|
|
146
162
|
const err = new types_1.OakServerProxyException(`网络请求返回status是${response.status}`);
|
|
147
|
-
throw err;
|
|
163
|
+
throw this.makeException(err);
|
|
148
164
|
}
|
|
149
165
|
const message = response.headers.get('oak-message');
|
|
150
166
|
const responseType = response.headers.get('Content-Type') ||
|
|
@@ -213,10 +229,6 @@ class SimpleConnector {
|
|
|
213
229
|
* @param headers
|
|
214
230
|
*/
|
|
215
231
|
makeBridgeUrl(url, headers) {
|
|
216
|
-
// if (process.env.PROD !== 'true') {
|
|
217
|
-
// console.warn('在development下无法通过bridge访问资源,将直接访问,可能失败', url);
|
|
218
|
-
// return url;
|
|
219
|
-
// }
|
|
220
232
|
const encodeUrl = encodeURIComponent(url);
|
|
221
233
|
return `${this.serverBridgeUrl}?url=${encodeUrl}`;
|
|
222
234
|
}
|