@strapi/utils 4.19.1 → 4.20.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/dist/index.js CHANGED
@@ -2111,7 +2111,9 @@ const createContentAPISanitizers = () => {
2111
2111
  }
2112
2112
  const nonWritableAttributes = getNonWritableAttributes(schema);
2113
2113
  const transforms = [
2114
- // Remove non writable attributes
2114
+ // Remove first level ID in inputs
2115
+ fp.omit("id"),
2116
+ // Remove non-writable attributes
2115
2117
  traverseEntity$1(removeRestrictedFields(nonWritableAttributes), { schema })
2116
2118
  ];
2117
2119
  if (auth) {
@@ -2459,7 +2461,12 @@ const createContentAPIValidators = () => {
2459
2461
  }
2460
2462
  const nonWritableAttributes = getNonWritableAttributes(schema);
2461
2463
  const transforms = [
2462
- // non writable attributes
2464
+ (data2) => {
2465
+ if (fp.isObject(data2) && "id" in data2) {
2466
+ throwInvalidParam({ key: "id" });
2467
+ }
2468
+ },
2469
+ // non-writable attributes
2463
2470
  traverseEntity$1(throwRestrictedFields(nonWritableAttributes), { schema })
2464
2471
  ];
2465
2472
  if (auth) {