@strapi/strapi 4.10.2-alpha.0 → 4.10.4

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/lib/Strapi.js CHANGED
@@ -110,7 +110,7 @@ class Strapi {
110
110
  // Instantiate the Koa app & the HTTP server
111
111
  this.server = createServer(this);
112
112
 
113
- // Strapi utils instanciation
113
+ // Strapi utils instantiation
114
114
  this.fs = createStrapiFs(this);
115
115
  this.eventHub = createEventHub();
116
116
  this.startupLogger = createStartupLogger(this);
@@ -106,12 +106,30 @@ const primaryProcess = async ({ distDir, appDir, build, isTSProject, watchAdmin,
106
106
  cluster.fork();
107
107
  };
108
108
 
109
- const workerProcess = ({ appDir, distDir, watchAdmin, polling, isTSProject }) => {
110
- const strapiInstance = strapi({
109
+ const workerProcess = async ({ appDir, distDir, watchAdmin, polling, isTSProject }) => {
110
+ const strapiInstance = await strapi({
111
111
  distDir,
112
112
  autoReload: true,
113
113
  serveAdminPanel: !watchAdmin,
114
- });
114
+ }).load();
115
+
116
+ /**
117
+ * TypeScript automatic type generation upon dev server restart
118
+ * Its implementation, configuration and behavior can change in future releases
119
+ * @experimental
120
+ */
121
+ const shouldGenerateTypeScriptTypes = strapiInstance.config.get('typescript.autogenerate', false);
122
+
123
+ if (shouldGenerateTypeScriptTypes) {
124
+ // This is run in an uncaught promise on purpose so that it doesn't block Strapi startup
125
+ // NOTE: We should probably add some configuration options to manage the file structure output or the verbosity level
126
+ tsUtils.generators.generateSchemasDefinitions({
127
+ strapi: strapiInstance,
128
+ outDir: appDir,
129
+ verbose: false,
130
+ silent: true,
131
+ });
132
+ }
115
133
 
116
134
  const adminWatchIgnoreFiles = strapiInstance.config.get('admin.watchIgnoreFiles', []);
117
135
  watchFileChanges({
@@ -179,6 +197,7 @@ function watchFileChanges({ appDir, strapiInstance, watchIgnoreFiles, polling })
179
197
  '**/*.db*',
180
198
  '**/exports/**',
181
199
  '**/dist/**',
200
+ '**/*.d.ts',
182
201
  ...watchIgnoreFiles,
183
202
  ],
184
203
  });
@@ -49,7 +49,7 @@ const createComponents = async (uid, data) => {
49
49
  const components = await mapAsync(
50
50
  componentValue,
51
51
  (value) => createComponent(componentUID, value),
52
- { concurrency: isDialectMySQL() ? 1 : Infinity }
52
+ { concurrency: isDialectMySQL() && !strapi.db.inTransaction() ? 1 : Infinity }
53
53
  );
54
54
 
55
55
  componentBody[attributeName] = components.map(({ id }) => {
@@ -97,7 +97,7 @@ const createComponents = async (uid, data) => {
97
97
  componentBody[attributeName] = await mapAsync(
98
98
  dynamiczoneValues,
99
99
  createDynamicZoneComponents,
100
- { concurrency: isDialectMySQL() ? 1 : Infinity }
100
+ { concurrency: isDialectMySQL() && !strapi.db.inTransaction() ? 1 : Infinity }
101
101
  );
102
102
 
103
103
  continue;
@@ -151,7 +151,7 @@ const updateComponents = async (uid, entityToUpdate, data) => {
151
151
  const components = await mapAsync(
152
152
  componentValue,
153
153
  (value) => updateOrCreateComponent(componentUID, value),
154
- { concurrency: isDialectMySQL() ? 1 : Infinity }
154
+ { concurrency: isDialectMySQL() && !strapi.db.inTransaction() ? 1 : Infinity }
155
155
  );
156
156
 
157
157
  componentBody[attributeName] = components.filter(_.negate(_.isNil)).map(({ id }) => {
@@ -200,7 +200,7 @@ const updateComponents = async (uid, entityToUpdate, data) => {
200
200
  },
201
201
  };
202
202
  },
203
- { concurrency: isDialectMySQL() ? 1 : Infinity }
203
+ { concurrency: isDialectMySQL() && !strapi.db.inTransaction() ? 1 : Infinity }
204
204
  );
205
205
 
206
206
  continue;
@@ -305,7 +305,7 @@ const deleteComponents = async (uid, entityToDelete, { loadComponents = true } =
305
305
  const { component: componentUID } = attribute;
306
306
  // MySQL/MariaDB can cause deadlocks here if concurrency higher than 1
307
307
  await mapAsync(_.castArray(value), (subValue) => deleteComponent(componentUID, subValue), {
308
- concurrency: isDialectMySQL() ? 1 : Infinity,
308
+ concurrency: isDialectMySQL() && !strapi.db.inTransaction() ? 1 : Infinity,
309
309
  });
310
310
  } else {
311
311
  // delete dynamic zone components
@@ -313,7 +313,7 @@ const deleteComponents = async (uid, entityToDelete, { loadComponents = true } =
313
313
  await mapAsync(
314
314
  _.castArray(value),
315
315
  (subValue) => deleteComponent(subValue.__component, subValue),
316
- { concurrency: isDialectMySQL() ? 1 : Infinity }
316
+ { concurrency: isDialectMySQL() && !strapi.db.inTransaction() ? 1 : Infinity }
317
317
  );
318
318
  }
319
319
 
@@ -33,15 +33,14 @@ module.exports = (strapi) => {
33
33
  const registerAdminRoutes = (strapi) => {
34
34
  const generateRouteScope = createRouteScopeGenerator(`admin::`);
35
35
 
36
- strapi.admin.routes.forEach((route) => {
37
- generateRouteScope(route);
38
- route.info = { pluginName: 'admin' };
39
- });
40
-
41
- strapi.server.routes({
42
- type: 'admin',
43
- prefix: '/admin',
44
- routes: strapi.admin.routes,
36
+ _.forEach(strapi.admin.routes, (router) => {
37
+ router.type = router.type || 'admin';
38
+ router.prefix = router.prefix || `/admin`;
39
+ router.routes.forEach((route) => {
40
+ generateRouteScope(route);
41
+ route.info = { pluginName: 'admin' };
42
+ });
43
+ strapi.server.routes(router);
45
44
  });
46
45
  };
47
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "4.10.2-alpha.0",
3
+ "version": "4.10.4",
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.2-alpha.0",
85
- "@strapi/data-transfer": "4.10.2-alpha.0",
86
- "@strapi/database": "4.10.2-alpha.0",
87
- "@strapi/generate-new": "4.10.2-alpha.0",
88
- "@strapi/generators": "4.10.2-alpha.0",
89
- "@strapi/logger": "4.10.2-alpha.0",
90
- "@strapi/permissions": "4.10.2-alpha.0",
91
- "@strapi/plugin-content-manager": "4.10.2-alpha.0",
92
- "@strapi/plugin-content-type-builder": "4.10.2-alpha.0",
93
- "@strapi/plugin-email": "4.10.2-alpha.0",
94
- "@strapi/plugin-upload": "4.10.2-alpha.0",
95
- "@strapi/typescript-utils": "4.10.2-alpha.0",
96
- "@strapi/utils": "4.10.2-alpha.0",
84
+ "@strapi/admin": "4.10.4",
85
+ "@strapi/data-transfer": "4.10.4",
86
+ "@strapi/database": "4.10.4",
87
+ "@strapi/generate-new": "4.10.4",
88
+ "@strapi/generators": "4.10.4",
89
+ "@strapi/logger": "4.10.4",
90
+ "@strapi/permissions": "4.10.4",
91
+ "@strapi/plugin-content-manager": "4.10.4",
92
+ "@strapi/plugin-content-type-builder": "4.10.4",
93
+ "@strapi/plugin-email": "4.10.4",
94
+ "@strapi/plugin-upload": "4.10.4",
95
+ "@strapi/typescript-utils": "4.10.4",
96
+ "@strapi/utils": "4.10.4",
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": "bb1b2273381c3deae0b5bb865e50e8382926bd8c"
145
+ "gitHead": "3f55bac2e7fc3b15c85ac6910be1e95bb7eed9e5"
146
146
  }