@strapi/database 4.25.15 → 4.25.17
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 +6 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -3
- package/dist/index.mjs.map +1 -1
- package/dist/query/helpers/populate/apply.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -3282,7 +3282,7 @@ const morphToMany = async (input, ctx) => {
|
|
|
3282
3282
|
const { on, ...typePopulate } = populateValue;
|
|
3283
3283
|
for (const type of Object.keys(idsByType)) {
|
|
3284
3284
|
const ids = idsByType[type];
|
|
3285
|
-
if (!db.metadata.
|
|
3285
|
+
if (!db.metadata.has(type)) {
|
|
3286
3286
|
map[type] = {};
|
|
3287
3287
|
continue;
|
|
3288
3288
|
}
|
|
@@ -3295,6 +3295,9 @@ const morphToMany = async (input, ctx) => {
|
|
|
3295
3295
|
const matchingRows = joinResults.flatMap((joinResult) => {
|
|
3296
3296
|
const id = joinResult[idColumn.name];
|
|
3297
3297
|
const type = joinResult[typeColumn.name];
|
|
3298
|
+
if (!map[type][id]) {
|
|
3299
|
+
return [];
|
|
3300
|
+
}
|
|
3298
3301
|
const targetMeta = db.metadata.get(type);
|
|
3299
3302
|
const fromTargetRow = (rowOrRows) => fromRow(targetMeta, rowOrRows);
|
|
3300
3303
|
return (map[type][id] || []).map((row) => {
|
|
@@ -3328,7 +3331,7 @@ const morphToOne = async (input, ctx) => {
|
|
|
3328
3331
|
const { on, ...typePopulate } = populateValue;
|
|
3329
3332
|
for (const type of Object.keys(idsByType)) {
|
|
3330
3333
|
const ids = idsByType[type];
|
|
3331
|
-
if (!db.metadata.
|
|
3334
|
+
if (!db.metadata.has(type)) {
|
|
3332
3335
|
map[type] = {};
|
|
3333
3336
|
return;
|
|
3334
3337
|
}
|
|
@@ -3339,7 +3342,7 @@ const morphToOne = async (input, ctx) => {
|
|
|
3339
3342
|
results.forEach((result) => {
|
|
3340
3343
|
const id = result[idColumn.name];
|
|
3341
3344
|
const type = result[typeColumn.name];
|
|
3342
|
-
if (!type || !id) {
|
|
3345
|
+
if (!type || !id || !map[type][id]) {
|
|
3343
3346
|
result[attributeName] = null;
|
|
3344
3347
|
return;
|
|
3345
3348
|
}
|