@fern-api/fdr-sdk 1.2.62-4bbcb763ed → 1.2.62-7fed4b0733

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.
@@ -635,10 +635,12 @@ __export(orpc_client_exports, {
635
635
  getGraphqlOperationIds: () => getGraphqlOperationIds,
636
636
  gitContract: () => gitContract,
637
637
  isFernFileRef: () => isFernFileRef,
638
+ ledgerSegmentIdentity: () => ledgerSegmentIdentity,
638
639
  libraryDocsContract: () => libraryDocsContract,
639
640
  organizationContract: () => organizationContract,
640
641
  pdfExportContract: () => pdfExportContract,
641
642
  sdksContract: () => sdksContract,
643
+ selectLedgerSegmentsForLocale: () => selectLedgerSegmentsForLocale,
642
644
  slugsContract: () => slugsContract,
643
645
  snippetsContract: () => snippetsContract,
644
646
  snippetsFactoryContract: () => snippetsFactoryContract,
@@ -6426,6 +6428,46 @@ var ManifestSegmentSchema = z33.object({
6426
6428
  variant: SegmentDetailSchema.nullable(),
6427
6429
  tab: SegmentDetailSchema.nullable()
6428
6430
  });
6431
+ function detailSlug(metadata) {
6432
+ if (metadata == null || typeof metadata !== "object" || !("slug" in metadata)) {
6433
+ return void 0;
6434
+ }
6435
+ const slug = metadata.slug;
6436
+ return typeof slug === "string" ? slug : void 0;
6437
+ }
6438
+ function detailIdentity(dimension, detail) {
6439
+ if (detail == null) {
6440
+ return `${dimension}:none`;
6441
+ }
6442
+ const slug = detailSlug(detail.metadata);
6443
+ if (slug != null && slug !== "") {
6444
+ return `${dimension}:slug:${slug}`;
6445
+ }
6446
+ return detail.sortOrder != null ? `${dimension}:sort-order:${detail.sortOrder}` : `${dimension}:id:${detail.id ?? ""}`;
6447
+ }
6448
+ function ledgerSegmentIdentity(segment) {
6449
+ return [
6450
+ segment.section,
6451
+ segment.sortOrder,
6452
+ detailIdentity("product", segment.product),
6453
+ detailIdentity("version", segment.version),
6454
+ detailIdentity("variant", segment.variant),
6455
+ detailIdentity("tab", segment.tab)
6456
+ ].join("|");
6457
+ }
6458
+ function selectLedgerSegmentsForLocale(segments, locale, defaultLocale) {
6459
+ const byIdentity = /* @__PURE__ */ new Map();
6460
+ for (const segment of segments) {
6461
+ const identity = ledgerSegmentIdentity(segment);
6462
+ const existing = byIdentity.get(identity);
6463
+ const prefersRequestedLocale = segment.locale === locale && existing?.locale !== locale;
6464
+ const prefersDefaultLocale = segment.locale === defaultLocale && existing?.locale !== locale && existing?.locale !== defaultLocale;
6465
+ if (existing == null || prefersRequestedLocale || prefersDefaultLocale) {
6466
+ byIdentity.set(identity, segment);
6467
+ }
6468
+ }
6469
+ return [...byIdentity.values()];
6470
+ }
6429
6471
  var ManifestNavRouteSchema = LedgerNavRouteSchema;
6430
6472
  var ManifestRouteBaseSchema = z33.object({
6431
6473
  segmentHash: z33.string(),
@@ -7328,10 +7370,12 @@ var UpsertThemeBodySchema = z35.object({
7328
7370
  getGraphqlOperationIds,
7329
7371
  gitContract,
7330
7372
  isFernFileRef,
7373
+ ledgerSegmentIdentity,
7331
7374
  libraryDocsContract,
7332
7375
  organizationContract,
7333
7376
  pdfExportContract,
7334
7377
  sdksContract,
7378
+ selectLedgerSegmentsForLocale,
7335
7379
  slugsContract,
7336
7380
  snippetsContract,
7337
7381
  snippetsFactoryContract,