@fern-api/fdr-sdk 1.2.43-60e226c2d6 → 1.2.44-08a3a65358

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 (98) hide show
  1. package/dist/api-definition/migrators/v1ToV2.d.ts.map +1 -1
  2. package/dist/api-definition/migrators/v1ToV2.js +1 -0
  3. package/dist/api-definition/migrators/v1ToV2.js.map +1 -1
  4. package/dist/converters/db/convertAPIDefinitionToDb.d.ts.map +1 -1
  5. package/dist/converters/db/convertAPIDefinitionToDb.js +1 -0
  6. package/dist/converters/db/convertAPIDefinitionToDb.js.map +1 -1
  7. package/dist/converters/read/convertDbAPIDefinitionToRead.d.ts +1 -0
  8. package/dist/converters/read/convertDbAPIDefinitionToRead.d.ts.map +1 -1
  9. package/dist/converters/read/convertDbAPIDefinitionToRead.js +1 -0
  10. package/dist/converters/read/convertDbAPIDefinitionToRead.js.map +1 -1
  11. package/dist/js/api-definition/index.js +3 -0
  12. package/dist/js/api-definition/index.js.map +1 -1
  13. package/dist/js/api-definition/index.mjs +3 -0
  14. package/dist/js/api-definition/index.mjs.map +1 -1
  15. package/dist/js/client/FdrClient.js +3 -0
  16. package/dist/js/client/FdrClient.js.map +1 -1
  17. package/dist/js/client/FdrClient.mjs +3 -0
  18. package/dist/js/client/FdrClient.mjs.map +1 -1
  19. package/dist/js/client/types.js +4 -0
  20. package/dist/js/client/types.js.map +1 -1
  21. package/dist/js/client/types.mjs +4 -0
  22. package/dist/js/client/types.mjs.map +1 -1
  23. package/dist/js/converters/index.js +16 -2
  24. package/dist/js/converters/index.js.map +1 -1
  25. package/dist/js/converters/index.mjs +16 -2
  26. package/dist/js/converters/index.mjs.map +1 -1
  27. package/dist/js/index.js +16 -2
  28. package/dist/js/index.js.map +1 -1
  29. package/dist/js/index.mjs +16 -2
  30. package/dist/js/index.mjs.map +1 -1
  31. package/dist/js/navigation/index.js +14 -2
  32. package/dist/js/navigation/index.js.map +1 -1
  33. package/dist/js/navigation/index.mjs +14 -2
  34. package/dist/js/navigation/index.mjs.map +1 -1
  35. package/dist/js/navigation/ledger-root-builder.js +33 -4
  36. package/dist/js/navigation/ledger-root-builder.js.map +1 -1
  37. package/dist/js/navigation/ledger-root-builder.mjs +33 -4
  38. package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
  39. package/dist/js/orpc-client.js +4 -0
  40. package/dist/js/orpc-client.js.map +1 -1
  41. package/dist/js/orpc-client.mjs +4 -0
  42. package/dist/js/orpc-client.mjs.map +1 -1
  43. package/dist/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.d.ts +2 -0
  44. package/dist/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.d.ts.map +1 -0
  45. package/dist/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.js +308 -0
  46. package/dist/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.js.map +1 -0
  47. package/dist/navigation/__test__/ledger-root-builder.pointsTo.test.js +122 -10
  48. package/dist/navigation/__test__/ledger-root-builder.pointsTo.test.js.map +1 -1
  49. package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js +5 -5
  50. package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js.map +1 -1
  51. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js +194 -0
  52. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js.map +1 -1
  53. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +403 -0
  54. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +1 -1
  55. package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
  56. package/dist/navigation/ledger-root-builder.js +58 -7
  57. package/dist/navigation/ledger-root-builder.js.map +1 -1
  58. package/dist/navigation/utils/toApis.d.ts +1 -0
  59. package/dist/navigation/utils/toApis.d.ts.map +1 -1
  60. package/dist/navigation/utils/updatePointsTo.d.ts.map +1 -1
  61. package/dist/navigation/utils/updatePointsTo.js +12 -4
  62. package/dist/navigation/utils/updatePointsTo.js.map +1 -1
  63. package/dist/orpc-client/api/contract-db.d.ts +3 -0
  64. package/dist/orpc-client/api/contract-db.d.ts.map +1 -1
  65. package/dist/orpc-client/api/contract-db.js +1 -0
  66. package/dist/orpc-client/api/contract-db.js.map +1 -1
  67. package/dist/orpc-client/api/contract-latest.d.ts +6 -0
  68. package/dist/orpc-client/api/contract-latest.d.ts.map +1 -1
  69. package/dist/orpc-client/api/contract-latest.js +1 -0
  70. package/dist/orpc-client/api/contract-latest.js.map +1 -1
  71. package/dist/orpc-client/api/contract-read.d.ts +3 -0
  72. package/dist/orpc-client/api/contract-read.d.ts.map +1 -1
  73. package/dist/orpc-client/api/contract-read.js +1 -0
  74. package/dist/orpc-client/api/contract-read.js.map +1 -1
  75. package/dist/orpc-client/api/contract-register.d.ts +3 -0
  76. package/dist/orpc-client/api/contract-register.d.ts.map +1 -1
  77. package/dist/orpc-client/api/contract-register.js +1 -0
  78. package/dist/orpc-client/api/contract-register.js.map +1 -1
  79. package/dist/tsconfig.tsbuildinfo +1 -1
  80. package/dist/types/api-definition/migrators/v1ToV2.d.ts.map +1 -1
  81. package/dist/types/converters/db/convertAPIDefinitionToDb.d.ts.map +1 -1
  82. package/dist/types/converters/read/convertDbAPIDefinitionToRead.d.ts +1 -0
  83. package/dist/types/converters/read/convertDbAPIDefinitionToRead.d.ts.map +1 -1
  84. package/dist/types/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.d.ts +2 -0
  85. package/dist/types/navigation/__test__/ledger-root-builder.contentfulRedirectRepro.test.d.ts.map +1 -0
  86. package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
  87. package/dist/types/navigation/utils/toApis.d.ts +1 -0
  88. package/dist/types/navigation/utils/toApis.d.ts.map +1 -1
  89. package/dist/types/navigation/utils/updatePointsTo.d.ts.map +1 -1
  90. package/dist/types/orpc-client/api/contract-db.d.ts +3 -0
  91. package/dist/types/orpc-client/api/contract-db.d.ts.map +1 -1
  92. package/dist/types/orpc-client/api/contract-latest.d.ts +6 -0
  93. package/dist/types/orpc-client/api/contract-latest.d.ts.map +1 -1
  94. package/dist/types/orpc-client/api/contract-read.d.ts +3 -0
  95. package/dist/types/orpc-client/api/contract-read.d.ts.map +1 -1
  96. package/dist/types/orpc-client/api/contract-register.d.ts +3 -0
  97. package/dist/types/orpc-client/api/contract-register.d.ts.map +1 -1
  98. package/package.json +1 -1
@@ -1310,7 +1310,14 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
1310
1310
  const relSection = stripLeadingScopePrefix(seg.section, scopePrefix);
1311
1311
  let slug = structuralNodeSlug(ctx, overview?.fullPath, relSection, scopePrefix);
1312
1312
  if (relSection === "" && overview?.fullPath == null) {
1313
- slug = inferSectionSlugFromNav(ctx, nav, scopePrefix) ?? slug;
1313
+ const inferred = inferSectionSlugFromNav(ctx, nav, scopePrefix);
1314
+ if (inferred != null) {
1315
+ const inferredStr = String(inferred);
1316
+ const collides = nav.some((r) => r.fullPath != null && String(ctx.contentSlug(r.fullPath)) === inferredStr);
1317
+ if (!collides) {
1318
+ slug = inferred;
1319
+ }
1320
+ }
1314
1321
  }
1315
1322
  const metaPointsTo = metaStr(seg.metadata, "pointsTo");
1316
1323
  const defaults = withMetadataDefaults({
@@ -1718,6 +1725,13 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1718
1725
  if (!sectionPaths.has(parent)) {
1719
1726
  return nearestExistingAncestor(sec, sectionPaths) === parentPath;
1720
1727
  }
1728
+ if (depth != null) {
1729
+ const pSeg = scopeSegs.find((c) => c.seg.section === parent);
1730
+ const pDepth = pSeg != null ? metaNum(pSeg.seg.metadata, "sidebarDepth") : void 0;
1731
+ if (pDepth != null && depth <= pDepth) {
1732
+ return nearestExistingAncestor(parent, sectionPaths) === parentPath;
1733
+ }
1734
+ }
1721
1735
  return false;
1722
1736
  }).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
1723
1737
  const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
@@ -1806,6 +1820,9 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1806
1820
  const hasRootSection = ordered.some(
1807
1821
  (s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
1808
1822
  );
1823
+ const hasTrueRootWrapper = ordered.some(
1824
+ (s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && metaNum(s.seg.metadata, "childIndex") == null
1825
+ );
1809
1826
  const depth0SectionPaths = /* @__PURE__ */ new Set();
1810
1827
  for (const s of ordered) {
1811
1828
  if (metaStr(s.seg.metadata, "type") === "section" && metaNum(s.seg.metadata, "sidebarDepth") === 0) {
@@ -1840,7 +1857,15 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1840
1857
  }
1841
1858
  if (type === "section" && sec === "" && hasRootSection) {
1842
1859
  const bounds = siblingBoundaries.get(s);
1843
- const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1860
+ let ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1861
+ if (!hasTrueRootWrapper) {
1862
+ ownedSegs = ownedSegs.filter((o) => {
1863
+ if (o.seg.section === "") {
1864
+ return true;
1865
+ }
1866
+ return metaNum(o.seg.metadata, "sidebarDepth") != null;
1867
+ });
1868
+ }
1844
1869
  const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
1845
1870
  const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1846
1871
  annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
@@ -1849,7 +1874,7 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1849
1874
  const depth = metaNum(s.seg.metadata, "sidebarDepth");
1850
1875
  const parent = parentSectionPath(sec);
1851
1876
  const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1852
- if (isRootLevel && hasRootSection && sec !== "" && depth !== 0) {
1877
+ if (isRootLevel && hasRootSection && sec !== "" && (depth != null ? depth !== 0 : hasTrueRootWrapper)) {
1853
1878
  continue;
1854
1879
  }
1855
1880
  if (isRootLevel && depth != null && depth > 0 && depth0SectionPaths.has(sec)) {
@@ -1883,7 +1908,11 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1883
1908
  const hasLeafPos = annotated.some((a) => a.isLeaf && a.pos != null);
1884
1909
  const hasSegmentPos = annotated.some((a) => !a.isLeaf && a.pos != null);
1885
1910
  const flat = hasLeafPos && hasSegmentPos ? annotated.map((a, seq) => ({ ...a, seq })).sort(
1886
- (x, y) => (x.pos ?? Number.MAX_SAFE_INTEGER) - (y.pos ?? Number.MAX_SAFE_INTEGER) || x.seq - y.seq
1911
+ (x, y) => (x.pos ?? Number.MAX_SAFE_INTEGER) - (y.pos ?? Number.MAX_SAFE_INTEGER) || // When positions tie, prefer structural nodes (sections) over
1912
+ // leaves (pages). This handles stale tabRoot nav entries whose
1913
+ // displaySortOrder wasn't updated due to content-addressing
1914
+ // (the segment hash doesn't include childPosition).
1915
+ (x.isLeaf === y.isLeaf ? 0 : x.isLeaf ? 1 : -1) || x.seq - y.seq
1887
1916
  ).map((a) => a.node) : annotated.map((a) => a.node);
1888
1917
  return groupSidebarRootChildren(ctx, flat);
1889
1918
  }