@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.
Files changed (44) hide show
  1. package/dist/js/converters/index.js +9 -0
  2. package/dist/js/converters/index.js.map +1 -1
  3. package/dist/js/converters/index.mjs +9 -0
  4. package/dist/js/converters/index.mjs.map +1 -1
  5. package/dist/js/index.js +9 -0
  6. package/dist/js/index.js.map +1 -1
  7. package/dist/js/index.mjs +9 -0
  8. package/dist/js/index.mjs.map +1 -1
  9. package/dist/js/navigation/index.js +9 -0
  10. package/dist/js/navigation/index.js.map +1 -1
  11. package/dist/js/navigation/index.mjs +9 -0
  12. package/dist/js/navigation/index.mjs.map +1 -1
  13. package/dist/js/navigation/ledger-root-builder.js +97 -12
  14. package/dist/js/navigation/ledger-root-builder.js.map +1 -1
  15. package/dist/js/navigation/ledger-root-builder.mjs +97 -12
  16. package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
  17. package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js +109 -4
  18. package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js.map +1 -1
  19. package/dist/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.js +276 -0
  20. package/dist/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.js.map +1 -1
  21. package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
  22. package/dist/navigation/ledger-root-builder.js +103 -12
  23. package/dist/navigation/ledger-root-builder.js.map +1 -1
  24. package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts +2 -0
  25. package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +1 -0
  26. package/dist/navigation/utils/__test__/syntheticSectionPath.test.js +29 -0
  27. package/dist/navigation/utils/__test__/syntheticSectionPath.test.js.map +1 -0
  28. package/dist/navigation/utils/index.d.ts +1 -0
  29. package/dist/navigation/utils/index.d.ts.map +1 -1
  30. package/dist/navigation/utils/index.js +1 -0
  31. package/dist/navigation/utils/index.js.map +1 -1
  32. package/dist/navigation/utils/syntheticSectionPath.d.ts +13 -0
  33. package/dist/navigation/utils/syntheticSectionPath.d.ts.map +1 -0
  34. package/dist/navigation/utils/syntheticSectionPath.js +20 -0
  35. package/dist/navigation/utils/syntheticSectionPath.js.map +1 -0
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
  38. package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts +2 -0
  39. package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +1 -0
  40. package/dist/types/navigation/utils/index.d.ts +1 -0
  41. package/dist/types/navigation/utils/index.d.ts.map +1 -1
  42. package/dist/types/navigation/utils/syntheticSectionPath.d.ts +13 -0
  43. package/dist/types/navigation/utils/syntheticSectionPath.d.ts.map +1 -0
  44. 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())
@@ -845,6 +856,12 @@ function traverseDF(node, visit) {
845
856
  return dfs(node, visit, getChildren);
846
857
  }
847
858
 
859
+ // src/navigation/utils/syntheticSectionPath.ts
860
+ var SYNTHETIC_SEGMENT_RE = /^~\d+$/;
861
+ function stripSyntheticSegments(section) {
862
+ return section.split("/").filter((part) => !SYNTHETIC_SEGMENT_RE.test(part)).join("/");
863
+ }
864
+
848
865
  // src/navigation/ledger-root-builder.ts
849
866
  var STRUCTURAL_SEGMENT_TYPES = /* @__PURE__ */ new Set([
850
867
  "section",
@@ -882,6 +899,35 @@ function metaStr(metadata, key) {
882
899
  }
883
900
  return void 0;
884
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
+ }
885
931
  function metaBool(metadata, key) {
886
932
  if (metadata != null && typeof metadata === "object" && key in metadata) {
887
933
  const v = metadata[key];
@@ -999,7 +1045,7 @@ function artifactToNode(ctx, route) {
999
1045
  }),
1000
1046
  pageId: PageId(pageId),
1001
1047
  noindex: metaBool(md, "noindex"),
1002
- availability: metaStr(md, "availability")
1048
+ availability: metaAvailability(md)
1003
1049
  };
1004
1050
  return node;
1005
1051
  }
@@ -1064,7 +1110,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1064
1110
  endpointId: EndpointId(endpointId),
1065
1111
  apiDefinitionId,
1066
1112
  isResponseStream: metaBool(md, "isResponseStream"),
1067
- availability: metaStr(md, "availability"),
1113
+ availability: metaAvailability(md),
1068
1114
  playground: void 0
1069
1115
  };
1070
1116
  }
@@ -1080,7 +1126,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1080
1126
  method,
1081
1127
  webhookId: WebhookId(webhookId),
1082
1128
  apiDefinitionId,
1083
- availability: metaStr(md, "availability")
1129
+ availability: metaAvailability(md)
1084
1130
  };
1085
1131
  }
1086
1132
  if (route.type === "asyncapi") {
@@ -1093,7 +1139,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1093
1139
  ...meta,
1094
1140
  webSocketId: WebSocketId(webSocketId),
1095
1141
  apiDefinitionId,
1096
- availability: metaStr(md, "availability"),
1142
+ availability: metaAvailability(md),
1097
1143
  playground: void 0
1098
1144
  };
1099
1145
  }
@@ -1109,7 +1155,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1109
1155
  method,
1110
1156
  grpcId: GrpcId(grpcId),
1111
1157
  apiDefinitionId,
1112
- availability: metaStr(md, "availability")
1158
+ availability: metaAvailability(md)
1113
1159
  };
1114
1160
  }
1115
1161
  if (route.type === "graphql") {
@@ -1125,7 +1171,7 @@ function apiLeafNodeFromNavRouteInternal(ctx, route, segmentApiDefinitionId2) {
1125
1171
  graphqlOperationId: GraphQlOperationId(graphqlOperationId),
1126
1172
  graphqlOperationIds: void 0,
1127
1173
  apiDefinitionId,
1128
- availability: metaStr(md, "availability"),
1174
+ availability: metaAvailability(md),
1129
1175
  playground: void 0
1130
1176
  };
1131
1177
  }
@@ -1238,7 +1284,8 @@ function structuralNodeSlug(ctx, overviewFullPath, section, scopePrefix) {
1238
1284
  if (overviewFullPath != null) {
1239
1285
  return ctx.contentSlug(overviewFullPath);
1240
1286
  }
1241
- return section !== "" ? slugjoin(scopePrefix, section) : scopePrefix;
1287
+ const cleanSection = stripSyntheticSegments(section);
1288
+ return cleanSection !== "" ? slugjoin(scopePrefix, cleanSection) : scopePrefix;
1242
1289
  }
1243
1290
  function stripLeadingScopePrefix(section, scopePrefix) {
1244
1291
  const prefix = scopePrefix;
@@ -1302,7 +1349,7 @@ function sectionNode(ctx, scoped, sectionChildren, scopePrefix) {
1302
1349
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1303
1350
  collapsible: metaBool(seg.metadata, "collapsible") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
1304
1351
  collapsedByDefault: metaBool(seg.metadata, "collapsedByDefault") ?? (metaCollapsed(seg.metadata) === true ? true : void 0),
1305
- availability: metaStr(seg.metadata, "availability"),
1352
+ availability: metaAvailability(seg.metadata),
1306
1353
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
1307
1354
  children: mergeChildrenByPosition(ctx, nav, sectionChildren)
1308
1355
  };
@@ -1376,7 +1423,7 @@ function apiPackageChildNode(ctx, scoped, scopeSegs, parentApiDefinitionId, scop
1376
1423
  featureFlags: metaFeatureFlags(seg.metadata)
1377
1424
  }),
1378
1425
  apiDefinitionId: ApiDefinitionId(apiDefinitionId),
1379
- availability: metaStr(seg.metadata, "availability"),
1426
+ availability: metaAvailability(seg.metadata),
1380
1427
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1381
1428
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1382
1429
  pointsTo: metaPointsTo != null ? pointsToSlug(metaPointsTo) : void 0,
@@ -1464,7 +1511,7 @@ function apiReferenceNode(ctx, scoped, scopeSegs, scopePrefix) {
1464
1511
  featureFlags: metaFeatureFlags(seg.metadata)
1465
1512
  }),
1466
1513
  apiDefinitionId: ApiDefinitionId(apiDefinitionId),
1467
- availability: metaStr(seg.metadata, "availability"),
1514
+ availability: metaAvailability(seg.metadata),
1468
1515
  overviewPageId: overviewPageId != null ? PageId(overviewPageId) : void 0,
1469
1516
  noindex: metaBool(overview?.metadata, "noindex") ?? metaBool(seg.metadata, "noindex"),
1470
1517
  paginated: true,
@@ -1500,6 +1547,44 @@ function hasOwningApiReference(scoped, scopeSegs) {
1500
1547
  return metaStr(candidate.seg.metadata, "apiDefinitionId") === apiDefinitionId;
1501
1548
  });
1502
1549
  }
1550
+ function isNestedApiPackage(scoped, scopeSegs) {
1551
+ if (metaStr(scoped.seg.metadata, "type") !== "apiPackage") {
1552
+ return false;
1553
+ }
1554
+ const apiDefinitionId = metaStr(scoped.seg.metadata, "apiDefinitionId");
1555
+ if (apiDefinitionId == null) {
1556
+ return false;
1557
+ }
1558
+ const apiReferenceSections = new Set(
1559
+ scopeSegs.filter(
1560
+ (s) => metaStr(s.seg.metadata, "type") === "apiReference" && metaStr(s.seg.metadata, "apiDefinitionId") === apiDefinitionId
1561
+ ).map((s) => s.seg.section)
1562
+ );
1563
+ if (apiReferenceSections.size === 0) {
1564
+ return false;
1565
+ }
1566
+ const sectionPaths = new Set(scopeSegs.map((s) => s.seg.section));
1567
+ const resolveParent = (section) => {
1568
+ const parent = parentSectionPath(section);
1569
+ if (parent === "" || sectionPaths.has(parent)) {
1570
+ return parent;
1571
+ }
1572
+ return nearestExistingAncestor(section, sectionPaths);
1573
+ };
1574
+ let current = scoped.seg.section;
1575
+ const seen = /* @__PURE__ */ new Set([current]);
1576
+ for (; ; ) {
1577
+ const parent = resolveParent(current);
1578
+ if (apiReferenceSections.has(parent)) {
1579
+ return true;
1580
+ }
1581
+ if (parent === "" || seen.has(parent)) {
1582
+ return false;
1583
+ }
1584
+ seen.add(parent);
1585
+ current = parent;
1586
+ }
1587
+ }
1503
1588
  function changelogNode(ctx, scoped, scopePrefix) {
1504
1589
  const { seg, nav } = scoped;
1505
1590
  const overview = overviewRoute(nav);
@@ -1603,7 +1688,7 @@ function buildSectionTree(ctx, scopeSegs, parentPath, scopePrefix, changelogScop
1603
1688
  if (sec === "" || type === "tabRoot") {
1604
1689
  return false;
1605
1690
  }
1606
- if (hasOwningApiReference(s, scopeSegs)) {
1691
+ if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1607
1692
  return false;
1608
1693
  }
1609
1694
  const parent = parentSectionPath(sec);
@@ -1677,7 +1762,7 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1677
1762
  for (const s of ordered) {
1678
1763
  const type = metaStr(s.seg.metadata, "type");
1679
1764
  const sec = s.seg.section;
1680
- if (hasOwningApiReference(s, scopeSegs)) {
1765
+ if (hasOwningApiReference(s, scopeSegs) || isNestedApiPackage(s, scopeSegs)) {
1681
1766
  continue;
1682
1767
  }
1683
1768
  if (type === "tabRoot" && metaBool(s.seg.metadata, "landingPage") === true) {