oak-domain 5.1.24 → 5.1.25

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.
@@ -350,30 +350,33 @@ function createAttrUpdateCheckers(schema, attrUpdateMatrix) {
350
350
  }
351
351
  const filters = condition.map(ele => {
352
352
  if (typeof ele?.filter === 'function') {
353
- return ele.filter(action || 'select');
353
+ return (ele.filter)({ action: action || 'select', data: data, filter }, context);
354
354
  }
355
355
  return ele?.filter;
356
- }).filter(ele => !!ele);
357
- const f = filters.length > 0 && (0, filter_1.combineFilters)(entity, schema, filters);
358
- if (f) {
359
- const result = (0, filter_1.checkFilterContains)(entity, context, f, filter, true);
360
- if (result instanceof Promise) {
361
- return result.then((v) => {
362
- if (!v) {
363
- if (attrs.length > 1) {
364
- return cascadelyCheckUpdateFilters(entity, schema, action || 'select', data, filter, matrix, attrs, context);
365
- }
366
- throw new types_1.OakAttrCantUpdateException(entity, attrs);
356
+ });
357
+ const checkFiltersInner = (filters2) => {
358
+ const filters3 = filters2.filter(ele => !!ele);
359
+ const f = filters3.length > 0 && (0, filter_1.combineFilters)(entity, schema, filters3);
360
+ const checkResultInner = (result2) => {
361
+ if (!result2) {
362
+ if (attrs.length > 1) {
363
+ return cascadelyCheckUpdateFilters(entity, schema, action || 'select', data, filter, matrix, attrs, context);
367
364
  }
368
- });
369
- }
370
- if (!result) {
371
- if (attrs.length > 1) {
372
- return cascadelyCheckUpdateFilters(entity, schema, action || 'select', data, filter, matrix, attrs, context);
365
+ throw new types_1.OakAttrCantUpdateException(entity, attrs);
373
366
  }
374
- throw new types_1.OakAttrCantUpdateException(entity, attrs, '更新的行当前属性不满足约束,请仔细检查数据');
367
+ };
368
+ if (f) {
369
+ const result = (0, filter_1.checkFilterContains)(entity, context, f, filter, true);
370
+ if (result instanceof Promise) {
371
+ return result.then((r) => checkResultInner(r));
372
+ }
373
+ return checkResultInner(result);
375
374
  }
375
+ };
376
+ if (filters.find(ele => ele instanceof Promise)) {
377
+ return Promise.all(filters).then((ff) => checkFiltersInner(ff));
376
378
  }
379
+ return checkFiltersInner(filters);
377
380
  }
378
381
  };
379
382
  checkers.push(updateChecker);
@@ -46,6 +46,7 @@ export type ServerConfiguration = {
46
46
  methods?: string[];
47
47
  };
48
48
  ui?: {
49
+ path?: string;
49
50
  disable?: boolean;
50
51
  username?: string;
51
52
  password?: string;
@@ -189,7 +189,7 @@ class SimpleConnector {
189
189
  };
190
190
  }
191
191
  async serializeResult(result, opRecords, headers, body, message) {
192
- if (result instanceof stream_1.Stream || result instanceof Buffer || result instanceof ReadableStream) {
192
+ if (result instanceof stream_1.Stream || result instanceof Buffer) {
193
193
  return {
194
194
  body: result,
195
195
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oak-domain",
3
- "version": "5.1.24",
3
+ "version": "5.1.25",
4
4
  "author": {
5
5
  "name": "XuChang"
6
6
  },