@fern-api/fdr-sdk 1.2.38-b6bdd8176d → 1.2.39-38c6f9a29c
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 +197 -6
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +197 -6
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -698,6 +698,77 @@ function getChildren(node) {
|
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
700
|
|
|
701
|
+
// ../commons/core-utils/dist/assertNever.js
|
|
702
|
+
function assertNever(x) {
|
|
703
|
+
throw new Error("Unexpected value: " + JSON.stringify(x));
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
// ../commons/core-utils/dist/visitDiscriminatedUnion.js
|
|
707
|
+
function visitDiscriminatedUnion(item, discriminant = "type") {
|
|
708
|
+
return {
|
|
709
|
+
_visit: (visitor) => {
|
|
710
|
+
const visit = visitor[item[discriminant]];
|
|
711
|
+
if (visit != null) {
|
|
712
|
+
return visit(item);
|
|
713
|
+
} else {
|
|
714
|
+
if (visitor._other == null) {
|
|
715
|
+
assertNever(item);
|
|
716
|
+
}
|
|
717
|
+
return visitor._other(item);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
var visitDiscriminatedUnion_default = visitDiscriminatedUnion;
|
|
723
|
+
|
|
724
|
+
// src/navigation/versions/latest/getPageId.ts
|
|
725
|
+
var RETURN_PAGEID = (node) => node.pageId;
|
|
726
|
+
var RETURN_OVERVIEW_PAGEID = (node) => node.overviewPageId;
|
|
727
|
+
var RETURN_UNDEFINED = () => void 0;
|
|
728
|
+
function getPageId(node) {
|
|
729
|
+
return visitDiscriminatedUnion_default(node)._visit({
|
|
730
|
+
section: RETURN_OVERVIEW_PAGEID,
|
|
731
|
+
apiReference: RETURN_OVERVIEW_PAGEID,
|
|
732
|
+
changelog: RETURN_OVERVIEW_PAGEID,
|
|
733
|
+
apiPackage: RETURN_OVERVIEW_PAGEID,
|
|
734
|
+
changelogEntry: RETURN_PAGEID,
|
|
735
|
+
page: RETURN_PAGEID,
|
|
736
|
+
landingPage: RETURN_PAGEID,
|
|
737
|
+
// if the following changes, make sure to update the algolia records generator
|
|
738
|
+
endpoint: RETURN_UNDEFINED,
|
|
739
|
+
webSocket: RETURN_UNDEFINED,
|
|
740
|
+
webhook: RETURN_UNDEFINED,
|
|
741
|
+
grpc: RETURN_UNDEFINED,
|
|
742
|
+
graphql: RETURN_UNDEFINED,
|
|
743
|
+
graphqlType: RETURN_UNDEFINED
|
|
744
|
+
// changelogYear: RETURN_UNDEFINED,
|
|
745
|
+
// changelogMonth: RETURN_UNDEFINED,
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
// src/navigation/versions/latest/NavigationNodeSection.ts
|
|
750
|
+
function isSection(node) {
|
|
751
|
+
return node.type === "section" || node.type === "apiReference" || node.type === "changelog" || node.type === "apiPackage";
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// src/navigation/versions/latest/NavigationNodeSectionOverview.ts
|
|
755
|
+
function isSectionOverview(node) {
|
|
756
|
+
return isSection(node) && node.overviewPageId != null;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
// src/navigation/versions/latest/NavigationNodeMarkdown.ts
|
|
760
|
+
function hasMarkdown(node) {
|
|
761
|
+
return isMarkdownLeaf(node) || isSectionOverview(node);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
// src/navigation/versions/latest/NavigationNodePage.ts
|
|
765
|
+
function isPage(node) {
|
|
766
|
+
return isApiLeaf(node) || node.type === "changelog" || // TODO: Uncomment when changelog years and months are visitable
|
|
767
|
+
// node.type === "changelogYear" ||
|
|
768
|
+
// node.type === "changelogMonth" ||
|
|
769
|
+
hasMarkdown(node);
|
|
770
|
+
}
|
|
771
|
+
|
|
701
772
|
// src/navigation/versions/latest/NavigationNodeWithMetadata.ts
|
|
702
773
|
function hasMetadata(node) {
|
|
703
774
|
return typeof node.title === "string" && typeof node.slug === "string";
|
|
@@ -1125,8 +1196,9 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
|
|
|
1125
1196
|
const { seg, nav } = scoped;
|
|
1126
1197
|
const overview = overviewRoute(nav) ?? overviewRouteFromSegmentMeta(seg, nav);
|
|
1127
1198
|
const overviewPageId = overview != null ? metaStr(overview.metadata, "pageId") : void 0;
|
|
1128
|
-
|
|
1129
|
-
|
|
1199
|
+
const relSection = stripLeadingScopePrefix(seg.section, scopePrefix);
|
|
1200
|
+
let slug = structuralNodeSlug(ctx, overview?.fullPath, relSection, scopePrefix);
|
|
1201
|
+
if (relSection === "" && overview?.fullPath == null) {
|
|
1130
1202
|
slug = inferSectionSlugFromNav(ctx, nav, scopePrefix) ?? slug;
|
|
1131
1203
|
}
|
|
1132
1204
|
const metaPointsTo = metaStr(seg.metadata, "pointsTo");
|
|
@@ -1207,7 +1279,12 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
|
|
|
1207
1279
|
const overview = overviewRoute(nav);
|
|
1208
1280
|
const overviewPageId = overview != null ? metaStr(overview.metadata, "pageId") : void 0;
|
|
1209
1281
|
const apiDefinitionId = metaStr(seg.metadata, "apiDefinitionId") ?? parentApiDefinitionId;
|
|
1210
|
-
const slug = structuralNodeSlug(
|
|
1282
|
+
const slug = structuralNodeSlug(
|
|
1283
|
+
ctx,
|
|
1284
|
+
overview?.fullPath,
|
|
1285
|
+
stripLeadingScopePrefix(seg.section, scopePrefix),
|
|
1286
|
+
scopePrefix
|
|
1287
|
+
);
|
|
1211
1288
|
const metaPointsTo = metaStr(seg.metadata, "pointsTo");
|
|
1212
1289
|
const children = buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix);
|
|
1213
1290
|
return {
|
|
@@ -1286,7 +1363,12 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
|
|
|
1286
1363
|
const overview = overviewRoute(nav);
|
|
1287
1364
|
const overviewPageId = overview != null ? metaStr(overview.metadata, "pageId") : void 0;
|
|
1288
1365
|
const apiDefinitionId = metaStr(seg.metadata, "apiDefinitionId") ?? "";
|
|
1289
|
-
const slug = structuralNodeSlug(
|
|
1366
|
+
const slug = structuralNodeSlug(
|
|
1367
|
+
ctx,
|
|
1368
|
+
overview?.fullPath,
|
|
1369
|
+
stripLeadingScopePrefix(seg.section, scopePrefix),
|
|
1370
|
+
scopePrefix
|
|
1371
|
+
);
|
|
1290
1372
|
const metaPointsTo = metaStr(seg.metadata, "pointsTo");
|
|
1291
1373
|
const children = buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix);
|
|
1292
1374
|
const changelog = attachedApiChangelogNode(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix);
|
|
@@ -1691,7 +1773,10 @@ function buildTabbedOrSidebar(ctx, scopeSegs, tabsPresent, scopePrefix) {
|
|
|
1691
1773
|
const tabDetails = uniqueDetails(scopeSegs, "tab");
|
|
1692
1774
|
const children = tabDetails.map((tab) => {
|
|
1693
1775
|
const tabType = metaStr(tab.metadata, "tab_type");
|
|
1694
|
-
const
|
|
1776
|
+
const rawTabSlug = detailSlug(tab);
|
|
1777
|
+
const versionDetail = scopeSegs[0]?.seg.version;
|
|
1778
|
+
const versionSlugStr = versionDetail != null ? detailSlug(versionDetail) : void 0;
|
|
1779
|
+
const tabSlug = versionSlugStr != null && rawTabSlug !== "" && (rawTabSlug === versionSlugStr || rawTabSlug.startsWith(versionSlugStr + "/")) ? asSlug(rawTabSlug) : asSlug(scopeSlugPrefix(scopePrefix, tab));
|
|
1695
1780
|
if (tabType === "link") {
|
|
1696
1781
|
return {
|
|
1697
1782
|
type: "link",
|
|
@@ -1788,7 +1873,7 @@ function buildVersioned(ctx, versions, scoped, rootSlug, productPrefix) {
|
|
|
1788
1873
|
default: detailIsDefault(version),
|
|
1789
1874
|
versionId: VersionId(version.id),
|
|
1790
1875
|
availability: void 0,
|
|
1791
|
-
landingPage:
|
|
1876
|
+
landingPage: buildVersionLandingPage(ctx, versionSegs, asSlug(slug)),
|
|
1792
1877
|
announcement: void 0,
|
|
1793
1878
|
pointsTo: metaStr(version.metadata, "pointsTo") != null ? pointsToSlug(metaStr(version.metadata, "pointsTo")) : void 0,
|
|
1794
1879
|
// The version's full slug roots structural sections so the whole
|
|
@@ -1800,6 +1885,7 @@ function buildVersioned(ctx, versions, scoped, rootSlug, productPrefix) {
|
|
|
1800
1885
|
}
|
|
1801
1886
|
return node;
|
|
1802
1887
|
});
|
|
1888
|
+
markCrossVersionCanonicalSlugs(children);
|
|
1803
1889
|
return {
|
|
1804
1890
|
type: "versioned",
|
|
1805
1891
|
id: ctx.nodeId(`versioned:${productPrefix ?? "root"}`),
|
|
@@ -1825,6 +1911,111 @@ function markDefaultVersionCanonicalSlugs(node, pruneSlug, versionSlug) {
|
|
|
1825
1911
|
return;
|
|
1826
1912
|
});
|
|
1827
1913
|
}
|
|
1914
|
+
function unversionedParents(parents) {
|
|
1915
|
+
let versionIdx = -1;
|
|
1916
|
+
for (let i = parents.length - 1; i >= 0; i--) {
|
|
1917
|
+
if (parents[i].type === "version") {
|
|
1918
|
+
versionIdx = i;
|
|
1919
|
+
break;
|
|
1920
|
+
}
|
|
1921
|
+
}
|
|
1922
|
+
return versionIdx >= 0 ? parents.slice(versionIdx + 1) : parents;
|
|
1923
|
+
}
|
|
1924
|
+
function crossVersionDedupKeys(node, parents) {
|
|
1925
|
+
const keys = [];
|
|
1926
|
+
const uParents = unversionedParents(parents);
|
|
1927
|
+
const pid = getPageId(node);
|
|
1928
|
+
if (pid != null) {
|
|
1929
|
+
keys.push(`pid:${pid}`);
|
|
1930
|
+
}
|
|
1931
|
+
if (node.type === "endpoint" || node.type === "webSocket" || node.type === "webhook" || node.type === "grpc" || node.type === "graphql") {
|
|
1932
|
+
const apiParentTitles = uParents.filter(
|
|
1933
|
+
(p) => p.type === "apiReference"
|
|
1934
|
+
).map((p) => p.title.replaceAll(" ", ""));
|
|
1935
|
+
const apiPrefix = apiParentTitles.join(":");
|
|
1936
|
+
if (node.type === "endpoint") {
|
|
1937
|
+
keys.push(`${apiPrefix}:api:endpoint:${node.method}:${node.endpointId}`);
|
|
1938
|
+
} else if (node.type === "webSocket") {
|
|
1939
|
+
keys.push(`${apiPrefix}:api:websocket:${node.webSocketId}`);
|
|
1940
|
+
} else if (node.type === "webhook") {
|
|
1941
|
+
keys.push(`${apiPrefix}:api:webhook:${node.method}:${node.webhookId}`);
|
|
1942
|
+
} else if (node.type === "grpc") {
|
|
1943
|
+
keys.push(`${apiPrefix}:api:grpc:${node.method}:${node.grpcId}`);
|
|
1944
|
+
} else if (node.type === "graphql") {
|
|
1945
|
+
keys.push(`${apiPrefix}:api:graphql:${node.id}`);
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
const parentTitles = [];
|
|
1949
|
+
for (const p of uParents) {
|
|
1950
|
+
if (hasMetadata(p)) {
|
|
1951
|
+
parentTitles.push(p.title);
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
keys.push([...parentTitles, node.title].join("###"));
|
|
1955
|
+
return keys;
|
|
1956
|
+
}
|
|
1957
|
+
function buildVersionLandingPage(ctx, versionSegs, versionSlug) {
|
|
1958
|
+
const tablessSegs = versionSegs.filter((s) => s.seg.tab == null);
|
|
1959
|
+
if (tablessSegs.length === 0) {
|
|
1960
|
+
return void 0;
|
|
1961
|
+
}
|
|
1962
|
+
for (const s of tablessSegs) {
|
|
1963
|
+
for (const r of s.nav) {
|
|
1964
|
+
if (r.type === "markdown" && r.fullPath != null) {
|
|
1965
|
+
const md = r.metadata;
|
|
1966
|
+
const pageId = metaStr(md, "pageId") ?? "";
|
|
1967
|
+
const slug = ctx.contentSlug(r.fullPath);
|
|
1968
|
+
return {
|
|
1969
|
+
type: "landingPage",
|
|
1970
|
+
...withMetadataDefaults({
|
|
1971
|
+
id: ctx.nodeId(`landing:${slug}`),
|
|
1972
|
+
title: metaStr(md, "title") ?? "",
|
|
1973
|
+
slug,
|
|
1974
|
+
icon: metaStr(md, "icon"),
|
|
1975
|
+
hidden: r.hidden,
|
|
1976
|
+
viewers: toViewers(metaStrArr(md, "viewers"))
|
|
1977
|
+
}),
|
|
1978
|
+
pageId: PageId(pageId),
|
|
1979
|
+
noindex: metaBool(md, "noindex")
|
|
1980
|
+
};
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
return void 0;
|
|
1985
|
+
}
|
|
1986
|
+
function markCrossVersionCanonicalSlugs(versionNodes) {
|
|
1987
|
+
const keyToCanonical = /* @__PURE__ */ new Map();
|
|
1988
|
+
const sorted = [...versionNodes].sort((a, b) => {
|
|
1989
|
+
if (a.default !== b.default) {
|
|
1990
|
+
return a.default ? -1 : 1;
|
|
1991
|
+
}
|
|
1992
|
+
return 0;
|
|
1993
|
+
});
|
|
1994
|
+
for (const version of sorted) {
|
|
1995
|
+
traverseDF(version, (child, parents) => {
|
|
1996
|
+
if (hasMetadata(child) && isPage(child)) {
|
|
1997
|
+
const keys = crossVersionDedupKeys(child, parents);
|
|
1998
|
+
let matched = false;
|
|
1999
|
+
for (const key of keys) {
|
|
2000
|
+
const canonical = keyToCanonical.get(key);
|
|
2001
|
+
if (canonical != null && !version.default) {
|
|
2002
|
+
child.canonicalSlug = canonical;
|
|
2003
|
+
matched = true;
|
|
2004
|
+
break;
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
if (!matched) {
|
|
2008
|
+
const canonical = child.canonicalSlug ?? child.slug;
|
|
2009
|
+
for (const key of keys) {
|
|
2010
|
+
if (!keyToCanonical.has(key)) {
|
|
2011
|
+
keyToCanonical.set(key, canonical);
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
});
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
1828
2019
|
function buildProductGroup(ctx, products, scoped, rootSlug) {
|
|
1829
2020
|
const children = products.map((product) => {
|
|
1830
2021
|
const productSegs = scoped.filter((s) => s.seg.product?.id === product.id);
|