@strapi/content-type-builder 5.4.2 → 5.5.0
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-B-HL7krE.js → ListView-B8sInwpb.js} +2 -2
- package/dist/_chunks/{ListView-B-HL7krE.js.map → ListView-B8sInwpb.js.map} +1 -1
- package/dist/_chunks/{ListView-CpLjBWJ4.mjs → ListView-DPzmWFi5.mjs} +2 -2
- package/dist/_chunks/{ListView-CpLjBWJ4.mjs.map → ListView-DPzmWFi5.mjs.map} +1 -1
- package/dist/_chunks/{index-SDJgON5S.js → index-BKtm7tvi.js} +22 -17
- package/dist/_chunks/{index-SDJgON5S.js.map → index-BKtm7tvi.js.map} +1 -1
- package/dist/_chunks/{index-DoD5A25S.js → index-CD3IaMB6.js} +8 -12
- package/dist/_chunks/{index-DoD5A25S.js.map → index-CD3IaMB6.js.map} +1 -1
- package/dist/_chunks/{index-CvbyAgJs.mjs → index-Dj0FBBTu.mjs} +21 -15
- package/dist/_chunks/{index-CvbyAgJs.mjs.map → index-Dj0FBBTu.mjs.map} +1 -1
- package/dist/_chunks/{index-BdUS6fSR.mjs → index-OzcYkX5o.mjs} +7 -10
- package/dist/_chunks/{index-BdUS6fSR.mjs.map → index-OzcYkX5o.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +16 -32
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +15 -30
- package/dist/server/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/admin/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const index = require("../_chunks/index-
|
|
3
|
+
const index = require("../_chunks/index-BKtm7tvi.js");
|
|
4
4
|
require("@strapi/icons");
|
|
5
5
|
exports.default = index.index;
|
|
6
6
|
exports.private_AutoReloadOverlayBlockerProvider = index.AutoReloadOverlayBlockerProvider;
|
package/dist/admin/index.mjs
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -7,8 +7,7 @@ const fse = require("fs-extra");
|
|
|
7
7
|
const pluralize = require("pluralize");
|
|
8
8
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
9
9
|
function _interopNamespace(e) {
|
|
10
|
-
if (e && e.__esModule)
|
|
11
|
-
return e;
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
12
11
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
13
12
|
if (e) {
|
|
14
13
|
for (const k in e) {
|
|
@@ -104,8 +103,7 @@ const replaceTemporaryUIDs = (uidMap) => (schema) => {
|
|
|
104
103
|
acc[key] = {
|
|
105
104
|
...attr,
|
|
106
105
|
components: attr.components.map((value) => {
|
|
107
|
-
if (___default.default.has(uidMap, value))
|
|
108
|
-
return uidMap[value];
|
|
106
|
+
if (___default.default.has(uidMap, value)) return uidMap[value];
|
|
109
107
|
if (!___default.default.has(strapi.components, value)) {
|
|
110
108
|
throw new ApplicationError$3("component.notFound");
|
|
111
109
|
}
|
|
@@ -181,8 +179,7 @@ function createSchemaHandler(infos) {
|
|
|
181
179
|
},
|
|
182
180
|
// set a particular path inside the schema
|
|
183
181
|
set(path2, val) {
|
|
184
|
-
if (!state.schema)
|
|
185
|
-
return this;
|
|
182
|
+
if (!state.schema) return this;
|
|
186
183
|
modified = true;
|
|
187
184
|
const value = ___default.default.defaultTo(val, ___default.default.get(state.schema, path2));
|
|
188
185
|
___default.default.set(state.schema, path2, value);
|
|
@@ -208,8 +205,7 @@ function createSchemaHandler(infos) {
|
|
|
208
205
|
return this.unset(["attributes", key]);
|
|
209
206
|
},
|
|
210
207
|
setAttributes(newAttributes) {
|
|
211
|
-
if (!this.schema)
|
|
212
|
-
return this;
|
|
208
|
+
if (!this.schema) return this;
|
|
213
209
|
for (const key in this.schema.attributes) {
|
|
214
210
|
if (isConfigurable(this.schema.attributes[key])) {
|
|
215
211
|
this.deleteAttribute(key);
|
|
@@ -221,8 +217,7 @@ function createSchemaHandler(infos) {
|
|
|
221
217
|
return this;
|
|
222
218
|
},
|
|
223
219
|
removeContentType(uid2) {
|
|
224
|
-
if (!state.schema)
|
|
225
|
-
return this;
|
|
220
|
+
if (!state.schema) return this;
|
|
226
221
|
const attributes = state.schema.attributes;
|
|
227
222
|
Object.keys(attributes).forEach((key) => {
|
|
228
223
|
const attribute = attributes[key];
|
|
@@ -234,8 +229,7 @@ function createSchemaHandler(infos) {
|
|
|
234
229
|
},
|
|
235
230
|
// utils
|
|
236
231
|
removeComponent(uid2) {
|
|
237
|
-
if (!state.schema)
|
|
238
|
-
return this;
|
|
232
|
+
if (!state.schema) return this;
|
|
239
233
|
const attributes = state.schema.attributes;
|
|
240
234
|
Object.keys(attributes).forEach((key) => {
|
|
241
235
|
const attr = attributes[key];
|
|
@@ -252,8 +246,7 @@ function createSchemaHandler(infos) {
|
|
|
252
246
|
return this;
|
|
253
247
|
},
|
|
254
248
|
updateComponent(uid2, newUID) {
|
|
255
|
-
if (!state.schema)
|
|
256
|
-
return this;
|
|
249
|
+
if (!state.schema) return this;
|
|
257
250
|
const attributes = state.schema.attributes;
|
|
258
251
|
Object.keys(attributes).forEach((key) => {
|
|
259
252
|
const attr = attributes[key];
|
|
@@ -285,8 +278,7 @@ function createSchemaHandler(infos) {
|
|
|
285
278
|
return;
|
|
286
279
|
}
|
|
287
280
|
if (modified) {
|
|
288
|
-
if (!state.schema)
|
|
289
|
-
return Promise.resolve();
|
|
281
|
+
if (!state.schema) return Promise.resolve();
|
|
290
282
|
await fse__namespace.default.ensureFile(filePath);
|
|
291
283
|
await fse__namespace.default.writeJSON(
|
|
292
284
|
filePath,
|
|
@@ -505,8 +497,7 @@ function createComponentBuilder() {
|
|
|
505
497
|
const targetCT = this.contentTypes.get(attribute.target);
|
|
506
498
|
const targetAttributeName = attribute.inversedBy || attribute.mappedBy;
|
|
507
499
|
const targetAttribute = targetCT.getAttribute(targetAttributeName);
|
|
508
|
-
if (!targetAttribute)
|
|
509
|
-
return;
|
|
500
|
+
if (!targetAttribute) return;
|
|
510
501
|
return targetCT.deleteAttribute(targetAttributeName);
|
|
511
502
|
},
|
|
512
503
|
/**
|
|
@@ -1112,8 +1103,7 @@ const components$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
|
|
|
1112
1103
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1113
1104
|
const editCategory = async (name, infos) => {
|
|
1114
1105
|
const newName = utils.strings.nameToSlug(infos.name);
|
|
1115
|
-
if (name === newName)
|
|
1116
|
-
return;
|
|
1106
|
+
if (name === newName) return;
|
|
1117
1107
|
if (!categoryExists(name)) {
|
|
1118
1108
|
throw new utils.errors.ApplicationError("category not found");
|
|
1119
1109
|
}
|
|
@@ -1124,8 +1114,7 @@ const editCategory = async (name, infos) => {
|
|
|
1124
1114
|
builder2.components.forEach((component) => {
|
|
1125
1115
|
const oldUID = component.uid;
|
|
1126
1116
|
const newUID = `${newName}.${component.modelName}`;
|
|
1127
|
-
if (component.category !== name)
|
|
1128
|
-
return;
|
|
1117
|
+
if (component.category !== name) return;
|
|
1129
1118
|
component.setUID(newUID).setDir(path.join(strapi.dirs.app.components, newName));
|
|
1130
1119
|
builder2.components.forEach((compo) => {
|
|
1131
1120
|
compo.updateComponent(oldUID, newUID);
|
|
@@ -1689,8 +1678,7 @@ const createAttributesValidator = ({ types, modelType, relations }) => {
|
|
|
1689
1678
|
const isConflictingKey = (key, attributes) => {
|
|
1690
1679
|
const snakeCaseKey = fp.snakeCase(key);
|
|
1691
1680
|
return Object.keys(attributes).some((existingKey) => {
|
|
1692
|
-
if (existingKey === key)
|
|
1693
|
-
return false;
|
|
1681
|
+
if (existingKey === key) return false;
|
|
1694
1682
|
return fp.snakeCase(existingKey) === snakeCaseKey;
|
|
1695
1683
|
});
|
|
1696
1684
|
};
|
|
@@ -1755,10 +1743,8 @@ const nestedComponentSchema = utils.yup.array().of(
|
|
|
1755
1743
|
name: "mustHaveUIDOrTmpUID",
|
|
1756
1744
|
message: "Component must have a uid or a tmpUID",
|
|
1757
1745
|
test(attr) {
|
|
1758
|
-
if (___default.default.has(attr, "uid") && ___default.default.has(attr, "tmpUID"))
|
|
1759
|
-
|
|
1760
|
-
if (!___default.default.has(attr, "uid") && !___default.default.has(attr, "tmpUID"))
|
|
1761
|
-
return false;
|
|
1746
|
+
if (___default.default.has(attr, "uid") && ___default.default.has(attr, "tmpUID")) return false;
|
|
1747
|
+
if (!___default.default.has(attr, "uid") && !___default.default.has(attr, "tmpUID")) return false;
|
|
1762
1748
|
return true;
|
|
1763
1749
|
}
|
|
1764
1750
|
}).required().noUnknown()
|
|
@@ -1978,8 +1964,7 @@ const nameIsAvailable = (isEdition) => {
|
|
|
1978
1964
|
name: "nameAlreadyUsed",
|
|
1979
1965
|
message: "contentType: name `${value}` is already being used by another content type.",
|
|
1980
1966
|
test(value) {
|
|
1981
|
-
if (isEdition)
|
|
1982
|
-
return true;
|
|
1967
|
+
if (isEdition) return true;
|
|
1983
1968
|
if (typeof value !== "string") {
|
|
1984
1969
|
return true;
|
|
1985
1970
|
}
|
|
@@ -1995,8 +1980,7 @@ const nameIsNotExistingCollectionName = (isEdition) => {
|
|
|
1995
1980
|
name: "nameAlreadyUsed",
|
|
1996
1981
|
message: "contentType: name `${value}` is already being used by another content type.",
|
|
1997
1982
|
test(value) {
|
|
1998
|
-
if (isEdition)
|
|
1999
|
-
return true;
|
|
1983
|
+
if (isEdition) return true;
|
|
2000
1984
|
if (typeof value !== "string") {
|
|
2001
1985
|
return true;
|
|
2002
1986
|
}
|