@strapi/content-type-builder 5.54.0 → 5.55.1
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/admin/components/AIChat/hooks/useAIFetch.js +6 -2
- package/dist/admin/components/AIChat/hooks/useAIFetch.js.map +1 -1
- package/dist/admin/components/AIChat/hooks/useAIFetch.mjs +7 -3
- package/dist/admin/components/AIChat/hooks/useAIFetch.mjs.map +1 -1
- package/dist/admin/components/AIChat/hooks/usePrefetchAIToken.js +20 -0
- package/dist/admin/components/AIChat/hooks/usePrefetchAIToken.js.map +1 -0
- package/dist/admin/components/AIChat/hooks/usePrefetchAIToken.mjs +18 -0
- package/dist/admin/components/AIChat/hooks/usePrefetchAIToken.mjs.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/ContentTypeBuilderNav.js +83 -59
- package/dist/admin/components/ContentTypeBuilderNav/ContentTypeBuilderNav.js.map +1 -1
- package/dist/admin/components/ContentTypeBuilderNav/ContentTypeBuilderNav.mjs +86 -62
- package/dist/admin/components/ContentTypeBuilderNav/ContentTypeBuilderNav.mjs.map +1 -1
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/DeleteFolderDialog.js +112 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/DeleteFolderDialog.js.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/DeleteFolderDialog.mjs +110 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/DeleteFolderDialog.mjs.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/FolderNameField.js +159 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/FolderNameField.js.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/FolderNameField.mjs +157 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/FolderNameField.mjs.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/FolderNavSection.js +311 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/FolderNavSection.js.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/FolderNavSection.mjs +309 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/FolderNavSection.mjs.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/SortableTreeRow.js +379 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/SortableTreeRow.js.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/SortableTreeRow.mjs +376 -0
- package/dist/admin/components/ContentTypeBuilderNav/components/FolderNav/SortableTreeRow.mjs.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/hooks/useContentTypeBuilderMenu.js +172 -0
- package/dist/admin/components/ContentTypeBuilderNav/hooks/useContentTypeBuilderMenu.js.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/hooks/useContentTypeBuilderMenu.mjs +166 -0
- package/dist/admin/components/ContentTypeBuilderNav/hooks/useContentTypeBuilderMenu.mjs.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/hooks/useFolderActions.js +62 -0
- package/dist/admin/components/ContentTypeBuilderNav/hooks/useFolderActions.js.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/hooks/useFolderActions.mjs +60 -0
- package/dist/admin/components/ContentTypeBuilderNav/hooks/useFolderActions.mjs.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/hooks/useSortableTree.js +145 -0
- package/dist/admin/components/ContentTypeBuilderNav/hooks/useSortableTree.js.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/hooks/useSortableTree.mjs +143 -0
- package/dist/admin/components/ContentTypeBuilderNav/hooks/useSortableTree.mjs.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/lib/buildFolderTree.js +176 -0
- package/dist/admin/components/ContentTypeBuilderNav/lib/buildFolderTree.js.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/lib/buildFolderTree.mjs +169 -0
- package/dist/admin/components/ContentTypeBuilderNav/lib/buildFolderTree.mjs.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/lib/dropProjection.js +277 -0
- package/dist/admin/components/ContentTypeBuilderNav/lib/dropProjection.js.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/lib/dropProjection.mjs +273 -0
- package/dist/admin/components/ContentTypeBuilderNav/lib/dropProjection.mjs.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/lib/flatModel.js +62 -0
- package/dist/admin/components/ContentTypeBuilderNav/lib/flatModel.js.map +1 -0
- package/dist/admin/components/ContentTypeBuilderNav/lib/flatModel.mjs +58 -0
- package/dist/admin/components/ContentTypeBuilderNav/lib/flatModel.mjs.map +1 -0
- package/dist/admin/components/DataManager/DataManagerContext.js.map +1 -1
- package/dist/admin/components/DataManager/DataManagerContext.mjs.map +1 -1
- package/dist/admin/components/DataManager/DataManagerProvider.js +70 -8
- package/dist/admin/components/DataManager/DataManagerProvider.js.map +1 -1
- package/dist/admin/components/DataManager/DataManagerProvider.mjs +70 -8
- package/dist/admin/components/DataManager/DataManagerProvider.mjs.map +1 -1
- package/dist/admin/components/DataManager/reducer.js +411 -33
- package/dist/admin/components/DataManager/reducer.js.map +1 -1
- package/dist/admin/components/DataManager/reducer.mjs +411 -33
- package/dist/admin/components/DataManager/reducer.mjs.map +1 -1
- package/dist/admin/components/DataManager/utils/cleanData.js +11 -2
- package/dist/admin/components/DataManager/utils/cleanData.js.map +1 -1
- package/dist/admin/components/DataManager/utils/cleanData.mjs +11 -2
- package/dist/admin/components/DataManager/utils/cleanData.mjs.map +1 -1
- package/dist/admin/components/DataManager/utils/contentStructure.js +150 -0
- package/dist/admin/components/DataManager/utils/contentStructure.js.map +1 -0
- package/dist/admin/components/DataManager/utils/contentStructure.mjs +133 -0
- package/dist/admin/components/DataManager/utils/contentStructure.mjs.map +1 -0
- package/dist/admin/components/FolderSelect.js +200 -0
- package/dist/admin/components/FolderSelect.js.map +1 -0
- package/dist/admin/components/FolderSelect.mjs +198 -0
- package/dist/admin/components/FolderSelect.mjs.map +1 -0
- package/dist/admin/components/FormModal/FormModal.js +23 -2
- package/dist/admin/components/FormModal/FormModal.js.map +1 -1
- package/dist/admin/components/FormModal/FormModal.mjs +23 -2
- package/dist/admin/components/FormModal/FormModal.mjs.map +1 -1
- package/dist/admin/components/FormModal/contentType/contentTypeForm.js +15 -18
- package/dist/admin/components/FormModal/contentType/contentTypeForm.js.map +1 -1
- package/dist/admin/components/FormModal/contentType/contentTypeForm.mjs +15 -18
- package/dist/admin/components/FormModal/contentType/contentTypeForm.mjs.map +1 -1
- package/dist/admin/components/FormModal/reducer.js +6 -0
- package/dist/admin/components/FormModal/reducer.js.map +1 -1
- package/dist/admin/components/FormModal/reducer.mjs +6 -0
- package/dist/admin/components/FormModal/reducer.mjs.map +1 -1
- package/dist/admin/pages/App/index.js +2 -5
- package/dist/admin/pages/App/index.js.map +1 -1
- package/dist/admin/pages/App/index.mjs +2 -5
- package/dist/admin/pages/App/index.mjs.map +1 -1
- package/dist/admin/src/components/AIChat/hooks/usePrefetchAIToken.d.ts +1 -0
- package/dist/admin/src/components/ContentTypeBuilderNav/components/FolderNav/DeleteFolderDialog.d.ts +16 -0
- package/dist/admin/src/components/ContentTypeBuilderNav/components/FolderNav/FolderNameField.d.ts +12 -0
- package/dist/admin/src/components/ContentTypeBuilderNav/components/FolderNav/FolderNavSection.d.ts +14 -0
- package/dist/admin/src/components/ContentTypeBuilderNav/components/FolderNav/SortableTreeRow.d.ts +38 -0
- package/dist/admin/src/components/ContentTypeBuilderNav/{useContentTypeBuilderMenu.d.ts → hooks/useContentTypeBuilderMenu.d.ts} +17 -7
- package/dist/admin/src/components/ContentTypeBuilderNav/hooks/useFolderActions.d.ts +42 -0
- package/dist/admin/src/components/ContentTypeBuilderNav/hooks/useSortableTree.d.ts +53 -0
- package/dist/admin/src/components/ContentTypeBuilderNav/lib/buildFolderTree.d.ts +42 -0
- package/dist/admin/src/components/ContentTypeBuilderNav/lib/dropProjection.d.ts +58 -0
- package/dist/admin/src/components/ContentTypeBuilderNav/lib/flatModel.d.ts +18 -0
- package/dist/admin/src/components/DataManager/DataManagerContext.d.ts +41 -0
- package/dist/admin/src/components/DataManager/reducer.d.ts +105 -1
- package/dist/admin/src/components/DataManager/utils/cleanData.d.ts +5 -1
- package/dist/admin/src/components/DataManager/utils/contentStructure.d.ts +68 -0
- package/dist/admin/src/components/FolderSelect.d.ts +18 -0
- package/dist/admin/src/components/FormModal/contentType/contentTypeForm.d.ts +0 -21
- package/dist/admin/src/components/FormModal/forms/forms.d.ts +0 -10
- package/dist/admin/src/components/FormModal/reducer.d.ts +7 -0
- package/dist/admin/src/utils/folderTelemetry.d.ts +5 -0
- package/dist/admin/translations/en.json.js +23 -0
- package/dist/admin/translations/en.json.js.map +1 -1
- package/dist/admin/translations/en.json.mjs +23 -0
- package/dist/admin/translations/en.json.mjs.map +1 -1
- package/dist/admin/utils/folderTelemetry.js +19 -0
- package/dist/admin/utils/folderTelemetry.js.map +1 -0
- package/dist/admin/utils/folderTelemetry.mjs +16 -0
- package/dist/admin/utils/folderTelemetry.mjs.map +1 -0
- package/dist/server/controllers/schema.js +1 -1
- package/dist/server/controllers/schema.js.map +1 -1
- package/dist/server/controllers/schema.mjs +1 -1
- package/dist/server/controllers/schema.mjs.map +1 -1
- package/dist/server/controllers/validation/common.js +3 -0
- package/dist/server/controllers/validation/common.js.map +1 -1
- package/dist/server/controllers/validation/common.mjs +3 -1
- package/dist/server/controllers/validation/common.mjs.map +1 -1
- package/dist/server/controllers/validation/content-structure.js +177 -0
- package/dist/server/controllers/validation/content-structure.js.map +1 -0
- package/dist/server/controllers/validation/content-structure.mjs +173 -0
- package/dist/server/controllers/validation/content-structure.mjs.map +1 -0
- package/dist/server/controllers/validation/schema.js +3 -1
- package/dist/server/controllers/validation/schema.js.map +1 -1
- package/dist/server/controllers/validation/schema.mjs +3 -1
- package/dist/server/controllers/validation/schema.mjs.map +1 -1
- package/dist/server/register.js +1 -1
- package/dist/server/register.js.map +1 -1
- package/dist/server/register.mjs +1 -1
- package/dist/server/register.mjs.map +1 -1
- package/dist/server/routes/content-api.js +4 -4
- package/dist/server/routes/content-api.js.map +1 -1
- package/dist/server/routes/content-api.mjs +4 -4
- package/dist/server/routes/content-api.mjs.map +1 -1
- package/dist/server/services/api-handler.js +37 -4
- package/dist/server/services/api-handler.js.map +1 -1
- package/dist/server/services/api-handler.mjs +36 -5
- package/dist/server/services/api-handler.mjs.map +1 -1
- package/dist/server/services/content-structure.js +174 -0
- package/dist/server/services/content-structure.js.map +1 -0
- package/dist/server/services/content-structure.mjs +172 -0
- package/dist/server/services/content-structure.mjs.map +1 -0
- package/dist/server/services/content-types.js +196 -44
- package/dist/server/services/content-types.js.map +1 -1
- package/dist/server/services/content-types.mjs +195 -45
- package/dist/server/services/content-types.mjs.map +1 -1
- package/dist/server/services/index.js +3 -1
- package/dist/server/services/index.js.map +1 -1
- package/dist/server/services/index.mjs +3 -1
- package/dist/server/services/index.mjs.map +1 -1
- package/dist/server/services/schema-builder/index.js +4 -2
- package/dist/server/services/schema-builder/index.js.map +1 -1
- package/dist/server/services/schema-builder/index.mjs +4 -2
- package/dist/server/services/schema-builder/index.mjs.map +1 -1
- package/dist/server/services/schema-builder/schema-handler.js +16 -16
- package/dist/server/services/schema-builder/schema-handler.js.map +1 -1
- package/dist/server/services/schema-builder/schema-handler.mjs +16 -16
- package/dist/server/services/schema-builder/schema-handler.mjs.map +1 -1
- package/dist/server/services/schema-mutation.js +46 -0
- package/dist/server/services/schema-mutation.js.map +1 -0
- package/dist/server/services/schema-mutation.mjs +43 -0
- package/dist/server/services/schema-mutation.mjs.map +1 -0
- package/dist/server/services/schema.js +134 -79
- package/dist/server/services/schema.js.map +1 -1
- package/dist/server/services/schema.mjs +135 -80
- package/dist/server/services/schema.mjs.map +1 -1
- package/dist/server/src/controllers/schema.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/common.d.ts +1 -0
- package/dist/server/src/controllers/validation/common.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/content-structure.d.ts +56 -0
- package/dist/server/src/controllers/validation/content-structure.d.ts.map +1 -0
- package/dist/server/src/controllers/validation/schema.d.ts +35 -0
- package/dist/server/src/controllers/validation/schema.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +3 -0
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/routes/content-api.d.ts.map +1 -1
- package/dist/server/src/services/api-handler.d.ts +13 -1
- package/dist/server/src/services/api-handler.d.ts.map +1 -1
- package/dist/server/src/services/content-structure.d.ts +37 -0
- package/dist/server/src/services/content-structure.d.ts.map +1 -0
- package/dist/server/src/services/content-types.d.ts +4 -0
- package/dist/server/src/services/content-types.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +4 -0
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/schema-builder/index.d.ts +3 -1
- package/dist/server/src/services/schema-builder/index.d.ts.map +1 -1
- package/dist/server/src/services/schema-builder/schema-handler.d.ts.map +1 -1
- package/dist/server/src/services/schema-mutation.d.ts +26 -0
- package/dist/server/src/services/schema-mutation.d.ts.map +1 -0
- package/dist/server/src/services/schema.d.ts +1 -0
- package/dist/server/src/services/schema.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts +2 -0
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/server/utils/index.js.map +1 -1
- package/dist/server/utils/index.mjs.map +1 -1
- package/package.json +6 -6
- package/dist/admin/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.js +0 -157
- package/dist/admin/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.js.map +0 -1
- package/dist/admin/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.mjs +0 -151
- package/dist/admin/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.mjs.map +0 -1
|
@@ -4,7 +4,9 @@ var _ = require('lodash');
|
|
|
4
4
|
var fp = require('lodash/fp');
|
|
5
5
|
var utils = require('@strapi/utils');
|
|
6
6
|
var attributes = require('../utils/attributes.js');
|
|
7
|
+
var index$1 = require('../utils/index.js');
|
|
7
8
|
var index = require('./schema-builder/index.js');
|
|
9
|
+
var schemaMutation = require('./schema-mutation.js');
|
|
8
10
|
var constants = require('./constants.js');
|
|
9
11
|
|
|
10
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -12,6 +14,17 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
12
14
|
var ___default = /*#__PURE__*/_interopDefault(_);
|
|
13
15
|
|
|
14
16
|
const { ApplicationError } = utils.errors;
|
|
17
|
+
const isCTBOwnedApplicationContentType = (uid)=>uid.startsWith('api::');
|
|
18
|
+
const assertCTBOwnedApplicationContentType = (uid)=>{
|
|
19
|
+
if (!isCTBOwnedApplicationContentType(uid)) {
|
|
20
|
+
throw new ApplicationError(`Content type "${uid}" is not managed by CTB and cannot be deleted`);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const pruneFolderReferences = (uids)=>{
|
|
24
|
+
return index$1.getService('content-structure').commitFromUpdate({
|
|
25
|
+
deletedUids: new Set(uids)
|
|
26
|
+
});
|
|
27
|
+
};
|
|
15
28
|
const isContentTypeVisible = (model)=>fp.getOr(true, 'pluginOptions.content-type-builder.visible', model) === true;
|
|
16
29
|
const getRestrictRelationsTo = (contentType)=>{
|
|
17
30
|
const { uid } = contentType;
|
|
@@ -53,12 +66,36 @@ const getRestrictRelationsTo = (contentType)=>{
|
|
|
53
66
|
const createContentTypes = async (contentTypes)=>{
|
|
54
67
|
const builder = index();
|
|
55
68
|
const createdContentTypes = [];
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
const generatedApiNames = [];
|
|
70
|
+
let schemaAlreadyRolledBack = false;
|
|
71
|
+
try {
|
|
72
|
+
for (const contentType of contentTypes){
|
|
73
|
+
createdContentTypes.push(await createContentType(contentType, {
|
|
74
|
+
defaultBuilder: builder,
|
|
75
|
+
generatedApiNames,
|
|
76
|
+
deferEvent: true
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
const schemaFilesWritten = await builder.writeFiles();
|
|
80
|
+
if (!schemaFilesWritten) {
|
|
81
|
+
schemaAlreadyRolledBack = true;
|
|
82
|
+
throw new ApplicationError('Invalid schema edition');
|
|
83
|
+
}
|
|
84
|
+
} catch (error) {
|
|
85
|
+
const apiHandler = strapi.plugin('content-type-builder').service('api-handler');
|
|
86
|
+
await schemaMutation.rollbackSchemaMutation({
|
|
87
|
+
builder,
|
|
88
|
+
apiHandler,
|
|
89
|
+
generatedApiNames,
|
|
90
|
+
schemaAlreadyRolledBack
|
|
91
|
+
});
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
for (const contentType of createdContentTypes){
|
|
95
|
+
strapi.eventHub.emit('content-type.create', {
|
|
96
|
+
contentType
|
|
97
|
+
});
|
|
60
98
|
}
|
|
61
|
-
await builder.writeFiles();
|
|
62
99
|
return createdContentTypes;
|
|
63
100
|
};
|
|
64
101
|
/**
|
|
@@ -85,19 +122,43 @@ const createContentTypes = async (contentTypes)=>{
|
|
|
85
122
|
}
|
|
86
123
|
return builder.editComponent(options);
|
|
87
124
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
125
|
+
const generatedApiNames = options.generatedApiNames ?? [];
|
|
126
|
+
let schemaAlreadyRolledBack = false;
|
|
127
|
+
try {
|
|
128
|
+
// Generate before writing the schema so a successful mutation retains the existing layout.
|
|
129
|
+
if (!contentType.plugin) {
|
|
130
|
+
generatedApiNames.push(contentType.singularName);
|
|
131
|
+
await generateAPI({
|
|
132
|
+
displayName: contentType.displayName || contentType.info.displayName,
|
|
133
|
+
singularName: contentType.singularName,
|
|
134
|
+
pluralName: contentType.pluralName,
|
|
135
|
+
kind: contentType.kind
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (!options.defaultBuilder) {
|
|
139
|
+
const schemaFilesWritten = await builder.writeFiles();
|
|
140
|
+
if (!schemaFilesWritten) {
|
|
141
|
+
schemaAlreadyRolledBack = true;
|
|
142
|
+
throw new ApplicationError('Invalid schema edition');
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
} catch (error) {
|
|
146
|
+
if (!options.defaultBuilder) {
|
|
147
|
+
const apiHandler = strapi.plugin('content-type-builder').service('api-handler');
|
|
148
|
+
await schemaMutation.rollbackSchemaMutation({
|
|
149
|
+
builder,
|
|
150
|
+
apiHandler,
|
|
151
|
+
generatedApiNames,
|
|
152
|
+
schemaAlreadyRolledBack
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
throw error;
|
|
156
|
+
}
|
|
157
|
+
if (!options.deferEvent) {
|
|
158
|
+
strapi.eventHub.emit('content-type.create', {
|
|
159
|
+
contentType: newContentType
|
|
160
|
+
});
|
|
97
161
|
}
|
|
98
|
-
strapi.eventHub.emit('content-type.create', {
|
|
99
|
-
contentType: newContentType
|
|
100
|
-
});
|
|
101
162
|
return newContentType;
|
|
102
163
|
};
|
|
103
164
|
/**
|
|
@@ -123,6 +184,7 @@ const createContentTypes = async (contentTypes)=>{
|
|
|
123
184
|
*/ const editContentType = async (uid, { contentType, components = [] })=>{
|
|
124
185
|
const builder = index();
|
|
125
186
|
const previousSchema = builder.contentTypes.get(uid).schema;
|
|
187
|
+
const isPluginContentType = Boolean(builder.contentTypes.get(uid).plugin);
|
|
126
188
|
const previousKind = previousSchema.kind;
|
|
127
189
|
const newKind = contentType.kind || previousKind;
|
|
128
190
|
// Restore non-visible attributes from previous schema
|
|
@@ -153,21 +215,48 @@ const createContentTypes = async (contentTypes)=>{
|
|
|
153
215
|
return builder.editComponent(replaceTmpUIDs(component));
|
|
154
216
|
});
|
|
155
217
|
if (newKind !== previousKind) {
|
|
218
|
+
let schemaAlreadyRolledBack = false;
|
|
156
219
|
const apiHandler = strapi.plugin('content-type-builder').service('api-handler');
|
|
157
220
|
await apiHandler.backup(uid);
|
|
158
221
|
try {
|
|
159
|
-
await apiHandler.clear(uid
|
|
160
|
-
|
|
161
|
-
await generateAPI({
|
|
162
|
-
displayName: updatedContentType.schema.info.displayName,
|
|
163
|
-
singularName: updatedContentType.schema.info.singularName,
|
|
164
|
-
pluralName: updatedContentType.schema.info.pluralName,
|
|
165
|
-
kind: updatedContentType.schema.kind
|
|
222
|
+
await apiHandler.clear(uid, {
|
|
223
|
+
preserveBackup: true
|
|
166
224
|
});
|
|
167
|
-
|
|
225
|
+
if (!isPluginContentType) {
|
|
226
|
+
// generate new api skeleton
|
|
227
|
+
await generateAPI({
|
|
228
|
+
displayName: updatedContentType.schema.info.displayName,
|
|
229
|
+
singularName: updatedContentType.schema.info.singularName,
|
|
230
|
+
pluralName: updatedContentType.schema.info.pluralName,
|
|
231
|
+
kind: updatedContentType.schema.kind
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
const schemaFilesWritten = await builder.writeFiles();
|
|
235
|
+
if (!schemaFilesWritten) {
|
|
236
|
+
schemaAlreadyRolledBack = true;
|
|
237
|
+
throw new ApplicationError('Invalid schema edition');
|
|
238
|
+
}
|
|
239
|
+
await pruneFolderReferences([
|
|
240
|
+
uid
|
|
241
|
+
]);
|
|
168
242
|
} catch (error) {
|
|
243
|
+
await schemaMutation.rollbackSchemaMutation({
|
|
244
|
+
builder,
|
|
245
|
+
apiHandler,
|
|
246
|
+
backedUpApiUids: [
|
|
247
|
+
uid
|
|
248
|
+
],
|
|
249
|
+
schemaAlreadyRolledBack
|
|
250
|
+
});
|
|
251
|
+
throw error;
|
|
252
|
+
}
|
|
253
|
+
for (const error of (await schemaMutation.finalizeSchemaMutation({
|
|
254
|
+
apiHandler,
|
|
255
|
+
backedUpApiUids: [
|
|
256
|
+
uid
|
|
257
|
+
]
|
|
258
|
+
}))){
|
|
169
259
|
strapi.log.error(error);
|
|
170
|
-
await apiHandler.rollback(uid);
|
|
171
260
|
}
|
|
172
261
|
return updatedContentType;
|
|
173
262
|
}
|
|
@@ -178,43 +267,105 @@ const createContentTypes = async (contentTypes)=>{
|
|
|
178
267
|
return updatedContentType;
|
|
179
268
|
};
|
|
180
269
|
const deleteContentTypes = async (uids)=>{
|
|
270
|
+
uids.forEach(assertCTBOwnedApplicationContentType);
|
|
181
271
|
const builder = index();
|
|
182
272
|
const apiHandler = strapi.plugin('content-type-builder').service('api-handler');
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
273
|
+
const deletedContentTypes = [];
|
|
274
|
+
const backedUpApiUids = [];
|
|
275
|
+
let schemaAlreadyRolledBack = false;
|
|
276
|
+
try {
|
|
277
|
+
for (const uid of uids){
|
|
278
|
+
await apiHandler.backup(uid);
|
|
279
|
+
backedUpApiUids.push(uid);
|
|
280
|
+
deletedContentTypes.push(builder.deleteContentType(uid));
|
|
281
|
+
}
|
|
282
|
+
const schemaFilesWritten = await builder.writeFiles();
|
|
283
|
+
if (!schemaFilesWritten) {
|
|
284
|
+
schemaAlreadyRolledBack = true;
|
|
285
|
+
throw new ApplicationError('Invalid schema edition');
|
|
286
|
+
}
|
|
287
|
+
for (const uid of uids){
|
|
288
|
+
await apiHandler.clear(uid, {
|
|
289
|
+
preserveBackup: true
|
|
290
|
+
});
|
|
193
291
|
}
|
|
292
|
+
await pruneFolderReferences(uids);
|
|
293
|
+
} catch (error) {
|
|
294
|
+
await schemaMutation.rollbackSchemaMutation({
|
|
295
|
+
builder,
|
|
296
|
+
apiHandler,
|
|
297
|
+
backedUpApiUids,
|
|
298
|
+
schemaAlreadyRolledBack
|
|
299
|
+
});
|
|
300
|
+
throw error;
|
|
301
|
+
}
|
|
302
|
+
for (const error of (await schemaMutation.finalizeSchemaMutation({
|
|
303
|
+
apiHandler,
|
|
304
|
+
backedUpApiUids
|
|
305
|
+
}))){
|
|
306
|
+
strapi.log.error(error);
|
|
307
|
+
}
|
|
308
|
+
for (const contentType of deletedContentTypes){
|
|
309
|
+
strapi.eventHub.emit('content-type.delete', {
|
|
310
|
+
contentType
|
|
311
|
+
});
|
|
194
312
|
}
|
|
195
313
|
};
|
|
196
314
|
/**
|
|
197
315
|
* Deletes a content type and the api files related to it
|
|
198
316
|
*/ const deleteContentType = async (uid, defaultBuilder = undefined)=>{
|
|
317
|
+
assertCTBOwnedApplicationContentType(uid);
|
|
199
318
|
const builder = defaultBuilder || index();
|
|
200
319
|
// make a backup
|
|
201
320
|
const apiHandler = strapi.plugin('content-type-builder').service('api-handler');
|
|
202
321
|
await apiHandler.backup(uid);
|
|
203
|
-
|
|
322
|
+
let contentType;
|
|
323
|
+
let schemaAlreadyRolledBack = false;
|
|
204
324
|
if (!defaultBuilder) {
|
|
205
325
|
try {
|
|
206
|
-
|
|
207
|
-
await
|
|
208
|
-
|
|
209
|
-
|
|
326
|
+
contentType = builder.deleteContentType(uid);
|
|
327
|
+
const schemaFilesWritten = await builder.writeFiles();
|
|
328
|
+
if (!schemaFilesWritten) {
|
|
329
|
+
schemaAlreadyRolledBack = true;
|
|
330
|
+
throw new ApplicationError('Invalid schema edition');
|
|
331
|
+
}
|
|
332
|
+
await apiHandler.clear(uid, {
|
|
333
|
+
preserveBackup: true
|
|
334
|
+
});
|
|
335
|
+
await pruneFolderReferences([
|
|
336
|
+
uid
|
|
337
|
+
]);
|
|
338
|
+
} catch (error) {
|
|
339
|
+
await schemaMutation.rollbackSchemaMutation({
|
|
340
|
+
builder,
|
|
341
|
+
apiHandler,
|
|
342
|
+
backedUpApiUids: [
|
|
343
|
+
uid
|
|
344
|
+
],
|
|
345
|
+
schemaAlreadyRolledBack
|
|
346
|
+
});
|
|
347
|
+
throw error;
|
|
210
348
|
}
|
|
349
|
+
for (const error of (await schemaMutation.finalizeSchemaMutation({
|
|
350
|
+
apiHandler,
|
|
351
|
+
backedUpApiUids: [
|
|
352
|
+
uid
|
|
353
|
+
]
|
|
354
|
+
}))){
|
|
355
|
+
strapi.log.error(error);
|
|
356
|
+
}
|
|
357
|
+
} else {
|
|
358
|
+
contentType = builder.deleteContentType(uid);
|
|
359
|
+
}
|
|
360
|
+
if (!defaultBuilder) {
|
|
361
|
+
strapi.eventHub.emit('content-type.delete', {
|
|
362
|
+
contentType
|
|
363
|
+
});
|
|
211
364
|
}
|
|
212
|
-
strapi.eventHub.emit('content-type.delete', {
|
|
213
|
-
contentType
|
|
214
|
-
});
|
|
215
365
|
return contentType;
|
|
216
366
|
};
|
|
217
367
|
|
|
368
|
+
exports.assertCTBOwnedApplicationContentType = assertCTBOwnedApplicationContentType;
|
|
218
369
|
exports.createContentType = createContentType;
|
|
219
370
|
exports.createContentTypes = createContentTypes;
|
|
220
371
|
exports.deleteContentType = deleteContentType;
|
|
@@ -223,5 +374,6 @@ exports.editContentType = editContentType;
|
|
|
223
374
|
exports.formatContentType = formatContentType;
|
|
224
375
|
exports.generateAPI = generateAPI;
|
|
225
376
|
exports.getRestrictRelationsTo = getRestrictRelationsTo;
|
|
377
|
+
exports.isCTBOwnedApplicationContentType = isCTBOwnedApplicationContentType;
|
|
226
378
|
exports.isContentTypeVisible = isContentTypeVisible;
|
|
227
379
|
//# sourceMappingURL=content-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-types.js","sources":["../../../server/src/services/content-types.ts"],"sourcesContent":["import _ from 'lodash';\nimport { getOr } from 'lodash/fp';\nimport { contentTypes as contentTypesUtils, errors } from '@strapi/utils';\nimport type { UID, Struct } from '@strapi/types';\nimport { formatAttributes, replaceTemporaryUIDs } from '../utils/attributes';\nimport createBuilder from './schema-builder';\nimport { coreUids, pluginsUids } from './constants';\n\nconst { ApplicationError } = errors;\n\nexport const isContentTypeVisible = (model: Struct.ContentTypeSchema) =>\n getOr(true, 'pluginOptions.content-type-builder.visible', model) === true;\n\nexport const getRestrictRelationsTo = (contentType: Struct.ContentTypeSchema) => {\n const { uid } = contentType;\n if (uid === coreUids.STRAPI_USER) {\n // TODO: replace with an obj { relation: 'x', bidirectional: true|false }\n return ['oneWay', 'manyWay'];\n }\n\n if (\n uid.startsWith(coreUids.PREFIX) ||\n uid === pluginsUids.UPLOAD_FILE ||\n !isContentTypeVisible(contentType)\n ) {\n return [];\n }\n\n return null;\n};\n\n/**\n * Format a contentType info to be used by the front-end\n */\nexport const formatContentType = (contentType: any) => {\n const { uid, kind, modelName, plugin, collectionName, info } = contentType;\n\n return {\n uid,\n plugin,\n apiID: modelName,\n schema: {\n ...contentTypesUtils.getOptions(contentType),\n displayName: info.displayName,\n singularName: info.singularName,\n pluralName: info.pluralName,\n description: _.get(info, 'description', ''),\n pluginOptions: contentType.pluginOptions,\n kind: kind || 'collectionType',\n collectionName,\n attributes: formatAttributes(contentType),\n visible: isContentTypeVisible(contentType),\n restrictRelationsTo: getRestrictRelationsTo(contentType),\n },\n };\n};\n\nexport const createContentTypes = async (contentTypes: any[]) => {\n const builder = createBuilder();\n const createdContentTypes: any[] = [];\n\n for (const contentType of contentTypes) {\n createdContentTypes.push(await createContentType(contentType, { defaultBuilder: builder }));\n }\n\n await builder.writeFiles();\n\n return createdContentTypes;\n};\n\ntype CreateContentTypeOptions = {\n defaultBuilder?: any; // TODO\n};\n\n/**\n * Creates a content type and handle the nested components sent with it\n */\nexport const createContentType = async (\n { contentType, components }: any,\n options: CreateContentTypeOptions = {}\n) => {\n const builder = options.defaultBuilder || createBuilder();\n const uidMap = builder.createNewComponentUIDMap(components || []);\n\n const replaceTmpUIDs = replaceTemporaryUIDs(uidMap);\n\n const newContentType = builder.createContentType(replaceTmpUIDs(contentType));\n\n // allow components to target the new contentType\n const targetContentType = (infos: any) => {\n Object.keys(infos.attributes).forEach((key) => {\n const { target } = infos.attributes[key];\n if (target === '__contentType__') {\n infos.attributes[key].target = newContentType.uid;\n }\n });\n\n return infos;\n };\n\n components?.forEach((component: any) => {\n const options = replaceTmpUIDs(targetContentType(component));\n\n if (!_.has(component, 'uid')) {\n return builder.createComponent(options);\n }\n\n return builder.editComponent(options);\n });\n\n // generate api skeleton\n await generateAPI({\n displayName: contentType!.displayName || contentType!.info.displayName,\n singularName: contentType!.singularName,\n pluralName: contentType!.pluralName,\n kind: contentType!.kind,\n });\n\n if (!options.defaultBuilder) {\n await builder.writeFiles();\n }\n\n strapi.eventHub.emit('content-type.create', { contentType: newContentType });\n\n return newContentType;\n};\n\n/**\n * Generate an API skeleton\n */\nexport const generateAPI = ({\n singularName,\n kind = 'collectionType',\n pluralName,\n displayName,\n}: any) => {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const strapiGenerators = require('@strapi/generators');\n return strapiGenerators.generate(\n 'content-type',\n {\n kind,\n singularName,\n id: singularName,\n pluralName,\n displayName,\n destination: 'new',\n bootstrapApi: true,\n attributes: [],\n },\n { dir: strapi.dirs.app.root }\n );\n};\n\n/**\n * Edits a contentType and handle the nested contentTypes sent with it\n */\nexport const editContentType = async (\n uid: UID.ContentType,\n { contentType, components = [] }: any\n) => {\n const builder = createBuilder();\n\n const previousSchema = builder.contentTypes.get(uid).schema;\n const previousKind = previousSchema.kind;\n const newKind = contentType.kind || previousKind;\n\n // Restore non-visible attributes from previous schema\n const previousAttributes = previousSchema.attributes;\n const prevNonVisibleAttributes = contentTypesUtils\n .getNonVisibleAttributes(previousSchema)\n .reduce((acc, key) => {\n if (key in previousAttributes) {\n acc[key] = previousAttributes[key];\n }\n\n return acc;\n }, {} as any);\n contentType.attributes = _.merge(prevNonVisibleAttributes, contentType.attributes);\n\n if (newKind !== previousKind && newKind === 'singleType') {\n const entryCount = await strapi.db.query(uid).count();\n if (entryCount > 1) {\n throw new ApplicationError(\n 'You cannot convert a collectionType to a singleType when having multiple entries in DB'\n );\n }\n }\n\n const uidMap = builder.createNewComponentUIDMap(components);\n const replaceTmpUIDs = replaceTemporaryUIDs(uidMap);\n\n const updatedContentType = builder.editContentType({\n uid,\n ...replaceTmpUIDs(contentType),\n });\n\n components.forEach((component: any) => {\n if (!_.has(component, 'uid')) {\n return builder.createComponent(replaceTmpUIDs(component));\n }\n\n return builder.editComponent(replaceTmpUIDs(component));\n });\n\n if (newKind !== previousKind) {\n const apiHandler = strapi.plugin('content-type-builder').service('api-handler');\n await apiHandler.backup(uid);\n\n try {\n await apiHandler.clear(uid);\n\n // generate new api skeleton\n await generateAPI({\n displayName: updatedContentType.schema.info.displayName,\n singularName: updatedContentType.schema.info.singularName,\n pluralName: updatedContentType.schema.info.pluralName,\n kind: updatedContentType.schema.kind,\n });\n\n await builder.writeFiles();\n } catch (error) {\n strapi.log.error(error);\n await apiHandler.rollback(uid);\n }\n\n return updatedContentType;\n }\n\n await builder.writeFiles();\n\n strapi.eventHub.emit('content-type.update', { contentType: updatedContentType });\n\n return updatedContentType;\n};\n\nexport const deleteContentTypes = async (uids: UID.ContentType[]) => {\n const builder = createBuilder();\n const apiHandler = strapi.plugin('content-type-builder').service('api-handler');\n\n for (const uid of uids) {\n await deleteContentType(uid, builder);\n }\n\n await builder.writeFiles();\n for (const uid of uids) {\n try {\n await apiHandler.clear(uid);\n } catch (error) {\n strapi.log.error(error);\n await apiHandler.rollback(uid);\n }\n }\n};\n\n/**\n * Deletes a content type and the api files related to it\n */\nexport const deleteContentType = async (uid: UID.ContentType, defaultBuilder: any = undefined) => {\n const builder = defaultBuilder || createBuilder();\n // make a backup\n const apiHandler = strapi.plugin('content-type-builder').service('api-handler');\n await apiHandler.backup(uid);\n\n const contentType = builder.deleteContentType(uid);\n\n if (!defaultBuilder) {\n try {\n await builder.writeFiles();\n await apiHandler.clear(uid);\n } catch {\n await apiHandler.rollback(uid);\n }\n }\n\n strapi.eventHub.emit('content-type.delete', { contentType });\n\n return contentType;\n};\n"],"names":["ApplicationError","errors","isContentTypeVisible","model","getOr","getRestrictRelationsTo","contentType","uid","coreUids","STRAPI_USER","startsWith","PREFIX","pluginsUids","UPLOAD_FILE","formatContentType","kind","modelName","plugin","collectionName","info","apiID","schema","contentTypesUtils","getOptions","displayName","singularName","pluralName","description","_","get","pluginOptions","attributes","formatAttributes","visible","restrictRelationsTo","createContentTypes","contentTypes","builder","createBuilder","createdContentTypes","push","createContentType","defaultBuilder","writeFiles","components","options","uidMap","createNewComponentUIDMap","replaceTmpUIDs","replaceTemporaryUIDs","newContentType","targetContentType","infos","Object","keys","forEach","key","target","component","has","createComponent","editComponent","generateAPI","strapi","eventHub","emit","strapiGenerators","require","generate","id","destination","bootstrapApi","dir","dirs","app","root","editContentType","previousSchema","previousKind","newKind","previousAttributes","prevNonVisibleAttributes","getNonVisibleAttributes","reduce","acc","merge","entryCount","db","query","count","updatedContentType","apiHandler","service","backup","clear","error","log","rollback","deleteContentTypes","uids","deleteContentType","undefined"],"mappings":";;;;;;;;;;;;;AAQA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,YAAAA;AAEtB,MAAMC,uBAAuB,CAACC,KAAAA,GACnCC,SAAM,IAAA,EAAM,4CAAA,EAA8CD,WAAW;AAEhE,MAAME,yBAAyB,CAACC,WAAAA,GAAAA;IACrC,MAAM,EAAEC,GAAG,EAAE,GAAGD,WAAAA;IAChB,IAAIC,GAAAA,KAAQC,kBAAAA,CAASC,WAAW,EAAE;;QAEhC,OAAO;AAAC,YAAA,QAAA;AAAU,YAAA;AAAU,SAAA;AAC9B,IAAA;AAEA,IAAA,IACEF,GAAAA,CAAIG,UAAU,CAACF,kBAAAA,CAASG,MAAM,CAAA,IAC9BJ,GAAAA,KAAQK,qBAAAA,CAAYC,WAAW,IAC/B,CAACX,oBAAAA,CAAqBI,WAAAA,CAAAA,EACtB;AACA,QAAA,OAAO,EAAE;AACX,IAAA;IAEA,OAAO,IAAA;AACT;AAEA;;IAGO,MAAMQ,iBAAAA,GAAoB,CAACR,WAAAA,GAAAA;AAChC,IAAA,MAAM,EAAEC,GAAG,EAAEQ,IAAI,EAAEC,SAAS,EAAEC,MAAM,EAAEC,cAAc,EAAEC,IAAI,EAAE,GAA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AAAA;AAC5B,QAAA;AACF,IAAA;AAEAwD,IAAAA,MAAAA,CAAOC,QAAQ,CAACC,IAAI,CAAC,qBAAA,EAAuB;AAAE3D,QAAAA;AAAY,KAAA,CAAA;IAE1D,OAAOA,WAAAA;AACT;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"content-types.js","sources":["../../../server/src/services/content-types.ts"],"sourcesContent":["import _ from 'lodash';\nimport { getOr } from 'lodash/fp';\nimport { contentTypes as contentTypesUtils, errors } from '@strapi/utils';\nimport type { UID, Struct } from '@strapi/types';\nimport { formatAttributes, replaceTemporaryUIDs } from '../utils/attributes';\nimport { getService } from '../utils';\nimport createBuilder from './schema-builder';\nimport { finalizeSchemaMutation, rollbackSchemaMutation } from './schema-mutation';\nimport { coreUids, pluginsUids } from './constants';\n\nconst { ApplicationError } = errors;\n\nexport const isCTBOwnedApplicationContentType = (uid: UID.ContentType): boolean =>\n uid.startsWith('api::');\n\nexport const assertCTBOwnedApplicationContentType = (uid: UID.ContentType): void => {\n if (!isCTBOwnedApplicationContentType(uid)) {\n throw new ApplicationError(`Content type \"${uid}\" is not managed by CTB and cannot be deleted`);\n }\n};\n\nconst pruneFolderReferences = (uids: UID.ContentType[]) => {\n return getService('content-structure').commitFromUpdate({ deletedUids: new Set(uids) });\n};\n\nexport const isContentTypeVisible = (model: Struct.ContentTypeSchema) =>\n getOr(true, 'pluginOptions.content-type-builder.visible', model) === true;\n\nexport const getRestrictRelationsTo = (contentType: Struct.ContentTypeSchema) => {\n const { uid } = contentType;\n if (uid === coreUids.STRAPI_USER) {\n // TODO: replace with an obj { relation: 'x', bidirectional: true|false }\n return ['oneWay', 'manyWay'];\n }\n\n if (\n uid.startsWith(coreUids.PREFIX) ||\n uid === pluginsUids.UPLOAD_FILE ||\n !isContentTypeVisible(contentType)\n ) {\n return [];\n }\n\n return null;\n};\n\n/**\n * Format a contentType info to be used by the front-end\n */\nexport const formatContentType = (contentType: any) => {\n const { uid, kind, modelName, plugin, collectionName, info } = contentType;\n\n return {\n uid,\n plugin,\n apiID: modelName,\n schema: {\n ...contentTypesUtils.getOptions(contentType),\n displayName: info.displayName,\n singularName: info.singularName,\n pluralName: info.pluralName,\n description: _.get(info, 'description', ''),\n pluginOptions: contentType.pluginOptions,\n kind: kind || 'collectionType',\n collectionName,\n attributes: formatAttributes(contentType),\n visible: isContentTypeVisible(contentType),\n restrictRelationsTo: getRestrictRelationsTo(contentType),\n },\n };\n};\n\nexport const createContentTypes = async (contentTypes: any[]) => {\n const builder = createBuilder();\n const createdContentTypes: any[] = [];\n const generatedApiNames: string[] = [];\n let schemaAlreadyRolledBack = false;\n\n try {\n for (const contentType of contentTypes) {\n createdContentTypes.push(\n await createContentType(contentType, {\n defaultBuilder: builder,\n generatedApiNames,\n deferEvent: true,\n })\n );\n }\n\n const schemaFilesWritten = await builder.writeFiles();\n if (!schemaFilesWritten) {\n schemaAlreadyRolledBack = true;\n throw new ApplicationError('Invalid schema edition');\n }\n } catch (error) {\n const apiHandler = strapi\n .plugin('content-type-builder')\n .service('api-handler') as typeof import('./api-handler');\n await rollbackSchemaMutation({\n builder,\n apiHandler,\n generatedApiNames,\n schemaAlreadyRolledBack,\n });\n\n throw error;\n }\n\n for (const contentType of createdContentTypes) {\n strapi.eventHub.emit('content-type.create', { contentType });\n }\n\n return createdContentTypes;\n};\n\ntype CreateContentTypeOptions = {\n defaultBuilder?: any; // TODO\n generatedApiNames?: string[];\n deferEvent?: boolean;\n};\n\n/**\n * Creates a content type and handle the nested components sent with it\n */\nexport const createContentType = async (\n { contentType, components }: any,\n options: CreateContentTypeOptions = {}\n) => {\n const builder = options.defaultBuilder || createBuilder();\n const uidMap = builder.createNewComponentUIDMap(components || []);\n\n const replaceTmpUIDs = replaceTemporaryUIDs(uidMap);\n\n const newContentType = builder.createContentType(replaceTmpUIDs(contentType));\n\n // allow components to target the new contentType\n const targetContentType = (infos: any) => {\n Object.keys(infos.attributes).forEach((key) => {\n const { target } = infos.attributes[key];\n if (target === '__contentType__') {\n infos.attributes[key].target = newContentType.uid;\n }\n });\n\n return infos;\n };\n\n components?.forEach((component: any) => {\n const options = replaceTmpUIDs(targetContentType(component));\n\n if (!_.has(component, 'uid')) {\n return builder.createComponent(options);\n }\n\n return builder.editComponent(options);\n });\n\n const generatedApiNames = options.generatedApiNames ?? [];\n let schemaAlreadyRolledBack = false;\n\n try {\n // Generate before writing the schema so a successful mutation retains the existing layout.\n if (!contentType.plugin) {\n generatedApiNames.push(contentType.singularName);\n\n await generateAPI({\n displayName: contentType!.displayName || contentType!.info.displayName,\n singularName: contentType!.singularName,\n pluralName: contentType!.pluralName,\n kind: contentType!.kind,\n });\n }\n\n if (!options.defaultBuilder) {\n const schemaFilesWritten = await builder.writeFiles();\n if (!schemaFilesWritten) {\n schemaAlreadyRolledBack = true;\n throw new ApplicationError('Invalid schema edition');\n }\n }\n } catch (error) {\n if (!options.defaultBuilder) {\n const apiHandler = strapi\n .plugin('content-type-builder')\n .service('api-handler') as typeof import('./api-handler');\n await rollbackSchemaMutation({\n builder,\n apiHandler,\n generatedApiNames,\n schemaAlreadyRolledBack,\n });\n }\n\n throw error;\n }\n\n if (!options.deferEvent) {\n strapi.eventHub.emit('content-type.create', { contentType: newContentType });\n }\n\n return newContentType;\n};\n\n/**\n * Generate an API skeleton\n */\nexport const generateAPI = ({\n singularName,\n kind = 'collectionType',\n pluralName,\n displayName,\n}: any) => {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const strapiGenerators = require('@strapi/generators');\n return strapiGenerators.generate(\n 'content-type',\n {\n kind,\n singularName,\n id: singularName,\n pluralName,\n displayName,\n destination: 'new',\n bootstrapApi: true,\n attributes: [],\n },\n { dir: strapi.dirs.app.root }\n );\n};\n\n/**\n * Edits a contentType and handle the nested contentTypes sent with it\n */\nexport const editContentType = async (\n uid: UID.ContentType,\n { contentType, components = [] }: any\n) => {\n const builder = createBuilder();\n\n const previousSchema = builder.contentTypes.get(uid).schema;\n const isPluginContentType = Boolean(builder.contentTypes.get(uid).plugin);\n const previousKind = previousSchema.kind;\n const newKind = contentType.kind || previousKind;\n\n // Restore non-visible attributes from previous schema\n const previousAttributes = previousSchema.attributes;\n const prevNonVisibleAttributes = contentTypesUtils\n .getNonVisibleAttributes(previousSchema)\n .reduce((acc, key) => {\n if (key in previousAttributes) {\n acc[key] = previousAttributes[key];\n }\n\n return acc;\n }, {} as any);\n contentType.attributes = _.merge(prevNonVisibleAttributes, contentType.attributes);\n\n if (newKind !== previousKind && newKind === 'singleType') {\n const entryCount = await strapi.db.query(uid).count();\n if (entryCount > 1) {\n throw new ApplicationError(\n 'You cannot convert a collectionType to a singleType when having multiple entries in DB'\n );\n }\n }\n\n const uidMap = builder.createNewComponentUIDMap(components);\n const replaceTmpUIDs = replaceTemporaryUIDs(uidMap);\n\n const updatedContentType = builder.editContentType({\n uid,\n ...replaceTmpUIDs(contentType),\n });\n\n components.forEach((component: any) => {\n if (!_.has(component, 'uid')) {\n return builder.createComponent(replaceTmpUIDs(component));\n }\n\n return builder.editComponent(replaceTmpUIDs(component));\n });\n\n if (newKind !== previousKind) {\n let schemaAlreadyRolledBack = false;\n const apiHandler = strapi\n .plugin('content-type-builder')\n .service('api-handler') as typeof import('./api-handler');\n await apiHandler.backup(uid);\n\n try {\n await apiHandler.clear(uid, { preserveBackup: true });\n\n if (!isPluginContentType) {\n // generate new api skeleton\n await generateAPI({\n displayName: updatedContentType.schema.info.displayName,\n singularName: updatedContentType.schema.info.singularName,\n pluralName: updatedContentType.schema.info.pluralName,\n kind: updatedContentType.schema.kind,\n });\n }\n\n const schemaFilesWritten = await builder.writeFiles();\n if (!schemaFilesWritten) {\n schemaAlreadyRolledBack = true;\n throw new ApplicationError('Invalid schema edition');\n }\n await pruneFolderReferences([uid]);\n } catch (error) {\n await rollbackSchemaMutation({\n builder,\n apiHandler,\n backedUpApiUids: [uid],\n schemaAlreadyRolledBack,\n });\n\n throw error;\n }\n\n for (const error of await finalizeSchemaMutation({ apiHandler, backedUpApiUids: [uid] })) {\n strapi.log.error(error);\n }\n\n return updatedContentType;\n }\n\n await builder.writeFiles();\n\n strapi.eventHub.emit('content-type.update', { contentType: updatedContentType });\n\n return updatedContentType;\n};\n\nexport const deleteContentTypes = async (uids: UID.ContentType[]) => {\n uids.forEach(assertCTBOwnedApplicationContentType);\n\n const builder = createBuilder();\n const apiHandler = strapi\n .plugin('content-type-builder')\n .service('api-handler') as typeof import('./api-handler');\n\n const deletedContentTypes: any[] = [];\n const backedUpApiUids: UID.ContentType[] = [];\n let schemaAlreadyRolledBack = false;\n\n try {\n for (const uid of uids) {\n await apiHandler.backup(uid);\n backedUpApiUids.push(uid);\n deletedContentTypes.push(builder.deleteContentType(uid));\n }\n\n const schemaFilesWritten = await builder.writeFiles();\n if (!schemaFilesWritten) {\n schemaAlreadyRolledBack = true;\n throw new ApplicationError('Invalid schema edition');\n }\n\n for (const uid of uids) {\n await apiHandler.clear(uid, { preserveBackup: true });\n }\n\n await pruneFolderReferences(uids);\n } catch (error) {\n await rollbackSchemaMutation({\n builder,\n apiHandler,\n backedUpApiUids,\n schemaAlreadyRolledBack,\n });\n\n throw error;\n }\n\n for (const error of await finalizeSchemaMutation({ apiHandler, backedUpApiUids })) {\n strapi.log.error(error);\n }\n\n for (const contentType of deletedContentTypes) {\n strapi.eventHub.emit('content-type.delete', { contentType });\n }\n};\n\n/**\n * Deletes a content type and the api files related to it\n */\nexport const deleteContentType = async (uid: UID.ContentType, defaultBuilder: any = undefined) => {\n assertCTBOwnedApplicationContentType(uid);\n\n const builder = defaultBuilder || createBuilder();\n // make a backup\n const apiHandler = strapi\n .plugin('content-type-builder')\n .service('api-handler') as typeof import('./api-handler');\n await apiHandler.backup(uid);\n\n let contentType;\n let schemaAlreadyRolledBack = false;\n\n if (!defaultBuilder) {\n try {\n contentType = builder.deleteContentType(uid);\n const schemaFilesWritten = await builder.writeFiles();\n if (!schemaFilesWritten) {\n schemaAlreadyRolledBack = true;\n throw new ApplicationError('Invalid schema edition');\n }\n await apiHandler.clear(uid, { preserveBackup: true });\n await pruneFolderReferences([uid]);\n } catch (error) {\n await rollbackSchemaMutation({\n builder,\n apiHandler,\n backedUpApiUids: [uid],\n schemaAlreadyRolledBack,\n });\n\n throw error;\n }\n\n for (const error of await finalizeSchemaMutation({ apiHandler, backedUpApiUids: [uid] })) {\n strapi.log.error(error);\n }\n } else {\n contentType = builder.deleteContentType(uid);\n }\n\n if (!defaultBuilder) {\n strapi.eventHub.emit('content-type.delete', { contentType });\n }\n\n return contentType;\n};\n"],"names":["ApplicationError","errors","isCTBOwnedApplicationContentType","uid","startsWith","assertCTBOwnedApplicationContentType","pruneFolderReferences","uids","getService","commitFromUpdate","deletedUids","Set","isContentTypeVisible","model","getOr","getRestrictRelationsTo","contentType","coreUids","STRAPI_USER","PREFIX","pluginsUids","UPLOAD_FILE","formatContentType","kind","modelName","plugin","collectionName","info","apiID","schema","contentTypesUtils","getOptions","displayName","singularName","pluralName","description","_","get","pluginOptions","attributes","formatAttributes","visible","restrictRelationsTo","createContentTypes","contentTypes","builder","createBuilder","createdContentTypes","generatedApiNames","schemaAlreadyRolledBack","push","createContentType","defaultBuilder","deferEvent","schemaFilesWritten","writeFiles","error","apiHandler","strapi","service","rollbackSchemaMutation","eventHub","emit","components","options","uidMap","createNewComponentUIDMap","replaceTmpUIDs","replaceTemporaryUIDs","newContentType","targetContentType","infos","Object","keys","forEach","key","target","component","has","createComponent","editComponent","generateAPI","strapiGenerators","require","generate","id","destination","bootstrapApi","dir","dirs","app","root","editContentType","previousSchema","isPluginContentType","Boolean","previousKind","newKind","previousAttributes","prevNonVisibleAttributes","getNonVisibleAttributes","reduce","acc","merge","entryCount","db","query","count","updatedContentType","backup","clear","preserveBackup","backedUpApiUids","finalizeSchemaMutation","log","deleteContentTypes","deletedContentTypes","deleteContentType","undefined"],"mappings":";;;;;;;;;;;;;;;AAUA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,YAAAA;MAEhBC,gCAAAA,GAAmC,CAACC,MAC/CA,GA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