@umbraco-cms/mcp-editor 17.6.0-beta.7 → 17.6.0-beta.8
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/collections.js +170 -134
- package/dist/collections.js.map +1 -1
- package/dist/index.js +171 -135
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/collections.js
CHANGED
|
@@ -141,78 +141,21 @@ async function chainCms(toolName, args) {
|
|
|
141
141
|
}
|
|
142
142
|
return { ok: true, data: extractChainedResult(result) };
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const stripped = stripHtml(text);
|
|
152
|
-
if (!stripped) return 0;
|
|
153
|
-
return stripped.split(/\s+/).filter(Boolean).length;
|
|
154
|
-
}
|
|
155
|
-
function extractTextFromBlockValues(innerValues) {
|
|
156
|
-
const parts = [];
|
|
157
|
-
for (const v of innerValues || []) {
|
|
158
|
-
const text = extractTextFromValue(v.value, v.editorAlias);
|
|
159
|
-
if (text) parts.push(text);
|
|
160
|
-
}
|
|
161
|
-
return parts.join(" ");
|
|
162
|
-
}
|
|
163
|
-
function extractTextFromValue(value, editorAlias) {
|
|
164
|
-
if (typeof value === "string") {
|
|
165
|
-
return stripHtml(value);
|
|
166
|
-
}
|
|
167
|
-
if (value && typeof value === "object" && typeof value.markup === "string") {
|
|
168
|
-
const markupText = stripHtml(value.markup);
|
|
169
|
-
const blockText = extractTextFromContentData(value.blocks?.contentData);
|
|
170
|
-
return [markupText, blockText].filter(Boolean).join(" ");
|
|
171
|
-
}
|
|
172
|
-
if (value && typeof value === "object" && Array.isArray(value.contentData)) {
|
|
173
|
-
return extractTextFromContentData(value.contentData);
|
|
174
|
-
}
|
|
175
|
-
return "";
|
|
176
|
-
}
|
|
177
|
-
function extractTextFromContentData(contentData) {
|
|
178
|
-
const parts = [];
|
|
179
|
-
for (const block of contentData || []) {
|
|
180
|
-
const blockText = extractTextFromBlockValues(block.values || []);
|
|
181
|
-
if (blockText) parts.push(blockText);
|
|
182
|
-
}
|
|
183
|
-
return parts.join(" ");
|
|
184
|
-
}
|
|
185
|
-
function extractTextContent(values) {
|
|
186
|
-
const parts = [];
|
|
187
|
-
for (const v of values || []) {
|
|
188
|
-
const text = extractTextFromValue(v.value, v.editorAlias);
|
|
189
|
-
if (text) parts.push(text);
|
|
190
|
-
}
|
|
191
|
-
return parts.filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
|
|
192
|
-
}
|
|
193
|
-
function extractHeadings(html) {
|
|
194
|
-
const headings = [];
|
|
195
|
-
const regex = /<h([1-6])[^>]*>(.*?)<\/h[1-6]>/gi;
|
|
196
|
-
let match;
|
|
197
|
-
while ((match = regex.exec(html)) !== null) {
|
|
198
|
-
headings.push({ level: parseInt(match[1]), text: stripHtml(match[2]) });
|
|
199
|
-
}
|
|
200
|
-
return headings;
|
|
144
|
+
var DEFAULT_PROVIDER_ALIAS = "umbDocumentUrlProvider";
|
|
145
|
+
var URL_BATCH_CHUNK_SIZE = 40;
|
|
146
|
+
function describeChainError(errorResult) {
|
|
147
|
+
const problem = extractInnerProblemDetails(errorResult);
|
|
148
|
+
const title = typeof problem.title === "string" ? problem.title : void 0;
|
|
149
|
+
const detail = typeof problem.detail === "string" ? problem.detail : void 0;
|
|
150
|
+
return [title, detail].filter(Boolean).join(": ") || "unknown error";
|
|
201
151
|
}
|
|
202
|
-
function
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
while ((match = regex.exec(html)) !== null) {
|
|
207
|
-
const srcMatch = match[0].match(/src="([^"]*)"/i);
|
|
208
|
-
const altMatch = match[0].match(/alt="([^"]*)"/i);
|
|
209
|
-
const src = srcMatch?.[1] ?? "";
|
|
210
|
-
const alt = altMatch?.[1] ?? "";
|
|
211
|
-
images.push({ src, alt, hasAlt: !!altMatch && alt.length > 0 });
|
|
152
|
+
function chunkIds(ids, size) {
|
|
153
|
+
const chunks = [];
|
|
154
|
+
for (let i = 0; i < ids.length; i += size) {
|
|
155
|
+
chunks.push(ids.slice(i, i + size));
|
|
212
156
|
}
|
|
213
|
-
return
|
|
157
|
+
return chunks;
|
|
214
158
|
}
|
|
215
|
-
var DEFAULT_PROVIDER_ALIAS = "umbDocumentUrlProvider";
|
|
216
159
|
var cachedBaseUrl = null;
|
|
217
160
|
var cachedMtimeMs = null;
|
|
218
161
|
function readBaseUrlFromEnvFile(envPath) {
|
|
@@ -318,26 +261,131 @@ function flattenPublishedUrls(urls) {
|
|
|
318
261
|
async function fetchPublishedUrls(id) {
|
|
319
262
|
try {
|
|
320
263
|
const result = await chainCms("get-document-urls", { id: [id] });
|
|
321
|
-
if (!result.ok)
|
|
264
|
+
if (!result.ok) {
|
|
265
|
+
console.warn(
|
|
266
|
+
`fetchPublishedUrls: get-document-urls failed for id ${id} \u2014 returning no published URLs: ${describeChainError(result.errorResult)}`
|
|
267
|
+
);
|
|
268
|
+
return [];
|
|
269
|
+
}
|
|
322
270
|
return flattenPublishedUrls(result.data.items);
|
|
323
|
-
} catch {
|
|
271
|
+
} catch (error) {
|
|
272
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
273
|
+
console.warn(
|
|
274
|
+
`fetchPublishedUrls: unexpected error fetching published URLs for id ${id} \u2014 returning no published URLs: ${message}`
|
|
275
|
+
);
|
|
324
276
|
return [];
|
|
325
277
|
}
|
|
326
278
|
}
|
|
327
279
|
async function fetchPublishedUrlsBatch(ids) {
|
|
328
280
|
const out = /* @__PURE__ */ new Map();
|
|
329
281
|
if (ids.length === 0) return out;
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
282
|
+
for (const idChunk of chunkIds(ids, URL_BATCH_CHUNK_SIZE)) {
|
|
283
|
+
try {
|
|
284
|
+
const result = await chainCms("get-document-urls", { id: idChunk });
|
|
285
|
+
if (!result.ok) {
|
|
286
|
+
console.warn(
|
|
287
|
+
`fetchPublishedUrlsBatch: get-document-urls failed for a chunk of ${idChunk.length} ids \u2014 those ids will have no published URL: ${describeChainError(result.errorResult)}`
|
|
288
|
+
);
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
for (const entry of result.data.items ?? []) {
|
|
292
|
+
if (!entry?.id) continue;
|
|
293
|
+
out.set(entry.id, flattenPublishedUrls([entry]));
|
|
294
|
+
}
|
|
295
|
+
} catch (error) {
|
|
296
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
297
|
+
console.warn(
|
|
298
|
+
`fetchPublishedUrlsBatch: unexpected error processing a chunk of ${idChunk.length} ids \u2014 those ids will have no published URL: ${message}`
|
|
299
|
+
);
|
|
336
300
|
}
|
|
337
|
-
} catch {
|
|
338
301
|
}
|
|
339
302
|
return out;
|
|
340
303
|
}
|
|
304
|
+
async function fetchPrimaryPublishedUrl(id) {
|
|
305
|
+
const urls = await fetchPublishedUrls(id);
|
|
306
|
+
return urls[0] ?? "";
|
|
307
|
+
}
|
|
308
|
+
async function fetchPrimaryPublishedUrlsBatch(ids) {
|
|
309
|
+
const batch = await fetchPublishedUrlsBatch(ids);
|
|
310
|
+
const out = /* @__PURE__ */ new Map();
|
|
311
|
+
for (const id of ids) {
|
|
312
|
+
out.set(id, batch.get(id)?.[0] ?? "");
|
|
313
|
+
}
|
|
314
|
+
return out;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// src/umbraco-api/tools/helpers/tree-walker.ts
|
|
318
|
+
function buildChainedCursor(skip, take) {
|
|
319
|
+
return encodeCursor({ s: skip, t: take });
|
|
320
|
+
}
|
|
321
|
+
function stripHtml(html) {
|
|
322
|
+
return (html || "").replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
323
|
+
}
|
|
324
|
+
function countWords(text) {
|
|
325
|
+
const stripped = stripHtml(text);
|
|
326
|
+
if (!stripped) return 0;
|
|
327
|
+
return stripped.split(/\s+/).filter(Boolean).length;
|
|
328
|
+
}
|
|
329
|
+
function extractTextFromBlockValues(innerValues) {
|
|
330
|
+
const parts = [];
|
|
331
|
+
for (const v of innerValues || []) {
|
|
332
|
+
const text = extractTextFromValue(v.value, v.editorAlias);
|
|
333
|
+
if (text) parts.push(text);
|
|
334
|
+
}
|
|
335
|
+
return parts.join(" ");
|
|
336
|
+
}
|
|
337
|
+
function extractTextFromValue(value, editorAlias) {
|
|
338
|
+
if (typeof value === "string") {
|
|
339
|
+
return stripHtml(value);
|
|
340
|
+
}
|
|
341
|
+
if (value && typeof value === "object" && typeof value.markup === "string") {
|
|
342
|
+
const markupText = stripHtml(value.markup);
|
|
343
|
+
const blockText = extractTextFromContentData(value.blocks?.contentData);
|
|
344
|
+
return [markupText, blockText].filter(Boolean).join(" ");
|
|
345
|
+
}
|
|
346
|
+
if (value && typeof value === "object" && Array.isArray(value.contentData)) {
|
|
347
|
+
return extractTextFromContentData(value.contentData);
|
|
348
|
+
}
|
|
349
|
+
return "";
|
|
350
|
+
}
|
|
351
|
+
function extractTextFromContentData(contentData) {
|
|
352
|
+
const parts = [];
|
|
353
|
+
for (const block of contentData || []) {
|
|
354
|
+
const blockText = extractTextFromBlockValues(block.values || []);
|
|
355
|
+
if (blockText) parts.push(blockText);
|
|
356
|
+
}
|
|
357
|
+
return parts.join(" ");
|
|
358
|
+
}
|
|
359
|
+
function extractTextContent(values) {
|
|
360
|
+
const parts = [];
|
|
361
|
+
for (const v of values || []) {
|
|
362
|
+
const text = extractTextFromValue(v.value, v.editorAlias);
|
|
363
|
+
if (text) parts.push(text);
|
|
364
|
+
}
|
|
365
|
+
return parts.filter(Boolean).join(" ").replace(/\s+/g, " ").trim();
|
|
366
|
+
}
|
|
367
|
+
function extractHeadings(html) {
|
|
368
|
+
const headings = [];
|
|
369
|
+
const regex = /<h([1-6])[^>]*>(.*?)<\/h[1-6]>/gi;
|
|
370
|
+
let match;
|
|
371
|
+
while ((match = regex.exec(html)) !== null) {
|
|
372
|
+
headings.push({ level: parseInt(match[1]), text: stripHtml(match[2]) });
|
|
373
|
+
}
|
|
374
|
+
return headings;
|
|
375
|
+
}
|
|
376
|
+
function extractImages(html) {
|
|
377
|
+
const images = [];
|
|
378
|
+
const regex = /<img[^>]*>/gi;
|
|
379
|
+
let match;
|
|
380
|
+
while ((match = regex.exec(html)) !== null) {
|
|
381
|
+
const srcMatch = match[0].match(/src="([^"]*)"/i);
|
|
382
|
+
const altMatch = match[0].match(/alt="([^"]*)"/i);
|
|
383
|
+
const src = srcMatch?.[1] ?? "";
|
|
384
|
+
const alt = altMatch?.[1] ?? "";
|
|
385
|
+
images.push({ src, alt, hasAlt: !!altMatch && alt.length > 0 });
|
|
386
|
+
}
|
|
387
|
+
return images;
|
|
388
|
+
}
|
|
341
389
|
|
|
342
390
|
// src/umbraco-api/tools/content/get/search-content.ts
|
|
343
391
|
var inputSchema = {
|
|
@@ -356,7 +404,7 @@ var outputSchema = z.object({
|
|
|
356
404
|
});
|
|
357
405
|
var tool = {
|
|
358
406
|
name: "search-content",
|
|
359
|
-
description: "Search for content pages by name or
|
|
407
|
+
description: "Search for content pages by name only \u2014 it does not match body text or other field values (tracked in #234). Returns a list of matching pages with their names and IDs. For body text, use list-children + get-page instead. Use get-page with an ID from the results to retrieve full page content.",
|
|
360
408
|
inputSchema,
|
|
361
409
|
outputSchema,
|
|
362
410
|
slices: ["search"],
|
|
@@ -432,8 +480,10 @@ var tool2 = {
|
|
|
432
480
|
})),
|
|
433
481
|
variants: doc.variants ?? [],
|
|
434
482
|
previewUrl: buildPreviewUrl(doc.id),
|
|
435
|
-
//
|
|
436
|
-
|
|
483
|
+
// The get-document-by-id response doesn't carry `urls` — published
|
|
484
|
+
// URLs come only from the separate get-document-urls endpoint via
|
|
485
|
+
// fetchPublishedUrls.
|
|
486
|
+
publishedUrls: await fetchPublishedUrls(id)
|
|
437
487
|
});
|
|
438
488
|
}
|
|
439
489
|
};
|
|
@@ -4730,11 +4780,11 @@ var tool64 = {
|
|
|
4730
4780
|
const headings = extractHeadings(allHtml);
|
|
4731
4781
|
const images = extractImages(allHtml);
|
|
4732
4782
|
const bodyWordCount = countWords(extractTextContent(values));
|
|
4733
|
-
const
|
|
4783
|
+
const url = await fetchPrimaryPublishedUrl(id);
|
|
4734
4784
|
return createToolResult({
|
|
4735
4785
|
id: doc.id,
|
|
4736
4786
|
name: variant?.name ?? "Unknown",
|
|
4737
|
-
url
|
|
4787
|
+
url,
|
|
4738
4788
|
hasTitle: title.length > 0,
|
|
4739
4789
|
hasMetaDescription: metaDescription.length > 0,
|
|
4740
4790
|
titleLength: title.length,
|
|
@@ -4793,12 +4843,12 @@ var tool65 = {
|
|
|
4793
4843
|
const fullBodyText = extractTextContent(values);
|
|
4794
4844
|
const bodyContent = fullBodyText.slice(0, BODY_CONTENT_MAX);
|
|
4795
4845
|
const wordCount = fullBodyText ? fullBodyText.split(/\s+/).filter(Boolean).length : 0;
|
|
4796
|
-
const extra = doc;
|
|
4797
4846
|
const dt = doc.documentType;
|
|
4847
|
+
const url = await fetchPrimaryPublishedUrl(id);
|
|
4798
4848
|
return createToolResult({
|
|
4799
4849
|
id: doc.id,
|
|
4800
4850
|
name: variant?.name ?? "Unknown",
|
|
4801
|
-
url
|
|
4851
|
+
url,
|
|
4802
4852
|
hasMetaDescription: metaDescription.length > 0,
|
|
4803
4853
|
bodyWordCount: wordCount,
|
|
4804
4854
|
metaDescription,
|
|
@@ -4849,6 +4899,9 @@ async function fetchTreeLevel(parentId, depth) {
|
|
|
4849
4899
|
}
|
|
4850
4900
|
async function buildTreeNodes(parentId, depth, maxDepth, pagesPerLevel, totalRef, maxDepthRef) {
|
|
4851
4901
|
const items = await fetchTreeLevel(parentId);
|
|
4902
|
+
const urlsById = await fetchPrimaryPublishedUrlsBatch(
|
|
4903
|
+
items.map((item) => item.id).filter((id) => typeof id === "string")
|
|
4904
|
+
);
|
|
4852
4905
|
const nodes = [];
|
|
4853
4906
|
for (const item of items) {
|
|
4854
4907
|
totalRef.count++;
|
|
@@ -4864,7 +4917,7 @@ async function buildTreeNodes(parentId, depth, maxDepth, pagesPerLevel, totalRef
|
|
|
4864
4917
|
nodes.push({
|
|
4865
4918
|
id: item.id ?? "",
|
|
4866
4919
|
name: item.name ?? item.variants?.[0]?.name ?? "Unknown",
|
|
4867
|
-
url:
|
|
4920
|
+
url: urlsById.get(item.id) ?? "",
|
|
4868
4921
|
documentType: item.documentType?.name ?? item.contentTypeName ?? "",
|
|
4869
4922
|
depth,
|
|
4870
4923
|
childCount: children.length,
|
|
@@ -4932,6 +4985,9 @@ var tool67 = {
|
|
|
4932
4985
|
if (!result.ok) return;
|
|
4933
4986
|
const data = result.data;
|
|
4934
4987
|
const items = data?.items ?? [];
|
|
4988
|
+
const urlsById = await fetchPrimaryPublishedUrlsBatch(
|
|
4989
|
+
items.map((item) => item.id).filter((id) => typeof id === "string")
|
|
4990
|
+
);
|
|
4935
4991
|
for (const item of items) {
|
|
4936
4992
|
if (scannedRef.count >= 500) break;
|
|
4937
4993
|
scannedRef.count++;
|
|
@@ -4940,7 +4996,7 @@ var tool67 = {
|
|
|
4940
4996
|
allPages.push({
|
|
4941
4997
|
id: item.id ?? "",
|
|
4942
4998
|
name,
|
|
4943
|
-
url:
|
|
4999
|
+
url: urlsById.get(item.id) ?? "",
|
|
4944
5000
|
documentType: item.documentType?.name ?? item.contentTypeName ?? "",
|
|
4945
5001
|
depth,
|
|
4946
5002
|
rawDepth: depth,
|
|
@@ -6582,6 +6638,26 @@ var outputSchema93 = z.object({
|
|
|
6582
6638
|
).describe("Pages that reference this item"),
|
|
6583
6639
|
referenceCount: z.number().describe("Total number of pages referencing this item")
|
|
6584
6640
|
});
|
|
6641
|
+
async function buildReferencedBy(refItems) {
|
|
6642
|
+
const docRefIds = refItems.filter((ref) => ref.$type === "DocumentReferenceResponseModel").map((ref) => ref.id);
|
|
6643
|
+
const urlsById = await fetchPrimaryPublishedUrlsBatch(docRefIds);
|
|
6644
|
+
return refItems.map((ref) => {
|
|
6645
|
+
if (ref.$type === "DocumentReferenceResponseModel") {
|
|
6646
|
+
return {
|
|
6647
|
+
id: ref.id,
|
|
6648
|
+
name: ref.variants?.[0]?.name ?? ref.name ?? "(unnamed)",
|
|
6649
|
+
url: urlsById.get(ref.id) ?? "",
|
|
6650
|
+
documentType: ref.documentType?.alias ?? ""
|
|
6651
|
+
};
|
|
6652
|
+
}
|
|
6653
|
+
return {
|
|
6654
|
+
id: ref.id,
|
|
6655
|
+
name: ref.name ?? "(unnamed)",
|
|
6656
|
+
url: "",
|
|
6657
|
+
documentType: ""
|
|
6658
|
+
};
|
|
6659
|
+
});
|
|
6660
|
+
}
|
|
6585
6661
|
var tool93 = {
|
|
6586
6662
|
name: "report-content-references",
|
|
6587
6663
|
description: "Find which pages reference a given content page or media item. Useful before deleting or restructuring content to understand the impact.",
|
|
@@ -6596,32 +6672,11 @@ var tool93 = {
|
|
|
6596
6672
|
chainCms("get-document-by-id-referenced-by", { id })
|
|
6597
6673
|
]);
|
|
6598
6674
|
let name = "Unknown";
|
|
6599
|
-
let url = "";
|
|
6600
6675
|
if (docResult.ok) {
|
|
6601
|
-
|
|
6602
|
-
name = doc.variants?.[0]?.name ?? "Unknown";
|
|
6603
|
-
url = doc.urls?.[0]?.url ?? "";
|
|
6604
|
-
}
|
|
6605
|
-
const referencedBy = [];
|
|
6606
|
-
if (refResult.ok) {
|
|
6607
|
-
for (const ref of refResult.data.items ?? []) {
|
|
6608
|
-
if (ref.$type === "DocumentReferenceResponseModel") {
|
|
6609
|
-
referencedBy.push({
|
|
6610
|
-
id: ref.id,
|
|
6611
|
-
name: ref.variants?.[0]?.name ?? ref.name ?? "(unnamed)",
|
|
6612
|
-
url: ref.urls?.[0]?.url ?? ref.url ?? "",
|
|
6613
|
-
documentType: ref.documentType?.alias ?? ""
|
|
6614
|
-
});
|
|
6615
|
-
} else {
|
|
6616
|
-
referencedBy.push({
|
|
6617
|
-
id: ref.id,
|
|
6618
|
-
name: ref.name ?? "(unnamed)",
|
|
6619
|
-
url: "",
|
|
6620
|
-
documentType: ""
|
|
6621
|
-
});
|
|
6622
|
-
}
|
|
6623
|
-
}
|
|
6676
|
+
name = docResult.data.variants?.[0]?.name ?? "Unknown";
|
|
6624
6677
|
}
|
|
6678
|
+
const url = await fetchPrimaryPublishedUrl(id);
|
|
6679
|
+
const referencedBy = refResult.ok ? await buildReferencedBy(refResult.data.items ?? []) : [];
|
|
6625
6680
|
return createToolResult({
|
|
6626
6681
|
id,
|
|
6627
6682
|
name,
|
|
@@ -6645,26 +6700,7 @@ var tool93 = {
|
|
|
6645
6700
|
const entry = urlResult.data.items?.find((u) => u.id === id);
|
|
6646
6701
|
url = entry?.urlInfos?.[0]?.url ?? "";
|
|
6647
6702
|
}
|
|
6648
|
-
const referencedBy = [];
|
|
6649
|
-
if (refResult.ok) {
|
|
6650
|
-
for (const ref of refResult.data.items ?? []) {
|
|
6651
|
-
if (ref.$type === "DocumentReferenceResponseModel") {
|
|
6652
|
-
referencedBy.push({
|
|
6653
|
-
id: ref.id,
|
|
6654
|
-
name: ref.variants?.[0]?.name ?? ref.name ?? "(unnamed)",
|
|
6655
|
-
url: ref.urls?.[0]?.url ?? ref.url ?? "",
|
|
6656
|
-
documentType: ref.documentType?.alias ?? ""
|
|
6657
|
-
});
|
|
6658
|
-
} else {
|
|
6659
|
-
referencedBy.push({
|
|
6660
|
-
id: ref.id,
|
|
6661
|
-
name: ref.name ?? "(unnamed)",
|
|
6662
|
-
url: "",
|
|
6663
|
-
documentType: ""
|
|
6664
|
-
});
|
|
6665
|
-
}
|
|
6666
|
-
}
|
|
6667
|
-
}
|
|
6703
|
+
const referencedBy = refResult.ok ? await buildReferencedBy(refResult.data.items ?? []) : [];
|
|
6668
6704
|
return createToolResult({
|
|
6669
6705
|
id,
|
|
6670
6706
|
name,
|
|
@@ -6837,18 +6873,18 @@ async function resolveOutboundIds(candidateIds, excludeId) {
|
|
|
6837
6873
|
const internalPages = [];
|
|
6838
6874
|
const media = [];
|
|
6839
6875
|
const filtered = excludeId ? candidateIds.filter((cid) => cid !== excludeId.toLowerCase()) : candidateIds;
|
|
6876
|
+
const urlsById = await fetchPrimaryPublishedUrlsBatch(filtered);
|
|
6840
6877
|
await Promise.all(
|
|
6841
6878
|
filtered.map(async (refId) => {
|
|
6842
6879
|
try {
|
|
6843
6880
|
const docResult = await chainCms("get-document-by-id", { id: refId });
|
|
6844
6881
|
if (docResult.ok) {
|
|
6845
6882
|
const refDoc = docResult.data;
|
|
6846
|
-
const docExtra = refDoc;
|
|
6847
6883
|
const docType = refDoc.documentType;
|
|
6848
6884
|
internalPages.push({
|
|
6849
6885
|
id: refId,
|
|
6850
6886
|
name: refDoc.variants?.[0]?.name ?? "Unknown",
|
|
6851
|
-
url:
|
|
6887
|
+
url: urlsById.get(refId) ?? "",
|
|
6852
6888
|
documentType: docType?.alias ?? ""
|
|
6853
6889
|
});
|
|
6854
6890
|
return;
|
|
@@ -6922,7 +6958,7 @@ var tool94 = {
|
|
|
6922
6958
|
const doc = result.data;
|
|
6923
6959
|
const variant = doc.variants?.[0];
|
|
6924
6960
|
const name = variant?.name ?? "Unknown";
|
|
6925
|
-
const url =
|
|
6961
|
+
const url = await fetchPrimaryPublishedUrl(id);
|
|
6926
6962
|
const values = doc.values ?? [];
|
|
6927
6963
|
const links = extractLinksFromValues(values);
|
|
6928
6964
|
const { internalPages, media } = await resolveOutboundIds(links.allIds, id);
|