@fern-api/fdr-sdk 1.2.42-6d01f91096 → 1.2.42-b174eece86
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/converters/index.js +9 -0
- package/dist/js/converters/index.js.map +1 -1
- package/dist/js/converters/index.mjs +9 -0
- package/dist/js/converters/index.mjs.map +1 -1
- package/dist/js/index.js +9 -0
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.mjs +9 -0
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/navigation/index.js +9 -0
- package/dist/js/navigation/index.js.map +1 -1
- package/dist/js/navigation/index.mjs +9 -0
- package/dist/js/navigation/index.mjs.map +1 -1
- package/dist/js/navigation/ledger-root-builder.js +97 -12
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +97 -12
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js +109 -4
- package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.js +276 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.js.map +1 -1
- package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/navigation/ledger-root-builder.js +103 -12
- package/dist/navigation/ledger-root-builder.js.map +1 -1
- package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts +2 -0
- package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +1 -0
- package/dist/navigation/utils/__test__/syntheticSectionPath.test.js +29 -0
- package/dist/navigation/utils/__test__/syntheticSectionPath.test.js.map +1 -0
- package/dist/navigation/utils/index.d.ts +1 -0
- package/dist/navigation/utils/index.d.ts.map +1 -1
- package/dist/navigation/utils/index.js +1 -0
- package/dist/navigation/utils/index.js.map +1 -1
- package/dist/navigation/utils/syntheticSectionPath.d.ts +13 -0
- package/dist/navigation/utils/syntheticSectionPath.d.ts.map +1 -0
- package/dist/navigation/utils/syntheticSectionPath.js +20 -0
- package/dist/navigation/utils/syntheticSectionPath.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts +2 -0
- package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +1 -0
- package/dist/types/navigation/utils/index.d.ts +1 -0
- package/dist/types/navigation/utils/index.d.ts.map +1 -1
- package/dist/types/navigation/utils/syntheticSectionPath.d.ts +13 -0
- package/dist/types/navigation/utils/syntheticSectionPath.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -51,6 +51,17 @@ var VersionIdSchema = z.string();
|
|
|
51
51
|
function VersionId(value) {
|
|
52
52
|
return value;
|
|
53
53
|
}
|
|
54
|
+
var Availability = {
|
|
55
|
+
Alpha: "Alpha",
|
|
56
|
+
Stable: "Stable",
|
|
57
|
+
GenerallyAvailable: "GenerallyAvailable",
|
|
58
|
+
InDevelopment: "InDevelopment",
|
|
59
|
+
PreRelease: "PreRelease",
|
|
60
|
+
Deprecated: "Deprecated",
|
|
61
|
+
Beta: "Beta",
|
|
62
|
+
Preview: "Preview",
|
|
63
|
+
Legacy: "Legacy"
|
|
64
|
+
};
|
|
54
65
|
var SnippetsByEndpointMethodSchema = z.record(
|
|
55
66
|
HttpMethodSchema,
|
|
56
67
|
z.array(z.unknown())
|
|
@@ -804,6 +815,12 @@ function traverseDF(node, visit) {
|
|
|
804
815
|
return dfs(node, visit, getChildren);
|
|
805
816
|
}
|
|
806
817
|
|
|
818
|
+
// src/navigation/utils/syntheticSectionPath.ts
|
|
819
|
+
var SYNTHETIC_SEGMENT_RE = /^~\d+$/;
|
|
820
|
+
function stripSyntheticSegments(section) {
|
|
821
|
+
return section.split("/").filter((part) => !SYNTHETIC_SEGMENT_RE.test(part)).join("/");
|
|
822
|
+
}
|
|
823
|
+
|
|
807
824
|
// src/navigation/ledger-root-builder.ts
|
|
808
825
|
var STRUCTURAL_SEGMENT_TYPES = /* @__PURE__ */ new Set([
|
|
809
826
|
"section",
|
|
@@ -841,6 +858,35 @@ function metaStr(metadata, key) {
|
|
|
841
858
|
}
|
|
842
859
|
return void 0;
|
|
843
860
|
}
|
|
861
|
+
var AVAILABILITY_LOOKUP = {
|
|
862
|
+
// V1 lowercase values (stored by docsPublishTransform from V1 navigation tree)
|
|
863
|
+
alpha: Availability.Alpha,
|
|
864
|
+
stable: Availability.Stable,
|
|
865
|
+
"generally-available": Availability.GenerallyAvailable,
|
|
866
|
+
"in-development": Availability.InDevelopment,
|
|
867
|
+
"pre-release": Availability.PreRelease,
|
|
868
|
+
deprecated: Availability.Deprecated,
|
|
869
|
+
beta: Availability.Beta,
|
|
870
|
+
preview: Availability.Preview,
|
|
871
|
+
legacy: Availability.Legacy,
|
|
872
|
+
// Latest PascalCase values (pass-through)
|
|
873
|
+
Alpha: Availability.Alpha,
|
|
874
|
+
Stable: Availability.Stable,
|
|
875
|
+
GenerallyAvailable: Availability.GenerallyAvailable,
|
|
876
|
+
InDevelopment: Availability.InDevelopment,
|
|
877
|
+
PreRelease: Availability.PreRelease,
|
|
878
|
+
Deprecated: Availability.Deprecated,
|
|
879
|
+
Beta: Availability.Beta,
|
|
880
|
+
Preview: Availability.Preview,
|
|
881
|
+
Legacy: Availability.Legacy
|
|
882
|
+
};
|
|
883
|
+
function metaAvailability(metadata) {
|
|
884
|
+
const raw = metaStr(metadata, "availability");
|
|
885
|
+
if (raw == null) {
|
|
886
|
+
return void 0;
|
|
887
|
+
}
|
|
888
|
+
return AVAILABILITY_LOOKUP[raw];
|
|
889
|
+
}
|
|
844
890
|
function metaBool(metadata, key) {
|
|
845
891
|
if (metadata != null && typeof metadata === "object" && key in metadata) {
|
|
846
892
|
const v = metadata[key];
|
|
@@ -958,7 +1004,7 @@ function artifactToNode(ctx, route) {
|
|
|
958
1004
|
}),
|
|
959
1005
|
pageId: PageId(pageId),
|
|
960
1006
|
noindex: metaBool(md, "noindex"),
|
|
961
|
-
availability:
|
|
1007
|
+
availability: metaAvailability(md)
|
|
962
1008
|
};
|
|
963
1009
|
return node;
|
|
964
1010
|
}
|
|
@@ -1023,7 +1069,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1023
1069
|
endpointId: EndpointId(endpointId),
|
|
1024
1070
|
apiDefinitionId,
|
|
1025
1071
|
isResponseStream: metaBool(md, "isResponseStream"),
|
|
1026
|
-
availability:
|
|
1072
|
+
availability: metaAvailability(md),
|
|
1027
1073
|
playground: void 0
|
|
1028
1074
|
};
|
|
1029
1075
|
}
|
|
@@ -1039,7 +1085,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1039
1085
|
method,
|
|
1040
1086
|
webhookId: WebhookId(webhookId),
|
|
1041
1087
|
apiDefinitionId,
|
|
1042
|
-
availability:
|
|
1088
|
+
availability: metaAvailability(md)
|
|
1043
1089
|
};
|
|
1044
1090
|
}
|
|
1045
1091
|
if (route.type === "asyncapi") {
|
|
@@ -1052,7 +1098,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1052
1098
|
...meta,
|
|
1053
1099
|
webSocketId: WebSocketId(webSocketId),
|
|
1054
1100
|
apiDefinitionId,
|
|
1055
|
-
availability:
|
|
1101
|
+
availability: metaAvailability(md),
|
|
1056
1102
|
playground: void 0
|
|
1057
1103
|
};
|
|
1058
1104
|
}
|
|
@@ -1068,7 +1114,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1068
1114
|
method,
|
|
1069
1115
|
grpcId: GrpcId(grpcId),
|
|
1070
1116
|
apiDefinitionId,
|
|
1071
|
-
availability:
|
|
1117
|
+
availability: metaAvailability(md)
|
|
1072
1118
|
};
|
|
1073
1119
|
}
|
|
1074
1120
|
if (route.type === "graphql") {
|
|
@@ -1084,7 +1130,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1084
1130
|
graphqlOperationId: GraphQlOperationId(graphqlOperationId),
|
|
1085
1131
|
graphqlOperationIds: void 0,
|
|
1086
1132
|
apiDefinitionId,
|
|
1087
|
-
availability:
|
|
1133
|
+
availability: metaAvailability(md),
|
|
1088
1134
|
playground: void 0
|
|
1089
1135
|
};
|
|
1090
1136
|
}
|
|
@@ -1197,7 +1243,8 @@ function structuralNodeSlug(ctx, overviewFullPath, section, scopePrefix) {
|
|
|
1197
1243
|
if (overviewFullPath != null) {
|
|
1198
1244
|
return ctx.contentSlug(overviewFullPath);
|
|
1199
1245
|
}
|
|
1200
|
-
|
|
1246
|
+
const cleanSection = stripSyntheticSegments(section);
|
|
1247
|
+
return cleanSection !== "" ? slugjoin(scopePrefix, cleanSection) : scopePrefix;
|
|
1201
1248
|
}
|
|
1202
1249
|
function stripLeadingScopePrefix(section, scopePrefix) {
|
|
1203
1250
|
const prefix = scopePrefix;
|
|
@@ -1261,7 +1308,7 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
|
|
|
1261
1308
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1262
1309
|
collapsible: metaBool(seg.metadata, "collapsible") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
|
|
1263
1310
|
collapsedByDefault: metaBool(seg.metadata, "collapsedByDefault") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
|
|
1264
|
-
availability:
|
|
1311
|
+
availability: metaAvailability(seg.metadata),
|
|
1265
1312
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
1266
1313
|
children: mergeChildrenByPosition(ctx, nav, sectionChildren)
|
|
1267
1314
|
};
|
|
@@ -1335,7 +1382,7 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
|
|
|
1335
1382
|
featureFlags: metaFeatureFlags(seg.metadata)
|
|
1336
1383
|
}),
|
|
1337
1384
|
apiDefinitionId: ApiDefinitionId(apiDefinitionId),
|
|
1338
|
-
availability:
|
|
1385
|
+
availability: metaAvailability(seg.metadata),
|
|
1339
1386
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1340
1387
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1341
1388
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
@@ -1423,7 +1470,7 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
|
|
|
1423
1470
|
featureFlags: metaFeatureFlags(seg.metadata)
|
|
1424
1471
|
}),
|
|
1425
1472
|
apiDefinitionId: ApiDefinitionId(apiDefinitionId),
|
|
1426
|
-
availability:
|
|
1473
|
+
availability: metaAvailability(seg.metadata),
|
|
1427
1474
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1428
1475
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1429
1476
|
paginated: true,
|
|
@@ -1459,6 +1506,44 @@ function hasOwningApiReference(scoped, scopeSegs) {
|
|
|
1459
1506
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1460
1507
|
});
|
|
1461
1508
|
}
|
|
1509
|
+
function isNestedApiPackage(scoped, scopeSegs) {
|
|
1510
|
+
if (metaStr(scoped.seg.metadata, "type") !== "apiPackage") {
|
|
1511
|
+
return false;
|
|
1512
|
+
}
|
|
1513
|
+
const apiDefinitionId = metaStr(scoped.seg.metadata, "apiDefinitionId");
|
|
1514
|
+
if (apiDefinitionId == null) {
|
|
1515
|
+
return false;
|
|
1516
|
+
}
|
|
1517
|
+
const apiReferenceSections = new Set(
|
|
1518
|
+
scopeSegs.filter(
|
|
1519
|
+
(s) => metaStr(s.seg.metadata, "type") === "apiReference" && metaStr(s.seg.metadata, "apiDefinitionId") === apiDefinitionId
|
|
1520
|
+
).map((s) => s.seg.section)
|
|
1521
|
+
);
|
|
1522
|
+
if (apiReferenceSections.size === 0) {
|
|
1523
|
+
return false;
|
|
1524
|
+
}
|
|
1525
|
+
const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
|
|
1526
|
+
const resolveParent = (section) => {
|
|
1527
|
+
const parent = parentSectionPath(section);
|
|
1528
|
+
if (parent === "" || sectionPaths.has(parent)) {
|
|
1529
|
+
return parent;
|
|
1530
|
+
}
|
|
1531
|
+
return nearestExistingAncestor(section, sectionPaths);
|
|
1532
|
+
};
|
|
1533
|
+
let current = scoped.seg.section;
|
|
1534
|
+
const seen = /* @__PURE__ */ new Set([current]);
|
|
1535
|
+
for (; ; ) {
|
|
1536
|
+
const parent = resolveParent(current);
|
|
1537
|
+
if (apiReferenceSections.has(parent)) {
|
|
1538
|
+
return true;
|
|
1539
|
+
}
|
|
1540
|
+
if (parent === "" || seen.has(parent)) {
|
|
1541
|
+
return false;
|
|
1542
|
+
}
|
|
1543
|
+
seen.add(parent);
|
|
1544
|
+
current = parent;
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1462
1547
|
function changelogNode(ctx, scoped, scopePrefix) {
|
|
1463
1548
|
const { seg, nav } = scoped;
|
|
1464
1549
|
const overview = overviewRoute(nav);
|
|
@@ -1562,7 +1647,7 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1562
1647
|
if (sec === "" || type === "tabRoot") {
|
|
1563
1648
|
return false;
|
|
1564
1649
|
}
|
|
1565
|
-
if (hasOwningApiReference(s, scopeSegs)) {
|
|
1650
|
+
if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
|
|
1566
1651
|
return false;
|
|
1567
1652
|
}
|
|
1568
1653
|
const parent = parentSectionPath(sec);
|
|
@@ -1636,7 +1721,7 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1636
1721
|
for (const s of ordered) {
|
|
1637
1722
|
const type = metaStr(s.seg.metadata, "type");
|
|
1638
1723
|
const sec = s.seg.section;
|
|
1639
|
-
if (hasOwningApiReference(s, scopeSegs)) {
|
|
1724
|
+
if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
|
|
1640
1725
|
continue;
|
|
1641
1726
|
}
|
|
1642
1727
|
if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {
|