@mattisvensson/strapi-plugin-webatlas 0.12.0 → 0.12.2
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/README.md +13 -1
- package/dist/admin/{RoutePicker-h2yWGB6S.mjs → RoutePicker-C6LpgVMi.mjs} +1 -1
- package/dist/admin/{RoutePicker-mEHRtXQ9.js → RoutePicker-DvzQH2CX.js} +1 -1
- package/dist/admin/{SettingTitle-DTXdYICP.mjs → SettingTitle-C1_2epDJ.mjs} +1 -1
- package/dist/admin/{SettingTitle-CBcBCh1h.js → SettingTitle-DXGCUfum.js} +1 -1
- package/dist/admin/{WarningBox-DsBtzhs3.js → WarningBox-BHlYlKQ8.js} +1 -1
- package/dist/admin/{WarningBox-CMQuE_Ov.mjs → WarningBox-CfIVF0O-.mjs} +1 -1
- package/dist/admin/{de-DhwCZE_m.js → de-BWUGdpM0.js} +1 -0
- package/dist/admin/{de-BFjenpyN.mjs → de-Dnk_hvMW.mjs} +1 -0
- package/dist/admin/{en-CGCh9ld_.mjs → en-D5EqZSGy.mjs} +1 -0
- package/dist/admin/{en-C-rPCNd2.js → en-DOk8P6X5.js} +1 -0
- package/dist/admin/{index-Ckaev6xU.mjs → index-CVrufPeL.mjs} +47 -14
- package/dist/admin/{index-GZ_b2eve.js → index-D7zg69uM.js} +3 -3
- package/dist/admin/{index-Do9dOMP-.mjs → index-DC-2-FsX.mjs} +2 -2
- package/dist/admin/{index-BYytQZfK.js → index-DHNPW0YT.js} +47 -14
- package/dist/admin/{index-BZBUZWp1.js → index-Dp_eCRFS.js} +1 -1
- package/dist/admin/{index-aSdHc104.mjs → index-DuSnxRbO.mjs} +3 -3
- package/dist/admin/{index-DuwTQMlZ.mjs → index-Dx4gvFWK.mjs} +2 -2
- package/dist/admin/{index-CaFjiS4j.js → index-FuvoHpAT.js} +2 -2
- package/dist/admin/{index-Bn_SWdWd.js → index-RmZ3LQPu.js} +2 -2
- package/dist/admin/{index-l4-tTCw9.mjs → index-Y4uwBSjP.mjs} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +132 -47
- package/dist/server/index.mjs +132 -47
- package/dist/server/src/index.d.ts +1 -1
- package/package.json +3 -3
package/dist/server/index.js
CHANGED
|
@@ -184,6 +184,7 @@ function buildStructuredNavigation(navigation2, variant = "nested") {
|
|
|
184
184
|
itemsById.set(item.documentId, newItem);
|
|
185
185
|
itemsProcessed.add(item.documentId);
|
|
186
186
|
});
|
|
187
|
+
if (remainingItems.length === itemsToProcess.length) break;
|
|
187
188
|
itemsToProcess = remainingItems;
|
|
188
189
|
}
|
|
189
190
|
const sortedItems = sortItems(rootItems);
|
|
@@ -4671,7 +4672,8 @@ async function enrichWebatlasData(data, contentTypeUid) {
|
|
|
4671
4672
|
}
|
|
4672
4673
|
return ids;
|
|
4673
4674
|
};
|
|
4674
|
-
const
|
|
4675
|
+
const items = Array.isArray(data) ? data : [data];
|
|
4676
|
+
const documentIds = items.flatMap((item) => collectDocumentIds(item, contentTypeUid));
|
|
4675
4677
|
if (documentIds.length === 0) return data;
|
|
4676
4678
|
const uniqueDocumentIds = [...new Set(documentIds)];
|
|
4677
4679
|
const routes2 = await strapi.db?.query(waRoute).findMany({
|
|
@@ -4727,7 +4729,7 @@ async function enrichWebatlasData(data, contentTypeUid) {
|
|
|
4727
4729
|
}
|
|
4728
4730
|
return entity;
|
|
4729
4731
|
};
|
|
4730
|
-
return enrichEntity2(data, contentTypeUid);
|
|
4732
|
+
return Array.isArray(data) ? data.map((item) => enrichEntity2(item, contentTypeUid)) : enrichEntity2(data, contentTypeUid);
|
|
4731
4733
|
}
|
|
4732
4734
|
function isExternalUrl(value) {
|
|
4733
4735
|
return !/^[a-z0-9]+$/.test(value);
|
|
@@ -4789,6 +4791,8 @@ function enrichEntity(entity, uid, routeMap) {
|
|
|
4789
4791
|
`Wrapper route detected in route-picker field '${key}'. Wrapper routes cannot be used as page links. Setting to null.`
|
|
4790
4792
|
);
|
|
4791
4793
|
entity[key] = null;
|
|
4794
|
+
} else if (route2.isUnpublished) {
|
|
4795
|
+
entity[key] = null;
|
|
4792
4796
|
} else {
|
|
4793
4797
|
entity[key] = route2.canonicalPath || route2.path || value;
|
|
4794
4798
|
}
|
|
@@ -4824,20 +4828,36 @@ function enrichEntity(entity, uid, routeMap) {
|
|
|
4824
4828
|
}
|
|
4825
4829
|
return entity;
|
|
4826
4830
|
}
|
|
4827
|
-
async function enrichRoutePickerFields(data, contentTypeUid) {
|
|
4831
|
+
async function enrichRoutePickerFields(data, contentTypeUid, status = "published") {
|
|
4828
4832
|
if (!data || typeof data !== "object") return data;
|
|
4829
|
-
const
|
|
4833
|
+
const items = Array.isArray(data) ? data : [data];
|
|
4834
|
+
const documentIds = items.flatMap((item) => collectRoutePickerIds(item, contentTypeUid));
|
|
4830
4835
|
if (documentIds.length === 0) return data;
|
|
4831
4836
|
const uniqueDocumentIds = [...new Set(documentIds)];
|
|
4832
4837
|
const routes2 = await strapi.db?.query(waRoute).findMany({
|
|
4833
4838
|
where: {
|
|
4834
4839
|
documentId: { $in: uniqueDocumentIds }
|
|
4835
4840
|
},
|
|
4836
|
-
select: [
|
|
4841
|
+
select: [
|
|
4842
|
+
"documentId",
|
|
4843
|
+
"path",
|
|
4844
|
+
"canonicalPath",
|
|
4845
|
+
"type",
|
|
4846
|
+
"relatedContentType",
|
|
4847
|
+
"relatedDocumentId"
|
|
4848
|
+
]
|
|
4837
4849
|
});
|
|
4838
|
-
const
|
|
4839
|
-
const
|
|
4840
|
-
|
|
4850
|
+
const publishedDocumentIds = status === "published" ? await getPublishedDocumentIds(routes2 || []) : null;
|
|
4851
|
+
const routeMap = new Map(
|
|
4852
|
+
routes2?.map((route2) => [
|
|
4853
|
+
route2.documentId,
|
|
4854
|
+
{
|
|
4855
|
+
...route2,
|
|
4856
|
+
isUnpublished: publishedDocumentIds && route2.relatedContentType && !publishedDocumentIds.has(route2.relatedDocumentId)
|
|
4857
|
+
}
|
|
4858
|
+
]) || []
|
|
4859
|
+
);
|
|
4860
|
+
return Array.isArray(data) ? data.map((item) => enrichEntity(item, contentTypeUid, routeMap)) : enrichEntity(data, contentTypeUid, routeMap);
|
|
4841
4861
|
}
|
|
4842
4862
|
function isBlacklistedPath(url, routeBlacklist) {
|
|
4843
4863
|
if (!url) return false;
|
|
@@ -4903,18 +4923,67 @@ function toBreadcrumbEntry(route2) {
|
|
|
4903
4923
|
title: route2.title
|
|
4904
4924
|
};
|
|
4905
4925
|
}
|
|
4906
|
-
async function addWebatlasBreadcrumb(data, route2) {
|
|
4926
|
+
async function addWebatlasBreadcrumb(data, route2, status = "published") {
|
|
4907
4927
|
if (!data?.webatlas || !route2) return data;
|
|
4908
4928
|
const segments = route2.canonicalPath?.split("/").filter(Boolean) || [];
|
|
4909
4929
|
const ancestorPaths = segments.slice(0, -1).map((_, i) => segments.slice(0, i + 1).join("/"));
|
|
4910
4930
|
const ancestors = ancestorPaths.length ? await strapi.db.query(waRoute).findMany({
|
|
4911
4931
|
where: { canonicalPath: { $in: ancestorPaths } },
|
|
4912
|
-
select: [
|
|
4932
|
+
select: [
|
|
4933
|
+
"path",
|
|
4934
|
+
"canonicalPath",
|
|
4935
|
+
"slug",
|
|
4936
|
+
"uidPath",
|
|
4937
|
+
"title",
|
|
4938
|
+
"relatedContentType",
|
|
4939
|
+
"relatedDocumentId"
|
|
4940
|
+
]
|
|
4913
4941
|
}) : [];
|
|
4914
|
-
const
|
|
4942
|
+
const publishedDocumentIds = status === "published" ? await getPublishedDocumentIds(ancestors) : null;
|
|
4943
|
+
const isVisible = (ancestor) => !publishedDocumentIds || !ancestor.relatedContentType || publishedDocumentIds.has(ancestor.relatedDocumentId);
|
|
4944
|
+
const orderedAncestors = ancestorPaths.map((path) => ancestors.find((ancestor) => ancestor.canonicalPath === path)).filter((ancestor) => ancestor && isVisible(ancestor));
|
|
4915
4945
|
data.webatlas.breadcrumb = [...orderedAncestors, route2].map(toBreadcrumbEntry);
|
|
4916
4946
|
return data;
|
|
4917
4947
|
}
|
|
4948
|
+
async function removeUnpublishedNavItems(items) {
|
|
4949
|
+
const publishedDocumentIds = await getPublishedDocumentIds(items.map((item) => item.route));
|
|
4950
|
+
const removedItemIds = new Set(
|
|
4951
|
+
items.filter(
|
|
4952
|
+
({ route: route2 }) => route2?.relatedContentType && !publishedDocumentIds.has(route2.relatedDocumentId)
|
|
4953
|
+
).map((item) => item.documentId)
|
|
4954
|
+
);
|
|
4955
|
+
let foundDescendant = removedItemIds.size > 0;
|
|
4956
|
+
while (foundDescendant) {
|
|
4957
|
+
foundDescendant = false;
|
|
4958
|
+
for (const item of items) {
|
|
4959
|
+
if (item.parent && removedItemIds.has(item.parent.documentId) && !removedItemIds.has(item.documentId)) {
|
|
4960
|
+
removedItemIds.add(item.documentId);
|
|
4961
|
+
foundDescendant = true;
|
|
4962
|
+
}
|
|
4963
|
+
}
|
|
4964
|
+
}
|
|
4965
|
+
return items.filter((item) => !removedItemIds.has(item.documentId));
|
|
4966
|
+
}
|
|
4967
|
+
async function getPublishedDocumentIds(routes2) {
|
|
4968
|
+
const documentIdsByUid = /* @__PURE__ */ new Map();
|
|
4969
|
+
for (const route2 of routes2) {
|
|
4970
|
+
if (!route2?.relatedContentType) continue;
|
|
4971
|
+
const documentIds = documentIdsByUid.get(route2.relatedContentType) ?? [];
|
|
4972
|
+
documentIds.push(route2.relatedDocumentId);
|
|
4973
|
+
documentIdsByUid.set(route2.relatedContentType, documentIds);
|
|
4974
|
+
}
|
|
4975
|
+
const publishedDocumentIds = /* @__PURE__ */ new Set();
|
|
4976
|
+
for (const [uid, documentIds] of documentIdsByUid) {
|
|
4977
|
+
if (!strapi.contentTypes[uid]) continue;
|
|
4978
|
+
const entries = await strapi.documents(uid).findMany({
|
|
4979
|
+
filters: { documentId: { $in: documentIds } },
|
|
4980
|
+
fields: ["documentId"],
|
|
4981
|
+
status: "published"
|
|
4982
|
+
});
|
|
4983
|
+
entries.forEach((entry) => publishedDocumentIds.add(entry.documentId));
|
|
4984
|
+
}
|
|
4985
|
+
return publishedDocumentIds;
|
|
4986
|
+
}
|
|
4918
4987
|
const migration_001_canonical_path = {
|
|
4919
4988
|
version: "001",
|
|
4920
4989
|
description: "Migrate title field to canonicalPath using transformToUrl",
|
|
@@ -5177,11 +5246,17 @@ function documentMiddleware(strapi2, enabledContentTypes, config2) {
|
|
|
5177
5246
|
return next();
|
|
5178
5247
|
}
|
|
5179
5248
|
const ctSettings = config2.selectedContentTypes.find((ct) => ct.uid === context.uid);
|
|
5249
|
+
const requestContext = strapi2.requestContext.get();
|
|
5250
|
+
const isRouteDataAllowed = !requestContext || requestContext.state?.route?.info?.type === "admin";
|
|
5251
|
+
if ((context.action === "create" || context.action === "update") && !isRouteDataAllowed) {
|
|
5252
|
+
delete context.params.data?.webatlas;
|
|
5253
|
+
}
|
|
5180
5254
|
if (context.action === "create") {
|
|
5181
5255
|
const data = context.params.data;
|
|
5182
5256
|
const { webatlas } = data;
|
|
5183
5257
|
const { slug, parentDocumentId, isOverride } = webatlas || {};
|
|
5184
5258
|
const transformedSlug = slug ? transformToUrl(slug, !isOverride) : null;
|
|
5259
|
+
if (!transformedSlug) return next();
|
|
5185
5260
|
let parent = null;
|
|
5186
5261
|
let isValid = false;
|
|
5187
5262
|
if (parentDocumentId) {
|
|
@@ -5210,7 +5285,6 @@ function documentMiddleware(strapi2, enabledContentTypes, config2) {
|
|
|
5210
5285
|
assertPathAllowed(rawPath, routeBlacklist);
|
|
5211
5286
|
assertPathAllowed(canonicalPath, routeBlacklist);
|
|
5212
5287
|
const result2 = await next();
|
|
5213
|
-
if (!transformedSlug) return result2;
|
|
5214
5288
|
const existing = await strapi2.db?.query(waRoute).findOne({
|
|
5215
5289
|
where: { relatedDocumentId: result2.documentId }
|
|
5216
5290
|
});
|
|
@@ -5263,7 +5337,8 @@ function documentMiddleware(strapi2, enabledContentTypes, config2) {
|
|
|
5263
5337
|
let rawPath = transformedSlug;
|
|
5264
5338
|
if (!isOverride) rawPath = parent ? `${parent.path}/${transformedSlug}` : transformedSlug;
|
|
5265
5339
|
const validatedPath = await duplicateCheck(rawPath, relatedRoute?.documentId ?? null);
|
|
5266
|
-
const
|
|
5340
|
+
const sourceValue = ctSettings?.routeSourceField ? context.params.data[ctSettings.routeSourceField]?.trim() : void 0;
|
|
5341
|
+
const title = sourceValue || relatedRoute?.title || slug;
|
|
5267
5342
|
const canonicalPath = isOverride ? relatedRoute.path : await buildCanonicalPath(transformToUrl(title), parent?.documentId);
|
|
5268
5343
|
const routeBlacklist = await getRouteBlacklist();
|
|
5269
5344
|
assertPathAllowed(rawPath, routeBlacklist);
|
|
@@ -5382,15 +5457,7 @@ const addWebatlasField = ({ strapi: strapi2 }) => {
|
|
|
5382
5457
|
if (!contentTypeEntry) return;
|
|
5383
5458
|
const [contentTypeUid] = contentTypeEntry;
|
|
5384
5459
|
if (ctx.body.data) {
|
|
5385
|
-
|
|
5386
|
-
ctx.body.data = await Promise.all(
|
|
5387
|
-
ctx.body.data.map((item) => enrichWebatlasData(item, contentTypeUid))
|
|
5388
|
-
);
|
|
5389
|
-
} else {
|
|
5390
|
-
ctx.body.data = await enrichWebatlasData(ctx.body.data, contentTypeUid);
|
|
5391
|
-
}
|
|
5392
|
-
} else if (Array.isArray(ctx.body)) {
|
|
5393
|
-
ctx.body = await Promise.all(ctx.body.map((item) => enrichWebatlasData(item, contentTypeUid)));
|
|
5460
|
+
ctx.body.data = await enrichWebatlasData(ctx.body.data, contentTypeUid);
|
|
5394
5461
|
} else if (typeof ctx.body === "object") {
|
|
5395
5462
|
ctx.body = await enrichWebatlasData(ctx.body, contentTypeUid);
|
|
5396
5463
|
}
|
|
@@ -5413,20 +5480,11 @@ const enrichRoutePicker = ({ strapi: strapi2 }) => {
|
|
|
5413
5480
|
);
|
|
5414
5481
|
if (!contentTypeEntry) return;
|
|
5415
5482
|
const [contentTypeUid] = contentTypeEntry;
|
|
5483
|
+
const status = ctx.query?.status === "draft" ? "draft" : "published";
|
|
5416
5484
|
if (ctx.body.data) {
|
|
5417
|
-
|
|
5418
|
-
ctx.body.data = await Promise.all(
|
|
5419
|
-
ctx.body.data.map((item) => enrichRoutePickerFields(item, contentTypeUid))
|
|
5420
|
-
);
|
|
5421
|
-
} else {
|
|
5422
|
-
ctx.body.data = await enrichRoutePickerFields(ctx.body.data, contentTypeUid);
|
|
5423
|
-
}
|
|
5424
|
-
} else if (Array.isArray(ctx.body)) {
|
|
5425
|
-
ctx.body = await Promise.all(
|
|
5426
|
-
ctx.body.map((item) => enrichRoutePickerFields(item, contentTypeUid))
|
|
5427
|
-
);
|
|
5485
|
+
ctx.body.data = await enrichRoutePickerFields(ctx.body.data, contentTypeUid, status);
|
|
5428
5486
|
} else if (typeof ctx.body === "object") {
|
|
5429
|
-
ctx.body = await enrichRoutePickerFields(ctx.body, contentTypeUid);
|
|
5487
|
+
ctx.body = await enrichRoutePickerFields(ctx.body, contentTypeUid, status);
|
|
5430
5488
|
}
|
|
5431
5489
|
};
|
|
5432
5490
|
};
|
|
@@ -5739,14 +5797,20 @@ const admin$2 = () => ({
|
|
|
5739
5797
|
const client$2 = ({ strapi: strapi2 }) => ({
|
|
5740
5798
|
async getEntityByPath(ctx) {
|
|
5741
5799
|
const { slug, populate, populateDeepDepth, fields, status, breadcrumb } = ctx.query;
|
|
5742
|
-
if (!slug) throw new utils.errors.ValidationError("Slug is required");
|
|
5800
|
+
if (typeof slug !== "string" || !slug) throw new utils.errors.ValidationError("Slug is required");
|
|
5801
|
+
if (status !== void 0 && status !== "draft" && status !== "published")
|
|
5802
|
+
throw new utils.errors.ValidationError('Status must be "draft" or "published"');
|
|
5803
|
+
const depth = populateDeepDepth === void 0 ? 5 : Number(populateDeepDepth);
|
|
5804
|
+
if (!Number.isInteger(depth) || depth < 1 || depth > 10)
|
|
5805
|
+
throw new utils.errors.ValidationError("populateDeepDepth must be a number between 1 and 10");
|
|
5743
5806
|
const entity = await getClientService().getEntityByPath(
|
|
5744
5807
|
slug,
|
|
5745
5808
|
populate,
|
|
5746
|
-
|
|
5809
|
+
depth,
|
|
5747
5810
|
fields,
|
|
5748
5811
|
status,
|
|
5749
|
-
breadcrumb !== "false"
|
|
5812
|
+
breadcrumb !== "false",
|
|
5813
|
+
ctx.state.auth
|
|
5750
5814
|
);
|
|
5751
5815
|
if (!entity) throw new utils.errors.NotFoundError("Entity not found");
|
|
5752
5816
|
return ctx.send(entity);
|
|
@@ -5755,6 +5819,14 @@ const client$2 = ({ strapi: strapi2 }) => ({
|
|
|
5755
5819
|
const { id, name, slug, documentId, variant } = ctx.query;
|
|
5756
5820
|
if (!id && !name && !slug && !documentId)
|
|
5757
5821
|
throw new utils.errors.ValidationError("Navigation id, name, slug or documentId is required");
|
|
5822
|
+
for (const [key, value] of Object.entries({ id, name, slug, documentId })) {
|
|
5823
|
+
if (value !== void 0 && typeof value !== "string")
|
|
5824
|
+
throw new utils.errors.ValidationError(`Navigation ${key} must be a string`);
|
|
5825
|
+
}
|
|
5826
|
+
if (id !== void 0 && !/^\d+$/.test(id))
|
|
5827
|
+
throw new utils.errors.ValidationError("Navigation id must be a number");
|
|
5828
|
+
if (variant !== void 0 && variant !== "nested" && variant !== "flat")
|
|
5829
|
+
throw new utils.errors.ValidationError('Variant must be "nested" or "flat"');
|
|
5758
5830
|
const navigation2 = await getClientService().getNavigation(id, name, slug, documentId, variant);
|
|
5759
5831
|
if (!navigation2) throw new utils.errors.NotFoundError("Navigation not found");
|
|
5760
5832
|
return ctx.send(navigation2);
|
|
@@ -6194,7 +6266,7 @@ const admin = ({ strapi: strapi2 }) => ({
|
|
|
6194
6266
|
}
|
|
6195
6267
|
});
|
|
6196
6268
|
const client = ({ strapi: strapi2 }) => ({
|
|
6197
|
-
async getEntityByPath(slug, populate, populateDeepDepth, fields, status = "published", breadcrumb = true) {
|
|
6269
|
+
async getEntityByPath(slug, populate, populateDeepDepth, fields, status = "published", breadcrumb = true, auth) {
|
|
6198
6270
|
const route2 = await strapi2.documents(waRoute).findFirst({
|
|
6199
6271
|
filters: {
|
|
6200
6272
|
$or: [{ path: slug }, { canonicalPath: slug }, { uidPath: slug }]
|
|
@@ -6205,12 +6277,10 @@ const client = ({ strapi: strapi2 }) => ({
|
|
|
6205
6277
|
if (populate === "deep") {
|
|
6206
6278
|
const modelObject = getFullPopulateObject(
|
|
6207
6279
|
route2.relatedContentType,
|
|
6208
|
-
|
|
6280
|
+
populateDeepDepth,
|
|
6209
6281
|
[]
|
|
6210
6282
|
);
|
|
6211
|
-
|
|
6212
|
-
populateObject = modelObject.populate;
|
|
6213
|
-
}
|
|
6283
|
+
populateObject = typeof modelObject === "object" && "populate" in modelObject ? modelObject.populate : void 0;
|
|
6214
6284
|
}
|
|
6215
6285
|
const contentTypeObject = Object.entries(strapi2.contentTypes).find(
|
|
6216
6286
|
([key, value]) => key === route2.relatedContentType
|
|
@@ -6219,20 +6289,34 @@ const client = ({ strapi: strapi2 }) => ({
|
|
|
6219
6289
|
return null;
|
|
6220
6290
|
}
|
|
6221
6291
|
const [contentTypeKey, contentType] = contentTypeObject;
|
|
6292
|
+
const action = contentType.kind === "singleType" ? "find" : "findOne";
|
|
6293
|
+
try {
|
|
6294
|
+
await strapi2.auth.verify(auth, { scope: [`${contentTypeKey}.${action}`] });
|
|
6295
|
+
} catch {
|
|
6296
|
+
return null;
|
|
6297
|
+
}
|
|
6298
|
+
await strapi2.contentAPI.validate.query(
|
|
6299
|
+
{ populate: populate === "deep" ? void 0 : populate, fields },
|
|
6300
|
+
contentType,
|
|
6301
|
+
{ auth }
|
|
6302
|
+
);
|
|
6303
|
+
const sanitizedQuery = await strapi2.contentAPI.sanitize.query({ fields }, contentType, { auth });
|
|
6304
|
+
const sanitizedPopulate = populateObject ? await strapi2.contentAPI.sanitize.populate(populateObject, contentType, { auth }) : void 0;
|
|
6222
6305
|
const entity = await strapi2.documents(route2.relatedContentType).findOne({
|
|
6223
6306
|
documentId: route2.relatedDocumentId,
|
|
6224
|
-
populate:
|
|
6225
|
-
fields,
|
|
6307
|
+
populate: sanitizedPopulate,
|
|
6308
|
+
fields: sanitizedQuery.fields,
|
|
6226
6309
|
status
|
|
6227
6310
|
});
|
|
6228
6311
|
if (!entity) return null;
|
|
6229
|
-
|
|
6312
|
+
const sanitizedEntity = await strapi2.contentAPI.sanitize.output(entity, contentType, { auth });
|
|
6313
|
+
let cleanEntity = cleanRootKeys(sanitizedEntity);
|
|
6230
6314
|
cleanEntity = removeWaFields(cleanEntity);
|
|
6231
6315
|
cleanEntity = await enrichWebatlasData(cleanEntity, route2.relatedContentType);
|
|
6232
6316
|
if (breadcrumb) {
|
|
6233
|
-
cleanEntity = await addWebatlasBreadcrumb(cleanEntity, route2);
|
|
6317
|
+
cleanEntity = await addWebatlasBreadcrumb(cleanEntity, route2, status);
|
|
6234
6318
|
}
|
|
6235
|
-
cleanEntity = await enrichRoutePickerFields(cleanEntity, contentTypeKey);
|
|
6319
|
+
cleanEntity = await enrichRoutePickerFields(cleanEntity, contentTypeKey, status);
|
|
6236
6320
|
return {
|
|
6237
6321
|
contentType: contentType.info.singularName,
|
|
6238
6322
|
...cleanEntity
|
|
@@ -6285,6 +6369,7 @@ const client = ({ strapi: strapi2 }) => ({
|
|
|
6285
6369
|
}
|
|
6286
6370
|
}
|
|
6287
6371
|
if (!navigation2) return null;
|
|
6372
|
+
if (navigation2.items) navigation2.items = await removeUnpublishedNavItems(navigation2.items);
|
|
6288
6373
|
const structured = buildStructuredNavigation(navigation2, variant);
|
|
6289
6374
|
if (!structured) return null;
|
|
6290
6375
|
const entityNavigation = extractRouteAndItems(structured.items);
|
package/dist/server/index.mjs
CHANGED
|
@@ -182,6 +182,7 @@ function buildStructuredNavigation(navigation2, variant = "nested") {
|
|
|
182
182
|
itemsById.set(item.documentId, newItem);
|
|
183
183
|
itemsProcessed.add(item.documentId);
|
|
184
184
|
});
|
|
185
|
+
if (remainingItems.length === itemsToProcess.length) break;
|
|
185
186
|
itemsToProcess = remainingItems;
|
|
186
187
|
}
|
|
187
188
|
const sortedItems = sortItems(rootItems);
|
|
@@ -4669,7 +4670,8 @@ async function enrichWebatlasData(data, contentTypeUid) {
|
|
|
4669
4670
|
}
|
|
4670
4671
|
return ids;
|
|
4671
4672
|
};
|
|
4672
|
-
const
|
|
4673
|
+
const items = Array.isArray(data) ? data : [data];
|
|
4674
|
+
const documentIds = items.flatMap((item) => collectDocumentIds(item, contentTypeUid));
|
|
4673
4675
|
if (documentIds.length === 0) return data;
|
|
4674
4676
|
const uniqueDocumentIds = [...new Set(documentIds)];
|
|
4675
4677
|
const routes2 = await strapi.db?.query(waRoute).findMany({
|
|
@@ -4725,7 +4727,7 @@ async function enrichWebatlasData(data, contentTypeUid) {
|
|
|
4725
4727
|
}
|
|
4726
4728
|
return entity;
|
|
4727
4729
|
};
|
|
4728
|
-
return enrichEntity2(data, contentTypeUid);
|
|
4730
|
+
return Array.isArray(data) ? data.map((item) => enrichEntity2(item, contentTypeUid)) : enrichEntity2(data, contentTypeUid);
|
|
4729
4731
|
}
|
|
4730
4732
|
function isExternalUrl(value) {
|
|
4731
4733
|
return !/^[a-z0-9]+$/.test(value);
|
|
@@ -4787,6 +4789,8 @@ function enrichEntity(entity, uid, routeMap) {
|
|
|
4787
4789
|
`Wrapper route detected in route-picker field '${key}'. Wrapper routes cannot be used as page links. Setting to null.`
|
|
4788
4790
|
);
|
|
4789
4791
|
entity[key] = null;
|
|
4792
|
+
} else if (route2.isUnpublished) {
|
|
4793
|
+
entity[key] = null;
|
|
4790
4794
|
} else {
|
|
4791
4795
|
entity[key] = route2.canonicalPath || route2.path || value;
|
|
4792
4796
|
}
|
|
@@ -4822,20 +4826,36 @@ function enrichEntity(entity, uid, routeMap) {
|
|
|
4822
4826
|
}
|
|
4823
4827
|
return entity;
|
|
4824
4828
|
}
|
|
4825
|
-
async function enrichRoutePickerFields(data, contentTypeUid) {
|
|
4829
|
+
async function enrichRoutePickerFields(data, contentTypeUid, status = "published") {
|
|
4826
4830
|
if (!data || typeof data !== "object") return data;
|
|
4827
|
-
const
|
|
4831
|
+
const items = Array.isArray(data) ? data : [data];
|
|
4832
|
+
const documentIds = items.flatMap((item) => collectRoutePickerIds(item, contentTypeUid));
|
|
4828
4833
|
if (documentIds.length === 0) return data;
|
|
4829
4834
|
const uniqueDocumentIds = [...new Set(documentIds)];
|
|
4830
4835
|
const routes2 = await strapi.db?.query(waRoute).findMany({
|
|
4831
4836
|
where: {
|
|
4832
4837
|
documentId: { $in: uniqueDocumentIds }
|
|
4833
4838
|
},
|
|
4834
|
-
select: [
|
|
4839
|
+
select: [
|
|
4840
|
+
"documentId",
|
|
4841
|
+
"path",
|
|
4842
|
+
"canonicalPath",
|
|
4843
|
+
"type",
|
|
4844
|
+
"relatedContentType",
|
|
4845
|
+
"relatedDocumentId"
|
|
4846
|
+
]
|
|
4835
4847
|
});
|
|
4836
|
-
const
|
|
4837
|
-
const
|
|
4838
|
-
|
|
4848
|
+
const publishedDocumentIds = status === "published" ? await getPublishedDocumentIds(routes2 || []) : null;
|
|
4849
|
+
const routeMap = new Map(
|
|
4850
|
+
routes2?.map((route2) => [
|
|
4851
|
+
route2.documentId,
|
|
4852
|
+
{
|
|
4853
|
+
...route2,
|
|
4854
|
+
isUnpublished: publishedDocumentIds && route2.relatedContentType && !publishedDocumentIds.has(route2.relatedDocumentId)
|
|
4855
|
+
}
|
|
4856
|
+
]) || []
|
|
4857
|
+
);
|
|
4858
|
+
return Array.isArray(data) ? data.map((item) => enrichEntity(item, contentTypeUid, routeMap)) : enrichEntity(data, contentTypeUid, routeMap);
|
|
4839
4859
|
}
|
|
4840
4860
|
function isBlacklistedPath(url, routeBlacklist) {
|
|
4841
4861
|
if (!url) return false;
|
|
@@ -4901,18 +4921,67 @@ function toBreadcrumbEntry(route2) {
|
|
|
4901
4921
|
title: route2.title
|
|
4902
4922
|
};
|
|
4903
4923
|
}
|
|
4904
|
-
async function addWebatlasBreadcrumb(data, route2) {
|
|
4924
|
+
async function addWebatlasBreadcrumb(data, route2, status = "published") {
|
|
4905
4925
|
if (!data?.webatlas || !route2) return data;
|
|
4906
4926
|
const segments = route2.canonicalPath?.split("/").filter(Boolean) || [];
|
|
4907
4927
|
const ancestorPaths = segments.slice(0, -1).map((_, i) => segments.slice(0, i + 1).join("/"));
|
|
4908
4928
|
const ancestors = ancestorPaths.length ? await strapi.db.query(waRoute).findMany({
|
|
4909
4929
|
where: { canonicalPath: { $in: ancestorPaths } },
|
|
4910
|
-
select: [
|
|
4930
|
+
select: [
|
|
4931
|
+
"path",
|
|
4932
|
+
"canonicalPath",
|
|
4933
|
+
"slug",
|
|
4934
|
+
"uidPath",
|
|
4935
|
+
"title",
|
|
4936
|
+
"relatedContentType",
|
|
4937
|
+
"relatedDocumentId"
|
|
4938
|
+
]
|
|
4911
4939
|
}) : [];
|
|
4912
|
-
const
|
|
4940
|
+
const publishedDocumentIds = status === "published" ? await getPublishedDocumentIds(ancestors) : null;
|
|
4941
|
+
const isVisible = (ancestor) => !publishedDocumentIds || !ancestor.relatedContentType || publishedDocumentIds.has(ancestor.relatedDocumentId);
|
|
4942
|
+
const orderedAncestors = ancestorPaths.map((path) => ancestors.find((ancestor) => ancestor.canonicalPath === path)).filter((ancestor) => ancestor && isVisible(ancestor));
|
|
4913
4943
|
data.webatlas.breadcrumb = [...orderedAncestors, route2].map(toBreadcrumbEntry);
|
|
4914
4944
|
return data;
|
|
4915
4945
|
}
|
|
4946
|
+
async function removeUnpublishedNavItems(items) {
|
|
4947
|
+
const publishedDocumentIds = await getPublishedDocumentIds(items.map((item) => item.route));
|
|
4948
|
+
const removedItemIds = new Set(
|
|
4949
|
+
items.filter(
|
|
4950
|
+
({ route: route2 }) => route2?.relatedContentType && !publishedDocumentIds.has(route2.relatedDocumentId)
|
|
4951
|
+
).map((item) => item.documentId)
|
|
4952
|
+
);
|
|
4953
|
+
let foundDescendant = removedItemIds.size > 0;
|
|
4954
|
+
while (foundDescendant) {
|
|
4955
|
+
foundDescendant = false;
|
|
4956
|
+
for (const item of items) {
|
|
4957
|
+
if (item.parent && removedItemIds.has(item.parent.documentId) && !removedItemIds.has(item.documentId)) {
|
|
4958
|
+
removedItemIds.add(item.documentId);
|
|
4959
|
+
foundDescendant = true;
|
|
4960
|
+
}
|
|
4961
|
+
}
|
|
4962
|
+
}
|
|
4963
|
+
return items.filter((item) => !removedItemIds.has(item.documentId));
|
|
4964
|
+
}
|
|
4965
|
+
async function getPublishedDocumentIds(routes2) {
|
|
4966
|
+
const documentIdsByUid = /* @__PURE__ */ new Map();
|
|
4967
|
+
for (const route2 of routes2) {
|
|
4968
|
+
if (!route2?.relatedContentType) continue;
|
|
4969
|
+
const documentIds = documentIdsByUid.get(route2.relatedContentType) ?? [];
|
|
4970
|
+
documentIds.push(route2.relatedDocumentId);
|
|
4971
|
+
documentIdsByUid.set(route2.relatedContentType, documentIds);
|
|
4972
|
+
}
|
|
4973
|
+
const publishedDocumentIds = /* @__PURE__ */ new Set();
|
|
4974
|
+
for (const [uid, documentIds] of documentIdsByUid) {
|
|
4975
|
+
if (!strapi.contentTypes[uid]) continue;
|
|
4976
|
+
const entries = await strapi.documents(uid).findMany({
|
|
4977
|
+
filters: { documentId: { $in: documentIds } },
|
|
4978
|
+
fields: ["documentId"],
|
|
4979
|
+
status: "published"
|
|
4980
|
+
});
|
|
4981
|
+
entries.forEach((entry) => publishedDocumentIds.add(entry.documentId));
|
|
4982
|
+
}
|
|
4983
|
+
return publishedDocumentIds;
|
|
4984
|
+
}
|
|
4916
4985
|
const migration_001_canonical_path = {
|
|
4917
4986
|
version: "001",
|
|
4918
4987
|
description: "Migrate title field to canonicalPath using transformToUrl",
|
|
@@ -5175,11 +5244,17 @@ function documentMiddleware(strapi2, enabledContentTypes, config2) {
|
|
|
5175
5244
|
return next();
|
|
5176
5245
|
}
|
|
5177
5246
|
const ctSettings = config2.selectedContentTypes.find((ct) => ct.uid === context.uid);
|
|
5247
|
+
const requestContext = strapi2.requestContext.get();
|
|
5248
|
+
const isRouteDataAllowed = !requestContext || requestContext.state?.route?.info?.type === "admin";
|
|
5249
|
+
if ((context.action === "create" || context.action === "update") && !isRouteDataAllowed) {
|
|
5250
|
+
delete context.params.data?.webatlas;
|
|
5251
|
+
}
|
|
5178
5252
|
if (context.action === "create") {
|
|
5179
5253
|
const data = context.params.data;
|
|
5180
5254
|
const { webatlas } = data;
|
|
5181
5255
|
const { slug, parentDocumentId, isOverride } = webatlas || {};
|
|
5182
5256
|
const transformedSlug = slug ? transformToUrl(slug, !isOverride) : null;
|
|
5257
|
+
if (!transformedSlug) return next();
|
|
5183
5258
|
let parent = null;
|
|
5184
5259
|
let isValid = false;
|
|
5185
5260
|
if (parentDocumentId) {
|
|
@@ -5208,7 +5283,6 @@ function documentMiddleware(strapi2, enabledContentTypes, config2) {
|
|
|
5208
5283
|
assertPathAllowed(rawPath, routeBlacklist);
|
|
5209
5284
|
assertPathAllowed(canonicalPath, routeBlacklist);
|
|
5210
5285
|
const result2 = await next();
|
|
5211
|
-
if (!transformedSlug) return result2;
|
|
5212
5286
|
const existing = await strapi2.db?.query(waRoute).findOne({
|
|
5213
5287
|
where: { relatedDocumentId: result2.documentId }
|
|
5214
5288
|
});
|
|
@@ -5261,7 +5335,8 @@ function documentMiddleware(strapi2, enabledContentTypes, config2) {
|
|
|
5261
5335
|
let rawPath = transformedSlug;
|
|
5262
5336
|
if (!isOverride) rawPath = parent ? `${parent.path}/${transformedSlug}` : transformedSlug;
|
|
5263
5337
|
const validatedPath = await duplicateCheck(rawPath, relatedRoute?.documentId ?? null);
|
|
5264
|
-
const
|
|
5338
|
+
const sourceValue = ctSettings?.routeSourceField ? context.params.data[ctSettings.routeSourceField]?.trim() : void 0;
|
|
5339
|
+
const title = sourceValue || relatedRoute?.title || slug;
|
|
5265
5340
|
const canonicalPath = isOverride ? relatedRoute.path : await buildCanonicalPath(transformToUrl(title), parent?.documentId);
|
|
5266
5341
|
const routeBlacklist = await getRouteBlacklist();
|
|
5267
5342
|
assertPathAllowed(rawPath, routeBlacklist);
|
|
@@ -5380,15 +5455,7 @@ const addWebatlasField = ({ strapi: strapi2 }) => {
|
|
|
5380
5455
|
if (!contentTypeEntry) return;
|
|
5381
5456
|
const [contentTypeUid] = contentTypeEntry;
|
|
5382
5457
|
if (ctx.body.data) {
|
|
5383
|
-
|
|
5384
|
-
ctx.body.data = await Promise.all(
|
|
5385
|
-
ctx.body.data.map((item) => enrichWebatlasData(item, contentTypeUid))
|
|
5386
|
-
);
|
|
5387
|
-
} else {
|
|
5388
|
-
ctx.body.data = await enrichWebatlasData(ctx.body.data, contentTypeUid);
|
|
5389
|
-
}
|
|
5390
|
-
} else if (Array.isArray(ctx.body)) {
|
|
5391
|
-
ctx.body = await Promise.all(ctx.body.map((item) => enrichWebatlasData(item, contentTypeUid)));
|
|
5458
|
+
ctx.body.data = await enrichWebatlasData(ctx.body.data, contentTypeUid);
|
|
5392
5459
|
} else if (typeof ctx.body === "object") {
|
|
5393
5460
|
ctx.body = await enrichWebatlasData(ctx.body, contentTypeUid);
|
|
5394
5461
|
}
|
|
@@ -5411,20 +5478,11 @@ const enrichRoutePicker = ({ strapi: strapi2 }) => {
|
|
|
5411
5478
|
);
|
|
5412
5479
|
if (!contentTypeEntry) return;
|
|
5413
5480
|
const [contentTypeUid] = contentTypeEntry;
|
|
5481
|
+
const status = ctx.query?.status === "draft" ? "draft" : "published";
|
|
5414
5482
|
if (ctx.body.data) {
|
|
5415
|
-
|
|
5416
|
-
ctx.body.data = await Promise.all(
|
|
5417
|
-
ctx.body.data.map((item) => enrichRoutePickerFields(item, contentTypeUid))
|
|
5418
|
-
);
|
|
5419
|
-
} else {
|
|
5420
|
-
ctx.body.data = await enrichRoutePickerFields(ctx.body.data, contentTypeUid);
|
|
5421
|
-
}
|
|
5422
|
-
} else if (Array.isArray(ctx.body)) {
|
|
5423
|
-
ctx.body = await Promise.all(
|
|
5424
|
-
ctx.body.map((item) => enrichRoutePickerFields(item, contentTypeUid))
|
|
5425
|
-
);
|
|
5483
|
+
ctx.body.data = await enrichRoutePickerFields(ctx.body.data, contentTypeUid, status);
|
|
5426
5484
|
} else if (typeof ctx.body === "object") {
|
|
5427
|
-
ctx.body = await enrichRoutePickerFields(ctx.body, contentTypeUid);
|
|
5485
|
+
ctx.body = await enrichRoutePickerFields(ctx.body, contentTypeUid, status);
|
|
5428
5486
|
}
|
|
5429
5487
|
};
|
|
5430
5488
|
};
|
|
@@ -5737,14 +5795,20 @@ const admin$2 = () => ({
|
|
|
5737
5795
|
const client$2 = ({ strapi: strapi2 }) => ({
|
|
5738
5796
|
async getEntityByPath(ctx) {
|
|
5739
5797
|
const { slug, populate, populateDeepDepth, fields, status, breadcrumb } = ctx.query;
|
|
5740
|
-
if (!slug) throw new errors.ValidationError("Slug is required");
|
|
5798
|
+
if (typeof slug !== "string" || !slug) throw new errors.ValidationError("Slug is required");
|
|
5799
|
+
if (status !== void 0 && status !== "draft" && status !== "published")
|
|
5800
|
+
throw new errors.ValidationError('Status must be "draft" or "published"');
|
|
5801
|
+
const depth = populateDeepDepth === void 0 ? 5 : Number(populateDeepDepth);
|
|
5802
|
+
if (!Number.isInteger(depth) || depth < 1 || depth > 10)
|
|
5803
|
+
throw new errors.ValidationError("populateDeepDepth must be a number between 1 and 10");
|
|
5741
5804
|
const entity = await getClientService().getEntityByPath(
|
|
5742
5805
|
slug,
|
|
5743
5806
|
populate,
|
|
5744
|
-
|
|
5807
|
+
depth,
|
|
5745
5808
|
fields,
|
|
5746
5809
|
status,
|
|
5747
|
-
breadcrumb !== "false"
|
|
5810
|
+
breadcrumb !== "false",
|
|
5811
|
+
ctx.state.auth
|
|
5748
5812
|
);
|
|
5749
5813
|
if (!entity) throw new errors.NotFoundError("Entity not found");
|
|
5750
5814
|
return ctx.send(entity);
|
|
@@ -5753,6 +5817,14 @@ const client$2 = ({ strapi: strapi2 }) => ({
|
|
|
5753
5817
|
const { id, name, slug, documentId, variant } = ctx.query;
|
|
5754
5818
|
if (!id && !name && !slug && !documentId)
|
|
5755
5819
|
throw new errors.ValidationError("Navigation id, name, slug or documentId is required");
|
|
5820
|
+
for (const [key, value] of Object.entries({ id, name, slug, documentId })) {
|
|
5821
|
+
if (value !== void 0 && typeof value !== "string")
|
|
5822
|
+
throw new errors.ValidationError(`Navigation ${key} must be a string`);
|
|
5823
|
+
}
|
|
5824
|
+
if (id !== void 0 && !/^\d+$/.test(id))
|
|
5825
|
+
throw new errors.ValidationError("Navigation id must be a number");
|
|
5826
|
+
if (variant !== void 0 && variant !== "nested" && variant !== "flat")
|
|
5827
|
+
throw new errors.ValidationError('Variant must be "nested" or "flat"');
|
|
5756
5828
|
const navigation2 = await getClientService().getNavigation(id, name, slug, documentId, variant);
|
|
5757
5829
|
if (!navigation2) throw new errors.NotFoundError("Navigation not found");
|
|
5758
5830
|
return ctx.send(navigation2);
|
|
@@ -6192,7 +6264,7 @@ const admin = ({ strapi: strapi2 }) => ({
|
|
|
6192
6264
|
}
|
|
6193
6265
|
});
|
|
6194
6266
|
const client = ({ strapi: strapi2 }) => ({
|
|
6195
|
-
async getEntityByPath(slug, populate, populateDeepDepth, fields, status = "published", breadcrumb = true) {
|
|
6267
|
+
async getEntityByPath(slug, populate, populateDeepDepth, fields, status = "published", breadcrumb = true, auth) {
|
|
6196
6268
|
const route2 = await strapi2.documents(waRoute).findFirst({
|
|
6197
6269
|
filters: {
|
|
6198
6270
|
$or: [{ path: slug }, { canonicalPath: slug }, { uidPath: slug }]
|
|
@@ -6203,12 +6275,10 @@ const client = ({ strapi: strapi2 }) => ({
|
|
|
6203
6275
|
if (populate === "deep") {
|
|
6204
6276
|
const modelObject = getFullPopulateObject(
|
|
6205
6277
|
route2.relatedContentType,
|
|
6206
|
-
|
|
6278
|
+
populateDeepDepth,
|
|
6207
6279
|
[]
|
|
6208
6280
|
);
|
|
6209
|
-
|
|
6210
|
-
populateObject = modelObject.populate;
|
|
6211
|
-
}
|
|
6281
|
+
populateObject = typeof modelObject === "object" && "populate" in modelObject ? modelObject.populate : void 0;
|
|
6212
6282
|
}
|
|
6213
6283
|
const contentTypeObject = Object.entries(strapi2.contentTypes).find(
|
|
6214
6284
|
([key, value]) => key === route2.relatedContentType
|
|
@@ -6217,20 +6287,34 @@ const client = ({ strapi: strapi2 }) => ({
|
|
|
6217
6287
|
return null;
|
|
6218
6288
|
}
|
|
6219
6289
|
const [contentTypeKey, contentType] = contentTypeObject;
|
|
6290
|
+
const action = contentType.kind === "singleType" ? "find" : "findOne";
|
|
6291
|
+
try {
|
|
6292
|
+
await strapi2.auth.verify(auth, { scope: [`${contentTypeKey}.${action}`] });
|
|
6293
|
+
} catch {
|
|
6294
|
+
return null;
|
|
6295
|
+
}
|
|
6296
|
+
await strapi2.contentAPI.validate.query(
|
|
6297
|
+
{ populate: populate === "deep" ? void 0 : populate, fields },
|
|
6298
|
+
contentType,
|
|
6299
|
+
{ auth }
|
|
6300
|
+
);
|
|
6301
|
+
const sanitizedQuery = await strapi2.contentAPI.sanitize.query({ fields }, contentType, { auth });
|
|
6302
|
+
const sanitizedPopulate = populateObject ? await strapi2.contentAPI.sanitize.populate(populateObject, contentType, { auth }) : void 0;
|
|
6220
6303
|
const entity = await strapi2.documents(route2.relatedContentType).findOne({
|
|
6221
6304
|
documentId: route2.relatedDocumentId,
|
|
6222
|
-
populate:
|
|
6223
|
-
fields,
|
|
6305
|
+
populate: sanitizedPopulate,
|
|
6306
|
+
fields: sanitizedQuery.fields,
|
|
6224
6307
|
status
|
|
6225
6308
|
});
|
|
6226
6309
|
if (!entity) return null;
|
|
6227
|
-
|
|
6310
|
+
const sanitizedEntity = await strapi2.contentAPI.sanitize.output(entity, contentType, { auth });
|
|
6311
|
+
let cleanEntity = cleanRootKeys(sanitizedEntity);
|
|
6228
6312
|
cleanEntity = removeWaFields(cleanEntity);
|
|
6229
6313
|
cleanEntity = await enrichWebatlasData(cleanEntity, route2.relatedContentType);
|
|
6230
6314
|
if (breadcrumb) {
|
|
6231
|
-
cleanEntity = await addWebatlasBreadcrumb(cleanEntity, route2);
|
|
6315
|
+
cleanEntity = await addWebatlasBreadcrumb(cleanEntity, route2, status);
|
|
6232
6316
|
}
|
|
6233
|
-
cleanEntity = await enrichRoutePickerFields(cleanEntity, contentTypeKey);
|
|
6317
|
+
cleanEntity = await enrichRoutePickerFields(cleanEntity, contentTypeKey, status);
|
|
6234
6318
|
return {
|
|
6235
6319
|
contentType: contentType.info.singularName,
|
|
6236
6320
|
...cleanEntity
|
|
@@ -6283,6 +6367,7 @@ const client = ({ strapi: strapi2 }) => ({
|
|
|
6283
6367
|
}
|
|
6284
6368
|
}
|
|
6285
6369
|
if (!navigation2) return null;
|
|
6370
|
+
if (navigation2.items) navigation2.items = await removeUnpublishedNavItems(navigation2.items);
|
|
6286
6371
|
const structured = buildStructuredNavigation(navigation2, variant);
|
|
6287
6372
|
if (!structured) return null;
|
|
6288
6373
|
const entityNavigation = extractRouteAndItems(structured.items);
|