vona-module-a-orm 5.0.40 → 5.0.41
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/dist/index.js +14 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import { Event, BeanEventBase } from 'vona-module-a-event';
|
|
|
15
15
|
import { Schedule } from 'vona-module-a-schedule';
|
|
16
16
|
import { configAllWithIgnoreNull, configAll, configRedisWithIgnoreNull, configRedis } from 'vona-module-a-summer';
|
|
17
17
|
import { ServiceDatabaseAsyncLocalStorage as ServiceDatabaseAsyncLocalStorage$1, ServiceTransactionConsistency as ServiceTransactionConsistency_ } from 'vona-module-a-orm';
|
|
18
|
+
import { mutate } from 'mutate-on-copy';
|
|
18
19
|
|
|
19
20
|
var _dec$u, _dec2$u, _class$u;
|
|
20
21
|
let AopMethodTransaction = (_dec$u = AopMethod(), _dec2$u = BeanInfo({
|
|
@@ -3709,7 +3710,7 @@ function _DtoGet_relation_handle(entityClass, relation, mutateTypeTopLevel) {
|
|
|
3709
3710
|
options
|
|
3710
3711
|
} = relationReal;
|
|
3711
3712
|
const modelTarget = prepareClassModel(model);
|
|
3712
|
-
const optionsReal =
|
|
3713
|
+
const optionsReal = Object.assign({}, options, {
|
|
3713
3714
|
include: includeReal,
|
|
3714
3715
|
with: withReal
|
|
3715
3716
|
});
|
|
@@ -3832,21 +3833,29 @@ function _DtoMutate_raw(modelLike, params, mutateTypeTopLevel, columnsOmitDefaul
|
|
|
3832
3833
|
// entity
|
|
3833
3834
|
let entityClass = getClassEntityFromClassModel(modelClass);
|
|
3834
3835
|
// columns
|
|
3835
|
-
|
|
3836
|
+
let columns = prepareColumns(params?.columns);
|
|
3836
3837
|
if (columns) {
|
|
3837
3838
|
if (!topLevel) {
|
|
3838
3839
|
if (mutateTypeTopLevel === 'create') {
|
|
3839
3840
|
for (const key of ['deleted', 'id']) {
|
|
3840
3841
|
const index = columns.indexOf(key);
|
|
3841
|
-
if (index > -1)
|
|
3842
|
+
if (index > -1) {
|
|
3843
|
+
columns = mutate(columns, copyState => {
|
|
3844
|
+
copyState.splice(index, 1);
|
|
3845
|
+
});
|
|
3846
|
+
}
|
|
3842
3847
|
}
|
|
3843
3848
|
} else {
|
|
3844
3849
|
for (const key of ['deleted', 'id']) {
|
|
3845
|
-
if (!columns.includes(key))
|
|
3850
|
+
if (!columns.includes(key)) {
|
|
3851
|
+
columns = mutate(columns, copyState => {
|
|
3852
|
+
copyState.unshift(key);
|
|
3853
|
+
});
|
|
3854
|
+
}
|
|
3846
3855
|
}
|
|
3847
3856
|
}
|
|
3848
3857
|
}
|
|
3849
|
-
entityClass = $Class.pick(entityClass,
|
|
3858
|
+
entityClass = $Class.pick(entityClass, columns);
|
|
3850
3859
|
} else {
|
|
3851
3860
|
const columns = columnsOmitDefault ?? (mutateTypeTopLevel === 'create' ? ['id', 'iid', 'deleted', 'createdAt', 'updatedAt'] : ['iid', 'createdAt', 'updatedAt']);
|
|
3852
3861
|
entityClass = $Class.omit(entityClass, prepareColumns(columns));
|