@fern-api/fdr-sdk 1.2.42-304ea6b285 → 1.2.42-5d054efb73

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.
Files changed (22) hide show
  1. package/dist/js/navigation/ledger-root-builder.js +36 -3
  2. package/dist/js/navigation/ledger-root-builder.js.map +1 -1
  3. package/dist/js/navigation/ledger-root-builder.mjs +36 -3
  4. package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
  5. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +2 -0
  6. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +1 -0
  7. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js +267 -0
  8. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js.map +1 -0
  9. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +2 -0
  10. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +1 -0
  11. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js +273 -0
  12. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js.map +1 -0
  13. package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
  14. package/dist/navigation/ledger-root-builder.js +70 -11
  15. package/dist/navigation/ledger-root-builder.js.map +1 -1
  16. package/dist/tsconfig.tsbuildinfo +1 -1
  17. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +2 -0
  18. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +1 -0
  19. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +2 -0
  20. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +1 -0
  21. package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
  22. package/package.json +1 -1
@@ -1722,6 +1722,10 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1722
1722
  if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1723
1723
  return false;
1724
1724
  }
1725
+ const depth = metaNum(s.seg.metadata, "sidebarDepth");
1726
+ if (depth === 0) {
1727
+ return false;
1728
+ }
1725
1729
  const parent = parentSectionPath(sec);
1726
1730
  if (parent === parentPath) {
1727
1731
  return true;
@@ -1769,8 +1773,9 @@ function computeSiblingSortBoundaries(ordered) {
1769
1773
  rootSections.push(s);
1770
1774
  continue;
1771
1775
  }
1776
+ const depth = metaNum(s.seg.metadata, "sidebarDepth");
1772
1777
  const parent = parentSectionPath(sec);
1773
- const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1778
+ const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1774
1779
  if (isRootLevel) {
1775
1780
  rootSections.push(s);
1776
1781
  }
@@ -1827,9 +1832,10 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1827
1832
  annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
1828
1833
  continue;
1829
1834
  }
1835
+ const depth = metaNum(s.seg.metadata, "sidebarDepth");
1830
1836
  const parent = parentSectionPath(sec);
1831
- const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1832
- if (isRootLevel && hasRootSection && sec !== "") {
1837
+ const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1838
+ if (isRootLevel && hasRootSection && sec !== "" && depth == null) {
1833
1839
  continue;
1834
1840
  }
1835
1841
  if (isRootLevel) {
@@ -2397,6 +2403,7 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
2397
2403
  };
2398
2404
  return node;
2399
2405
  });
2406
+ markCrossProductCanonicalSlugs(children);
2400
2407
  return {
2401
2408
  type: "productgroup",
2402
2409
  id: ctx.nodeId("productgroup"),
@@ -2408,6 +2415,32 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
2408
2415
  children
2409
2416
  };
2410
2417
  }
2418
+ function markCrossProductCanonicalSlugs(productNodes) {
2419
+ const pageIdToCanonical = /* @__PURE__ */ new Map();
2420
+ const sorted = [...productNodes].sort((a, b) => {
2421
+ if (a.default !== b.default) {
2422
+ return a.default ? -1 : 1;
2423
+ }
2424
+ return 0;
2425
+ });
2426
+ for (const product of sorted) {
2427
+ traverseDF(product, (child) => {
2428
+ if (hasMetadata(child) && isPage(child)) {
2429
+ const pid = getPageId(child);
2430
+ if (pid == null) {
2431
+ return;
2432
+ }
2433
+ const key = `pid:${pid}`;
2434
+ const canonical = pageIdToCanonical.get(key);
2435
+ if (canonical != null && !product.default) {
2436
+ child.canonicalSlug = canonical;
2437
+ } else if (canonical == null) {
2438
+ pageIdToCanonical.set(key, child.canonicalSlug ?? child.slug);
2439
+ }
2440
+ }
2441
+ });
2442
+ }
2443
+ }
2411
2444
  // Annotate the CommonJS export names for ESM import in node:
2412
2445
  0 && (module.exports = {
2413
2446
  apiLeafNodeFromNavRoute,