@strapi/content-manager 0.0.0-experimental.5691f94a497e119f564a7f60ce0830bf4c875eb9 → 0.0.0-experimental.5788c38836be65c0321a2dcadbdf44f04b798e8a
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-D_M8iBw5.js → ComponentConfigurationPage-B42mQr1K.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-D_M8iBw5.js.map → ComponentConfigurationPage-B42mQr1K.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-qemkOlnj.mjs → ComponentConfigurationPage-D1YuKq8j.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-qemkOlnj.mjs.map → ComponentConfigurationPage-D1YuKq8j.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CjUrEewK.mjs → EditConfigurationPage-C9yiwgI_.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CjUrEewK.mjs.map → EditConfigurationPage-C9yiwgI_.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BePwPuHy.js → EditConfigurationPage-NC89F29V.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BePwPuHy.js.map → EditConfigurationPage-NC89F29V.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-B-RJeiJD.js → EditViewPage-DYDpe5Wi.js} +15 -5
- package/dist/_chunks/EditViewPage-DYDpe5Wi.js.map +1 -0
- package/dist/_chunks/{EditViewPage-De8GyU8P.mjs → EditViewPage-k8UcfVwt.mjs} +15 -5
- package/dist/_chunks/EditViewPage-k8UcfVwt.mjs.map +1 -0
- package/dist/_chunks/{Field-pb2o8uBe.mjs → Field-BLL5lknV.mjs} +79 -77
- package/dist/_chunks/Field-BLL5lknV.mjs.map +1 -0
- package/dist/_chunks/{Field-dq8Tg1M_.js → Field-Crhugun2.js} +83 -81
- package/dist/_chunks/Field-Crhugun2.js.map +1 -0
- package/dist/_chunks/{Form-DGIf4jQU.js → Form-DUU19g6M.js} +15 -7
- package/dist/_chunks/Form-DUU19g6M.js.map +1 -0
- package/dist/_chunks/{Form-DJn0Dxha.mjs → Form-UHu2eOuG.mjs} +15 -7
- package/dist/_chunks/Form-UHu2eOuG.mjs.map +1 -0
- package/dist/_chunks/{History-BowL3JKP.mjs → History-CpxkZXS3.mjs} +4 -4
- package/dist/_chunks/{History-BowL3JKP.mjs.map → History-CpxkZXS3.mjs.map} +1 -1
- package/dist/_chunks/{History-Dh2NEHnR.js → History-CyA8tvJZ.js} +4 -4
- package/dist/_chunks/{History-Dh2NEHnR.js.map → History-CyA8tvJZ.js.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-BpVOB-hn.mjs → ListConfigurationPage-OUwV8QF1.mjs} +2 -2
- package/dist/_chunks/{ListConfigurationPage-BpVOB-hn.mjs.map → ListConfigurationPage-OUwV8QF1.mjs.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-BxYCWz9e.js → ListConfigurationPage-pJV7aG2V.js} +2 -2
- package/dist/_chunks/{ListConfigurationPage-BxYCWz9e.js.map → ListConfigurationPage-pJV7aG2V.js.map} +1 -1
- package/dist/_chunks/{ListViewPage-4XsciqHZ.js → ListViewPage-BIT0M8VG.js} +43 -39
- package/dist/_chunks/ListViewPage-BIT0M8VG.js.map +1 -0
- package/dist/_chunks/{ListViewPage-CXFUjZQC.mjs → ListViewPage-BOnhCGkE.mjs} +40 -36
- package/dist/_chunks/ListViewPage-BOnhCGkE.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DuhOTp3x.mjs → NoContentTypePage-CwjlHGTn.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-DuhOTp3x.mjs.map → NoContentTypePage-CwjlHGTn.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-C8OpoHeU.js → NoContentTypePage-uIBsBUmH.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-C8OpoHeU.js.map → NoContentTypePage-uIBsBUmH.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-y_r7DVA2.js → NoPermissionsPage-C8wkEaOF.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-y_r7DVA2.js.map → NoPermissionsPage-C8wkEaOF.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DVz3mzDz.mjs → NoPermissionsPage-CcWbyT_z.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DVz3mzDz.mjs.map → NoPermissionsPage-CcWbyT_z.mjs.map} +1 -1
- package/dist/_chunks/{Relations-DPFCAa7b.js → Relations-CwRu_eZv.js} +32 -23
- package/dist/_chunks/Relations-CwRu_eZv.js.map +1 -0
- package/dist/_chunks/{Relations-CVNLrn1Y.mjs → Relations-wIdWJnA9.mjs} +32 -23
- package/dist/_chunks/Relations-wIdWJnA9.mjs.map +1 -0
- package/dist/_chunks/{en-uOUIxfcQ.js → en-Bm0D0IWz.js} +13 -12
- package/dist/_chunks/{en-uOUIxfcQ.js.map → en-Bm0D0IWz.js.map} +1 -1
- package/dist/_chunks/{en-BrCTWlZv.mjs → en-DKV44jRb.mjs} +13 -12
- package/dist/_chunks/{en-BrCTWlZv.mjs.map → en-DKV44jRb.mjs.map} +1 -1
- package/dist/_chunks/{index-C3fJE-1-.js → index-BO-T2BdP.js} +1862 -1765
- package/dist/_chunks/index-BO-T2BdP.js.map +1 -0
- package/dist/_chunks/{index-DiMrfcfy.mjs → index-BQ8DxaCa.mjs} +1866 -1769
- package/dist/_chunks/index-BQ8DxaCa.mjs.map +1 -0
- package/dist/_chunks/{layout-C788OmNr.js → layout-BTB1_M8g.js} +5 -4
- package/dist/_chunks/{layout-C788OmNr.js.map → layout-BTB1_M8g.js.map} +1 -1
- package/dist/_chunks/{layout-ls3gxfpH.mjs → layout-N63eyE5E.mjs} +5 -4
- package/dist/_chunks/{layout-ls3gxfpH.mjs.map → layout-N63eyE5E.mjs.map} +1 -1
- package/dist/_chunks/{relations-CLcOmGO0.mjs → relations-Bh9r0CVE.mjs} +2 -2
- package/dist/_chunks/{relations-CLcOmGO0.mjs.map → relations-Bh9r0CVE.mjs.map} +1 -1
- package/dist/_chunks/{relations-DYeotliT.js → relations-C9AQuM2z.js} +2 -2
- package/dist/_chunks/{relations-DYeotliT.js.map → relations-C9AQuM2z.js.map} +1 -1
- package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +3 -2
- package/dist/admin/src/exports.d.ts +1 -1
- package/dist/admin/src/hooks/useDocument.d.ts +32 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +0 -32
- package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
- package/dist/admin/src/services/documents.d.ts +3 -1
- package/dist/server/index.js +42 -20
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +42 -20
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +1 -0
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/shared/contracts/collection-types.d.ts +3 -1
- package/dist/shared/contracts/collection-types.d.ts.map +1 -1
- package/package.json +11 -11
- package/dist/_chunks/EditViewPage-B-RJeiJD.js.map +0 -1
- package/dist/_chunks/EditViewPage-De8GyU8P.mjs.map +0 -1
- package/dist/_chunks/Field-dq8Tg1M_.js.map +0 -1
- package/dist/_chunks/Field-pb2o8uBe.mjs.map +0 -1
- package/dist/_chunks/Form-DGIf4jQU.js.map +0 -1
- package/dist/_chunks/Form-DJn0Dxha.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-4XsciqHZ.js.map +0 -1
- package/dist/_chunks/ListViewPage-CXFUjZQC.mjs.map +0 -1
- package/dist/_chunks/Relations-CVNLrn1Y.mjs.map +0 -1
- package/dist/_chunks/Relations-DPFCAa7b.js.map +0 -1
- package/dist/_chunks/index-C3fJE-1-.js.map +0 -1
- package/dist/_chunks/index-DiMrfcfy.mjs.map +0 -1
- package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
- package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
- package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
- package/strapi-server.js +0 -3
package/dist/server/index.mjs
CHANGED
@@ -173,7 +173,9 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
173
173
|
return strapi2.db.query("plugin::upload.file").findOne({ where: { id: versionRelationData.id } });
|
174
174
|
};
|
175
175
|
const localesService = strapi2.plugin("i18n")?.service("locales");
|
176
|
+
const i18nContentTypeService = strapi2.plugin("i18n")?.service("content-types");
|
176
177
|
const getDefaultLocale = async () => localesService ? localesService.getDefaultLocale() : null;
|
178
|
+
const isLocalizedContentType = (model) => i18nContentTypeService ? i18nContentTypeService.isLocalizedContentType(model) : false;
|
177
179
|
const getLocaleDictionary = async () => {
|
178
180
|
if (!localesService)
|
179
181
|
return {};
|
@@ -291,6 +293,7 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
291
293
|
getRelationRestoreValue,
|
292
294
|
getMediaRestoreValue,
|
293
295
|
getDefaultLocale,
|
296
|
+
isLocalizedContentType,
|
294
297
|
getLocaleDictionary,
|
295
298
|
getRetentionDays,
|
296
299
|
getVersionStatus,
|
@@ -313,7 +316,13 @@ const createHistoryService = ({ strapi: strapi2 }) => {
|
|
313
316
|
});
|
314
317
|
},
|
315
318
|
async findVersionsPage(params) {
|
316
|
-
const
|
319
|
+
const model = strapi2.getModel(params.query.contentType);
|
320
|
+
const isLocalizedContentType = serviceUtils.isLocalizedContentType(model);
|
321
|
+
const defaultLocale = await serviceUtils.getDefaultLocale();
|
322
|
+
let locale = null;
|
323
|
+
if (isLocalizedContentType) {
|
324
|
+
locale = params.query.locale || defaultLocale;
|
325
|
+
}
|
317
326
|
const [{ results, pagination: pagination2 }, localeDictionary] = await Promise.all([
|
318
327
|
query.findPage({
|
319
328
|
...params.query,
|
@@ -529,11 +538,13 @@ const createLifecyclesService = ({ strapi: strapi2 }) => {
|
|
529
538
|
}
|
530
539
|
const uid2 = context.contentType.uid;
|
531
540
|
const schemas = getSchemas(uid2);
|
541
|
+
const model = strapi2.getModel(uid2);
|
542
|
+
const isLocalizedContentType = serviceUtils.isLocalizedContentType(model);
|
532
543
|
const localeEntries = await strapi2.db.query(uid2).findMany({
|
533
544
|
where: {
|
534
545
|
documentId,
|
535
|
-
locale: { $in: locales },
|
536
|
-
publishedAt: null
|
546
|
+
...isLocalizedContentType ? { locale: { $in: locales } } : {},
|
547
|
+
...contentTypes$1.hasDraftAndPublish(strapi2.contentTypes[uid2]) ? { publishedAt: null } : {}
|
537
548
|
},
|
538
549
|
populate: serviceUtils.getDeepPopulate(
|
539
550
|
uid2,
|
@@ -1678,7 +1689,7 @@ const updateDocument = async (ctx, opts) => {
|
|
1678
1689
|
throw new errors.ForbiddenError();
|
1679
1690
|
}
|
1680
1691
|
const pickPermittedFields = documentVersion ? permissionChecker2.sanitizeUpdateInput(documentVersion) : permissionChecker2.sanitizeCreateInput;
|
1681
|
-
const setCreator = setCreatorFields({ user, isEdition: true });
|
1692
|
+
const setCreator = documentVersion ? setCreatorFields({ user, isEdition: true }) : setCreatorFields({ user });
|
1682
1693
|
const sanitizeFn = async.pipe(pickPermittedFields, setCreator);
|
1683
1694
|
const sanitizedBody = await sanitizeFn(body);
|
1684
1695
|
return documentManager2.update(documentVersion?.documentId || id, model, {
|
@@ -1750,7 +1761,7 @@ const collectionTypes = {
|
|
1750
1761
|
permissionChecker2,
|
1751
1762
|
model,
|
1752
1763
|
// @ts-expect-error TODO: fix
|
1753
|
-
{ id, locale, publishedAt: null },
|
1764
|
+
{ documentId: id, locale, publishedAt: null },
|
1754
1765
|
{ availableLocales: true, availableStatus: false }
|
1755
1766
|
);
|
1756
1767
|
ctx.body = { data: {}, meta };
|
@@ -1887,11 +1898,17 @@ const collectionTypes = {
|
|
1887
1898
|
}
|
1888
1899
|
const isUpdate = !isCreate;
|
1889
1900
|
if (isUpdate) {
|
1890
|
-
|
1891
|
-
if (!
|
1901
|
+
const documentExists = documentManager2.exists(model, id);
|
1902
|
+
if (!documentExists) {
|
1892
1903
|
throw new errors.NotFoundError("Document not found");
|
1893
1904
|
}
|
1894
|
-
|
1905
|
+
document = await documentManager2.findOne(id, model, { populate, locale });
|
1906
|
+
if (!document) {
|
1907
|
+
if (permissionChecker2.cannot.create({ locale }) || permissionChecker2.cannot.publish({ locale })) {
|
1908
|
+
throw new errors.ForbiddenError();
|
1909
|
+
}
|
1910
|
+
document = await updateDocument(ctx);
|
1911
|
+
} else if (permissionChecker2.can.update(document)) {
|
1895
1912
|
await updateDocument(ctx);
|
1896
1913
|
}
|
1897
1914
|
}
|
@@ -1953,7 +1970,9 @@ const collectionTypes = {
|
|
1953
1970
|
if (permissionChecker2.cannot.unpublish()) {
|
1954
1971
|
return ctx.forbidden();
|
1955
1972
|
}
|
1956
|
-
const { locale } = await getDocumentLocaleAndStatus(body, model
|
1973
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model, {
|
1974
|
+
allowMultipleLocales: true
|
1975
|
+
});
|
1957
1976
|
const entityPromises = documentIds.map(
|
1958
1977
|
(documentId) => documentManager2.findLocales(documentId, model, { locale, isPublished: true })
|
1959
1978
|
);
|
@@ -2343,11 +2362,8 @@ const validateLocale = (sourceUid, targetUid, locale) => {
|
|
2343
2362
|
const isLocalized = strapi.plugin("i18n").service("content-types").isLocalizedContentType;
|
2344
2363
|
const isSourceLocalized = isLocalized(sourceModel);
|
2345
2364
|
const isTargetLocalized = isLocalized(targetModel);
|
2346
|
-
let validatedLocale = locale;
|
2347
|
-
if (!targetModel || !isTargetLocalized)
|
2348
|
-
validatedLocale = void 0;
|
2349
2365
|
return {
|
2350
|
-
locale
|
2366
|
+
locale,
|
2351
2367
|
isSourceLocalized,
|
2352
2368
|
isTargetLocalized
|
2353
2369
|
};
|
@@ -2450,7 +2466,7 @@ const relations = {
|
|
2450
2466
|
attribute,
|
2451
2467
|
fieldsToSelect,
|
2452
2468
|
mainField,
|
2453
|
-
source: { schema: sourceSchema },
|
2469
|
+
source: { schema: sourceSchema, isLocalized: isSourceLocalized },
|
2454
2470
|
target: { schema: targetSchema, isLocalized: isTargetLocalized },
|
2455
2471
|
sourceSchema,
|
2456
2472
|
targetSchema,
|
@@ -2472,7 +2488,8 @@ const relations = {
|
|
2472
2488
|
fieldsToSelect,
|
2473
2489
|
mainField,
|
2474
2490
|
source: {
|
2475
|
-
schema: { uid: sourceUid, modelType: sourceModelType }
|
2491
|
+
schema: { uid: sourceUid, modelType: sourceModelType },
|
2492
|
+
isLocalized: isSourceLocalized
|
2476
2493
|
},
|
2477
2494
|
target: {
|
2478
2495
|
schema: { uid: targetUid },
|
@@ -2510,12 +2527,16 @@ const relations = {
|
|
2510
2527
|
} else {
|
2511
2528
|
where.id = id;
|
2512
2529
|
}
|
2513
|
-
|
2514
|
-
|
2530
|
+
const publishedAt = getPublishedAtClause(status, targetUid);
|
2531
|
+
if (!isEmpty(publishedAt)) {
|
2532
|
+
where[`${alias}.published_at`] = publishedAt;
|
2515
2533
|
}
|
2516
|
-
if (
|
2534
|
+
if (isTargetLocalized && locale) {
|
2517
2535
|
where[`${alias}.locale`] = locale;
|
2518
2536
|
}
|
2537
|
+
if (isSourceLocalized && locale) {
|
2538
|
+
where.locale = locale;
|
2539
|
+
}
|
2519
2540
|
if ((idsToInclude?.length ?? 0) !== 0) {
|
2520
2541
|
where[`${alias}.id`].$notIn = idsToInclude;
|
2521
2542
|
}
|
@@ -2533,7 +2554,8 @@ const relations = {
|
|
2533
2554
|
id: { $notIn: uniq(idsToOmit) }
|
2534
2555
|
});
|
2535
2556
|
}
|
2536
|
-
const
|
2557
|
+
const dbQuery = strapi.get("query-params").transform(targetUid, queryParams);
|
2558
|
+
const res = await strapi.db.query(targetUid).findPage(dbQuery);
|
2537
2559
|
ctx.body = {
|
2538
2560
|
...res,
|
2539
2561
|
results: await addStatusToRelations(targetUid, res.results)
|
@@ -2655,7 +2677,7 @@ const singleTypes = {
|
|
2655
2677
|
permissionChecker2,
|
2656
2678
|
model,
|
2657
2679
|
// @ts-expect-error - fix types
|
2658
|
-
{
|
2680
|
+
{ documentId: document.documentId, locale, publishedAt: null },
|
2659
2681
|
{ availableLocales: true, availableStatus: false }
|
2660
2682
|
);
|
2661
2683
|
ctx.body = { data: {}, meta };
|