oak-domain 2.5.1 → 2.6.1
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/actions/relation.d.ts +3 -3
- package/lib/actions/relation.js +1 -1
- package/lib/checkers/index.js +1 -1
- package/lib/store/CascadeStore.js +126 -108
- package/lib/store/checker.d.ts +1 -1
- package/lib/store/checker.js +191 -87
- package/lib/store/selection.d.ts +12 -0
- package/lib/store/selection.js +31 -1
- package/lib/types/Action.d.ts +3 -1
- package/lib/types/Auth.d.ts +4 -1
- package/lib/types/Connector.d.ts +1 -1
- package/lib/types/Entity.d.ts +1 -1
- package/lib/types/Exception.d.ts +21 -19
- package/lib/types/Exception.js +65 -21
- package/lib/utils/SimpleConnector.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CascadeRelationItem, RelationHierarchy } from "../types/Entity";
|
|
1
|
+
import { CascadeRelationItem, RelationHierarchy, EntityDict } from "../types/Entity";
|
|
2
2
|
export declare type GenericRelation = 'owner';
|
|
3
|
-
export declare function convertHierarchyToAuth<
|
|
4
|
-
[K in
|
|
3
|
+
export declare function convertHierarchyToAuth<ED extends EntityDict, T extends keyof ED>(entity: T, hierarchy: RelationHierarchy<NonNullable<ED[T]['Relation']>>): {
|
|
4
|
+
[K in NonNullable<ED[T]['Relation']>]?: CascadeRelationItem;
|
|
5
5
|
};
|
package/lib/actions/relation.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertHierarchyToAuth = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
function convertHierarchyToAuth(hierarchy) {
|
|
5
|
+
function convertHierarchyToAuth(entity, hierarchy) {
|
|
6
6
|
var e_1, _a;
|
|
7
7
|
var _b;
|
|
8
8
|
var reverseHierarchy = {};
|
package/lib/checkers/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var modi_1 = require("../store/modi");
|
|
|
7
7
|
function createDynamicCheckers(schema, authDict) {
|
|
8
8
|
var checkers = [];
|
|
9
9
|
checkers.push.apply(checkers, tslib_1.__spreadArray([], tslib_1.__read((0, modi_1.createModiRelatedCheckers)(schema)), false));
|
|
10
|
-
checkers.push.apply(checkers, tslib_1.__spreadArray([], tslib_1.__read((0, checker_1.createRemoveCheckers)(schema)), false));
|
|
10
|
+
checkers.push.apply(checkers, tslib_1.__spreadArray([], tslib_1.__read((0, checker_1.createRemoveCheckers)(schema, authDict)), false));
|
|
11
11
|
if (authDict) {
|
|
12
12
|
checkers.push.apply(checkers, tslib_1.__spreadArray([], tslib_1.__read((0, checker_1.createAuthCheckers)(schema, authDict)), false));
|
|
13
13
|
}
|
|
@@ -11,6 +11,7 @@ var types_1 = require("../types");
|
|
|
11
11
|
var lodash_1 = require("../utils/lodash");
|
|
12
12
|
var filter_2 = require("./filter");
|
|
13
13
|
var uuid_1 = require("../utils/uuid");
|
|
14
|
+
var selection_1 = require("./selection");
|
|
14
15
|
/**这个用来处理级联的select和update,对不同能力的 */
|
|
15
16
|
var CascadeStore = /** @class */ (function (_super) {
|
|
16
17
|
tslib_1.__extends(CascadeStore, _super);
|
|
@@ -100,20 +101,27 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
100
101
|
}
|
|
101
102
|
});
|
|
102
103
|
};
|
|
103
|
-
var entityIds = (0, lodash_1.uniq)(result.filter(function (ele) { return ele.entity === attr; }).map(function (ele) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
var entityIds = (0, lodash_1.uniq)(result.filter(function (ele) { return ele.entity === attr; }).map(function (ele) {
|
|
105
|
+
(0, assert_1.default)(ele.entityId !== null);
|
|
106
|
+
return ele.entityId;
|
|
107
|
+
}));
|
|
108
|
+
if (entityIds.length > 0) {
|
|
109
|
+
var subRows = cascadeSelectFn.call(_this, attr, {
|
|
110
|
+
data: projection2[attr],
|
|
111
|
+
filter: {
|
|
112
|
+
id: {
|
|
113
|
+
$in: entityIds
|
|
114
|
+
},
|
|
109
115
|
},
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
}, context, option);
|
|
117
|
+
if (subRows instanceof Promise) {
|
|
118
|
+
return subRows.then(function (subRowss) { return dealWithSubRows(subRowss); });
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
dealWithSubRows(subRows);
|
|
122
|
+
}
|
|
114
123
|
}
|
|
115
124
|
else {
|
|
116
|
-
dealWithSubRows(subRows);
|
|
117
125
|
}
|
|
118
126
|
});
|
|
119
127
|
}
|
|
@@ -191,18 +199,20 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
191
199
|
});
|
|
192
200
|
};
|
|
193
201
|
var ids = (0, lodash_1.uniq)(result.filter(function (ele) { return !!(ele["".concat(attr, "Id")]); }).map(function (ele) { return ele["".concat(attr, "Id")]; }));
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
202
|
+
if (ids.length > 0) {
|
|
203
|
+
var subRows = cascadeSelectFn.call(_this, relation, {
|
|
204
|
+
data: projection2[attr],
|
|
205
|
+
filter: {
|
|
206
|
+
id: {
|
|
207
|
+
$in: ids
|
|
208
|
+
},
|
|
199
209
|
},
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
210
|
+
}, context, option);
|
|
211
|
+
if (subRows instanceof Promise) {
|
|
212
|
+
return subRows.then(function (subRowss) { return dealWithSubRows(subRowss); });
|
|
213
|
+
}
|
|
214
|
+
dealWithSubRows(subRows);
|
|
204
215
|
}
|
|
205
|
-
dealWithSubRows(subRows);
|
|
206
216
|
});
|
|
207
217
|
}
|
|
208
218
|
}
|
|
@@ -261,21 +271,23 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
261
271
|
_a));
|
|
262
272
|
});
|
|
263
273
|
};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
274
|
+
if (ids.length > 0) {
|
|
275
|
+
var subRows = cascadeSelectFn.call(_this, entity2_1, {
|
|
276
|
+
data: subProjection_1,
|
|
277
|
+
filter: (0, filter_1.combineFilters)([(_a = {},
|
|
278
|
+
_a[foreignKey_1] = {
|
|
279
|
+
$in: ids,
|
|
280
|
+
},
|
|
281
|
+
_a), subFilter_1]),
|
|
282
|
+
sorter: subSorter_1,
|
|
283
|
+
indexFrom: indexFrom_1,
|
|
284
|
+
count: count_1
|
|
285
|
+
}, context, option);
|
|
286
|
+
if (subRows instanceof Promise) {
|
|
287
|
+
return subRows.then(function (subRowss) { return dealWithSubRows(subRowss); });
|
|
288
|
+
}
|
|
289
|
+
dealWithSubRows(subRows);
|
|
277
290
|
}
|
|
278
|
-
dealWithSubRows(subRows);
|
|
279
291
|
});
|
|
280
292
|
}
|
|
281
293
|
}
|
|
@@ -329,22 +341,24 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
329
341
|
_a));
|
|
330
342
|
});
|
|
331
343
|
};
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
if (ids.length > 0) {
|
|
345
|
+
var subRows = cascadeSelectFn.call(_this, entity2_1, {
|
|
346
|
+
data: subProjection_1,
|
|
347
|
+
filter: (0, filter_1.combineFilters)([{
|
|
348
|
+
entity: entity,
|
|
349
|
+
entityId: {
|
|
350
|
+
$in: ids,
|
|
351
|
+
}
|
|
352
|
+
}, subFilter_1]),
|
|
353
|
+
sorter: subSorter_1,
|
|
354
|
+
indexFrom: indexFrom_1,
|
|
355
|
+
count: count_1
|
|
356
|
+
}, context, option);
|
|
357
|
+
if (subRows instanceof Promise) {
|
|
358
|
+
return subRows.then(function (subRowss) { return dealWithSubRows(subRowss); });
|
|
359
|
+
}
|
|
360
|
+
dealWithSubRows(subRows);
|
|
346
361
|
}
|
|
347
|
-
dealWithSubRows(subRows);
|
|
348
362
|
});
|
|
349
363
|
}
|
|
350
364
|
}
|
|
@@ -708,11 +722,11 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
708
722
|
*/
|
|
709
723
|
CascadeStore.prototype.doUpdateSingleRowAsync = function (entity, operation, context, option) {
|
|
710
724
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
711
|
-
var data, action, operId, filter, now, _a, modiCreate, result_1, createInner, multipleCreate, data_1, data_1_1, d, createSingleOper, e_2_1, operatorId, createOper, _b, ids_1, selection, rows, modiUpsert, upsertModis, _c, originData, originId, createOper, updateAttrCount, result;
|
|
712
|
-
var e_2,
|
|
725
|
+
var data, action, operId, filter, now, _a, modiCreate, result_1, createInner, multipleCreate, data_1, data_1_1, d, createSingleOper, e_2_1, operatorId, createOper, _b, ids_1, selection, rows, modiUpsert, upsertModis, _c, originData, originId, _d, createOper, updateAttrCount, result;
|
|
726
|
+
var e_2, _e, _f, _g, _h, _j, _k, _l;
|
|
713
727
|
var _this = this;
|
|
714
|
-
return tslib_1.__generator(this, function (
|
|
715
|
-
switch (
|
|
728
|
+
return tslib_1.__generator(this, function (_m) {
|
|
729
|
+
switch (_m.label) {
|
|
716
730
|
case 0:
|
|
717
731
|
data = operation.data, action = operation.action, operId = operation.id, filter = operation.filter;
|
|
718
732
|
now = Date.now();
|
|
@@ -746,7 +760,7 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
746
760
|
};
|
|
747
761
|
return [4 /*yield*/, this.cascadeUpdateAsync('modi', modiCreate, context, option)];
|
|
748
762
|
case 2:
|
|
749
|
-
|
|
763
|
+
_m.sent();
|
|
750
764
|
return [2 /*return*/, 1];
|
|
751
765
|
case 3:
|
|
752
766
|
result_1 = 0;
|
|
@@ -836,12 +850,12 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
836
850
|
if (!multipleCreate) return [3 /*break*/, 5];
|
|
837
851
|
return [4 /*yield*/, createInner(operation)];
|
|
838
852
|
case 4:
|
|
839
|
-
|
|
853
|
+
_m.sent();
|
|
840
854
|
return [3 /*break*/, 12];
|
|
841
855
|
case 5:
|
|
842
|
-
|
|
856
|
+
_m.trys.push([5, 10, 11, 12]);
|
|
843
857
|
data_1 = tslib_1.__values(data), data_1_1 = data_1.next();
|
|
844
|
-
|
|
858
|
+
_m.label = 6;
|
|
845
859
|
case 6:
|
|
846
860
|
if (!!data_1_1.done) return [3 /*break*/, 9];
|
|
847
861
|
d = data_1_1.value;
|
|
@@ -852,27 +866,27 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
852
866
|
};
|
|
853
867
|
return [4 /*yield*/, createInner(createSingleOper)];
|
|
854
868
|
case 7:
|
|
855
|
-
|
|
856
|
-
|
|
869
|
+
_m.sent();
|
|
870
|
+
_m.label = 8;
|
|
857
871
|
case 8:
|
|
858
872
|
data_1_1 = data_1.next();
|
|
859
873
|
return [3 /*break*/, 6];
|
|
860
874
|
case 9: return [3 /*break*/, 12];
|
|
861
875
|
case 10:
|
|
862
|
-
e_2_1 =
|
|
876
|
+
e_2_1 = _m.sent();
|
|
863
877
|
e_2 = { error: e_2_1 };
|
|
864
878
|
return [3 /*break*/, 12];
|
|
865
879
|
case 11:
|
|
866
880
|
try {
|
|
867
|
-
if (data_1_1 && !data_1_1.done && (
|
|
881
|
+
if (data_1_1 && !data_1_1.done && (_e = data_1.return)) _e.call(data_1);
|
|
868
882
|
}
|
|
869
883
|
finally { if (e_2) throw e_2.error; }
|
|
870
884
|
return [7 /*endfinally*/];
|
|
871
885
|
case 12: return [3 /*break*/, 15];
|
|
872
886
|
case 13: return [4 /*yield*/, createInner(operation)];
|
|
873
887
|
case 14:
|
|
874
|
-
|
|
875
|
-
|
|
888
|
+
_m.sent();
|
|
889
|
+
_m.label = 15;
|
|
876
890
|
case 15:
|
|
877
891
|
if (!option.dontCollect) {
|
|
878
892
|
context.opRecords.push({
|
|
@@ -886,20 +900,20 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
886
900
|
(0, assert_1.default)(operId);
|
|
887
901
|
return [4 /*yield*/, context.getCurrentUserId(true)];
|
|
888
902
|
case 16:
|
|
889
|
-
operatorId =
|
|
903
|
+
operatorId = _m.sent();
|
|
890
904
|
if (!operatorId) return [3 /*break*/, 22];
|
|
891
|
-
|
|
905
|
+
_f = {
|
|
892
906
|
id: 'dummy',
|
|
893
907
|
action: 'create'
|
|
894
908
|
};
|
|
895
|
-
|
|
909
|
+
_g = {
|
|
896
910
|
id: operId,
|
|
897
911
|
action: action,
|
|
898
912
|
data: data,
|
|
899
913
|
operatorId: operatorId
|
|
900
914
|
};
|
|
901
915
|
if (!(data instanceof Array)) return [3 /*break*/, 18];
|
|
902
|
-
|
|
916
|
+
_h = {
|
|
903
917
|
id: 'dummy',
|
|
904
918
|
action: 'create'
|
|
905
919
|
};
|
|
@@ -918,34 +932,34 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
918
932
|
});
|
|
919
933
|
}); }))];
|
|
920
934
|
case 17:
|
|
921
|
-
_b = (
|
|
922
|
-
|
|
935
|
+
_b = (_h.data = _m.sent(),
|
|
936
|
+
_h);
|
|
923
937
|
return [3 /*break*/, 20];
|
|
924
938
|
case 18:
|
|
925
|
-
|
|
939
|
+
_j = {
|
|
926
940
|
id: 'dummy',
|
|
927
941
|
action: 'create'
|
|
928
942
|
};
|
|
929
|
-
|
|
943
|
+
_k = {};
|
|
930
944
|
return [4 /*yield*/, (0, uuid_1.generateNewIdAsync)()];
|
|
931
945
|
case 19:
|
|
932
|
-
_b = [(
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
946
|
+
_b = [(_j.data = (_k.id = _m.sent(),
|
|
947
|
+
_k.entity = entity,
|
|
948
|
+
_k.entityId = data.id,
|
|
949
|
+
_k),
|
|
950
|
+
_j)];
|
|
951
|
+
_m.label = 20;
|
|
938
952
|
case 20:
|
|
939
|
-
createOper = (
|
|
940
|
-
|
|
941
|
-
|
|
953
|
+
createOper = (_f.data = (_g.operEntity$oper = _b,
|
|
954
|
+
_g),
|
|
955
|
+
_f);
|
|
942
956
|
return [4 /*yield*/, this.cascadeUpdateAsync('oper', createOper, context, {
|
|
943
957
|
dontCollect: true,
|
|
944
958
|
dontCreateOper: true,
|
|
945
959
|
})];
|
|
946
960
|
case 21:
|
|
947
|
-
|
|
948
|
-
|
|
961
|
+
_m.sent();
|
|
962
|
+
_m.label = 22;
|
|
949
963
|
case 22: return [2 /*return*/, result_1];
|
|
950
964
|
case 23:
|
|
951
965
|
ids_1 = (0, filter_2.getRelevantIds)(filter);
|
|
@@ -962,9 +976,9 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
962
976
|
dontCollect: true,
|
|
963
977
|
})];
|
|
964
978
|
case 24:
|
|
965
|
-
rows =
|
|
979
|
+
rows = _m.sent();
|
|
966
980
|
ids_1.push.apply(ids_1, tslib_1.__spreadArray([], tslib_1.__read((rows.map(function (ele) { return ele.id; }))), false));
|
|
967
|
-
|
|
981
|
+
_m.label = 25;
|
|
968
982
|
case 25:
|
|
969
983
|
if (data) {
|
|
970
984
|
this.preProcessDataUpdated(data);
|
|
@@ -1003,7 +1017,7 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
1003
1017
|
count: 1,
|
|
1004
1018
|
}, context, option)];
|
|
1005
1019
|
case 26:
|
|
1006
|
-
upsertModis =
|
|
1020
|
+
upsertModis = _m.sent();
|
|
1007
1021
|
if (upsertModis.length > 0) {
|
|
1008
1022
|
_c = upsertModis[0], originData = _c.data, originId = _c.id;
|
|
1009
1023
|
modiUpsert = {
|
|
@@ -1017,24 +1031,26 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
1017
1031
|
}
|
|
1018
1032
|
};
|
|
1019
1033
|
}
|
|
1020
|
-
|
|
1034
|
+
_m.label = 27;
|
|
1021
1035
|
case 27:
|
|
1022
1036
|
if (!!modiUpsert) return [3 /*break*/, 29];
|
|
1023
|
-
|
|
1037
|
+
modiUpsert = {
|
|
1024
1038
|
id: 'dummy',
|
|
1025
|
-
action: 'create'
|
|
1039
|
+
action: 'create',
|
|
1040
|
+
data: {
|
|
1041
|
+
id: operId,
|
|
1042
|
+
targetEntity: entity,
|
|
1043
|
+
entity: option.modiParentEntity,
|
|
1044
|
+
entityId: option.modiParentId,
|
|
1045
|
+
action: action,
|
|
1046
|
+
data: data,
|
|
1047
|
+
iState: 'active',
|
|
1048
|
+
filter: filter,
|
|
1049
|
+
},
|
|
1026
1050
|
};
|
|
1051
|
+
if (!(ids_1.length > 0)) return [3 /*break*/, 29];
|
|
1052
|
+
_d = modiUpsert.data;
|
|
1027
1053
|
_l = {
|
|
1028
|
-
id: operId,
|
|
1029
|
-
targetEntity: entity,
|
|
1030
|
-
entity: option.modiParentEntity,
|
|
1031
|
-
entityId: option.modiParentId,
|
|
1032
|
-
action: action,
|
|
1033
|
-
data: data,
|
|
1034
|
-
iState: 'active',
|
|
1035
|
-
filter: filter
|
|
1036
|
-
};
|
|
1037
|
-
_m = {
|
|
1038
1054
|
id: 'dummy',
|
|
1039
1055
|
action: 'create'
|
|
1040
1056
|
};
|
|
@@ -1053,14 +1069,12 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
1053
1069
|
});
|
|
1054
1070
|
}); }))];
|
|
1055
1071
|
case 28:
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
_k);
|
|
1060
|
-
_o.label = 29;
|
|
1072
|
+
_d.modiEntity$modi = (_l.data = _m.sent(),
|
|
1073
|
+
_l);
|
|
1074
|
+
_m.label = 29;
|
|
1061
1075
|
case 29: return [4 /*yield*/, this.cascadeUpdateAsync('modi', modiUpsert, context, option)];
|
|
1062
1076
|
case 30:
|
|
1063
|
-
|
|
1077
|
+
_m.sent();
|
|
1064
1078
|
return [2 /*return*/, 1];
|
|
1065
1079
|
case 31:
|
|
1066
1080
|
createOper = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
@@ -1155,15 +1169,15 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
1155
1169
|
return [4 /*yield*/, createOper()];
|
|
1156
1170
|
case 34:
|
|
1157
1171
|
// 如果不是update动作而是用户自定义的动作,这里还是要记录oper
|
|
1158
|
-
|
|
1172
|
+
_m.sent();
|
|
1159
1173
|
return [2 /*return*/, 0];
|
|
1160
1174
|
case 35: return [2 /*return*/, 0];
|
|
1161
1175
|
case 36: return [4 /*yield*/, this.updateAbjointRowAsync(entity, operation, context, option)];
|
|
1162
1176
|
case 37:
|
|
1163
|
-
result =
|
|
1177
|
+
result = _m.sent();
|
|
1164
1178
|
return [4 /*yield*/, createOper()];
|
|
1165
1179
|
case 38:
|
|
1166
|
-
|
|
1180
|
+
_m.sent();
|
|
1167
1181
|
return [2 /*return*/, result];
|
|
1168
1182
|
}
|
|
1169
1183
|
});
|
|
@@ -1239,6 +1253,7 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
1239
1253
|
};
|
|
1240
1254
|
CascadeStore.prototype.cascadeUpdate = function (entity, operation, context, option) {
|
|
1241
1255
|
var e_5, _a, e_6, _b, e_7, _c;
|
|
1256
|
+
(0, selection_1.reinforceOperation)(this.getSchema(), entity, operation);
|
|
1242
1257
|
var action = operation.action, data = operation.data, filter = operation.filter, id = operation.id;
|
|
1243
1258
|
var opData;
|
|
1244
1259
|
var wholeBeforeFns = [];
|
|
@@ -1315,6 +1330,7 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
1315
1330
|
return tslib_1.__generator(this, function (_h) {
|
|
1316
1331
|
switch (_h.label) {
|
|
1317
1332
|
case 0:
|
|
1333
|
+
(0, selection_1.reinforceOperation)(this.getSchema(), entity, operation);
|
|
1318
1334
|
action = operation.action, data = operation.data, filter = operation.filter, id = operation.id;
|
|
1319
1335
|
wholeBeforeFns = [];
|
|
1320
1336
|
wholeAfterFns = [];
|
|
@@ -1413,6 +1429,7 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
1413
1429
|
});
|
|
1414
1430
|
};
|
|
1415
1431
|
CascadeStore.prototype.cascadeSelect = function (entity, selection, context, option) {
|
|
1432
|
+
(0, selection_1.reinforceSelection)(this.getSchema(), entity, selection);
|
|
1416
1433
|
var data = selection.data, filter = selection.filter, indexFrom = selection.indexFrom, count = selection.count, sorter = selection.sorter;
|
|
1417
1434
|
var _a = this.destructCascadeSelect(entity, data, context, this.cascadeSelect, this.aggregateSync, option), projection = _a.projection, cascadeSelectionFns = _a.cascadeSelectionFns;
|
|
1418
1435
|
var rows = this.selectAbjointRow(entity, {
|
|
@@ -1534,6 +1551,7 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
1534
1551
|
return tslib_1.__generator(this, function (_b) {
|
|
1535
1552
|
switch (_b.label) {
|
|
1536
1553
|
case 0:
|
|
1554
|
+
(0, selection_1.reinforceSelection)(this.getSchema(), entity, selection);
|
|
1537
1555
|
data = selection.data, filter = selection.filter, indexFrom = selection.indexFrom, count = selection.count, sorter = selection.sorter;
|
|
1538
1556
|
_a = this.destructCascadeSelect(entity, data, context, this.cascadeSelectAsync, this.aggregateAsync, option), projection = _a.projection, cascadeSelectionFns = _a.cascadeSelectionFns;
|
|
1539
1557
|
return [4 /*yield*/, this.selectAbjointRowAsync(entity, {
|
package/lib/store/checker.d.ts
CHANGED
|
@@ -23,4 +23,4 @@ export declare function createAuthCheckers<ED extends EntityDict & BaseEntityDic
|
|
|
23
23
|
* @returns
|
|
24
24
|
* 如果有的对象允许删除,需要使用trigger来处理其相关联的外键对象,这些trigger写作before,则会在checker之前执行,仍然可以删除成功
|
|
25
25
|
*/
|
|
26
|
-
export declare function createRemoveCheckers<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED> | SyncContext<ED>>(schema: StorageSchema<ED>): Checker<ED, keyof ED, Cxt>[];
|
|
26
|
+
export declare function createRemoveCheckers<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED> | SyncContext<ED>>(schema: StorageSchema<ED>, authDict?: AuthDefDict<ED>): Checker<ED, keyof ED, Cxt>[];
|