@strapi/strapi 4.5.1 → 4.5.2

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.
@@ -5,8 +5,8 @@
5
5
 
6
6
  'use strict';
7
7
 
8
- const { uniqBy, castArray, isNil } = require('lodash');
9
- const { has, assoc, prop, isObject, isEmpty, merge } = require('lodash/fp');
8
+ const { uniqBy, castArray, isNil, isArray, mergeWith } = require('lodash');
9
+ const { has, assoc, prop, isObject, isEmpty } = require('lodash/fp');
10
10
  const strapiUtils = require('@strapi/utils');
11
11
  const validators = require('./validators');
12
12
 
@@ -247,9 +247,14 @@ const createValidateEntity =
247
247
  * @returns {Object}
248
248
  */
249
249
  const buildRelationsStore = ({ uid, data }) => {
250
+ if (!uid) {
251
+ throw new ValidationError(`Cannot build relations store: "uid" is undefined`);
252
+ }
253
+
250
254
  if (isEmpty(data)) {
251
255
  return {};
252
256
  }
257
+
253
258
  const currentModel = strapi.getModel(uid);
254
259
 
255
260
  return Object.keys(currentModel.attributes).reduce((result, attributeName) => {
@@ -290,12 +295,17 @@ const buildRelationsStore = ({ uid, data }) => {
290
295
  case 'component': {
291
296
  return castArray(value).reduce(
292
297
  (relationsStore, componentValue) =>
293
- merge(
298
+ mergeWith(
294
299
  relationsStore,
295
300
  buildRelationsStore({
296
301
  uid: attribute.component,
297
302
  data: componentValue,
298
- })
303
+ }),
304
+ (objValue, srcValue) => {
305
+ if (isArray(objValue)) {
306
+ return objValue.concat(srcValue);
307
+ }
308
+ }
299
309
  ),
300
310
  result
301
311
  );
@@ -303,12 +313,17 @@ const buildRelationsStore = ({ uid, data }) => {
303
313
  case 'dynamiczone': {
304
314
  return value.reduce(
305
315
  (relationsStore, dzValue) =>
306
- merge(
316
+ mergeWith(
307
317
  relationsStore,
308
318
  buildRelationsStore({
309
319
  uid: dzValue.__component,
310
320
  data: dzValue,
311
- })
321
+ }),
322
+ (objValue, srcValue) => {
323
+ if (isArray(objValue)) {
324
+ return objValue.concat(srcValue);
325
+ }
326
+ }
312
327
  ),
313
328
  result
314
329
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "4.5.1",
3
+ "version": "4.5.2",
4
4
  "description": "An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite",
5
5
  "keywords": [
6
6
  "strapi",
@@ -80,18 +80,18 @@
80
80
  "dependencies": {
81
81
  "@koa/cors": "3.4.3",
82
82
  "@koa/router": "10.1.1",
83
- "@strapi/admin": "4.5.1",
84
- "@strapi/database": "4.5.1",
85
- "@strapi/generate-new": "4.5.1",
86
- "@strapi/generators": "4.5.1",
87
- "@strapi/logger": "4.5.1",
88
- "@strapi/permissions": "4.5.1",
89
- "@strapi/plugin-content-manager": "4.5.1",
90
- "@strapi/plugin-content-type-builder": "4.5.1",
91
- "@strapi/plugin-email": "4.5.1",
92
- "@strapi/plugin-upload": "4.5.1",
93
- "@strapi/typescript-utils": "4.5.1",
94
- "@strapi/utils": "4.5.1",
83
+ "@strapi/admin": "4.5.2",
84
+ "@strapi/database": "4.5.2",
85
+ "@strapi/generate-new": "4.5.2",
86
+ "@strapi/generators": "4.5.2",
87
+ "@strapi/logger": "4.5.2",
88
+ "@strapi/permissions": "4.5.2",
89
+ "@strapi/plugin-content-manager": "4.5.2",
90
+ "@strapi/plugin-content-type-builder": "4.5.2",
91
+ "@strapi/plugin-email": "4.5.2",
92
+ "@strapi/plugin-upload": "4.5.2",
93
+ "@strapi/typescript-utils": "4.5.2",
94
+ "@strapi/utils": "4.5.2",
95
95
  "bcryptjs": "2.4.3",
96
96
  "boxen": "5.1.2",
97
97
  "chalk": "4.1.2",
@@ -128,7 +128,7 @@
128
128
  "package-json": "7.0.0",
129
129
  "qs": "6.10.1",
130
130
  "resolve-cwd": "3.0.0",
131
- "semver": "7.3.7",
131
+ "semver": "7.3.8",
132
132
  "statuses": "2.0.1",
133
133
  "uuid": "^8.3.2"
134
134
  },
@@ -140,5 +140,5 @@
140
140
  "node": ">=14.19.1 <=18.x.x",
141
141
  "npm": ">=6.0.0"
142
142
  },
143
- "gitHead": "8c20ea2b5c5a115b78454086ea270dcd59b06004"
143
+ "gitHead": "bcb1b7f472aae2556a9b59d59ee66d241c497a3e"
144
144
  }