@strapi/content-manager 0.0.0-experimental.cfda358b7f27015e34e739b8742a2962ae2e7aee → 0.0.0-experimental.d3cdf79a0d5f803dfeb6d0f055bb2f3b913bb015
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/{ComponentConfigurationPage-BTR_hQow.js → ComponentConfigurationPage-BSEZcJVB.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-BTR_hQow.js.map → ComponentConfigurationPage-BSEZcJVB.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-bLQr82ce.mjs → ComponentConfigurationPage-BiASGi7x.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-bLQr82ce.mjs.map → ComponentConfigurationPage-BiASGi7x.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-z39Wv3E6.js → EditConfigurationPage-D2rtvneE.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-z39Wv3E6.js.map → EditConfigurationPage-D2rtvneE.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BhRSnUsL.mjs → EditConfigurationPage-vN4zupij.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BhRSnUsL.mjs.map → EditConfigurationPage-vN4zupij.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-wujOq90c.js → EditViewPage-BwisF04Q.js} +3 -3
- package/dist/_chunks/{EditViewPage-wujOq90c.js.map → EditViewPage-BwisF04Q.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-BCjNxNlY.mjs → EditViewPage-_A31Cl4g.mjs} +3 -3
- package/dist/_chunks/{EditViewPage-BCjNxNlY.mjs.map → EditViewPage-_A31Cl4g.mjs.map} +1 -1
- package/dist/_chunks/{Field-Byr3mPTl.mjs → Field-CvIunNOj.mjs} +23 -50
- package/dist/_chunks/Field-CvIunNOj.mjs.map +1 -0
- package/dist/_chunks/{Field-B5QXnctJ.js → Field-Dsu6-FrM.js} +23 -50
- package/dist/_chunks/Field-Dsu6-FrM.js.map +1 -0
- package/dist/_chunks/{Form-BZgvE8C8.mjs → Form-DK0fG0Gj.mjs} +2 -2
- package/dist/_chunks/{Form-BZgvE8C8.mjs.map → Form-DK0fG0Gj.mjs.map} +1 -1
- package/dist/_chunks/{Form-D7mexvm3.js → Form-DUwWcCmA.js} +2 -2
- package/dist/_chunks/{Form-D7mexvm3.js.map → Form-DUwWcCmA.js.map} +1 -1
- package/dist/_chunks/{History-DYl2A8Z_.js → History-CeCDhoJG.js} +4 -4
- package/dist/_chunks/{History-DYl2A8Z_.js.map → History-CeCDhoJG.js.map} +1 -1
- package/dist/_chunks/{History-CqNgxkqK.mjs → History-DP8gmXpm.mjs} +4 -4
- package/dist/_chunks/{History-CqNgxkqK.mjs.map → History-DP8gmXpm.mjs.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-BbQjzKkQ.mjs → ListConfigurationPage-BCkO5iuN.mjs} +2 -2
- package/dist/_chunks/{ListConfigurationPage-BbQjzKkQ.mjs.map → ListConfigurationPage-BCkO5iuN.mjs.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-BXnu_OoY.js → ListConfigurationPage-C-bAd44a.js} +2 -2
- package/dist/_chunks/{ListConfigurationPage-BXnu_OoY.js.map → ListConfigurationPage-C-bAd44a.js.map} +1 -1
- package/dist/_chunks/{ListViewPage-BtSi8C1l.js → ListViewPage-BKTZFhsM.js} +3 -3
- package/dist/_chunks/{ListViewPage-BtSi8C1l.js.map → ListViewPage-BKTZFhsM.js.map} +1 -1
- package/dist/_chunks/{ListViewPage-D4ofkbjR.mjs → ListViewPage-Cf_DgaFV.mjs} +3 -3
- package/dist/_chunks/{ListViewPage-D4ofkbjR.mjs.map → ListViewPage-Cf_DgaFV.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CitJeOq4.js → NoContentTypePage-D3Cm3v3q.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-CitJeOq4.js.map → NoContentTypePage-D3Cm3v3q.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-DyUx5mXh.mjs → NoContentTypePage-nHIyvJcB.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-DyUx5mXh.mjs.map → NoContentTypePage-nHIyvJcB.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DhIiyWkk.mjs → NoPermissionsPage-BALVSJ7x.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DhIiyWkk.mjs.map → NoPermissionsPage-BALVSJ7x.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DzgWz0M-.js → NoPermissionsPage-CChGWBj5.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DzgWz0M-.js.map → NoPermissionsPage-CChGWBj5.js.map} +1 -1
- package/dist/_chunks/{Preview-BaYGJ0nb.mjs → Preview-C4NBzKUV.mjs} +5 -4
- package/dist/_chunks/Preview-C4NBzKUV.mjs.map +1 -0
- package/dist/_chunks/{Preview-DfNx8Ke-.js → Preview-CT28Ckpg.js} +5 -4
- package/dist/_chunks/Preview-CT28Ckpg.js.map +1 -0
- package/dist/_chunks/{Relations-DM2yUTST.mjs → Relations-C8uC89cT.mjs} +3 -3
- package/dist/_chunks/{Relations-DM2yUTST.mjs.map → Relations-C8uC89cT.mjs.map} +1 -1
- package/dist/_chunks/{Relations-DuKCaXrv.js → Relations-CvkPCng_.js} +3 -3
- package/dist/_chunks/{Relations-DuKCaXrv.js.map → Relations-CvkPCng_.js.map} +1 -1
- package/dist/_chunks/{index-BUWEmX8m.js → index-CnX_j5h-.js} +24 -12
- package/dist/_chunks/index-CnX_j5h-.js.map +1 -0
- package/dist/_chunks/{index-DVAIIsOs.mjs → index-Dh2aGTGJ.mjs} +24 -12
- package/dist/_chunks/index-Dh2aGTGJ.mjs.map +1 -0
- package/dist/_chunks/{layout-Bxsv5mP7.mjs → layout-B5qsPihj.mjs} +3 -3
- package/dist/_chunks/{layout-Bxsv5mP7.mjs.map → layout-B5qsPihj.mjs.map} +1 -1
- package/dist/_chunks/{layout-C3fN7Ejz.js → layout-B_qdWGny.js} +3 -3
- package/dist/_chunks/{layout-C3fN7Ejz.js.map → layout-B_qdWGny.js.map} +1 -1
- package/dist/_chunks/{relations-BPZKAoEY.js → relations-ChcieiF5.js} +2 -2
- package/dist/_chunks/{relations-BPZKAoEY.js.map → relations-ChcieiF5.js.map} +1 -1
- package/dist/_chunks/{relations-o3pPhzY4.mjs → relations-DMXpNY-e.mjs} +2 -2
- package/dist/_chunks/{relations-o3pPhzY4.mjs.map → relations-DMXpNY-e.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +77 -63
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +78 -64
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +1 -0
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +3 -2
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/services/document-metadata.d.ts +4 -2
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +3 -2
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
- package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
- package/dist/server/src/services/utils/populate.d.ts +2 -2
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/package.json +6 -7
- package/dist/_chunks/Field-B5QXnctJ.js.map +0 -1
- package/dist/_chunks/Field-Byr3mPTl.mjs.map +0 -1
- package/dist/_chunks/Preview-BaYGJ0nb.mjs.map +0 -1
- package/dist/_chunks/Preview-DfNx8Ke-.js.map +0 -1
- package/dist/_chunks/index-BUWEmX8m.js.map +0 -1
- package/dist/_chunks/index-DVAIIsOs.mjs.map +0 -1
package/dist/server/index.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import strapiUtils, { validateYupSchema, errors, async, contentTypes as contentTypes$1, yup as yup$1, validateYupSchemaSync, policy, traverse, setCreatorFields, isOperatorOfType, relations as relations$1,
|
1
|
+
import strapiUtils, { validateYupSchema, errors, async, contentTypes as contentTypes$1, yup as yup$1, validateYupSchemaSync, policy, traverse, setCreatorFields, isOperatorOfType, relations as relations$1, pagination } from "@strapi/utils";
|
2
2
|
import { pick, omit, difference, castArray, mergeWith, intersection, pipe, propOr, isEqual, isEmpty, set, isNil as isNil$1, has, prop, assoc, mapValues, flow, uniq, uniqBy, concat, getOr, propEq, merge, groupBy } from "lodash/fp";
|
3
3
|
import "@strapi/types";
|
4
4
|
import * as yup from "yup";
|
@@ -3904,6 +3904,12 @@ function getPopulateForRelation(attribute, model, attributeName, { countMany, co
|
|
3904
3904
|
if (initialPopulate) {
|
3905
3905
|
return initialPopulate;
|
3906
3906
|
}
|
3907
|
+
if (attributeName === "localizations") {
|
3908
|
+
const validationPopulate = getPopulateForValidation(model.uid);
|
3909
|
+
return {
|
3910
|
+
populate: validationPopulate.populate
|
3911
|
+
};
|
3912
|
+
}
|
3907
3913
|
if (!isVisibleAttribute$1(model, attributeName)) {
|
3908
3914
|
return true;
|
3909
3915
|
}
|
@@ -3963,6 +3969,9 @@ const getDeepPopulate = (uid2, {
|
|
3963
3969
|
return {};
|
3964
3970
|
}
|
3965
3971
|
const model = strapi.getModel(uid2);
|
3972
|
+
if (!model) {
|
3973
|
+
return {};
|
3974
|
+
}
|
3966
3975
|
return Object.keys(model.attributes).reduce(
|
3967
3976
|
(populateAcc, attributeName) => merge(
|
3968
3977
|
populateAcc,
|
@@ -3982,40 +3991,46 @@ const getDeepPopulate = (uid2, {
|
|
3982
3991
|
{}
|
3983
3992
|
);
|
3984
3993
|
};
|
3985
|
-
const
|
3986
|
-
|
3987
|
-
|
3988
|
-
countOne = false,
|
3989
|
-
maxLevel = Infinity
|
3990
|
-
} = {}, level = 1) => {
|
3991
|
-
if (level > maxLevel) {
|
3994
|
+
const getPopulateForValidation = (uid2) => {
|
3995
|
+
const model = strapi.getModel(uid2);
|
3996
|
+
if (!model) {
|
3992
3997
|
return {};
|
3993
3998
|
}
|
3994
|
-
const model = strapi.getModel(uid2);
|
3995
3999
|
return Object.entries(model.attributes).reduce((populateAcc, [attributeName, attribute]) => {
|
3996
|
-
if (
|
4000
|
+
if (isScalarAttribute(attribute)) {
|
4001
|
+
if (getDoesAttributeRequireValidation(attribute)) {
|
4002
|
+
populateAcc.fields = populateAcc.fields || [];
|
4003
|
+
populateAcc.fields.push(attributeName);
|
4004
|
+
}
|
3997
4005
|
return populateAcc;
|
3998
4006
|
}
|
3999
|
-
if (
|
4000
|
-
|
4001
|
-
|
4002
|
-
|
4007
|
+
if (isComponent(attribute)) {
|
4008
|
+
const component = attribute.component;
|
4009
|
+
const componentResult = getPopulateForValidation(component);
|
4010
|
+
if (Object.keys(componentResult).length > 0) {
|
4011
|
+
populateAcc.populate = populateAcc.populate || {};
|
4012
|
+
populateAcc.populate[attributeName] = componentResult;
|
4013
|
+
}
|
4014
|
+
return populateAcc;
|
4003
4015
|
}
|
4004
|
-
|
4005
|
-
|
4006
|
-
|
4007
|
-
|
4008
|
-
|
4009
|
-
|
4010
|
-
|
4011
|
-
|
4012
|
-
|
4013
|
-
countOne,
|
4014
|
-
maxLevel
|
4016
|
+
if (isDynamicZone(attribute)) {
|
4017
|
+
const components2 = attribute.components;
|
4018
|
+
const componentsResult = (components2 || []).reduce(
|
4019
|
+
(acc, componentUID) => {
|
4020
|
+
const componentResult = getPopulateForValidation(componentUID);
|
4021
|
+
if (Object.keys(componentResult).length > 0) {
|
4022
|
+
acc[componentUID] = componentResult;
|
4023
|
+
}
|
4024
|
+
return acc;
|
4015
4025
|
},
|
4016
|
-
|
4017
|
-
)
|
4018
|
-
|
4026
|
+
{}
|
4027
|
+
);
|
4028
|
+
if (Object.keys(componentsResult).length > 0) {
|
4029
|
+
populateAcc.populate = populateAcc.populate || {};
|
4030
|
+
populateAcc.populate[attributeName] = { on: componentsResult };
|
4031
|
+
}
|
4032
|
+
}
|
4033
|
+
return populateAcc;
|
4019
4034
|
}, {});
|
4020
4035
|
};
|
4021
4036
|
const getDeepPopulateDraftCount = (uid2) => {
|
@@ -4257,7 +4272,6 @@ const AVAILABLE_LOCALES_FIELDS = [
|
|
4257
4272
|
"locale",
|
4258
4273
|
"updatedAt",
|
4259
4274
|
"createdAt",
|
4260
|
-
"status",
|
4261
4275
|
"publishedAt",
|
4262
4276
|
"documentId"
|
4263
4277
|
];
|
@@ -4278,36 +4292,20 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4278
4292
|
/**
|
4279
4293
|
* Returns available locales of a document for the current status
|
4280
4294
|
*/
|
4281
|
-
async getAvailableLocales(uid2, version, allVersions
|
4295
|
+
async getAvailableLocales(uid2, version, allVersions) {
|
4282
4296
|
const versionsByLocale = groupBy("locale", allVersions);
|
4283
4297
|
if (version.locale) {
|
4284
4298
|
delete versionsByLocale[version.locale];
|
4285
4299
|
}
|
4286
4300
|
const model = strapi2.getModel(uid2);
|
4287
|
-
const keysToKeep = [...AVAILABLE_LOCALES_FIELDS, ...validatableFields];
|
4288
|
-
const traversalFunction = async (localeVersion) => traverseEntity(
|
4289
|
-
({ key }, { remove }) => {
|
4290
|
-
if (keysToKeep.includes(key)) {
|
4291
|
-
return;
|
4292
|
-
}
|
4293
|
-
remove(key);
|
4294
|
-
},
|
4295
|
-
{ schema: model, getModel: strapi2.getModel.bind(strapi2) },
|
4296
|
-
// @ts-expect-error fix types DocumentVersion incompatible with Data
|
4297
|
-
localeVersion
|
4298
|
-
);
|
4299
4301
|
const mappingResult = await async.map(
|
4300
4302
|
Object.values(versionsByLocale),
|
4301
4303
|
async (localeVersions) => {
|
4302
|
-
const mappedLocaleVersions = await async.map(
|
4303
|
-
localeVersions,
|
4304
|
-
traversalFunction
|
4305
|
-
);
|
4306
4304
|
if (!contentTypes$1.hasDraftAndPublish(model)) {
|
4307
|
-
return
|
4305
|
+
return localeVersions[0];
|
4308
4306
|
}
|
4309
|
-
const draftVersion =
|
4310
|
-
const otherVersions =
|
4307
|
+
const draftVersion = localeVersions.find((v) => v.publishedAt === null);
|
4308
|
+
const otherVersions = localeVersions.filter((v) => v.id !== draftVersion?.id);
|
4311
4309
|
if (!draftVersion) {
|
4312
4310
|
return;
|
4313
4311
|
}
|
@@ -4341,15 +4339,17 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4341
4339
|
async getManyAvailableStatus(uid2, documents) {
|
4342
4340
|
if (!documents.length) return [];
|
4343
4341
|
const status = documents[0].publishedAt !== null ? "published" : "draft";
|
4344
|
-
const
|
4345
|
-
const
|
4346
|
-
|
4347
|
-
|
4348
|
-
|
4349
|
-
|
4350
|
-
|
4351
|
-
|
4352
|
-
|
4342
|
+
const locales = documents.map((d) => d.locale).filter(Boolean);
|
4343
|
+
const where = {
|
4344
|
+
documentId: { $in: documents.map((d) => d.documentId).filter(Boolean) },
|
4345
|
+
publishedAt: { $null: status === "published" }
|
4346
|
+
};
|
4347
|
+
if (locales.length) {
|
4348
|
+
where.locale = { $in: locales };
|
4349
|
+
}
|
4350
|
+
return strapi2.query(uid2).findMany({
|
4351
|
+
where,
|
4352
|
+
select: ["id", "documentId", "locale", "updatedAt", "createdAt", "publishedAt"]
|
4353
4353
|
});
|
4354
4354
|
},
|
4355
4355
|
getStatus(version, otherDocumentStatuses) {
|
@@ -4375,11 +4375,9 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4375
4375
|
// We could refactor this so the locales are only loaded when they're
|
4376
4376
|
// needed. e.g. in the bulk locale action modal.
|
4377
4377
|
async getMetadata(uid2, version, { availableLocales = true, availableStatus = true } = {}) {
|
4378
|
-
const populate =
|
4379
|
-
const
|
4380
|
-
where: { documentId: version.documentId },
|
4378
|
+
const { populate = {}, fields = [] } = getPopulateForValidation(uid2);
|
4379
|
+
const params = {
|
4381
4380
|
populate: {
|
4382
|
-
// Populate only fields that require validation for bulk locale actions
|
4383
4381
|
...populate,
|
4384
4382
|
// NOTE: creator fields are selected in this way to avoid exposing sensitive data
|
4385
4383
|
createdBy: {
|
@@ -4388,9 +4386,15 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4388
4386
|
updatedBy: {
|
4389
4387
|
select: ["id", "firstname", "lastname", "email"]
|
4390
4388
|
}
|
4389
|
+
},
|
4390
|
+
fields: uniq([...AVAILABLE_LOCALES_FIELDS, ...fields]),
|
4391
|
+
filters: {
|
4392
|
+
documentId: version.documentId
|
4391
4393
|
}
|
4392
|
-
}
|
4393
|
-
const
|
4394
|
+
};
|
4395
|
+
const dbParams = strapi2.get("query-params").transform(uid2, params);
|
4396
|
+
const versions = await strapi2.db.query(uid2).findMany(dbParams);
|
4397
|
+
const availableLocalesResult = availableLocales ? await this.getAvailableLocales(uid2, version, versions) : [];
|
4394
4398
|
const availableStatusResult = availableStatus ? this.getAvailableStatus(version, versions) : null;
|
4395
4399
|
return {
|
4396
4400
|
availableLocales: availableLocalesResult,
|
@@ -4417,6 +4421,16 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4417
4421
|
opts.availableStatus = false;
|
4418
4422
|
}
|
4419
4423
|
const meta = await this.getMetadata(uid2, document, opts);
|
4424
|
+
if (document.localizations) {
|
4425
|
+
const otherStatus = await this.getManyAvailableStatus(uid2, document.localizations);
|
4426
|
+
document.localizations = document.localizations.map((d) => {
|
4427
|
+
const status = otherStatus.find((s) => s.documentId === d.documentId);
|
4428
|
+
return {
|
4429
|
+
...d,
|
4430
|
+
status: this.getStatus(d, status ? [status] : [])
|
4431
|
+
};
|
4432
|
+
});
|
4433
|
+
}
|
4420
4434
|
return {
|
4421
4435
|
data: {
|
4422
4436
|
...document,
|