@fern-api/fdr-sdk 1.2.50-c32b5f74fd → 1.2.51-403b2eae4f
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/js/navigation/ledger-root-builder.js +22 -2
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +22 -2
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/navigation/__test__/ledger-canonical-bugs.repro.test.js +399 -12
- package/dist/navigation/__test__/ledger-canonical-bugs.repro.test.js.map +1 -1
- package/dist/navigation/ledger-root-builder.js +52 -10
- package/dist/navigation/ledger-root-builder.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -2408,8 +2408,27 @@ function buildLandingPage(ctx, scopeSegs) {
|
|
|
2408
2408
|
landingSegment?.nav.find((route) => route.type === "markdown")
|
|
2409
2409
|
);
|
|
2410
2410
|
}
|
|
2411
|
+
function buildSlugOwnerContentKeys(roots) {
|
|
2412
|
+
const slugOwnerKeys = /* @__PURE__ */ new Map();
|
|
2413
|
+
for (const root of roots) {
|
|
2414
|
+
traverseDF(root, (child, parents) => {
|
|
2415
|
+
if (hasMetadata(child) && isPage(child) && !slugOwnerKeys.has(child.slug)) {
|
|
2416
|
+
slugOwnerKeys.set(child.slug, new Set(crossVersionDedupKeys(child, parents)));
|
|
2417
|
+
}
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2420
|
+
return slugOwnerKeys;
|
|
2421
|
+
}
|
|
2422
|
+
function canonicalOwnerSharesContent(slugOwnerKeys, canonical, keys) {
|
|
2423
|
+
const ownerKeys = slugOwnerKeys.get(canonical);
|
|
2424
|
+
if (ownerKeys == null) {
|
|
2425
|
+
return false;
|
|
2426
|
+
}
|
|
2427
|
+
return keys.some((key) => key.startsWith("pid:") && ownerKeys.has(key));
|
|
2428
|
+
}
|
|
2411
2429
|
function markWithinScopeCanonicalSlugs(scopeNode) {
|
|
2412
2430
|
const keyToCanonical = /* @__PURE__ */ new Map();
|
|
2431
|
+
const slugOwnerKeys = buildSlugOwnerContentKeys([scopeNode]);
|
|
2413
2432
|
traverseDF(scopeNode, (child, parents) => {
|
|
2414
2433
|
if (hasMetadata(child) && isPage(child)) {
|
|
2415
2434
|
const keys = crossVersionDedupKeys(child, parents);
|
|
@@ -2417,7 +2436,7 @@ function markWithinScopeCanonicalSlugs(scopeNode) {
|
|
|
2417
2436
|
for (const key of keys) {
|
|
2418
2437
|
const canonical = keyToCanonical.get(key);
|
|
2419
2438
|
if (canonical != null && canonical !== child.slug) {
|
|
2420
|
-
if (child.slug.startsWith(canonical + "/") && getChildren(child).length > 0) {
|
|
2439
|
+
if (child.slug.startsWith(canonical + "/") && getChildren(child).length > 0 && !canonicalOwnerSharesContent(slugOwnerKeys, canonical, keys)) {
|
|
2421
2440
|
continue;
|
|
2422
2441
|
}
|
|
2423
2442
|
child.canonicalSlug = canonical;
|
|
@@ -2444,6 +2463,7 @@ function markCrossVersionCanonicalSlugs(versionNodes) {
|
|
|
2444
2463
|
}
|
|
2445
2464
|
return 0;
|
|
2446
2465
|
});
|
|
2466
|
+
const slugOwnerKeys = buildSlugOwnerContentKeys(sorted);
|
|
2447
2467
|
for (const version of sorted) {
|
|
2448
2468
|
traverseDF(version, (child, parents) => {
|
|
2449
2469
|
if (hasMetadata(child) && isPage(child)) {
|
|
@@ -2452,7 +2472,7 @@ function markCrossVersionCanonicalSlugs(versionNodes) {
|
|
|
2452
2472
|
for (const key of keys) {
|
|
2453
2473
|
const canonical = keyToCanonical.get(key);
|
|
2454
2474
|
if (canonical != null && !version.default) {
|
|
2455
|
-
if (child.slug.startsWith(canonical + "/") && getChildren(child).length > 0) {
|
|
2475
|
+
if (child.slug.startsWith(canonical + "/") && getChildren(child).length > 0 && !canonicalOwnerSharesContent(slugOwnerKeys, canonical, keys)) {
|
|
2456
2476
|
continue;
|
|
2457
2477
|
}
|
|
2458
2478
|
child.canonicalSlug = canonical;
|