oak-domain 5.1.4 → 5.1.5
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.
|
@@ -148,7 +148,7 @@ class RelationAuth {
|
|
|
148
148
|
if (!entity2) {
|
|
149
149
|
entity2 = relations[0]?.entity;
|
|
150
150
|
}
|
|
151
|
-
else {
|
|
151
|
+
else if (relations.length) {
|
|
152
152
|
(0, assert_1.default)(entity2 === relations[0]?.entity);
|
|
153
153
|
}
|
|
154
154
|
return relations.map(ele => ele.id);
|
|
@@ -156,6 +156,7 @@ class RelationAuth {
|
|
|
156
156
|
const relationIds = getRelationIds();
|
|
157
157
|
if (relationIds instanceof Promise) {
|
|
158
158
|
return relationIds.then((ids) => {
|
|
159
|
+
(0, assert_1.default)(ids.length > 0);
|
|
159
160
|
return Promise.all(ids.map(ele => checkOnRelationId(entity2, ele, entityFilter))).then((value) => {
|
|
160
161
|
if (intersection) {
|
|
161
162
|
return !(value.includes(false));
|
|
@@ -164,6 +165,10 @@ class RelationAuth {
|
|
|
164
165
|
});
|
|
165
166
|
});
|
|
166
167
|
}
|
|
168
|
+
if (relationIds.length === 0) {
|
|
169
|
+
// 如果没有relationId(前端cache中),直接返回false
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
167
172
|
const value = relationIds.map(ele => checkOnRelationId(entity2, ele, entityFilter));
|
|
168
173
|
if (intersection) {
|
|
169
174
|
return !(value.includes(false));
|