oak-domain 5.1.12 → 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.
@@ -247,7 +247,8 @@ class CascadeStore extends RowStore_1.RowStore {
247
247
  assignNecessaryProjectionAttrs(projectionNode, necessaryAttrs);
248
248
  }
249
249
  // 如果对象中指向一对多的Modi,此时加上指向Modi的projection
250
- if (this.getSchema()[entity2].toModi) {
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,2 @@
1
+ import { Projection } from '../base-app-domain/Modi/Schema';
2
+ export declare const fullModi: Projection;
@@ -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
+ };
@@ -42,7 +42,7 @@ function judgeRelation(schema, entity, attr, allowUnrecognized) {
42
42
  }
43
43
  else {
44
44
  // 这种情况应该不会跑到
45
- (0, assert_1.default)(false);
45
+ (0, assert_1.default)(false, `非法的属性名:[${attr}]`);
46
46
  }
47
47
  }
48
48
  else if ((attributes.hasOwnProperty(`${attr}Id`))) {
@@ -65,6 +65,7 @@ export type AccessConfiguration = {
65
65
  path?: string;
66
66
  };
67
67
  timeout?: number;
68
+ clockDriftDuration?: number;
68
69
  };
69
70
  /**
70
71
  * 业务逻辑的通用配置
@@ -87,15 +88,3 @@ export type DependencyConfiguration = string[];
87
88
  export type RenderConfiguration<ED extends BaseEntityDict & EntityDict> = {
88
89
  styleDict: StyleDict<ED>;
89
90
  };
90
- /**
91
- * 编译环境配置
92
- */
93
- export type CompilerConfiguration = {
94
- webpack?: {
95
- resolve?: {
96
- alias?: Record<string, string>;
97
- fallback?: Record<string, string | false>;
98
- };
99
- extraOakModules?: (string | RegExp)[];
100
- };
101
- };
@@ -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
  *
@@ -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
  }
@@ -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,10 +120,14 @@ class SimpleConnector {
118
120
  }
119
121
  catch (err) {
120
122
  // fetch返回异常一定是网络异常
123
+ let exception = err;
121
124
  if (err instanceof types_1.OakRequestTimeoutException) {
122
- throw new types_1.OakNetworkException(`接口请求超时`);
125
+ exception = new types_1.OakNetworkException(`接口请求超时`);
123
126
  }
124
- throw new types_1.OakNetworkException(`接口请求时发生网络异常`);
127
+ else {
128
+ exception = new types_1.OakNetworkException(`接口请求时发生网络异常`);
129
+ }
130
+ throw this.makeException(exception);
125
131
  }
126
132
  return this.parseAspectResult(response);
127
133
  }
@@ -143,14 +149,18 @@ class SimpleConnector {
143
149
  response = await this.fetchWithTimeout(this.serverSubscribePointUrl, {}, this.timeout);
144
150
  }
145
151
  catch (err) {
152
+ let exception = err;
146
153
  if (err instanceof types_1.OakRequestTimeoutException) {
147
- throw new types_1.OakNetworkException(`接口请求超时`);
154
+ exception = new types_1.OakNetworkException(`接口请求超时`);
155
+ }
156
+ else {
157
+ exception = new types_1.OakNetworkException(`接口请求时发生网络异常`);
148
158
  }
149
- throw new types_1.OakNetworkException(`接口请求时发生网络异常`);
159
+ throw this.makeException(exception);
150
160
  }
151
161
  if (response.status > 299) {
152
162
  const err = new types_1.OakServerProxyException(`网络请求返回status是${response.status}`);
153
- throw err;
163
+ throw this.makeException(err);
154
164
  }
155
165
  const message = response.headers.get('oak-message');
156
166
  const responseType = response.headers.get('Content-Type') ||
@@ -219,10 +229,6 @@ class SimpleConnector {
219
229
  * @param headers
220
230
  */
221
231
  makeBridgeUrl(url, headers) {
222
- // if (process.env.PROD !== 'true') {
223
- //     console.warn('在development下无法通过bridge访问资源,将直接访问,可能失败', url);
224
- //     return url;
225
- // }
226
232
  const encodeUrl = encodeURIComponent(url);
227
233
  return `${this.serverBridgeUrl}?url=${encodeUrl}`;
228
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oak-domain",
3
- "version": "5.1.12",
3
+ "version": "5.1.13",
4
4
  "author": {
5
5
  "name": "XuChang"
6
6
  },