@strapi/strapi 4.3.6 → 4.3.7

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/README.md CHANGED
@@ -1,8 +1,12 @@
1
1
  <p align="center">
2
- <a href="https://strapi.io">
2
+ <a href="https://strapi.io/#gh-light-mode-only">
3
3
  <img src="https://strapi.io/assets/strapi-logo-dark.svg" width="318px" alt="Strapi logo" />
4
4
  </a>
5
+ <a href="https://strapi.io/#gh-dark-mode-only">
6
+ <img src="https://strapi.io/assets/strapi-logo-light.svg" width="318px" alt="Strapi logo" />
7
+ </a>
5
8
  </p>
9
+
6
10
  <h3 align="center">API creation made simple, secure and fast.</h3>
7
11
  <p align="center">The most advanced open-source headless CMS to build powerful APIs with no effort.</p>
8
12
  <p align="center"><a href="https://strapi.io/demo">Try live demo</a></p>
@@ -18,6 +22,9 @@
18
22
  <a href="https://discord.strapi.io">
19
23
  <img src="https://img.shields.io/discord/811989166782021633?label=Discord" alt="Strapi on Discord" />
20
24
  </a>
25
+ <a href="https://github.com/strapi/strapi/actions/workflows/nightly.yml">
26
+ <img src="https://github.com/strapi/strapi/actions/workflows/nightly.yml/badge.svg" alt="Strapi Nightly Release Build Status" />
27
+ </a>
21
28
  </p>
22
29
 
23
30
  <br>
@@ -79,15 +86,17 @@ Complete installation requirements can be found in the documentation under <a hr
79
86
 
80
87
  **Node:**
81
88
 
82
- - NodeJS >= 12 <= 16
89
+ - NodeJS >= 14 <= 16
83
90
  - NPM >= 6.x
84
91
 
85
92
  **Database:**
86
93
 
87
- - MySQL >= 5.7.8
88
- - MariaDB >= 10.2.7
89
- - PostgreSQL >= 10
90
- - SQLite >= 3
94
+ | Database | Minimum | Recommended |
95
+ | ---------- | ------- | ----------- |
96
+ | MySQL | 5.7.8 | 8.0 |
97
+ | MariaDB | 10.3 | 10.6 |
98
+ | PostgreSQL | 11.0 | 14.0 |
99
+ | SQLite | 3 | 3 |
91
100
 
92
101
  **We recommend always using the latest version of Strapi to start your new projects**.
93
102
 
@@ -114,7 +123,7 @@ For general help using Strapi, please refer to [the official Strapi documentatio
114
123
  - [Discord](https://discord.strapi.io) (For live discussion with the Community and Strapi team)
115
124
  - [GitHub](https://github.com/strapi/strapi) (Bug reports, Contributions)
116
125
  - [Community Forum](https://forum.strapi.io) (Questions and Discussions)
117
- - [Roadmap & Feature Requests](https://feedback.strapi.io/)
126
+ - [Feedback section](https://feedback.strapi.io) (Roadmap, Feature requests)
118
127
  - [Twitter](https://twitter.com/strapijs) (Get the news fast)
119
128
  - [Facebook](https://www.facebook.com/Strapi-616063331867161)
120
129
  - [YouTube Channel](https://www.youtube.com/strapi) (Learn from Video Tutorials)
@@ -125,7 +134,7 @@ Follow our [migration guides](https://docs.strapi.io/developer-docs/latest/updat
125
134
 
126
135
  ## Roadmap
127
136
 
128
- Check out our [roadmap](https://feedback.strapi.io/) to get informed of the latest features released and the upcoming ones. You may also give us insights and vote for a specific feature.
137
+ Check out our [roadmap](https://feedback.strapi.io) to get informed of the latest features released and the upcoming ones. You may also give us insights and vote for a specific feature.
129
138
 
130
139
  ## Documentation
131
140
 
@@ -5,6 +5,7 @@ const { has, prop, omit, toString } = require('lodash/fp');
5
5
 
6
6
  const { contentTypes: contentTypesUtils } = require('@strapi/utils');
7
7
  const { ApplicationError } = require('@strapi/utils').errors;
8
+ const { getComponentAttributes } = require('@strapi/utils').contentTypes;
8
9
 
9
10
  const omitComponentData = (contentType, data) => {
10
11
  const { attributes } = contentType;
@@ -100,6 +101,18 @@ const createComponents = async (uid, data) => {
100
101
  return componentBody;
101
102
  };
102
103
 
104
+ /**
105
+ * @param {str} uid
106
+ * @param {object} entity
107
+ * @return {Promise<{uid: string, entity: object}>}
108
+ */
109
+ const getComponents = async (uid, entity) => {
110
+ const componentAttributes = getComponentAttributes(strapi.getModel(uid));
111
+
112
+ if (_.isEmpty(componentAttributes)) return {};
113
+ return strapi.query(uid).load(entity, componentAttributes);
114
+ };
115
+
103
116
  /*
104
117
  delete old components
105
118
  create or update
@@ -270,7 +283,10 @@ const deleteComponents = async (uid, entityToDelete) => {
270
283
  if (attribute.type === 'component') {
271
284
  const { component: componentUID } = attribute;
272
285
 
273
- const value = await strapi.query(uid).load(entityToDelete, attributeName);
286
+ // Load attribute value if it's not already loaded
287
+ const value =
288
+ entityToDelete[attributeName] ||
289
+ (await strapi.query(uid).load(entityToDelete, attributeName));
274
290
 
275
291
  if (!value) {
276
292
  continue;
@@ -286,7 +302,9 @@ const deleteComponents = async (uid, entityToDelete) => {
286
302
  }
287
303
 
288
304
  if (attribute.type === 'dynamiczone') {
289
- const value = await strapi.query(uid).load(entityToDelete, attributeName);
305
+ const value =
306
+ entityToDelete[attributeName] ||
307
+ (await strapi.query(uid).load(entityToDelete, attributeName));
290
308
 
291
309
  if (!value) {
292
310
  continue;
@@ -352,7 +370,9 @@ const deleteComponent = async (uid, componentToDelete) => {
352
370
 
353
371
  module.exports = {
354
372
  omitComponentData,
373
+ getComponents,
355
374
  createComponents,
356
375
  updateComponents,
357
376
  deleteComponents,
377
+ deleteComponent,
358
378
  };
@@ -14,6 +14,7 @@ const uploadFiles = require('../utils/upload-files');
14
14
 
15
15
  const {
16
16
  omitComponentData,
17
+ getComponents,
17
18
  createComponents,
18
19
  updateComponents,
19
20
  deleteComponents,
@@ -213,8 +214,10 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
213
214
  return null;
214
215
  }
215
216
 
217
+ const componentsToDelete = await getComponents(uid, entityToDelete);
218
+
216
219
  await db.query(uid).delete({ where: { id: entityToDelete.id } });
217
- await deleteComponents(uid, entityToDelete);
220
+ await deleteComponents(uid, { ...entityToDelete, ...componentsToDelete });
218
221
 
219
222
  await this.emitEvent(uid, ENTRY_DELETE, entityToDelete);
220
223
 
@@ -234,8 +237,12 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
234
237
  return null;
235
238
  }
236
239
 
240
+ const componentsToDelete = await Promise.all(
241
+ entitiesToDelete.map((entityToDelete) => getComponents(uid, entityToDelete))
242
+ );
243
+
237
244
  const deletedEntities = await db.query(uid).deleteMany(query);
238
- await Promise.all(entitiesToDelete.map((entity) => deleteComponents(uid, entity)));
245
+ await Promise.all(componentsToDelete.map((compos) => deleteComponents(uid, compos)));
239
246
 
240
247
  // Trigger webhooks. One for each entity
241
248
  await Promise.all(entitiesToDelete.map((entity) => this.emitEvent(uid, ENTRY_DELETE, entity)));
@@ -45,12 +45,12 @@ module.exports = (strapi) => {
45
45
  environment: strapi.config.environment,
46
46
  os: os.type(),
47
47
  osPlatform: os.platform(),
48
+ osArch: os.arch(),
48
49
  osRelease: os.release(),
49
- nodeVersion: process.version,
50
+ nodeVersion: process.versions.node,
50
51
  docker: process.env.DOCKER || isDocker(),
51
52
  isCI: ciEnv.isCI,
52
53
  version: strapi.config.get('info.strapi'),
53
- strapiVersion: strapi.config.get('info.strapi'),
54
54
  projectType: isEE ? 'Enterprise' : 'Community',
55
55
  useTypescriptOnServer: isUsingTypeScriptSync(serverRootPath),
56
56
  useTypescriptOnAdmin: isUsingTypeScriptSync(adminRootPath),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "4.3.6",
3
+ "version": "4.3.7",
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",
@@ -78,19 +78,19 @@
78
78
  "test:unit": "jest --verbose"
79
79
  },
80
80
  "dependencies": {
81
- "@koa/cors": "3.1.0",
81
+ "@koa/cors": "3.4.1",
82
82
  "@koa/router": "10.1.1",
83
- "@strapi/admin": "4.3.6",
84
- "@strapi/database": "4.3.6",
85
- "@strapi/generate-new": "4.3.6",
86
- "@strapi/generators": "4.3.6",
87
- "@strapi/logger": "4.3.6",
88
- "@strapi/plugin-content-manager": "4.3.6",
89
- "@strapi/plugin-content-type-builder": "4.3.6",
90
- "@strapi/plugin-email": "4.3.6",
91
- "@strapi/plugin-upload": "4.3.6",
92
- "@strapi/typescript-utils": "4.3.6",
93
- "@strapi/utils": "4.3.6",
83
+ "@strapi/admin": "4.3.7",
84
+ "@strapi/database": "4.3.7",
85
+ "@strapi/generate-new": "4.3.7",
86
+ "@strapi/generators": "4.3.7",
87
+ "@strapi/logger": "4.3.7",
88
+ "@strapi/plugin-content-manager": "4.3.7",
89
+ "@strapi/plugin-content-type-builder": "4.3.7",
90
+ "@strapi/plugin-email": "4.3.7",
91
+ "@strapi/plugin-upload": "4.3.7",
92
+ "@strapi/typescript-utils": "4.3.7",
93
+ "@strapi/utils": "4.3.7",
94
94
  "bcryptjs": "2.4.3",
95
95
  "boxen": "5.1.2",
96
96
  "chalk": "4.1.2",
@@ -139,5 +139,5 @@
139
139
  "node": ">=14.19.1 <=16.x.x",
140
140
  "npm": ">=6.0.0"
141
141
  },
142
- "gitHead": "4c6e67c4934580ed051a2afb83e6fc8f64f3a5b5"
142
+ "gitHead": "73f523b98322cea8992c72977b94a73a624d2e79"
143
143
  }