@fourlights/strapi-plugin-deep-populate 1.9.0 → 1.9.1-rc.0
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/server/index.js
CHANGED
|
@@ -18551,6 +18551,20 @@ const cache = ({ strapi: strapi2 }) => ({
|
|
|
18551
18551
|
}
|
|
18552
18552
|
}
|
|
18553
18553
|
});
|
|
18554
|
+
const sanitizeObject = (obj) => {
|
|
18555
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
18556
|
+
const dangerousProps = ["__proto__", "constructor", "prototype"];
|
|
18557
|
+
const sanitized = {};
|
|
18558
|
+
for (const key in obj) {
|
|
18559
|
+
if (dangerousProps.includes(key)) continue;
|
|
18560
|
+
if (typeof obj[key] === "object" && ___default.isNil(obj[key])) {
|
|
18561
|
+
sanitized[key] = sanitizeObject(obj[key]);
|
|
18562
|
+
} else {
|
|
18563
|
+
sanitized[key] = obj[key];
|
|
18564
|
+
}
|
|
18565
|
+
}
|
|
18566
|
+
return sanitized;
|
|
18567
|
+
};
|
|
18554
18568
|
const getRelations = (model) => {
|
|
18555
18569
|
const filteredAttributes = /* @__PURE__ */ new Set();
|
|
18556
18570
|
const { populateCreatorFields } = getOptions(model);
|
|
@@ -18619,7 +18633,7 @@ async function _populateDynamicZone({
|
|
|
18619
18633
|
...params
|
|
18620
18634
|
});
|
|
18621
18635
|
const currentPopulate = get__default.default(resolvedPopulate, [component]);
|
|
18622
|
-
const mergedComponentPopulate = !currentPopulate && componentPopulate === true ? componentPopulate : merge__default.default({}, currentPopulate, componentPopulate);
|
|
18636
|
+
const mergedComponentPopulate = !currentPopulate && componentPopulate === true ? componentPopulate : merge__default.default({}, currentPopulate, sanitizeObject(componentPopulate));
|
|
18623
18637
|
set__default.default(resolvedPopulate, [component], mergedComponentPopulate);
|
|
18624
18638
|
}
|
|
18625
18639
|
if (isEmpty(resolvedPopulate)) return void 0;
|
|
@@ -18652,7 +18666,7 @@ async function _populateRelation({
|
|
|
18652
18666
|
}
|
|
18653
18667
|
const newPopulate = {};
|
|
18654
18668
|
for (const { documentId } of relations) {
|
|
18655
|
-
const relationPopulate = resolvedRelations.get(documentId);
|
|
18669
|
+
const relationPopulate = sanitizeObject(resolvedRelations.get(documentId));
|
|
18656
18670
|
mergeWith__default.default(newPopulate, relationPopulate, (existing, proposed) => {
|
|
18657
18671
|
if (proposed === true && existing) return existing;
|
|
18658
18672
|
return void 0;
|
|
@@ -18823,7 +18837,7 @@ async function populate$1(params) {
|
|
|
18823
18837
|
const { omitEmpty, localizations, contentTypes: contentTypes2 } = strapi.config.get("plugin::deep-populate");
|
|
18824
18838
|
const contentTypeConfig = has__default.default(contentTypes2, "*") ? get__default.default(contentTypes2, "*") : {};
|
|
18825
18839
|
if (has__default.default(contentTypes2, params.contentType)) {
|
|
18826
|
-
mergeWith__default.default(contentTypeConfig, get__default.default(contentTypes2, params.contentType));
|
|
18840
|
+
mergeWith__default.default(contentTypeConfig, sanitizeObject(get__default.default(contentTypes2, params.contentType)));
|
|
18827
18841
|
}
|
|
18828
18842
|
const { allow, deny } = contentTypeConfig;
|
|
18829
18843
|
const resolvedRelations = /* @__PURE__ */ new Map();
|
package/dist/server/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import isEmpty$1 from "lodash/isEmpty";
|
|
2
2
|
import isObject$2 from "lodash/isObject";
|
|
3
|
-
import ___default from "lodash";
|
|
3
|
+
import ___default, { isNil as isNil$1 } from "lodash";
|
|
4
4
|
import { union as union$1, getOr, curry, isObject as isObject$3, isNil, clone as clone$2, isArray, pick as pick$1, isEmpty as isEmpty$2, cloneDeep, omit as omit$1, isString, trim as trim$1, pipe as pipe$2, split, map as map$2, flatten, first, constant, identity, join, eq, get } from "lodash/fp";
|
|
5
5
|
import require$$1 from "crypto";
|
|
6
6
|
import require$$0$1 from "child_process";
|
|
@@ -18524,6 +18524,20 @@ const cache = ({ strapi: strapi2 }) => ({
|
|
|
18524
18524
|
}
|
|
18525
18525
|
}
|
|
18526
18526
|
});
|
|
18527
|
+
const sanitizeObject = (obj) => {
|
|
18528
|
+
if (obj === null || typeof obj !== "object") return obj;
|
|
18529
|
+
const dangerousProps = ["__proto__", "constructor", "prototype"];
|
|
18530
|
+
const sanitized = {};
|
|
18531
|
+
for (const key in obj) {
|
|
18532
|
+
if (dangerousProps.includes(key)) continue;
|
|
18533
|
+
if (typeof obj[key] === "object" && isNil$1(obj[key])) {
|
|
18534
|
+
sanitized[key] = sanitizeObject(obj[key]);
|
|
18535
|
+
} else {
|
|
18536
|
+
sanitized[key] = obj[key];
|
|
18537
|
+
}
|
|
18538
|
+
}
|
|
18539
|
+
return sanitized;
|
|
18540
|
+
};
|
|
18527
18541
|
const getRelations = (model) => {
|
|
18528
18542
|
const filteredAttributes = /* @__PURE__ */ new Set();
|
|
18529
18543
|
const { populateCreatorFields } = getOptions(model);
|
|
@@ -18592,7 +18606,7 @@ async function _populateDynamicZone({
|
|
|
18592
18606
|
...params
|
|
18593
18607
|
});
|
|
18594
18608
|
const currentPopulate = get$1(resolvedPopulate, [component]);
|
|
18595
|
-
const mergedComponentPopulate = !currentPopulate && componentPopulate === true ? componentPopulate : merge$2({}, currentPopulate, componentPopulate);
|
|
18609
|
+
const mergedComponentPopulate = !currentPopulate && componentPopulate === true ? componentPopulate : merge$2({}, currentPopulate, sanitizeObject(componentPopulate));
|
|
18596
18610
|
set$2(resolvedPopulate, [component], mergedComponentPopulate);
|
|
18597
18611
|
}
|
|
18598
18612
|
if (isEmpty(resolvedPopulate)) return void 0;
|
|
@@ -18625,7 +18639,7 @@ async function _populateRelation({
|
|
|
18625
18639
|
}
|
|
18626
18640
|
const newPopulate = {};
|
|
18627
18641
|
for (const { documentId } of relations) {
|
|
18628
|
-
const relationPopulate = resolvedRelations.get(documentId);
|
|
18642
|
+
const relationPopulate = sanitizeObject(resolvedRelations.get(documentId));
|
|
18629
18643
|
mergeWith(newPopulate, relationPopulate, (existing, proposed) => {
|
|
18630
18644
|
if (proposed === true && existing) return existing;
|
|
18631
18645
|
return void 0;
|
|
@@ -18796,7 +18810,7 @@ async function populate$1(params) {
|
|
|
18796
18810
|
const { omitEmpty, localizations, contentTypes: contentTypes2 } = strapi.config.get("plugin::deep-populate");
|
|
18797
18811
|
const contentTypeConfig = has(contentTypes2, "*") ? get$1(contentTypes2, "*") : {};
|
|
18798
18812
|
if (has(contentTypes2, params.contentType)) {
|
|
18799
|
-
mergeWith(contentTypeConfig, get$1(contentTypes2, params.contentType));
|
|
18813
|
+
mergeWith(contentTypeConfig, sanitizeObject(get$1(contentTypes2, params.contentType)));
|
|
18800
18814
|
}
|
|
18801
18815
|
const { allow, deny } = contentTypeConfig;
|
|
18802
18816
|
const resolvedRelations = /* @__PURE__ */ new Map();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sanitizeObject: (obj: unknown) => unknown;
|
package/package.json
CHANGED