@strapi/content-manager 0.0.0-experimental.da85533897155e719d784f0271223c866d2f69ab → 0.0.0-experimental.de2b94258659463e5ddc5992e9a9490d66d950dd
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-DyDkPajU.js → ComponentConfigurationPage-CQDCxI8x.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-DyDkPajU.js.map → ComponentConfigurationPage-CQDCxI8x.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-9lRmRdIr.mjs → ComponentConfigurationPage-jmWwucg_.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-9lRmRdIr.mjs.map → ComponentConfigurationPage-jmWwucg_.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DValmA0m.js → EditConfigurationPage-Ce4bIm4n.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-DValmA0m.js.map → EditConfigurationPage-Ce4bIm4n.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-Bk893vVY.mjs → EditConfigurationPage-W07CEdm2.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-Bk893vVY.mjs.map → EditConfigurationPage-W07CEdm2.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-Dk7Eaft4.js → EditViewPage-CqHMM0P0.js} +15 -5
- package/dist/_chunks/EditViewPage-CqHMM0P0.js.map +1 -0
- package/dist/_chunks/{EditViewPage-DiNFdFqP.mjs → EditViewPage-al5OO1NR.mjs} +15 -5
- package/dist/_chunks/EditViewPage-al5OO1NR.mjs.map +1 -0
- package/dist/_chunks/{Field-DH2OaqUP.js → Field-DSOUlTCm.js} +76 -42
- package/dist/_chunks/Field-DSOUlTCm.js.map +1 -0
- package/dist/_chunks/{Field-Dv_HTFTa.mjs → Field-EeG6NQ7x.mjs} +72 -38
- package/dist/_chunks/Field-EeG6NQ7x.mjs.map +1 -0
- package/dist/_chunks/{Form-Dy6P4HgH.mjs → Form-BAo9ANb_.mjs} +16 -8
- package/dist/_chunks/Form-BAo9ANb_.mjs.map +1 -0
- package/dist/_chunks/{Form-B_dUDizM.js → Form-DAEfHKzm.js} +16 -8
- package/dist/_chunks/Form-DAEfHKzm.js.map +1 -0
- package/dist/_chunks/{History-DrwsD1Vc.mjs → History-BpLIu67W.mjs} +24 -11
- package/dist/_chunks/History-BpLIu67W.mjs.map +1 -0
- package/dist/_chunks/{History-BT4w83Oa.js → History-CTFvy6XH.js} +23 -10
- package/dist/_chunks/History-CTFvy6XH.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-CuYrMcW3.js → ListConfigurationPage-CDzlMBz_.js} +2 -2
- package/dist/_chunks/{ListConfigurationPage-CuYrMcW3.js.map → ListConfigurationPage-CDzlMBz_.js.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-BxIP0jRy.mjs → ListConfigurationPage-DOqj5f8Y.mjs} +2 -2
- package/dist/_chunks/{ListConfigurationPage-BxIP0jRy.mjs.map → ListConfigurationPage-DOqj5f8Y.mjs.map} +1 -1
- package/dist/_chunks/{ListViewPage-5a1vw-OK.mjs → ListViewPage-BbXYNI0v.mjs} +24 -12
- package/dist/_chunks/ListViewPage-BbXYNI0v.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-BvpwNur7.js → ListViewPage-D0fpPYKp.js} +28 -16
- package/dist/_chunks/ListViewPage-D0fpPYKp.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-UqEiWKkM.js → NoContentTypePage-DTzkSAV5.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-UqEiWKkM.js.map → NoContentTypePage-DTzkSAV5.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-Bm6tRcd3.mjs → NoContentTypePage-w2Q0VVOT.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-Bm6tRcd3.mjs.map → NoContentTypePage-w2Q0VVOT.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-C_vGRo8Q.js → NoPermissionsPage-BoI2rU68.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-C_vGRo8Q.js.map → NoPermissionsPage-BoI2rU68.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BHPqn_tQ.mjs → NoPermissionsPage-Km0Vk5Wp.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BHPqn_tQ.mjs.map → NoPermissionsPage-Km0Vk5Wp.mjs.map} +1 -1
- package/dist/_chunks/{Relations-C7fPyh5P.mjs → Relations-C_bpmSuQ.mjs} +50 -28
- package/dist/_chunks/Relations-C_bpmSuQ.mjs.map +1 -0
- package/dist/_chunks/{Relations-CznVF6LS.js → Relations-D6Nz5ksc.js} +50 -28
- package/dist/_chunks/Relations-D6Nz5ksc.js.map +1 -0
- package/dist/_chunks/{en-otD_UBJi.js → en-Bm0D0IWz.js} +12 -11
- package/dist/_chunks/{en-otD_UBJi.js.map → en-Bm0D0IWz.js.map} +1 -1
- package/dist/_chunks/{en-CbaIuYoB.mjs → en-DKV44jRb.mjs} +12 -11
- package/dist/_chunks/{en-CbaIuYoB.mjs.map → en-DKV44jRb.mjs.map} +1 -1
- package/dist/_chunks/{index-D9UmmBcM.js → index-BsMu2oVP.js} +2004 -1875
- package/dist/_chunks/index-BsMu2oVP.js.map +1 -0
- package/dist/_chunks/{index-BJ6uTqLL.mjs → index-DcQ6xogO.mjs} +2007 -1879
- package/dist/_chunks/index-DcQ6xogO.mjs.map +1 -0
- package/dist/_chunks/{layout-kfu5Wtix.js → layout-B4aCAdTt.js} +5 -4
- package/dist/_chunks/{layout-kfu5Wtix.js.map → layout-B4aCAdTt.js.map} +1 -1
- package/dist/_chunks/{layout-uomiIGbG.mjs → layout-BavJ6v4B.mjs} +5 -4
- package/dist/_chunks/{layout-uomiIGbG.mjs.map → layout-BavJ6v4B.mjs.map} +1 -1
- package/dist/_chunks/{relations-DiDufGSA.mjs → relations-DMG453Od.mjs} +2 -2
- package/dist/_chunks/{relations-DiDufGSA.mjs.map → relations-DMG453Od.mjs.map} +1 -1
- package/dist/_chunks/{relations-DKENrxko.js → relations-Lrm9nz_m.js} +2 -2
- package/dist/_chunks/{relations-DKENrxko.js.map → relations-Lrm9nz_m.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/Header.d.ts +11 -11
- package/dist/admin/src/services/documents.d.ts +3 -1
- package/dist/server/index.js +74 -32
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +74 -32
- 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/controllers/utils/metadata.d.ts +15 -1
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +4 -4
- package/dist/server/src/services/document-metadata.d.ts +8 -8
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +4 -4
- 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/utils/index.d.ts +2 -0
- package/dist/server/src/utils/index.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 +12 -12
- package/dist/_chunks/EditViewPage-DiNFdFqP.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-Dk7Eaft4.js.map +0 -1
- package/dist/_chunks/Field-DH2OaqUP.js.map +0 -1
- package/dist/_chunks/Field-Dv_HTFTa.mjs.map +0 -1
- package/dist/_chunks/Form-B_dUDizM.js.map +0 -1
- package/dist/_chunks/Form-Dy6P4HgH.mjs.map +0 -1
- package/dist/_chunks/History-BT4w83Oa.js.map +0 -1
- package/dist/_chunks/History-DrwsD1Vc.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-5a1vw-OK.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-BvpwNur7.js.map +0 -1
- package/dist/_chunks/Relations-C7fPyh5P.mjs.map +0 -1
- package/dist/_chunks/Relations-CznVF6LS.js.map +0 -1
- package/dist/_chunks/index-BJ6uTqLL.mjs.map +0 -1
- package/dist/_chunks/index-D9UmmBcM.js.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
@@ -367,7 +367,12 @@ const createHistoryService = ({ strapi: strapi2 }) => {
|
|
367
367
|
if (userToPopulate == null) {
|
368
368
|
return null;
|
369
369
|
}
|
370
|
-
return strapi2.query("admin::user").findOne({
|
370
|
+
return strapi2.query("admin::user").findOne({
|
371
|
+
where: {
|
372
|
+
...userToPopulate.id ? { id: userToPopulate.id } : {},
|
373
|
+
...userToPopulate.documentId ? { documentId: userToPopulate.documentId } : {}
|
374
|
+
}
|
375
|
+
});
|
371
376
|
})
|
372
377
|
);
|
373
378
|
return {
|
@@ -1689,7 +1694,7 @@ const updateDocument = async (ctx, opts) => {
|
|
1689
1694
|
throw new errors.ForbiddenError();
|
1690
1695
|
}
|
1691
1696
|
const pickPermittedFields = documentVersion ? permissionChecker2.sanitizeUpdateInput(documentVersion) : permissionChecker2.sanitizeCreateInput;
|
1692
|
-
const setCreator = setCreatorFields({ user, isEdition: true });
|
1697
|
+
const setCreator = documentVersion ? setCreatorFields({ user, isEdition: true }) : setCreatorFields({ user });
|
1693
1698
|
const sanitizeFn = async.pipe(pickPermittedFields, setCreator);
|
1694
1699
|
const sanitizedBody = await sanitizeFn(body);
|
1695
1700
|
return documentManager2.update(documentVersion?.documentId || id, model, {
|
@@ -1761,7 +1766,7 @@ const collectionTypes = {
|
|
1761
1766
|
permissionChecker2,
|
1762
1767
|
model,
|
1763
1768
|
// @ts-expect-error TODO: fix
|
1764
|
-
{ id, locale, publishedAt: null },
|
1769
|
+
{ documentId: id, locale, publishedAt: null },
|
1765
1770
|
{ availableLocales: true, availableStatus: false }
|
1766
1771
|
);
|
1767
1772
|
ctx.body = { data: {}, meta };
|
@@ -1898,11 +1903,17 @@ const collectionTypes = {
|
|
1898
1903
|
}
|
1899
1904
|
const isUpdate = !isCreate;
|
1900
1905
|
if (isUpdate) {
|
1901
|
-
|
1902
|
-
if (!
|
1906
|
+
const documentExists = documentManager2.exists(model, id);
|
1907
|
+
if (!documentExists) {
|
1903
1908
|
throw new errors.NotFoundError("Document not found");
|
1904
1909
|
}
|
1905
|
-
|
1910
|
+
document = await documentManager2.findOne(id, model, { populate, locale });
|
1911
|
+
if (!document) {
|
1912
|
+
if (permissionChecker2.cannot.create({ locale }) || permissionChecker2.cannot.publish({ locale })) {
|
1913
|
+
throw new errors.ForbiddenError();
|
1914
|
+
}
|
1915
|
+
document = await updateDocument(ctx);
|
1916
|
+
} else if (permissionChecker2.can.update(document)) {
|
1906
1917
|
await updateDocument(ctx);
|
1907
1918
|
}
|
1908
1919
|
}
|
@@ -1964,7 +1975,9 @@ const collectionTypes = {
|
|
1964
1975
|
if (permissionChecker2.cannot.unpublish()) {
|
1965
1976
|
return ctx.forbidden();
|
1966
1977
|
}
|
1967
|
-
const { locale } = await getDocumentLocaleAndStatus(body, model
|
1978
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model, {
|
1979
|
+
allowMultipleLocales: true
|
1980
|
+
});
|
1968
1981
|
const entityPromises = documentIds.map(
|
1969
1982
|
(documentId) => documentManager2.findLocales(documentId, model, { locale, isPublished: true })
|
1970
1983
|
);
|
@@ -2325,15 +2338,27 @@ const sanitizeMainField = (model, mainField, userAbility) => {
|
|
2325
2338
|
}
|
2326
2339
|
return mainField;
|
2327
2340
|
};
|
2328
|
-
const addStatusToRelations = async (
|
2329
|
-
if (!contentTypes$1.hasDraftAndPublish(strapi.
|
2341
|
+
const addStatusToRelations = async (targetUid, relations2) => {
|
2342
|
+
if (!contentTypes$1.hasDraftAndPublish(strapi.getModel(targetUid))) {
|
2330
2343
|
return relations2;
|
2331
2344
|
}
|
2332
2345
|
const documentMetadata2 = getService$1("document-metadata");
|
2333
|
-
|
2346
|
+
if (!relations2.length) {
|
2347
|
+
return relations2;
|
2348
|
+
}
|
2349
|
+
const firstRelation = relations2[0];
|
2350
|
+
const filters = {
|
2351
|
+
documentId: { $in: relations2.map((r) => r.documentId) },
|
2352
|
+
// NOTE: find the "opposite" status
|
2353
|
+
publishedAt: firstRelation.publishedAt !== null ? { $null: true } : { $notNull: true }
|
2354
|
+
};
|
2355
|
+
const availableStatus = await strapi.query(targetUid).findMany({
|
2356
|
+
select: ["id", "documentId", "locale", "updatedAt", "createdAt", "publishedAt"],
|
2357
|
+
filters
|
2358
|
+
});
|
2334
2359
|
return relations2.map((relation) => {
|
2335
|
-
const availableStatuses =
|
2336
|
-
(availableDocument) => availableDocument.documentId === relation.documentId
|
2360
|
+
const availableStatuses = availableStatus.filter(
|
2361
|
+
(availableDocument) => availableDocument.documentId === relation.documentId && (relation.locale ? availableDocument.locale === relation.locale : true)
|
2337
2362
|
);
|
2338
2363
|
return {
|
2339
2364
|
...relation,
|
@@ -2354,11 +2379,8 @@ const validateLocale = (sourceUid, targetUid, locale) => {
|
|
2354
2379
|
const isLocalized = strapi.plugin("i18n").service("content-types").isLocalizedContentType;
|
2355
2380
|
const isSourceLocalized = isLocalized(sourceModel);
|
2356
2381
|
const isTargetLocalized = isLocalized(targetModel);
|
2357
|
-
let validatedLocale = locale;
|
2358
|
-
if (!targetModel || !isTargetLocalized)
|
2359
|
-
validatedLocale = void 0;
|
2360
2382
|
return {
|
2361
|
-
locale
|
2383
|
+
locale,
|
2362
2384
|
isSourceLocalized,
|
2363
2385
|
isTargetLocalized
|
2364
2386
|
};
|
@@ -2461,7 +2483,7 @@ const relations = {
|
|
2461
2483
|
attribute,
|
2462
2484
|
fieldsToSelect,
|
2463
2485
|
mainField,
|
2464
|
-
source: { schema: sourceSchema },
|
2486
|
+
source: { schema: sourceSchema, isLocalized: isSourceLocalized },
|
2465
2487
|
target: { schema: targetSchema, isLocalized: isTargetLocalized },
|
2466
2488
|
sourceSchema,
|
2467
2489
|
targetSchema,
|
@@ -2483,7 +2505,8 @@ const relations = {
|
|
2483
2505
|
fieldsToSelect,
|
2484
2506
|
mainField,
|
2485
2507
|
source: {
|
2486
|
-
schema: { uid: sourceUid, modelType: sourceModelType }
|
2508
|
+
schema: { uid: sourceUid, modelType: sourceModelType },
|
2509
|
+
isLocalized: isSourceLocalized
|
2487
2510
|
},
|
2488
2511
|
target: {
|
2489
2512
|
schema: { uid: targetUid },
|
@@ -2521,12 +2544,16 @@ const relations = {
|
|
2521
2544
|
} else {
|
2522
2545
|
where.id = id;
|
2523
2546
|
}
|
2524
|
-
|
2525
|
-
|
2547
|
+
const publishedAt = getPublishedAtClause(status, targetUid);
|
2548
|
+
if (!isEmpty(publishedAt)) {
|
2549
|
+
where[`${alias}.published_at`] = publishedAt;
|
2526
2550
|
}
|
2527
|
-
if (
|
2551
|
+
if (isTargetLocalized && locale) {
|
2528
2552
|
where[`${alias}.locale`] = locale;
|
2529
2553
|
}
|
2554
|
+
if (isSourceLocalized && locale) {
|
2555
|
+
where.locale = locale;
|
2556
|
+
}
|
2530
2557
|
if ((idsToInclude?.length ?? 0) !== 0) {
|
2531
2558
|
where[`${alias}.id`].$notIn = idsToInclude;
|
2532
2559
|
}
|
@@ -2544,7 +2571,8 @@ const relations = {
|
|
2544
2571
|
id: { $notIn: uniq(idsToOmit) }
|
2545
2572
|
});
|
2546
2573
|
}
|
2547
|
-
const
|
2574
|
+
const dbQuery = strapi.get("query-params").transform(targetUid, queryParams);
|
2575
|
+
const res = await strapi.db.query(targetUid).findPage(dbQuery);
|
2548
2576
|
ctx.body = {
|
2549
2577
|
...res,
|
2550
2578
|
results: await addStatusToRelations(targetUid, res.results)
|
@@ -2559,21 +2587,33 @@ const relations = {
|
|
2559
2587
|
attribute,
|
2560
2588
|
targetField,
|
2561
2589
|
fieldsToSelect,
|
2562
|
-
|
2563
|
-
|
2564
|
-
}
|
2565
|
-
target: {
|
2566
|
-
schema: { uid: targetUid }
|
2567
|
-
}
|
2590
|
+
status,
|
2591
|
+
source: { schema: sourceSchema },
|
2592
|
+
target: { schema: targetSchema }
|
2568
2593
|
} = await this.extractAndValidateRequestInfo(ctx, id);
|
2594
|
+
const { uid: sourceUid } = sourceSchema;
|
2595
|
+
const { uid: targetUid } = targetSchema;
|
2569
2596
|
const permissionQuery = await getService$1("permission-checker").create({ userAbility, model: targetUid }).sanitizedQuery.read({ fields: fieldsToSelect });
|
2570
2597
|
const dbQuery = strapi.db.query(sourceUid);
|
2571
2598
|
const loadRelations = relations$1.isAnyToMany(attribute) ? (...args) => dbQuery.loadPages(...args) : (...args) => dbQuery.load(...args).then((res2) => ({ results: res2 ? [res2] : [] }));
|
2599
|
+
const filters = {};
|
2600
|
+
if (sourceSchema?.options?.draftAndPublish) {
|
2601
|
+
if (targetSchema?.options?.draftAndPublish) {
|
2602
|
+
if (status === "published") {
|
2603
|
+
filters.publishedAt = { $notNull: true };
|
2604
|
+
} else {
|
2605
|
+
filters.publishedAt = { $null: true };
|
2606
|
+
}
|
2607
|
+
}
|
2608
|
+
} else if (targetSchema?.options?.draftAndPublish) {
|
2609
|
+
filters.publishedAt = { $null: true };
|
2610
|
+
}
|
2572
2611
|
const res = await loadRelations({ id: entryId }, targetField, {
|
2573
|
-
select: ["id", "documentId", "locale", "publishedAt"],
|
2612
|
+
select: ["id", "documentId", "locale", "publishedAt", "updatedAt"],
|
2574
2613
|
ordering: "desc",
|
2575
2614
|
page: ctx.request.query.page,
|
2576
|
-
pageSize: ctx.request.query.pageSize
|
2615
|
+
pageSize: ctx.request.query.pageSize,
|
2616
|
+
filters
|
2577
2617
|
});
|
2578
2618
|
const loadedIds = res.results.map((item) => item.id);
|
2579
2619
|
addFiltersClause(permissionQuery, { id: { $in: loadedIds } });
|
@@ -2666,7 +2706,7 @@ const singleTypes = {
|
|
2666
2706
|
permissionChecker2,
|
2667
2707
|
model,
|
2668
2708
|
// @ts-expect-error - fix types
|
2669
|
-
{
|
2709
|
+
{ documentId: document.documentId, locale, publishedAt: null },
|
2670
2710
|
{ availableLocales: true, availableStatus: false }
|
2671
2711
|
);
|
2672
2712
|
ctx.body = { data: {}, meta };
|
@@ -4037,7 +4077,9 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4037
4077
|
*/
|
4038
4078
|
async getAvailableLocales(uid2, version, allVersions, validatableFields = []) {
|
4039
4079
|
const versionsByLocale = groupBy("locale", allVersions);
|
4040
|
-
|
4080
|
+
if (version.locale) {
|
4081
|
+
delete versionsByLocale[version.locale];
|
4082
|
+
}
|
4041
4083
|
const model = strapi2.getModel(uid2);
|
4042
4084
|
const keysToKeep = [...AVAILABLE_LOCALES_FIELDS, ...validatableFields];
|
4043
4085
|
const traversalFunction = async (localeVersion) => traverseEntity(
|