@strapi/strapi 4.10.5 → 4.10.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/ee/LICENSE.txt CHANGED
@@ -1,21 +1 @@
1
- This Strapi Enterprise Edition (EE) supplemental license (this “EE Supplemental License”) governs the use of this software and documentation (collectively, the “EE Software”) by you and any entity you represent (collectively, “You”). If You have separately entered into the Strapi, Inc. Enterprise Agreement (the “Enterprise Agreement”), then this EE Supplemental License hereby incorporates by reference the Enterprise Agreement and modifies the Enterprise Agreement solely to the extent set forth herein. If You have separately entered into the Strapi, Inc. Subscription Agreement (the “Subscription Agreement”), then this EE Supplemental License hereby incorporates by reference the Agreement and modifies the Subscription Agreement solely to the extent set forth herein. If You have not entered into either the Enterprise Agreement or the Subscription Agreement, then You may use the EE Software solely as set forth in Section 2 below.
2
-
3
- In the event of a direct conflict between the terms of this EE Supplemental License and the terms of the Enterprise Agreement or the Subscription Agreement, as applicable, the terms of this EE Supplemental License will control. Except to the extent modified by this EE Supplemental License, the Enterprise Agreement or the Subscription Agreement, as applicable, remain in full force and effect in accordance with its terms.
4
-
5
- By using the EE Software, You hereby agree to the below terms and conditions.
6
-
7
- 1. Notwithstanding any terms to the contrary in the Enterprise Agreement or Subscription Agreement, You may copy, modify and publish patches to the EE Software in a production environment (such copies, “Production Copies,” such modifications, “Production Modifications” and such patches, “Production Patches”) if and only if (a) You have agreed to, and are in full compliance with, the Enterprise Agreement or Subscription Agreement, as applicable, and (b) You have a valid license to the EE Software for the correct number of projects. You agree that Strapi and/or its licensors (as applicable) will own all right, title and interest in and to all such Production Copies, Production Modifications and Production Patches. You may display and/or distribute such Production Copies, Production Modifications and Production Patches if and only if (i) You have a valid license to the EE Software for the correct number of projects and (ii) You are in compliance with the Enterprise Agreement or Subscription Agreement, as applicable. You hereby assign to Strapi all right, title and interest in and to all Production Copies, Production Modifications and Production Patches, including all intellectual property rights embodied in or related to the foregoing.
8
-
9
- 2. Notwithstanding the foregoing, You may copy and modify the EE Software solely for development and testing purposes (such copies, “Development Copies” and such modifications, “Development Modifications”) with or without a license to the EE Software if your use is in compliance with this Section 2. You agree that Strapi and/or its licensors (as applicable) will own all right, title and interest in and to all Development Copies and Development Modifications and You hereby assign to Strapi all right, title and interest in and to all Development Copies and Development Modifications, including all intellectual property rights embodied in or related to the foregoing. If You do not have a license to the EE Software, then You further agree as follows:
10
-
11
- Other than as expressly set forth in this Section 2, You may not (a) copy or modify the EE Software, (b) create derivative works of the EE Software, (c) remove or modify any notice of any patent, copyright, trademark, or other proprietary rights that appear on or in the EE Software, (d) reverse engineer, decompile, translate, disassemble, or discover the source code of all or any portion of the EE Software, (e) publicly display all or any part of the EE Software, (f) distribute, disclose, market, lease, publish, merge, resell, assign, loan, sublicense, rent, or transfer the EE Software to any third party, (g) use the EE Software for any dial-up, remote access, interactive, or other on-line or hosted service, or to provide a service bureau, time share, or other services to third parties, (h) merge the EE Software into another product, (i) disclose the results of any EE Software performance benchmarks or test results to any third party without Strapi’s prior written consent, (j) use any trademarks, logos, service marks, trade names of Strapi, or any portion thereof, without Strapi’s prior written consent, (k) use the EE Software, or any portion thereof, in a manner that does not comply with applicable law, regulations, or governmental orders, or (l) use or store the EE Software on equipment not owned or controlled by Customer.
12
-
13
- THE EE SOFTWARE IS PROVIDED ON AN “AS IS” BASIS WITHOUT ANY REPRESENTATIONS, WARRANTIES, COVENANTS, OR CONDITIONS OF ANY KIND (EXPRESS OR IMPLIED, STATUTORY OR OTHERWISE), INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, TITLE, FITNESS FOR A PARTICULAR PURPOSE, OR NONINFRINGEMENT. FURTHER, STRAPI DOES NOT REPRESENT OR WARRANT THAT (A) THE ACCESS TO OR USE OF THE EE SOFTWARE WILL BE SECURE, TIMELY, UNINTERRUPTED, ERROR-FREE, OR OPERATE IN COMBINATION WITH ANY OTHER HARDWARE, SOFTWARE, SYSTEM, OR DATA, (B) THE EE SOFTWARE WILL MEET YOUR REQUIREMENTS OR EXPECTATIONS, OR OTHERWISE PRODUCE ANY PARTICULAR RESULTS, (C) ERRORS OR DEFECTS WILL BE CORRECTED, PATCHES OR WORKAROUNDS WILL BE PROVIDED, OR STRAPI WILL DETECT ANY BUG IN THE EE SOFTWARE, (D) THE SOFTWARE IS FREE OF VIRUSES OR OTHER HARMFUL COMPONENTS, OR (E) THIRD-PARTY DISRUPTIONS OR SECURITY BREACHES OF THE EE SOFTWARE WILL BE PREVENTED.
14
-
15
- STRAPI WILL NOT BE LIABLE FOR ANY LOSS OF PROFITS OR ANY INDIRECT, SPECIAL, INCIDENTAL, RELIANCE, OR CONSEQUENTIAL DAMAGES OF ANY KIND, REGARDLESS OF THE FORM OF ACTION, WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY, OR OTHERWISE, EVEN IF INFORMED OF THE POSSIBILITY OF SUCH DAMAGES IN ADVANCE.
16
-
17
- STRAPI’S ENTIRE LIABILITY TO YOU FOR USE OF THE EE SOFTWARE WILL NOT EXCEED $100.
18
-
19
- 3. You are not granted any other rights beyond what is expressly stated herein and in the Enterprise Agreement or Subscription Agreement, as applicable.
20
-
21
- 4. This EE Supplemental License does not apply to Strapi software that is distributed as part of the Strapi Community Edition (CE) (the “CE Software”).
1
+ If you or the company you represent has entered into a written agreement referencing the Enterprise Edition of the Strapi source code available at https://github.com/strapi/strapi, then such agreement applies to your use of the Enterprise Edition of the Strapi Software. If you or the company you represent is using the Enterprise Edition of the Strapi Software in connection with a subscription to our cloud offering, then the agreement you have agreed to with respect to our cloud offering and the licenses included in such agreement apply to your use of the Enterprise Edition of the Strapi Software. Otherwise, the Strapi Enterprise Software License Agreement (found here https://strapi.io/enterprise-terms) applies to your use of the Enterprise Edition of the Strapi Software. BY ACCESSING OR USING THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE RELEVANT REFERENCED AGREEMENT. IF YOU ARE NOT AUTHORIZED TO ACCEPT THESE TERMS ON BEHALF OF THE COMPANY YOU REPRESENT OR IF YOU DO NOT AGREE TO ALL OF THE RELEVANT TERMS AND CONDITIONS REFERENCED AND YOU HAVE NOT OTHERWISE EXECUTED A WRITTEN AGREEMENT WITH STRAPI, YOU ARE NOT AUTHORIZED TO ACCESS OR USE OR ALLOW ANY USER TO ACCESS OR USE ANY PART OF THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE. YOUR ACCESS RIGHTS ARE CONDITIONAL ON YOUR CONSENT TO THE RELEVANT REFERENCED TERMS TO THE EXCLUSION OF ALL OTHER TERMS; IF THE RELEVANT REFERENCED TERMS ARE CONSIDERED AN OFFER BY YOU, ACCEPTANCE IS EXPRESSLY LIMITED TO THE RELEVANT REFERENCED TERMS.
package/lib/Strapi.js CHANGED
@@ -255,6 +255,7 @@ class Strapi {
255
255
  numberOfAllContentTypes: _.size(this.contentTypes), // TODO: V5: This event should be renamed numberOfContentTypes in V5 as the name is already taken to describe the number of content types using i18n.
256
256
  numberOfComponents: _.size(this.components),
257
257
  numberOfDynamicZones: getNumberOfDynamicZones(),
258
+ environment: strapi.config.environment,
258
259
  // TODO: to add back
259
260
  // providers: this.config.installedProviders,
260
261
  },
@@ -59,6 +59,10 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
59
59
  return options;
60
60
  },
61
61
 
62
+ async wrapResult(result) {
63
+ return result;
64
+ },
65
+
62
66
  async emitEvent(uid, event, entity) {
63
67
  // Ignore audit log events to prevent infinite loops
64
68
  if (uid === 'admin::audit-log') {
@@ -83,10 +87,12 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
83
87
  const query = transformParamsToQuery(uid, wrappedParams);
84
88
 
85
89
  if (kind === 'singleType') {
86
- return db.query(uid).findOne(query);
90
+ const entity = db.query(uid).findOne(query);
91
+ return this.wrapResult(entity, { uid, action: 'findOne' });
87
92
  }
88
93
 
89
- return db.query(uid).findMany(query);
94
+ const entities = await db.query(uid).findMany(query);
95
+ return this.wrapResult(entities, { uid, action: 'findMany' });
90
96
  },
91
97
 
92
98
  async findPage(uid, opts) {
@@ -94,7 +100,11 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
94
100
 
95
101
  const query = transformParamsToQuery(uid, wrappedParams);
96
102
 
97
- return db.query(uid).findPage(query);
103
+ const page = await db.query(uid).findPage(query);
104
+ return {
105
+ ...page,
106
+ results: await this.wrapResult(page.results, { uid, action: 'findPage' }),
107
+ };
98
108
  },
99
109
 
100
110
  // TODO: streamline the logic based on the populate option
@@ -103,7 +113,11 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
103
113
 
104
114
  const query = transformParamsToQuery(uid, wrappedParams);
105
115
 
106
- return db.query(uid).findPage(query);
116
+ const entities = await db.query(uid).findPage(query);
117
+ return {
118
+ ...entities,
119
+ results: await this.wrapResult(entities.results, { uid, action: 'findWithRelationCounts' }),
120
+ };
107
121
  },
108
122
 
109
123
  async findWithRelationCounts(uid, opts) {
@@ -111,7 +125,8 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
111
125
 
112
126
  const query = transformParamsToQuery(uid, wrappedParams);
113
127
 
114
- return db.query(uid).findMany(query);
128
+ const entities = await db.query(uid).findMany(query);
129
+ return this.wrapResult(entities, { uid, action: 'findWithRelationCounts' });
115
130
  },
116
131
 
117
132
  async findOne(uid, entityId, opts) {
@@ -119,7 +134,8 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
119
134
 
120
135
  const query = transformParamsToQuery(uid, pickSelectionParams(wrappedParams));
121
136
 
122
- return db.query(uid).findOne({ ...query, where: { id: entityId } });
137
+ const entity = await db.query(uid).findOne({ ...query, where: { id: entityId } });
138
+ return this.wrapResult(entity, { uid, action: 'findOne' });
123
139
  },
124
140
 
125
141
  async count(uid, opts) {
@@ -162,6 +178,8 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
162
178
  entity = await this.findOne(uid, entity.id, wrappedParams);
163
179
  }
164
180
 
181
+ entity = await this.wrapResult(entity, { uid, action: 'create' });
182
+
165
183
  await this.emitEvent(uid, ENTRY_CREATE, entity);
166
184
 
167
185
  return entity;
@@ -213,6 +231,8 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
213
231
  entity = await this.findOne(uid, entity.id, wrappedParams);
214
232
  }
215
233
 
234
+ entity = await this.wrapResult(entity, { uid, action: 'update' });
235
+
216
236
  await this.emitEvent(uid, ENTRY_UPDATE, entity);
217
237
 
218
238
  return entity;
@@ -224,7 +244,7 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
224
244
  // select / populate
225
245
  const query = transformParamsToQuery(uid, pickSelectionParams(wrappedParams));
226
246
 
227
- const entityToDelete = await db.query(uid).findOne({
247
+ let entityToDelete = await db.query(uid).findOne({
228
248
  ...query,
229
249
  where: { id: entityId },
230
250
  });
@@ -238,6 +258,8 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
238
258
  await db.query(uid).delete({ where: { id: entityToDelete.id } });
239
259
  await deleteComponents(uid, componentsToDelete, { loadComponents: false });
240
260
 
261
+ entityToDelete = await this.wrapResult(entityToDelete, { uid, action: 'delete' });
262
+
241
263
  await this.emitEvent(uid, ENTRY_DELETE, entityToDelete);
242
264
 
243
265
  return entityToDelete;
@@ -250,7 +272,7 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
250
272
  // select / populate
251
273
  const query = transformParamsToQuery(uid, wrappedParams);
252
274
 
253
- const entitiesToDelete = await db.query(uid).findMany(query);
275
+ let entitiesToDelete = await db.query(uid).findMany(query);
254
276
 
255
277
  if (!entitiesToDelete.length) {
256
278
  return null;
@@ -265,21 +287,27 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
265
287
  componentsToDelete.map((compos) => deleteComponents(uid, compos, { loadComponents: false }))
266
288
  );
267
289
 
290
+ entitiesToDelete = await this.wrapResult(entitiesToDelete, { uid, action: 'delete' });
291
+
268
292
  // Trigger webhooks. One for each entity
269
293
  await Promise.all(entitiesToDelete.map((entity) => this.emitEvent(uid, ENTRY_DELETE, entity)));
270
294
 
271
295
  return deletedEntities;
272
296
  },
273
297
 
274
- load(uid, entity, field, params = {}) {
298
+ async load(uid, entity, field, params = {}) {
275
299
  if (!_.isString(field)) {
276
300
  throw new Error(`Invalid load. Expected "${field}" to be a string`);
277
301
  }
278
302
 
279
- return db.query(uid).load(entity, field, transformLoadParamsToQuery(uid, field, params));
303
+ const loadedEntity = await db
304
+ .query(uid)
305
+ .load(entity, field, transformLoadParamsToQuery(uid, field, params));
306
+
307
+ return this.wrapResult(loadedEntity, { uid, field, action: 'load' });
280
308
  },
281
309
 
282
- loadPages(uid, entity, field, params = {}, pagination = {}) {
310
+ async loadPages(uid, entity, field, params = {}, pagination = {}) {
283
311
  if (!_.isString(field)) {
284
312
  throw new Error(`Invalid load. Expected "${field}" to be a string`);
285
313
  }
@@ -293,7 +321,12 @@ const createDefaultImplementation = ({ strapi, db, eventHub, entityValidator })
293
321
 
294
322
  const query = transformLoadParamsToQuery(uid, field, params, pagination);
295
323
 
296
- return db.query(uid).loadPages(entity, field, query);
324
+ const loadedPage = await db.query(uid).loadPages(entity, field, query);
325
+
326
+ return {
327
+ ...loadedPage,
328
+ results: await this.wrapResult(loadedPage.results, { uid, field, action: 'load' }),
329
+ };
297
330
  },
298
331
  });
299
332
 
@@ -10,7 +10,7 @@ const crypto = require('crypto');
10
10
  */
11
11
  const generateAdminUserHash = (strapi) => {
12
12
  const ctx = strapi?.requestContext?.get();
13
- if (!ctx?.state?.user) {
13
+ if (!ctx?.state?.user?.email) {
14
14
  return '';
15
15
  }
16
16
  return crypto.createHash('sha256').update(ctx.state.user.email).digest('hex');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "4.10.5",
3
+ "version": "4.10.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",
@@ -81,19 +81,19 @@
81
81
  "dependencies": {
82
82
  "@koa/cors": "3.4.3",
83
83
  "@koa/router": "10.1.1",
84
- "@strapi/admin": "4.10.5",
85
- "@strapi/data-transfer": "4.10.5",
86
- "@strapi/database": "4.10.5",
87
- "@strapi/generate-new": "4.10.5",
88
- "@strapi/generators": "4.10.5",
89
- "@strapi/logger": "4.10.5",
90
- "@strapi/permissions": "4.10.5",
91
- "@strapi/plugin-content-manager": "4.10.5",
92
- "@strapi/plugin-content-type-builder": "4.10.5",
93
- "@strapi/plugin-email": "4.10.5",
94
- "@strapi/plugin-upload": "4.10.5",
95
- "@strapi/typescript-utils": "4.10.5",
96
- "@strapi/utils": "4.10.5",
84
+ "@strapi/admin": "4.10.7",
85
+ "@strapi/data-transfer": "4.10.7",
86
+ "@strapi/database": "4.10.7",
87
+ "@strapi/generate-new": "4.10.7",
88
+ "@strapi/generators": "4.10.7",
89
+ "@strapi/logger": "4.10.7",
90
+ "@strapi/permissions": "4.10.7",
91
+ "@strapi/plugin-content-manager": "4.10.7",
92
+ "@strapi/plugin-content-type-builder": "4.10.7",
93
+ "@strapi/plugin-email": "4.10.7",
94
+ "@strapi/plugin-upload": "4.10.7",
95
+ "@strapi/typescript-utils": "4.10.7",
96
+ "@strapi/utils": "4.10.7",
97
97
  "bcryptjs": "2.4.3",
98
98
  "boxen": "5.1.2",
99
99
  "chalk": "4.1.2",
@@ -142,5 +142,5 @@
142
142
  "node": ">=14.19.1 <=18.x.x",
143
143
  "npm": ">=6.0.0"
144
144
  },
145
- "gitHead": "d9277d616b4478a3839e79e47330a4aaf167a2f1"
145
+ "gitHead": "da080df32b85cdd59d46bdda5c984a346cad0860"
146
146
  }