strapi-layout-plugin 1.0.6 → 1.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-layout-plugin",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Strapi layout engine plugin for Sitecore-like routing",
5
5
  "strapi": {
6
6
  "name": "strapi-layout-plugin",
package/server/index.js CHANGED
@@ -3,11 +3,9 @@
3
3
  const controllers = require('./controllers');
4
4
  const routes = require('./routes');
5
5
  const contentTypes = require('./content-types');
6
- const bootstrap = require('./bootstrap');
7
6
 
8
7
  module.exports = {
9
8
  controllers,
10
9
  routes,
11
10
  contentTypes,
12
- bootstrap,
13
11
  };
@@ -25,8 +25,17 @@ module.exports = ({ strapi }) => {
25
25
 
26
26
  for (const [uid, schema] of Object.entries(componentsToInject)) {
27
27
  if (!strapi.components[uid]) {
28
- // Mock the structure Strapi expects for components
29
- strapi.components[uid] = Object.assign({}, schema, { uid, category: uid.split('.')[0] });
28
+ const parts = uid.split('.');
29
+ const category = parts[0];
30
+ const modelName = parts.slice(1).join('.');
31
+
32
+ // Mock the structure Strapi expects for components to avoid database.init crash
33
+ strapi.components[uid] = Object.assign({}, schema, {
34
+ uid,
35
+ category,
36
+ modelName,
37
+ modelType: 'component'
38
+ });
30
39
  }
31
40
  }
32
41