@strapi/content-type-builder 5.0.0-beta.13 → 5.0.0-beta.15
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/dist/_chunks/{ListView-xaNatyR5.js → ListView-Ck4RD5zv.js} +2 -2
- package/dist/_chunks/{ListView-xaNatyR5.js.map → ListView-Ck4RD5zv.js.map} +1 -1
- package/dist/_chunks/{ListView-XY2fP5rq.mjs → ListView-CvhNSPOj.mjs} +2 -2
- package/dist/_chunks/{ListView-XY2fP5rq.mjs.map → ListView-CvhNSPOj.mjs.map} +1 -1
- package/dist/_chunks/{index-CXnxyVmN.mjs → index-B75PCXjD.mjs} +104 -29
- package/dist/_chunks/index-B75PCXjD.mjs.map +1 -0
- package/dist/_chunks/{index-dNWVwai8.js → index-CzY3GwAJ.js} +9 -11
- package/dist/_chunks/index-CzY3GwAJ.js.map +1 -0
- package/dist/_chunks/{index-B8DNmsqZ.js → index-Dlls62x0.js} +104 -29
- package/dist/_chunks/index-Dlls62x0.js.map +1 -0
- package/dist/_chunks/{index-BTar7GUh.mjs → index-DxoOWoqf.mjs} +9 -11
- package/dist/_chunks/index-DxoOWoqf.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/DataManagerProvider/utils/retrieveComponentsThatHaveComponents.d.ts +11 -3
- package/dist/admin/src/components/DataManagerProvider/utils/retrieveNestedComponents.d.ts +8 -1
- package/dist/admin/src/components/FormModal/utils/getAttributesToDisplay.d.ts +2 -1
- package/dist/admin/src/components/SelectComponent.d.ts +2 -1
- package/dist/admin/src/constants.d.ts +1 -0
- package/dist/admin/src/utils/getMaxDepth.d.ts +23 -0
- package/dist/server/index.js +3 -22
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +3 -22
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/validation/types.d.ts.map +1 -1
- package/dist/server/src/utils/attributes.d.ts +1 -2
- package/dist/server/src/utils/attributes.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/_chunks/index-B8DNmsqZ.js.map +0 -1
- package/dist/_chunks/index-BTar7GUh.mjs.map +0 -1
- package/dist/_chunks/index-CXnxyVmN.mjs.map +0 -1
- package/dist/_chunks/index-dNWVwai8.js.map +0 -1
package/dist/server/index.mjs
CHANGED
|
@@ -23,12 +23,6 @@ const bootstrap = async ({ strapi: strapi2 }) => {
|
|
|
23
23
|
await strapi2.service("admin::permission").actionProvider.registerMany(actions);
|
|
24
24
|
};
|
|
25
25
|
const { ApplicationError: ApplicationError$3 } = errors;
|
|
26
|
-
const hasComponent = (model) => {
|
|
27
|
-
const compoKeys = Object.keys(model.attributes || {}).filter((key) => {
|
|
28
|
-
return model.attributes[key].type === "component";
|
|
29
|
-
});
|
|
30
|
-
return compoKeys.length > 0;
|
|
31
|
-
};
|
|
32
26
|
const isConfigurable = (attribute) => _.get(attribute, "configurable", true);
|
|
33
27
|
const isRelation = (attribute) => attribute.type === "relation";
|
|
34
28
|
const formatAttributes = (model) => {
|
|
@@ -1374,7 +1368,7 @@ const getTypeValidator = (attribute, { types, modelType, attributes }) => {
|
|
|
1374
1368
|
...getTypeShape(attribute, { modelType, attributes })
|
|
1375
1369
|
});
|
|
1376
1370
|
};
|
|
1377
|
-
const getTypeShape = (attribute, {
|
|
1371
|
+
const getTypeShape = (attribute, { attributes } = {}) => {
|
|
1378
1372
|
switch (attribute.type) {
|
|
1379
1373
|
case "media": {
|
|
1380
1374
|
return {
|
|
@@ -1519,21 +1513,8 @@ const getTypeShape = (attribute, { modelType, attributes } = {}) => {
|
|
|
1519
1513
|
return {
|
|
1520
1514
|
required: validators.required,
|
|
1521
1515
|
repeatable: yup.boolean(),
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
test(compoUID) {
|
|
1525
|
-
const targetCompo = strapi.components[compoUID];
|
|
1526
|
-
if (!targetCompo)
|
|
1527
|
-
return true;
|
|
1528
|
-
if (modelType === modelTypes.COMPONENT && hasComponent(targetCompo)) {
|
|
1529
|
-
return this.createError({
|
|
1530
|
-
path: this.path,
|
|
1531
|
-
message: `${targetCompo.modelName} already is a nested component. You cannot have more than one level of nesting inside your components.`
|
|
1532
|
-
});
|
|
1533
|
-
}
|
|
1534
|
-
return true;
|
|
1535
|
-
}
|
|
1536
|
-
}).required(),
|
|
1516
|
+
// TODO: Add correct server validation for nested components
|
|
1517
|
+
component: yup.string().required(),
|
|
1537
1518
|
min: yup.number(),
|
|
1538
1519
|
max: yup.number()
|
|
1539
1520
|
};
|