@fern-api/fdr-sdk 1.2.39-008eed59b3 → 1.2.39-4a89db5dd2
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/client/FdrClient.js +1 -0
- package/dist/js/client/FdrClient.js.map +1 -1
- package/dist/js/client/FdrClient.mjs +1 -0
- package/dist/js/client/FdrClient.mjs.map +1 -1
- package/dist/js/index.js +1 -0
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.mjs +1 -0
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/navigation/ledger-root-builder.js +104 -43
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +104 -43
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/js/orpc-client.js +1 -0
- package/dist/js/orpc-client.js.map +1 -1
- package/dist/js/orpc-client.mjs +1 -0
- package/dist/js/orpc-client.mjs.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/navigation/__test__/ledger-root-builder.apiReferenceChildren.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.apiReferenceChildren.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.landingPage.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.landingPage.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.rootSlug.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.rootSlug.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugTabs.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugTabs.test.d.ts.map +1 -0
- package/dist/types/navigation/ledger-root-builder.d.ts +2 -0
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/types/orpc-client/docs-ledger/contract.d.ts +50 -0
- package/dist/types/orpc-client/docs-ledger/contract.d.ts.map +1 -1
- package/dist/types/orpc-client/docs-ledger/ledger-manifest.d.ts +12 -0
- package/dist/types/orpc-client/docs-ledger/ledger-manifest.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1082,6 +1082,63 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1082
1082
|
}
|
|
1083
1083
|
return void 0;
|
|
1084
1084
|
}
|
|
1085
|
+
function apiLeafPositionKey(node) {
|
|
1086
|
+
switch (node.type) {
|
|
1087
|
+
case "endpoint":
|
|
1088
|
+
return `endpoint:${node.endpointId}`;
|
|
1089
|
+
case "webhook":
|
|
1090
|
+
return `webhook:${node.webhookId}`;
|
|
1091
|
+
case "webSocket":
|
|
1092
|
+
return `webSocket:${node.webSocketId}`;
|
|
1093
|
+
case "grpc":
|
|
1094
|
+
return `grpc:${node.grpcId}`;
|
|
1095
|
+
case "graphql":
|
|
1096
|
+
return `graphql:${node.graphqlOperationId}`;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
function apiChildPositionKey(node) {
|
|
1100
|
+
switch (node.type) {
|
|
1101
|
+
case "endpoint":
|
|
1102
|
+
case "webhook":
|
|
1103
|
+
case "webSocket":
|
|
1104
|
+
case "grpc":
|
|
1105
|
+
case "graphql":
|
|
1106
|
+
return apiLeafPositionKey(node);
|
|
1107
|
+
default:
|
|
1108
|
+
return void 0;
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
function positionedApiLeafChildren(ctx, nav, apiDefinitionId) {
|
|
1112
|
+
const rawLeafNodes = [];
|
|
1113
|
+
const leafPositions = /* @__PURE__ */ new Map();
|
|
1114
|
+
const nonApiLeafNodes = [];
|
|
1115
|
+
for (let i = 0; i < nav.length; i++) {
|
|
1116
|
+
const route = nav[i];
|
|
1117
|
+
const pos = route.displaySortOrder ?? i;
|
|
1118
|
+
const apiLeaf = apiLeafNodeFromNavRouteInternal(ctx, route, apiDefinitionId);
|
|
1119
|
+
if (apiLeaf != null) {
|
|
1120
|
+
rawLeafNodes.push(apiLeaf);
|
|
1121
|
+
const key = apiLeafPositionKey(apiLeaf);
|
|
1122
|
+
leafPositions.set(key, Math.min(leafPositions.get(key) ?? pos, pos));
|
|
1123
|
+
continue;
|
|
1124
|
+
}
|
|
1125
|
+
const node = artifactToNode(ctx, route);
|
|
1126
|
+
if (node?.type === "page" || node?.type === "link") {
|
|
1127
|
+
nonApiLeafNodes.push({ node, pos });
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
const apiLeafNodes = mergeEndpointPairs(ctx, rawLeafNodes, nav);
|
|
1131
|
+
const positionedApiLeafNodes = apiLeafNodes.map((node, index) => {
|
|
1132
|
+
if (node.type === "endpointPair") {
|
|
1133
|
+
const streamPos = leafPositions.get(apiLeafPositionKey(node.stream)) ?? index;
|
|
1134
|
+
const nonStreamPos = leafPositions.get(apiLeafPositionKey(node.nonStream)) ?? index;
|
|
1135
|
+
return { node, pos: Math.min(streamPos, nonStreamPos) };
|
|
1136
|
+
}
|
|
1137
|
+
const key = apiChildPositionKey(node);
|
|
1138
|
+
return { node, pos: key != null ? leafPositions.get(key) ?? index : index };
|
|
1139
|
+
});
|
|
1140
|
+
return [...positionedApiLeafNodes, ...nonApiLeafNodes];
|
|
1141
|
+
}
|
|
1085
1142
|
function collectApiLeafNodesFromNav(routes, basePath, segmentApiDefinitionId2) {
|
|
1086
1143
|
const ctx = createBuildContext(basePath);
|
|
1087
1144
|
return routes.map((route) => apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2)).filter((node) => node != null);
|
|
@@ -1221,8 +1278,7 @@ function directChildApiPackages(parentSection, scopeSegs) {
|
|
|
1221
1278
|
}
|
|
1222
1279
|
function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix) {
|
|
1223
1280
|
const { seg, nav } = scoped;
|
|
1224
|
-
const
|
|
1225
|
-
const leafNodes = mergeEndpointPairs(ctx, rawLeafNodes, nav);
|
|
1281
|
+
const leafNodes = positionedApiLeafChildren(ctx, nav, apiDefinitionId);
|
|
1226
1282
|
const childPackages = directChildApiPackages(seg.section, scopeSegs);
|
|
1227
1283
|
const packageNodes = childPackages.map((child) => ({
|
|
1228
1284
|
node: apiPackageChildNode(
|
|
@@ -1236,18 +1292,10 @@ function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix)
|
|
|
1236
1292
|
}));
|
|
1237
1293
|
const hasChildIndex = packageNodes.some((p) => p.childIndex != null);
|
|
1238
1294
|
if (!hasChildIndex) {
|
|
1239
|
-
return [...leafNodes, ...packageNodes.map((p) => p.node)];
|
|
1240
|
-
}
|
|
1241
|
-
const leafPositions = [];
|
|
1242
|
-
for (const route of nav) {
|
|
1243
|
-
if (route.displaySortOrder != null) {
|
|
1244
|
-
leafPositions.push(route.displaySortOrder);
|
|
1245
|
-
}
|
|
1295
|
+
return [...leafNodes, ...packageNodes.map((p) => ({ node: p.node, pos: Number.MAX_SAFE_INTEGER }))].sort((a, b) => a.pos - b.pos).map((p) => p.node);
|
|
1246
1296
|
}
|
|
1247
1297
|
const positioned = [];
|
|
1248
|
-
|
|
1249
|
-
positioned.push({ node: leafNodes[i], pos: leafPositions[i] ?? i });
|
|
1250
|
-
}
|
|
1298
|
+
positioned.push(...leafNodes);
|
|
1251
1299
|
for (const p of packageNodes) {
|
|
1252
1300
|
positioned.push({ node: p.node, pos: p.childIndex ?? Number.MAX_SAFE_INTEGER });
|
|
1253
1301
|
}
|
|
@@ -1550,6 +1598,9 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1550
1598
|
if (hasOwningApiReference(s, scopeSegs)) {
|
|
1551
1599
|
continue;
|
|
1552
1600
|
}
|
|
1601
|
+
if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {
|
|
1602
|
+
continue;
|
|
1603
|
+
}
|
|
1553
1604
|
if (type === "tabRoot" || sec === "" && type !== "section") {
|
|
1554
1605
|
for (const r of s.nav) {
|
|
1555
1606
|
const node = artifactToNode(ctx, r);
|
|
@@ -1636,13 +1687,13 @@ function buildSidebarRoot(ctx, scopeSegs, scopePrefix, changelogScopePrefix) {
|
|
|
1636
1687
|
};
|
|
1637
1688
|
}
|
|
1638
1689
|
function buildFullRootFromSegments(options) {
|
|
1639
|
-
const { basePath, title, segments, navBySegment } = options;
|
|
1690
|
+
const { basePath, rootSlug: sourceRootSlug, title, segments, navBySegment } = options;
|
|
1640
1691
|
const ctx = createBuildContext(basePath);
|
|
1641
1692
|
const scoped = segments.filter((seg) => {
|
|
1642
1693
|
const t = metaStr(seg.metadata, "type");
|
|
1643
1694
|
return t !== "files" && t !== "redirects";
|
|
1644
1695
|
}).map((seg) => ({ seg, nav: navBySegment.get(seg.segmentHash) ?? [] }));
|
|
1645
|
-
const rootSlug = asSlug(basePath);
|
|
1696
|
+
const rootSlug = asSlug(sourceRootSlug ?? basePath);
|
|
1646
1697
|
const scopesByKey = /* @__PURE__ */ new Map();
|
|
1647
1698
|
for (const s of scoped) {
|
|
1648
1699
|
const key = scopeKey(s.seg);
|
|
@@ -1705,7 +1756,7 @@ function uniqueDetails(scoped, dim) {
|
|
|
1705
1756
|
continue;
|
|
1706
1757
|
}
|
|
1707
1758
|
const slug = detailSlug(d);
|
|
1708
|
-
const key = slug !== "" ? slug : d.id;
|
|
1759
|
+
const key = dim === "tab" ? d.id : slug !== "" ? slug : d.id;
|
|
1709
1760
|
const existing = byKey.get(key);
|
|
1710
1761
|
if (existing == null) {
|
|
1711
1762
|
byKey.set(key, d);
|
|
@@ -1857,7 +1908,7 @@ function buildUnversioned(ctx, scopeSegs, scopePrefix, tabsPresent) {
|
|
|
1857
1908
|
type: "unversioned",
|
|
1858
1909
|
id: ctx.nodeId(`unversioned:${first?.seg.product?.id ?? "root"}`),
|
|
1859
1910
|
collapsed: void 0,
|
|
1860
|
-
landingPage:
|
|
1911
|
+
landingPage: buildLandingPage(ctx, scopeSegs),
|
|
1861
1912
|
// The enclosing scope prefix (product slug, or rootSlug at the top
|
|
1862
1913
|
// level) roots structural sections so they share the scope's slug
|
|
1863
1914
|
// namespace.
|
|
@@ -1884,7 +1935,7 @@ function buildVersioned(ctx, versions, scoped, rootSlug, productPrefix) {
|
|
|
1884
1935
|
default: detailIsDefault(version),
|
|
1885
1936
|
versionId: VersionId(version.id),
|
|
1886
1937
|
availability: void 0,
|
|
1887
|
-
landingPage:
|
|
1938
|
+
landingPage: buildLandingPage(ctx, versionSegs),
|
|
1888
1939
|
announcement: void 0,
|
|
1889
1940
|
pointsTo: metaStr(version.metadata, "pointsTo") != null ? pointsToSlug(metaStr(version.metadata, "pointsTo")) : void 0,
|
|
1890
1941
|
// The version's full slug roots structural sections so the whole
|
|
@@ -1965,34 +2016,41 @@ function crossVersionDedupKeys(node, parents) {
|
|
|
1965
2016
|
keys.push([...parentTitles, node.title].join("###"));
|
|
1966
2017
|
return keys;
|
|
1967
2018
|
}
|
|
1968
|
-
function
|
|
1969
|
-
|
|
1970
|
-
if (tablessSegs.length === 0) {
|
|
2019
|
+
function routeToLandingPage(ctx, route) {
|
|
2020
|
+
if (route == null || route.type !== "markdown" || route.fullPath == null) {
|
|
1971
2021
|
return void 0;
|
|
1972
2022
|
}
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
const pageId = metaStr(md, "pageId") ?? "";
|
|
1978
|
-
const slug = ctx.contentSlug(r.fullPath);
|
|
1979
|
-
return {
|
|
1980
|
-
type: "landingPage",
|
|
1981
|
-
...withMetadataDefaults({
|
|
1982
|
-
id: ctx.nodeId(`landing:${slug}`),
|
|
1983
|
-
title: metaStr(md, "title") ?? "",
|
|
1984
|
-
slug,
|
|
1985
|
-
icon: metaStr(md, "icon"),
|
|
1986
|
-
hidden: r.hidden,
|
|
1987
|
-
viewers: toViewers(metaStrArr(md, "viewers"))
|
|
1988
|
-
}),
|
|
1989
|
-
pageId: PageId(pageId),
|
|
1990
|
-
noindex: metaBool(md, "noindex")
|
|
1991
|
-
};
|
|
1992
|
-
}
|
|
1993
|
-
}
|
|
2023
|
+
const md = route.metadata;
|
|
2024
|
+
const pageId = metaStr(md, "pageId");
|
|
2025
|
+
if (pageId == null) {
|
|
2026
|
+
return void 0;
|
|
1994
2027
|
}
|
|
1995
|
-
|
|
2028
|
+
const slug = ctx.contentSlug(route.fullPath);
|
|
2029
|
+
return {
|
|
2030
|
+
type: "landingPage",
|
|
2031
|
+
...withMetadataDefaults({
|
|
2032
|
+
id: ctx.nodeId(`landing:${slug}`),
|
|
2033
|
+
title: metaStr(md, "title") ?? "",
|
|
2034
|
+
slug,
|
|
2035
|
+
icon: metaStr(md, "icon"),
|
|
2036
|
+
hidden: route.hidden,
|
|
2037
|
+
authed: metaBool(md, "authed"),
|
|
2038
|
+
viewers: toViewers(metaStrArr(md, "viewers")),
|
|
2039
|
+
orphaned: metaBool(md, "orphaned"),
|
|
2040
|
+
featureFlags: metaFeatureFlags(md)
|
|
2041
|
+
}),
|
|
2042
|
+
pageId: PageId(pageId),
|
|
2043
|
+
noindex: metaBool(md, "noindex")
|
|
2044
|
+
};
|
|
2045
|
+
}
|
|
2046
|
+
function buildLandingPage(ctx, scopeSegs) {
|
|
2047
|
+
const landingSegment = scopeSegs.find(
|
|
2048
|
+
(s) => metaStr(s.seg.metadata, "type") === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true
|
|
2049
|
+
);
|
|
2050
|
+
return routeToLandingPage(
|
|
2051
|
+
ctx,
|
|
2052
|
+
landingSegment?.nav.find((route) => route.type === "markdown")
|
|
2053
|
+
);
|
|
1996
2054
|
}
|
|
1997
2055
|
function markCrossVersionCanonicalSlugs(versionNodes) {
|
|
1998
2056
|
const keyToCanonical = /* @__PURE__ */ new Map();
|
|
@@ -2063,7 +2121,10 @@ function buildProductGroup(ctx, products, scoped, rootSlug) {
|
|
|
2063
2121
|
type: "productgroup",
|
|
2064
2122
|
id: ctx.nodeId("productgroup"),
|
|
2065
2123
|
collapsed: void 0,
|
|
2066
|
-
landingPage:
|
|
2124
|
+
landingPage: buildLandingPage(
|
|
2125
|
+
ctx,
|
|
2126
|
+
scoped.filter((s) => s.seg.product == null)
|
|
2127
|
+
),
|
|
2067
2128
|
children
|
|
2068
2129
|
};
|
|
2069
2130
|
}
|