@fern-api/fdr-sdk 1.2.42-0c024f5b0d → 1.2.42-19c9e28733
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 +13 -0
- package/dist/js/client/FdrClient.js.map +1 -1
- package/dist/js/client/FdrClient.mjs +13 -0
- package/dist/js/client/FdrClient.mjs.map +1 -1
- package/dist/js/index.js +13 -0
- package/dist/js/index.js.map +1 -1
- package/dist/js/index.mjs +13 -0
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/navigation/ledger-root-builder.js +211 -39
- package/dist/js/navigation/ledger-root-builder.js.map +1 -1
- package/dist/js/navigation/ledger-root-builder.mjs +211 -39
- package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
- package/dist/js/orpc-client.js +60 -0
- package/dist/js/orpc-client.js.map +1 -1
- package/dist/js/orpc-client.mjs +59 -0
- package/dist/js/orpc-client.mjs.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js +267 -0
- package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js +306 -0
- package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js.map +1 -0
- 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.rootChildOrder.test.js +102 -0
- package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js.map +1 -1
- package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js +440 -0
- package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.js +234 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.js.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +2 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +1 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +510 -0
- package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +1 -0
- package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/navigation/ledger-root-builder.js +330 -45
- package/dist/navigation/ledger-root-builder.js.map +1 -1
- package/dist/orpc-client/docs-ledger/__test__/config-files.navFiles.test.d.ts +2 -0
- package/dist/orpc-client/docs-ledger/__test__/config-files.navFiles.test.d.ts.map +1 -0
- package/dist/orpc-client/docs-ledger/__test__/config-files.navFiles.test.js +153 -0
- package/dist/orpc-client/docs-ledger/__test__/config-files.navFiles.test.js.map +1 -0
- package/dist/orpc-client/docs-ledger/config-files.d.ts +8 -0
- package/dist/orpc-client/docs-ledger/config-files.d.ts.map +1 -1
- package/dist/orpc-client/docs-ledger/config-files.js +69 -0
- package/dist/orpc-client/docs-ledger/config-files.js.map +1 -1
- package/dist/orpc-client/docs-ledger/contract.d.ts +433 -28
- package/dist/orpc-client/docs-ledger/contract.d.ts.map +1 -1
- package/dist/orpc-client/docs-ledger/contract.js +15 -0
- package/dist/orpc-client/docs-ledger/contract.js.map +1 -1
- package/dist/orpc-client/docs-ledger/ledger-manifest.d.ts +92 -0
- package/dist/orpc-client/docs-ledger/ledger-manifest.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugGroupOrdering.test.d.ts.map +1 -0
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +2 -0
- package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +1 -0
- package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
- package/dist/types/orpc-client/docs-ledger/__test__/config-files.navFiles.test.d.ts +2 -0
- package/dist/types/orpc-client/docs-ledger/__test__/config-files.navFiles.test.d.ts.map +1 -0
- package/dist/types/orpc-client/docs-ledger/config-files.d.ts +8 -0
- package/dist/types/orpc-client/docs-ledger/config-files.d.ts.map +1 -1
- package/dist/types/orpc-client/docs-ledger/contract.d.ts +433 -28
- package/dist/types/orpc-client/docs-ledger/contract.d.ts.map +1 -1
- package/dist/types/orpc-client/docs-ledger/ledger-manifest.d.ts +92 -0
- package/dist/types/orpc-client/docs-ledger/ledger-manifest.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -92,6 +92,17 @@ var VersionIdSchema = z.string();
|
|
|
92
92
|
function VersionId(value) {
|
|
93
93
|
return value;
|
|
94
94
|
}
|
|
95
|
+
var Availability = {
|
|
96
|
+
Alpha: "Alpha",
|
|
97
|
+
Stable: "Stable",
|
|
98
|
+
GenerallyAvailable: "GenerallyAvailable",
|
|
99
|
+
InDevelopment: "InDevelopment",
|
|
100
|
+
PreRelease: "PreRelease",
|
|
101
|
+
Deprecated: "Deprecated",
|
|
102
|
+
Beta: "Beta",
|
|
103
|
+
Preview: "Preview",
|
|
104
|
+
Legacy: "Legacy"
|
|
105
|
+
};
|
|
95
106
|
var SnippetsByEndpointMethodSchema = z.record(
|
|
96
107
|
HttpMethodSchema,
|
|
97
108
|
z.array(z.unknown())
|
|
@@ -888,6 +899,35 @@ function metaStr(metadata, key) {
|
|
|
888
899
|
}
|
|
889
900
|
return void 0;
|
|
890
901
|
}
|
|
902
|
+
var AVAILABILITY_LOOKUP = {
|
|
903
|
+
// V1 lowercase values (stored by docsPublishTransform from V1 navigation tree)
|
|
904
|
+
alpha: Availability.Alpha,
|
|
905
|
+
stable: Availability.Stable,
|
|
906
|
+
"generally-available": Availability.GenerallyAvailable,
|
|
907
|
+
"in-development": Availability.InDevelopment,
|
|
908
|
+
"pre-release": Availability.PreRelease,
|
|
909
|
+
deprecated: Availability.Deprecated,
|
|
910
|
+
beta: Availability.Beta,
|
|
911
|
+
preview: Availability.Preview,
|
|
912
|
+
legacy: Availability.Legacy,
|
|
913
|
+
// Latest PascalCase values (pass-through)
|
|
914
|
+
Alpha: Availability.Alpha,
|
|
915
|
+
Stable: Availability.Stable,
|
|
916
|
+
GenerallyAvailable: Availability.GenerallyAvailable,
|
|
917
|
+
InDevelopment: Availability.InDevelopment,
|
|
918
|
+
PreRelease: Availability.PreRelease,
|
|
919
|
+
Deprecated: Availability.Deprecated,
|
|
920
|
+
Beta: Availability.Beta,
|
|
921
|
+
Preview: Availability.Preview,
|
|
922
|
+
Legacy: Availability.Legacy
|
|
923
|
+
};
|
|
924
|
+
function metaAvailability(metadata) {
|
|
925
|
+
const raw = metaStr(metadata, "availability");
|
|
926
|
+
if (raw == null) {
|
|
927
|
+
return void 0;
|
|
928
|
+
}
|
|
929
|
+
return AVAILABILITY_LOOKUP[raw];
|
|
930
|
+
}
|
|
891
931
|
function metaBool(metadata, key) {
|
|
892
932
|
if (metadata != null && typeof metadata === "object" && key in metadata) {
|
|
893
933
|
const v = metadata[key];
|
|
@@ -1005,7 +1045,7 @@ function artifactToNode(ctx, route) {
|
|
|
1005
1045
|
}),
|
|
1006
1046
|
pageId: PageId(pageId),
|
|
1007
1047
|
noindex: metaBool(md, "noindex"),
|
|
1008
|
-
availability:
|
|
1048
|
+
availability: metaAvailability(md)
|
|
1009
1049
|
};
|
|
1010
1050
|
return node;
|
|
1011
1051
|
}
|
|
@@ -1070,7 +1110,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1070
1110
|
endpointId: EndpointId(endpointId),
|
|
1071
1111
|
apiDefinitionId,
|
|
1072
1112
|
isResponseStream: metaBool(md, "isResponseStream"),
|
|
1073
|
-
availability:
|
|
1113
|
+
availability: metaAvailability(md),
|
|
1074
1114
|
playground: void 0
|
|
1075
1115
|
};
|
|
1076
1116
|
}
|
|
@@ -1086,7 +1126,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1086
1126
|
method,
|
|
1087
1127
|
webhookId: WebhookId(webhookId),
|
|
1088
1128
|
apiDefinitionId,
|
|
1089
|
-
availability:
|
|
1129
|
+
availability: metaAvailability(md)
|
|
1090
1130
|
};
|
|
1091
1131
|
}
|
|
1092
1132
|
if (route.type === "asyncapi") {
|
|
@@ -1099,7 +1139,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1099
1139
|
...meta,
|
|
1100
1140
|
webSocketId: WebSocketId(webSocketId),
|
|
1101
1141
|
apiDefinitionId,
|
|
1102
|
-
availability:
|
|
1142
|
+
availability: metaAvailability(md),
|
|
1103
1143
|
playground: void 0
|
|
1104
1144
|
};
|
|
1105
1145
|
}
|
|
@@ -1115,7 +1155,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1115
1155
|
method,
|
|
1116
1156
|
grpcId: GrpcId(grpcId),
|
|
1117
1157
|
apiDefinitionId,
|
|
1118
|
-
availability:
|
|
1158
|
+
availability: metaAvailability(md)
|
|
1119
1159
|
};
|
|
1120
1160
|
}
|
|
1121
1161
|
if (route.type === "graphql") {
|
|
@@ -1131,7 +1171,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
|
|
|
1131
1171
|
graphqlOperationId: GraphQlOperationId(graphqlOperationId),
|
|
1132
1172
|
graphqlOperationIds: void 0,
|
|
1133
1173
|
apiDefinitionId,
|
|
1134
|
-
availability:
|
|
1174
|
+
availability: metaAvailability(md),
|
|
1135
1175
|
playground: void 0
|
|
1136
1176
|
};
|
|
1137
1177
|
}
|
|
@@ -1260,6 +1300,30 @@ function stripLeadingScopePrefix(section, scopePrefix) {
|
|
|
1260
1300
|
}
|
|
1261
1301
|
return section;
|
|
1262
1302
|
}
|
|
1303
|
+
function computeDuplicateSiblingSortBoundaries(siblings) {
|
|
1304
|
+
const result = /* @__PURE__ */ new Map();
|
|
1305
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
1306
|
+
for (const sibling of siblings) {
|
|
1307
|
+
if (metaStr(sibling.seg.metadata, "type") !== "section") {
|
|
1308
|
+
continue;
|
|
1309
|
+
}
|
|
1310
|
+
const group = byPath.get(sibling.seg.section) ?? [];
|
|
1311
|
+
group.push(sibling);
|
|
1312
|
+
byPath.set(sibling.seg.section, group);
|
|
1313
|
+
}
|
|
1314
|
+
for (const [, group] of byPath) {
|
|
1315
|
+
if (group.length <= 1) {
|
|
1316
|
+
continue;
|
|
1317
|
+
}
|
|
1318
|
+
for (let i = 0; i < group.length; i++) {
|
|
1319
|
+
result.set(group[i], {
|
|
1320
|
+
lo: group[i].seg.sortOrder,
|
|
1321
|
+
hi: i + 1 < group.length ? group[i + 1].seg.sortOrder : Number.MAX_SAFE_INTEGER
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
return result;
|
|
1326
|
+
}
|
|
1263
1327
|
function mergeChildrenByPosition(ctx, nav, sectionChildren) {
|
|
1264
1328
|
const leafNodes = [];
|
|
1265
1329
|
for (let i = 0; i < nav.length; i++) {
|
|
@@ -1309,17 +1373,20 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
|
|
|
1309
1373
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1310
1374
|
collapsible: metaBool(seg.metadata, "collapsible") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
|
|
1311
1375
|
collapsedByDefault: metaBool(seg.metadata, "collapsedByDefault") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
|
|
1312
|
-
availability:
|
|
1376
|
+
availability: metaAvailability(seg.metadata),
|
|
1313
1377
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
1314
1378
|
children: mergeChildrenByPosition(ctx, nav, sectionChildren)
|
|
1315
1379
|
};
|
|
1316
1380
|
}
|
|
1317
|
-
function directChildApiPackages(parentSection, scopeSegs) {
|
|
1381
|
+
function directChildApiPackages(parentSection, scopeSegs, apiDefinitionId) {
|
|
1318
1382
|
const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
|
|
1319
1383
|
return scopeSegs.filter((s) => {
|
|
1320
1384
|
if (metaStr(s.seg.metadata, "type") !== "apiPackage") {
|
|
1321
1385
|
return false;
|
|
1322
1386
|
}
|
|
1387
|
+
if (metaStr(s.seg.metadata, "apiDefinitionId") !== apiDefinitionId) {
|
|
1388
|
+
return false;
|
|
1389
|
+
}
|
|
1323
1390
|
const parent = parentSectionPath(s.seg.section);
|
|
1324
1391
|
if (parent === parentSection) {
|
|
1325
1392
|
return true;
|
|
@@ -1333,7 +1400,17 @@ function directChildApiPackages(parentSection, scopeSegs) {
|
|
|
1333
1400
|
function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix) {
|
|
1334
1401
|
const { seg, nav } = scoped;
|
|
1335
1402
|
const leafNodes = positionedApiLeafChildren(ctx, nav, apiDefinitionId);
|
|
1336
|
-
|
|
1403
|
+
let childPackages = directChildApiPackages(seg.section, scopeSegs, apiDefinitionId);
|
|
1404
|
+
const samePathApiSiblings = scopeSegs.filter(
|
|
1405
|
+
(s) => s.seg.section === seg.section && s.seg.sortOrder !== seg.sortOrder && API_NODE_SEGMENT_TYPES.has(metaStr(s.seg.metadata, "type") ?? "")
|
|
1406
|
+
);
|
|
1407
|
+
const hasCollapsedGroups = samePathApiSiblings.length > 0;
|
|
1408
|
+
if (hasCollapsedGroups && metaStr(seg.metadata, "type") !== "apiReference") {
|
|
1409
|
+
const nextSibling = samePathApiSiblings.filter((s) => s.seg.sortOrder > seg.sortOrder).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder)[0];
|
|
1410
|
+
const lo = seg.sortOrder;
|
|
1411
|
+
const hi = nextSibling?.seg.sortOrder ?? Number.MAX_SAFE_INTEGER;
|
|
1412
|
+
childPackages = childPackages.filter((c) => c.seg.sortOrder > lo && c.seg.sortOrder < hi);
|
|
1413
|
+
}
|
|
1337
1414
|
const packageNodes = childPackages.map((child) => ({
|
|
1338
1415
|
node: apiPackageChildNode(
|
|
1339
1416
|
ctx,
|
|
@@ -1344,6 +1421,9 @@ function buildApiChildren(ctx, scoped, scopeSegs, apiDefinitionId, scopePrefix)
|
|
|
1344
1421
|
),
|
|
1345
1422
|
childIndex: metaNum(child.seg.metadata, "childIndex")
|
|
1346
1423
|
}));
|
|
1424
|
+
if (hasCollapsedGroups && metaStr(seg.metadata, "type") === "apiReference") {
|
|
1425
|
+
return [...leafNodes, ...packageNodes.map((p, i) => ({ node: p.node, pos: leafNodes.length + i }))].sort((a, b) => a.pos - b.pos).map((p) => p.node);
|
|
1426
|
+
}
|
|
1347
1427
|
const hasChildIndex = packageNodes.some((p) => p.childIndex != null);
|
|
1348
1428
|
if (!hasChildIndex) {
|
|
1349
1429
|
return [...leafNodes, ...packageNodes.map((p) => ({ node: p.node, pos: Number.MAX_SAFE_INTEGER }))].sort((a, b) => a.pos - b.pos).map((p) => p.node);
|
|
@@ -1383,7 +1463,7 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
|
|
|
1383
1463
|
featureFlags: metaFeatureFlags(seg.metadata)
|
|
1384
1464
|
}),
|
|
1385
1465
|
apiDefinitionId: ApiDefinitionId(apiDefinitionId),
|
|
1386
|
-
availability:
|
|
1466
|
+
availability: metaAvailability(seg.metadata),
|
|
1387
1467
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1388
1468
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1389
1469
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
@@ -1471,10 +1551,10 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
|
|
|
1471
1551
|
featureFlags: metaFeatureFlags(seg.metadata)
|
|
1472
1552
|
}),
|
|
1473
1553
|
apiDefinitionId: ApiDefinitionId(apiDefinitionId),
|
|
1474
|
-
availability:
|
|
1554
|
+
availability: metaAvailability(seg.metadata),
|
|
1475
1555
|
overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
|
|
1476
1556
|
noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
|
|
1477
|
-
paginated:
|
|
1557
|
+
paginated: metaBool(seg.metadata, "paginated"),
|
|
1478
1558
|
showErrors: metaBool(seg.metadata, "showErrors"),
|
|
1479
1559
|
hideTitle: metaBool(seg.metadata, "hideTitle"),
|
|
1480
1560
|
pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
|
|
@@ -1492,7 +1572,10 @@ function attachedApiChangelogNode(ctx, scoped, scopeSegs, apiDefinitionId, scope
|
|
|
1492
1572
|
}
|
|
1493
1573
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1494
1574
|
});
|
|
1495
|
-
const
|
|
1575
|
+
const apiReferenceCount = scopeSegs.filter((candidate) => {
|
|
1576
|
+
return metaStr(candidate.seg.metadata, "type") === "apiReference" && metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1577
|
+
}).length;
|
|
1578
|
+
const changelogSeg = candidates.find((candidate) => parentSectionPath(candidate.seg.section) === seg.section) ?? (apiReferenceCount === 1 ? candidates[0] : void 0);
|
|
1496
1579
|
return changelogSeg != null ? changelogNode(ctx, changelogSeg, scopePrefix) : void 0;
|
|
1497
1580
|
}
|
|
1498
1581
|
function hasOwningApiReference(scoped, scopeSegs) {
|
|
@@ -1500,12 +1583,13 @@ function hasOwningApiReference(scoped, scopeSegs) {
|
|
|
1500
1583
|
if (apiDefinitionId == null || metaStr(scoped.seg.metadata, "type") !== "changelog") {
|
|
1501
1584
|
return false;
|
|
1502
1585
|
}
|
|
1503
|
-
|
|
1586
|
+
const candidates = scopeSegs.filter((candidate) => {
|
|
1504
1587
|
if (metaStr(candidate.seg.metadata, "type") !== "apiReference") {
|
|
1505
1588
|
return false;
|
|
1506
1589
|
}
|
|
1507
1590
|
return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
|
|
1508
1591
|
});
|
|
1592
|
+
return candidates.some((candidate) => parentSectionPath(scoped.seg.section) === candidate.seg.section) || candidates.length === 1;
|
|
1509
1593
|
}
|
|
1510
1594
|
function isNestedApiPackage(scoped, scopeSegs) {
|
|
1511
1595
|
if (metaStr(scoped.seg.metadata, "type") !== "apiPackage") {
|
|
@@ -1642,6 +1726,13 @@ function nearestExistingAncestor(sectionPath, existing) {
|
|
|
1642
1726
|
}
|
|
1643
1727
|
function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScopePrefix) {
|
|
1644
1728
|
const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
|
|
1729
|
+
const parentCandidates = scopeSegs.filter((s) => s.seg.section === parentPath);
|
|
1730
|
+
const parentSeg = parentCandidates.length > 1 ? parentCandidates.reduce((best, cur) => {
|
|
1731
|
+
const bd = metaNum(best.seg.metadata, "sidebarDepth") ?? Number.MAX_SAFE_INTEGER;
|
|
1732
|
+
const cd = metaNum(cur.seg.metadata, "sidebarDepth") ?? Number.MAX_SAFE_INTEGER;
|
|
1733
|
+
return cd < bd ? cur : best;
|
|
1734
|
+
}) : parentCandidates[0];
|
|
1735
|
+
const parentDepth = parentSeg != null ? metaNum(parentSeg.seg.metadata, "sidebarDepth") : void 0;
|
|
1645
1736
|
const direct = scopeSegs.filter((s) => {
|
|
1646
1737
|
const sec = s.seg.section;
|
|
1647
1738
|
const type = metaStr(s.seg.metadata, "type");
|
|
@@ -1651,6 +1742,16 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1651
1742
|
if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
|
|
1652
1743
|
return false;
|
|
1653
1744
|
}
|
|
1745
|
+
const depth = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1746
|
+
if (depth === 0) {
|
|
1747
|
+
return false;
|
|
1748
|
+
}
|
|
1749
|
+
if (sec === parentPath && s !== parentSeg && depth != null && parentDepth != null && depth > parentDepth) {
|
|
1750
|
+
return true;
|
|
1751
|
+
}
|
|
1752
|
+
if (parentDepth != null && depth != null && depth <= parentDepth) {
|
|
1753
|
+
return false;
|
|
1754
|
+
}
|
|
1654
1755
|
const parent = parentSectionPath(sec);
|
|
1655
1756
|
if (parent === parentPath) {
|
|
1656
1757
|
return true;
|
|
@@ -1660,6 +1761,7 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1660
1761
|
}
|
|
1661
1762
|
return false;
|
|
1662
1763
|
}).sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
|
|
1764
|
+
const siblingBoundaries = computeDuplicateSiblingSortBoundaries(direct);
|
|
1663
1765
|
return direct.map((s) => {
|
|
1664
1766
|
const type = metaStr(s.seg.metadata, "type");
|
|
1665
1767
|
const childIndex = metaNum(s.seg.metadata, "childIndex");
|
|
@@ -1669,12 +1771,21 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
|
|
|
1669
1771
|
} else if (type === "changelog") {
|
|
1670
1772
|
node = changelogNode(ctx, s, changelogScopePrefix ?? scopePrefix);
|
|
1671
1773
|
} else {
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
s,
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1774
|
+
const isSkipSlugChild = s.seg.section === parentPath;
|
|
1775
|
+
if (isSkipSlugChild) {
|
|
1776
|
+
node = sectionNode(ctx, s, [], scopePrefix);
|
|
1777
|
+
} else {
|
|
1778
|
+
const boundary = siblingBoundaries.get(s);
|
|
1779
|
+
const childScopeSegs = boundary != null ? scopeSegs.filter(
|
|
1780
|
+
(candidate) => candidate.seg.sortOrder >= boundary.lo && candidate.seg.sortOrder < boundary.hi
|
|
1781
|
+
) : scopeSegs;
|
|
1782
|
+
node = sectionNode(
|
|
1783
|
+
ctx,
|
|
1784
|
+
s,
|
|
1785
|
+
buildSectionTree(ctx, childScopeSegs, s.seg.section, scopePrefix, changelogScopePrefix),
|
|
1786
|
+
scopePrefix
|
|
1787
|
+
);
|
|
1788
|
+
}
|
|
1678
1789
|
}
|
|
1679
1790
|
return { node, childIndex };
|
|
1680
1791
|
});
|
|
@@ -1686,17 +1797,32 @@ function computeSiblingSortBoundaries(ordered) {
|
|
|
1686
1797
|
for (const s of ordered) {
|
|
1687
1798
|
const type = metaStr(s.seg.metadata, "type");
|
|
1688
1799
|
const sec = s.seg.section;
|
|
1689
|
-
if (type !== "section"
|
|
1800
|
+
if (type !== "section") {
|
|
1690
1801
|
continue;
|
|
1691
1802
|
}
|
|
1803
|
+
if (sec === "") {
|
|
1804
|
+
rootSections.push(s);
|
|
1805
|
+
continue;
|
|
1806
|
+
}
|
|
1807
|
+
const depth = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1692
1808
|
const parent = parentSectionPath(sec);
|
|
1693
|
-
const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1809
|
+
const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1694
1810
|
if (isRootLevel) {
|
|
1695
1811
|
rootSections.push(s);
|
|
1696
1812
|
}
|
|
1697
1813
|
}
|
|
1698
|
-
const
|
|
1814
|
+
const depth0Paths = /* @__PURE__ */ new Set();
|
|
1699
1815
|
for (const s of rootSections) {
|
|
1816
|
+
if (metaNum(s.seg.metadata, "sidebarDepth") === 0) {
|
|
1817
|
+
depth0Paths.add(s.seg.section);
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
const effectiveRootSections = rootSections.filter((s) => {
|
|
1821
|
+
const d = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1822
|
+
return d === 0 || d == null || !depth0Paths.has(s.seg.section);
|
|
1823
|
+
});
|
|
1824
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
1825
|
+
for (const s of effectiveRootSections) {
|
|
1700
1826
|
const group = byPath.get(s.seg.section) ?? [];
|
|
1701
1827
|
group.push(s);
|
|
1702
1828
|
byPath.set(s.seg.section, group);
|
|
@@ -1717,14 +1843,30 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1717
1843
|
const ordered = [...scopeSegs].sort((a, b) => a.seg.sortOrder - b.seg.sortOrder);
|
|
1718
1844
|
const sectionPaths = new Set(ordered.map((s) => s.seg.section));
|
|
1719
1845
|
const annotated = [];
|
|
1720
|
-
const hasRootSection = ordered.some((s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "");
|
|
1721
1846
|
const siblingBoundaries = computeSiblingSortBoundaries(ordered);
|
|
1847
|
+
const hasRootSection = ordered.some(
|
|
1848
|
+
(s) => metaStr(s.seg.metadata, "type") === "section" && s.seg.section === "" && (metaNum(s.seg.metadata, "childIndex") == null || siblingBoundaries.has(s))
|
|
1849
|
+
);
|
|
1850
|
+
const depth0SectionPaths = /* @__PURE__ */ new Set();
|
|
1851
|
+
for (const s of ordered) {
|
|
1852
|
+
if (metaStr(s.seg.metadata, "type") === "section" && metaNum(s.seg.metadata, "sidebarDepth") === 0) {
|
|
1853
|
+
depth0SectionPaths.add(s.seg.section);
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1722
1856
|
for (const s of ordered) {
|
|
1723
1857
|
const type = metaStr(s.seg.metadata, "type");
|
|
1724
1858
|
const sec = s.seg.section;
|
|
1725
1859
|
if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
|
|
1726
1860
|
continue;
|
|
1727
1861
|
}
|
|
1862
|
+
if (type === "apiPackage") {
|
|
1863
|
+
const hasApiRefSibling = ordered.some(
|
|
1864
|
+
(sib) => sib.seg.section === sec && metaStr(sib.seg.metadata, "type") === "apiReference"
|
|
1865
|
+
);
|
|
1866
|
+
if (hasApiRefSibling) {
|
|
1867
|
+
continue;
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1728
1870
|
if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {
|
|
1729
1871
|
continue;
|
|
1730
1872
|
}
|
|
@@ -1737,15 +1879,21 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1737
1879
|
}
|
|
1738
1880
|
continue;
|
|
1739
1881
|
}
|
|
1740
|
-
if (type === "section" && sec === "") {
|
|
1741
|
-
const
|
|
1882
|
+
if (type === "section" && sec === "" && hasRootSection) {
|
|
1883
|
+
const bounds = siblingBoundaries.get(s);
|
|
1884
|
+
const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
|
|
1885
|
+
const sectionChildren = buildSectionTree(ctx, ownedSegs, "", scopePrefix, changelogScopePrefix);
|
|
1742
1886
|
const node = sectionNode(ctx, s, sectionChildren, scopePrefix);
|
|
1743
1887
|
annotated.push({ node, pos: metaNum(s.seg.metadata, "childIndex"), isLeaf: false });
|
|
1744
1888
|
continue;
|
|
1745
1889
|
}
|
|
1890
|
+
const depth = metaNum(s.seg.metadata, "sidebarDepth");
|
|
1746
1891
|
const parent = parentSectionPath(sec);
|
|
1747
|
-
const isRootLevel = parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1748
|
-
if (isRootLevel && hasRootSection && sec !== "") {
|
|
1892
|
+
const isRootLevel = depth === 0 || parent === "" || !sectionPaths.has(parent) && nearestExistingAncestor(sec, sectionPaths) === "";
|
|
1893
|
+
if (isRootLevel && hasRootSection && sec !== "" && depth !== 0) {
|
|
1894
|
+
continue;
|
|
1895
|
+
}
|
|
1896
|
+
if (isRootLevel && depth != null && depth > 0 && depth0SectionPaths.has(sec)) {
|
|
1749
1897
|
continue;
|
|
1750
1898
|
}
|
|
1751
1899
|
if (isRootLevel) {
|
|
@@ -1757,12 +1905,13 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
|
|
|
1757
1905
|
} else {
|
|
1758
1906
|
const bounds = siblingBoundaries.get(s);
|
|
1759
1907
|
const ownedSegs = bounds != null ? scopeSegs.filter((seg) => seg.seg.sortOrder >= bounds.lo && seg.seg.sortOrder < bounds.hi) : scopeSegs;
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
);
|
|
1908
|
+
const isUnboundedSkipSlugSibling = sec === "" && metaNum(s.seg.metadata, "childIndex") != null && bounds == null;
|
|
1909
|
+
const hasDepthMarkedChildren = isUnboundedSkipSlugSibling && ownedSegs.some((candidate) => {
|
|
1910
|
+
const d = metaNum(candidate.seg.metadata, "sidebarDepth");
|
|
1911
|
+
return d != null && d > 0 && parentSectionPath(candidate.seg.section) === sec;
|
|
1912
|
+
});
|
|
1913
|
+
const sectionChildren = isUnboundedSkipSlugSibling && !hasDepthMarkedChildren ? [] : buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix);
|
|
1914
|
+
node = sectionNode(ctx, s, sectionChildren, scopePrefix);
|
|
1766
1915
|
}
|
|
1767
1916
|
const isSharedSection = siblingBoundaries.size > 0 && scopePrefix !== "" && sec !== "" && !sec.startsWith(scopePrefix);
|
|
1768
1917
|
annotated.push({
|
|
@@ -1800,10 +1949,6 @@ function groupSidebarRootChildren(ctx, children) {
|
|
|
1800
1949
|
} else if (child.type === "section" && !child.collapsible) {
|
|
1801
1950
|
flushRun();
|
|
1802
1951
|
out.push(child);
|
|
1803
|
-
} else if (child.type === "changelog") {
|
|
1804
|
-
flushRun();
|
|
1805
|
-
run.push(child);
|
|
1806
|
-
flushRun();
|
|
1807
1952
|
} else {
|
|
1808
1953
|
run.push(child);
|
|
1809
1954
|
}
|
|
@@ -1918,7 +2063,7 @@ function buildVariantedNode(ctx, variants, scopeSegs, scopePrefix) {
|
|
|
1918
2063
|
const variantIndividualSlug = detailSlug(variant);
|
|
1919
2064
|
const variantSlug = variantIndividualSlug !== "" ? asSlug(slugjoin(scopePrefix, variantIndividualSlug)) : scopePrefix;
|
|
1920
2065
|
const metaPointsTo = metaStr(variant.metadata, "pointsTo");
|
|
1921
|
-
const children = buildSidebarRootChildren(ctx, variantSegs,
|
|
2066
|
+
const children = buildSidebarRootChildren(ctx, variantSegs, variantSlug);
|
|
1922
2067
|
return {
|
|
1923
2068
|
type: "variant",
|
|
1924
2069
|
...withMetadataDefaults({
|
|
@@ -2320,6 +2465,7 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
|
|
|
2320
2465
|
};
|
|
2321
2466
|
return node;
|
|
2322
2467
|
});
|
|
2468
|
+
markCrossProductCanonicalSlugs(children);
|
|
2323
2469
|
return {
|
|
2324
2470
|
type: "productgroup",
|
|
2325
2471
|
id: ctx.nodeId("productgroup"),
|
|
@@ -2331,6 +2477,32 @@ function buildProductGroup(ctx, products, scoped, rootSlug, skipSharedSectionMer
|
|
|
2331
2477
|
children
|
|
2332
2478
|
};
|
|
2333
2479
|
}
|
|
2480
|
+
function markCrossProductCanonicalSlugs(productNodes) {
|
|
2481
|
+
const pageIdToCanonical = /* @__PURE__ */ new Map();
|
|
2482
|
+
const sorted = [...productNodes].sort((a, b) => {
|
|
2483
|
+
if (a.default !== b.default) {
|
|
2484
|
+
return a.default ? -1 : 1;
|
|
2485
|
+
}
|
|
2486
|
+
return 0;
|
|
2487
|
+
});
|
|
2488
|
+
for (const product of sorted) {
|
|
2489
|
+
traverseDF(product, (child) => {
|
|
2490
|
+
if (hasMetadata(child) && isPage(child)) {
|
|
2491
|
+
const pid = getPageId(child);
|
|
2492
|
+
if (pid == null) {
|
|
2493
|
+
return;
|
|
2494
|
+
}
|
|
2495
|
+
const key = `pid:${pid}`;
|
|
2496
|
+
const canonical = pageIdToCanonical.get(key);
|
|
2497
|
+
if (canonical != null && !product.default) {
|
|
2498
|
+
child.canonicalSlug = canonical;
|
|
2499
|
+
} else if (canonical == null) {
|
|
2500
|
+
pageIdToCanonical.set(key, child.canonicalSlug ?? child.slug);
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2334
2506
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2335
2507
|
0 && (module.exports = {
|
|
2336
2508
|
apiLeafNodeFromNavRoute,
|