@fern-api/fdr-sdk 1.2.43-345d4ef0ea → 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 +3 -3
@@ -1351,7 +1351,14 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
1351
1351
  const relSection = stripLeadingScopePrefix(seg.section, scopePrefix);
1352
1352
  let slug = structuralNodeSlug(ctx, overview?.fullPath, relSection, scopePrefix);
1353
1353
  if (relSection === "" && overview?.fullPath == null) {
1354
- slug = inferSectionSlugFromNav(ctx, nav, scopePrefix) ?? slug;
1354
+ const inferred = inferSectionSlugFromNav(ctx, nav, scopePrefix);
1355
+ if (inferred != null) {
1356
+ const inferredStr = String(inferred);
1357
+ const collides = nav.some((r) => r.fullPath != null && String(ctx.contentSlug(r.fullPath)) === inferredStr);
1358
+ if (!collides) {
1359
+ slug = inferred;
1360
+ }
1361
+ }
1355
1362
  }
1356
1363
  const metaPointsTo = metaStr(seg.metadata, "pointsTo");
1357
1364
  const defaults = withMetadataDefaults({
@@ -1759,6 +1766,13 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1759
1766
  if (!sectionPaths.has(parent)) {
1760
1767
  return nearestExistingAncestor(sec, sectionPaths) === parentPath;
1761
1768
  }
1769
+ if (depth != null) {
1770
+ const pSeg = scopeSegs.find((c) => c.seg.section === parent);
1771
+ const pDepth = pSeg != null ? metaNum(pSeg.seg.metadata, "sidebarDepth") : void 0;
1772
+ if (pDepth != null && depth <= pDepth) {
1773
+ return nearestExistingAncestor(parent, sectionPaths) === parentPath;
1774
+ }
1775
+ }
1762
1776
  return false;
1763
1777
  }).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
1764
1778
  const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
@@ -1847,6 +1861,9 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1847
1861
  const hasRootSection = ordered.some(
1848
1862
  (s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
1849
1863
  );
1864
+ const hasTrueRootWrapper = ordered.some(
1865
+ (s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && metaNum(s.seg.metadata, "childIndex") == null
1866
+ );
1850
1867
  const depth0SectionPaths = /* @__PURE__ */ new Set();
1851
1868
  for (const s of ordered) {
1852
1869
  if (metaStr(s.seg.metadata, "type") === "section" && metaNum(s.seg.metadata, "sidebarDepth") === 0) {
@@ -1881,7 +1898,15 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1881
1898
  }
1882
1899
  if (type === "section" && sec === "" && hasRootSection) {
1883
1900
  const bounds = siblingBoundaries.get(s);
1884
- const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1901
+ let ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
1902
+ if (!hasTrueRootWrapper) {
1903
+ ownedSegs = ownedSegs.filter((o) => {
1904
+ if (o.seg.section === "") {
1905
+ return true;
1906
+ }
1907
+ return metaNum(o.seg.metadata, "sidebarDepth") != null;
1908
+ });
1909
+ }
1885
1910
  const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
1886
1911
  const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1887
1912
  annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
@@ -1890,7 +1915,7 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1890
1915
  const depth = metaNum(s.seg.metadata, "sidebarDepth");
1891
1916
  const parent = parentSectionPath(sec);
1892
1917
  const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
1893
- if (isRootLevel && hasRootSection && sec !== "" && depth !== 0) {
1918
+ if (isRootLevel && hasRootSection && sec !== "" && (depth != null ? depth !== 0 : hasTrueRootWrapper)) {
1894
1919
  continue;
1895
1920
  }
1896
1921
  if (isRootLevel && depth != null && depth > 0 && depth0SectionPaths.has(sec)) {
@@ -1924,7 +1949,11 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1924
1949
  const hasLeafPos = annotated.some((a) => a.isLeaf && a.pos != null);
1925
1950
  const hasSegmentPos = annotated.some((a) => !a.isLeaf && a.pos != null);
1926
1951
  const flat = hasLeafPos && hasSegmentPos ? annotated.map((a, seq) => ({ ...a, seq })).sort(
1927
- (x, y) => (x.pos ?? Number.MAX_SAFE_INTEGER) - (y.pos ?? Number.MAX_SAFE_INTEGER) || x.seq - y.seq
1952
+ (x, y) => (x.pos ?? Number.MAX_SAFE_INTEGER) - (y.pos ?? Number.MAX_SAFE_INTEGER) || // When positions tie, prefer structural nodes (sections) over
1953
+ // leaves (pages). This handles stale tabRoot nav entries whose
1954
+ // displaySortOrder wasn't updated due to content-addressing
1955
+ // (the segment hash doesn't include childPosition).
1956
+ (x.isLeaf === y.isLeaf ? 0 : x.isLeaf ? 1 : -1) || x.seq - y.seq
1928
1957
  ).map((a) => a.node) : annotated.map((a) => a.node);
1929
1958
  return groupSidebarRootChildren(ctx, flat);
1930
1959
  }