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
|
-
})
|
|
357
|
-
const
|
|
358
|
-
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
if (
|
|
363
|
-
|
|
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
|
-
|
|
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);
|
|
@@ -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
|
|
192
|
+
if (result instanceof stream_1.Stream || result instanceof Buffer) {
|
|
193
193
|
return {
|
|
194
194
|
body: result,
|
|
195
195
|
headers: {
|