@fern-api/fdr-sdk 1.2.165-800b1938f3 → 1.2.166-e8ae898b4d

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/docs-ledger/index.ts","../../../../commons/core-utils/src/assertNever.ts","../../../src/orpc-client/api/contract-latest.ts","../../../src/orpc-client/api/shared.ts","../../../src/orpc-client/shared.ts","../../../src/orpc-client/api/ids.ts","../../../src/orpc-client/api/contract-register.ts","../../../src/orpc-client/api/contract-read.ts","../../../src/orpc-client/api/contract-db.ts","../../../src/client/docs-types/read.ts","../../../src/client/docs-types/read-commons.ts","../../../src/client/docs-types/shared.ts","../../../src/orpc-client/docs/v2/read/contract.ts","../../../src/orpc-client/docs/v2/write/contract.ts","../../../src/client/docs-types/write.ts","../../../src/client/docs-types/write-commons.ts","../../../src/orpc-client/docs-ledger/contract.ts","../../../src/orpc-client/sdks/contract.ts","../../../src/orpc-client/templates/contract.ts","../../../src/orpc-client/docs-ledger/config-files.ts","../../../src/orpc-client/docs-ledger/ledger-manifest.ts","../../../src/orpc-client/docs-ledger/stable-stringify.ts","../../../src/docs-ledger/stableHash.ts","../../../src/docs-ledger/toBasepathRelative.ts","../../../src/docs-ledger/buildLedgerManifest.ts","../../../src/docs-ledger/docsLedgerHash.ts","../../../src/docs-ledger/docsPublishTransform.ts","../../../src/api-definition/index.ts","../../../src/api-definition/const.ts","../../../../commons/core-utils/src/empty.ts","../../../../commons/core-utils/src/identity.ts","../../../../commons/core-utils/src/isNonNullish.ts","../../../../commons/core-utils/src/objects/isPlainObject.ts","../../../../commons/core-utils/src/sanitizeUrl.ts","../../../../../node_modules/.pnpm/title@4.0.1/node_modules/title/dist/esm/lower-case.js","../../../../../node_modules/.pnpm/title@4.0.1/node_modules/title/dist/esm/specials.js","../../../../../node_modules/.pnpm/title@4.0.1/node_modules/title/dist/esm/index.js","../../../../commons/core-utils/src/specialTokens.ts","../../../../commons/core-utils/src/titleCase.ts","../../../../commons/core-utils/src/unknownToString.ts","../../../../commons/core-utils/src/visitDiscriminatedUnion.ts","../../../src/api-definition/unwrap.ts","../../../src/api-definition/availability.ts","../../../src/api-definition/collect-referenced-types.ts","../../../src/api-definition/collect-type-tree.ts","../../../src/api-definition/typeid-visitor.ts","../../../src/api-definition/graphql-type-references.ts","../../../src/api-definition/prune.ts","../../../src/api-definition/endpoint-context.ts","../../../src/api-definition/endpoint-path-literal.ts","../../../src/api-definition/join.ts","../../../src/api-definition/lang.ts","../../../src/api-definition/migrators/v1ToV2.ts","../../../src/navigation/consts.ts","../../../src/api-definition/snippets/curl.ts","../../../src/utils/obfuscate-secret.ts","../../../src/api-definition/wrapOpenRPCRequest.ts","../../../src/api-definition/snippets/multipart-filename-placeholder.ts","../../../src/api-definition/snippets/SnippetHttpRequest.ts","../../../src/api-definition/url.ts","../../../src/api-definition/sort-keys.ts","../../../src/api-definition/status-message.ts","../../../src/api-definition/prune-endpoint-example.ts","../../../src/api-definition/prune-endpoint-schema.ts","../../../src/api-definition/snippets/constants.ts","../../../src/api-definition/snippets/auth-scheme.ts","../../../src/api-definition/snippets/get-har-request.ts","../../../src/api-definition/snippets/graphql-snippets.ts","../../../src/api-definition/snippets/HttpSnippetConverter.ts","../../../src/api-definition/snippets/http-snippets.ts","../../../src/api-definition/snippets/sdk-snippets.ts","../../../src/api-definition/snippets/types.ts","../../../src/api-definition/transformer.ts","../../../src/navigation/index.ts","../../../src/navigation/utils/isSubpackage.ts","../../../src/navigation/types/latest.ts","../../../src/navigation/versions/latest/NavigationNodeApiLeaf.ts","../../../src/navigation/versions/latest/NavigationNodePageLeaf.ts","../../../src/navigation/versions/latest/NavigationNodeLeaf.ts","../../../src/navigation/versions/latest/getChildren.ts","../../../src/navigation/versions/latest/getPageId.ts","../../../src/navigation/versions/latest/isApiReferenceNode.ts","../../../src/navigation/versions/latest/isExternalProductNode.ts","../../../src/navigation/versions/latest/isInternalProductNode.ts","../../../src/navigation/versions/latest/NavigationNodeSection.ts","../../../src/navigation/versions/latest/NavigationNodeSectionOverview.ts","../../../src/navigation/versions/latest/NavigationNodeMarkdown.ts","../../../src/navigation/versions/latest/isNoindexNode.ts","../../../src/navigation/versions/latest/isProductGroupNode.ts","../../../src/navigation/versions/latest/isProductNode.ts","../../../src/navigation/versions/latest/isSidebarRootNode.ts","../../../src/navigation/versions/latest/isTabbedNode.ts","../../../src/navigation/versions/latest/isUnversionedNode.ts","../../../src/navigation/versions/latest/isVariantedNode.ts","../../../src/navigation/versions/latest/isVariantNode.ts","../../../src/navigation/versions/latest/isVersionNode.ts","../../../src/navigation/versions/latest/NavigationNodeNeighbor.ts","../../../src/navigation/versions/latest/NavigationNodePage.ts","../../../src/navigation/versions/latest/NavigationNodeWithMetadata.ts","../../../src/navigation/versions/latest/NavigationNodeWithRedirect.ts","../../../src/navigation/versions/latest/NavigationNodeWithSlug.ts","../../../src/navigation/versions/latest/slugjoin.ts","../../../src/navigation/versions/latest/toDefaultSlug.ts","../../../src/utils/traversers/types.ts","../../../src/utils/traversers/bfs.ts","../../../src/navigation/versions/latest/traverseBF.ts","../../../src/utils/traversers/dfs.ts","../../../src/navigation/versions/latest/traverseDF.ts","../../../src/navigation/ApiDefinitionHolder.ts","../../../src/navigation/ApiTypeIdVisitor.ts","../../../src/navigation/ApiDefinitionPruner.ts","../../../src/navigation/NodeCollector.ts","../../../src/navigation/utils/canonicalSlugKey.ts","../../../src/navigation/versions/v1/index.ts","../../../src/navigation/types/v1.ts","../../../src/navigation/versions/v1/convertAvailability.ts","../../../src/client/APIV1Db.ts","../../../src/client/APIV1Read.ts","../../../src/client/APIV1Write.ts","../../../src/client/DocsV1Db.ts","../../../src/client/docs-types/db.ts","../../../src/client/docs-types/db-docsRead.ts","../../../src/client/DocsV1Read.ts","../../../src/client/DocsV1Write.ts","../../../src/client/FdrAPI.ts","../../../src/client/ApiLatestWithSubs.ts","../../../src/client/ApiLatestEndpoint.ts","../../../src/client/ApiLatestWebhook.ts","../../../src/client/ApiLatestWebsocket.ts","../../../src/client/DocsLatest.ts","../../../src/client/docs-types/latest.ts","../../../src/client/DocsV1Commons.ts","../../../src/client/libraryDocs.ts","../../../src/client/Sdks.ts","../../../src/client/visitReadNavigationConfig.ts","../../../src/navigation/versions/v1/converters/ApiReferenceNavigationConverter.ts","../../../src/navigation/utils/stringifyEndpointPathParts.ts","../../../src/navigation/versions/v1/converters/ChangelogConverter.ts","../../../src/navigation/versions/v1/converters/NodeIdGenerator.ts","../../../src/navigation/versions/v1/converters/SlugGenerator.ts","../../../src/navigation/versions/v1/converters/toRootNode.ts","../../../src/navigation/utils/getFrontmatter.ts","../../../src/navigation/utils/getNoIndexFromFrontmatter.ts","../../../src/navigation/versions/v1/converters/getFullSlugFromFrontmatter.ts","../../../src/navigation/versions/v1/converters/NavigationConfigConverter.ts","../../../src/navigation/versions/v1/NavigationNodeWithMetadata.ts","../../../src/navigation/versions/v1/followRedirect.ts","../../../src/navigation/versions/v1/getPageId.ts","../../../src/navigation/versions/v1/NavigationNodeApiLeaf.ts","../../../src/navigation/versions/v1/NavigationNodePageLeaf.ts","../../../src/navigation/versions/v1/NavigationNodeLeaf.ts","../../../src/navigation/versions/v1/NavigationNodeSection.ts","../../../src/navigation/versions/v1/NavigationNodeSectionOverview.ts","../../../src/navigation/versions/v1/NavigationNodeMarkdown.ts","../../../src/navigation/versions/v1/NavigationNodeNeighbor.ts","../../../src/navigation/versions/v1/NavigationNodePage.ts","../../../src/navigation/versions/v1/NavigationNodeWithRedirect.ts","../../../src/navigation/versions/v1/slugjoin.ts","../../../src/navigation/versions/v1/toDefaultSlug.ts","../../../src/navigation/versions/v1/getChildren.ts","../../../src/navigation/versions/v1/traverseDF.ts","../../../src/navigation/utils/pruneVersionNode.ts","../../../src/navigation/migrators/index.ts","../../../src/navigation/migrators/v1ToV2.ts","../../../src/navigation/utils/index.ts","../../../src/navigation/utils/buildPageIdToSlugMap.ts","../../../src/navigation/utils/collectApiReferences.ts","../../../src/navigation/utils/collectLinkRedirects.ts","../../../src/navigation/utils/collectPageIds.ts","../../../src/navigation/utils/createBreadcrumb.ts","../../../src/navigation/utils/findNode.ts","../../../src/navigation/utils/resolveCurrentTab.ts","../../../src/navigation/utils/followRedirect.ts","../../../src/navigation/utils/getApiReferenceId.ts","../../../src/navigation/utils/syntheticSectionPath.ts","../../../src/navigation/utils/toApis.ts","../../../src/navigation/utils/toPages.ts","../../../src/navigation/utils/updatePointsTo.ts","../../../src/navigation/utils/toRootNode.ts","../../../src/navigation/utils/toUnversionedSlug.ts","../../../src/utils/traversers/prunetree.ts","../../../src/navigation/utils/deleteChild.ts","../../../src/navigation/utils/pruneNavigationTree.ts"],"sourcesContent":["/**\n * Ledger publish transform — the pure (no DB, no S3) half of a docs publish.\n *\n * `transformPublishInput` turns a `DocsPublishInput` locale into hashed\n * content-addressed entities, and `buildLedgerReadModel` assembles the pointer\n * manifest + route shards the Astro renderer reads. FDR runs these on publish;\n * the Fern CLI runs the same code to render a local project without a server.\n */\nexport * from \"./buildLedgerManifest.js\";\nexport * from \"./docsLedgerHash.js\";\nexport * from \"./docsPublishTransform.js\";\nexport * from \"./inputTypes.js\";\nexport { sha256Hex, stableHash } from \"./stableHash.js\";\nexport * from \"./toBasepathRelative.js\";\n","export function assertNever(x: never): never {\n throw new Error(\"Unexpected value: \" + JSON.stringify(x));\n}\n\nexport function assertNeverNoThrow(_: never): void {}\n\nexport default assertNever;\n","import * as z from \"zod\";\n\nimport {\n AuthSchemeIdSchema,\n AvailabilitySchema,\n Base64TypeSchema,\n BigIntegerTypeSchema,\n BooleanTypeSchema,\n DateTypeSchema,\n DatetimeTypeSchema,\n DoubleTypeSchema,\n EndpointIdSchema,\n EndpointPathPartSchema,\n EnvironmentIdSchema,\n EnvironmentSchema,\n GraphQlOperationIdSchema,\n HttpMethodSchema,\n IntegerTypeSchema,\n LongTypeSchema,\n MultipleAuthTypeSchema,\n PropertyKeySchema,\n ProtocolSchema,\n ScalarTypeSchema,\n StringTypeSchema,\n SubpackageIdSchema,\n TypeIdSchema,\n Uint64TypeSchema,\n UintTypeSchema,\n UuidTypeSchema,\n WebhookHttpMethodSchema,\n WebhookIdSchema,\n WebSocketIdSchema,\n WebSocketMessageIdSchema,\n WebSocketMessageOriginSchema\n} from \"./shared.js\";\n\n// ── Latest commons ───────────────────────────────────────────────────────\n\nexport const PathPartSchema = EndpointPathPartSchema;\nexport type PathPart = z.infer<typeof PathPartSchema>;\n\nexport const WithNamespaceSchema = z.object({\n namespace: z.array(SubpackageIdSchema).nullish()\n});\nexport type WithNamespace = z.infer<typeof WithNamespaceSchema>;\n\n// ── Latest auth ──────────────────────────────────────────────────────────\n\nimport { BasicAuthSchema, BearerAuthSchema, HeaderAuthSchema, OAuthSchema } from \"./shared.js\";\n\nexport { BasicAuthSchema, BearerAuthSchema, HeaderAuthSchema, OAuthSchema };\n\nexport const LatestAuthSchemeSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"bearerAuth\"), ...BearerAuthSchema.shape }),\n z.object({ type: z.literal(\"basicAuth\"), ...BasicAuthSchema.shape }),\n z.object({ type: z.literal(\"header\"), ...HeaderAuthSchema.shape }),\n z.object({ type: z.literal(\"oAuth\"), value: OAuthSchema })\n]);\nexport type LatestAuthScheme = z.infer<typeof LatestAuthSchemeSchema>;\n\n// ── Latest type ──────────────────────────────────────────────────────────\n\nexport const LatestObjectPropertyAccessSchema = z.enum([\"READ_ONLY\", \"WRITE_ONLY\"]);\nexport type LatestObjectPropertyAccess = z.infer<typeof LatestObjectPropertyAccessSchema>;\n\nexport const LatestTypeReferenceIdDefaultSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"enum\"), value: z.string() })\n]);\nexport type LatestTypeReferenceIdDefault = z.infer<typeof LatestTypeReferenceIdDefaultSchema>;\n\nexport const LatestPrimitiveTypeSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"integer\"), ...IntegerTypeSchema.shape }),\n z.object({ type: z.literal(\"double\"), ...DoubleTypeSchema.shape }),\n z.object({ type: z.literal(\"string\"), ...StringTypeSchema.shape }),\n z.object({ type: z.literal(\"long\"), ...LongTypeSchema.shape }),\n z.object({ type: z.literal(\"boolean\"), ...BooleanTypeSchema.shape }),\n z.object({ type: z.literal(\"datetime\"), ...DatetimeTypeSchema.shape }),\n z.object({ type: z.literal(\"uuid\"), ...UuidTypeSchema.shape }),\n z.object({ type: z.literal(\"base64\"), ...Base64TypeSchema.shape }),\n z.object({ type: z.literal(\"date\"), ...DateTypeSchema.shape }),\n z.object({ type: z.literal(\"bigInteger\"), ...BigIntegerTypeSchema.shape }),\n z.object({ type: z.literal(\"uint\"), ...UintTypeSchema.shape }),\n z.object({ type: z.literal(\"uint64\"), ...Uint64TypeSchema.shape }),\n z.object({ type: z.literal(\"scalar\"), ...ScalarTypeSchema.shape })\n]);\nexport type LatestPrimitiveType = z.infer<typeof LatestPrimitiveTypeSchema>;\n\nexport const LatestLiteralTypeSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"booleanLiteral\"), value: z.boolean() }),\n z.object({ type: z.literal(\"stringLiteral\"), value: z.string() })\n]);\nexport type LatestLiteralType = z.infer<typeof LatestLiteralTypeSchema>;\n\nexport const LatestUnknownTypeSchema = z.object({\n displayName: z.string().nullish()\n});\nexport type LatestUnknownType = z.infer<typeof LatestUnknownTypeSchema>;\n\nexport const LatestEnumValueSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n value: z.string()\n});\nexport type LatestEnumValue = z.infer<typeof LatestEnumValueSchema>;\n\nexport const LatestEnumTypeSchema = z.object({\n default: z.string().nullish(),\n values: z.array(LatestEnumValueSchema)\n});\nexport type LatestEnumType = z.infer<typeof LatestEnumTypeSchema>;\n\nexport type LatestTypeShape =\n | LatestTypeShape.Alias\n | LatestTypeShape.Enum\n | LatestTypeShape.UndiscriminatedUnion\n | LatestTypeShape.DiscriminatedUnion\n | LatestTypeShape.Object_;\n\nexport namespace LatestTypeShape {\n export interface Alias {\n type: \"alias\";\n value: LatestTypeReference;\n }\n export interface Enum extends LatestEnumType {\n type: \"enum\";\n }\n export interface UndiscriminatedUnion extends LatestUndiscriminatedUnionType {\n type: \"undiscriminatedUnion\";\n }\n export interface DiscriminatedUnion extends LatestDiscriminatedUnionType {\n type: \"discriminatedUnion\";\n }\n export interface Object_ extends LatestObjectType {\n type: \"object\";\n }\n}\n\nexport type LatestTypeReference =\n | LatestTypeReference.Id\n | LatestTypeReference.Primitive\n | LatestTypeReference.Optional\n | LatestTypeReference.Nullable\n | LatestTypeReference.List\n | LatestTypeReference.Set\n | LatestTypeReference.Map\n | LatestTypeReference.Literal\n | LatestTypeReference.Unknown;\n\nexport namespace LatestTypeReference {\n export interface Id {\n type: \"id\";\n id: string;\n default?: LatestTypeReferenceIdDefault | null;\n }\n export interface Primitive {\n type: \"primitive\";\n value: LatestPrimitiveType;\n }\n export interface Optional {\n type: \"optional\";\n shape: LatestTypeShape;\n default?: unknown | null;\n }\n export interface Nullable {\n type: \"nullable\";\n shape: LatestTypeShape;\n }\n export interface List {\n type: \"list\";\n itemShape: LatestTypeShape;\n minItems?: number | null;\n maxItems?: number | null;\n }\n export interface Set {\n type: \"set\";\n itemShape: LatestTypeShape;\n minItems?: number | null;\n maxItems?: number | null;\n }\n export interface Map {\n type: \"map\";\n keyShape: LatestTypeShape;\n valueShape: LatestTypeShape;\n minProperties?: number | null;\n maxProperties?: number | null;\n }\n export interface Literal {\n type: \"literal\";\n value: LatestLiteralType;\n }\n export interface Unknown extends LatestUnknownType {\n type: \"unknown\";\n }\n}\n\nexport interface LatestObjectType {\n extends: string[];\n properties: LatestObjectProperty[];\n extraProperties?: LatestTypeReference | null;\n}\n\nexport interface LatestObjectProperty {\n description?: string | null;\n availability?: z.infer<typeof AvailabilitySchema> | null;\n key: string;\n valueShape: LatestTypeShape;\n propertyAccess?: LatestObjectPropertyAccess | null;\n arguments?: LatestGraphQlArgument[] | null;\n}\n\nexport interface LatestParameterProperty extends LatestObjectProperty {\n explode?: boolean | null;\n}\n\nexport interface LatestUndiscriminatedUnionVariant {\n description?: string | null;\n availability?: z.infer<typeof AvailabilitySchema> | null;\n displayName?: string | null;\n shape: LatestTypeShape;\n}\n\nexport interface LatestUndiscriminatedUnionType {\n variants: LatestUndiscriminatedUnionVariant[];\n}\n\nexport interface LatestDiscriminatedUnionVariant extends LatestObjectType {\n description?: string | null;\n availability?: z.infer<typeof AvailabilitySchema> | null;\n discriminantValue: string;\n displayName?: string | null;\n}\n\nexport interface LatestDiscriminatedUnionType {\n discriminant: string;\n variants: LatestDiscriminatedUnionVariant[];\n}\n\nexport const LatestObjectPropertySchema: z.ZodType<LatestObjectProperty> = z.lazy(() =>\n z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n key: PropertyKeySchema,\n valueShape: LatestTypeShapeSchema,\n propertyAccess: LatestObjectPropertyAccessSchema.nullish(),\n arguments: z.array(LatestGraphQlArgumentSchema).nullish()\n })\n);\n\nexport const LatestParameterPropertySchema: z.ZodType<LatestParameterProperty> = z.lazy(() =>\n z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n key: PropertyKeySchema,\n valueShape: LatestTypeShapeSchema,\n propertyAccess: LatestObjectPropertyAccessSchema.nullish(),\n explode: z.boolean().nullish()\n })\n);\n\nexport const LatestObjectTypeSchema: z.ZodType<LatestObjectType> = z.lazy(() =>\n z.object({\n extends: z.array(TypeIdSchema),\n properties: z.array(LatestObjectPropertySchema),\n extraProperties: LatestTypeReferenceSchema.nullish()\n })\n);\n\nexport const LatestUndiscriminatedUnionVariantSchema: z.ZodType<LatestUndiscriminatedUnionVariant> = z.lazy(() =>\n z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n displayName: z.string().nullish(),\n shape: LatestTypeShapeSchema\n })\n);\n\nexport const LatestUndiscriminatedUnionTypeSchema: z.ZodType<LatestUndiscriminatedUnionType> = z.lazy(() =>\n z.object({\n variants: z.array(LatestUndiscriminatedUnionVariantSchema)\n })\n);\n\nexport const LatestDiscriminatedUnionVariantSchema: z.ZodType<LatestDiscriminatedUnionVariant> = z.lazy(() =>\n z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n discriminantValue: z.string(),\n displayName: z.string().nullish(),\n extends: z.array(TypeIdSchema),\n properties: z.array(LatestObjectPropertySchema),\n extraProperties: LatestTypeReferenceSchema.nullish()\n })\n);\n\nexport const LatestDiscriminatedUnionTypeSchema: z.ZodType<LatestDiscriminatedUnionType> = z.lazy(() =>\n z.object({\n discriminant: PropertyKeySchema,\n variants: z.array(LatestDiscriminatedUnionVariantSchema)\n })\n);\n\nexport const LatestTypeShapeSchema: z.ZodType<LatestTypeShape> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"alias\"),\n value: LatestTypeReferenceSchema\n }),\n z.object({\n type: z.literal(\"enum\"),\n default: z.string().nullish(),\n values: z.array(LatestEnumValueSchema)\n }),\n z.object({\n type: z.literal(\"undiscriminatedUnion\"),\n variants: z.array(LatestUndiscriminatedUnionVariantSchema)\n }),\n z.object({\n type: z.literal(\"discriminatedUnion\"),\n discriminant: PropertyKeySchema,\n variants: z.array(LatestDiscriminatedUnionVariantSchema)\n }),\n z.object({\n type: z.literal(\"object\"),\n extends: z.array(TypeIdSchema),\n properties: z.array(LatestObjectPropertySchema),\n extraProperties: LatestTypeReferenceSchema.nullish()\n })\n ])\n);\n\nexport const LatestTypeReferenceSchema: z.ZodType<LatestTypeReference> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"id\"),\n id: TypeIdSchema,\n default: LatestTypeReferenceIdDefaultSchema.nullish()\n }),\n z.object({\n type: z.literal(\"primitive\"),\n value: LatestPrimitiveTypeSchema\n }),\n z.object({\n type: z.literal(\"optional\"),\n shape: LatestTypeShapeSchema,\n default: z.unknown().nullish()\n }),\n z.object({\n type: z.literal(\"nullable\"),\n shape: LatestTypeShapeSchema\n }),\n z.object({\n type: z.literal(\"list\"),\n itemShape: LatestTypeShapeSchema,\n minItems: z.number().int().nullish(),\n maxItems: z.number().int().nullish()\n }),\n z.object({\n type: z.literal(\"set\"),\n itemShape: LatestTypeShapeSchema,\n minItems: z.number().int().nullish(),\n maxItems: z.number().int().nullish()\n }),\n z.object({\n type: z.literal(\"map\"),\n keyShape: LatestTypeShapeSchema,\n valueShape: LatestTypeShapeSchema,\n minProperties: z.number().int().nullish(),\n maxProperties: z.number().int().nullish()\n }),\n z.object({\n type: z.literal(\"literal\"),\n value: LatestLiteralTypeSchema\n }),\n z.object({\n type: z.literal(\"unknown\"),\n displayName: z.string().nullish()\n })\n ])\n);\n\nexport const LatestTypeDefinitionSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n name: z.string(),\n shape: LatestTypeShapeSchema,\n displayName: z.string().nullish()\n});\nexport type LatestTypeDefinition = z.infer<typeof LatestTypeDefinitionSchema>;\n\nexport const LatestContentTypeSchema = z.union([z.string(), z.array(z.string())]);\nexport type LatestContentType = z.infer<typeof LatestContentTypeSchema>;\n\nexport const LatestBytesRequestSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n isOptional: z.boolean(),\n contentType: LatestContentTypeSchema.nullish()\n});\nexport type LatestBytesRequest = z.infer<typeof LatestBytesRequestSchema>;\n\nexport const LatestFormDataPropertySchema: z.ZodType<LatestFormDataField> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"file\"),\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n key: PropertyKeySchema,\n isOptional: z.boolean(),\n contentType: LatestContentTypeSchema.nullish()\n }),\n z.object({\n type: z.literal(\"files\"),\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n key: PropertyKeySchema,\n isOptional: z.boolean(),\n contentType: LatestContentTypeSchema.nullish()\n }),\n z.object({\n type: z.literal(\"property\"),\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n key: PropertyKeySchema,\n valueShape: LatestTypeShapeSchema,\n propertyAccess: LatestObjectPropertyAccessSchema.nullish(),\n contentType: LatestContentTypeSchema.nullish(),\n exploded: z.boolean().nullish()\n })\n ])\n);\n\nexport type LatestFormDataFile = {\n type: \"file\";\n description?: string | null;\n availability?: z.infer<typeof AvailabilitySchema> | null;\n key: string;\n isOptional: boolean;\n contentType?: LatestContentType | null;\n};\n\nexport type LatestFormDataFiles = {\n type: \"files\";\n description?: string | null;\n availability?: z.infer<typeof AvailabilitySchema> | null;\n key: string;\n isOptional: boolean;\n contentType?: LatestContentType | null;\n};\n\nexport type LatestFormDataPropertyVariant = {\n type: \"property\";\n description?: string | null;\n availability?: z.infer<typeof AvailabilitySchema> | null;\n key: string;\n valueShape: LatestTypeShape;\n propertyAccess?: LatestObjectPropertyAccess | null;\n contentType?: LatestContentType | null;\n exploded?: boolean | null;\n};\n\nexport type LatestFormDataField = LatestFormDataFile | LatestFormDataFiles | LatestFormDataPropertyVariant;\n\nexport const LatestFormDataRequestSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n fields: z.array(LatestFormDataPropertySchema)\n});\nexport type LatestFormDataRequest = z.infer<typeof LatestFormDataRequestSchema>;\n\nexport const LatestNullableTypeSchema: z.ZodType<{ shape: LatestTypeShape }> = z.lazy(() =>\n z.object({\n shape: LatestTypeShapeSchema\n })\n);\n\nexport const LatestOptionalTypeSchema: z.ZodType<{ shape: LatestTypeShape; default?: unknown }> = z.lazy(() =>\n z.object({\n shape: LatestTypeShapeSchema,\n default: z.unknown().nullish()\n })\n);\n\nexport const LatestListTypeSchema: z.ZodType<{\n itemShape: LatestTypeShape;\n minItems?: number | null;\n maxItems?: number | null;\n}> = z.lazy(() =>\n z.object({\n itemShape: LatestTypeShapeSchema,\n minItems: z.number().int().nullish(),\n maxItems: z.number().int().nullish()\n })\n);\n\nexport const LatestSetTypeSchema: z.ZodType<{\n itemShape: LatestTypeShape;\n minItems?: number | null;\n maxItems?: number | null;\n}> = z.lazy(() =>\n z.object({\n itemShape: LatestTypeShapeSchema,\n minItems: z.number().int().nullish(),\n maxItems: z.number().int().nullish()\n })\n);\n\nexport const LatestMapTypeSchema: z.ZodType<{\n keyShape: LatestTypeShape;\n valueShape: LatestTypeShape;\n minProperties?: number | null;\n maxProperties?: number | null;\n}> = z.lazy(() =>\n z.object({\n keyShape: LatestTypeShapeSchema,\n valueShape: LatestTypeShapeSchema,\n minProperties: z.number().int().nullish(),\n maxProperties: z.number().int().nullish()\n })\n);\n\n// ── Latest endpoint ──────────────────────────────────────────────────────\n\nexport const LatestLanguageSchema = z.string();\nexport type LatestLanguage = z.infer<typeof LatestLanguageSchema>;\n\nexport const LatestExampleEndpointRequestSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"json\"), value: z.unknown() }),\n z.object({ type: z.literal(\"form\"), value: z.record(z.string(), z.unknown()) }),\n z.object({ type: z.literal(\"bytes\"), value: z.unknown() })\n]);\nexport type LatestExampleEndpointRequest = z.infer<typeof LatestExampleEndpointRequestSchema>;\n\nexport const LatestExampleEndpointResponseSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"json\"), value: z.unknown() }),\n z.object({ type: z.literal(\"filename\"), value: z.unknown() }),\n z.object({ type: z.literal(\"stream\"), value: z.array(z.unknown()) }),\n z.object({ type: z.literal(\"sse\"), value: z.array(z.object({ event: z.string(), data: z.unknown() })) })\n]);\nexport type LatestExampleEndpointResponse = z.infer<typeof LatestExampleEndpointResponseSchema>;\n\nexport const LatestExampleErrorResponseSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"json\"), value: z.unknown() })\n]);\nexport type LatestExampleErrorResponse = z.infer<typeof LatestExampleErrorResponseSchema>;\n\nexport const LatestHttpRequestBodyShapeSchema: z.ZodType<LatestHttpRequestBodyShape> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"object\"),\n extends: z.array(TypeIdSchema),\n properties: z.array(LatestObjectPropertySchema),\n extraProperties: LatestTypeReferenceSchema.nullish()\n }),\n z.object({ type: z.literal(\"alias\"), value: LatestTypeReferenceSchema }),\n z.object({ type: z.literal(\"bytes\"), ...LatestBytesRequestSchema.shape }),\n z.object({ type: z.literal(\"formData\"), ...LatestFormDataRequestSchema.shape })\n ])\n);\n\nexport type LatestHttpRequestBodyShape =\n | ({ type: \"object\" } & LatestObjectType)\n | { type: \"alias\"; value: LatestTypeReference }\n | ({ type: \"bytes\" } & z.infer<typeof LatestBytesRequestSchema>)\n | ({ type: \"formData\" } & z.infer<typeof LatestFormDataRequestSchema>);\n\nexport const LatestHttpRequestSchema = z.object({\n description: z.string().nullish(),\n contentType: z.string().nullish(),\n body: LatestHttpRequestBodyShapeSchema\n});\nexport type LatestHttpRequest = z.infer<typeof LatestHttpRequestSchema>;\n\nexport const LatestFileDownloadResponseBodyShapeSchema = z.object({\n contentType: z.string().nullish()\n});\nexport type LatestFileDownloadResponseBodyShape = z.infer<typeof LatestFileDownloadResponseBodyShapeSchema>;\n\nexport const LatestStreamResponseSchema = z.object({\n terminator: z.string().nullish(),\n shape: LatestTypeShapeSchema\n});\nexport type LatestStreamResponse = z.infer<typeof LatestStreamResponseSchema>;\n\nexport type LatestHttpResponseBodyShape =\n | { type: \"empty\" }\n | ({ type: \"object\" } & LatestObjectType)\n | { type: \"alias\"; value: LatestTypeReference }\n | ({ type: \"fileDownload\" } & z.infer<typeof LatestFileDownloadResponseBodyShapeSchema>)\n | { type: \"streamingText\" }\n | ({ type: \"stream\" } & z.infer<typeof LatestStreamResponseSchema>);\n\nexport const LatestHttpResponseBodyShapeSchema: z.ZodType<LatestHttpResponseBodyShape> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"empty\") }),\n z.object({\n type: z.literal(\"object\"),\n extends: z.array(TypeIdSchema),\n properties: z.array(LatestObjectPropertySchema),\n extraProperties: LatestTypeReferenceSchema.nullish()\n }),\n z.object({ type: z.literal(\"alias\"), value: LatestTypeReferenceSchema }),\n z.object({ type: z.literal(\"fileDownload\"), ...LatestFileDownloadResponseBodyShapeSchema.shape }),\n z.object({ type: z.literal(\"streamingText\") }),\n z.object({ type: z.literal(\"stream\"), ...LatestStreamResponseSchema.shape })\n ])\n);\n\nexport const LatestHttpResponseSchema = z.object({\n description: z.string().nullish(),\n body: LatestHttpResponseBodyShapeSchema,\n statusCode: z.number().int(),\n isWildcard: z.boolean().nullish()\n});\nexport type LatestHttpResponse = z.infer<typeof LatestHttpResponseSchema>;\n\nexport const LatestErrorExampleSchema = z.object({\n description: z.string().nullish(),\n name: z.string().nullish(),\n responseBody: LatestExampleErrorResponseSchema\n});\nexport type LatestErrorExample = z.infer<typeof LatestErrorExampleSchema>;\n\nexport const LatestErrorResponseSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n shape: LatestTypeShapeSchema.nullish(),\n statusCode: z.number().int(),\n isWildcard: z.boolean().nullish(),\n name: z.string(),\n examples: z.array(LatestErrorExampleSchema).nullish(),\n headers: z.array(LatestObjectPropertySchema).nullish()\n});\nexport type LatestErrorResponse = z.infer<typeof LatestErrorResponseSchema>;\n\nexport const LatestCodeSnippetSchema = z.object({\n description: z.string().nullish(),\n name: z.string().nullish(),\n language: LatestLanguageSchema,\n install: z.string().nullish(),\n code: z.string(),\n generated: z.boolean()\n});\nexport type LatestCodeSnippet = z.infer<typeof LatestCodeSnippetSchema>;\n\nexport const LatestExampleEndpointCallSchema = z.object({\n description: z.string().nullish(),\n path: z.string(),\n responseStatusCode: z.number().int(),\n name: z.string().nullish(),\n contentType: z.string().nullish(),\n pathParameters: z.record(PropertyKeySchema, z.unknown()).nullish(),\n queryParameters: z.record(PropertyKeySchema, z.unknown()).nullish(),\n headers: z.record(PropertyKeySchema, z.unknown()).nullish(),\n requestBody: LatestExampleEndpointRequestSchema.nullish(),\n responseBody: LatestExampleEndpointResponseSchema.nullish(),\n responseHeaders: z.record(z.string(), z.unknown()).nullish(),\n snippets: z.record(LatestLanguageSchema, z.array(LatestCodeSnippetSchema)).nullish(),\n codeExamples: z.unknown().nullish(),\n codeSamples: z.array(LatestCodeSnippetSchema).nullish()\n});\nexport type LatestExampleEndpointCall = z.infer<typeof LatestExampleEndpointCallSchema>;\n\nexport const LatestEndpointDefinitionSchema = z.object({\n description: z.string().nullish(),\n subtitle: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n namespace: z.array(z.string()).nullish(),\n id: EndpointIdSchema,\n method: HttpMethodSchema,\n path: z.array(PathPartSchema),\n displayName: z.string().nullish(),\n operationId: z.string().nullish(),\n auth: z.array(AuthSchemeIdSchema).nullish(),\n multiAuth: z.array(MultipleAuthTypeSchema).nullish(),\n defaultEnvironment: EnvironmentIdSchema.nullish(),\n environments: z.array(EnvironmentSchema).nullish(),\n pathParameters: z.array(LatestParameterPropertySchema).nullish(),\n queryParameters: z.array(LatestParameterPropertySchema).nullish(),\n requestHeaders: z.array(LatestObjectPropertySchema).nullish(),\n responseHeaders: z.array(LatestObjectPropertySchema).nullish(),\n requests: z.array(LatestHttpRequestSchema).nullish(),\n responses: z.array(LatestHttpResponseSchema).nullish(),\n errors: z.array(LatestErrorResponseSchema).nullish(),\n examples: z.array(LatestExampleEndpointCallSchema).nullish(),\n protocol: ProtocolSchema.nullish(),\n includeInApiExplorer: z.boolean().nullish(),\n snippetTemplates: z.unknown().nullish()\n});\nexport type LatestEndpointDefinition = z.infer<typeof LatestEndpointDefinitionSchema>;\n\n// ── Latest graphql ───────────────────────────────────────────────────────\n\nexport const LatestGraphQlOperationTypeSchema = z.enum([\"QUERY\", \"MUTATION\", \"SUBSCRIPTION\"]);\nexport type LatestGraphQlOperationType = z.infer<typeof LatestGraphQlOperationTypeSchema>;\n\nexport const LatestGraphQlArgumentSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n name: z.string(),\n type: LatestTypeShapeSchema,\n defaultValue: z.unknown().nullish()\n});\nexport type LatestGraphQlArgument = z.infer<typeof LatestGraphQlArgumentSchema>;\n\nexport const LatestGraphQlExampleSchema = z.object({\n description: z.string().nullish(),\n name: z.string().nullish(),\n query: z.string(),\n variables: z.record(z.string(), z.unknown()).nullish(),\n response: z.unknown().nullish()\n});\nexport type LatestGraphQlExample = z.infer<typeof LatestGraphQlExampleSchema>;\n\nexport const LatestGraphQlOperationSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n namespace: z.array(z.string()).nullish(),\n fieldPath: z.array(z.string()).nullish(),\n id: GraphQlOperationIdSchema,\n operationType: LatestGraphQlOperationTypeSchema,\n name: z.string(),\n displayName: z.string().nullish(),\n arguments: z.array(LatestGraphQlArgumentSchema).nullish(),\n returnType: LatestTypeShapeSchema,\n examples: z.array(LatestGraphQlExampleSchema).nullish(),\n snippets: z.record(LatestLanguageSchema, z.array(LatestCodeSnippetSchema)).nullish()\n});\nexport type LatestGraphQlOperation = z.infer<typeof LatestGraphQlOperationSchema>;\n\n// ── Latest webhook ───────────────────────────────────────────────────────\n\nexport type LatestWebhookPayloadShape =\n | ({ type: \"object\" } & LatestObjectType)\n | { type: \"alias\"; value: LatestTypeReference }\n | ({ type: \"formData\" } & z.infer<typeof LatestFormDataRequestSchema>);\n\nexport const LatestWebhookPayloadShapeSchema: z.ZodType<LatestWebhookPayloadShape> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"object\"),\n extends: z.array(TypeIdSchema),\n properties: z.array(LatestObjectPropertySchema),\n extraProperties: LatestTypeReferenceSchema.nullish()\n }),\n z.object({ type: z.literal(\"alias\"), value: LatestTypeReferenceSchema }),\n z.object({ type: z.literal(\"formData\"), ...LatestFormDataRequestSchema.shape })\n ])\n);\n\nexport const LatestWebhookPayloadSchema = z.object({\n description: z.string().nullish(),\n shape: LatestWebhookPayloadShapeSchema\n});\nexport type LatestWebhookPayload = z.infer<typeof LatestWebhookPayloadSchema>;\n\nexport const LatestExampleWebhookPayloadSchema = z.object({\n name: z.string().nullish(),\n payload: z.unknown()\n});\nexport type LatestExampleWebhookPayload = z.infer<typeof LatestExampleWebhookPayloadSchema>;\n\nexport const LatestWebhookDefinitionSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n namespace: z.array(z.string()).nullish(),\n id: WebhookIdSchema,\n displayName: z.string().nullish(),\n operationId: z.string().nullish(),\n method: WebhookHttpMethodSchema,\n path: z.array(z.string()),\n headers: z.array(LatestObjectPropertySchema).nullish(),\n payloads: z.array(LatestWebhookPayloadSchema).nullish(),\n responses: z.array(LatestHttpResponseSchema).nullish(),\n examples: z.array(LatestExampleWebhookPayloadSchema).nullish()\n});\nexport type LatestWebhookDefinition = z.infer<typeof LatestWebhookDefinitionSchema>;\n\n// ── Latest websocket ─────────────────────────────────────────────────────\n\nexport const LatestWebSocketMessageSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n type: WebSocketMessageIdSchema,\n displayName: z.string().nullish(),\n origin: WebSocketMessageOriginSchema,\n body: LatestTypeShapeSchema\n});\nexport type LatestWebSocketMessage = z.infer<typeof LatestWebSocketMessageSchema>;\n\nexport const LatestExampleWebSocketMessageSchema = z.object({\n type: WebSocketMessageIdSchema,\n body: z.unknown()\n});\nexport type LatestExampleWebSocketMessage = z.infer<typeof LatestExampleWebSocketMessageSchema>;\n\nexport const LatestExampleWebSocketSessionSchema = z.object({\n description: z.string().nullish(),\n path: z.string(),\n name: z.string().nullish(),\n pathParameters: z.record(PropertyKeySchema, z.unknown()).nullish(),\n queryParameters: z.record(PropertyKeySchema, z.unknown()).nullish(),\n requestHeaders: z.record(PropertyKeySchema, z.unknown()).nullish(),\n messages: z.array(LatestExampleWebSocketMessageSchema).nullish()\n});\nexport type LatestExampleWebSocketSession = z.infer<typeof LatestExampleWebSocketSessionSchema>;\n\nexport const LatestWebSocketChannelSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n namespace: z.array(z.string()).nullish(),\n id: WebSocketIdSchema,\n displayName: z.string().nullish(),\n operationId: z.string().nullish(),\n path: z.array(PathPartSchema),\n messages: z.array(LatestWebSocketMessageSchema),\n auth: z.array(AuthSchemeIdSchema).nullish(),\n defaultEnvironment: EnvironmentIdSchema.nullish(),\n environments: z.array(EnvironmentSchema).nullish(),\n pathParameters: z.array(LatestParameterPropertySchema).nullish(),\n queryParameters: z.array(LatestParameterPropertySchema).nullish(),\n requestHeaders: z.array(LatestObjectPropertySchema).nullish(),\n examples: z.array(LatestExampleWebSocketSessionSchema).nullish(),\n includeInApiExplorer: z.boolean().nullish()\n});\nexport type LatestWebSocketChannel = z.infer<typeof LatestWebSocketChannelSchema>;\n\n// ── Latest SubpackageMetadata & ApiDefinition ────────────────────────────\n\nexport const LatestSubpackageMetadataSchema = z.object({\n id: SubpackageIdSchema,\n name: z.string(),\n displayName: z.string().nullish(),\n description: z.string().nullish()\n});\nexport type LatestSubpackageMetadata = z.infer<typeof LatestSubpackageMetadataSchema>;\n\n// Import SnippetsConfigSchema from contract-register\nimport { SnippetsConfigSchema } from \"./contract-register.js\";\n\nexport const LatestApiDefinitionSchema = z.object({\n id: z.string(),\n apiName: z.string().nullish(),\n specVersion: z.string().nullish(),\n endpoints: z.record(EndpointIdSchema, LatestEndpointDefinitionSchema),\n websockets: z.record(WebSocketIdSchema, LatestWebSocketChannelSchema),\n webhooks: z.record(WebhookIdSchema, LatestWebhookDefinitionSchema),\n graphqlOperations: z.record(GraphQlOperationIdSchema, LatestGraphQlOperationSchema),\n types: z.record(TypeIdSchema, LatestTypeDefinitionSchema),\n subpackages: z.record(SubpackageIdSchema, LatestSubpackageMetadataSchema),\n auths: z.record(AuthSchemeIdSchema, LatestAuthSchemeSchema),\n globalHeaders: z.array(LatestObjectPropertySchema).nullish(),\n snippetsConfiguration: SnippetsConfigSchema.nullish()\n});\nexport type LatestApiDefinition = z.infer<typeof LatestApiDefinitionSchema>;\n\n// Alias for backward compatibility (consumers use FdrAPI.api.latest.ApiDefinition)\nexport type ApiDefinition = LatestApiDefinition;\nexport const ApiDefinitionSchema = LatestApiDefinitionSchema;\n","import * as z from \"zod\";\nimport { ApiDefinitionIdSchema, HttpMethod, HttpMethodSchema } from \"../shared.js\";\nimport type { FileId } from \"./ids.js\";\n\nexport { ApiDefinitionIdSchema, HttpMethod, HttpMethodSchema };\nexport * from \"./ids.js\";\n\nexport const TypeIdSchema = z.string();\n\nexport const EndpointIdSchema = z.string();\n\nexport const WebSocketIdSchema = z.string();\n\nexport const WebhookIdSchema = z.string();\n\nexport const GraphQlOperationIdSchema = z.string();\n\nexport const GraphQlTypeCategorySchema = z.enum([\"object\", \"input\", \"enum\", \"scalar\", \"interface\", \"union\"]);\nexport type GraphQlTypeCategory = z.infer<typeof GraphQlTypeCategorySchema>;\n\nexport const EnvironmentIdSchema = z.string();\n\nexport const PropertyKeySchema = z.string();\n\nexport const AuthSchemeIdSchema = z.string();\n\nexport const SubpackageIdSchema = z.string();\n\nexport const WebSocketMessageIdSchema = z.string();\n\nexport const FileIdSchema: z.ZodType<FileId> = z.string() as any;\n\nexport const MultipleAuthTypeSchema = z.object({\n schemes: z.array(AuthSchemeIdSchema)\n});\nexport type MultipleAuthType = z.infer<typeof MultipleAuthTypeSchema>;\n\nexport const GrpcMethodSchema = z.enum([\"UNARY\", \"CLIENT_STREAM\", \"SERVER_STREAM\", \"BIDIRECTIONAL_STREAM\"]);\n\nexport const AvailabilitySchema = z.enum([\n \"Alpha\",\n \"Stable\",\n \"GenerallyAvailable\",\n \"InDevelopment\",\n \"PreRelease\",\n \"Deprecated\",\n \"Beta\",\n \"Preview\",\n \"Legacy\"\n]);\n\nexport const WebSocketMessageOriginSchema = z.enum([\"client\", \"server\"]);\nexport type WebSocketMessageOrigin = z.infer<typeof WebSocketMessageOriginSchema>;\n\nexport const WebhookHttpMethodSchema = z.enum([\"GET\", \"POST\"]);\nexport type WebhookHttpMethod = z.infer<typeof WebhookHttpMethodSchema>;\n\nexport const WithDescriptionSchema = z.object({\n description: z.string().nullish()\n});\nexport type WithDescription = z.infer<typeof WithDescriptionSchema>;\n\nexport const WithAvailabilitySchema = z.object({\n availability: AvailabilitySchema.nullish()\n});\nexport type WithAvailability = z.infer<typeof WithAvailabilitySchema>;\n\nexport const EnvironmentSchema = z.object({\n id: EnvironmentIdSchema,\n baseUrl: z.string(),\n audiences: z.array(z.string()).nullish()\n});\nexport type Environment = z.infer<typeof EnvironmentSchema>;\n\nexport const RestProtocolSchema = z.object({});\n\nexport const OpenRpcProtocolSchema = z.object({\n methodName: z.string()\n});\n\nexport const GrpcProtocolSchema = z.object({\n methodName: z.string(),\n methodType: GrpcMethodSchema.nullish()\n});\n\nexport const ProtocolSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"rest\"), ...RestProtocolSchema.shape }),\n z.object({ type: z.literal(\"openrpc\"), ...OpenRpcProtocolSchema.shape }),\n z.object({ type: z.literal(\"grpc\"), ...GrpcProtocolSchema.shape })\n]);\nexport type Protocol = z.infer<typeof ProtocolSchema>;\n\nexport const ObjectPropertyAccessSchema = z.enum([\"READ_ONLY\", \"WRITE_ONLY\"]);\nexport type ObjectPropertyAccess = z.infer<typeof ObjectPropertyAccessSchema>;\n\nexport const TypeReferenceIdDefaultSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"enum\"), value: z.string() })\n]);\nexport type TypeReferenceIdDefault = z.infer<typeof TypeReferenceIdDefaultSchema>;\n\nconst _numberNullish = z.number().nullish();\nconst _numberIntNullish = z.number().int().nullish();\n\nfunction coerceNumber(val: unknown): unknown {\n if (typeof val === \"string\" && val.trim() !== \"\") {\n const num = Number(val);\n if (!Number.isNaN(num)) {\n return num;\n }\n }\n return val;\n}\n\nconst coercedNumberNullish = z.preprocess(coerceNumber, z.number().nullish()) as unknown as typeof _numberNullish;\nconst coercedNumberIntNullish = z.preprocess(\n coerceNumber,\n z.number().int().nullish()\n) as unknown as typeof _numberIntNullish;\n\nexport const IntegerTypeSchema = z.object({\n minimum: coercedNumberIntNullish,\n maximum: coercedNumberIntNullish,\n exclusiveMinimum: coercedNumberIntNullish,\n exclusiveMaximum: coercedNumberIntNullish,\n multipleOf: coercedNumberIntNullish,\n default: coercedNumberIntNullish\n});\nexport type IntegerType = z.infer<typeof IntegerTypeSchema>;\n\nexport const DoubleTypeSchema = z.object({\n minimum: coercedNumberNullish,\n maximum: coercedNumberNullish,\n exclusiveMinimum: coercedNumberNullish,\n exclusiveMaximum: coercedNumberNullish,\n multipleOf: coercedNumberNullish,\n default: coercedNumberNullish\n});\nexport type DoubleType = z.infer<typeof DoubleTypeSchema>;\n\nexport const StringTypeSchema = z.object({\n format: z.string().nullish(),\n regex: z.string().nullish(),\n minLength: z.number().int().nullish(),\n maxLength: z.number().int().nullish(),\n default: z.string().nullish()\n});\nexport type StringType = z.infer<typeof StringTypeSchema>;\n\nexport const LongTypeSchema = z.object({\n minimum: coercedNumberNullish,\n maximum: coercedNumberNullish,\n exclusiveMinimum: coercedNumberNullish,\n exclusiveMaximum: coercedNumberNullish,\n multipleOf: coercedNumberNullish,\n default: coercedNumberNullish\n});\nexport type LongType = z.infer<typeof LongTypeSchema>;\n\nconst _booleanNullish = z.boolean().nullish();\n\nexport const BooleanTypeSchema = z.object({\n default: z.preprocess((val) => {\n if (typeof val === \"string\") {\n if (val.toLowerCase() === \"true\") {\n return true;\n }\n if (val.toLowerCase() === \"false\") {\n return false;\n }\n }\n return val;\n }, z.boolean().nullish()) as unknown as typeof _booleanNullish\n});\nexport type BooleanType = z.infer<typeof BooleanTypeSchema>;\n\nexport const DatetimeTypeSchema = z.object({\n default: z.string().nullish()\n});\nexport type DatetimeType = z.infer<typeof DatetimeTypeSchema>;\n\nexport const UuidTypeSchema = z.object({\n default: z.string().nullish()\n});\nexport type UuidType = z.infer<typeof UuidTypeSchema>;\n\nexport const Base64TypeSchema = z.object({\n default: z.string().nullish(),\n mimeType: z.string().nullish()\n});\nexport type Base64Type = z.infer<typeof Base64TypeSchema>;\n\nexport const DateTypeSchema = z.object({\n default: z.string().nullish()\n});\nexport type DateType = z.infer<typeof DateTypeSchema>;\n\nexport const BigIntegerTypeSchema = z.object({\n default: z.string().nullish()\n});\nexport type BigIntegerType = z.infer<typeof BigIntegerTypeSchema>;\n\nexport const UintTypeSchema = z.object({\n minimum: coercedNumberIntNullish,\n maximum: coercedNumberIntNullish,\n exclusiveMinimum: coercedNumberIntNullish,\n exclusiveMaximum: coercedNumberIntNullish,\n multipleOf: coercedNumberIntNullish,\n default: coercedNumberIntNullish\n});\nexport type UintType = z.infer<typeof UintTypeSchema>;\n\nexport const Uint64TypeSchema = z.object({\n minimum: coercedNumberNullish,\n maximum: coercedNumberNullish,\n exclusiveMinimum: coercedNumberNullish,\n exclusiveMaximum: coercedNumberNullish,\n multipleOf: coercedNumberNullish,\n default: coercedNumberNullish\n});\nexport type Uint64Type = z.infer<typeof Uint64TypeSchema>;\n\nexport const ScalarTypeSchema = z.object({\n name: z.string(),\n description: z.string().nullish(),\n default: z.unknown().nullish()\n});\nexport type ScalarType = z.infer<typeof ScalarTypeSchema>;\n\nexport const PrimitiveTypeSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"integer\"), ...IntegerTypeSchema.shape }),\n z.object({ type: z.literal(\"double\"), ...DoubleTypeSchema.shape }),\n z.object({ type: z.literal(\"string\"), ...StringTypeSchema.shape }),\n z.object({ type: z.literal(\"long\"), ...LongTypeSchema.shape }),\n z.object({ type: z.literal(\"boolean\"), ...BooleanTypeSchema.shape }),\n z.object({ type: z.literal(\"datetime\"), ...DatetimeTypeSchema.shape }),\n z.object({ type: z.literal(\"uuid\"), ...UuidTypeSchema.shape }),\n z.object({ type: z.literal(\"base64\"), ...Base64TypeSchema.shape }),\n z.object({ type: z.literal(\"date\"), ...DateTypeSchema.shape }),\n z.object({ type: z.literal(\"bigInteger\"), ...BigIntegerTypeSchema.shape }),\n z.object({ type: z.literal(\"uint\"), ...UintTypeSchema.shape }),\n z.object({ type: z.literal(\"uint64\"), ...Uint64TypeSchema.shape }),\n z.object({ type: z.literal(\"scalar\"), ...ScalarTypeSchema.shape })\n]);\nexport type PrimitiveType = z.infer<typeof PrimitiveTypeSchema>;\n\nexport const LiteralTypeSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"booleanLiteral\"), value: z.boolean() }),\n z.object({ type: z.literal(\"stringLiteral\"), value: z.string() })\n]);\nexport type LiteralType = z.infer<typeof LiteralTypeSchema>;\n\nexport type TypeReference =\n | TypeReference.Id\n | TypeReference.Primitive\n | TypeReference.Optional\n | TypeReference.Nullable\n | TypeReference.List\n | TypeReference.Set\n | TypeReference.Map\n | TypeReference.Literal\n | TypeReference.Unknown;\n\nexport namespace TypeReference {\n export interface Id {\n type: \"id\";\n value: string;\n default?: TypeReferenceIdDefault | null;\n }\n export interface Primitive {\n type: \"primitive\";\n value: PrimitiveType;\n }\n export interface Optional {\n type: \"optional\";\n itemType: TypeReference;\n defaultValue?: unknown | null;\n }\n export interface Nullable {\n type: \"nullable\";\n itemType: TypeReference;\n }\n export interface List {\n type: \"list\";\n itemType: TypeReference;\n minItems?: number | null;\n maxItems?: number | null;\n }\n export interface Set {\n type: \"set\";\n itemType: TypeReference;\n minItems?: number | null;\n maxItems?: number | null;\n }\n export interface Map {\n type: \"map\";\n keyType: TypeReference;\n valueType: TypeReference;\n minProperties?: number | null;\n maxProperties?: number | null;\n }\n export interface Literal {\n type: \"literal\";\n value: LiteralType;\n }\n export interface Unknown {\n type: \"unknown\";\n }\n}\n\nexport const TypeReferenceSchema: z.ZodType<TypeReference> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"id\"),\n value: TypeIdSchema,\n default: TypeReferenceIdDefaultSchema.nullish()\n }),\n z.object({\n type: z.literal(\"primitive\"),\n value: PrimitiveTypeSchema\n }),\n z.object({\n type: z.literal(\"optional\"),\n itemType: TypeReferenceSchema,\n defaultValue: z.unknown().nullish()\n }),\n z.object({\n type: z.literal(\"nullable\"),\n itemType: TypeReferenceSchema\n }),\n z.object({\n type: z.literal(\"list\"),\n itemType: TypeReferenceSchema,\n minItems: z.number().int().nullish(),\n maxItems: z.number().int().nullish()\n }),\n z.object({\n type: z.literal(\"set\"),\n itemType: TypeReferenceSchema,\n minItems: z.number().int().nullish(),\n maxItems: z.number().int().nullish()\n }),\n z.object({\n type: z.literal(\"map\"),\n keyType: TypeReferenceSchema,\n valueType: TypeReferenceSchema,\n minProperties: z.number().int().nullish(),\n maxProperties: z.number().int().nullish()\n }),\n z.object({\n type: z.literal(\"literal\"),\n value: LiteralTypeSchema\n }),\n z.object({\n type: z.literal(\"unknown\")\n })\n ])\n);\n\nexport interface GraphQlArgument {\n description?: string | null;\n availability?: z.infer<typeof AvailabilitySchema> | null;\n name: string;\n type: TypeReference;\n defaultValue?: unknown | null;\n}\nexport const GraphQlArgumentSchema: z.ZodType<GraphQlArgument> = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n name: z.string(),\n type: TypeReferenceSchema,\n defaultValue: z.unknown().nullish()\n});\n\nexport const ObjectPropertySchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n key: PropertyKeySchema,\n valueType: TypeReferenceSchema,\n propertyAccess: ObjectPropertyAccessSchema.nullish(),\n arguments: z.array(GraphQlArgumentSchema).nullish()\n});\nexport type ObjectProperty = z.infer<typeof ObjectPropertySchema>;\n\nexport const ObjectTypeSchema = z.object({\n extends: z.array(TypeIdSchema),\n properties: z.array(ObjectPropertySchema),\n extraProperties: TypeReferenceSchema.nullish()\n});\nexport type ObjectType = z.infer<typeof ObjectTypeSchema>;\n\nexport const EnumValueSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n value: z.string()\n});\nexport type EnumValue = z.infer<typeof EnumValueSchema>;\n\nexport const EnumTypeSchema = z.object({\n default: z.string().nullish(),\n values: z.array(EnumValueSchema)\n});\nexport type EnumType = z.infer<typeof EnumTypeSchema>;\n\nexport const DiscriminatedUnionVariantSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n discriminantValue: z.string(),\n displayName: z.string().nullish(),\n additionalProperties: ObjectTypeSchema\n});\nexport type DiscriminatedUnionVariant = z.infer<typeof DiscriminatedUnionVariantSchema>;\n\nexport const DiscriminatedUnionTypeSchema = z.object({\n discriminant: z.string(),\n variants: z.array(DiscriminatedUnionVariantSchema)\n});\nexport type DiscriminatedUnionType = z.infer<typeof DiscriminatedUnionTypeSchema>;\n\nexport const ContentTypeSchema = z.union([z.string(), z.array(z.string())]);\nexport type ContentType = z.infer<typeof ContentTypeSchema>;\n\nexport const FilePropertySingleSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n key: PropertyKeySchema,\n isOptional: z.boolean(),\n contentType: ContentTypeSchema.nullish()\n});\nexport type FilePropertySingle = z.infer<typeof FilePropertySingleSchema>;\n\nexport const FilePropertyArraySchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n key: PropertyKeySchema,\n isOptional: z.boolean(),\n contentType: ContentTypeSchema.nullish()\n});\nexport type FilePropertyArray = z.infer<typeof FilePropertyArraySchema>;\n\nexport const FormDataFilePropertySchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"file\"), ...FilePropertySingleSchema.shape }),\n z.object({ type: z.literal(\"fileArray\"), ...FilePropertyArraySchema.shape })\n]);\nexport type FormDataFileProperty = z.infer<typeof FormDataFilePropertySchema>;\n\nexport const FormDataBodyPropertySchema = z.object({\n ...ObjectPropertySchema.shape,\n contentType: ContentTypeSchema.nullish(),\n exploded: z.boolean().nullish()\n});\nexport type FormDataBodyProperty = z.infer<typeof FormDataBodyPropertySchema>;\n\nexport const FormDataPropertySchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"file\"), value: FormDataFilePropertySchema }),\n z.object({ type: z.literal(\"bodyProperty\"), ...FormDataBodyPropertySchema.shape })\n]);\nexport type FormDataProperty = z.infer<typeof FormDataPropertySchema>;\n\nexport const FormDataRequestSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n name: z.string(),\n properties: z.array(FormDataPropertySchema)\n});\nexport type FormDataRequest = z.infer<typeof FormDataRequestSchema>;\n\nexport const EndpointPathPartSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"literal\"), value: z.string() }),\n z.object({ type: z.literal(\"pathParameter\"), value: PropertyKeySchema })\n]);\nexport type EndpointPathPart = z.infer<typeof EndpointPathPartSchema>;\n\nexport const PathParameterSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n key: PropertyKeySchema,\n type: TypeReferenceSchema,\n explode: z.boolean().nullish()\n});\nexport type PathParameter = z.infer<typeof PathParameterSchema>;\n\nexport const EndpointPathSchema = z.object({\n parts: z.array(EndpointPathPartSchema),\n pathParameters: z.array(PathParameterSchema)\n});\nexport type EndpointPath = z.infer<typeof EndpointPathSchema>;\n\nexport const QueryParameterSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n key: z.string(),\n type: TypeReferenceSchema,\n explode: z.boolean().nullish()\n});\nexport type QueryParameter = z.infer<typeof QueryParameterSchema>;\n\nexport const HeaderSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n key: z.string(),\n type: TypeReferenceSchema\n});\nexport type Header = z.infer<typeof HeaderSchema>;\n\nexport const JsonBodyShapeSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"object\"), ...ObjectTypeSchema.shape }),\n z.object({ type: z.literal(\"reference\"), value: TypeReferenceSchema })\n]);\nexport type JsonBodyShape = z.infer<typeof JsonBodyShapeSchema>;\n\nexport const FileDownloadResponseBodyShapeSchema = z.object({\n contentType: z.string().nullish()\n});\nexport type FileDownloadResponseBodyShape = z.infer<typeof FileDownloadResponseBodyShapeSchema>;\n\nexport const StreamResponseV2Schema = z.object({\n terminator: z.string().nullish(),\n shape: JsonBodyShapeSchema\n});\nexport type StreamResponseV2 = z.infer<typeof StreamResponseV2Schema>;\n\nexport const StreamConditionSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"booleanRequestProperty\"), value: PropertyKeySchema })\n]);\nexport type StreamCondition = z.infer<typeof StreamConditionSchema>;\n\nexport const FilenameWithDataSchema = z.object({\n filename: z.string(),\n data: FileIdSchema\n});\nexport type FilenameWithData = z.infer<typeof FilenameWithDataSchema>;\n\nexport const FormValueSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"json\"), value: z.unknown() }),\n z.object({ type: z.literal(\"filename\"), value: z.string() }),\n z.object({ type: z.literal(\"filenames\"), value: z.array(z.string()) }),\n z.object({ type: z.literal(\"filenameWithData\"), ...FilenameWithDataSchema.shape }),\n z.object({ type: z.literal(\"filenamesWithData\"), value: z.array(FilenameWithDataSchema) }),\n z.object({ type: z.literal(\"exploded\"), value: z.array(z.unknown()) })\n]);\nexport type FormValue = z.infer<typeof FormValueSchema>;\n\nexport const BytesValueSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"base64\"), value: z.string() })\n]);\nexport type BytesValue = z.infer<typeof BytesValueSchema>;\n\n// The form variant uses z.unknown() for record values instead of FormValueSchema to be\n// forward-compatible with new form value types and to tolerate form values produced by\n// the AI example enhancer (which may not conform to the strict FormValueSchema).\n// Example data is display-only and does not require strict validation at registration time.\nexport const ExampleEndpointRequestSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"json\"), value: z.unknown() }),\n z.object({ type: z.literal(\"form\"), value: z.record(z.string(), z.unknown()) }),\n z.object({ type: z.literal(\"bytes\"), value: BytesValueSchema })\n]);\nexport type ExampleEndpointRequest = z.infer<typeof ExampleEndpointRequestSchema>;\n\nexport const ExampleServerSentEventSchema = z.object({\n event: z.string(),\n data: z.unknown()\n});\nexport type ExampleServerSentEvent = z.infer<typeof ExampleServerSentEventSchema>;\n\nexport const ExampleEndpointResponseSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"json\"), value: z.unknown() }),\n z.object({ type: z.literal(\"filename\"), value: z.unknown() }),\n z.object({ type: z.literal(\"stream\"), value: z.array(z.unknown()) }),\n z.object({ type: z.literal(\"sse\"), value: z.array(ExampleServerSentEventSchema) })\n]);\nexport type ExampleEndpointResponse = z.infer<typeof ExampleEndpointResponseSchema>;\n\nexport const ErrorDeclarationSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n type: TypeReferenceSchema.nullish(),\n statusCode: z.number().int()\n});\nexport type ErrorDeclaration = z.infer<typeof ErrorDeclarationSchema>;\n\nexport const ExampleErrorResponseSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"json\"), value: z.unknown() })\n]);\nexport type ExampleErrorResponse = z.infer<typeof ExampleErrorResponseSchema>;\n\nexport const ErrorExampleSchema = z.object({\n description: z.string().nullish(),\n name: z.string().nullish(),\n responseBody: ExampleErrorResponseSchema\n});\nexport type ErrorExample = z.infer<typeof ErrorExampleSchema>;\n\nexport const GraphQlOperationTypeSchema = z.enum([\"QUERY\", \"MUTATION\", \"SUBSCRIPTION\"]);\nexport type GraphQlOperationType = z.infer<typeof GraphQlOperationTypeSchema>;\n\nexport const GraphQlExampleSchema = z.object({\n description: z.string().nullish(),\n name: z.string().nullish(),\n query: z.string(),\n variables: z.record(z.string(), z.unknown()).nullish(),\n response: z.unknown().nullish()\n});\nexport type GraphQlExample = z.infer<typeof GraphQlExampleSchema>;\n\nexport const CodeSnippetSchema = z.object({\n description: z.string().nullish(),\n name: z.string().nullish(),\n language: z.string(),\n install: z.string().nullish(),\n code: z.string(),\n generated: z.boolean()\n});\nexport type CodeSnippet = z.infer<typeof CodeSnippetSchema>;\n\nexport const GraphQlOperationSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n id: GraphQlOperationIdSchema,\n operationType: GraphQlOperationTypeSchema,\n name: z.string(),\n displayName: z.string().nullish(),\n fieldPath: z.array(z.string()).nullish(),\n arguments: z.array(GraphQlArgumentSchema).nullish(),\n returnType: TypeReferenceSchema,\n examples: z.array(GraphQlExampleSchema).nullish(),\n snippets: z.record(z.string(), z.array(CodeSnippetSchema)).nullish()\n});\nexport type GraphQlOperation = z.infer<typeof GraphQlOperationSchema>;\n\nexport const WebhookPayloadShapeSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"object\"), ...ObjectTypeSchema.shape }),\n z.object({ type: z.literal(\"reference\"), value: TypeReferenceSchema }),\n z.object({ type: z.literal(\"formData\"), ...FormDataRequestSchema.shape })\n]);\nexport type WebhookPayloadShape = z.infer<typeof WebhookPayloadShapeSchema>;\n\nexport const WebhookPayloadSchema = z.object({\n description: z.string().nullish(),\n type: WebhookPayloadShapeSchema\n});\nexport type WebhookPayload = z.infer<typeof WebhookPayloadSchema>;\n\nexport const ExampleWebhookPayloadSchema = z.object({\n name: z.string().nullish(),\n payload: z.unknown()\n});\nexport type ExampleWebhookPayload = z.infer<typeof ExampleWebhookPayloadSchema>;\n\nexport const WebSocketMessageBodyShapeSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"object\"), ...ObjectTypeSchema.shape }),\n z.object({ type: z.literal(\"reference\"), value: TypeReferenceSchema })\n]);\nexport type WebSocketMessageBodyShape = z.infer<typeof WebSocketMessageBodyShapeSchema>;\n\nexport const WebSocketMessageSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n type: WebSocketMessageIdSchema,\n displayName: z.string().nullish(),\n origin: WebSocketMessageOriginSchema,\n body: WebSocketMessageBodyShapeSchema\n});\nexport type WebSocketMessage = z.infer<typeof WebSocketMessageSchema>;\n\nexport const ExampleWebSocketMessageSchema = z.object({\n type: WebSocketMessageIdSchema,\n body: z.unknown()\n});\nexport type ExampleWebSocketMessage = z.infer<typeof ExampleWebSocketMessageSchema>;\n\nexport const ExampleWebSocketSessionSchema = z.object({\n description: z.string().nullish(),\n name: z.string().nullish(),\n path: z.string(),\n pathParameters: z.record(PropertyKeySchema, z.unknown()),\n queryParameters: z.record(z.string(), z.unknown()),\n headers: z.record(z.string(), z.unknown()),\n messages: z.array(ExampleWebSocketMessageSchema)\n});\nexport type ExampleWebSocketSession = z.infer<typeof ExampleWebSocketSessionSchema>;\n\nexport type ApiNavigationConfigItem =\n | ApiNavigationConfigItem.Subpackage\n | ApiNavigationConfigItem.EndpointId\n | ApiNavigationConfigItem.WebsocketId\n | ApiNavigationConfigItem.WebhookId\n | ApiNavigationConfigItem.GraphqlOperationId;\n\nexport namespace ApiNavigationConfigItem {\n export interface Subpackage {\n type: \"subpackage\";\n subpackageId: string;\n items: ApiNavigationConfigItem[];\n }\n export interface EndpointId {\n type: \"endpointId\";\n value: string;\n }\n export interface WebsocketId {\n type: \"websocketId\";\n value: string;\n }\n export interface WebhookId {\n type: \"webhookId\";\n value: string;\n }\n export interface GraphqlOperationId {\n type: \"graphqlOperationId\";\n value: string;\n }\n}\n\nexport const ApiNavigationConfigItemSchema: z.ZodType<ApiNavigationConfigItem> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"subpackage\"),\n subpackageId: SubpackageIdSchema,\n items: z.array(ApiNavigationConfigItemSchema)\n }),\n z.object({ type: z.literal(\"endpointId\"), value: EndpointIdSchema }),\n z.object({ type: z.literal(\"websocketId\"), value: WebSocketIdSchema }),\n z.object({ type: z.literal(\"webhookId\"), value: WebhookIdSchema }),\n z.object({ type: z.literal(\"graphqlOperationId\"), value: GraphQlOperationIdSchema })\n ])\n);\n\nexport const ApiNavigationConfigRootSchema = z.object({\n items: z.array(ApiNavigationConfigItemSchema)\n});\nexport type ApiNavigationConfigRoot = z.infer<typeof ApiNavigationConfigRootSchema>;\n\n/**\n * Shown below the scheme's input in the API playground instead of `description`.\n * Supports a markdown subset: `[label](url)` links (absolute or relative), bare URLs,\n * `inline code`, and blank-line-separated paragraphs. Set via `x-fern-playground-description`.\n */\nconst PlaygroundDescriptionSchema = z.string().nullish();\n\nexport const BearerAuthSchema = z.object({\n description: z.string().nullish(),\n playgroundDescription: PlaygroundDescriptionSchema,\n tokenName: z.string().nullish()\n});\nexport type BearerAuth = z.infer<typeof BearerAuthSchema>;\n\nexport const BasicAuthSchema = z.object({\n description: z.string().nullish(),\n playgroundDescription: PlaygroundDescriptionSchema,\n usernameName: z.string().nullish(),\n passwordName: z.string().nullish(),\n passwordAlwaysEmpty: z.boolean().nullish()\n});\nexport type BasicAuth = z.infer<typeof BasicAuthSchema>;\n\nexport const HeaderAuthSchema = z.object({\n description: z.string().nullish(),\n playgroundDescription: PlaygroundDescriptionSchema,\n nameOverride: z.string().nullish(),\n headerWireValue: z.string(),\n prefix: z.string().nullish()\n});\nexport type HeaderAuth = z.infer<typeof HeaderAuthSchema>;\n\nexport const OAuthClientCredentialsReferencedEndpointSchema = z.object({\n description: z.string().nullish(),\n playgroundDescription: PlaygroundDescriptionSchema,\n endpointId: EndpointIdSchema,\n accessTokenLocator: z.string(),\n headerName: z.string().nullish(),\n tokenPrefix: z.string().nullish()\n});\nexport type OAuthClientCredentialsReferencedEndpoint = z.infer<typeof OAuthClientCredentialsReferencedEndpointSchema>;\n\nexport const OAuthClientCredentialsSchema = z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"referencedEndpoint\"),\n ...OAuthClientCredentialsReferencedEndpointSchema.shape\n })\n]);\nexport type OAuthClientCredentials = z.infer<typeof OAuthClientCredentialsSchema>;\n\nexport const OAuthSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"clientCredentials\"), value: OAuthClientCredentialsSchema })\n]);\nexport type OAuth = z.infer<typeof OAuthSchema>;\n\nexport const ApiAuthSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"bearerAuth\"), ...BearerAuthSchema.shape }),\n z.object({ type: z.literal(\"basicAuth\"), ...BasicAuthSchema.shape }),\n z.object({ type: z.literal(\"header\"), ...HeaderAuthSchema.shape }),\n z.object({ type: z.literal(\"oAuth\"), value: OAuthSchema })\n]);\nexport type ApiAuth = z.infer<typeof ApiAuthSchema>;\n","import * as z from \"zod\";\n\n// ── Org / API identifiers ──────────────────────────────────────────────\n\nexport const OrgIdSchema = z.string();\nexport type OrgId = z.infer<typeof OrgIdSchema>;\nexport function OrgId(value: string): OrgId {\n return value;\n}\n\nexport const ApiIdSchema = z.string();\nexport type ApiId = z.infer<typeof ApiIdSchema>;\nexport function ApiId(value: string): ApiId {\n return value;\n}\n\nexport const ApiDefinitionIdSchema = z.string().uuid();\nexport type ApiDefinitionId = z.infer<typeof ApiDefinitionIdSchema>;\nexport function ApiDefinitionId(value: string): ApiDefinitionId {\n return value;\n}\n\n// ── HTTP / Endpoint schemas ─────────────────────────────────────────────\n\nexport const HttpMethodSchema = z.enum([\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\", \"HEAD\"]);\nexport type HttpMethod = z.infer<typeof HttpMethodSchema>;\n\nexport const HttpMethod = {\n Get: \"GET\",\n Post: \"POST\",\n Put: \"PUT\",\n Patch: \"PATCH\",\n Delete: \"DELETE\",\n Head: \"HEAD\"\n} as const;\n\nexport const UrlSchema: z.ZodType<Url> = z.string() as any;\nexport type Url = string & { Url: void };\nexport function Url(value: string): Url {\n return value as unknown as Url;\n}\n\nexport const EndpointPathLiteralSchema = z.string();\nexport type EndpointPathLiteral = z.infer<typeof EndpointPathLiteralSchema>;\nexport function EndpointPathLiteral(value: string): EndpointPathLiteral {\n return value;\n}\n\nexport const EndpointIdentifierSchema = z.object({\n path: z.string(),\n method: HttpMethodSchema,\n identifierOverride: z.string().nullish()\n});\nexport type EndpointIdentifier = z.infer<typeof EndpointIdentifierSchema>;\n\n// ── SDK request schema ──────────────────────────────────────────────────\n\nexport type SdkRequest =\n | { type: \"typescript\"; package: string; version: string | undefined }\n | { type: \"python\"; package: string; version: string | undefined }\n | { type: \"go\"; githubRepo: string; version: string | undefined }\n | { type: \"ruby\"; gem: string; version: string | undefined }\n | { type: \"java\"; group: string; artifact: string; version: string | undefined }\n | { type: \"csharp\"; package: string; version: string | undefined };\n\nexport const SdkRequestSchema: z.ZodType<SdkRequest> = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"typescript\"), package: z.string(), version: z.string().nullish() }),\n z.object({ type: z.literal(\"python\"), package: z.string(), version: z.string().nullish() }),\n z.object({ type: z.literal(\"go\"), githubRepo: z.string(), version: z.string().nullish() }),\n z.object({ type: z.literal(\"ruby\"), gem: z.string(), version: z.string().nullish() }),\n z.object({\n type: z.literal(\"java\"),\n group: z.string(),\n artifact: z.string(),\n version: z.string().nullish()\n }),\n z.object({ type: z.literal(\"csharp\"), package: z.string(), version: z.string().nullish() })\n]) as any;\n\n// ── Additional identifiers ─────────────────────────────────────────────\n\nexport const DocsConfigIdSchema = z.string();\nexport type DocsConfigId = z.infer<typeof DocsConfigIdSchema>;\nexport function DocsConfigId(value: string): DocsConfigId {\n return value;\n}\n\nexport const GrpcIdSchema = z.string();\nexport type GrpcId = z.infer<typeof GrpcIdSchema>;\nexport function GrpcId(value: string): GrpcId {\n return value;\n}\n\nexport const PageIdSchema = z.string();\nexport type PageId = z.infer<typeof PageIdSchema>;\nexport function PageId(value: string): PageId {\n return value;\n}\n\nexport const RoleIdSchema = z.string();\nexport type RoleId = z.infer<typeof RoleIdSchema>;\nexport function RoleId(value: string): RoleId {\n return value;\n}\n\nexport const TokenIdSchema = z.string();\nexport type TokenId = z.infer<typeof TokenIdSchema>;\n\nexport const VersionIdSchema = z.string();\nexport type VersionId = z.infer<typeof VersionIdSchema>;\nexport function VersionId(value: string): VersionId {\n return value;\n}\n\n// ── Enums ──────────────────────────────────────────────────────────────\n\nexport const LinkTarget = {\n Blank: \"_blank\",\n Self: \"_self\",\n Parent: \"_parent\",\n Top: \"_top\"\n} as const;\nexport type LinkTarget = (typeof LinkTarget)[keyof typeof LinkTarget];\n\nexport const GrpcMethod = {\n Unary: \"UNARY\",\n ClientStream: \"CLIENT_STREAM\",\n ServerStream: \"SERVER_STREAM\",\n BidirectionalStream: \"BIDIRECTIONAL_STREAM\"\n} as const;\nexport type GrpcMethod = (typeof GrpcMethod)[keyof typeof GrpcMethod];\n\nexport const Availability = {\n Alpha: \"Alpha\",\n Stable: \"Stable\",\n GenerallyAvailable: \"GenerallyAvailable\",\n InDevelopment: \"InDevelopment\",\n PreRelease: \"PreRelease\",\n Deprecated: \"Deprecated\",\n Beta: \"Beta\",\n Preview: \"Preview\",\n Legacy: \"Legacy\"\n} as const;\nexport type Availability = (typeof Availability)[keyof typeof Availability];\n\nexport const SupportedLanguage = {\n Curl: \"curl\",\n Python: \"python\",\n Javascript: \"javascript\",\n Js: \"js\",\n Node: \"node\",\n Typescript: \"typescript\",\n Ts: \"ts\",\n Go: \"go\",\n Ruby: \"ruby\",\n Csharp: \"csharp\",\n Php: \"php\",\n Swift: \"swift\",\n Rust: \"rust\"\n} as const;\nexport type SupportedLanguage = (typeof SupportedLanguage)[keyof typeof SupportedLanguage];\n\nexport const HttpSnippetLanguage = {\n Curl: \"curl\",\n Csharp: \"csharp\",\n Go: \"go\",\n Java: \"java\",\n Javascript: \"javascript\",\n Php: \"php\",\n Python: \"python\",\n Ruby: \"ruby\",\n Swift: \"swift\",\n Rust: \"rust\",\n Typescript: \"typescript\"\n} as const;\nexport type HttpSnippetLanguage = (typeof HttpSnippetLanguage)[keyof typeof HttpSnippetLanguage];\n\n// ── Error types ────────────────────────────────────────────────────────\n\nexport interface InvalidDomainErrorBody {\n /** Value the domain should end with (i.e. docs.buildwithfern.com or dev.docs.buildwithfern.com) */\n requiredDomainSuffix: string;\n}\n\n// ── Docs types ─────────────────────────────────────────────────────────\n\nexport interface AnnouncementConfig {\n /** The text to display in the banner, using markdown. */\n text: string;\n}\n\n// ── Snippet types ──────────────────────────────────────────────────────\n\nexport type SnippetsByEndpointMethod = Partial<Record<HttpMethod, Snippet[]>>;\n\nexport const SnippetsByEndpointMethodSchema: z.ZodType<SnippetsByEndpointMethod> = z.record(\n HttpMethodSchema,\n z.array(z.unknown())\n) as any;\n\n// ── SDK types for snippets ────────────────────────────────────────────\n\nexport interface TypeScriptSdk {\n package: string;\n version: string;\n}\n\nexport interface PythonSdk {\n package: string;\n version: string;\n}\n\nexport interface GoSdk {\n githubRepo: string;\n version: string;\n}\n\nexport interface RubySdk {\n gem: string;\n version: string;\n}\n\nexport interface CsharpSdk {\n package: string;\n version: string;\n}\n\nexport interface JavaSdk {\n group: string;\n artifact: string;\n version: string;\n}\n\nexport interface TypeScriptSnippet {\n sdk: TypeScriptSdk;\n client: string;\n}\n\nexport interface PythonSnippet {\n sdk: PythonSdk;\n async_client: string;\n sync_client: string;\n}\n\nexport interface GoSnippet {\n sdk: GoSdk;\n client: string;\n}\n\nexport interface RubySnippet {\n sdk: RubySdk;\n client: string;\n}\n\nexport interface CsharpSnippet {\n sdk: CsharpSdk;\n client: string;\n}\n\nexport interface JavaSnippet {\n sdk: JavaSdk;\n async_client: string;\n sync_client: string;\n}\n\n// ── Snippet discriminated union ───────────────────────────────────────\n\n// ── Snippet code types (used to deserialize snippet data from DB) ────\n\nexport interface TypeScriptSnippetCode {\n client: string;\n}\n\nexport interface PythonSnippetCode {\n async_client: string;\n sync_client: string;\n}\n\nexport interface GoSnippetCode {\n client: string;\n}\n\nexport interface RubySnippetCode {\n client: string;\n}\n\nexport interface JavaSnippetCode {\n async_client: string;\n sync_client: string;\n}\n\nexport interface CsharpSnippetCode {\n client: string;\n}\n\n// ── Sdk type (SdkRequest with required version) ─────────────────────\n\nexport const SdkSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"typescript\"), package: z.string(), version: z.string() }),\n z.object({ type: z.literal(\"python\"), package: z.string(), version: z.string() }),\n z.object({ type: z.literal(\"go\"), githubRepo: z.string(), version: z.string() }),\n z.object({ type: z.literal(\"ruby\"), gem: z.string(), version: z.string() }),\n z.object({\n type: z.literal(\"java\"),\n group: z.string(),\n artifact: z.string(),\n version: z.string()\n }),\n z.object({ type: z.literal(\"csharp\"), package: z.string(), version: z.string() })\n]);\nexport type Sdk = z.infer<typeof SdkSchema>;\n\n// ── Template type (generic template placeholder) ────────────────────\nexport type Template = unknown;\n\nexport type Snippet = Snippet.Typescript | Snippet.Python | Snippet.Java | Snippet.Go | Snippet.Ruby | Snippet.Csharp;\n\nexport namespace Snippet {\n interface _Base {\n exampleIdentifier: string | undefined;\n }\n\n export interface Typescript extends TypeScriptSnippet, _Base {\n type: \"typescript\";\n }\n\n export interface Python extends PythonSnippet, _Base {\n type: \"python\";\n }\n\n export interface Java extends JavaSnippet, _Base {\n type: \"java\";\n }\n\n export interface Go extends GoSnippet, _Base {\n type: \"go\";\n }\n\n export interface Ruby extends RubySnippet, _Base {\n type: \"ruby\";\n }\n\n export interface Csharp extends CsharpSnippet, _Base {\n type: \"csharp\";\n }\n}\n","export type TypeId = string;\nexport type EndpointId = string;\nexport type WebSocketId = string;\nexport type WebhookId = string;\nexport type GraphQlOperationId = string;\nexport type EnvironmentId = string;\nexport type PropertyKey = string;\nexport type AuthSchemeId = string;\nexport type SubpackageId = string;\nexport type WebSocketMessageId = string;\nexport type FileId = string & { FileId: void };\n\nexport function TypeId(value: string): TypeId {\n return value;\n}\n\nexport function EndpointId(value: string): EndpointId {\n return value;\n}\n\nexport function WebSocketId(value: string): WebSocketId {\n return value;\n}\n\nexport function WebhookId(value: string): WebhookId {\n return value;\n}\n\nexport function GraphQlOperationId(value: string): GraphQlOperationId {\n return value;\n}\n\nexport function EnvironmentId(value: string): EnvironmentId {\n return value;\n}\n\nexport function PropertyKey(value: string): PropertyKey {\n return value;\n}\n\nexport function AuthSchemeId(value: string): AuthSchemeId {\n return value;\n}\n\nexport function SubpackageId(value: string): SubpackageId {\n return value;\n}\n\nexport function WebSocketMessageId(value: string): WebSocketMessageId {\n return value;\n}\n\n/**\n * Resolve every GraphQL operation id backing a graphql node: the primary\n * operation plus any grouped (namespace) operations, deduplicated.\n *\n * The primary `graphqlOperationId` is NOT guaranteed to appear in\n * `graphqlOperationIds` — for namespace nodes it is the parent operation, which\n * lives outside the grouped-children list — so it must be unioned in explicitly.\n * Any caller that needs the full operation set (pruning, search indexing,\n * markdown) must use this rather than reading `graphqlOperationIds` directly.\n */\nexport function getGraphqlOperationIds(node: {\n graphqlOperationId: GraphQlOperationId;\n graphqlOperationIds?: GraphQlOperationId[] | undefined;\n}): GraphQlOperationId[] {\n const ids = new Set<GraphQlOperationId>(node.graphqlOperationIds ?? []);\n ids.add(node.graphqlOperationId);\n return [...ids];\n}\n\nexport function FileId(value: string): FileId {\n return value as unknown as FileId;\n}\n","import * as z from \"zod\";\nimport type { DiscriminatedUnionType, EnumType, ObjectType, TypeReference } from \"./shared.js\";\nimport {\n ApiAuthSchema,\n ApiDefinitionIdSchema,\n ApiNavigationConfigRootSchema,\n AuthSchemeIdSchema,\n AvailabilitySchema,\n DiscriminatedUnionTypeSchema,\n EndpointIdSchema,\n EndpointPathSchema,\n EnumTypeSchema,\n EnvironmentIdSchema,\n EnvironmentSchema,\n ErrorDeclarationSchema,\n ErrorExampleSchema,\n ExampleEndpointRequestSchema,\n ExampleEndpointResponseSchema,\n ExampleWebhookPayloadSchema,\n ExampleWebSocketSessionSchema,\n FileDownloadResponseBodyShapeSchema,\n FormDataRequestSchema,\n GraphQlOperationSchema,\n HeaderSchema,\n HttpMethodSchema,\n JsonBodyShapeSchema,\n MultipleAuthTypeSchema,\n ObjectTypeSchema,\n PropertyKeySchema,\n ProtocolSchema,\n QueryParameterSchema,\n StreamConditionSchema,\n StreamResponseV2Schema,\n SubpackageIdSchema,\n TypeIdSchema,\n TypeReferenceSchema,\n WebhookHttpMethodSchema,\n WebhookIdSchema,\n WebhookPayloadSchema,\n WebSocketIdSchema,\n WebSocketMessageSchema\n} from \"./shared.js\";\n\n// ── Register commons ─────────────────────────────────────────────────────\n\nexport const JqStringSchema = z.string();\nexport type JqString = z.infer<typeof JqStringSchema>;\n\nexport const RegisterLanguageSchema = z.string();\nexport type RegisterLanguage = z.infer<typeof RegisterLanguageSchema>;\n\n// ── Register type ────────────────────────────────────────────────────────\n\nexport const RegisterUndiscriminatedUnionVariantSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n typeName: z.string().nullish(),\n type: TypeReferenceSchema,\n displayName: z.string().nullish()\n});\nexport type RegisterUndiscriminatedUnionVariant = z.infer<typeof RegisterUndiscriminatedUnionVariantSchema>;\n\nexport const RegisterUndiscriminatedUnionTypeSchema = z.object({\n variants: z.array(RegisterUndiscriminatedUnionVariantSchema)\n});\nexport type RegisterUndiscriminatedUnionType = z.infer<typeof RegisterUndiscriminatedUnionTypeSchema>;\n\nexport type RegisterTypeShape =\n | RegisterTypeShape.Alias\n | RegisterTypeShape.Enum\n | RegisterTypeShape.UndiscriminatedUnion\n | RegisterTypeShape.DiscriminatedUnion\n | RegisterTypeShape.Object_;\n\nexport namespace RegisterTypeShape {\n export interface Alias {\n type: \"alias\";\n value: TypeReference;\n }\n export interface Enum extends EnumType {\n type: \"enum\";\n }\n export interface UndiscriminatedUnion extends RegisterUndiscriminatedUnionType {\n type: \"undiscriminatedUnion\";\n }\n export interface DiscriminatedUnion extends DiscriminatedUnionType {\n type: \"discriminatedUnion\";\n }\n export interface Object_ extends ObjectType {\n type: \"object\";\n }\n}\n\nexport const RegisterTypeShapeSchema: z.ZodType<RegisterTypeShape> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"alias\"),\n value: TypeReferenceSchema\n }),\n z.object({\n type: z.literal(\"enum\"),\n ...EnumTypeSchema.shape\n }),\n z.object({\n type: z.literal(\"undiscriminatedUnion\"),\n ...RegisterUndiscriminatedUnionTypeSchema.shape\n }),\n z.object({\n type: z.literal(\"discriminatedUnion\"),\n ...DiscriminatedUnionTypeSchema.shape\n }),\n z.object({\n type: z.literal(\"object\"),\n ...ObjectTypeSchema.shape\n })\n ])\n);\n\nexport const RegisterTypeDefinitionSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n name: z.string(),\n shape: RegisterTypeShapeSchema,\n displayName: z.string().nullish()\n});\nexport type RegisterTypeDefinition = z.infer<typeof RegisterTypeDefinitionSchema>;\n\nexport const RegisterBytesRequestSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n isOptional: z.boolean(),\n contentType: z.string().nullish()\n});\nexport type RegisterBytesRequest = z.infer<typeof RegisterBytesRequestSchema>;\n\n// ── Register endpoint ────────────────────────────────────────────────────\n\nexport const RegisterJsonRequestBodySchema = z.object({\n contentType: z.string(),\n shape: JsonBodyShapeSchema\n});\nexport type RegisterJsonRequestBody = z.infer<typeof RegisterJsonRequestBodySchema>;\n\nexport const RegisterHttpRequestBodyShapeSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"json\"), ...RegisterJsonRequestBodySchema.shape }),\n z.object({ type: z.literal(\"formData\"), ...FormDataRequestSchema.shape }),\n z.object({ type: z.literal(\"bytes\"), ...RegisterBytesRequestSchema.shape }),\n z.object({ type: z.literal(\"object\"), ...ObjectTypeSchema.shape }),\n z.object({ type: z.literal(\"reference\"), value: TypeReferenceSchema }),\n z.object({ type: z.literal(\"fileUpload\"), value: FormDataRequestSchema.nullish() })\n]);\nexport type RegisterHttpRequestBodyShape = z.infer<typeof RegisterHttpRequestBodyShapeSchema>;\n\nexport const RegisterHttpRequestSchema = z.object({\n description: z.string().nullish(),\n type: RegisterHttpRequestBodyShapeSchema\n});\nexport type RegisterHttpRequest = z.infer<typeof RegisterHttpRequestSchema>;\n\nexport const RegisterHttpRequestsV2Schema = z.object({\n requests: z.array(RegisterHttpRequestSchema).nullish()\n});\nexport type RegisterHttpRequestsV2 = z.infer<typeof RegisterHttpRequestsV2Schema>;\n\nexport const RegisterCustomCodeSampleSchema = z.object({\n description: z.string().nullish(),\n language: z.string(),\n code: z.string(),\n name: z.string().nullish(),\n install: z.string().nullish()\n});\nexport type RegisterCustomCodeSample = z.infer<typeof RegisterCustomCodeSampleSchema>;\n\nexport const RegisterExampleEndpointCallSchema = z.object({\n description: z.string().nullish(),\n name: z.string().nullish(),\n contentType: z.string().nullish(),\n path: z.string(),\n pathParameters: z.record(PropertyKeySchema, z.unknown()),\n queryParameters: z.record(z.string(), z.unknown()),\n headers: z.record(z.string(), z.unknown()),\n requestBody: z.unknown(),\n requestBodyV3: ExampleEndpointRequestSchema.nullish(),\n responseStatusCode: z.number().int(),\n responseBody: z.unknown(),\n responseBodyV3: ExampleEndpointResponseSchema.nullish(),\n responseHeaders: z.record(z.string(), z.unknown()).nullish(),\n codeSamples: z.array(RegisterCustomCodeSampleSchema).nullish()\n});\nexport type RegisterExampleEndpointCall = z.infer<typeof RegisterExampleEndpointCallSchema>;\n\nexport const RegisterNonStreamResponseSchema = z.object({\n shape: JsonBodyShapeSchema,\n examples: z.array(RegisterExampleEndpointCallSchema)\n});\nexport type RegisterNonStreamResponse = z.infer<typeof RegisterNonStreamResponseSchema>;\n\nexport const RegisterStreamResponseSchema = z.object({\n shape: JsonBodyShapeSchema,\n examples: z.array(RegisterExampleEndpointCallSchema)\n});\nexport type RegisterStreamResponse = z.infer<typeof RegisterStreamResponseSchema>;\n\nexport const RegisterStreamConditionResponseSchema = z.object({\n response: RegisterNonStreamResponseSchema,\n streamResponse: RegisterStreamResponseSchema,\n streamCondition: StreamConditionSchema\n});\nexport type RegisterStreamConditionResponse = z.infer<typeof RegisterStreamConditionResponseSchema>;\n\nexport const RegisterHttpResponseBodyShapeSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"object\"), ...ObjectTypeSchema.shape }),\n z.object({ type: z.literal(\"reference\"), value: TypeReferenceSchema }),\n z.object({ type: z.literal(\"fileDownload\"), ...FileDownloadResponseBodyShapeSchema.shape }),\n z.object({ type: z.literal(\"streamingText\") }),\n z.object({ type: z.literal(\"stream\"), ...StreamResponseV2Schema.shape }),\n z.object({ type: z.literal(\"streamCondition\"), ...RegisterStreamConditionResponseSchema.shape })\n]);\nexport type RegisterHttpResponseBodyShape = z.infer<typeof RegisterHttpResponseBodyShapeSchema>;\n\nexport const RegisterHttpResponseSchema = z.object({\n description: z.string().nullish(),\n type: RegisterHttpResponseBodyShapeSchema,\n statusCode: z.number().int().nullish(),\n isWildcard: z.boolean().nullish()\n});\nexport type RegisterHttpResponse = z.infer<typeof RegisterHttpResponseSchema>;\n\nexport const RegisterHttpResponsesV2Schema = z.object({\n responses: z.array(RegisterHttpResponseSchema).nullish()\n});\nexport type RegisterHttpResponsesV2 = z.infer<typeof RegisterHttpResponsesV2Schema>;\n\nexport const RegisterErrorDeclarationV2Schema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n type: RegisterTypeShapeSchema.nullish(),\n statusCode: z.number().int(),\n isWildcard: z.boolean().nullish(),\n name: z.string().nullish(),\n examples: z.array(ErrorExampleSchema).nullish(),\n headers: z.array(HeaderSchema).nullish()\n});\nexport type RegisterErrorDeclarationV2 = z.infer<typeof RegisterErrorDeclarationV2Schema>;\n\nexport const RegisterEndpointDefinitionSchema = z.object({\n description: z.string().nullish(),\n subtitle: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n slug: z.string().nullish(),\n auth: z.boolean().nullish(),\n authV2: z.array(AuthSchemeIdSchema).nullish(),\n multiAuth: z.array(MultipleAuthTypeSchema).nullish(),\n defaultEnvironment: EnvironmentIdSchema.nullish(),\n environments: z.array(EnvironmentSchema).nullish(),\n method: HttpMethodSchema,\n id: EndpointIdSchema,\n originalEndpointId: z.string().nullish(),\n name: z.string().nullish(),\n path: EndpointPathSchema,\n queryParameters: z.array(QueryParameterSchema),\n headers: z.array(HeaderSchema),\n responseHeaders: z.array(HeaderSchema).nullish(),\n request: RegisterHttpRequestSchema.nullish(),\n requestsV2: RegisterHttpRequestsV2Schema.nullish(),\n response: RegisterHttpResponseSchema.nullish(),\n responsesV2: RegisterHttpResponsesV2Schema.nullish(),\n errors: z.array(ErrorDeclarationSchema).nullish(),\n errorsV2: z.array(RegisterErrorDeclarationV2Schema).nullish(),\n examples: z.array(RegisterExampleEndpointCallSchema),\n protocol: ProtocolSchema.nullish(),\n includeInApiExplorer: z.boolean().nullish()\n});\nexport type RegisterEndpointDefinition = z.infer<typeof RegisterEndpointDefinitionSchema>;\n\n// ── Register webhook ─────────────────────────────────────────────────────\n\nexport const RegisterWebhookDefinitionSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n method: WebhookHttpMethodSchema,\n id: WebhookIdSchema,\n name: z.string().nullish(),\n path: z.array(z.string()),\n headers: z.array(HeaderSchema),\n payload: WebhookPayloadSchema,\n responses: z.array(RegisterHttpResponseSchema).nullish(),\n examples: z.array(ExampleWebhookPayloadSchema)\n});\nexport type RegisterWebhookDefinition = z.infer<typeof RegisterWebhookDefinitionSchema>;\n\n// ── Register websocket ───────────────────────────────────────────────────\n\nexport const RegisterWebSocketChannelSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n id: WebSocketIdSchema,\n auth: z.boolean(),\n name: z.string().nullish(),\n defaultEnvironment: EnvironmentIdSchema.nullish(),\n environments: z.array(EnvironmentSchema),\n path: EndpointPathSchema,\n headers: z.array(HeaderSchema),\n queryParameters: z.array(QueryParameterSchema),\n messages: z.array(WebSocketMessageSchema),\n examples: z.array(ExampleWebSocketSessionSchema),\n includeInApiExplorer: z.boolean().nullish()\n});\nexport type RegisterWebSocketChannel = z.infer<typeof RegisterWebSocketChannelSchema>;\n\n// ── Register index schemas ───────────────────────────────────────────────\n\nexport const SourceIdSchema = z.string();\nexport type SourceId = z.infer<typeof SourceIdSchema>;\nexport function SourceId(value: string): SourceId {\n return value;\n}\n\nexport const SourceSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"openapi\") }),\n z.object({ type: z.literal(\"asyncapi\") }),\n z.object({ type: z.literal(\"proto\") })\n]);\nexport type Source = z.infer<typeof SourceSchema>;\n\nexport const SourceUploadSchema = z.object({\n uploadUrl: z.string(),\n downloadUrl: z.string()\n});\nexport type SourceUpload = z.infer<typeof SourceUploadSchema>;\n\nexport const DynamicIRSchema = z.object({\n dynamicIR: z.unknown()\n});\nexport type DynamicIR = z.infer<typeof DynamicIRSchema>;\n\nexport const DynamicIRUploadSchema = z.object({\n uploadUrl: z.string()\n});\nexport type DynamicIRUpload = z.infer<typeof DynamicIRUploadSchema>;\n\nexport const TypescriptPackageSchema = z.object({\n package: z.string(),\n version: z.string().nullish()\n});\nexport type TypescriptPackage = z.infer<typeof TypescriptPackageSchema>;\n\nexport const PythonPackageSchema = z.object({\n package: z.string(),\n version: z.string().nullish()\n});\nexport type PythonPackage = z.infer<typeof PythonPackageSchema>;\n\nexport const GoModuleSchema = z.object({\n githubRepo: z.string(),\n version: z.string().nullish()\n});\nexport type GoModule = z.infer<typeof GoModuleSchema>;\n\nexport const JavaCoordinateSchema = z.object({\n coordinate: z.string(),\n version: z.string().nullish()\n});\nexport type JavaCoordinate = z.infer<typeof JavaCoordinateSchema>;\n\nexport const RubyGemSchema = z.object({\n gem: z.string(),\n version: z.string().nullish()\n});\nexport type RubyGem = z.infer<typeof RubyGemSchema>;\n\nexport const NugetPackageSchema = z.object({\n package: z.string(),\n version: z.string().nullish()\n});\nexport type NugetPackage = z.infer<typeof NugetPackageSchema>;\n\nexport const ComposerPackageSchema = z.object({\n package: z.string(),\n version: z.string().nullish()\n});\nexport type ComposerPackage = z.infer<typeof ComposerPackageSchema>;\n\nexport const SwiftPackageSchema = z.object({\n package: z.string(),\n version: z.string().nullish()\n});\nexport type SwiftPackage = z.infer<typeof SwiftPackageSchema>;\n\nexport const CratesPackageSchema = z.object({\n package: z.string(),\n version: z.string().nullish()\n});\nexport type CratesPackage = z.infer<typeof CratesPackageSchema>;\n\nexport const SnippetsConfigSchema = z.object({\n typescriptSdk: TypescriptPackageSchema.nullish(),\n pythonSdk: PythonPackageSchema.nullish(),\n goSdk: GoModuleSchema.nullish(),\n javaSdk: JavaCoordinateSchema.nullish(),\n rubySdk: RubyGemSchema.nullish(),\n csharpSdk: NugetPackageSchema.nullish(),\n phpSdk: ComposerPackageSchema.nullish(),\n swiftSdk: SwiftPackageSchema.nullish(),\n rustSdk: CratesPackageSchema.nullish()\n});\nexport type SnippetsConfig = z.infer<typeof SnippetsConfigSchema>;\n\nexport const RegisterApiDefinitionPackageSchema = z.object({\n endpoints: z.array(RegisterEndpointDefinitionSchema),\n websockets: z.array(RegisterWebSocketChannelSchema).nullish(),\n webhooks: z.array(RegisterWebhookDefinitionSchema).nullish(),\n graphqlOperations: z.array(GraphQlOperationSchema).nullish(),\n types: z.array(TypeIdSchema),\n subpackages: z.array(SubpackageIdSchema),\n pointsTo: SubpackageIdSchema.nullish()\n});\nexport type RegisterApiDefinitionPackage = z.infer<typeof RegisterApiDefinitionPackageSchema>;\n\nexport const RegisterApiDefinitionSubpackageSchema = z.object({\n ...RegisterApiDefinitionPackageSchema.shape,\n description: z.string().nullish(),\n subpackageId: SubpackageIdSchema,\n name: z.string(),\n displayName: z.string().nullish()\n});\nexport type RegisterApiDefinitionSubpackage = z.infer<typeof RegisterApiDefinitionSubpackageSchema>;\n\nexport const RegisterApiDefinitionSchema = z.object({\n rootPackage: RegisterApiDefinitionPackageSchema,\n apiName: z.string().nullish(),\n specVersion: z.string().nullish(),\n types: z.record(TypeIdSchema, RegisterTypeDefinitionSchema),\n subpackages: z.record(SubpackageIdSchema, RegisterApiDefinitionSubpackageSchema),\n auth: ApiAuthSchema.nullish(),\n authSchemes: z.record(AuthSchemeIdSchema, ApiAuthSchema).nullish(),\n globalHeaders: z.array(HeaderSchema).nullish(),\n snippetsConfiguration: SnippetsConfigSchema.nullish(),\n navigation: ApiNavigationConfigRootSchema.nullish()\n});\nexport type RegisterApiDefinition = z.infer<typeof RegisterApiDefinitionSchema>;\n\nexport const RegisterApiDefinitionResponseSchema = z.object({\n apiDefinitionId: ApiDefinitionIdSchema,\n sources: z.record(SourceIdSchema, SourceUploadSchema).nullish(),\n dynamicIRs: z.record(z.string(), DynamicIRUploadSchema).nullish()\n});\nexport type RegisterApiDefinitionResponse = z.infer<typeof RegisterApiDefinitionResponseSchema>;\n\nexport const SnippetInfoSchema = z.object({\n packageName: z.string(),\n version: z.string().nullish()\n});\nexport type SnippetInfo = z.infer<typeof SnippetInfoSchema>;\n\nexport const SdkDynamicIrDownloadSchema = z.object({\n downloadUrl: z.string()\n});\nexport type SdkDynamicIrDownload = z.infer<typeof SdkDynamicIrDownloadSchema>;\n\nexport const GetSdkDynamicIrUploadUrlsResponseSchema = z.object({\n uploadUrls: z.record(z.string(), DynamicIRUploadSchema)\n});\nexport type GetSdkDynamicIrUploadUrlsResponse = z.infer<typeof GetSdkDynamicIrUploadUrlsResponseSchema>;\n\nexport const CheckSdkDynamicIrExistsResponseSchema = z.object({\n existingDynamicIrs: z.record(z.string(), SdkDynamicIrDownloadSchema)\n});\nexport type CheckSdkDynamicIrExistsResponse = z.infer<typeof CheckSdkDynamicIrExistsResponseSchema>;\n\nexport const EndpointExampleGenerationErrorBodySchema = z.object({\n endpointId: z.string()\n});\nexport type EndpointExampleGenerationErrorBody = z.infer<typeof EndpointExampleGenerationErrorBodySchema>;\n","import * as z from \"zod\";\nimport { SnippetsConfigSchema } from \"./contract-register.js\";\n\nimport type { DiscriminatedUnionType, EnumType, ObjectType, TypeReference } from \"./shared.js\";\nimport {\n ApiAuthSchema,\n ApiDefinitionIdSchema,\n ApiNavigationConfigRootSchema,\n AuthSchemeIdSchema,\n AvailabilitySchema,\n DiscriminatedUnionTypeSchema,\n EndpointIdSchema,\n EndpointPathSchema,\n EnumTypeSchema,\n EnvironmentIdSchema,\n EnvironmentSchema,\n ErrorDeclarationSchema,\n ErrorExampleSchema,\n ExampleEndpointRequestSchema,\n ExampleEndpointResponseSchema,\n ExampleWebhookPayloadSchema,\n ExampleWebSocketSessionSchema,\n FileDownloadResponseBodyShapeSchema,\n FormDataRequestSchema,\n GraphQlOperationSchema,\n HeaderSchema,\n HttpMethodSchema,\n JsonBodyShapeSchema,\n MultipleAuthTypeSchema,\n ObjectTypeSchema,\n PropertyKeySchema,\n ProtocolSchema,\n QueryParameterSchema,\n StreamConditionSchema,\n StreamResponseV2Schema,\n SubpackageIdSchema,\n TypeIdSchema,\n TypeReferenceSchema,\n WebhookHttpMethodSchema,\n WebhookIdSchema,\n WebhookPayloadSchema,\n WebSocketIdSchema,\n WebSocketMessageSchema\n} from \"./shared.js\";\n\n// ── Read type ────────────────────────────────────────────────────────────\n\nexport const ReadUndiscriminatedUnionVariantSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n displayName: z.string().nullish(),\n type: TypeReferenceSchema\n});\nexport type ReadUndiscriminatedUnionVariant = z.infer<typeof ReadUndiscriminatedUnionVariantSchema>;\n\nexport const ReadUndiscriminatedUnionTypeSchema = z.object({\n variants: z.array(ReadUndiscriminatedUnionVariantSchema)\n});\nexport type ReadUndiscriminatedUnionType = z.infer<typeof ReadUndiscriminatedUnionTypeSchema>;\n\nexport type ReadTypeShape =\n | ReadTypeShape.Alias\n | ReadTypeShape.Enum\n | ReadTypeShape.UndiscriminatedUnion\n | ReadTypeShape.DiscriminatedUnion\n | ReadTypeShape.Object_;\n\nexport namespace ReadTypeShape {\n export interface Alias {\n type: \"alias\";\n value: TypeReference;\n }\n export interface Enum extends EnumType {\n type: \"enum\";\n }\n export interface UndiscriminatedUnion extends ReadUndiscriminatedUnionType {\n type: \"undiscriminatedUnion\";\n }\n export interface DiscriminatedUnion extends DiscriminatedUnionType {\n type: \"discriminatedUnion\";\n }\n export interface Object_ extends ObjectType {\n type: \"object\";\n }\n}\n\nexport const ReadTypeShapeSchema: z.ZodType<ReadTypeShape> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"alias\"),\n value: TypeReferenceSchema\n }),\n z.object({\n type: z.literal(\"enum\"),\n ...EnumTypeSchema.shape\n }),\n z.object({\n type: z.literal(\"undiscriminatedUnion\"),\n ...ReadUndiscriminatedUnionTypeSchema.shape\n }),\n z.object({\n type: z.literal(\"discriminatedUnion\"),\n ...DiscriminatedUnionTypeSchema.shape\n }),\n z.object({\n type: z.literal(\"object\"),\n ...ObjectTypeSchema.shape\n })\n ])\n);\n\nexport const ReadTypeDefinitionSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n name: z.string(),\n shape: ReadTypeShapeSchema,\n displayName: z.string().nullish()\n});\nexport type ReadTypeDefinition = z.infer<typeof ReadTypeDefinitionSchema>;\n\nexport const ReadBytesRequestSchema = z.object({\n isOptional: z.boolean(),\n contentType: z.string().nullish()\n});\nexport type ReadBytesRequest = z.infer<typeof ReadBytesRequestSchema>;\n\n// ── Read endpoint ────────────────────────────────────────────────────────\n\nexport const ReadHttpRequestBodyShapeSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"object\"), ...ObjectTypeSchema.shape }),\n z.object({ type: z.literal(\"reference\"), value: TypeReferenceSchema }),\n z.object({ type: z.literal(\"bytes\"), ...ReadBytesRequestSchema.shape }),\n z.object({ type: z.literal(\"formData\"), ...FormDataRequestSchema.shape }),\n z.object({ type: z.literal(\"fileUpload\"), value: FormDataRequestSchema.nullish() })\n]);\nexport type ReadHttpRequestBodyShape = z.infer<typeof ReadHttpRequestBodyShapeSchema>;\n\nexport const ReadHttpRequestSchema = z.object({\n description: z.string().nullish(),\n contentType: z.string(),\n type: ReadHttpRequestBodyShapeSchema\n});\nexport type ReadHttpRequest = z.infer<typeof ReadHttpRequestSchema>;\n\nexport const ReadHttpRequestsV2Schema = z.object({\n requests: z.array(ReadHttpRequestSchema).nullish()\n});\nexport type ReadHttpRequestsV2 = z.infer<typeof ReadHttpRequestsV2Schema>;\n\nexport const ReadSupportedLanguageSchema = z.enum([\n \"curl\",\n \"python\",\n \"javascript\",\n \"js\",\n \"node\",\n \"typescript\",\n \"ts\",\n \"go\",\n \"ruby\",\n \"csharp\",\n \"php\",\n \"swift\",\n \"rust\"\n]);\nexport type ReadSupportedLanguage = z.infer<typeof ReadSupportedLanguageSchema>;\n\nexport const ReadLanguageSchema = z.union([ReadSupportedLanguageSchema, z.string()]);\nexport type ReadLanguage = z.infer<typeof ReadLanguageSchema>;\n\nexport const ReadCustomCodeSampleSchema = z.object({\n description: z.string().nullish(),\n language: ReadLanguageSchema,\n code: z.string(),\n name: z.string().nullish(),\n install: z.string().nullish()\n});\nexport type ReadCustomCodeSample = z.infer<typeof ReadCustomCodeSampleSchema>;\n\nexport const ReadPythonSnippetSchema = z.object({\n async_client: z.string(),\n sync_client: z.string(),\n install: z.string().nullish()\n});\nexport type ReadPythonSnippet = z.infer<typeof ReadPythonSnippetSchema>;\n\nexport const ReadTypescriptSnippetSchema = z.object({\n client: z.string(),\n install: z.string().nullish()\n});\nexport type ReadTypescriptSnippet = z.infer<typeof ReadTypescriptSnippetSchema>;\n\nexport const ReadGoSnippetSchema = z.object({\n client: z.string(),\n install: z.string().nullish()\n});\nexport type ReadGoSnippet = z.infer<typeof ReadGoSnippetSchema>;\n\nexport const ReadRubySnippetSchema = z.object({\n client: z.string(),\n install: z.string().nullish()\n});\nexport type ReadRubySnippet = z.infer<typeof ReadRubySnippetSchema>;\n\nexport const ReadCsharpSnippetSchema = z.object({\n client: z.string(),\n install: z.string().nullish()\n});\nexport type ReadCsharpSnippet = z.infer<typeof ReadCsharpSnippetSchema>;\n\nexport const ReadCodeExamplesSchema = z.object({\n nodeAxios: z.string().nullish(),\n pythonSdk: ReadPythonSnippetSchema.nullish(),\n typescriptSdk: ReadTypescriptSnippetSchema.nullish(),\n goSdk: ReadGoSnippetSchema.nullish(),\n rubySdk: ReadRubySnippetSchema.nullish(),\n csharpSdk: ReadCsharpSnippetSchema.nullish()\n});\nexport type ReadCodeExamples = z.infer<typeof ReadCodeExamplesSchema>;\n\nexport const ReadExampleEndpointCallSchema = z.object({\n description: z.string().nullish(),\n name: z.string().nullish(),\n contentType: z.string().nullish(),\n path: z.string(),\n pathParameters: z.record(PropertyKeySchema, z.unknown()),\n queryParameters: z.record(z.string(), z.unknown()),\n headers: z.record(z.string(), z.unknown()),\n requestBody: z.unknown(),\n requestBodyV3: ExampleEndpointRequestSchema.nullish(),\n responseStatusCode: z.number().int(),\n responseBody: z.unknown(),\n responseBodyV3: ExampleEndpointResponseSchema.nullish(),\n responseHeaders: z.record(z.string(), z.unknown()).nullish(),\n codeExamples: ReadCodeExamplesSchema,\n codeSamples: z.array(ReadCustomCodeSampleSchema)\n});\nexport type ReadExampleEndpointCall = z.infer<typeof ReadExampleEndpointCallSchema>;\n\nexport const ReadNonStreamResponseSchema = z.object({\n shape: JsonBodyShapeSchema,\n examples: z.array(ReadExampleEndpointCallSchema)\n});\nexport type ReadNonStreamResponse = z.infer<typeof ReadNonStreamResponseSchema>;\n\nexport const ReadStreamResponseSchema = z.object({\n shape: JsonBodyShapeSchema,\n examples: z.array(ReadExampleEndpointCallSchema)\n});\nexport type ReadStreamResponse = z.infer<typeof ReadStreamResponseSchema>;\n\nexport const ReadStreamConditionResponseSchema = z.object({\n response: ReadNonStreamResponseSchema,\n streamResponse: ReadStreamResponseSchema,\n streamCondition: StreamConditionSchema\n});\nexport type ReadStreamConditionResponse = z.infer<typeof ReadStreamConditionResponseSchema>;\n\nexport const ReadHttpResponseBodyShapeSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"object\"), ...ObjectTypeSchema.shape }),\n z.object({ type: z.literal(\"reference\"), value: TypeReferenceSchema }),\n z.object({ type: z.literal(\"fileDownload\"), ...FileDownloadResponseBodyShapeSchema.shape }),\n z.object({ type: z.literal(\"streamingText\") }),\n z.object({ type: z.literal(\"stream\"), ...StreamResponseV2Schema.shape }),\n z.object({ type: z.literal(\"streamCondition\"), ...ReadStreamConditionResponseSchema.shape })\n]);\nexport type ReadHttpResponseBodyShape = z.infer<typeof ReadHttpResponseBodyShapeSchema>;\n\nexport const ReadHttpResponseSchema = z.object({\n description: z.string().nullish(),\n type: ReadHttpResponseBodyShapeSchema,\n statusCode: z.number().int().nullish(),\n isWildcard: z.boolean().nullish()\n});\nexport type ReadHttpResponse = z.infer<typeof ReadHttpResponseSchema>;\n\nexport const ReadHttpResponsesV2Schema = z.object({\n responses: z.array(ReadHttpResponseSchema).nullish()\n});\nexport type ReadHttpResponsesV2 = z.infer<typeof ReadHttpResponsesV2Schema>;\n\nexport const ReadErrorDeclarationV2Schema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n type: ReadTypeShapeSchema.nullish(),\n statusCode: z.number().int(),\n isWildcard: z.boolean().nullish(),\n name: z.string().nullish(),\n examples: z.array(ErrorExampleSchema).nullish(),\n headers: z.array(HeaderSchema).nullish()\n});\nexport type ReadErrorDeclarationV2 = z.infer<typeof ReadErrorDeclarationV2Schema>;\n\nexport const ReadEndpointDefinitionSchema = z.object({\n description: z.string().nullish(),\n subtitle: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n authed: z.boolean(),\n authV2: z.array(AuthSchemeIdSchema).nullish(),\n multiAuth: z.array(MultipleAuthTypeSchema).nullish(),\n defaultEnvironment: EnvironmentIdSchema.nullish(),\n environments: z.array(EnvironmentSchema),\n method: HttpMethodSchema,\n id: EndpointIdSchema,\n originalEndpointId: z.string().nullish(),\n urlSlug: z.string(),\n migratedFromUrlSlugs: z.array(z.string()).nullish(),\n name: z.string().nullish(),\n path: EndpointPathSchema,\n queryParameters: z.array(QueryParameterSchema),\n headers: z.array(HeaderSchema),\n responseHeaders: z.array(HeaderSchema).nullish(),\n request: ReadHttpRequestSchema.nullish(),\n requestsV2: ReadHttpRequestsV2Schema.nullish(),\n response: ReadHttpResponseSchema.nullish(),\n responsesV2: ReadHttpResponsesV2Schema.nullish(),\n errors: z.array(ErrorDeclarationSchema),\n errorsV2: z.array(ReadErrorDeclarationV2Schema).nullish(),\n examples: z.array(ReadExampleEndpointCallSchema),\n protocol: ProtocolSchema.nullish(),\n includeInApiExplorer: z.boolean().nullish()\n});\nexport type ReadEndpointDefinition = z.infer<typeof ReadEndpointDefinitionSchema>;\n\n// ── Read webhook ─────────────────────────────────────────────────────────\n\nexport const ReadWebhookDefinitionSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n urlSlug: z.string(),\n migratedFromUrlSlugs: z.array(z.string()).nullish(),\n method: WebhookHttpMethodSchema,\n id: WebhookIdSchema,\n name: z.string().nullish(),\n path: z.array(z.string()),\n headers: z.array(HeaderSchema),\n payload: WebhookPayloadSchema,\n responses: z.array(ReadHttpResponseSchema).nullish(),\n examples: z.array(ExampleWebhookPayloadSchema)\n});\nexport type ReadWebhookDefinition = z.infer<typeof ReadWebhookDefinitionSchema>;\n\n// ── Read websocket ───────────────────────────────────────────────────────\n\nexport const ReadWebSocketChannelSchema = z.object({\n description: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n urlSlug: z.string(),\n id: WebSocketIdSchema,\n auth: z.boolean(),\n name: z.string().nullish(),\n defaultEnvironment: EnvironmentIdSchema.nullish(),\n environments: z.array(EnvironmentSchema),\n path: EndpointPathSchema,\n headers: z.array(HeaderSchema),\n queryParameters: z.array(QueryParameterSchema),\n messages: z.array(WebSocketMessageSchema),\n examples: z.array(ExampleWebSocketSessionSchema),\n includeInApiExplorer: z.boolean().nullish()\n});\nexport type ReadWebSocketChannel = z.infer<typeof ReadWebSocketChannelSchema>;\n\n// ── Read ApiDefinition ───────────────────────────────────────────────────\n\nexport const ReadApiDefinitionPackageSchema = z.object({\n endpoints: z.array(ReadEndpointDefinitionSchema),\n websockets: z.array(ReadWebSocketChannelSchema),\n webhooks: z.array(ReadWebhookDefinitionSchema),\n graphqlOperations: z.array(GraphQlOperationSchema),\n types: z.array(TypeIdSchema),\n subpackages: z.array(SubpackageIdSchema),\n pointsTo: SubpackageIdSchema.nullish()\n});\nexport type ReadApiDefinitionPackage = z.infer<typeof ReadApiDefinitionPackageSchema>;\n\nexport const ReadApiDefinitionSubpackageSchema = z.object({\n description: z.string().nullish(),\n ...ReadApiDefinitionPackageSchema.shape,\n parent: SubpackageIdSchema.nullish(),\n subpackageId: SubpackageIdSchema,\n name: z.string(),\n urlSlug: z.string(),\n displayName: z.string().nullish()\n});\nexport type ReadApiDefinitionSubpackage = z.infer<typeof ReadApiDefinitionSubpackageSchema>;\n\nexport const ReadApiDefinitionSchema = z.object({\n id: ApiDefinitionIdSchema,\n apiName: z.string().nullish(),\n specVersion: z.string().nullish(),\n rootPackage: ReadApiDefinitionPackageSchema,\n types: z.record(TypeIdSchema, ReadTypeDefinitionSchema),\n subpackages: z.record(SubpackageIdSchema, ReadApiDefinitionSubpackageSchema),\n snippetsConfiguration: SnippetsConfigSchema.nullish(),\n auth: ApiAuthSchema.nullish(),\n authSchemes: z.record(AuthSchemeIdSchema, ApiAuthSchema).nullish(),\n hasMultipleBaseUrls: z.boolean().nullish(),\n navigation: ApiNavigationConfigRootSchema.nullish(),\n globalHeaders: z.array(HeaderSchema).nullish()\n});\nexport type ReadApiDefinition = z.infer<typeof ReadApiDefinitionSchema>;\n","import * as z from \"zod\";\nimport {\n RegisterErrorDeclarationV2Schema,\n RegisterExampleEndpointCallSchema,\n RegisterHttpRequestBodyShapeSchema,\n RegisterHttpResponseSchema,\n RegisterHttpResponsesV2Schema,\n RegisterTypeDefinitionSchema,\n RegisterWebhookDefinitionSchema,\n RegisterWebSocketChannelSchema,\n SnippetsConfigSchema\n} from \"./contract-register.js\";\nimport {\n ApiAuthSchema,\n ApiDefinitionIdSchema,\n ApiNavigationConfigRootSchema,\n AuthSchemeIdSchema,\n AvailabilitySchema,\n EndpointIdSchema,\n EndpointPathSchema,\n EnvironmentIdSchema,\n EnvironmentSchema,\n ErrorDeclarationSchema,\n GraphQlOperationSchema,\n HeaderSchema,\n HttpMethodSchema,\n MultipleAuthTypeSchema,\n ProtocolSchema,\n QueryParameterSchema,\n SubpackageIdSchema,\n TypeIdSchema\n} from \"./shared.js\";\n\n// ── DB endpoint ──────────────────────────────────────────────────────────\n\nexport const EndpointSnippetTemplatesSchema = z.object({\n typescript: z.unknown().nullish(),\n python: z.unknown().nullish()\n});\nexport type EndpointSnippetTemplates = z.infer<typeof EndpointSnippetTemplatesSchema>;\n\nexport const DbHttpRequestSchema = z.object({\n description: z.string().nullish(),\n contentType: z.string().nullish(),\n type: RegisterHttpRequestBodyShapeSchema\n});\nexport type DbHttpRequest = z.infer<typeof DbHttpRequestSchema>;\n\nexport const DbHttpRequestsV2Schema = z.object({\n requests: z.array(DbHttpRequestSchema).nullish()\n});\nexport type DbHttpRequestsV2 = z.infer<typeof DbHttpRequestsV2Schema>;\n\nexport const DbEndpointDefinitionSchema = z.object({\n description: z.string().nullish(),\n subtitle: z.string().nullish(),\n availability: AvailabilitySchema.nullish(),\n authed: z.boolean().nullish(),\n authV2: z.array(AuthSchemeIdSchema).nullish(),\n multiAuth: z.array(MultipleAuthTypeSchema).nullish(),\n defaultEnvironment: EnvironmentIdSchema.nullish(),\n environments: z.array(EnvironmentSchema).nullish(),\n method: HttpMethodSchema,\n id: EndpointIdSchema,\n originalEndpointId: z.string().nullish(),\n urlSlug: z.string(),\n migratedFromUrlSlugs: z.array(z.string()).nullish(),\n name: z.string().nullish(),\n path: EndpointPathSchema,\n queryParameters: z.array(QueryParameterSchema),\n headers: z.array(HeaderSchema),\n responseHeaders: z.array(HeaderSchema).nullish(),\n request: DbHttpRequestSchema.nullish(),\n requestsV2: DbHttpRequestsV2Schema.nullish(),\n response: RegisterHttpResponseSchema.nullish(),\n responsesV2: RegisterHttpResponsesV2Schema.nullish(),\n errors: z.array(ErrorDeclarationSchema).nullish(),\n errorsV2: z.array(RegisterErrorDeclarationV2Schema).nullish(),\n examples: z.array(RegisterExampleEndpointCallSchema),\n snippetTemplates: EndpointSnippetTemplatesSchema.nullish(),\n protocol: ProtocolSchema.nullish(),\n includeInApiExplorer: z.boolean().nullish()\n});\nexport type DbEndpointDefinition = z.infer<typeof DbEndpointDefinitionSchema>;\n\n// ── DB ApiDefinition ─────────────────────────────────────────────────────\n\nexport const DbApiDefinitionPackageSchema = z.object({\n endpoints: z.array(DbEndpointDefinitionSchema),\n websockets: z.array(RegisterWebSocketChannelSchema).nullish(),\n webhooks: z.array(RegisterWebhookDefinitionSchema).nullish(),\n graphqlOperations: z.array(GraphQlOperationSchema).nullish(),\n types: z.array(TypeIdSchema),\n subpackages: z.array(SubpackageIdSchema),\n pointsTo: SubpackageIdSchema.nullish()\n});\nexport type DbApiDefinitionPackage = z.infer<typeof DbApiDefinitionPackageSchema>;\n\nexport const DbApiDefinitionSubpackageSchema = z.object({\n ...DbApiDefinitionPackageSchema.shape,\n description: z.string().nullish(),\n parent: SubpackageIdSchema.nullish(),\n subpackageId: SubpackageIdSchema,\n name: z.string(),\n urlSlug: z.string(),\n displayName: z.string().nullish()\n});\nexport type DbApiDefinitionSubpackage = z.infer<typeof DbApiDefinitionSubpackageSchema>;\n\nexport const DbApiDefinitionSchema = z.object({\n id: ApiDefinitionIdSchema,\n apiName: z.string().nullish(),\n specVersion: z.string().nullish(),\n rootPackage: DbApiDefinitionPackageSchema,\n types: z.record(TypeIdSchema, RegisterTypeDefinitionSchema),\n subpackages: z.record(SubpackageIdSchema, DbApiDefinitionSubpackageSchema),\n snippetsConfiguration: SnippetsConfigSchema.nullish(),\n auth: ApiAuthSchema.nullish(),\n authSchemes: z.record(AuthSchemeIdSchema, ApiAuthSchema).nullish(),\n hasMultipleBaseUrls: z.boolean(),\n navigation: ApiNavigationConfigRootSchema.nullish(),\n globalHeaders: z.array(HeaderSchema).nullish()\n});\nexport type DbApiDefinition = z.infer<typeof DbApiDefinitionSchema>;\n\nexport const DbEndpointWithContextSchema = z.object({\n endpoint: DbEndpointDefinitionSchema,\n authSchemes: z.record(AuthSchemeIdSchema, ApiAuthSchema).nullish(),\n globalHeaders: z.array(HeaderSchema).nullish()\n});\nexport type DbEndpointWithContext = z.infer<typeof DbEndpointWithContextSchema>;\n","import * as z from \"zod\";\nimport type { RootNode } from \"../../navigation/types/v1.js\";\nimport type { PageId, Url } from \"./read-commons\";\nimport {\n AgentsConfigSchema,\n AIChatConfigSchema,\n AnalyticsConfigSchema,\n AnnouncementConfigSchema,\n ApiDefinitionIdSchema,\n AvailabilitySchema,\n CssConfigSchema,\n DocsConfigIdSchema,\n DocsLayoutConfigSchema,\n DocsSettingsConfigSchema,\n DocsThemeConfigSchema,\n DocsTranslationsConfigSchema,\n DocsTypographyConfigV2Schema,\n EditThisPageLaunchSchema,\n FileIdSchema,\n FooterLinkSchema,\n IframeConfigSchema,\n IntegrationsConfigSchema,\n JsConfigSchema,\n LanguageSchema,\n MetadataConfigSchema,\n NavbarLinkSchema,\n PageActionsConfigSchema,\n ProgrammingLanguageSchema,\n RedirectConfigSchema,\n RgbaColorSchema,\n UrlSchema\n} from \"./read-commons\";\nimport {\n ApiArtifactsSchema,\n ApiSectionV2Schema,\n ChangelogItemSchema,\n ChangelogSectionSchema,\n ChangelogSectionV3Schema,\n GitHubRepoSchema,\n HeightSchema,\n LinkMetadataSchema,\n MavenPackageSchema,\n NavigationNodeMetadataSchema,\n NavigationTabLinkSchema,\n NpmPackageSchema,\n PageContentSchema,\n PageIdSchema,\n PageMetadataSchema,\n PublishedPostmanCollectionSchema,\n PublishedSdkSchema,\n PypiPackageSchema,\n ApiNavigationConfigItemSchema as SharedApiNavigationConfigItemSchema,\n ApiNavigationConfigRootSchema as SharedApiNavigationConfigRootSchema,\n SubpackageIdSchema,\n VersionIdSchema\n} from \"./shared\";\n\nexport type { ApiNavigationConfigItem } from \"./shared\";\n\nexport {\n ApiArtifactsSchema,\n ApiSectionV2Schema,\n ChangelogItemSchema,\n ChangelogSectionSchema,\n ChangelogSectionV3Schema,\n GitHubRepoSchema,\n HeightSchema,\n LinkMetadataSchema,\n MavenPackageSchema,\n NavigationNodeMetadataSchema,\n NavigationTabLinkSchema,\n NpmPackageSchema,\n PageContentSchema,\n PageMetadataSchema,\n PublishedPostmanCollectionSchema,\n PublishedSdkSchema,\n PypiPackageSchema,\n SubpackageIdSchema\n};\n\nexport type {\n ApiArtifacts,\n ApiSectionV2,\n ChangelogItem,\n ChangelogSection,\n ChangelogSectionV3,\n GitHubRepo,\n Height,\n LinkMetadata,\n MavenPackage,\n NavigationNodeMetadata,\n NavigationTabLink,\n NpmPackage,\n PageContent,\n PageMetadata,\n PublishedPostmanCollection,\n PublishedSdk,\n PypiPackage,\n SubpackageId\n} from \"./shared\";\n\nexport const UrlFileSchema = z.object({\n url: UrlSchema\n});\nexport type UrlFile = z.infer<typeof UrlFileSchema>;\n\nexport const ImageFileSchema = z.object({\n url: UrlSchema,\n width: z.number(),\n height: z.number(),\n blurDataUrl: z.string().optional(),\n alt: z.string().optional()\n});\nexport type ImageFile = z.infer<typeof ImageFileSchema>;\n\nexport const FileSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"url\"), ...UrlFileSchema.shape }),\n z.object({ type: z.literal(\"image\"), ...ImageFileSchema.shape })\n]);\nexport type File_ = z.infer<typeof FileSchema>;\n\nexport const BackgroundSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"solid\"), ...RgbaColorSchema.shape }),\n z.object({ type: z.literal(\"gradient\") })\n]);\nexport type Background = z.infer<typeof BackgroundSchema>;\n\nexport const ThemeConfigSchema = z.object({\n logo: FileIdSchema.optional(),\n backgroundImage: FileIdSchema.optional(),\n accentPrimary: RgbaColorSchema,\n background: BackgroundSchema,\n border: RgbaColorSchema.optional(),\n sidebarBackground: RgbaColorSchema.optional(),\n headerBackground: RgbaColorSchema.optional(),\n cardBackground: RgbaColorSchema.optional(),\n accent1: RgbaColorSchema.optional(),\n accent2: RgbaColorSchema.optional(),\n accent3: RgbaColorSchema.optional(),\n accent4: RgbaColorSchema.optional(),\n accent5: RgbaColorSchema.optional(),\n accent6: RgbaColorSchema.optional(),\n accent7: RgbaColorSchema.optional(),\n accent8: RgbaColorSchema.optional(),\n accent9: RgbaColorSchema.optional(),\n accent10: RgbaColorSchema.optional(),\n accent11: RgbaColorSchema.optional(),\n accent12: RgbaColorSchema.optional()\n});\nexport type ThemeConfig = z.infer<typeof ThemeConfigSchema>;\n\nexport const DarkAndLightModeConfigSchema = z.object({\n dark: ThemeConfigSchema,\n light: ThemeConfigSchema\n});\nexport type DarkAndLightModeConfig = z.infer<typeof DarkAndLightModeConfigSchema>;\n\nexport const ColorsConfigV3Schema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"dark\"), ...ThemeConfigSchema.shape }),\n z.object({ type: z.literal(\"light\"), ...ThemeConfigSchema.shape }),\n z.object({ type: z.literal(\"darkAndLight\"), ...DarkAndLightModeConfigSchema.shape })\n]);\nexport type ColorsConfigV3 = z.infer<typeof ColorsConfigV3Schema>;\n\nexport const ApiNavigationConfigItemSchema = SharedApiNavigationConfigItemSchema;\nexport const ApiNavigationConfigRootSchema = SharedApiNavigationConfigRootSchema;\nexport type ApiNavigationConfigRoot = z.infer<typeof ApiNavigationConfigRootSchema>;\n\nexport const ApiSectionSchema = z.object({\n ...NavigationNodeMetadataSchema.shape,\n title: z.string(),\n api: ApiDefinitionIdSchema,\n skipUrlSlug: z.boolean(),\n artifacts: z.lazy(() => ApiArtifactsSchema).optional(),\n showErrors: z.boolean(),\n changelog: ChangelogSectionSchema.optional(),\n navigation: ApiNavigationConfigRootSchema.optional(),\n longScrolling: z.boolean().optional(),\n flattened: z.boolean().optional()\n});\nexport type ApiSection = z.infer<typeof ApiSectionSchema>;\n\nexport const DocsSectionSchema: z.ZodType<any> = z.lazy(() =>\n z.object({\n ...NavigationNodeMetadataSchema.shape,\n title: z.string(),\n items: z.array(NavigationItemSchema),\n skipUrlSlug: z.boolean(),\n collapsed: z.union([z.boolean(), z.literal(\"open-by-default\")]),\n collapsible: z.boolean().optional(),\n collapsedByDefault: z.boolean().optional(),\n overviewPageId: PageIdSchema.optional()\n })\n);\nexport type DocsSection = z.infer<typeof DocsSectionSchema>;\n\nexport type NavigationItem =\n | NavigationItem.Page\n | NavigationItem.Api\n | NavigationItem.ApiV2\n | NavigationItem.Section\n | NavigationItem.Link\n | NavigationItem.Changelog\n | NavigationItem.ChangelogV3;\n\nexport namespace NavigationItem {\n export interface Page {\n type: \"page\";\n icon?: string;\n hidden?: boolean;\n urlSlug: string;\n fullSlug?: string[];\n id: PageId;\n title: string;\n }\n export interface Api extends ApiSection {\n type: \"api\";\n }\n export interface ApiV2 {\n type: \"apiV2\";\n node?: unknown;\n }\n export interface Section {\n type: \"section\";\n icon?: string;\n hidden?: boolean;\n urlSlug: string;\n fullSlug?: string[];\n skipUrlSlug: boolean;\n title: string;\n items: NavigationItem[];\n collapsed: boolean | \"open-by-default\";\n collapsible?: boolean;\n collapsedByDefault?: boolean;\n overviewPageId?: PageId;\n }\n export interface Link {\n type: \"link\";\n url: Url;\n title: string;\n icon?: string;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\";\n }\n export interface Changelog {\n type: \"changelog\";\n icon?: string;\n hidden?: boolean;\n urlSlug: string;\n fullSlug?: string[];\n title?: string;\n description?: string;\n pageId?: PageId;\n items: Array<{ date: string; pageId: PageId; tags?: string[] }>;\n }\n export interface ChangelogV3 {\n type: \"changelogV3\";\n node?: unknown;\n }\n}\n\nexport const NavigationItemSchema: z.ZodType<NavigationItem> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"page\"), ...PageMetadataSchema.shape }),\n z.object({ type: z.literal(\"api\"), ...ApiSectionSchema.shape }),\n z.object({ type: z.literal(\"apiV2\"), ...ApiSectionV2Schema.shape }),\n z.object({\n type: z.literal(\"section\"),\n ...NavigationNodeMetadataSchema.shape,\n title: z.string(),\n items: z.array(NavigationItemSchema),\n skipUrlSlug: z.boolean(),\n collapsed: z.union([z.boolean(), z.literal(\"open-by-default\")]),\n collapsible: z.boolean().optional(),\n collapsedByDefault: z.boolean().optional(),\n overviewPageId: PageIdSchema.optional()\n }),\n z.object({ type: z.literal(\"link\"), ...LinkMetadataSchema.shape }),\n z.object({ type: z.literal(\"changelog\"), ...ChangelogSectionSchema.shape }),\n z.object({ type: z.literal(\"changelogV3\"), ...ChangelogSectionV3Schema.shape })\n ])\n) as z.ZodType<NavigationItem>;\n\nexport const NavigationTabGroupSchema = z.object({\n ...NavigationNodeMetadataSchema.shape,\n title: z.string(),\n items: z.array(NavigationItemSchema),\n skipUrlSlug: z.boolean()\n});\nexport type NavigationTabGroup = z.infer<typeof NavigationTabGroupSchema>;\n\nexport const NavigationTabSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"group\"), ...NavigationTabGroupSchema.shape }),\n z.object({ type: z.literal(\"link\"), ...NavigationTabLinkSchema.shape }),\n z.object({ type: z.literal(\"changelog\"), ...ChangelogSectionSchema.shape }),\n z.object({ type: z.literal(\"changelogV3\"), ...ChangelogSectionV3Schema.shape })\n]);\nexport type NavigationTab = z.infer<typeof NavigationTabSchema>;\n\nexport const UnversionedTabbedNavigationConfigSchema = z.object({\n tabs: z.array(NavigationTabSchema),\n landingPage: PageMetadataSchema.optional()\n});\nexport type UnversionedTabbedNavigationConfig = z.infer<typeof UnversionedTabbedNavigationConfigSchema>;\n\nexport const UnversionedUntabbedNavigationConfigSchema = z.object({\n items: z.array(NavigationItemSchema),\n landingPage: PageMetadataSchema.optional()\n});\nexport type UnversionedUntabbedNavigationConfig = z.infer<typeof UnversionedUntabbedNavigationConfigSchema>;\n\nexport const UnversionedNavigationConfigSchema = z.union([\n UnversionedTabbedNavigationConfigSchema,\n UnversionedUntabbedNavigationConfigSchema\n]);\nexport type UnversionedNavigationConfig = z.infer<typeof UnversionedNavigationConfigSchema>;\n\nexport const VersionedNavigationConfigDataSchema = z.object({\n version: VersionIdSchema,\n urlSlug: z.string(),\n availability: AvailabilitySchema.optional(),\n config: UnversionedNavigationConfigSchema\n});\nexport type VersionedNavigationConfigData = z.infer<typeof VersionedNavigationConfigDataSchema>;\n\nexport const VersionedNavigationConfigSchema = z.object({\n versions: z.array(VersionedNavigationConfigDataSchema)\n});\nexport type VersionedNavigationConfig = z.infer<typeof VersionedNavigationConfigSchema>;\n\nexport const NavigationConfigSchema = z.union([UnversionedNavigationConfigSchema, VersionedNavigationConfigSchema]);\nexport type NavigationConfig = z.infer<typeof NavigationConfigSchema>;\n\nexport const DocsConfigSchema = z.object({\n title: z.string().optional(),\n defaultLanguage: ProgrammingLanguageSchema.optional(),\n languages: z.array(LanguageSchema).optional(),\n translations: DocsTranslationsConfigSchema.optional(),\n announcement: AnnouncementConfigSchema.optional(),\n navigation: NavigationConfigSchema.optional(),\n root: z.custom<RootNode>().optional(),\n navbarLinks: z.array(NavbarLinkSchema).optional(),\n footerLinks: z.array(FooterLinkSchema).optional(),\n hideNavLinks: z.boolean().optional(),\n logoHeight: HeightSchema.optional(),\n logoHref: UrlSchema.optional(),\n logoRightText: z.string().optional(),\n favicon: FileIdSchema.optional(),\n agents: AgentsConfigSchema.optional(),\n metadata: MetadataConfigSchema.optional(),\n redirects: z.array(RedirectConfigSchema).optional(),\n colorsV3: ColorsConfigV3Schema.optional(),\n layout: DocsLayoutConfigSchema.optional(),\n theme: DocsThemeConfigSchema.optional(),\n globalTheme: z.string().optional(),\n settings: DocsSettingsConfigSchema.optional(),\n typographyV2: DocsTypographyConfigV2Schema.optional(),\n analyticsConfig: AnalyticsConfigSchema.optional(),\n integrations: IntegrationsConfigSchema.optional(),\n css: CssConfigSchema.optional(),\n js: JsConfigSchema.optional(),\n aiChatConfig: AIChatConfigSchema.optional(),\n pageActions: PageActionsConfigSchema.optional(),\n editThisPageLaunch: EditThisPageLaunchSchema.optional(),\n iframe: IframeConfigSchema.optional(),\n header: z.string().optional(),\n footer: z.string().optional()\n});\nexport type DocsConfig = z.infer<typeof DocsConfigSchema>;\n\nexport const DocsDefinitionSchema = z.object({\n pages: z.record(PageIdSchema, PageContentSchema),\n apis: z.record(ApiDefinitionIdSchema, z.unknown()),\n apisV2: z.record(ApiDefinitionIdSchema, z.unknown()),\n apiNameToId: z.record(z.string(), ApiDefinitionIdSchema).optional(),\n files: z.record(FileIdSchema, UrlSchema),\n filesV2: z.record(FileIdSchema, FileSchema),\n jsFiles: z.record(z.string(), z.string()).optional(),\n id: DocsConfigIdSchema.optional(),\n config: DocsConfigSchema\n});\nexport type DocsDefinition = z.infer<typeof DocsDefinitionSchema>;\n\nexport const BaseUrlSchema = z.object({\n domain: z.string(),\n basePath: z.string().optional()\n});\nexport type BaseUrl = z.infer<typeof BaseUrlSchema>;\n\nexport const LoadDocsForUrlResponseSchema = z.object({\n baseUrl: BaseUrlSchema,\n definition: DocsDefinitionSchema,\n orgId: z.string().optional(),\n lightModeEnabled: z.boolean().optional(),\n locale: z.string().optional(),\n defaultLocale: z.string().optional(),\n translations: z.array(z.string()).optional()\n});\nexport type LoadDocsForUrlResponse = z.infer<typeof LoadDocsForUrlResponseSchema>;\n\nexport * from \"./read-commons\";\n","import * as z from \"zod\";\n\nexport type DocsConfigId = string & { DocsConfigId: void };\nexport const DocsConfigIdSchema: z.ZodType<DocsConfigId> = z.string() as any;\nexport function DocsConfigId(value: string): DocsConfigId {\n return value as unknown as DocsConfigId;\n}\n\nexport type {\n AIChatConfig,\n AIChatDatasource,\n AIChatLocation,\n AIChatWebsiteDatasource,\n AIModel,\n AmplitudeConfig,\n AnalyticsConfig,\n AnnouncementConfig,\n Availability,\n ClearBitConfig,\n ColorConfig,\n ColorsConfig,\n ColorsConfigV2,\n ColorThemedConfig,\n ColorUnthemedConfig,\n ContentAlignment,\n CssConfig,\n CustomFontConfig,\n CustomFontConfigVariant,\n CustomPageAction,\n DocsBodyConfig,\n DocsLayoutConfig,\n DocsPageActionsConfig,\n DocsSettingsConfig,\n DocsSidebarConfig,\n DocsTabsConfig,\n DocsTabsObjectConfig,\n DocsTabsStyle,\n DocsThemeConfig,\n DocsTranslationsConfig,\n DocsTypographyConfig,\n DocsTypographyConfigV2,\n EditThisPageLaunch,\n FathomConfig,\n FileIdOrUrl,\n FontConfig,\n FontConfigV2,\n FontDisplay,\n FontStyle,\n FooterLink,\n FooterNavConfig,\n FullStoryAnalyticsConfig,\n GoogleAnalytics4Config,\n GTMConfig,\n HeaderPosition,\n HeapConfig,\n HotJarConfig,\n HttpSnippetLanguage,\n HttpSnippetsConfig,\n IntegrationsConfig,\n IntercomConfig,\n JsConfig,\n JsFileConfig,\n JsRemoteConfig,\n JsScriptStrategy,\n KoalaConfig,\n Language,\n LanguageSwitcherConfig,\n LinkTarget,\n LogRocketConfig,\n MetadataConfig,\n MixpanelConfig,\n NavbarGithubMetadata,\n NavbarLink,\n NavbarLinkDropdownMetadata,\n NavbarLinkMetadata,\n PageActionOption,\n PageActionOptions,\n PageActionsConfig,\n PageWidthSizeConfig,\n PirschConfig,\n PlausibleConfig,\n PostHogConfig,\n ProductSwitcherConfig,\n ProgrammingLanguage,\n RedirectConfig,\n RgbaColor,\n SearchbarPlacement,\n SegmentConfig,\n SiteSwitcherConfig,\n SizeConfig,\n Skill,\n SkillsConfig,\n SwitcherPlacement,\n TabsPlacement,\n ThemedFileId,\n TwitterCardSetting,\n WithPermissions\n} from \"./shared\";\nexport {\n AgentsConfigSchema,\n AIChatConfigSchema,\n AIChatDatasourceSchema,\n AIChatLocationSchema,\n AIChatWebsiteDatasourceSchema,\n AIModelSchema,\n AmplitudeConfigSchema,\n AnalyticsConfigSchema,\n AnnouncementConfigSchema,\n ApiDefinitionId,\n ApiDefinitionIdSchema,\n AvailabilitySchema,\n ClearBitConfigSchema,\n ColorConfigSchema,\n ColorsConfigSchema,\n ColorsConfigV2Schema,\n ColorThemedConfigSchema,\n ColorUnthemedConfigSchema,\n ContentAlignmentSchema,\n CssConfigSchema,\n CustomFontConfigSchema,\n CustomFontConfigVariantSchema,\n CustomPageActionSchema,\n DocsBodyConfigSchema,\n DocsLayoutConfigSchema,\n DocsPageActionsConfigSchema,\n DocsSettingsConfigSchema,\n DocsSidebarConfigSchema,\n DocsTabsConfigSchema,\n DocsTabsObjectConfigSchema,\n DocsTabsStyleSchema,\n DocsThemeConfigSchema,\n DocsTranslationsConfigSchema,\n DocsTypographyConfigSchema,\n DocsTypographyConfigV2Schema,\n EditThisPageLaunchSchema,\n EndpointId,\n EndpointIdSchema,\n FathomConfigSchema,\n FileId,\n FileIdOrUrlSchema,\n FileIdSchema,\n FontConfigSchema,\n FontConfigV2Schema,\n FontDisplaySchema,\n FontStyleSchema,\n FooterLinkSchema,\n FooterNavConfigSchema,\n FullStoryAnalyticsConfigSchema,\n GoogleAnalytics4ConfigSchema,\n GTMConfigSchema,\n HeaderPositionSchema,\n HeapConfigSchema,\n HotJarConfigSchema,\n HttpSnippetLanguageSchema,\n HttpSnippetsConfigSchema,\n IframeConfigSchema,\n IntegrationsConfigSchema,\n IntercomConfigSchema,\n JsConfigSchema,\n JsFileConfigSchema,\n JsRemoteConfigSchema,\n JsScriptStrategySchema,\n KoalaConfigSchema,\n LanguageSchema,\n LanguageSwitcherConfigSchema,\n LinkTargetSchema,\n LogRocketConfigSchema,\n MetadataConfigSchema,\n MixpanelConfigSchema,\n NavbarGithubMetadataSchema,\n NavbarLinkDropdownMetadataSchema,\n NavbarLinkMetadataSchema,\n NavbarLinkSchema,\n PageActionOptionSchema,\n PageActionOptionsSchema,\n PageActionsConfigSchema,\n PageId,\n PageIdSchema,\n PageWidthSizeConfigSchema,\n PirschConfigSchema,\n PlausibleConfigSchema,\n PostHogConfigSchema,\n ProductSwitcherConfigSchema,\n ProgrammingLanguageSchema,\n RedirectConfigSchema,\n RgbaColorSchema,\n RoleId,\n RoleIdSchema,\n SearchbarPlacementSchema,\n SegmentConfigSchema,\n SiteSwitcherConfigSchema,\n SizeConfigSchema,\n SkillSchema,\n SkillsConfigSchema,\n SubpackageId,\n SwitcherPlacementSchema,\n TabsPlacementSchema,\n ThemedFileIdSchema,\n TwitterCardSettingSchema,\n Url,\n UrlSchema,\n VersionId,\n VersionIdSchema,\n WebhookId,\n WebhookIdSchema,\n WebSocketId,\n WebSocketIdSchema,\n WithPermissionsSchema\n} from \"./shared\";\n","import * as z from \"zod\";\n\nexport type FileId = string & { FileId: void };\nexport const FileIdSchema: z.ZodType<FileId> = z.string() as any;\nexport function FileId(value: string): FileId {\n return value as unknown as FileId;\n}\n\nexport type PageId = string & { PageId: void };\nexport const PageIdSchema: z.ZodType<PageId> = z.string() as any;\nexport function PageId(value: string): PageId {\n return value as unknown as PageId;\n}\n\nexport type Url = string & { Url: void };\nexport const UrlSchema: z.ZodType<Url> = z.string() as any;\nexport function Url(value: string): Url {\n return value as unknown as Url;\n}\n\nexport type VersionId = string & { VersionId: void };\nexport const VersionIdSchema: z.ZodType<VersionId> = z.string() as any;\nexport function VersionId(value: string): VersionId {\n return value as unknown as VersionId;\n}\n\nexport type ApiDefinitionId = string & { ApiDefinitionId: void };\nexport const ApiDefinitionIdSchema: z.ZodType<ApiDefinitionId> = z.string().uuid() as any;\nexport function ApiDefinitionId(value: string): ApiDefinitionId {\n return value as unknown as ApiDefinitionId;\n}\n\nexport type EndpointId = string & { EndpointId: void };\nexport const EndpointIdSchema: z.ZodType<EndpointId> = z.string() as any;\nexport function EndpointId(value: string): EndpointId {\n return value as unknown as EndpointId;\n}\n\nexport type WebSocketId = string & { WebSocketId: void };\nexport const WebSocketIdSchema: z.ZodType<WebSocketId> = z.string() as any;\nexport function WebSocketId(value: string): WebSocketId {\n return value as unknown as WebSocketId;\n}\n\nexport type WebhookId = string & { WebhookId: void };\nexport const WebhookIdSchema: z.ZodType<WebhookId> = z.string() as any;\nexport function WebhookId(value: string): WebhookId {\n return value as unknown as WebhookId;\n}\n\nexport type RoleId = string & { RoleId: void };\nexport const RoleIdSchema: z.ZodType<RoleId> = z.string() as any;\nexport function RoleId(value: string): RoleId {\n return value as unknown as RoleId;\n}\n\nexport type SubpackageId = string & { SubpackageId: void };\nexport const SubpackageIdSchema: z.ZodType<SubpackageId> = z.string() as any;\nexport function SubpackageId(value: string): SubpackageId {\n return value as unknown as SubpackageId;\n}\n\nexport const LinkTargetSchema = z.enum([\"_blank\", \"_self\", \"_parent\", \"_top\"]);\nexport type LinkTarget = z.infer<typeof LinkTargetSchema>;\n\nexport const AvailabilitySchema = z.enum([\n \"Stable\",\n \"GenerallyAvailable\",\n \"InDevelopment\",\n \"PreRelease\",\n \"Deprecated\",\n \"Beta\"\n]);\nexport type Availability = z.infer<typeof AvailabilitySchema>;\n\nexport const RgbaColorSchema = z.object({\n r: z.number().int(),\n g: z.number().int(),\n b: z.number().int(),\n a: z.number().optional()\n});\nexport type RgbaColor = z.infer<typeof RgbaColorSchema>;\n\nexport const FileIdOrUrlSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"fileId\"), value: FileIdSchema }),\n z.object({ type: z.literal(\"url\"), value: UrlSchema })\n]);\nexport type FileIdOrUrl = z.infer<typeof FileIdOrUrlSchema>;\n\n/**\n * BCP 47 language tag validator for docs localization.\n * Accepts simple codes like \"en\", \"ja\" as well as regional variants\n * like \"ja-JP\", \"pt-BR\", \"zh-Hans\", \"zh-Hans-CN\".\n * See: https://www.rfc-editor.org/rfc/rfc5646\n */\nexport const LanguageSchema = z\n .string()\n .regex(\n /^[a-zA-Z]{2,8}(-[a-zA-Z0-9]{1,8})*$/,\n \"Language must be a valid BCP 47 language tag (e.g. 'en', 'ja', 'ja-JP', 'pt-BR', 'zh-Hans-CN')\"\n );\nexport type Language = z.infer<typeof LanguageSchema>;\n\n/**\n * BCP 47 language tag validator.\n * Accepts tags like \"en\", \"fr\", \"pt-BR\", \"zh-Hans\", \"zh-Hans-CN\".\n * See: https://www.rfc-editor.org/rfc/rfc5646\n */\nconst Bcp47LocaleSchema = z\n .string()\n .regex(\n /^[a-zA-Z]{2,8}(-[a-zA-Z0-9]{1,8})*$/,\n \"Locale must be a valid BCP 47 language tag (e.g. 'en', 'fr', 'pt-BR', 'zh-Hans-CN')\"\n );\n\nexport const DocsTranslationsConfigSchema = z.object({\n /** The locale served when no locale-specific translation is found. Must be a valid BCP 47 language tag. */\n defaultLocale: Bcp47LocaleSchema,\n /** Supported locales for this docs site.\n * Must be valid BCP 47 language tags. Include `defaultLocale` when localization is configured.\n * Omit to serve only `defaultLocale`. */\n translations: z.array(Bcp47LocaleSchema).optional()\n});\nexport type DocsTranslationsConfig = z.infer<typeof DocsTranslationsConfigSchema>;\n\nexport const ProgrammingLanguageSchema = z.enum([\n \"typescript\",\n \"javascript\",\n \"python\",\n \"java\",\n \"go\",\n \"ruby\",\n \"csharp\",\n \"php\",\n \"swift\",\n \"rust\",\n \"nodets\",\n \"nodejs\",\n \"dotnet\",\n \"curl\",\n \"jvm\",\n \"ts\",\n \"js\"\n]);\nexport type ProgrammingLanguage = z.infer<typeof ProgrammingLanguageSchema>;\n\nexport const AnnouncementConfigSchema = z.object({\n text: z.string()\n});\nexport type AnnouncementConfig = z.infer<typeof AnnouncementConfigSchema>;\n\nexport const SegmentConfigSchema = z.object({\n writeKey: z.string()\n});\nexport type SegmentConfig = z.infer<typeof SegmentConfigSchema>;\n\nexport const FullStoryAnalyticsConfigSchema = z.object({\n orgId: z.string()\n});\nexport type FullStoryAnalyticsConfig = z.infer<typeof FullStoryAnalyticsConfigSchema>;\n\nexport const IntercomConfigSchema = z.object({\n appId: z.string(),\n apiBase: z.string().optional()\n});\nexport type IntercomConfig = z.infer<typeof IntercomConfigSchema>;\n\nexport const PostHogConfigSchema = z.object({\n apiKey: z.string(),\n endpoint: z.string().optional()\n});\nexport type PostHogConfig = z.infer<typeof PostHogConfigSchema>;\n\nexport const GTMConfigSchema = z.object({\n containerId: z.string()\n});\nexport type GTMConfig = z.infer<typeof GTMConfigSchema>;\n\nexport const GoogleAnalytics4ConfigSchema = z.object({\n measurementId: z.string()\n});\nexport type GoogleAnalytics4Config = z.infer<typeof GoogleAnalytics4ConfigSchema>;\n\nexport const AmplitudeConfigSchema = z.object({\n apiKey: z.string()\n});\nexport type AmplitudeConfig = z.infer<typeof AmplitudeConfigSchema>;\n\nexport const MixpanelConfigSchema = z.object({\n apiKey: z.string()\n});\nexport type MixpanelConfig = z.infer<typeof MixpanelConfigSchema>;\n\nexport const HotJarConfigSchema = z.object({\n hjid: z.string(),\n hjsv: z.string()\n});\nexport type HotJarConfig = z.infer<typeof HotJarConfigSchema>;\n\nexport const KoalaConfigSchema = z.object({\n apiKey: z.string()\n});\nexport type KoalaConfig = z.infer<typeof KoalaConfigSchema>;\n\nexport const LogRocketConfigSchema = z.object({\n apiKey: z.string()\n});\nexport type LogRocketConfig = z.infer<typeof LogRocketConfigSchema>;\n\nexport const PirschConfigSchema = z.object({\n id: z.string()\n});\nexport type PirschConfig = z.infer<typeof PirschConfigSchema>;\n\nexport const PlausibleConfigSchema = z.object({\n domain: z.string()\n});\nexport type PlausibleConfig = z.infer<typeof PlausibleConfigSchema>;\n\nexport const FathomConfigSchema = z.object({\n siteId: z.string()\n});\nexport type FathomConfig = z.infer<typeof FathomConfigSchema>;\n\nexport const ClearBitConfigSchema = z.object({\n apiKey: z.string()\n});\nexport type ClearBitConfig = z.infer<typeof ClearBitConfigSchema>;\n\nexport const HeapConfigSchema = z.object({\n appId: z.string()\n});\nexport type HeapConfig = z.infer<typeof HeapConfigSchema>;\n\nexport const AnalyticsConfigSchema = z.object({\n segment: SegmentConfigSchema.optional(),\n fullstory: FullStoryAnalyticsConfigSchema.optional(),\n intercom: IntercomConfigSchema.optional(),\n posthog: PostHogConfigSchema.optional(),\n gtm: GTMConfigSchema.optional(),\n ga4: GoogleAnalytics4ConfigSchema.optional(),\n amplitude: AmplitudeConfigSchema.optional(),\n mixpanel: MixpanelConfigSchema.optional(),\n hotjar: HotJarConfigSchema.optional(),\n koala: KoalaConfigSchema.optional(),\n logrocket: LogRocketConfigSchema.optional(),\n pirsch: PirschConfigSchema.optional(),\n plausible: PlausibleConfigSchema.optional(),\n fathom: FathomConfigSchema.optional(),\n clearbit: ClearBitConfigSchema.optional(),\n heap: HeapConfigSchema.optional()\n});\nexport type AnalyticsConfig = z.infer<typeof AnalyticsConfigSchema>;\n\nexport const SearchbarPlacementSchema = z.enum([\"HEADER\", \"HEADER_TABS\", \"SIDEBAR\"]);\nexport type SearchbarPlacement = z.infer<typeof SearchbarPlacementSchema>;\n\nexport const TabsPlacementSchema = z.enum([\"HEADER\", \"SIDEBAR\"]);\nexport type TabsPlacement = z.infer<typeof TabsPlacementSchema>;\n\nexport const SwitcherPlacementSchema = z.enum([\"HEADER\", \"SIDEBAR\"]);\nexport type SwitcherPlacement = z.infer<typeof SwitcherPlacementSchema>;\n\nexport const ContentAlignmentSchema = z.enum([\"CENTER\", \"LEFT\"]);\nexport type ContentAlignment = z.infer<typeof ContentAlignmentSchema>;\n\nexport const HeaderPositionSchema = z.enum([\"FIXED\", \"ABSOLUTE\"]);\nexport type HeaderPosition = z.infer<typeof HeaderPositionSchema>;\n\nexport const PageWidthSizeConfigSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"px\"), value: z.number() }),\n z.object({ type: z.literal(\"rem\"), value: z.number() }),\n z.object({ type: z.literal(\"full\") })\n]);\nexport type PageWidthSizeConfig = z.infer<typeof PageWidthSizeConfigSchema>;\n\nexport const SizeConfigSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"px\"), value: z.number() }),\n z.object({ type: z.literal(\"rem\"), value: z.number() })\n]);\nexport type SizeConfig = z.infer<typeof SizeConfigSchema>;\n\nexport const TabsAlignmentSchema = z.enum([\"LEFT\", \"CENTER\"]);\nexport type TabsAlignment = z.infer<typeof TabsAlignmentSchema>;\n\n// \"timeline\" is the searchable timeline-of-cards layout; \"classic\" is the\n// legacy stacked-entries layout with a per-page table of contents.\nexport const ChangelogLayoutSchema = z.enum([\"timeline\", \"classic\"]);\nexport type ChangelogLayout = z.infer<typeof ChangelogLayoutSchema>;\n\n// How nested object fields render in the API reference. \"indented\" is the\n// connector-line tree; \"cards\" is the legacy nested-card layout.\nexport const ApiReferenceLayoutSchema = z.enum([\"indented\", \"cards\"]);\nexport type ApiReferenceLayout = z.infer<typeof ApiReferenceLayoutSchema>;\n\nexport const DocsBreadcrumbsConfigSchema = z.object({\n // Appends the current page to the breadcrumb trail as a non-clickable item.\n currentPage: z.boolean().optional()\n});\nexport type DocsBreadcrumbsConfig = z.infer<typeof DocsBreadcrumbsConfigSchema>;\n\nexport const DocsLayoutConfigSchema = z.object({\n pageWidth: PageWidthSizeConfigSchema.optional(),\n contentWidth: SizeConfigSchema.optional(),\n sidebarWidth: SizeConfigSchema.optional(),\n headerHeight: SizeConfigSchema.optional(),\n searchbarPlacement: SearchbarPlacementSchema.optional(),\n tabsPlacement: TabsPlacementSchema.optional(),\n switcherPlacement: SwitcherPlacementSchema.optional(),\n contentAlignment: ContentAlignmentSchema.optional(),\n headerPosition: HeaderPositionSchema.optional(),\n disableHeader: z.boolean().optional(),\n hideNavLinks: z.boolean().optional(),\n hideFeedback: z.boolean().optional(),\n mobileToc: z.boolean().optional(),\n changelogLayout: ChangelogLayoutSchema.optional(),\n apiReferenceLayout: ApiReferenceLayoutSchema.optional(),\n // Opens the first level of nested object/union fields in the API reference by default.\n apiReferenceExpandProperties: z.boolean().optional(),\n showNavAvailabilityBadges: z.boolean().optional(),\n breadcrumbs: DocsBreadcrumbsConfigSchema.optional()\n});\nexport type DocsLayoutConfig = z.infer<typeof DocsLayoutConfigSchema>;\n\nexport const FooterNavConfigSchema = z.enum([\"default\", \"minimal\"]);\nexport type FooterNavConfig = z.infer<typeof FooterNavConfigSchema>;\n\nexport const DocsSidebarConfigSchema = z.enum([\"default\", \"minimal\"]);\nexport type DocsSidebarConfig = z.infer<typeof DocsSidebarConfigSchema>;\n\nexport const DocsBodyConfigSchema = z.enum([\"default\", \"canvas\"]);\nexport type DocsBodyConfig = z.infer<typeof DocsBodyConfigSchema>;\n\nexport const DocsTabsStyleSchema = z.enum([\"default\", \"bubble\"]);\nexport type DocsTabsStyle = z.infer<typeof DocsTabsStyleSchema>;\n\nexport const DocsTabsObjectConfigSchema = z.object({\n style: DocsTabsStyleSchema.optional(),\n alignment: TabsAlignmentSchema.optional(),\n placement: TabsPlacementSchema.optional()\n});\nexport type DocsTabsObjectConfig = z.infer<typeof DocsTabsObjectConfigSchema>;\n\nexport const DocsTabsConfigSchema = z.union([DocsTabsStyleSchema, DocsTabsObjectConfigSchema]);\nexport type DocsTabsConfig = z.infer<typeof DocsTabsConfigSchema>;\n\nexport const DocsPageActionsConfigSchema = z.enum([\"default\", \"toolbar\"]);\nexport type DocsPageActionsConfig = z.infer<typeof DocsPageActionsConfigSchema>;\n\nexport const LanguageSwitcherConfigSchema = z.enum([\"default\", \"minimal\"]);\nexport type LanguageSwitcherConfig = z.infer<typeof LanguageSwitcherConfigSchema>;\n\nexport const ProductSwitcherConfigSchema = z.enum([\"default\", \"toggle\", \"tabs\"]);\nexport type ProductSwitcherConfig = z.infer<typeof ProductSwitcherConfigSchema>;\n\n/**\n * Header switcher listing the other sites published on the same host.\n * Membership is derived from the registry at publish time (`LedgerManifest.siblingSites`);\n * this only shapes presentation. Keys of `labels` and entries of `order`/`hide` are basepaths.\n */\nexport const SiteSwitcherConfigSchema = z.object({\n enabled: z.boolean().optional(),\n order: z.array(z.string()).optional(),\n hide: z.array(z.string()).optional(),\n labels: z.record(z.string(), z.string()).optional(),\n \"show-products\": z.boolean().optional()\n});\nexport type SiteSwitcherConfig = z.infer<typeof SiteSwitcherConfigSchema>;\n\nexport const DocsThemeConfigSchema = z.object({\n sidebar: DocsSidebarConfigSchema.optional(),\n body: DocsBodyConfigSchema.optional(),\n tabs: DocsTabsConfigSchema.optional(),\n footerNav: FooterNavConfigSchema.optional(),\n \"page-actions\": DocsPageActionsConfigSchema.optional(),\n \"language-switcher\": LanguageSwitcherConfigSchema.optional(),\n \"product-switcher\": ProductSwitcherConfigSchema.optional(),\n \"site-switcher\": SiteSwitcherConfigSchema.optional()\n});\nexport type DocsThemeConfig = z.infer<typeof DocsThemeConfigSchema>;\n\nexport const HttpSnippetLanguageSchema = z.enum([\n \"curl\",\n \"csharp\",\n \"go\",\n \"java\",\n \"javascript\",\n \"php\",\n \"python\",\n \"ruby\",\n \"swift\",\n \"rust\",\n \"typescript\"\n]);\nexport type HttpSnippetLanguage = z.infer<typeof HttpSnippetLanguageSchema>;\n\nexport const HttpSnippetsConfigSchema = z.union([z.boolean(), z.array(HttpSnippetLanguageSchema)]);\nexport type HttpSnippetsConfig = z.infer<typeof HttpSnippetsConfigSchema>;\n\nexport const ExternalSitemapConfigSchema = z.object({\n url: z.string(),\n /**\n * Site locale every URL in this sitemap is indexed into, overriding per-URL\n * language detection. Must match the default language or a translation.\n */\n locale: z.string().optional()\n});\nexport type ExternalSitemapConfig = z.infer<typeof ExternalSitemapConfigSchema>;\n\nexport const ExternalSitemapSchema = z.union([z.string(), ExternalSitemapConfigSchema]);\nexport type ExternalSitemap = z.infer<typeof ExternalSitemapSchema>;\n\nexport const SearchSettingsConfigSchema = z.object({\n prioritizeCurrentProduct: z.boolean().optional(),\n defaultFilterByCurrentProduct: z.boolean().optional(),\n /**\n * Experimental: external sitemaps to index alongside this site's docs\n * content, each an absolute URL or `{ url, locale? }`. Their pages are tagged\n * to the same domain but flagged as third-party so they rank below all\n * first-party documentation in search.\n */\n externalSitemaps: z.array(ExternalSitemapSchema).optional()\n});\nexport type SearchSettingsConfig = z.infer<typeof SearchSettingsConfigSchema>;\n\nexport const DocsSettingsConfigSchema = z.object({\n searchText: z.string().optional(),\n disableSearch: z.boolean().optional(),\n disableAnalytics: z.boolean().optional(),\n darkModeCode: z.boolean().optional(),\n defaultSearchFilters: z.boolean().optional(),\n search: SearchSettingsConfigSchema.optional(),\n httpSnippets: HttpSnippetsConfigSchema.optional(),\n hide404Page: z.boolean().optional(),\n useJavascriptAsTypescript: z.boolean().optional(),\n disableExplorerProxy: z.boolean().optional(),\n disableEnvironmentEditing: z.boolean().optional(),\n language: LanguageSchema.optional(),\n websocketOneofDisplay: z.enum([\"flat\", \"grouped\"]).optional(),\n showHeadersInExamples: z.boolean().optional()\n});\nexport type DocsSettingsConfig = z.infer<typeof DocsSettingsConfigSchema>;\n\nexport const TwitterCardSettingSchema = z.enum([\"summary\", \"summary_large_image\", \"app\", \"player\"]);\nexport type TwitterCardSetting = z.infer<typeof TwitterCardSettingSchema>;\n\nexport const MetadataConfigSchema = z.object({\n \"og:site_name\": z.string().optional(),\n \"og:title\": z.string().optional(),\n \"og:description\": z.string().optional(),\n \"og:url\": z.string().optional(),\n \"og:image\": FileIdOrUrlSchema.optional(),\n \"og:image:width\": z.number().optional(),\n \"og:image:height\": z.number().optional(),\n \"og:locale\": z.string().optional(),\n \"og:logo\": FileIdOrUrlSchema.optional(),\n \"twitter:title\": z.string().optional(),\n \"twitter:description\": z.string().optional(),\n \"twitter:handle\": z.string().optional(),\n \"twitter:image\": FileIdOrUrlSchema.optional(),\n \"twitter:site\": z.string().optional(),\n \"twitter:url\": z.string().optional(),\n \"twitter:card\": TwitterCardSettingSchema.optional(),\n \"og:background-image\": FileIdOrUrlSchema.optional(),\n \"og:dynamic\": z.boolean().optional(),\n \"og:dynamic:background-image\": FileIdOrUrlSchema.optional(),\n \"og:dynamic:text-color\": z.string().optional(),\n \"og:dynamic:background-color\": z.string().optional(),\n \"og:dynamic:show-logo\": z.boolean().optional(),\n \"og:dynamic:show-section\": z.boolean().optional(),\n \"og:dynamic:show-description\": z.boolean().optional(),\n \"og:dynamic:show-url\": z.boolean().optional(),\n \"og:dynamic:show-gradient\": z.boolean().optional(),\n noindex: z.boolean().optional(),\n nofollow: z.boolean().optional(),\n canonicalHost: z.string().optional()\n});\nexport type MetadataConfig = z.infer<typeof MetadataConfigSchema>;\n\nexport const RedirectConfigSchema = z.object({\n source: z.string(),\n destination: z.string(),\n permanent: z.boolean().optional()\n});\nexport type RedirectConfig = z.infer<typeof RedirectConfigSchema>;\n\nexport const WithPermissionsSchema = z.object({\n viewers: z.array(RoleIdSchema).optional()\n});\nexport type WithPermissions = z.infer<typeof WithPermissionsSchema>;\n\nexport const NavbarLinkMetadataSchema = z.object({\n ...WithPermissionsSchema.shape,\n url: UrlSchema,\n target: LinkTargetSchema.optional(),\n text: z.string().optional(),\n icon: z.string().optional(),\n rightIcon: z.string().optional(),\n rounded: z.boolean().optional()\n});\nexport type NavbarLinkMetadata = z.infer<typeof NavbarLinkMetadataSchema>;\n\nexport const NavbarGithubMetadataSchema = z.object({\n ...WithPermissionsSchema.shape,\n url: UrlSchema,\n target: LinkTargetSchema.optional()\n});\nexport type NavbarGithubMetadata = z.infer<typeof NavbarGithubMetadataSchema>;\n\nexport const NavbarLinkDropdownMetadataSchema = z.object({\n ...WithPermissionsSchema.shape,\n links: z.array(NavbarLinkMetadataSchema),\n text: z.string().optional(),\n icon: z.string().optional(),\n rightIcon: z.string().optional(),\n rounded: z.boolean().optional()\n});\nexport type NavbarLinkDropdownMetadata = z.infer<typeof NavbarLinkDropdownMetadataSchema>;\n\nexport const NavbarLinkSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"filled\"), ...NavbarLinkMetadataSchema.shape }),\n z.object({ type: z.literal(\"outlined\"), ...NavbarLinkMetadataSchema.shape }),\n z.object({ type: z.literal(\"minimal\"), ...NavbarLinkMetadataSchema.shape }),\n z.object({ type: z.literal(\"github\"), ...NavbarGithubMetadataSchema.shape }),\n z.object({ type: z.literal(\"dropdown\"), ...NavbarLinkDropdownMetadataSchema.shape }),\n z.object({ type: z.literal(\"primary\"), ...NavbarLinkMetadataSchema.shape }),\n z.object({ type: z.literal(\"secondary\"), ...NavbarLinkMetadataSchema.shape })\n]);\nexport type NavbarLink = z.infer<typeof NavbarLinkSchema>;\n\nexport const FooterLinkSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"github\"), value: UrlSchema }),\n z.object({ type: z.literal(\"twitter\"), value: UrlSchema }),\n z.object({ type: z.literal(\"x\"), value: UrlSchema }),\n z.object({ type: z.literal(\"linkedin\"), value: UrlSchema }),\n z.object({ type: z.literal(\"youtube\"), value: UrlSchema }),\n z.object({ type: z.literal(\"instagram\"), value: UrlSchema }),\n z.object({ type: z.literal(\"facebook\"), value: UrlSchema }),\n z.object({ type: z.literal(\"discord\"), value: UrlSchema }),\n z.object({ type: z.literal(\"slack\"), value: UrlSchema }),\n z.object({ type: z.literal(\"hackernews\"), value: UrlSchema }),\n z.object({ type: z.literal(\"medium\"), value: UrlSchema }),\n z.object({ type: z.literal(\"website\"), value: UrlSchema })\n]);\nexport type FooterLink = z.infer<typeof FooterLinkSchema>;\n\nexport const CssConfigSchema = z.object({\n inline: z.array(z.string()).optional()\n});\nexport type CssConfig = z.infer<typeof CssConfigSchema>;\n\nexport const JsScriptStrategySchema = z.enum([\"beforeInteractive\", \"afterInteractive\", \"lazyOnload\"]);\nexport type JsScriptStrategy = z.infer<typeof JsScriptStrategySchema>;\n\nexport const JsRemoteConfigSchema = z.object({\n url: UrlSchema,\n strategy: JsScriptStrategySchema.optional(),\n // When true, skip computing a Subresource Integrity (SRI) hash for this\n // remote script so it is rendered without an `integrity` attribute.\n disableSri: z.boolean().optional()\n});\nexport type JsRemoteConfig = z.infer<typeof JsRemoteConfigSchema>;\n\nexport const JsFileConfigSchema = z.object({\n fileId: FileIdSchema,\n strategy: JsScriptStrategySchema.optional()\n});\nexport type JsFileConfig = z.infer<typeof JsFileConfigSchema>;\n\nexport const JsConfigSchema = z.object({\n remote: z.array(JsRemoteConfigSchema).optional(),\n files: z.array(JsFileConfigSchema),\n inline: z.array(z.string()).optional()\n});\nexport type JsConfig = z.infer<typeof JsConfigSchema>;\n\nexport const IntegrationsConfigSchema = z.object({\n intercom: z.string().optional(),\n context7: FileIdSchema.optional()\n});\nexport type IntegrationsConfig = z.infer<typeof IntegrationsConfigSchema>;\n\nexport const FontStyleSchema = z.enum([\"normal\", \"italic\"]);\nexport type FontStyle = z.infer<typeof FontStyleSchema>;\n\nexport const FontDisplaySchema = z.enum([\"auto\", \"block\", \"swap\", \"fallback\", \"optional\"]);\nexport type FontDisplay = z.infer<typeof FontDisplaySchema>;\n\nexport const CustomFontConfigVariantSchema = z.object({\n fontFile: FileIdSchema,\n weight: z.array(z.string()).optional(),\n style: z.array(FontStyleSchema).optional()\n});\nexport type CustomFontConfigVariant = z.infer<typeof CustomFontConfigVariantSchema>;\n\nexport const CustomFontConfigSchema = z.object({\n name: z.string(),\n variants: z.array(CustomFontConfigVariantSchema),\n display: FontDisplaySchema.optional(),\n fallback: z.array(z.string()).optional(),\n fontVariationSettings: z.string().optional()\n});\nexport type CustomFontConfig = z.infer<typeof CustomFontConfigSchema>;\n\nexport const FontConfigV2Schema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"custom\"), ...CustomFontConfigSchema.shape })\n]);\nexport type FontConfigV2 = z.infer<typeof FontConfigV2Schema>;\n\nexport const DocsTypographyConfigV2Schema = z.object({\n headingsFont: FontConfigV2Schema.optional(),\n bodyFont: FontConfigV2Schema.optional(),\n codeFont: FontConfigV2Schema.optional()\n});\nexport type DocsTypographyConfigV2 = z.infer<typeof DocsTypographyConfigV2Schema>;\n\nexport const ThemedFileIdSchema = z.object({\n dark: FileIdSchema.optional(),\n light: FileIdSchema.optional()\n});\nexport type ThemedFileId = z.infer<typeof ThemedFileIdSchema>;\n\nexport const ColorsConfigSchema = z.object({\n accentPrimary: RgbaColorSchema.optional()\n});\nexport type ColorsConfig = z.infer<typeof ColorsConfigSchema>;\n\nexport const ColorUnthemedConfigSchema = z.object({\n color: RgbaColorSchema.optional()\n});\nexport type ColorUnthemedConfig = z.infer<typeof ColorUnthemedConfigSchema>;\n\nexport const ColorThemedConfigSchema = z.object({\n dark: RgbaColorSchema.optional(),\n light: RgbaColorSchema.optional()\n});\nexport type ColorThemedConfig = z.infer<typeof ColorThemedConfigSchema>;\n\nexport const ColorConfigSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"unthemed\"), ...ColorUnthemedConfigSchema.shape }),\n z.object({ type: z.literal(\"themed\"), ...ColorThemedConfigSchema.shape })\n]);\nexport type ColorConfig = z.infer<typeof ColorConfigSchema>;\n\nexport const ColorsConfigV2Schema = z.object({\n accentPrimary: ColorConfigSchema.optional(),\n background: ColorConfigSchema.optional()\n});\nexport type ColorsConfigV2 = z.infer<typeof ColorsConfigV2Schema>;\n\nexport const FontConfigSchema = z.object({\n name: z.string(),\n fontFile: FileIdSchema\n});\nexport type FontConfig = z.infer<typeof FontConfigSchema>;\n\nexport const DocsTypographyConfigSchema = z.object({\n headingsFont: FontConfigSchema.optional(),\n bodyFont: FontConfigSchema.optional(),\n codeFont: FontConfigSchema.optional()\n});\nexport type DocsTypographyConfig = z.infer<typeof DocsTypographyConfigSchema>;\n\nexport const EditThisPageLaunchSchema = z.enum([\"github\", \"dashboard\"]);\nexport type EditThisPageLaunch = z.infer<typeof EditThisPageLaunchSchema>;\n\n/**\n * A single CSP `frame-ancestors` host source: `scheme://host[:port]`, where the host may\n * lead with a `*.` wildcard label and the port may be `*`. Deliberately excludes the bare\n * `*`, keyword sources (`'none'`, `'self'`), scheme-only sources (`https:`) and anything\n * with a path, query or directive delimiter, so a value from an older CLI or a direct API\n * caller can neither open the site to every origin nor inject further directives.\n */\nexport const FRAME_ANCESTOR_SOURCE_PATTERN =\n /^[a-z][a-z0-9+.-]*:\\/\\/(?:\\*\\.)?[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*(?::(?:\\d{1,5}|\\*))?$/i;\n\nexport function isFrameAncestorSource(value: unknown): value is string {\n return typeof value === \"string\" && FRAME_ANCESTOR_SOURCE_PATTERN.test(value);\n}\n\n/** Trims, drops anything that is not a valid {@link FRAME_ANCESTOR_SOURCE_PATTERN} and de-duplicates. */\nexport function sanitizeFrameAncestors(origins: readonly unknown[]): string[] {\n const clean = origins\n .filter((origin): origin is string => typeof origin === \"string\")\n .map((origin) => origin.trim())\n .filter(isFrameAncestorSource);\n return [...new Set(clean)];\n}\n\n/**\n * Origins allowed to iframe the docs site, appended to the CSP `frame-ancestors`\n * directive (e.g. `https://app.example.com`, `https://*.example.com`). Each entry must\n * be a host source; wildcards for \"any origin\" are rejected.\n */\nexport const IframeConfigSchema = z.object({\n allowedParentOrigins: z.array(\n z.string().regex(FRAME_ANCESTOR_SOURCE_PATTERN, \"must be a CSP host source like https://app.example.com\")\n )\n});\nexport type IframeConfig = z.infer<typeof IframeConfigSchema>;\n\nexport const AIChatLocationSchema = z.enum([\"docs\", \"slack\"]);\nexport type AIChatLocation = z.infer<typeof AIChatLocationSchema>;\n\nexport const AIChatWebsiteDatasourceSchema = z.object({\n url: z.string(),\n title: z.string().optional()\n});\nexport type AIChatWebsiteDatasource = z.infer<typeof AIChatWebsiteDatasourceSchema>;\n\nexport const AIChatDatasourceSchema = AIChatWebsiteDatasourceSchema;\nexport type AIChatDatasource = z.infer<typeof AIChatDatasourceSchema>;\n\nexport const AIModelSchema = z.enum([\"claude-3.5\", \"claude-3.7\", \"claude-4\", \"command-a\"]);\nexport type AIModel = z.infer<typeof AIModelSchema>;\n\nexport const AIChatConfigSchema = z.object({\n model: AIModelSchema.optional(),\n systemPrompt: z.string().optional(),\n location: z.array(AIChatLocationSchema).optional(),\n datasources: z.array(AIChatDatasourceSchema).optional(),\n maskPii: z.boolean().optional(),\n disclaimer: z.string().optional()\n});\nexport type AIChatConfig = z.infer<typeof AIChatConfigSchema>;\n\nexport const PageDescriptionSourceSchema = z.enum([\"description\", \"subtitle\"]);\nexport type PageDescriptionSource = z.infer<typeof PageDescriptionSourceSchema>;\n\nexport const AgentsConfigSchema = z.object({\n pageDirective: z.string().optional(),\n pageDescriptionSource: PageDescriptionSourceSchema.optional(),\n siteDescription: z.string().optional(),\n llmsTxt: FileIdSchema.optional(),\n llmsFullTxt: FileIdSchema.optional(),\n robotsTxt: FileIdSchema.optional()\n});\nexport type AgentsConfig = z.infer<typeof AgentsConfigSchema>;\n\nexport const PageActionOptionSchema = z.enum([\n \"copyPage\",\n \"viewAsMarkdown\",\n \"askAi\",\n \"openAi\",\n \"claude\",\n \"cursor\",\n \"claudeCode\",\n \"vscode\",\n \"installSkills\"\n]);\nexport type PageActionOption = z.infer<typeof PageActionOptionSchema>;\n\nexport const CustomPageActionSchema = z.object({\n title: z.string(),\n subtitle: z.string().optional(),\n url: z.string(),\n icon: z.string().optional(),\n default: z.boolean().optional()\n});\nexport type CustomPageAction = z.infer<typeof CustomPageActionSchema>;\n\n/**\n * A single agent skill surfaced in the \"Install skills\" modal. `name` is the\n * skill identifier (e.g. `nemoclaw-user-get-started`); `url` optionally links\n * to its source (a path in the repo, a docs page, etc.).\n */\nexport const SkillSchema = z.object({\n name: z.string(),\n description: z.string().optional(),\n url: z.string().optional()\n});\nexport type Skill = z.infer<typeof SkillSchema>;\n\n/**\n * Powers the config-driven \"Install skills\" page action and its modal. Sites\n * that ship agent skills point at where those skills live and how to install\n * them — no skill generation happens on Fern's side. Presence of this config is\n * what enables the action; omit it and no \"Install skills\" action is rendered.\n */\nexport const SkillsConfigSchema = z.object({\n /** Overrides the modal title. */\n title: z.string().optional(),\n /** Overrides the modal description/blurb. */\n description: z.string().optional(),\n /** Optional \"Learn more\" link shown alongside the description. */\n learnMoreUrl: z.string().optional(),\n /** Source repository (public or private GH/GL) shown as a \"View source\" button. */\n repository: z.string().optional(),\n /**\n * Command(s) used to install/fetch the skills, rendered as a copyable block.\n * A single string is shown as-is; an array is joined with newlines (e.g. a\n * multi-step `git sparse-checkout` install).\n */\n installCommand: z.union([z.string(), z.array(z.string())]).optional(),\n /** Optional list of available skills displayed in the modal. */\n skills: z.array(SkillSchema).optional()\n});\nexport type SkillsConfig = z.infer<typeof SkillsConfigSchema>;\n\nexport const PageActionOptionsSchema = z.object({\n copyPage: z.boolean().optional(),\n viewAsMarkdown: z.boolean().optional(),\n askAi: z.boolean().optional(),\n openAi: z.boolean().optional(),\n claude: z.boolean().optional(),\n cursor: z.boolean().optional(),\n claudeCode: z.boolean().optional(),\n vscode: z.boolean().optional(),\n mcp: z.boolean().optional(),\n custom: z.array(CustomPageActionSchema).optional(),\n skills: SkillsConfigSchema.optional()\n});\nexport type PageActionOptions = z.infer<typeof PageActionOptionsSchema>;\n\nexport const PageActionsConfigSchema = z.object({\n default: PageActionOptionSchema.optional(),\n options: PageActionOptionsSchema.optional()\n});\nexport type PageActionsConfig = z.infer<typeof PageActionsConfigSchema>;\n\nexport const HeightSchema = z.number();\nexport type Height = z.infer<typeof HeightSchema>;\n\nexport const PageContentSchema = z.object({\n markdown: z.string(),\n editThisPageUrl: UrlSchema.optional(),\n editThisPageLaunch: EditThisPageLaunchSchema.optional(),\n rawMarkdown: z.string().optional()\n});\nexport type PageContent = z.infer<typeof PageContentSchema>;\n\nexport const NavigationNodeMetadataSchema = z.object({\n icon: z.string().optional(),\n hidden: z.boolean().optional(),\n urlSlug: z.string(),\n fullSlug: z.array(z.string()).optional()\n});\nexport type NavigationNodeMetadata = z.infer<typeof NavigationNodeMetadataSchema>;\n\nexport const PageMetadataSchema = z.object({\n ...NavigationNodeMetadataSchema.shape,\n id: PageIdSchema,\n title: z.string()\n});\nexport type PageMetadata = z.infer<typeof PageMetadataSchema>;\n\nexport const LinkMetadataSchema = z.object({\n title: z.string(),\n icon: z.string().optional(),\n url: UrlSchema,\n target: LinkTargetSchema.optional()\n});\nexport type LinkMetadata = z.infer<typeof LinkMetadataSchema>;\n\nexport const NavigationTabLinkSchema = z.object({\n title: z.string(),\n icon: z.string().optional(),\n url: UrlSchema,\n target: LinkTargetSchema.optional()\n});\nexport type NavigationTabLink = z.infer<typeof NavigationTabLinkSchema>;\n\nexport const ChangelogItemSchema = z.object({\n date: z.string(),\n pageId: PageIdSchema,\n tags: z.array(z.string()).optional()\n});\nexport type ChangelogItem = z.infer<typeof ChangelogItemSchema>;\n\nexport const ChangelogSectionSchema = z.object({\n ...NavigationNodeMetadataSchema.shape,\n title: z.string().optional(),\n description: z.string().optional(),\n pageId: PageIdSchema.optional(),\n items: z.array(ChangelogItemSchema)\n});\nexport type ChangelogSection = z.infer<typeof ChangelogSectionSchema>;\n\nexport const ChangelogSectionV3Schema = z.object({\n node: z.unknown().optional()\n});\nexport type ChangelogSectionV3 = z.infer<typeof ChangelogSectionV3Schema>;\n\nexport const ApiSectionV2Schema = z.object({\n node: z.unknown()\n});\nexport type ApiSectionV2 = z.infer<typeof ApiSectionV2Schema>;\n\nexport const GitHubRepoSchema = z.object({\n name: z.string(),\n url: UrlSchema\n});\nexport type GitHubRepo = z.infer<typeof GitHubRepoSchema>;\n\nexport const NpmPackageSchema = z.object({\n packageName: z.string(),\n githubRepo: GitHubRepoSchema,\n version: z.string()\n});\nexport type NpmPackage = z.infer<typeof NpmPackageSchema>;\n\nexport const MavenPackageSchema = z.object({\n coordinate: z.string(),\n githubRepo: GitHubRepoSchema,\n version: z.string()\n});\nexport type MavenPackage = z.infer<typeof MavenPackageSchema>;\n\nexport const PypiPackageSchema = z.object({\n packageName: z.string(),\n githubRepo: GitHubRepoSchema,\n version: z.string()\n});\nexport type PypiPackage = z.infer<typeof PypiPackageSchema>;\n\nexport const PublishedSdkSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"npm\"), ...NpmPackageSchema.shape }),\n z.object({ type: z.literal(\"maven\"), ...MavenPackageSchema.shape }),\n z.object({ type: z.literal(\"pypi\"), ...PypiPackageSchema.shape })\n]);\nexport type PublishedSdk = z.infer<typeof PublishedSdkSchema>;\n\nexport const PublishedPostmanCollectionSchema = z.object({\n url: UrlSchema,\n githubRepo: GitHubRepoSchema.optional()\n});\nexport type PublishedPostmanCollection = z.infer<typeof PublishedPostmanCollectionSchema>;\n\nexport const ApiArtifactsSchema = z.object({\n sdks: z.array(PublishedSdkSchema),\n postman: PublishedPostmanCollectionSchema.optional()\n});\nexport type ApiArtifacts = z.infer<typeof ApiArtifactsSchema>;\n\nexport type ApiNavigationConfigItem =\n | ApiNavigationConfigItem.Subpackage\n | ApiNavigationConfigItem.EndpointId\n | ApiNavigationConfigItem.WebsocketId\n | ApiNavigationConfigItem.WebhookId\n | ApiNavigationConfigItem.Page;\n\nexport namespace ApiNavigationConfigItem {\n export interface Subpackage {\n type: \"subpackage\";\n summaryPageId?: string | null;\n subpackageId: string;\n items: ApiNavigationConfigItem[];\n }\n export interface EndpointId {\n type: \"endpointId\";\n value: string;\n }\n export interface WebsocketId {\n type: \"websocketId\";\n value: string;\n }\n export interface WebhookId {\n type: \"webhookId\";\n value: string;\n }\n export interface Page extends PageMetadata {\n type: \"page\";\n }\n}\n\nexport const ApiNavigationConfigItemSchema: z.ZodType<ApiNavigationConfigItem> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"subpackage\"),\n summaryPageId: PageIdSchema.optional(),\n subpackageId: SubpackageIdSchema,\n items: z.array(ApiNavigationConfigItemSchema)\n }),\n z.object({ type: z.literal(\"endpointId\"), value: EndpointIdSchema }),\n z.object({ type: z.literal(\"websocketId\"), value: WebSocketIdSchema }),\n z.object({ type: z.literal(\"webhookId\"), value: WebhookIdSchema }),\n z.object({\n type: z.literal(\"page\"),\n ...PageMetadataSchema.shape\n })\n ])\n);\n\nexport const ApiNavigationConfigRootSchema = z.object({\n summaryPageId: PageIdSchema.optional(),\n items: z.array(ApiNavigationConfigItemSchema)\n});\nexport type ApiNavigationConfigRoot = z.infer<typeof ApiNavigationConfigRootSchema>;\n","import { oc } from \"@orpc/contract\";\nimport * as z from \"zod\";\nimport {\n DocsConfigSchema as DocsReadConfigSchema,\n DocsDefinitionSchema as DocsReadDefinitionSchema,\n LoadDocsForUrlResponseSchema\n} from \"../../../../client/docs-types/read.js\";\n\nexport type {\n DocsConfig,\n DocsDefinition,\n LoadDocsForUrlResponse,\n NavigationConfig,\n NavigationItem\n} from \"../../../../client/docs-types/read.js\";\n// Re-export docs types that consumers depend on\nexport { DocsReadConfigSchema, DocsReadDefinitionSchema, LoadDocsForUrlResponseSchema };\n\nexport const GetDocsUrlMetadataInputSchema = z.object({\n url: z.string()\n});\n\nexport const GetDocsUrlMetadataResponseSchema = z.object({\n isPreviewUrl: z.boolean(),\n org: z.string(),\n url: z.string(),\n gitUrl: z.string().nullish(),\n enableAlgoliaOnPreview: z.boolean().nullish()\n});\n\nexport const GetDocsForUrlInputSchema = z.object({\n url: z.string(),\n excludeApis: z.boolean().nullish()\n});\n\nexport const GetPrivateDocsForUrlInputSchema = z.object({\n url: z.string()\n});\n\nexport const ListAllDocsUrlsInputSchema = z.object({\n limit: z.number().nullish(),\n page: z.number().nullish(),\n custom: z.boolean().nullish(),\n preview: z.boolean().nullish()\n});\n\nexport const GetDocsConfigByIdInputSchema = z.object({\n docsConfigId: z.string()\n});\n\nexport const GetSiteMetricsInputSchema = z.object({\n url: z.string()\n});\n\nexport const SiteMetricsSchema = z.object({\n orgId: z.string().optional(),\n domain: z.string(),\n basepath: z.string().optional(),\n storageType: z.enum([\"ledger\", \"legacy\"]),\n pages: z.number(),\n endpoints: z.number(),\n apiSpecs: z.number()\n});\nexport type SiteMetrics = z.infer<typeof SiteMetricsSchema>;\n\n// Backward-compatible types from generated code, used by downstream packages\nexport interface BaseUrl {\n domain: string;\n basePath: string | undefined;\n}\n\nexport const DocsDefinitionField = {\n BaseUrl: \"BASE_URL\",\n FilesV2: \"FILES_V2\",\n ApisV2: \"APIS_V2\",\n Apis: \"APIS\",\n Pages: \"PAGES\",\n JsFiles: \"JS_FILES\",\n Config: \"CONFIG\",\n Root: \"ROOT\"\n} as const;\nexport type DocsDefinitionField = (typeof DocsDefinitionField)[keyof typeof DocsDefinitionField];\n\nexport interface DocsDomainItem extends BaseUrl {\n organizationId: string;\n updatedAt: string;\n}\n\nexport interface DocsUrlMetadata {\n url: string;\n org: string;\n isPreviewUrl: boolean;\n gitUrl: string | undefined;\n enableAlgoliaOnPreview: boolean;\n}\n\nexport interface EnsureDocsInS3Response {\n s3Url: string;\n orgId: string;\n}\n\nexport interface GetDocsFieldsRequest {\n domain: string;\n basepath?: string;\n fields: DocsDefinitionField[];\n}\n\nexport interface GetDocsFieldsResponse {\n domain: string;\n baseUrl: BaseUrl | undefined;\n filesV2: Record<string, unknown> | undefined;\n apisV2: Record<string, unknown> | undefined;\n apis: Record<string, unknown> | undefined;\n pages: Record<string, unknown> | undefined;\n jsFiles: Record<string, string> | undefined;\n config: unknown | undefined;\n root: unknown | undefined;\n}\n\nexport interface GetDocsConfigByIdResponse {\n docsConfig: unknown;\n apis: Record<string, unknown>;\n}\n\nexport const GetDocsConfigByIdResponseSchema = z.object({\n docsConfig: DocsReadConfigSchema,\n apis: z.record(z.string(), z.unknown())\n});\n\nexport const DocsDomainItemSchema = z.object({\n domain: z.string(),\n basePath: z.string().optional(),\n organizationId: z.string(),\n updatedAt: z.string()\n});\n\nexport const ListAllDocsUrlsResponseSchema = z.object({\n urls: z.array(DocsDomainItemSchema)\n});\n\nexport interface ListAllDocsUrlsResponse {\n urls: DocsDomainItem[];\n}\n\nexport interface ListAllDocsUrlsRequest {\n page?: number;\n limit?: number;\n custom?: boolean;\n preview?: boolean;\n}\n\nexport interface EnsureDocsInS3Request {\n url: string;\n basepath?: string;\n}\n\n// Backward-compatible error type for getDocsForUrl\n// Previously generated by the Fern client, used by downstream packages\nexport namespace getDocsForUrl {\n export type Error = Error.DomainNotRegisteredError | Error.UnauthorizedError | Error._Unknown;\n\n export namespace Error {\n export interface DomainNotRegisteredError {\n error: \"DomainNotRegisteredError\";\n content?: unknown;\n }\n export interface UnauthorizedError {\n error: \"UnauthorizedError\";\n content: string;\n }\n export interface _Unknown {\n error: void;\n content: unknown;\n }\n\n export function _unknown(fetcherError: unknown): _Unknown {\n return { error: undefined as void, content: fetcherError };\n }\n }\n}\n\nexport const docsV2ReadContract = {\n getDocsUrlMetadata: oc\n .route({ method: \"POST\", path: \"/metadata-for-url\" })\n .input(GetDocsUrlMetadataInputSchema)\n .output(GetDocsUrlMetadataResponseSchema),\n\n getDocsForUrl: oc\n .route({ method: \"POST\", path: \"/load-with-url\" })\n .input(GetDocsForUrlInputSchema)\n .output(LoadDocsForUrlResponseSchema),\n\n getPrivateDocsForUrl: oc\n .route({ method: \"POST\", path: \"/private/load-with-url\" })\n .input(GetPrivateDocsForUrlInputSchema)\n .output(LoadDocsForUrlResponseSchema),\n\n listAllDocsUrls: oc\n .route({ method: \"GET\", path: \"/urls/list\" })\n .input(ListAllDocsUrlsInputSchema)\n .output(ListAllDocsUrlsResponseSchema),\n\n getDocsConfigById: oc\n .route({ method: \"GET\", path: \"/{docsConfigId}\" })\n .input(GetDocsConfigByIdInputSchema)\n .output(GetDocsConfigByIdResponseSchema),\n\n getSiteMetrics: oc\n .route({ method: \"POST\", path: \"/admin/site-metrics\" })\n .input(GetSiteMetricsInputSchema)\n .output(SiteMetricsSchema),\n\n prepopulateFdrReadS3Bucket: oc.route({ method: \"POST\", path: \"/prepopulate-s3-bucket\" }).output(z.void()),\n\n ensureDocsInS3: oc.route({ method: \"POST\", path: \"/ensure-docs-in-s3\" }).output(z.void()),\n\n getDocsFields: oc.route({ method: \"POST\", path: \"/load-fields\" }).output(z.void())\n};\n","import { oc } from \"@orpc/contract\";\nimport * as z from \"zod\";\nimport { FileS3UploadUrlSchema } from \"../../../../client/docs-types/write.js\";\nimport type { DocsV1Write } from \"../../../../client/index.js\";\n\nexport type { FileS3UploadUrl } from \"../../../../client/docs-types/write.js\";\nexport { FileS3UploadUrlSchema };\n\n// Branded FilePath type matching DocsV1Write.FilePath\nexport type FilePath = string & { docs_v1_write_FilePath: void };\nexport const FilePathSchema: z.ZodType<FilePath> = z.string() as any;\nexport function FilePath(value: string): FilePath {\n return value as unknown as FilePath;\n}\n\nexport const FilePathInputSchema = z.union([\n FilePathSchema,\n z.object({ path: FilePathSchema, fileHash: z.string().nullish() })\n]);\nexport type FilePathInput = z.infer<typeof FilePathInputSchema>;\n\nexport const ImageFilePathSchema = z.object({\n filePath: FilePathSchema,\n width: z.number(),\n height: z.number(),\n blurDataUrl: z.string().nullish(),\n alt: z.string().nullish(),\n fileHash: z.string().nullish()\n});\nexport type ImageFilePath = z.infer<typeof ImageFilePathSchema>;\n\nexport const AuthConfigSchema = z.object({\n type: z.string()\n});\n\nexport const StartDocsRegisterV2InputSchema = z.object({\n orgId: z.string(),\n domain: z.string(),\n customDomains: z.array(z.string()),\n filepaths: z.array(FilePathInputSchema),\n images: z.array(ImageFilePathSchema).nullish(),\n authConfig: AuthConfigSchema.nullish()\n});\n\nexport const StartDocsRegisterV2ResponseSchema = z.object({\n docsRegistrationId: z.string(),\n uploadUrls: z.record(z.string(), FileS3UploadUrlSchema),\n skippedFiles: z.array(z.string())\n});\n\nexport const StartDocsPreviewRegisterInputSchema = z.object({\n orgId: z.string(),\n filepaths: z.array(FilePathInputSchema),\n basePath: z.string().nullish(),\n images: z.array(ImageFilePathSchema).nullish(),\n authConfig: AuthConfigSchema.nullish(),\n previewId: z.string().nullish()\n});\n\nexport const StartDocsPreviewRegisterResponseSchema = z.object({\n docsRegistrationId: z.string(),\n uploadUrls: z.record(z.string(), FileS3UploadUrlSchema),\n skippedFiles: z.array(z.string()),\n previewUrl: z.string()\n});\n\nexport const FinishDocsRegisterV2InputSchema = z.object({\n docsRegistrationId: z.string(),\n docsDefinition: z.unknown() as z.ZodType<DocsV1Write.DocsDefinition>,\n libraryDocs: z.unknown().nullish(),\n excludeApis: z.boolean().nullish(),\n basepathAware: z.boolean().nullish()\n});\n\nexport const TransferOwnershipInputSchema = z.object({\n domain: z.string(),\n toOrgId: z.string()\n});\n\nexport const SetIsArchivedInputSchema = z.object({\n url: z.string(),\n isArchived: z.boolean()\n});\n\nexport const SetDocsUrlMetadataInputSchema = z.object({\n url: z.string(),\n githubUrl: z.string().nullish()\n});\n\nexport const AlgoliaDomainInputSchema = z.object({\n domain: z.string()\n});\n\nexport const ListAlgoliaPreviewWhitelistResponseSchema = z.object({\n domains: z.array(z.string())\n});\n\nexport const DeleteDocsSiteInputSchema = z.object({\n url: z.string()\n});\n\nexport const RemoveCustomDomainAliasInputSchema = z.object({\n /** The custom-domain URL to remove (e.g. `docs.example.com` or `docs.example.com/api`). */\n url: z.string()\n});\n\n/**\n * BCP 47 language tag validator.\n * Accepts tags like \"en\", \"fr\", \"pt-BR\", \"zh-Hans\", \"zh-Hans-CN\".\n * See: https://www.rfc-editor.org/rfc/rfc5646\n */\nexport const Bcp47LocaleSchema = z\n .string()\n .regex(\n /^[a-zA-Z]{2,8}(-[a-zA-Z0-9]{1,8})*$/,\n \"Locale must be a valid BCP 47 language tag (e.g. 'en', 'fr', 'pt-BR', 'zh-Hans-CN')\"\n );\nexport type Bcp47Locale = z.infer<typeof Bcp47LocaleSchema>;\n\nexport const RegisterTranslationInputSchema = z.object({\n domain: z.string(),\n /**\n * Custom domains that share the docs registration with `domain`. The translation\n * blob is written to S3 once per URL (fern URL + each custom domain), mirroring\n * the fan-out shape of `finishDocsRegister`. Without this, requests to a custom\n * domain hit the translation S3 path under the fern URL prefix and 404.\n */\n customDomains: z.array(z.string()).optional().default([]),\n orgId: z.string(),\n /** BCP 47 language tag identifying the locale for this translation. */\n locale: Bcp47LocaleSchema,\n /** The full docs definition for this locale, same structure as finishDocsRegister. */\n docsDefinition: z.unknown() as z.ZodType<DocsV1Write.DocsDefinition>\n});\n\nexport const RegisterTranslationResponseSchema = z.object({\n locale: z.string()\n});\n\nexport const docsV2WriteContract = {\n startDocsRegister: oc\n .route({ method: \"POST\", path: \"/v2/init\" })\n .input(StartDocsRegisterV2InputSchema)\n .output(StartDocsRegisterV2ResponseSchema),\n\n startDocsPreviewRegister: oc\n .route({ method: \"POST\", path: \"/preview/init\" })\n .input(StartDocsPreviewRegisterInputSchema)\n .output(StartDocsPreviewRegisterResponseSchema),\n\n finishDocsRegister: oc\n .route({ method: \"POST\", path: \"/register/{docsRegistrationId}\" })\n .input(FinishDocsRegisterV2InputSchema)\n .output(z.void()),\n\n transferOwnershipOfDomain: oc\n .route({ method: \"POST\", path: \"/transfer-ownership\" })\n .input(TransferOwnershipInputSchema)\n .output(z.void()),\n\n setIsArchived: oc\n .route({ method: \"POST\", path: \"/set-is-archived\" })\n .input(SetIsArchivedInputSchema)\n .output(z.void()),\n\n setDocsUrlMetadata: oc\n .route({ method: \"POST\", path: \"/set-metadata-for-url\" })\n .input(SetDocsUrlMetadataInputSchema)\n .output(z.void()),\n\n addAlgoliaPreviewWhitelistEntry: oc\n .route({ method: \"POST\", path: \"/algolia-preview-whitelist/add\" })\n .input(AlgoliaDomainInputSchema)\n .output(z.void()),\n\n removeAlgoliaPreviewWhitelistEntry: oc\n .route({ method: \"POST\", path: \"/algolia-preview-whitelist/remove\" })\n .input(AlgoliaDomainInputSchema)\n .output(z.void()),\n\n listAlgoliaPreviewWhitelist: oc\n .route({ method: \"GET\", path: \"/algolia-preview-whitelist/list\" })\n .output(ListAlgoliaPreviewWhitelistResponseSchema),\n\n deleteDocsSite: oc.route({ method: \"POST\", path: \"/delete\" }).input(DeleteDocsSiteInputSchema).output(z.void()),\n\n /**\n * Removes a single custom-domain alias from a docs site, leaving the\n * Fern-URL sibling intact. Use this when un-binding a custom domain\n * (e.g. from the dashboard's \"Remove custom domain\" flow) — `deleteDocsSite`\n * would also nuke the Fern URL.\n *\n * Idempotent: succeeds with no-op if the URL is not registered.\n */\n removeCustomDomainAlias: oc\n .route({ method: \"POST\", path: \"/remove-custom-domain-alias\" })\n .input(RemoveCustomDomainAliasInputSchema)\n .output(z.void()),\n\n registerTranslation: oc\n .route({ method: \"POST\", path: \"/translations/register\" })\n .input(RegisterTranslationInputSchema)\n .output(RegisterTranslationResponseSchema)\n};\n","import * as z from \"zod\";\nimport type { RootNode } from \"../../navigation/types/v1.js\";\nimport type {\n EndpointId as EndpointId_,\n PageId,\n SubpackageId,\n WebhookId as WebhookId_,\n WebSocketId as WebSocketId_\n} from \"./write-commons\";\nimport {\n AgentsConfigSchema,\n AIChatConfigSchema,\n AnalyticsConfigSchema,\n ApiDefinitionIdSchema,\n AvailabilitySchema,\n ColorsConfigSchema,\n ColorsConfigV2Schema,\n CssConfigSchema,\n DocsLayoutConfigSchema,\n DocsSettingsConfigSchema,\n DocsThemeConfigSchema,\n DocsTranslationsConfigSchema,\n DocsTypographyConfigSchema,\n DocsTypographyConfigV2Schema,\n EditThisPageLaunchSchema,\n EndpointIdSchema,\n FileIdSchema,\n FooterLinkSchema,\n IframeConfigSchema,\n IntegrationsConfigSchema,\n JsConfigSchema,\n LanguageSchema,\n LinkTargetSchema,\n MetadataConfigSchema,\n NavbarLinkSchema,\n PageActionsConfigSchema,\n PageIdSchema,\n ProgrammingLanguageSchema,\n RedirectConfigSchema,\n RgbaColorSchema,\n SubpackageIdSchema,\n ThemedFileIdSchema,\n UrlSchema,\n VersionIdSchema,\n WebhookIdSchema,\n WebSocketIdSchema\n} from \"./write-commons\";\n\nexport type FilePath = string & { docs_v1_write_FilePath: void };\nexport const FilePathSchema: z.ZodType<FilePath> = z.string() as any;\nexport function FilePath(value: string): FilePath {\n return value as unknown as FilePath;\n}\n\nexport type DocsRegistrationId = string & { docs_v1_write_DocsRegistrationId: void };\nexport const DocsRegistrationIdSchema: z.ZodType<DocsRegistrationId> = z.string() as any;\nexport function DocsRegistrationId(value: string): DocsRegistrationId {\n return value as unknown as DocsRegistrationId;\n}\n\nexport const HeightSchema = z.number();\nexport type Height = z.infer<typeof HeightSchema>;\n\nexport const FileS3UploadUrlSchema = z.object({\n uploadUrl: z.string(),\n fileId: FileIdSchema\n});\nexport type FileS3UploadUrl = z.infer<typeof FileS3UploadUrlSchema>;\n\nexport const StartDocsRegisterResponseSchema = z.object({\n docsRegistrationId: DocsRegistrationIdSchema,\n uploadUrls: z.record(FilePathSchema, FileS3UploadUrlSchema),\n skippedFiles: z.array(FilePathSchema)\n});\nexport type StartDocsRegisterResponse = z.infer<typeof StartDocsRegisterResponseSchema>;\n\nexport const PageContentSchema = z.object({\n markdown: z.string(),\n editThisPageUrl: UrlSchema.optional(),\n editThisPageLaunch: EditThisPageLaunchSchema.optional(),\n rawMarkdown: z.string().optional()\n});\nexport type PageContent = z.infer<typeof PageContentSchema>;\n\nexport const NavigationNodeMetadataSchema = z.object({\n icon: z.string().optional(),\n hidden: z.boolean().optional(),\n urlSlugOverride: z.string().optional(),\n fullSlug: z.array(z.string()).optional()\n});\nexport type NavigationNodeMetadata = z.infer<typeof NavigationNodeMetadataSchema>;\n\nexport const PageMetadataSchema = z.object({\n ...NavigationNodeMetadataSchema.shape,\n id: PageIdSchema,\n title: z.string()\n});\nexport type PageMetadata = z.infer<typeof PageMetadataSchema>;\n\nexport const LinkMetadataSchema = z.object({\n title: z.string(),\n icon: z.string().optional(),\n url: UrlSchema,\n target: LinkTargetSchema.optional()\n});\nexport type LinkMetadata = z.infer<typeof LinkMetadataSchema>;\n\nexport const ChangelogItemSchema = z.object({\n date: z.string(),\n pageId: PageIdSchema,\n hidden: z.boolean().optional(),\n tags: z.array(z.string()).optional()\n});\nexport type ChangelogItem = z.infer<typeof ChangelogItemSchema>;\n\nexport const ChangelogSectionSchema = z.object({\n title: z.string().optional(),\n icon: z.string().optional(),\n hidden: z.boolean().optional(),\n description: z.string().optional(),\n pageId: PageIdSchema.optional(),\n items: z.array(ChangelogItemSchema),\n urlSlug: z.string(),\n fullSlug: z.array(z.string()).optional()\n});\nexport type ChangelogSection = z.infer<typeof ChangelogSectionSchema>;\n\nexport const ChangelogSectionV2Schema = z.object({\n ...NavigationNodeMetadataSchema.shape,\n title: z.string().optional(),\n description: z.string().optional(),\n pageId: PageIdSchema.optional(),\n items: z.array(ChangelogItemSchema)\n});\nexport type ChangelogSectionV2 = z.infer<typeof ChangelogSectionV2Schema>;\n\nexport const ChangelogSectionV3Schema = z.object({\n node: z.unknown()\n});\nexport type ChangelogSectionV3 = z.infer<typeof ChangelogSectionV3Schema>;\n\nexport const NavigationTabLinkSchema = z.object({\n title: z.string(),\n icon: z.string().optional(),\n url: UrlSchema,\n target: LinkTargetSchema.optional()\n});\nexport type NavigationTabLink = z.infer<typeof NavigationTabLinkSchema>;\n\nexport type ApiNavigationConfigItem =\n | ApiNavigationConfigItem.Subpackage\n | ApiNavigationConfigItem.EndpointId\n | ApiNavigationConfigItem.WebsocketId\n | ApiNavigationConfigItem.WebhookId\n | ApiNavigationConfigItem.Page;\n\nexport namespace ApiNavigationConfigItem {\n export interface Subpackage {\n type: \"subpackage\";\n summaryPageId?: PageId | null;\n subpackageId: SubpackageId;\n items: ApiNavigationConfigItem[];\n }\n export interface EndpointId {\n type: \"endpointId\";\n value: EndpointId_;\n }\n export interface WebsocketId {\n type: \"websocketId\";\n value: WebSocketId_;\n }\n export interface WebhookId {\n type: \"webhookId\";\n value: WebhookId_;\n }\n export interface Page extends PageMetadata {\n type: \"page\";\n }\n}\n\nexport const ApiNavigationConfigItemSchema: z.ZodType<ApiNavigationConfigItem> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"subpackage\"),\n summaryPageId: PageIdSchema.optional(),\n subpackageId: SubpackageIdSchema,\n items: z.array(ApiNavigationConfigItemSchema)\n }),\n z.object({ type: z.literal(\"endpointId\"), value: EndpointIdSchema }),\n z.object({ type: z.literal(\"websocketId\"), value: WebSocketIdSchema }),\n z.object({ type: z.literal(\"webhookId\"), value: WebhookIdSchema }),\n z.object({ type: z.literal(\"page\"), ...PageMetadataSchema.shape })\n ])\n);\n\nexport const ApiNavigationConfigSubpackageSchema = z.object({\n summaryPageId: PageIdSchema.optional(),\n subpackageId: SubpackageIdSchema,\n items: z.array(ApiNavigationConfigItemSchema)\n});\nexport type ApiNavigationConfigSubpackage = z.infer<typeof ApiNavigationConfigSubpackageSchema>;\n\nexport const ApiNavigationConfigRootSchema = z.object({\n summaryPageId: PageIdSchema.optional(),\n items: z.array(ApiNavigationConfigItemSchema)\n});\nexport type ApiNavigationConfigRoot = z.infer<typeof ApiNavigationConfigRootSchema>;\n\nexport const ApiSectionSchema = z.object({\n ...NavigationNodeMetadataSchema.shape,\n title: z.string(),\n api: ApiDefinitionIdSchema,\n artifacts: z\n .object({\n sdks: z.array(\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"npm\"),\n packageName: z.string(),\n githubRepoName: z.string(),\n version: z.string()\n }),\n z.object({\n type: z.literal(\"maven\"),\n coordinate: z.string(),\n githubRepoName: z.string(),\n version: z.string()\n }),\n z.object({\n type: z.literal(\"pypi\"),\n packageName: z.string(),\n githubRepoName: z.string(),\n version: z.string()\n })\n ])\n ),\n postman: z\n .object({\n url: UrlSchema,\n githubRepoName: z.string().optional()\n })\n .optional()\n })\n .optional(),\n skipUrlSlug: z.boolean().optional(),\n showErrors: z.boolean().optional(),\n changelog: ChangelogSectionSchema.optional(),\n changelogV2: ChangelogSectionV2Schema.optional(),\n navigation: ApiNavigationConfigRootSchema.optional(),\n longScrolling: z.boolean().optional(),\n flattened: z.boolean().optional()\n});\nexport type ApiSection = z.infer<typeof ApiSectionSchema>;\n\nexport const ApiSectionV2Schema = z.object({\n node: z.unknown()\n});\nexport type ApiSectionV2 = z.infer<typeof ApiSectionV2Schema>;\n\nexport type NavigationItem =\n | NavigationItem.Page\n | NavigationItem.Api\n | NavigationItem.ApiV2\n | NavigationItem.Section\n | NavigationItem.Link\n | NavigationItem.Changelog\n | NavigationItem.ChangelogV3;\n\nexport namespace NavigationItem {\n export interface Page extends PageMetadata {\n type: \"page\";\n }\n export interface Api extends ApiSection {\n type: \"api\";\n }\n export interface ApiV2 extends ApiSectionV2 {\n type: \"apiV2\";\n }\n export interface Section extends DocsSection {\n type: \"section\";\n }\n export interface Link extends LinkMetadata {\n type: \"link\";\n }\n export interface Changelog extends ChangelogSectionV2 {\n type: \"changelog\";\n }\n export interface ChangelogV3 extends ChangelogSectionV3 {\n type: \"changelogV3\";\n }\n}\n\nexport type DocsSection = NavigationNodeMetadata & {\n title: string;\n items: NavigationItem[];\n /** @deprecated Use `collapsible` and `collapsedByDefault` instead. */\n collapsed?: boolean | \"open-by-default\";\n collapsible?: boolean;\n collapsedByDefault?: boolean;\n skipUrlSlug?: boolean;\n overviewPageId?: PageId;\n};\n\nexport const DocsSectionSchema: z.ZodType<DocsSection> = z.lazy(() =>\n z.object({\n ...NavigationNodeMetadataSchema.shape,\n title: z.string(),\n items: z.array(NavigationItemSchema),\n collapsed: z.union([z.boolean(), z.literal(\"open-by-default\")]).optional(),\n collapsible: z.boolean().optional(),\n collapsedByDefault: z.boolean().optional(),\n skipUrlSlug: z.boolean().optional(),\n overviewPageId: PageIdSchema.optional()\n })\n);\n\nexport const NavigationItemSchema: z.ZodType<NavigationItem> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"page\"), ...PageMetadataSchema.shape }),\n z.object({ type: z.literal(\"api\"), ...ApiSectionSchema.shape }),\n z.object({ type: z.literal(\"apiV2\"), ...ApiSectionV2Schema.shape }),\n z.object({\n type: z.literal(\"section\"),\n ...NavigationNodeMetadataSchema.shape,\n title: z.string(),\n items: z.array(NavigationItemSchema),\n collapsed: z.union([z.boolean(), z.literal(\"open-by-default\")]).optional(),\n collapsible: z.boolean().optional(),\n collapsedByDefault: z.boolean().optional(),\n skipUrlSlug: z.boolean().optional(),\n overviewPageId: PageIdSchema.optional()\n }),\n z.object({ type: z.literal(\"link\"), ...LinkMetadataSchema.shape }),\n z.object({ type: z.literal(\"changelog\"), ...ChangelogSectionV2Schema.shape }),\n z.object({ type: z.literal(\"changelogV3\"), ...ChangelogSectionV3Schema.shape })\n ])\n);\n\nexport const NavigationTabGroupSchema = z.object({\n ...NavigationNodeMetadataSchema.shape,\n title: z.string(),\n items: z.array(NavigationItemSchema),\n skipUrlSlug: z.boolean().optional()\n});\nexport type NavigationTabGroup = z.infer<typeof NavigationTabGroupSchema>;\n\nexport const NavigationTabSchema = z.union([NavigationTabGroupSchema, NavigationTabLinkSchema]);\nexport type NavigationTab = z.infer<typeof NavigationTabSchema>;\n\nexport const NavigationTabV2Schema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"group\"), ...NavigationTabGroupSchema.shape }),\n z.object({ type: z.literal(\"link\"), ...NavigationTabLinkSchema.shape }),\n z.object({ type: z.literal(\"changelog\"), ...ChangelogSectionV2Schema.shape }),\n z.object({ type: z.literal(\"changelogV3\"), ...ChangelogSectionV3Schema.shape })\n]);\nexport type NavigationTabV2 = z.infer<typeof NavigationTabV2Schema>;\n\nexport const UnversionedTabbedNavigationConfigSchema = z.object({\n tabs: z.array(NavigationTabSchema).optional(),\n tabsV2: z.array(NavigationTabV2Schema).optional(),\n landingPage: PageMetadataSchema.optional()\n});\nexport type UnversionedTabbedNavigationConfig = z.infer<typeof UnversionedTabbedNavigationConfigSchema>;\n\nexport const UnversionedUntabbedNavigationConfigSchema = z.object({\n items: z.array(NavigationItemSchema),\n landingPage: PageMetadataSchema.optional()\n});\nexport type UnversionedUntabbedNavigationConfig = z.infer<typeof UnversionedUntabbedNavigationConfigSchema>;\n\nexport const UnversionedNavigationConfigSchema = z.union([\n UnversionedTabbedNavigationConfigSchema,\n UnversionedUntabbedNavigationConfigSchema\n]);\nexport type UnversionedNavigationConfig = z.infer<typeof UnversionedNavigationConfigSchema>;\n\nexport const VersionedNavigationConfigDataSchema = z.object({\n version: VersionIdSchema,\n urlSlugOverride: z.string().optional(),\n availability: AvailabilitySchema.optional(),\n config: UnversionedNavigationConfigSchema\n});\nexport type VersionedNavigationConfigData = z.infer<typeof VersionedNavigationConfigDataSchema>;\n\nexport const VersionedNavigationConfigSchema = z.object({\n versions: z.array(VersionedNavigationConfigDataSchema)\n});\nexport type VersionedNavigationConfig = z.infer<typeof VersionedNavigationConfigSchema>;\n\nexport const NavigationConfigSchema = z.union([UnversionedNavigationConfigSchema, VersionedNavigationConfigSchema]);\nexport type NavigationConfig = z.infer<typeof NavigationConfigSchema>;\n\nexport const ThemeConfigSchema = z.object({\n logo: FileIdSchema.optional(),\n backgroundImage: FileIdSchema.optional(),\n accentPrimary: RgbaColorSchema,\n background: RgbaColorSchema.optional(),\n border: RgbaColorSchema.optional(),\n sidebarBackground: RgbaColorSchema.optional(),\n headerBackground: RgbaColorSchema.optional(),\n cardBackground: RgbaColorSchema.optional(),\n accent1: RgbaColorSchema.optional(),\n accent2: RgbaColorSchema.optional(),\n accent3: RgbaColorSchema.optional(),\n accent4: RgbaColorSchema.optional(),\n accent5: RgbaColorSchema.optional(),\n accent6: RgbaColorSchema.optional(),\n accent7: RgbaColorSchema.optional(),\n accent8: RgbaColorSchema.optional(),\n accent9: RgbaColorSchema.optional(),\n accent10: RgbaColorSchema.optional(),\n accent11: RgbaColorSchema.optional(),\n accent12: RgbaColorSchema.optional()\n});\nexport type ThemeConfig = z.infer<typeof ThemeConfigSchema>;\n\nexport const DarkAndLightModeConfigSchema = z.object({\n dark: ThemeConfigSchema,\n light: ThemeConfigSchema\n});\nexport type DarkAndLightModeConfig = z.infer<typeof DarkAndLightModeConfigSchema>;\n\nexport const ColorsConfigV3Schema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"dark\"), ...ThemeConfigSchema.shape }),\n z.object({ type: z.literal(\"light\"), ...ThemeConfigSchema.shape }),\n z.object({ type: z.literal(\"darkAndLight\"), ...DarkAndLightModeConfigSchema.shape })\n]);\nexport type ColorsConfigV3 = z.infer<typeof ColorsConfigV3Schema>;\n\nexport const DocsConfigSchema = z.object({\n title: z.string().optional(),\n defaultLanguage: ProgrammingLanguageSchema.optional(),\n languages: z.array(LanguageSchema).optional(),\n translations: DocsTranslationsConfigSchema.optional(),\n announcement: z.object({ text: z.string() }).optional(),\n navigation: NavigationConfigSchema.optional(),\n root: z.custom<RootNode>().optional(),\n navbarLinks: z.array(NavbarLinkSchema).optional(),\n footerLinks: z.array(FooterLinkSchema).optional(),\n hideNavLinks: z.boolean().optional(),\n logoHeight: HeightSchema.optional(),\n logoHref: UrlSchema.optional(),\n logoRightText: z.string().optional(),\n favicon: FileIdSchema.optional(),\n agents: AgentsConfigSchema.optional(),\n metadata: MetadataConfigSchema.optional(),\n redirects: z.array(RedirectConfigSchema).optional(),\n colorsV3: ColorsConfigV3Schema.optional(),\n layout: DocsLayoutConfigSchema.optional(),\n theme: DocsThemeConfigSchema.optional(),\n globalTheme: z.string().optional(),\n settings: DocsSettingsConfigSchema.optional(),\n typographyV2: DocsTypographyConfigV2Schema.optional(),\n analyticsConfig: AnalyticsConfigSchema.optional(),\n integrations: IntegrationsConfigSchema.optional(),\n css: CssConfigSchema.optional(),\n js: JsConfigSchema.optional(),\n aiChatConfig: AIChatConfigSchema.optional(),\n pageActions: PageActionsConfigSchema.optional(),\n editThisPageLaunch: EditThisPageLaunchSchema.optional(),\n iframe: IframeConfigSchema.optional(),\n header: z.string().optional(),\n footer: z.string().optional(),\n backgroundImage: FileIdSchema.optional(),\n logoV2: ThemedFileIdSchema.optional(),\n logo: FileIdSchema.optional(),\n colors: ColorsConfigSchema.optional(),\n colorsV2: ColorsConfigV2Schema.optional(),\n typography: DocsTypographyConfigSchema.optional()\n});\nexport type DocsConfig = z.infer<typeof DocsConfigSchema>;\n\nexport const DocsDefinitionSchema = z.object({\n pages: z.record(PageIdSchema, PageContentSchema),\n config: DocsConfigSchema,\n jsFiles: z.record(z.string(), z.string()).optional()\n});\nexport type DocsDefinition = z.infer<typeof DocsDefinitionSchema>;\n\nexport const NpmPackageSchema = z.object({\n packageName: z.string(),\n githubRepoName: z.string(),\n version: z.string()\n});\nexport type NpmPackage = z.infer<typeof NpmPackageSchema>;\n\nexport const MavenPackageSchema = z.object({\n coordinate: z.string(),\n githubRepoName: z.string(),\n version: z.string()\n});\nexport type MavenPackage = z.infer<typeof MavenPackageSchema>;\n\nexport const PypiPackageSchema = z.object({\n packageName: z.string(),\n githubRepoName: z.string(),\n version: z.string()\n});\nexport type PypiPackage = z.infer<typeof PypiPackageSchema>;\n\nexport const PublishedSdkSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"npm\"), ...NpmPackageSchema.shape }),\n z.object({ type: z.literal(\"maven\"), ...MavenPackageSchema.shape }),\n z.object({ type: z.literal(\"pypi\"), ...PypiPackageSchema.shape })\n]);\nexport type PublishedSdk = z.infer<typeof PublishedSdkSchema>;\n\nexport const PublishedPostmanCollectionSchema = z.object({\n url: UrlSchema,\n githubRepoName: z.string().optional()\n});\nexport type PublishedPostmanCollection = z.infer<typeof PublishedPostmanCollectionSchema>;\n\nexport const ApiArtifactsSchema = z.object({\n sdks: z.array(PublishedSdkSchema),\n postman: PublishedPostmanCollectionSchema.optional()\n});\nexport type ApiArtifacts = z.infer<typeof ApiArtifactsSchema>;\n\nexport const InvalidCustomDomainErrorBodySchema = z.object({\n overlappingDomains: z.array(z.array(z.string()))\n});\nexport type InvalidCustomDomainErrorBody = z.infer<typeof InvalidCustomDomainErrorBodySchema>;\n\nexport const OverlappingCustomDomainsSchema = z.array(z.string());\nexport type OverlappingCustomDomains = z.infer<typeof OverlappingCustomDomainsSchema>;\n\nexport * from \"./write-commons\";\n","import * as z from \"zod\";\n\nexport type OrgId = string & { OrgId: void };\nexport const OrgIdSchema: z.ZodType<OrgId> = z.string() as any;\nexport function OrgId(value: string): OrgId {\n return value as unknown as OrgId;\n}\n\nexport type {\n AIChatConfig,\n AIChatDatasource,\n AIChatLocation,\n AIChatWebsiteDatasource,\n AIModel,\n AmplitudeConfig,\n AnalyticsConfig,\n AnnouncementConfig,\n Availability,\n ClearBitConfig,\n ColorConfig,\n ColorsConfig,\n ColorsConfigV2,\n ColorThemedConfig,\n ColorUnthemedConfig,\n ContentAlignment,\n CssConfig,\n CustomFontConfig,\n CustomFontConfigVariant,\n CustomPageAction,\n DocsBodyConfig,\n DocsLayoutConfig,\n DocsPageActionsConfig,\n DocsSettingsConfig,\n DocsSidebarConfig,\n DocsTabsConfig,\n DocsTabsObjectConfig,\n DocsTabsStyle,\n DocsThemeConfig,\n DocsTranslationsConfig,\n DocsTypographyConfig,\n DocsTypographyConfigV2,\n EditThisPageLaunch,\n FathomConfig,\n FileIdOrUrl,\n FontConfig,\n FontConfigV2,\n FontDisplay,\n FontStyle,\n FooterLink,\n FooterNavConfig,\n FullStoryAnalyticsConfig,\n GoogleAnalytics4Config,\n GTMConfig,\n HeaderPosition,\n HeapConfig,\n HotJarConfig,\n HttpSnippetLanguage,\n HttpSnippetsConfig,\n IntegrationsConfig,\n IntercomConfig,\n JsConfig,\n JsFileConfig,\n JsRemoteConfig,\n JsScriptStrategy,\n KoalaConfig,\n Language,\n LanguageSwitcherConfig,\n LinkTarget,\n LogRocketConfig,\n MetadataConfig,\n MixpanelConfig,\n NavbarGithubMetadata,\n NavbarLink,\n NavbarLinkDropdownMetadata,\n NavbarLinkMetadata,\n PageActionOption,\n PageActionOptions,\n PageActionsConfig,\n PageWidthSizeConfig,\n PirschConfig,\n PlausibleConfig,\n PostHogConfig,\n ProductSwitcherConfig,\n ProgrammingLanguage,\n RedirectConfig,\n RgbaColor,\n SearchbarPlacement,\n SegmentConfig,\n SiteSwitcherConfig,\n SizeConfig,\n SwitcherPlacement,\n TabsPlacement,\n ThemedFileId,\n TwitterCardSetting,\n WithPermissions\n} from \"./shared\";\nexport {\n AgentsConfigSchema,\n AIChatConfigSchema,\n AIChatDatasourceSchema,\n AIChatLocationSchema,\n AIChatWebsiteDatasourceSchema,\n AIModelSchema,\n AmplitudeConfigSchema,\n AnalyticsConfigSchema,\n AnnouncementConfigSchema,\n ApiDefinitionId,\n ApiDefinitionIdSchema,\n AvailabilitySchema,\n ClearBitConfigSchema,\n ColorConfigSchema,\n ColorsConfigSchema,\n ColorsConfigV2Schema,\n ColorThemedConfigSchema,\n ColorUnthemedConfigSchema,\n ContentAlignmentSchema,\n CssConfigSchema,\n CustomFontConfigSchema,\n CustomFontConfigVariantSchema,\n CustomPageActionSchema,\n DocsBodyConfigSchema,\n DocsLayoutConfigSchema,\n DocsPageActionsConfigSchema,\n DocsSettingsConfigSchema,\n DocsSidebarConfigSchema,\n DocsTabsConfigSchema,\n DocsTabsObjectConfigSchema,\n DocsTabsStyleSchema,\n DocsThemeConfigSchema,\n DocsTranslationsConfigSchema,\n DocsTypographyConfigSchema,\n DocsTypographyConfigV2Schema,\n EditThisPageLaunchSchema,\n EndpointId,\n EndpointIdSchema,\n FathomConfigSchema,\n FileId,\n FileIdOrUrlSchema,\n FileIdSchema,\n FontConfigSchema,\n FontConfigV2Schema,\n FontDisplaySchema,\n FontStyleSchema,\n FooterLinkSchema,\n FooterNavConfigSchema,\n FRAME_ANCESTOR_SOURCE_PATTERN,\n FullStoryAnalyticsConfigSchema,\n GoogleAnalytics4ConfigSchema,\n GTMConfigSchema,\n HeaderPositionSchema,\n HeapConfigSchema,\n HotJarConfigSchema,\n HttpSnippetLanguageSchema,\n HttpSnippetsConfigSchema,\n IframeConfigSchema,\n IntegrationsConfigSchema,\n IntercomConfigSchema,\n isFrameAncestorSource,\n JsConfigSchema,\n JsFileConfigSchema,\n JsRemoteConfigSchema,\n JsScriptStrategySchema,\n KoalaConfigSchema,\n LanguageSchema,\n LanguageSwitcherConfigSchema,\n LinkTargetSchema,\n LogRocketConfigSchema,\n MetadataConfigSchema,\n MixpanelConfigSchema,\n NavbarGithubMetadataSchema,\n NavbarLinkDropdownMetadataSchema,\n NavbarLinkMetadataSchema,\n NavbarLinkSchema,\n PageActionOptionSchema,\n PageActionOptionsSchema,\n PageActionsConfigSchema,\n PageId,\n PageIdSchema,\n PageWidthSizeConfigSchema,\n PirschConfigSchema,\n PlausibleConfigSchema,\n PostHogConfigSchema,\n ProductSwitcherConfigSchema,\n ProgrammingLanguageSchema,\n RedirectConfigSchema,\n RgbaColorSchema,\n RoleId,\n RoleIdSchema,\n SearchbarPlacementSchema,\n SegmentConfigSchema,\n SiteSwitcherConfigSchema,\n SizeConfigSchema,\n SubpackageId,\n SubpackageIdSchema,\n SwitcherPlacementSchema,\n sanitizeFrameAncestors,\n TabsPlacementSchema,\n ThemedFileIdSchema,\n TwitterCardSettingSchema,\n Url,\n UrlSchema,\n VersionId,\n VersionIdSchema,\n WebhookId,\n WebhookIdSchema,\n WebSocketId,\n WebSocketIdSchema,\n WithPermissionsSchema\n} from \"./shared\";\n","import { oc } from \"@orpc/contract\";\nimport * as z from \"zod\";\nimport {\n type AIChatConfig,\n AIChatConfigSchema,\n type AnalyticsConfig,\n AnalyticsConfigSchema,\n type DocsLayoutConfig,\n DocsLayoutConfigSchema,\n type DocsSettingsConfig,\n DocsSettingsConfigSchema,\n type DocsThemeConfig,\n DocsThemeConfigSchema,\n type FooterLink,\n FooterLinkSchema,\n type NavbarLink,\n NavbarLinkSchema,\n type PageActionsConfig,\n PageActionsConfigSchema\n} from \"../../client/docs-types/shared.js\";\nimport {\n AvailabilitySchema,\n GraphQlOperationTypeSchema,\n GraphQlTypeCategorySchema,\n GrpcMethodSchema\n} from \"../api/shared.js\";\nimport { HttpMethodSchema } from \"../shared.js\";\n\n// ── Register ───────────────────────────────────────────────────────────\n\nexport const MissingContentSchema = z.object({\n hash: z.string(),\n uploadUrl: z.string()\n});\n\n/**\n * Register response: the deployment hash and any blobs the server still needs.\n * An empty `missingContent` array means all content is already in CAS —\n * the client can proceed directly to finish without uploading anything.\n */\nexport const RegisterResponseSchema = z.object({\n deploymentHash: z.string(),\n missingContent: z.array(MissingContentSchema)\n});\n\n// ── Finish ─────────────────────────────────────────────────────────────\n\nexport const FinishResponseSchema = z.object({\n deploymentId: z.string(),\n /** ID of the canonical (fern URL) site row. */\n siteId: z.string(),\n /**\n * IDs of any additional site rows created for `customDomains` URLs\n * (ADR 0010). Empty when the publish has no `customDomains`. One ID\n * per parsed customDomain, in the same order as the input.\n */\n additionalSiteIds: z.array(z.string()).default([]),\n deploymentHash: z.string(),\n reusedDeployment: z.boolean(),\n /**\n * Per-locale segment counts when `translations[]` was supplied on the\n * finish input. Absent when no translations were included.\n */\n translationsProcessed: z.array(z.object({ locale: z.string(), segmentsAdded: z.number() })).optional()\n});\n\n// ── Archive ────────────────────────────────────────────────────────────\n\nexport const ArchiveSiteInputSchema = z.object({\n siteId: z.string()\n});\n\nexport const ArchiveSiteResponseSchema = z.object({\n status: z.enum([\"archived\", \"already_archived\", \"not_found\"])\n});\n\n// ── Migrate v2 → ledger ────────────────────────────────────────────────\n\n/**\n * Input for `POST /migrate-v2`: convert one already-published v2 site onto\n * the ledger without waiting for the customer to republish. A Fern-operator\n * action — the server restricts it to members of the `fern` org.\n */\nexport const MigrateV2SiteInputSchema = z.object({\n domain: z.string().min(1),\n /** \"\" for a root site, otherwise a leading-slash basepath. */\n basepath: z.string().default(\"\"),\n /** Report what would convert without writing anything. */\n dryRun: z.boolean().default(false),\n /** Convert again after a manual rollback left the row on a superseded ledger deployment. */\n allowRemigration: z.boolean().default(false)\n});\n\n// ── Static docs build ──────────────────────────────────────────────────\n\n/**\n * Input for `POST /static-build`: build a site's current deployment again\n * without waiting for it to be republished. A Fern-operator action — the\n * server restricts it to members of the `fern` org.\n */\nexport const StartStaticBuildInputSchema = z.object({\n domain: z.string().min(1),\n /** \"\" for a root site, otherwise a leading-slash basepath. Ignored when `path` is given. */\n basepath: z.string().default(\"\"),\n /**\n * A request path on `domain`: the site to build is the one whose basepath the\n * path falls under (the longest match; the root site catches the rest). What\n * the docs-router sends, since it does not know which basepaths a host publishes.\n */\n path: z.string().optional(),\n /**\n * The build the caller is serving for the site (the docs-router's pointer names it by\n * deployment id). When it is the site's current deployment, made with the current renderer\n * as far as `servingRenderer` tells, there is nothing to build and the answer is\n * `up-to-date`; otherwise the site is rebuilt as usual.\n */\n servingBuildId: z.string().optional(),\n /**\n * The renderer (build image digest) the served build was made with, `\"\"` when the caller\n * knows it was made before that was recorded. Omitted when the caller cannot tell (a\n * basepath build), in which case only the deployment is judged. Any value other than the\n * digest FDR currently dispatches builds with makes the build stale.\n */\n servingRenderer: z.string().optional(),\n /**\n * The site's Ask AI enablement after a settings change (FAI sends it when Ask AI is\n * toggled). The build bakes it in place of the manifest's publish-time snapshot, and a\n * finished build of the deployment is replaced rather than reported as already run.\n */\n askAiEnabled: z.boolean().optional(),\n /**\n * Rebuild even when a build of the current deployment already finished: the caller\n * changed per-site config the build bakes in (e.g. site auth) since that build ran.\n * Implied by `askAiEnabled`.\n */\n replaceFinished: z.boolean().optional(),\n /**\n * `publish` (the default) waits for the Job and reports how it ended.\n * `background` returns as soon as the Job exists (`outcome: \"queued\"`): the\n * Job promotes itself when it succeeds. What the docs-router asks for when a\n * visitor reaches a preview that has no static build yet.\n */\n priority: z.enum([\"publish\", \"background\"]).default(\"publish\")\n});\n\nexport const StartStaticBuildResponseSchema = z.object({\n /**\n * Mirrors the dispatcher's own outcomes, plus the sites it can't resolve and\n * `up-to-date`: `servingBuildId` already is the current deployment (made with the current\n * renderer, when `servingRenderer` was given), nothing started; `busy`: a `background`\n * ask FDR did not plan because as many background builds as it allows are already being\n * created — ask again later.\n */\n status: z.enum([\n \"created\",\n \"already-running\",\n \"host-not-enabled\",\n \"disabled\",\n \"not-published\",\n \"up-to-date\",\n \"busy\"\n ]),\n domain: z.string(),\n /** The site built: the requested basepath, or the one `path` resolved to. */\n basepath: z.string(),\n /** Every basepath currently published at `domain` (\"\" is the root site). */\n basepaths: z.array(z.string()).optional(),\n /** The deployment being built, absent when the site has never published. */\n deploymentId: z.string().optional(),\n jobName: z.string().optional(),\n /** The host the build is exported to and served from, which may not be `domain`. */\n host: z.string().optional(),\n /** How the Job ended, or `queued` for a `background` build nobody waited on. */\n outcome: z.enum([\"succeeded\", \"failed\", \"timed-out\", \"gone\", \"unrouted\", \"queued\"]).optional()\n});\n\n/**\n * Input for `POST /static-build/rebuild-all`: rebuild every production static\n * site on the release warm list (live custom-domain sites, no previews) from\n * its current ledger deployment, e.g. after a docs release moves the build\n * images. Builds are dispatched after the response returns (fire and\n * forget). A Fern-operator action — the server restricts it to members of the\n * `fern` org.\n */\nexport const RebuildAllStaticBuildsInputSchema = z.object({\n /** Resolve and report the sites without dispatching any build. */\n dryRun: z.boolean().default(false)\n});\n\nexport const RebuildAllStaticBuildsResponseSchema = z.object({\n dryRun: z.boolean(),\n /** The sites whose rebuild was queued (or would be, on a dry run). */\n sites: z.array(\n z.object({\n domain: z.string(),\n basepath: z.string(),\n deploymentId: z.string()\n })\n )\n});\n\n/**\n * Input for `POST /reindex`: manually rebuild a published site's Algolia search\n * index via the FDR reindex Job. A Fern-operator action — the server restricts\n * it to members of the `fern` org — and forced, so it runs regardless of the\n * per-host reindex allowlist.\n */\nexport const ReindexInputSchema = z.object({\n domain: z.string().min(1),\n /** \"\" for a root site, otherwise a leading-slash basepath. */\n basepath: z.string().default(\"\"),\n /**\n * Block until the Job terminates and report its `outcome`. `false` returns as\n * soon as the Job is launched, with `outcome: \"queued\"`.\n */\n wait: z.boolean().default(true)\n});\n\nexport const ReindexResponseSchema = z.object({\n /**\n * Whether the Job was launched; `disabled` when no Algolia key is configured.\n * `host-not-enabled` is part of the union but not returned here — the endpoint\n * forces the reindex past the allowlist.\n */\n status: z.enum([\"created\", \"already-running\", \"host-not-enabled\", \"disabled\", \"not-published\"]),\n domain: z.string(),\n basepath: z.string(),\n /** The deployment reindexed, absent when the site has never published. */\n deploymentId: z.string().optional(),\n jobName: z.string().optional(),\n /** The terminal Job outcome the endpoint waited for, or `queued` when called with `wait: false`. */\n outcome: z.enum([\"succeeded\", \"failed\", \"timed-out\", \"gone\", \"unrouted\", \"queued\"]).optional()\n});\n\n/**\n * Input for `POST /static-build/promote`: sent by a static build Job once its\n * upload has landed. The token, signed by FDR when it dispatched the Job, is\n * the only credential — it authorizes pointing the hosts it names at its build.\n */\nexport const PromoteStaticBuildInputSchema = z.object({\n token: z.string().min(1)\n});\n\nexport const PromoteStaticBuildResponseSchema = z.object({\n buildId: z.string(),\n /** Every host now pointed at the build, the serving host first. */\n hosts: z.array(z.string()),\n /** The pointer entry that moved: \"\" for the root site. */\n basepath: z.string()\n});\n\n/**\n * Input for `POST /static-build/serving-host`: which hostname this\n * environment's docs-router serves a site's static builds from. Also a\n * Fern-operator action — it reads another org's ledger.\n */\nexport const ResolveStaticServingHostInputSchema = z.object({\n domain: z.string().min(1),\n /** \"\" for a root site, otherwise a leading-slash basepath. */\n basepath: z.string().default(\"\")\n});\n\nexport const ResolveStaticServingHostResponseSchema = z.object({\n domain: z.string(),\n basepath: z.string(),\n /**\n * The hostname the static build is exported to and served from — always a\n * hostname Fern owns for a published site, even one on a customer's domain.\n */\n servingHost: z.string(),\n /** False when nothing routes to the serving host, so cutting over would serve nothing. */\n routable: z.boolean(),\n /**\n * The deployment the serving host was derived from; absent when the site\n * has never published, in which case only its own hostname was available.\n */\n deploymentId: z.string().optional()\n});\n\n/**\n * Input for the `POST /static-build/custom-hostname/*` operations: the customer\n * domain to look up / register / remove on the docs zone as a Cloudflare for SaaS\n * custom hostname. Fern-operator actions: they act on another org's domain.\n */\nexport const CustomHostnameInputSchema = z.object({\n /** A bare hostname (`docs.acme.com`); a scheme, path or port is rejected. */\n host: z\n .string()\n .trim()\n .toLowerCase()\n .regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/, \"Expected a bare hostname\")\n});\n\n/** One `.well-known` file Cloudflare fetches over HTTP to verify the hostname. */\nexport const CustomHostnameHttpChallengeSchema = z.object({\n path: z.string(),\n body: z.string()\n});\n\n/** A DNS TXT record the customer adds so Cloudflare can verify the hostname before it points at us. */\nexport const CustomHostnameTxtRecordSchema = z.object({\n name: z.string(),\n value: z.string()\n});\n\nexport const CustomHostnameSchema = z.object({\n id: z.string(),\n hostname: z.string(),\n /** Cloudflare's hostname status: `active` once it has verified the hostname and proxies it. */\n status: z.string(),\n /** Cloudflare's certificate status: `active` once the certificate is issued. */\n sslStatus: z.string(),\n /** How Cloudflare validates the certificate: `txt` or `http`. */\n sslMethod: z.string(),\n /** Both of the above are `active`, so HTTPS on the hostname works right now. */\n active: z.boolean(),\n httpChallenges: z.array(CustomHostnameHttpChallengeSchema),\n txtRecords: z.array(CustomHostnameTxtRecordSchema),\n verificationErrors: z.array(z.string())\n});\nexport type CustomHostnameStatus = z.infer<typeof CustomHostnameSchema>;\n\nexport const CustomHostnameResponseSchema = z.discriminatedUnion(\"status\", [\n /** No Cloudflare account is configured in this environment. */\n z.object({ status: z.literal(\"disabled\"), host: z.string() }),\n /** A hostname of ours: the zone-wide route already serves it, no custom hostname is needed. */\n z.object({ status: z.literal(\"routable-zone\"), host: z.string(), zone: z.string() }),\n z.object({ status: z.literal(\"not-registered\"), host: z.string(), zone: z.string() }),\n z.object({ status: z.literal(\"registered\"), host: z.string(), zone: z.string(), hostname: CustomHostnameSchema })\n]);\nexport type CustomHostnameResponse = z.infer<typeof CustomHostnameResponseSchema>;\n\nexport const DeleteCustomHostnameResponseSchema = z.object({\n host: z.string(),\n deleted: z.boolean()\n});\n\nexport const MigrateV2SiteSkipReasonSchema = z.enum([\n \"not-registered\",\n \"preview\",\n \"already-ledger\",\n \"has-translations\",\n \"no-navigation\"\n]);\n\nexport const MigrateV2SiteResponseSchema = z.discriminatedUnion(\"outcome\", [\n z.object({\n outcome: z.literal(\"skipped\"),\n domain: z.string(),\n basepath: z.string(),\n reason: MigrateV2SiteSkipReasonSchema\n }),\n z.object({\n outcome: z.literal(\"convertible\"),\n domain: z.string(),\n basepath: z.string(),\n pageCount: z.number(),\n fileCount: z.number()\n }),\n z.object({\n outcome: z.literal(\"migrated\"),\n domain: z.string(),\n basepath: z.string(),\n deploymentId: z.string()\n })\n]);\n\n// ── Publish input (next-gen: server-side decomposition) ───────────────\n\n/** Reference to a CAS blob: hash + content metadata for upload. */\nexport const BlobRefSchema = z.object({\n hash: z.string(),\n contentType: z.string(),\n contentLength: z.number()\n});\nexport type BlobRef = z.infer<typeof BlobRefSchema>;\n\nexport const PageBlobRefSchema = z.object({\n /** SHA-256 hex of the page content bytes. */\n hash: z.string(),\n contentType: z.string().default(\"text/markdown\"),\n contentLength: z.number(),\n /**\n * Bare `fullPath`s of the file/image artifacts this page's rendered\n * markdown references (the `<fullPath>` of each `file:<fullPath>` token).\n * Captured CLI-side from the already-rewritten page markdown (same `file:`\n * regex the bundle serializer uses) so FDR can materialise the page→file\n * join into the route shards without re-fetching or re-parsing content\n * (ADR 0016, \"File metadata on the render path\"). Optional — older CLIs\n * omit it and the page simply contributes no shard-side file identities.\n */\n referencedFiles: z.array(z.string()).optional()\n});\n\n/** Entry in the file manifest: a CAS blob ref with rendering metadata. */\nexport const FileManifestEntrySchema = z.object({\n /** SHA-256 hex of the file bytes (= CAS content hash). */\n hash: z.string(),\n contentType: z.string(),\n contentLength: z.number(),\n /** Original filename (e.g. \"logo.png\"). Used for Content-Disposition and URL cosmetics. */\n filename: z.string(),\n /** Image width in pixels (images only). */\n width: z.number().optional(),\n /** Image height in pixels (images only). */\n height: z.number().optional(),\n /** Base64-encoded blur placeholder (images only). */\n blurDataURL: z.string().optional()\n});\nexport type FileManifestEntry = z.infer<typeof FileManifestEntrySchema>;\n\n// ── Ledger config schema (validated server-side, replaces opaque blob) ─\n\n/** A file reference with image dimensions for next/image layout reservation. */\nexport const ImageRefSchema = z.object({\n path: z.string(),\n width: z.number(),\n height: z.number()\n});\nexport type ImageRef = z.infer<typeof ImageRefSchema>;\n\n/** A file reference or external URL. Replaces FileIdOrUrl. */\nexport const PathOrUrlSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"path\"), value: z.string() }),\n z.object({ type: z.literal(\"url\"), value: z.string() })\n]);\nexport type PathOrUrl = z.infer<typeof PathOrUrlSchema>;\n\nconst RgbaSchema = z.object({ r: z.number(), g: z.number(), b: z.number(), a: z.number().optional() });\n\nconst BackgroundColorSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"solid\"), ...RgbaSchema.shape }),\n z.object({ type: z.literal(\"gradient\") })\n]);\n\nconst ACCENT_SCALE_KEYS = [\n \"accent1\",\n \"accent2\",\n \"accent3\",\n \"accent4\",\n \"accent5\",\n \"accent6\",\n \"accent7\",\n \"accent8\",\n \"accent9\",\n \"accent10\",\n \"accent11\",\n \"accent12\"\n] as const;\n\n/** Radix-style 12-step accent scale, all optional. */\n// Cast is safe: Object.fromEntries cannot preserve the literal key union.\nconst accentScaleShape = Object.fromEntries(ACCENT_SCALE_KEYS.map((key) => [key, RgbaSchema.optional()])) as Record<\n (typeof ACCENT_SCALE_KEYS)[number],\n z.ZodOptional<typeof RgbaSchema>\n>;\n\nconst LedgerThemeConfigSchema = z.object({\n logo: ImageRefSchema.optional(),\n backgroundImage: z.string().optional(),\n accentPrimary: RgbaSchema,\n background: BackgroundColorSchema.optional(),\n border: RgbaSchema.optional(),\n sidebarBackground: RgbaSchema.optional(),\n headerBackground: RgbaSchema.optional(),\n cardBackground: RgbaSchema.optional(),\n ...accentScaleShape\n});\n\nconst LedgerColorsConfigSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"dark\"), ...LedgerThemeConfigSchema.shape }),\n z.object({ type: z.literal(\"light\"), ...LedgerThemeConfigSchema.shape }),\n z.object({\n type: z.literal(\"darkAndLight\"),\n dark: LedgerThemeConfigSchema,\n light: LedgerThemeConfigSchema\n })\n]);\n\nconst LedgerFontVariantSchema = z.object({\n fontFile: z.string(),\n weight: z.array(z.string()).optional(),\n style: z.array(z.enum([\"normal\", \"italic\"])).optional()\n});\n\nconst LedgerFontConfigSchema = z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"custom\"),\n name: z.string(),\n variants: z.array(LedgerFontVariantSchema),\n display: z.enum([\"auto\", \"block\", \"swap\", \"fallback\", \"optional\"]).optional(),\n fallback: z.array(z.string()).optional(),\n fontVariationSettings: z.string().optional()\n })\n]);\n\nconst LedgerTypographySchema = z.object({\n headingsFont: LedgerFontConfigSchema.optional(),\n bodyFont: LedgerFontConfigSchema.optional(),\n codeFont: LedgerFontConfigSchema.optional()\n});\n\nconst LedgerJsFileSchema = z.object({\n path: z.string(),\n strategy: z.enum([\"beforeInteractive\", \"afterInteractive\", \"lazyOnload\"]).optional()\n});\n\nconst LedgerJsConfigSchema = z.object({\n remote: z\n .array(\n z.object({\n url: z.string(),\n strategy: z.enum([\"beforeInteractive\", \"afterInteractive\", \"lazyOnload\"]).optional(),\n disableSri: z.boolean().optional()\n })\n )\n .optional(),\n files: z.array(LedgerJsFileSchema).optional(),\n inline: z.array(z.string()).optional()\n});\n\nconst LedgerMetadataConfigSchema = z.record(z.string(), z.unknown()).and(\n z.object({\n \"og:image\": PathOrUrlSchema.optional(),\n \"og:logo\": PathOrUrlSchema.optional(),\n \"twitter:image\": PathOrUrlSchema.optional(),\n \"og:background-image\": PathOrUrlSchema.optional(),\n \"og:dynamic:background-image\": PathOrUrlSchema.optional()\n })\n);\n\n// The shared docs-config schemas below are annotated as `z.ZodType<NamedType>`\n// so declaration emit references the named types instead of inlining their full\n// structural shape — without this, the inferred type of the publish router\n// exceeds tsc's serialization limit (TS7056).\nconst NavbarLinksFieldSchema: z.ZodType<NavbarLink[]> = z.array(NavbarLinkSchema);\nconst FooterLinksFieldSchema: z.ZodType<FooterLink[]> = z.array(FooterLinkSchema);\nconst LayoutFieldSchema: z.ZodType<DocsLayoutConfig> = DocsLayoutConfigSchema;\nconst ThemeFieldSchema: z.ZodType<DocsThemeConfig> = DocsThemeConfigSchema;\nconst SettingsFieldSchema: z.ZodType<DocsSettingsConfig> = DocsSettingsConfigSchema;\nconst AnalyticsFieldSchema: z.ZodType<AnalyticsConfig> = AnalyticsConfigSchema;\nconst AIChatFieldSchema: z.ZodType<AIChatConfig> = AIChatConfigSchema;\nconst PageActionsFieldSchema: z.ZodType<PageActionsConfig> = PageActionsConfigSchema;\n\nconst LedgerAgentsConfigSchema = z.object({\n pageDirective: z.string().optional(),\n pageDescriptionSource: z.enum([\"description\", \"subtitle\"]).optional(),\n siteDescription: z.string().optional()\n});\n\n/**\n * Ledger-native config schema. Validated server-side on register/finish.\n *\n * Key differences from the classic DocsConfig:\n * - No FileId references — file references use fullPath strings\n * - Logo uses ImageRef (path + width + height) for next/image layout\n * - Config-referenced files (favicon, logo, OG images, fonts, JS) carry their\n * fullPath strings and are retained in the pointer's `files` map\n * (see collectConfigFilePaths); robots.txt/llms.txt/context7.json remain\n * well-known files served by convention via file artifact lookup\n * - navigation/root excluded — the nav tree is a separate field on DocsPublishInput\n */\nexport const LedgerConfigSchema = z.object({\n title: z.string().optional(),\n rootSlug: z.string().optional(),\n defaultLanguage: z.string().optional(),\n translations: z\n .object({\n defaultLocale: z.string(),\n translations: z.array(z.string()).optional()\n })\n .optional(),\n announcement: z.object({ text: z.string() }).optional(),\n navbarLinks: NavbarLinksFieldSchema.optional(),\n footerLinks: FooterLinksFieldSchema.optional(),\n logoHeight: z.number().optional(),\n logoHref: z.string().optional(),\n logoRightText: z.string().optional(),\n /** fullPath of the favicon file artifact (any extension: .svg/.png/.ico). */\n favicon: z.string().nullish(),\n agents: LedgerAgentsConfigSchema.optional(),\n metadata: LedgerMetadataConfigSchema.optional(),\n redirects: z\n .array(z.object({ source: z.string(), destination: z.string(), permanent: z.boolean().optional() }))\n .optional(),\n colorsV3: LedgerColorsConfigSchema.optional(),\n layout: LayoutFieldSchema.optional(),\n theme: ThemeFieldSchema.optional(),\n settings: SettingsFieldSchema.optional(),\n typographyV2: LedgerTypographySchema.optional(),\n analyticsConfig: AnalyticsFieldSchema.optional(),\n integrations: z\n .object({\n intercom: z.string().optional()\n })\n .optional(),\n css: z.object({ inline: z.array(z.string()).optional() }).optional(),\n js: LedgerJsConfigSchema.optional(),\n aiChatConfig: AIChatFieldSchema.optional(),\n pageActions: PageActionsFieldSchema.optional(),\n editThisPageLaunch: z.enum([\"github\", \"dashboard\"]).optional(),\n /** Origins allowed to iframe the site, appended to the CSP `frame-ancestors` directive. */\n iframe: z.object({ allowedParentOrigins: z.array(z.string()) }).optional(),\n /**\n * Explicit edit-this-page GitHub config from docs.yml (ADR 0012 parity).\n * When present, the loader synthesises `editThisPageUrl` from these fields\n * instead of relying on deployment-scoped git provenance. This matches the\n * v2 behaviour where the CLI derives the URL from the declared config.\n */\n editThisPageGithub: z\n .object({\n owner: z.string(),\n repo: z.string(),\n branch: z.string().default(\"main\"),\n host: z.string().default(\"https://github.com\")\n })\n .optional(),\n header: z.string().optional(),\n footer: z.string().optional()\n});\nexport type LedgerConfig = z.infer<typeof LedgerConfigSchema>;\n\n// ── Ledger metadata schemas ───────────────────────────────────────────\n\nconst MetadataStringArraySchema = z.array(z.string());\nconst FeatureFlagMetadataSchema = z.array(\n z.union([\n z.string(),\n z.object({\n flag: z.string(),\n fallbackValue: z.unknown().optional(),\n match: z.unknown().optional()\n })\n ])\n);\nconst LinkTargetSchema = z.enum([\"_blank\", \"_self\", \"_parent\", \"_top\"]);\nconst CollapsedSchema = z.union([z.boolean(), z.literal(\"open-by-default\")]);\n// docs.yml `playground` settings, round-tripped through segment / api-artifact metadata\n// so `playground.hidden` (and friends) survive the ledger nav rebuild. The nav-node\n// `PlaygroundSettings` type is a fixed shape, so no `.passthrough()` here — the reader\n// in ledger-root-builder reads exactly these fields.\nconst PlaygroundSettingsSchema = z.object({\n hidden: z.boolean().optional(),\n environments: z.array(z.string()).optional(),\n button: z.object({ href: z.string().optional() }).optional(),\n \"limit-websocket-messages-per-connection\": z.number().optional(),\n \"send-optional-defaults\": z.boolean().optional()\n});\nexport type LedgerPlaygroundMetadata = z.infer<typeof PlaygroundSettingsSchema>;\nconst LedgerAvailabilitySchema = z.union([\n AvailabilitySchema,\n z.enum([\n \"alpha\",\n \"stable\",\n \"generally-available\",\n \"in-development\",\n \"pre-release\",\n \"beta\",\n \"preview\",\n \"deprecated\",\n \"legacy\"\n ])\n]);\n\nexport const LedgerArtifactTypeSchema = z.enum([\n \"markdown\",\n \"page\",\n \"rest\",\n \"asyncapi\",\n \"webhook\",\n \"grpc\",\n \"graphql\",\n \"graphqlType\",\n \"changelog\",\n \"link\",\n \"file\",\n \"image\",\n \"redirect\"\n]);\nexport type LedgerArtifactType = z.infer<typeof LedgerArtifactTypeSchema>;\n\nconst LedgerMetadataBaseSchema = z.object({}).passthrough();\n\nconst NodeMetadataFields = {\n title: z.string().optional(),\n slug: z.string().optional(),\n icon: z.string().optional(),\n authed: z.boolean().optional(),\n viewers: MetadataStringArraySchema.optional(),\n orphaned: z.boolean().optional(),\n featureFlags: FeatureFlagMetadataSchema.optional()\n} as const;\n\n// Read-model guarantee: the FDR transform always writes apiDefinitionId\n// (and the per-type ID fields below), so the read schemas require them.\nconst ApiNodeMetadataFields = {\n ...NodeMetadataFields,\n apiDefinitionId: z.string(),\n availability: LedgerAvailabilitySchema.optional(),\n playground: PlaygroundSettingsSchema.optional(),\n noindex: z.boolean().optional()\n} as const;\n\nconst LedgerSegmentDetailMetadataObjectSchema = LedgerMetadataBaseSchema.extend({\n slug: z.string().optional(),\n default: z.boolean().optional(),\n subtitle: z.string().optional(),\n href: z.string().optional(),\n url: z.string().optional(),\n target: LinkTargetSchema.optional(),\n image: z.string().optional(),\n pointsTo: z.string().optional(),\n availability: LedgerAvailabilitySchema.optional(),\n tab_type: z.enum([\"tab\", \"link\", \"changelog\"]).optional()\n});\nexport const LedgerSegmentDetailMetadataSchema = LedgerSegmentDetailMetadataObjectSchema.nullable();\nexport type LedgerSegmentDetailMetadata = z.infer<typeof LedgerSegmentDetailMetadataSchema>;\n\nconst LedgerSegmentMetadataObjectSchema = z.discriminatedUnion(\"type\", [\n LedgerMetadataBaseSchema.extend({\n type: z.literal(\"tabRoot\")\n }),\n LedgerMetadataBaseSchema.extend({\n type: z.literal(\"section\"),\n title: z.string().optional(),\n icon: z.string().optional(),\n authed: z.boolean().optional(),\n collapsed: CollapsedSchema.optional(),\n collapsible: z.boolean().optional(),\n collapsedByDefault: z.boolean().optional(),\n availability: LedgerAvailabilitySchema.optional(),\n overviewPageId: z.string().optional(),\n noindex: z.boolean().optional(),\n pointsTo: z.string().optional(),\n viewers: MetadataStringArraySchema.optional(),\n orphaned: z.boolean().optional(),\n featureFlags: FeatureFlagMetadataSchema.optional()\n }),\n LedgerMetadataBaseSchema.extend({\n type: z.literal(\"apiReference\"),\n title: z.string().optional(),\n icon: z.string().optional(),\n authed: z.boolean().optional(),\n apiDefinitionId: z.string().optional(),\n overviewPageId: z.string().optional(),\n noindex: z.boolean().optional(),\n availability: LedgerAvailabilitySchema.optional(),\n pointsTo: z.string().optional(),\n paginated: z.boolean().optional(),\n showErrors: z.boolean().optional(),\n hideTitle: z.boolean().optional(),\n viewers: MetadataStringArraySchema.optional(),\n orphaned: z.boolean().optional(),\n featureFlags: FeatureFlagMetadataSchema.optional(),\n playground: PlaygroundSettingsSchema.optional()\n }),\n LedgerMetadataBaseSchema.extend({\n type: z.literal(\"apiPackage\"),\n title: z.string().optional(),\n icon: z.string().optional(),\n authed: z.boolean().optional(),\n apiDefinitionId: z.string().optional(),\n overviewPageId: z.string().optional(),\n noindex: z.boolean().optional(),\n availability: LedgerAvailabilitySchema.optional(),\n pointsTo: z.string().optional(),\n viewers: MetadataStringArraySchema.optional(),\n orphaned: z.boolean().optional(),\n featureFlags: FeatureFlagMetadataSchema.optional(),\n playground: PlaygroundSettingsSchema.optional()\n }),\n LedgerMetadataBaseSchema.extend({\n type: z.literal(\"changelog\"),\n title: z.string().optional(),\n icon: z.string().optional(),\n overviewPageId: z.string().optional(),\n apiDefinitionId: z.string().optional(),\n noindex: z.boolean().optional(),\n authed: z.boolean().optional(),\n viewers: MetadataStringArraySchema.optional(),\n orphaned: z.boolean().optional(),\n featureFlags: FeatureFlagMetadataSchema.optional()\n }),\n LedgerMetadataBaseSchema.extend({\n type: z.literal(\"files\")\n }),\n LedgerMetadataBaseSchema.extend({\n type: z.literal(\"redirects\")\n }),\n LedgerMetadataBaseSchema.extend({\n type: z.literal(\"productLink\")\n }),\n LedgerMetadataBaseSchema.extend({\n type: z.literal(\"tabLink\")\n })\n]);\nexport const LedgerSegmentMetadataSchema = LedgerSegmentMetadataObjectSchema;\nexport type LedgerSegmentMetadata = z.infer<typeof LedgerSegmentMetadataSchema>;\n\nexport const LedgerMarkdownMetadataSchema = LedgerMetadataBaseSchema.extend({\n ...NodeMetadataFields,\n pageId: z.string().optional(),\n isOverview: z.boolean().optional(),\n noindex: z.boolean().optional()\n});\n\nexport const LedgerRestMetadataSchema = LedgerMetadataBaseSchema.extend({\n ...ApiNodeMetadataFields,\n endpointId: z.string(),\n method: HttpMethodSchema,\n isResponseStream: z.boolean().optional(),\n endpointPairKey: z.string().optional()\n});\n\nexport const LedgerWebSocketMetadataSchema = LedgerMetadataBaseSchema.extend({\n ...ApiNodeMetadataFields,\n webSocketId: z.string()\n});\n\nexport const LedgerWebhookMetadataSchema = LedgerMetadataBaseSchema.extend({\n ...ApiNodeMetadataFields,\n webhookId: z.string(),\n // V1.WebhookNode carries the full HttpMethod union, so the read model must accept it too.\n method: HttpMethodSchema\n});\n\nexport const LedgerGrpcMetadataSchema = LedgerMetadataBaseSchema.extend({\n ...ApiNodeMetadataFields,\n grpcId: z.string(),\n method: GrpcMethodSchema\n});\n\nexport const LedgerGraphQlMetadataSchema = LedgerMetadataBaseSchema.extend({\n ...ApiNodeMetadataFields,\n graphqlOperationId: z.string(),\n operationType: GraphQlOperationTypeSchema\n});\n\nexport const LedgerGraphQlTypeMetadataSchema = LedgerMetadataBaseSchema.extend({\n ...ApiNodeMetadataFields,\n typeId: z.string(),\n typeCategory: GraphQlTypeCategorySchema\n});\n\nexport const LedgerChangelogEntryMetadataSchema = LedgerMetadataBaseSchema.extend({\n ...NodeMetadataFields,\n pageId: z.string(),\n noindex: z.boolean().optional(),\n date: z.string().optional(),\n tags: MetadataStringArraySchema.optional()\n});\n\nexport const LedgerLinkMetadataSchema = LedgerMetadataBaseSchema.extend({\n title: z.string().optional(),\n slug: z.string().optional(),\n icon: z.string().optional(),\n url: z.string(),\n target: LinkTargetSchema.optional()\n});\n\nexport const LedgerFileArtifactMetadataSchema = LedgerMetadataBaseSchema.extend({\n contentType: z.string(),\n contentLength: z.number().optional(),\n filename: z.string(),\n width: z.number().optional(),\n height: z.number().optional(),\n blurDataURL: z.string().optional()\n});\n\nexport const LedgerStructuralRedirectKindSchema = z.enum([\n \"root\",\n \"product\",\n \"version\",\n \"variant\",\n \"tab\",\n \"section\",\n \"api-section\"\n]);\nexport const LedgerRedirectKindSchema = z.enum([\"structural\", \"link\"]);\n\nexport const LedgerRedirectMetadataSchema = LedgerMetadataBaseSchema.extend({\n href: z.string().optional(),\n redirectKind: LedgerRedirectKindSchema.optional(),\n structuralKind: LedgerStructuralRedirectKindSchema.optional()\n});\n\nexport const LedgerArtifactMetadataSchema = z.union([\n LedgerMarkdownMetadataSchema,\n LedgerRestMetadataSchema,\n LedgerWebSocketMetadataSchema,\n LedgerWebhookMetadataSchema,\n LedgerGrpcMetadataSchema,\n LedgerGraphQlMetadataSchema,\n LedgerGraphQlTypeMetadataSchema,\n LedgerChangelogEntryMetadataSchema,\n LedgerLinkMetadataSchema,\n LedgerFileArtifactMetadataSchema,\n LedgerRedirectMetadataSchema\n]);\nexport type LedgerArtifactMetadata = z.infer<typeof LedgerArtifactMetadataSchema>;\n\n/**\n * Single source of truth for the artifactType → metadata schema pairing.\n * Every discriminated union over artifact types (nav routes, manifest\n * routes, route-context responses) is derived from this map, so adding a\n * type added to one but not the other fails to compile.\n */\nexport const LEDGER_ARTIFACT_METADATA_SCHEMAS = {\n markdown: LedgerMarkdownMetadataSchema,\n page: LedgerMarkdownMetadataSchema,\n rest: LedgerRestMetadataSchema,\n asyncapi: LedgerWebSocketMetadataSchema,\n webhook: LedgerWebhookMetadataSchema,\n grpc: LedgerGrpcMetadataSchema,\n graphql: LedgerGraphQlMetadataSchema,\n graphqlType: LedgerGraphQlTypeMetadataSchema,\n changelog: LedgerChangelogEntryMetadataSchema,\n link: LedgerLinkMetadataSchema,\n file: LedgerFileArtifactMetadataSchema,\n image: LedgerFileArtifactMetadataSchema,\n redirect: LedgerRedirectMetadataSchema\n} as const satisfies Record<LedgerArtifactType, z.ZodType>;\n\n/**\n * Extends `base` with the canonical `{ artifactType, artifactMetadata }`\n * pair for one artifact type. The indexed access into\n * {@link LEDGER_ARTIFACT_METADATA_SCHEMAS} preserves the exact per-type\n * metadata schema, so unions built from tuples of these calls stay\n * precisely typed with zero casts.\n */\nexport function artifactTypeVariant<B extends z.ZodRawShape, T extends LedgerArtifactType>(\n base: z.ZodObject<B>,\n type: T\n): z.ZodObject<\n z.objectUtil.extendShape<\n B,\n {\n artifactType: z.ZodLiteral<T>;\n artifactMetadata: (typeof LEDGER_ARTIFACT_METADATA_SCHEMAS)[T];\n }\n >\n> {\n return base.extend({\n artifactType: z.literal(type),\n artifactMetadata: LEDGER_ARTIFACT_METADATA_SCHEMAS[type]\n });\n}\n\nconst NavRouteBaseSchema = z.object({\n fullPath: z.string().nullable(),\n artifactId: z.string(),\n hidden: z.boolean(),\n displaySortOrder: z.number().nullable().optional()\n});\n\n/** Like {@link artifactTypeVariant} but for nav routes, whose discriminator/metadata keys are `type`/`metadata`. */\nfunction navRouteVariant<T extends LedgerArtifactType>(\n type: T\n): z.ZodObject<\n z.objectUtil.extendShape<\n (typeof NavRouteBaseSchema)[\"shape\"],\n {\n type: z.ZodLiteral<T>;\n metadata: (typeof LEDGER_ARTIFACT_METADATA_SCHEMAS)[T];\n }\n >\n> {\n return NavRouteBaseSchema.extend({\n type: z.literal(type),\n metadata: LEDGER_ARTIFACT_METADATA_SCHEMAS[type]\n });\n}\n\nexport const LedgerNavRouteSchema = z.discriminatedUnion(\"type\", [\n navRouteVariant(\"markdown\"),\n navRouteVariant(\"page\"),\n navRouteVariant(\"rest\"),\n navRouteVariant(\"asyncapi\"),\n navRouteVariant(\"webhook\"),\n navRouteVariant(\"grpc\"),\n navRouteVariant(\"graphql\"),\n navRouteVariant(\"graphqlType\"),\n navRouteVariant(\"changelog\"),\n navRouteVariant(\"link\"),\n navRouteVariant(\"file\"),\n navRouteVariant(\"image\"),\n navRouteVariant(\"redirect\")\n]);\nexport type LedgerNavRoute = z.infer<typeof LedgerNavRouteSchema>;\ntype DistributivePick<T, K extends keyof T> = T extends unknown ? Pick<T, K> : never;\nexport type LedgerArtifactTypeMetadata = DistributivePick<LedgerNavRoute, \"type\" | \"metadata\">;\n\nexport type Equals<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;\n/** Compile-time proof that the nav-route union covers every artifact type. */\nconst _navRouteUnionIsExhaustive: Equals<LedgerNavRoute[\"type\"], LedgerArtifactType> = true;\n\n// ── Publish input (next-gen: server-side decomposition) ───────────────\n\n/**\n * Git provenance for a docs-ledger deployment (ADR 0012 / FER-10489).\n *\n * Captured server-side from the CLI publish input so the read path can\n * synthesise `editThisPageUrl = ${repoUrl}/edit/${branch}/${filename}`\n * without an additional round-trip. All three fields are deployment-\n * scoped (one value per `docs_ledger_deployments` row), nullable for\n * back-compat with deployments published before this field existed.\n */\nexport const DocsPublishGitInputSchema = z.object({\n /** Full HTTPS URL of the repo (e.g. `https://github.com/acme/docs`). */\n repoUrl: z.string(),\n /** Branch the publish ran from. Used to build the edit-this-page URL. */\n branch: z.string(),\n /**\n * Optional commit SHA captured when the CLI knows it. Currently surfaced\n * on `versionMetadata` for diagnostics but not used in URL synthesis.\n */\n commitSha: z.string().optional()\n});\nexport type DocsPublishGitInput = z.infer<typeof DocsPublishGitInputSchema>;\n\n/**\n * Content fields shared by DocsPublishInput and LedgerPreviewRegisterInput.\n * Extracted so that new content-layer fields (e.g. cssFiles) are picked up\n * everywhere automatically.\n */\nexport const DocsContentFieldsSchema = z.object({\n root: z.unknown(),\n pages: z.record(z.string(), PageBlobRefSchema),\n apiManifest: BlobRefSchema.nullish(),\n config: LedgerConfigSchema.optional(),\n /**\n * Content-addressable file manifest: maps fullPath → file metadata + CAS blob ref.\n * Each entry becomes a file/image artifact in the ledger with nav routing by fullPath.\n */\n fileManifest: z.record(z.string(), FileManifestEntrySchema).optional(),\n // TODO: jsFiles is a single blob containing all custom React component bundles.\n // These should eventually be individual artifacts so they can be loaded/cached\n // independently rather than as a monolithic bundle.\n jsFiles: BlobRefSchema.nullish(),\n redirects: BlobRefSchema.nullish(),\n locale: z.string().default(\"en\"),\n version: z.string().nullish(),\n repo: z.string().nullish(),\n /**\n * Git provenance for the deployment (ADR 0012 / FER-10489). Optional —\n * older CLI versions don't send it and the columns stay NULL. When\n * present, captured onto `docs_ledger_deployments` and surfaced on\n * `versionMetadata` so the read path can synthesise `editThisPageUrl`.\n */\n git: DocsPublishGitInputSchema.optional()\n});\n\n/**\n * A single locale entry in the `locales[]` array on `DocsPublishInputSchema`.\n * Overrides `locale` to be required (no default) — the caller must specify\n * the target locale explicitly. Content fields come from `DocsContentFieldsSchema`.\n */\nconst LocaleEntrySchemaInternal = DocsContentFieldsSchema.extend({\n /** Locale identifier (e.g. \"en\", \"es\", \"ja\"). Required — no default. */\n locale: z.string()\n});\nexport type LocaleEntry = z.output<typeof LocaleEntrySchemaInternal>;\nexport type LocaleEntryInput = z.input<typeof LocaleEntrySchemaInternal>;\n// Annotated as `z.ZodType` with named input/output types so declaration emit\n// references the aliases instead of inlining the structural shape — keeps the\n// publish router's inferred type under tsc's serialization limit (TS7056).\nexport const LocaleEntrySchema: z.ZodType<LocaleEntry, z.ZodTypeDef, LocaleEntryInput> = LocaleEntrySchemaInternal;\n\n/**\n * Wire format for the docs-ledger publish endpoints (register + finish).\n *\n * The client sends a flat `locales[]` array where each entry contains a\n * V1 navigation tree, page content as blob refs, and optional global blob\n * refs for one locale. `defaultLocale` identifies which locale is the\n * primary/fallback. The server processes every locale through the same\n * pipeline (transform → presigned URLs / HeadObject → persist).\n */\nconst DocsPublishInputSchemaInternal = z\n .object({\n orgId: z.string(),\n domain: z.string(),\n basepath: z.string().default(\"\"),\n basepathAware: z.boolean().nullish(),\n /**\n * Additional URLs the deployment should be served from (e.g. a customer's\n * vanity hostname `docs.example.com` alongside the canonical fern URL).\n * Each entry is parsed via `ParsedBaseUrl`, so a value like\n * `\"docs.example.com/v2\"` produces a `(domain, basepath)` site row of\n * `(\"docs.example.com\", \"/v2\")` — multi-domain + per-domain subpath is\n * supported in one field. Defaults to `[]`.\n *\n * See ADR 0010.\n */\n customDomains: z.array(z.string()).default([]),\n previewId: z.string().nullish(),\n /** The primary/fallback locale for this deployment (e.g. \"en\"). */\n defaultLocale: z.string().default(\"en\"),\n /**\n * All locales for this deployment. Each locale goes through the same\n * transform → upload → verify → persist pipeline.\n */\n locales: z.array(LocaleEntrySchema).min(1)\n })\n .refine((data) => data.locales.some((l) => l.locale === data.defaultLocale), {\n message: \"defaultLocale must match one of the locales in the locales array\",\n path: [\"defaultLocale\"]\n });\n\nexport type DocsPublishInput = z.output<typeof DocsPublishInputSchemaInternal>;\nexport type DocsPublishInputRaw = z.input<typeof DocsPublishInputSchemaInternal>;\n// See LocaleEntrySchema — same TS7056 mitigation.\nexport const DocsPublishInputSchema: z.ZodType<DocsPublishInput, z.ZodTypeDef, DocsPublishInputRaw> =\n DocsPublishInputSchemaInternal;\n\n// ── Preview register (FER-10491) ──────────────────────────────────────\n\n/**\n * Wire input for `POST /preview/init`. Mirrors V2's `startDocsPreviewRegister`\n * — `domain` is server-generated (`{orgId}-preview-{sanitizedId}.{suffix}`),\n * `customDomains` are explicitly disallowed (preview is single-URL), and\n * the entitlement / ownership / lock branches are bypassed in the handler.\n *\n * Otherwise the input mirrors `DocsPublishInputSchema` so the existing\n * decomposition pipeline (`transformPublishInput`) can run unchanged.\n */\nconst LedgerPreviewRegisterInputSchemaInternal = DocsContentFieldsSchema.partial()\n .extend({\n orgId: z.string(),\n /**\n * Optional caller-supplied identifier for the preview hostname. Sanitized\n * server-side (`[a-z0-9-]+`, no leading/trailing dashes). When absent,\n * the server uses a fresh UUIDv7 — produces a hard-to-guess URL but\n * defeats the round-trip use case where the CLI prints the predicted\n * URL before the publish completes. CLIs should always send this.\n */\n previewId: z.string().nullish(),\n /**\n * Optional path segment appended after the server-generated host.\n * Mirrors V2's `basePath` — most preview publishes leave this empty,\n * but explicit subpath previews (`/v2`) are supported.\n */\n basePath: z.string().default(\"\"),\n /** The primary/fallback locale for this preview deployment. */\n defaultLocale: z.string().optional(),\n /**\n * All locales for this preview deployment. Preferred over the legacy\n * single-locale content fields above.\n */\n locales: z.array(LocaleEntrySchema).min(1).optional()\n })\n .superRefine((data, ctx) => {\n if (data.locales == null) {\n if (data.root == null || data.pages == null) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: \"Either locales or legacy single-locale content fields must be provided\",\n path: [\"locales\"]\n });\n }\n return;\n }\n const defaultLocale = data.defaultLocale ?? data.locales[0]?.locale;\n if (defaultLocale == null || !data.locales.some((locale) => locale.locale === defaultLocale)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: \"defaultLocale must match one of the locales in the locales array\",\n path: [\"defaultLocale\"]\n });\n }\n });\n\nexport type LedgerPreviewRegisterInput = z.output<typeof LedgerPreviewRegisterInputSchemaInternal>;\nexport type LedgerPreviewRegisterInputRaw = z.input<typeof LedgerPreviewRegisterInputSchemaInternal>;\n// See LocaleEntrySchema — same TS7056 mitigation.\nexport const LedgerPreviewRegisterInputSchema: z.ZodType<\n LedgerPreviewRegisterInput,\n z.ZodTypeDef,\n LedgerPreviewRegisterInputRaw\n> = LedgerPreviewRegisterInputSchemaInternal;\n\n/**\n * Wire output for `POST /preview/init`. Same shape as `RegisterResponseSchema`\n * plus the server-generated `previewUrl` so the CLI can surface it to the\n * user without a round-trip to derive the host.\n */\nexport const LedgerPreviewRegisterResponseSchema = z.object({\n deploymentHash: z.string(),\n missingContent: z.array(MissingContentSchema),\n /** Canonical preview URL, e.g. `https://acme-preview-feature-x.docs.buildwithfern.com`. */\n previewUrl: z.string(),\n /** Server-generated host portion of `previewUrl` (no scheme, no basepath). */\n domain: z.string(),\n /** Echoed `basePath` (normalised — empty string when absent). */\n basepath: z.string(),\n /** Sanitized identifier the server actually used to compose the host. */\n previewId: z.string()\n});\n\n// ── Write-side types ───────────────────────────────────────────────────\n\nexport type RegisterResponse = z.infer<typeof RegisterResponseSchema>;\nexport type FinishResponse = z.infer<typeof FinishResponseSchema>;\nexport type ArchiveSiteInput = z.infer<typeof ArchiveSiteInputSchema>;\nexport type ArchiveSiteResponse = z.infer<typeof ArchiveSiteResponseSchema>;\nexport type MigrateV2SiteInput = z.output<typeof MigrateV2SiteInputSchema>;\nexport type MigrateV2SiteResponse = z.infer<typeof MigrateV2SiteResponseSchema>;\nexport type StartStaticBuildInput = z.output<typeof StartStaticBuildInputSchema>;\nexport type StartStaticBuildResponse = z.infer<typeof StartStaticBuildResponseSchema>;\nexport type RebuildAllStaticBuildsInput = z.output<typeof RebuildAllStaticBuildsInputSchema>;\nexport type RebuildAllStaticBuildsResponse = z.infer<typeof RebuildAllStaticBuildsResponseSchema>;\nexport type ReindexInput = z.output<typeof ReindexInputSchema>;\nexport type ReindexResponse = z.infer<typeof ReindexResponseSchema>;\nexport type PromoteStaticBuildInput = z.output<typeof PromoteStaticBuildInputSchema>;\nexport type PromoteStaticBuildResponse = z.infer<typeof PromoteStaticBuildResponseSchema>;\nexport type ResolveStaticServingHostInput = z.output<typeof ResolveStaticServingHostInputSchema>;\nexport type ResolveStaticServingHostResponse = z.infer<typeof ResolveStaticServingHostResponseSchema>;\nexport type LedgerPreviewRegisterResponse = z.infer<typeof LedgerPreviewRegisterResponseSchema>;\n\n// ── Write-side contract ────────────────────────────────────────────────\n\nexport const docsLedgerContract = {\n register: oc\n .route({ method: \"POST\", path: \"/register\" })\n .input(DocsPublishInputSchema)\n .output(RegisterResponseSchema),\n\n previewRegister: oc\n .route({ method: \"POST\", path: \"/preview/init\" })\n .input(LedgerPreviewRegisterInputSchema)\n .output(LedgerPreviewRegisterResponseSchema),\n\n finish: oc\n .route({ method: \"POST\", path: \"/register/finish\" })\n .input(DocsPublishInputSchema)\n .output(FinishResponseSchema),\n\n archiveSite: oc\n .route({ method: \"POST\", path: \"/archive\" })\n .input(ArchiveSiteInputSchema)\n .output(ArchiveSiteResponseSchema),\n\n migrateV2Site: oc\n .route({ method: \"POST\", path: \"/migrate-v2\" })\n .input(MigrateV2SiteInputSchema)\n .output(MigrateV2SiteResponseSchema),\n\n startStaticBuild: oc\n .route({ method: \"POST\", path: \"/static-build\" })\n .input(StartStaticBuildInputSchema)\n .output(StartStaticBuildResponseSchema),\n\n rebuildAllStaticBuilds: oc\n .route({ method: \"POST\", path: \"/static-build/rebuild-all\" })\n .input(RebuildAllStaticBuildsInputSchema)\n .output(RebuildAllStaticBuildsResponseSchema),\n\n reindex: oc.route({ method: \"POST\", path: \"/reindex\" }).input(ReindexInputSchema).output(ReindexResponseSchema),\n\n promoteStaticBuild: oc\n .route({ method: \"POST\", path: \"/static-build/promote\" })\n .input(PromoteStaticBuildInputSchema)\n .output(PromoteStaticBuildResponseSchema),\n\n resolveStaticServingHost: oc\n .route({ method: \"POST\", path: \"/static-build/serving-host\" })\n .input(ResolveStaticServingHostInputSchema)\n .output(ResolveStaticServingHostResponseSchema),\n\n getCustomHostname: oc\n .route({ method: \"POST\", path: \"/static-build/custom-hostname/get\" })\n .input(CustomHostnameInputSchema)\n .output(CustomHostnameResponseSchema),\n\n registerCustomHostname: oc\n .route({ method: \"POST\", path: \"/static-build/custom-hostname/register\" })\n .input(CustomHostnameInputSchema)\n .output(CustomHostnameResponseSchema),\n\n deleteCustomHostname: oc\n .route({ method: \"POST\", path: \"/static-build/custom-hostname/delete\" })\n .input(CustomHostnameInputSchema)\n .output(DeleteCustomHostnameResponseSchema)\n};\n\n// ── Read-side schemas ──────────────────────────────────────────────────\n\nexport const CurrentVersionInputSchema = z.object({\n domain: z.string(),\n basepath: z.string().default(\"\")\n});\n\nexport const CurrentPreviewInputSchema = CurrentVersionInputSchema.extend({\n previewId: z.string()\n});\n\nexport const CurrentVersionResponseSchema = z.object({\n orgId: z.string(),\n domain: z.string(),\n basepath: z.string(),\n deploymentId: z.string(),\n deploymentHash: z.string(),\n siteId: z.string(),\n assignedAt: z.string(),\n assignedBy: z.string().nullable()\n});\n\nconst ContentRefSchema = z.object({\n hash: z.string(),\n s3Key: z.string(),\n contentType: z.string(),\n url: z.string()\n});\n\n/**\n * Full detail metadata for one segment dimension (product / version /\n * variant / tab). Carries everything `docs_ledger_segment_details` stores —\n * not just name + icon — so the read path can reconstruct switcher chrome\n * and navigation nodes (slug, default flag, pointsTo, href, etc. live in\n * {@link metadata}) without fetching a monolithic root.\n */\nexport const SegmentDetailSchema = z.object({\n id: z.string(),\n displayName: z.string(),\n icon: z.string().nullable(),\n sortOrder: z.number(),\n hidden: z.boolean(),\n viewers: z.array(z.string()),\n orphaned: z.boolean(),\n featureFlags: z.array(z.string()),\n /** Type-specific fields: slug, default, subtitle, href, target, image, availability, pointsTo, tab_type. */\n metadata: LedgerSegmentDetailMetadataSchema\n});\nexport type SegmentDetail = z.infer<typeof SegmentDetailSchema>;\n\nconst SegmentSchema = z.object({\n segmentId: z.string(),\n segmentHash: z.string(),\n section: z.string(),\n locale: z.string(),\n /** Sidebar order across segments (docs_ledger_deployment_segments.sort_order). */\n sortOrder: z.number(),\n /** Whether the segment is hidden from the sidebar. */\n hidden: z.boolean(),\n /** Segment type descriptor (seg.metadata): { type, title, icon, apiDefinitionId, overviewPageId, pointsTo, ... }. */\n metadata: LedgerSegmentMetadataSchema,\n /** Full product/version/variant/tab detail metadata, or null when the dimension is absent. */\n product: SegmentDetailSchema.nullable(),\n version: SegmentDetailSchema.nullable(),\n variant: SegmentDetailSchema.nullable(),\n tab: SegmentDetailSchema.nullable(),\n // ── Flat name/icon retained for back-compat (derivable from the\n // detail objects above). ──\n productId: z.string().nullable(),\n productName: z.string().nullable(),\n productIcon: z.string().nullable(),\n versionId: z.string().nullable(),\n versionName: z.string().nullable(),\n versionIcon: z.string().nullable(),\n variantId: z.string().nullable(),\n variantName: z.string().nullable(),\n variantIcon: z.string().nullable(),\n tabId: z.string().nullable(),\n tabName: z.string().nullable(),\n tabIcon: z.string().nullable()\n});\n\nexport const VersionMetadataInputSchema = z.object({\n deploymentId: z.string(),\n locale: z.string().optional()\n});\n\nexport const VersionMetadataResponseSchema = z.object({\n deploymentId: z.string(),\n version: z.string().nullable(),\n /**\n * Inline structural config (ADR 0009). Contains everything from\n * {@link LedgerConfigSchema} except `header`, `footer`, `css.inline`,\n * `js.inline` — those four fields are returned separately via\n * {@link header}, {@link footer}, {@link cssInline}, {@link jsInline}\n * as content-addressed `ContentRef`s. The render path returns this\n * inline so initial page chrome doesn't require an S3 hop.\n */\n configJson: LedgerConfigSchema.nullable(),\n /** CAS ref for the extracted `config.header` blob (raw MDX). */\n header: ContentRefSchema.nullable(),\n /** CAS ref for the extracted `config.footer` blob (raw MDX). */\n footer: ContentRefSchema.nullable(),\n /** CAS ref for the joined `config.css.inline` blob (`\\n`-separated CSS). */\n cssInline: ContentRefSchema.nullable(),\n /** CAS ref for the joined `config.js.inline` blob (`\\n`-separated JS). */\n jsInline: ContentRefSchema.nullable(),\n jsFiles: ContentRefSchema.nullable(),\n segments: z.array(SegmentSchema),\n /** Mapping from human-readable API name slug to API definition UUID. */\n apiNameToId: z.record(z.string(), z.string()),\n /**\n * Git provenance for the deployment (ADR 0012 / FER-10489). Optional —\n * nullable on CLIs that don't send `git` on the publish input. When\n * present, the docs loader synthesises `editThisPageUrl` from `repoUrl`,\n * `branch`, and the page `filename` server-side.\n */\n git: z\n .object({\n repoUrl: z.string(),\n branch: z.string(),\n commitSha: z.string().nullable().optional()\n })\n .optional(),\n /**\n * Docs deployment status from the legacy `docs_sites` table, resolved\n * via Kysely join in the DAO. Null when no matching row exists.\n */\n docsStatus: z.enum([\"PUBLISHING\", \"LIVE\", \"UNPUBLISHED\", \"ERROR\"]).nullable().optional()\n});\n\nexport const PageContentInputSchema = z.object({\n deploymentId: z.string(),\n fullPath: z.string().optional(),\n pageId: z.string().optional(),\n locale: z.string().optional()\n});\n\nexport const PageContentResponseSchema = z.object({\n s3Key: z.string(),\n segmentHash: z.string(),\n url: z.string(),\n pageId: z.string().optional()\n});\n\nexport const BatchPageContentInputSchema = z.object({\n deploymentId: z.string(),\n pageIds: z.array(z.string()).min(1).max(2000),\n locale: z.string().optional()\n});\n\nexport const BatchPageContentItemSchema = z.object({\n pageId: z.string(),\n s3Key: z.string(),\n url: z.string()\n});\n\nexport const BatchPageContentResponseSchema = z.object({\n items: z.array(BatchPageContentItemSchema)\n});\n\nexport const NavInputSchema = z.object({\n segmentHash: z.string()\n});\n\nexport const NavResponseSchema = z.object({\n routes: z.array(LedgerNavRouteSchema)\n});\n\n// ── Route context (route/segment-first hot path) ──────────────────────\n\n/**\n * Resolve a single request path to its page content + the segment it lives\n * in, without fetching the whole navigation root. The ledger loader resolves\n * the route from the `routes` map, then reads the segment's local sidebar\n * (`nav`) and the top-level chrome from the same manifest (ADR 0016).\n */\nexport const RouteContextInputSchema = z.object({\n deploymentId: z.string(),\n fullPath: z.string(),\n locale: z.string().optional()\n});\n\nconst RouteContextResponseBaseSchema = z.object({\n artifactId: z.string(),\n /** Hash of the segment that owns the matched route — feed to `nav`. */\n segmentHash: z.string(),\n /** Section path of the owning segment (e.g. \"models/command\"). */\n section: z.string(),\n locale: z.string(),\n /**\n * Page content reference, or null for non-page artifacts (links/redirects)\n * and route-only aliases that carry no content blob.\n */\n page: z\n .object({\n s3Key: z.string(),\n url: z.string()\n })\n .nullable(),\n /** Identity of the owning segment, for switchers + breadcrumbs. */\n product: SegmentDetailSchema.nullable(),\n version: SegmentDetailSchema.nullable(),\n variant: SegmentDetailSchema.nullable(),\n tab: SegmentDetailSchema.nullable()\n});\n\nexport const RouteContextResponseSchema = z.discriminatedUnion(\"artifactType\", [\n artifactTypeVariant(RouteContextResponseBaseSchema, \"markdown\"),\n artifactTypeVariant(RouteContextResponseBaseSchema, \"page\"),\n artifactTypeVariant(RouteContextResponseBaseSchema, \"rest\"),\n artifactTypeVariant(RouteContextResponseBaseSchema, \"asyncapi\"),\n artifactTypeVariant(RouteContextResponseBaseSchema, \"webhook\"),\n artifactTypeVariant(RouteContextResponseBaseSchema, \"grpc\"),\n artifactTypeVariant(RouteContextResponseBaseSchema, \"graphql\"),\n artifactTypeVariant(RouteContextResponseBaseSchema, \"graphqlType\"),\n artifactTypeVariant(RouteContextResponseBaseSchema, \"changelog\"),\n artifactTypeVariant(RouteContextResponseBaseSchema, \"link\"),\n artifactTypeVariant(RouteContextResponseBaseSchema, \"file\"),\n artifactTypeVariant(RouteContextResponseBaseSchema, \"image\"),\n artifactTypeVariant(RouteContextResponseBaseSchema, \"redirect\")\n]);\n\n/** Compile-time proof that the route-context union covers every artifact type. */\nconst _routeContextUnionIsExhaustive: Equals<\n z.infer<typeof RouteContextResponseSchema>[\"artifactType\"],\n LedgerArtifactType\n> = true;\n\n// ── Top-level navigation (products / versions / variants / tabs) ──────\n\n/**\n * Distinct product/version/variant/tab dimensions for a deployment, with\n * full detail metadata + ordering. Drives the product switcher, version\n * dropdown, and tab bar without materialising the full navigation root.\n */\nexport const TopLevelNavigationInputSchema = z.object({\n deploymentId: z.string(),\n locale: z.string().optional()\n});\n\nexport const TopLevelNavigationResponseSchema = z.object({\n products: z.array(SegmentDetailSchema),\n versions: z.array(SegmentDetailSchema),\n variants: z.array(SegmentDetailSchema),\n tabs: z.array(SegmentDetailSchema)\n});\n\n// ── Version-switch targets (cross-version context preservation) ───────\n\n/**\n * Resolve, for every version of a deployment, the route equivalent to the\n * current page (`fullPath`). Drives the version switcher's cross-version\n * context preservation (`withVersionSwitcherInfo`) without shipping a\n * site-wide slug map to the client. This is inherently cross-version data\n * the route-scoped tree cannot supply — out-of-scope version sidebars are\n * empty — so it queries the flat `docs_ledger_nav` table directly.\n */\nexport const VersionSwitchTargetsInputSchema = z.object({\n deploymentId: z.string(),\n fullPath: z.string(),\n locale: z.string().optional()\n});\n\nexport const VersionSwitchTargetSchema = z.object({\n /** The version detail id (matches a `SegmentDetail.id` from `versionMetadata`). */\n versionId: z.string(),\n /**\n * Slug to navigate to when switching to this version — the equivalent\n * route in the target version, or that version's landing/root slug when\n * no equivalent exists. The current version maps to `fullPath` itself.\n */\n targetSlug: z.string()\n});\nexport type VersionSwitchTarget = z.infer<typeof VersionSwitchTargetSchema>;\n\nexport const VersionSwitchTargetsResponseSchema = z.object({\n targets: z.array(VersionSwitchTargetSchema)\n});\n\n// ── API Definition schemas ─────────────────────────────────────────────\n\nexport const ApiDefinitionInputSchema = z.object({\n deploymentId: z.string(),\n apiDefinitionId: z.string()\n});\n\nexport const ApiDefinitionResponseSchema = z.object({\n s3Key: z.string(),\n contentType: z.string(),\n url: z.string()\n});\n\n// ── Pruned API Definition schemas ─────────────────────────────────────\n\n/**\n * Look up a pre-pruned, per-endpoint API definition blob from the ledger.\n *\n * The finish handler prunes each endpoint/websocket/webhook from the full\n * API manifest at publish time and stores the result as a CAS blob linked\n * to the nav artifact. This endpoint resolves that blob by artifact\n * metadata, avoiding the need to fetch the full (multi-MB) definition.\n */\nexport const PrunedApiDefinitionInputSchema = z.object({\n deploymentId: z.string(),\n apiDefinitionId: z.string(),\n /** Discriminator matching PruningNodeType.type → artifact metadata field. */\n nodeType: z.enum([\"endpoint\", \"webSocket\", \"webhook\", \"grpc\", \"graphql\", \"graphqlType\"]),\n /** The node ID value (endpointId, webSocketId, etc.). */\n nodeId: z.string()\n});\n\nexport const PrunedApiDefinitionResponseSchema = z.object({\n s3Key: z.string(),\n contentType: z.string(),\n url: z.string()\n});\n\n// ── File artifact schemas ─────────────────────────────────────────────\n\nexport const FileArtifactInputSchema = z.object({\n deploymentId: z.string(),\n fullPath: z.string()\n});\n\nexport const FileArtifactResponseSchema = z.object({\n fullPath: z.string(),\n type: z.enum([\"file\", \"image\"]),\n contentType: z.string(),\n contentLength: z.number().optional(),\n filename: z.string(),\n url: z.string(),\n width: z.number().optional(),\n height: z.number().optional(),\n blurDataURL: z.string().optional()\n});\n\n// ── Presigned file download schemas ──────────────────────────────────\n\nexport const PresignedFileDownloadInputSchema = z.object({\n /** S3 object key in the public docs bucket (format: `{domain}/{hash}/{path}`). */\n s3Key: z.string().regex(/^[a-zA-Z0-9._-]+(?:\\/[^/]+){2,}$/)\n});\n\nexport const PresignedFileDownloadResponseSchema = z.object({\n /** Presigned S3 GET URL with long expiry (7 days). */\n url: z.string()\n});\n\n// ── File metadata schemas (metadata-only, no presigned URL) ──────────\n\nexport const FileMetadataInputSchema = z.object({\n deploymentId: z.string(),\n fullPath: z.string()\n});\n\nexport const FileMetadataResponseSchema = z.object({\n /** Content hash — used by the loader to construct CDN URLs. */\n hash: z.string(),\n /** Domain under which the file bytes were uploaded in the docs files bucket. */\n domain: z.string(),\n contentType: z.string(),\n contentLength: z.number().optional(),\n filename: z.string().optional(),\n width: z.number().optional(),\n height: z.number().optional(),\n blurDataURL: z.string().optional()\n});\n\n// ── Read-side contract ─────────────────────────────────────────────────\n\nexport const docsLedgerReadContract = {\n currentVersion: oc\n .route({ method: \"GET\", path: \"/current-version\" })\n .input(CurrentVersionInputSchema)\n .output(CurrentVersionResponseSchema),\n\n currentPreview: oc\n .route({ method: \"GET\", path: \"/current-preview\" })\n .input(CurrentPreviewInputSchema)\n .output(CurrentVersionResponseSchema),\n\n versionMetadata: oc\n .route({ method: \"GET\", path: \"/version-metadata/{deploymentId}\" })\n .input(VersionMetadataInputSchema)\n .output(VersionMetadataResponseSchema),\n\n pageContent: oc\n .route({ method: \"GET\", path: \"/page-content/{deploymentId}\" })\n .input(PageContentInputSchema)\n .output(PageContentResponseSchema),\n\n batchPageContent: oc\n .route({ method: \"POST\", path: \"/batch-page-content/{deploymentId}\" })\n .input(BatchPageContentInputSchema)\n .output(BatchPageContentResponseSchema),\n\n nav: oc.route({ method: \"GET\", path: \"/nav/{segmentHash}\" }).input(NavInputSchema).output(NavResponseSchema),\n\n routeContext: oc\n .route({ method: \"GET\", path: \"/route-context/{deploymentId}\" })\n .input(RouteContextInputSchema)\n .output(RouteContextResponseSchema),\n\n topLevelNavigation: oc\n .route({ method: \"GET\", path: \"/top-level-navigation/{deploymentId}\" })\n .input(TopLevelNavigationInputSchema)\n .output(TopLevelNavigationResponseSchema),\n\n versionSwitchTargets: oc\n .route({ method: \"GET\", path: \"/version-switch-targets/{deploymentId}\" })\n .input(VersionSwitchTargetsInputSchema)\n .output(VersionSwitchTargetsResponseSchema),\n\n apiDefinition: oc\n .route({ method: \"GET\", path: \"/api-definition/{deploymentId}/{apiDefinitionId}\" })\n .input(ApiDefinitionInputSchema)\n .output(ApiDefinitionResponseSchema),\n\n prunedApiDefinition: oc\n .route({ method: \"GET\", path: \"/pruned-api/{deploymentId}/{apiDefinitionId}\" })\n .input(PrunedApiDefinitionInputSchema)\n .output(PrunedApiDefinitionResponseSchema),\n\n fileArtifact: oc\n .route({ method: \"GET\", path: \"/file/{deploymentId}\" })\n .input(FileArtifactInputSchema)\n .output(FileArtifactResponseSchema),\n\n fileMetadata: oc\n .route({ method: \"GET\", path: \"/file-metadata/{deploymentId}\" })\n .input(FileMetadataInputSchema)\n .output(FileMetadataResponseSchema),\n\n presignedFileDownload: oc\n .route({ method: \"POST\", path: \"/presigned-file-download\" })\n .input(PresignedFileDownloadInputSchema)\n .output(PresignedFileDownloadResponseSchema)\n};\n\n// ── Read-side types ────────────────────────────────────────────────────\n\nexport type CurrentVersionInput = z.infer<typeof CurrentVersionInputSchema>;\nexport type CurrentPreviewInput = z.infer<typeof CurrentPreviewInputSchema>;\nexport type CurrentVersionResponse = z.infer<typeof CurrentVersionResponseSchema>;\nexport type VersionMetadataInput = z.infer<typeof VersionMetadataInputSchema>;\nexport type VersionMetadataResponse = z.infer<typeof VersionMetadataResponseSchema>;\nexport type PageContentInput = z.infer<typeof PageContentInputSchema>;\nexport type PageContentResponse = z.infer<typeof PageContentResponseSchema>;\nexport type BatchPageContentInput = z.infer<typeof BatchPageContentInputSchema>;\nexport type BatchPageContentItem = z.infer<typeof BatchPageContentItemSchema>;\nexport type BatchPageContentResponse = z.infer<typeof BatchPageContentResponseSchema>;\nexport type NavInput = z.infer<typeof NavInputSchema>;\nexport type NavResponse = z.infer<typeof NavResponseSchema>;\nexport type RouteContextInput = z.infer<typeof RouteContextInputSchema>;\nexport type RouteContextResponse = z.infer<typeof RouteContextResponseSchema>;\nexport type TopLevelNavigationInput = z.infer<typeof TopLevelNavigationInputSchema>;\nexport type TopLevelNavigationResponse = z.infer<typeof TopLevelNavigationResponseSchema>;\nexport type VersionSwitchTargetsInput = z.infer<typeof VersionSwitchTargetsInputSchema>;\nexport type VersionSwitchTargetsResponse = z.infer<typeof VersionSwitchTargetsResponseSchema>;\nexport type ApiDefinitionInput = z.infer<typeof ApiDefinitionInputSchema>;\nexport type ApiDefinitionResponse = z.infer<typeof ApiDefinitionResponseSchema>;\nexport type PrunedApiDefinitionInput = z.infer<typeof PrunedApiDefinitionInputSchema>;\nexport type PrunedApiDefinitionResponse = z.infer<typeof PrunedApiDefinitionResponseSchema>;\nexport type FileArtifactInput = z.infer<typeof FileArtifactInputSchema>;\nexport type FileArtifactResponse = z.infer<typeof FileArtifactResponseSchema>;\nexport type FileMetadataInput = z.infer<typeof FileMetadataInputSchema>;\nexport type FileMetadataResponse = z.infer<typeof FileMetadataResponseSchema>;\nexport type PresignedFileDownloadInput = z.infer<typeof PresignedFileDownloadInputSchema>;\nexport type PresignedFileDownloadResponse = z.infer<typeof PresignedFileDownloadResponseSchema>;\n","import { oc } from \"@orpc/contract\";\nimport * as z from \"zod\";\n\n// ── Enums ────────────────────────────────────────────────────────────────\n\nexport const LanguageEnumSchema = z.enum([\n \"Go\",\n \"TypeScript\",\n \"Java\",\n \"Python\",\n \"Csharp\",\n \"Ruby\",\n \"Php\",\n \"Swift\",\n \"Rust\"\n]);\nexport type Language = z.infer<typeof LanguageEnumSchema>;\n\nexport const VersionBumpEnumSchema = z.enum([\"MAJOR\", \"MINOR\", \"PATCH\"]);\nexport type VersionBump = z.infer<typeof VersionBumpEnumSchema>;\n\n// ── Input / Output schemas ───────────────────────────────────────────────\n\nexport const ComputeSemanticVersionInputSchema = z.object({\n package: z.string(),\n language: LanguageEnumSchema,\n githubRepository: z.string().nullish()\n});\nexport type ComputeSemanticVersionInput = z.infer<typeof ComputeSemanticVersionInputSchema>;\n\nexport const ComputeSemanticVersionOutputSchema = z.object({\n version: z.string(),\n bump: VersionBumpEnumSchema\n});\nexport type ComputeSemanticVersionOutput = z.infer<typeof ComputeSemanticVersionOutputSchema>;\n\n// ── Contract ─────────────────────────────────────────────────────────────\n\nexport const sdksContract = {\n computeSemanticVersion: oc\n .route({ method: \"POST\", path: \"/semantic-version/compute\" })\n .input(ComputeSemanticVersionInputSchema)\n .output(ComputeSemanticVersionOutputSchema)\n};\n","import { oc } from \"@orpc/contract\";\nimport * as z from \"zod\";\nimport { HttpMethodSchema, SdkSchema } from \"../shared.js\";\n\n// ── Snippet Registry Entry ──────────────────────────────────────────────\n\nexport const SnippetRegistryEntrySchema = z.object({\n sdk: SdkSchema,\n endpointId: z.object({\n path: z.string(),\n method: HttpMethodSchema,\n identifierOverride: z.string().nullish()\n }),\n snippetTemplate: z.object({\n type: z.literal(\"v1\"),\n functionInvocation: z.unknown(),\n clientInstantiation: z.string()\n }),\n additionalTemplates: z.record(z.string(), z.unknown()).nullish()\n});\nexport type SnippetRegistryEntry = z.infer<typeof SnippetRegistryEntrySchema>;\n\n// ── Register input ──────────────────────────────────────────────────────\n\nexport const RegisterInputSchema = z.object({\n orgId: z.string(),\n apiId: z.string(),\n apiDefinitionId: z.string(),\n snippet: SnippetRegistryEntrySchema\n});\nexport type RegisterInput = z.infer<typeof RegisterInputSchema>;\n\n// ── Register batch input ────────────────────────────────────────────────\n\nexport const RegisterBatchInputSchema = z.object({\n orgId: z.string(),\n apiId: z.string(),\n apiDefinitionId: z.string(),\n snippets: z.array(SnippetRegistryEntrySchema)\n});\nexport type RegisterBatchInput = z.infer<typeof RegisterBatchInputSchema>;\n\n// ── Get input ───────────────────────────────────────────────────────────\n\nexport const GetInputSchema = z.object({\n orgId: z.string(),\n apiId: z.string(),\n sdk: SdkSchema,\n endpointId: z.object({\n path: z.string(),\n method: HttpMethodSchema,\n identifierOverride: z.string().nullish()\n })\n});\nexport type GetInput = z.infer<typeof GetInputSchema>;\n\n// ── Get output ──────────────────────────────────────────────────────────\n\nexport const EndpointSnippetTemplateSchema = z.record(z.string(), z.unknown());\nexport type EndpointSnippetTemplate = z.infer<typeof EndpointSnippetTemplateSchema>;\n\n// ── Contract ────────────────────────────────────────────────────────────\n\nexport const templatesContract = {\n register: oc.route({ method: \"POST\", path: \"/register\" }).input(RegisterInputSchema),\n\n registerBatch: oc.route({ method: \"POST\", path: \"/register/batch\" }).input(RegisterBatchInputSchema),\n\n get: oc.route({ method: \"POST\", path: \"/get\" }).input(GetInputSchema).output(EndpointSnippetTemplateSchema)\n};\n","/**\n * Config file-path extraction (ADR 0016).\n *\n * Shared between FDR (write side — decides which files stay in the pointer's\n * `files` map after page-body files are pushed into route shards) and the docs\n * bundle (read side — resolves config-referenced files via\n * `fileMetadata`/`fileArtifact`). Keeping it in one place guarantees the two\n * sides agree on the set: if FDR prunes a file the bundle would later ask for,\n * config resolution breaks, so this MUST not drift.\n */\nimport * as z from \"zod\";\n\n/** Metadata keys that may contain PathOrUrl / FileIdOrUrl file references. */\nexport const PATH_OR_URL_METADATA_KEYS = [\n \"og:image\",\n \"og:logo\",\n \"twitter:image\",\n \"og:background-image\",\n \"og:dynamic:background-image\"\n] as const;\n\n// ── Dual-shape view schemas ─────────────────────────────────────────────\n//\n// These parse ONLY the file-bearing corners of a config blob, tolerating\n// both the ledger shape (ImageRef `{ path }`, `type: \"path\"`) and the\n// normalized legacy shape (`{ fileId }`, `type: \"fileId\"`). Every field is\n// `.optional().catch(undefined)` so an unexpected shape in one corner never\n// aborts collection for the rest of the config.\n\n/** Logo: ImageRef `{ path }` (ledger) or plain fullPath string (legacy). */\nconst LogoViewSchema = z.union([z.string(), z.object({ path: z.string() }).transform((v) => v.path)]);\n\nconst ThemeViewSchema = z.object({\n logo: LogoViewSchema.optional().catch(undefined),\n backgroundImage: z.string().optional().catch(undefined)\n});\n\nconst ColorsViewSchema = z.union([\n z.object({\n type: z.literal(\"darkAndLight\"),\n dark: ThemeViewSchema.optional().catch(undefined),\n light: ThemeViewSchema.optional().catch(undefined)\n }),\n ThemeViewSchema.transform((theme) => ({ type: \"single\" as const, theme }))\n]);\n\nconst FontViewSchema = z.object({\n variants: z.array(z.object({ fontFile: z.string().optional().catch(undefined) })).catch([])\n});\n\nconst TypographyViewSchema = z.object({\n headingsFont: FontViewSchema.optional().catch(undefined),\n bodyFont: FontViewSchema.optional().catch(undefined),\n codeFont: FontViewSchema.optional().catch(undefined)\n});\n\n/** JS file entry: `{ path }` (ledger) or `{ fileId }` (normalized). */\nconst JsFileViewSchema = z.union([\n z.object({ path: z.string() }).transform((v) => v.path),\n z.object({ fileId: z.string() }).transform((v) => v.fileId)\n]);\n\n/** Metadata file ref: `type: \"path\"` (ledger) or `type: \"fileId\"` (normalized). */\nconst MetadataFileRefViewSchema = z.object({\n type: z.enum([\"path\", \"fileId\"]),\n value: z.string()\n});\n\nconst ConfigViewSchema = z.object({\n favicon: z.string().optional().catch(undefined),\n colorsV3: ColorsViewSchema.optional().catch(undefined),\n typographyV2: TypographyViewSchema.optional().catch(undefined),\n js: z\n .object({ files: z.array(JsFileViewSchema.optional().catch(undefined)).catch([]) })\n .optional()\n .catch(undefined),\n metadata: z.record(z.string(), z.unknown()).optional().catch(undefined)\n});\n\nfunction isDarkAndLight(\n colors: z.infer<typeof ColorsViewSchema>\n): colors is Extract<z.infer<typeof ColorsViewSchema>, { type: \"darkAndLight\" }> {\n return colors.type === \"darkAndLight\";\n}\n\n// ── Navigation file-path extraction ─────────────────────────────────────\n//\n// Collects every file path referenced by navigation chrome (product/version/\n// variant/tab icons and images, section icons) from the decomposed segment\n// array returned by `versionMetadata`. These live in `SegmentDetail.icon`\n// (`file:<fullPath>` tokens) and `SegmentDetail.metadata.image` (raw paths\n// or `file:`-prefixed). FontAwesome class strings (no `file:` prefix) are\n// ignored for icons.\n\nconst NAV_ICON_FILE_PREFIX = \"file:\";\n\ntype FileTokenTree = string | number | boolean | null | FileTokenTree[] | { readonly [key: string]: FileTokenTree };\n\nconst FileTokenTreeSchema: z.ZodType<FileTokenTree> = z.lazy(() =>\n z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.array(FileTokenTreeSchema),\n z.record(z.string(), FileTokenTreeSchema)\n ])\n);\n\nconst ConfigFileTokenViewSchema = z.object({\n landingPage: FileTokenTreeSchema.optional().catch(undefined)\n});\n\nfunction addFileTokenPath(paths: Set<string>, value: FileTokenTree): void {\n if (typeof value === \"string\") {\n if (value.startsWith(NAV_ICON_FILE_PREFIX) && value.length > NAV_ICON_FILE_PREFIX.length) {\n paths.add(value.slice(NAV_ICON_FILE_PREFIX.length));\n }\n return;\n }\n if (Array.isArray(value)) {\n for (const item of value) {\n addFileTokenPath(paths, item);\n }\n return;\n }\n if (value !== null && typeof value === \"object\") {\n for (const item of Object.values(value)) {\n addFileTokenPath(paths, item);\n }\n }\n}\n\nconst SegmentDetailIconViewSchema = z.object({\n icon: z.string().nullish().catch(undefined),\n metadata: z\n .object({\n icon: z.string().nullish().catch(undefined),\n image: z.string().nullish().catch(undefined)\n })\n .nullish()\n .catch(undefined)\n});\n\nconst SegmentIconViewSchema = z.object({\n metadata: z\n .object({\n icon: z.string().nullish().catch(undefined),\n image: z.string().nullish().catch(undefined)\n })\n .nullish()\n .catch(undefined),\n product: SegmentDetailIconViewSchema.nullish().catch(undefined),\n version: SegmentDetailIconViewSchema.nullish().catch(undefined),\n variant: SegmentDetailIconViewSchema.nullish().catch(undefined),\n tab: SegmentDetailIconViewSchema.nullish().catch(undefined)\n});\n\n/**\n * Collect fullPaths of every nav icon (`file:<fullPath>`) and image (raw path)\n * referenced by version-metadata segments. FontAwesome class strings (no\n * `file:` prefix) are ignored for icons.\n *\n * Returns a deduplicated array of fullPath strings.\n */\nexport function collectNavFilePaths(segments: readonly unknown[]): string[] {\n const paths = new Set<string>();\n\n const addIcon = (v: string | null | undefined) => {\n if (v?.startsWith(NAV_ICON_FILE_PREFIX)) {\n paths.add(v.slice(NAV_ICON_FILE_PREFIX.length));\n }\n };\n\n const addImage = (v: string | null | undefined) => {\n if (v != null && v.length > 0) {\n paths.add(v.startsWith(NAV_ICON_FILE_PREFIX) ? v.slice(NAV_ICON_FILE_PREFIX.length) : v);\n }\n };\n\n for (const raw of segments) {\n const seg = SegmentIconViewSchema.nullish().catch(undefined).parse(raw);\n if (seg == null) {\n continue;\n }\n\n // Segment-level metadata (section/apiReference icons + images)\n addIcon(seg.metadata?.icon);\n addImage(seg.metadata?.image);\n\n // Dimension-level details (product/version/variant/tab)\n for (const d of [seg.product, seg.version, seg.variant, seg.tab]) {\n addIcon(d?.icon);\n addIcon(d?.metadata?.icon);\n addImage(d?.metadata?.image);\n }\n }\n\n return [...paths];\n}\n\n// ── Config file-path extraction ─────────────────────────────────────────\n\n/**\n * Walk a config blob and collect every `fullPath` string referenced by config\n * fields (favicon, logos, background images, fonts, JS files, OG images).\n *\n * Works on both raw LedgerConfig and normalized (legacy) shapes:\n * - Favicon: plain fullPath string (unchanged across shapes)\n * - Logo: ImageRef `{ path }` or plain string\n * - JS files: `{ path }` (ledger) or `{ fileId }` (normalized)\n * - Metadata: `type: \"path\"` (ledger) or `type: \"fileId\"` (normalized)\n *\n * Returns a deduplicated array of fullPath strings.\n */\nexport function collectConfigFilePaths(config: Record<string, unknown>): string[] {\n const paths = new Set<string>();\n const view = ConfigViewSchema.parse(config);\n const fileTokenView = ConfigFileTokenViewSchema.parse(config);\n if (fileTokenView.landingPage != null) {\n addFileTokenPath(paths, fileTokenView.landingPage);\n }\n\n if (view.favicon != null) {\n paths.add(view.favicon);\n }\n\n if (view.colorsV3 != null) {\n const themes = isDarkAndLight(view.colorsV3)\n ? [view.colorsV3.dark, view.colorsV3.light]\n : [view.colorsV3.theme];\n for (const theme of themes) {\n if (theme == null) {\n continue;\n }\n if (theme.logo != null) {\n paths.add(theme.logo);\n }\n if (theme.backgroundImage != null) {\n paths.add(theme.backgroundImage);\n }\n }\n }\n\n if (view.typographyV2 != null) {\n for (const font of [view.typographyV2.headingsFont, view.typographyV2.bodyFont, view.typographyV2.codeFont]) {\n for (const variant of font?.variants ?? []) {\n if (variant.fontFile != null) {\n paths.add(variant.fontFile);\n }\n }\n }\n }\n\n for (const file of view.js?.files ?? []) {\n if (file != null) {\n paths.add(file);\n }\n }\n\n if (view.metadata != null) {\n for (const key of PATH_OR_URL_METADATA_KEYS) {\n const parsed = MetadataFileRefViewSchema.optional().catch(undefined).parse(view.metadata[key]);\n if (parsed != null) {\n paths.add(parsed.value);\n }\n }\n }\n\n return [...paths];\n}\n","import * as z from \"zod\";\n\nimport {\n artifactTypeVariant,\n type Equals,\n type LedgerArtifactType,\n LedgerConfigSchema,\n LedgerNavRouteSchema,\n LedgerSegmentMetadataSchema,\n SegmentDetailSchema\n} from \"./contract.js\";\n\n/**\n * ADR 0016 read model.\n *\n * The mutable `{domain}/{basepath}/v1/fdr.json` object (when it has the ledger\n * `schema` discriminant) is the pointer. It identifies the live deployment and\n * references immutable route indexes.\n * Route indexes merge route lookup with a bounded sidebar map so the hot page\n * path is pointer → route index → content leaf for ordinary pages.\n */\nexport const LEDGER_MANIFEST_SCHEMA_VERSION = \"docsledger/20260601\" as const;\n\n/** Schema version of an immutable scope-packed route shard (ADR 0016 revised). */\nexport const LEDGER_SHARD_SCHEMA_VERSION = \"docsledger/shard/20260601\" as const;\n\n/** Reference to an immutable CAS blob. The reader derives the S3 key from (orgId, hash) via ADR 0008. */\nexport const ManifestBlobRefSchema = z.object({\n hash: z.string(),\n contentType: z.string()\n});\nexport type ManifestBlobRef = z.infer<typeof ManifestBlobRefSchema>;\n\n/**\n * One navigation segment with its full product/version/variant/tab detail.\n * Mirrors the data the deleted `/version-metadata` endpoint returned per\n * segment; the adapter derives the flat back-compat fields on read.\n */\nexport const ManifestSegmentSchema = z.object({\n /** Synthetic stable id (= segmentHash). */\n segmentId: z.string(),\n segmentHash: z.string(),\n section: z.string(),\n locale: z.string(),\n /** Sidebar order across segments (docs_ledger_deployment_segments.sort_order). */\n sortOrder: z.number(),\n hidden: z.boolean(),\n /** Segment type descriptor: { type, title, icon, apiDefinitionId, overviewPageId, pointsTo, ... }. */\n metadata: LedgerSegmentMetadataSchema,\n product: SegmentDetailSchema.nullable(),\n version: SegmentDetailSchema.nullable(),\n variant: SegmentDetailSchema.nullable(),\n tab: SegmentDetailSchema.nullable()\n});\nexport type ManifestSegment = z.infer<typeof ManifestSegmentSchema>;\n\ntype LedgerSegmentIdentityDetail = {\n id?: string;\n sortOrder?: number;\n metadata: unknown;\n};\n\nexport type LedgerSegmentIdentityInput = {\n section: string;\n sortOrder: number;\n product: LedgerSegmentIdentityDetail | null;\n version: LedgerSegmentIdentityDetail | null;\n variant: LedgerSegmentIdentityDetail | null;\n tab: LedgerSegmentIdentityDetail | null;\n};\n\nfunction detailSlug(metadata: unknown): string | undefined {\n if (metadata == null || typeof metadata !== \"object\" || !(\"slug\" in metadata)) {\n return undefined;\n }\n const slug = metadata.slug;\n return typeof slug === \"string\" ? slug : undefined;\n}\n\nfunction detailIdentity(dimension: string, detail: LedgerSegmentIdentityDetail | null): string {\n if (detail == null) {\n return `${dimension}:none`;\n }\n const slug = detailSlug(detail.metadata);\n if (slug != null && slug !== \"\") {\n return `${dimension}:slug:${slug}`;\n }\n return detail.sortOrder != null\n ? `${dimension}:sort-order:${detail.sortOrder}`\n : `${dimension}:id:${detail.id ?? \"\"}`;\n}\n\nexport function ledgerSegmentIdentity(segment: LedgerSegmentIdentityInput): string {\n return [\n segment.section,\n segment.sortOrder,\n detailIdentity(\"product\", segment.product),\n detailIdentity(\"version\", segment.version),\n detailIdentity(\"variant\", segment.variant),\n detailIdentity(\"tab\", segment.tab)\n ].join(\"|\");\n}\n\nexport function selectLedgerSegmentsForLocale<T extends LedgerSegmentIdentityInput & { locale: string }>(\n segments: T[],\n locale: string,\n defaultLocale: string\n): T[] {\n const byIdentity = new Map<string, T>();\n\n for (const segment of segments) {\n const identity = ledgerSegmentIdentity(segment);\n const existing = byIdentity.get(identity);\n const prefersRequestedLocale = segment.locale === locale && existing?.locale !== locale;\n const prefersDefaultLocale =\n segment.locale === defaultLocale && existing?.locale !== locale && existing?.locale !== defaultLocale;\n if (existing == null || prefersRequestedLocale || prefersDefaultLocale) {\n byIdentity.set(identity, segment);\n }\n }\n return [...byIdentity.values()];\n}\n\n/** A single sidebar entry within a segment. Mirrors the deleted `/nav` route. */\nexport const ManifestNavRouteSchema = LedgerNavRouteSchema;\nexport type ManifestNavRoute = z.infer<typeof ManifestNavRouteSchema>;\n\n/**\n * A routable artifact keyed by fullPath. The adapter reconstructs\n * `/route-context` and `/page-content` from this plus {@link ManifestSegment}.\n */\nconst ManifestRouteBaseSchema = z.object({\n segmentHash: z.string(),\n /** Key into the containing route index's sidebars map. */\n sidebarKey: z.string().nullable(),\n section: z.string(),\n locale: z.string(),\n artifactId: z.string(),\n pageId: z.string().optional(),\n /** CAS hash of the page content blob, or null for link/redirect artifacts. */\n contentHash: z.string().nullable(),\n contentType: z.string().nullable(),\n /** ISO-8601 timestamp of when this artifact's content version was first created.\n * Populated at publish time from `docs_ledger_artifacts.created_at`. Optional\n * for backward compatibility with manifests built before this field existed. */\n createdAt: z.string().optional()\n});\n\nexport const ManifestRouteSchema = z.discriminatedUnion(\"artifactType\", [\n artifactTypeVariant(ManifestRouteBaseSchema, \"markdown\"),\n artifactTypeVariant(ManifestRouteBaseSchema, \"page\"),\n artifactTypeVariant(ManifestRouteBaseSchema, \"rest\"),\n artifactTypeVariant(ManifestRouteBaseSchema, \"asyncapi\"),\n artifactTypeVariant(ManifestRouteBaseSchema, \"webhook\"),\n artifactTypeVariant(ManifestRouteBaseSchema, \"grpc\"),\n artifactTypeVariant(ManifestRouteBaseSchema, \"graphql\"),\n artifactTypeVariant(ManifestRouteBaseSchema, \"graphqlType\"),\n artifactTypeVariant(ManifestRouteBaseSchema, \"changelog\"),\n artifactTypeVariant(ManifestRouteBaseSchema, \"link\"),\n artifactTypeVariant(ManifestRouteBaseSchema, \"file\"),\n artifactTypeVariant(ManifestRouteBaseSchema, \"image\"),\n artifactTypeVariant(ManifestRouteBaseSchema, \"redirect\")\n]);\nexport type ManifestRoute = z.infer<typeof ManifestRouteSchema>;\n\n/** Compile-time proof that the manifest-route union covers every artifact type. */\nconst _manifestRouteUnionIsExhaustive: Equals<ManifestRoute[\"artifactType\"], LedgerArtifactType> = true;\n\n/** Page content reference keyed by the page's stable id (artifact metadata.pageId). */\nexport const ManifestPageSchema = z.object({\n fullPath: z.string().nullable(),\n segmentHash: z.string(),\n contentHash: z.string(),\n contentType: z.string()\n});\nexport type ManifestPage = z.infer<typeof ManifestPageSchema>;\n\n/** A full API definition plus its pre-pruned per-node blobs. */\nexport const ManifestApiDefSchema = z.object({\n /** CAS hash of the full API definition blob. */\n hash: z.string(),\n contentType: z.string(),\n /** key = `${nodeType}:${nodeId}` (e.g. `endpoint:abc`) → pruned CAS blob. */\n prunedHashes: z.record(z.string(), ManifestBlobRefSchema)\n});\nexport type ManifestApiDef = z.infer<typeof ManifestApiDefSchema>;\n\n/**\n * A file/image artifact. File bytes live in the docs files bucket (ADR 0007),\n * NOT CAS — `domain` + `hash` + `fullPath` derive the docs-bucket key (public\n * files resolve to the `/_files` CDN proxy; private files are presigned by the\n * bundle against the private docs bucket).\n */\nexport const ManifestFileSchema = z.object({\n type: z.enum([\"file\", \"image\"]),\n contentType: z.string(),\n contentLength: z.number().optional(),\n filename: z.string(),\n hash: z.string(),\n /** Canonical fern domain the bytes were uploaded under (ADR 0010 file anchor). */\n domain: z.string(),\n bucket: z.enum([\"public_docs\", \"private_docs\"]),\n width: z.number().optional(),\n height: z.number().optional(),\n blurDataURL: z.string().optional()\n});\nexport type ManifestFile = z.infer<typeof ManifestFileSchema>;\n\n/**\n * Lean file/image identity carried inside a route shard (ADR 0016, \"File\n * metadata on the render path\"). The page→file join is materialised into the\n * shard so the bundle resolves an embedded `file:<fullPath>` token from the\n * shard it already fetched (GET 2), never the pointer.\n *\n * Lean by construction: `domain` is omitted (all files share the pointer-level\n * {@link LedgerManifest.fileAnchorDomain}) and `bucket` is omitted unless it\n * diverges from the deployment default (`isPrivate ? private_docs :\n * public_docs`). The read client rebuilds the public `/_files` URL or presigns\n * the private bucket from `{ anchorDomain, hash, fullPath, bucket }`.\n */\nexport const LedgerShardFileSchema = z.object({\n /** SHA-256 hex of the file bytes (docs-bucket key component). */\n hash: z.string(),\n /** Fern-host-relative path; equals the `file:<fullPath>` token's suffix. */\n fullPath: z.string(),\n contentType: z.string(),\n contentLength: z.number().optional(),\n width: z.number().optional(),\n height: z.number().optional(),\n blurDataURL: z.string().optional(),\n /**\n * Per-file bucket override. Absent ⇒ derive from the pointer's `isPrivate`\n * (`private_docs` when private, else `public_docs`). Present only for the\n * rare file whose bucket diverges from the deployment default.\n */\n bucket: z.enum([\"public_docs\", \"private_docs\"]).optional()\n});\nexport type LedgerShardFile = z.infer<typeof LedgerShardFileSchema>;\n\nexport const LedgerSiblingProductSchema = z.object({\n title: z.string(),\n /** Absolute href on the host (`/{basepath}/{slug}/`) or an external URL for product links. */\n href: z.string(),\n subtitle: z.string().optional()\n});\nexport type LedgerSiblingProduct = z.infer<typeof LedgerSiblingProductSchema>;\n\nexport const LedgerSiblingSiteSchema = z.object({\n /** Basepath without leading/trailing slash; \"\" for the root site. */\n basepath: z.string(),\n /** `config.title` of that site as of its last publish; null if unknown. */\n title: z.string().nullable(),\n /** Top-level products of that site as of its last publish; absent for sites published before products were snapshotted. */\n products: z.array(LedgerSiblingProductSchema).optional()\n});\nexport type LedgerSiblingSite = z.infer<typeof LedgerSiblingSiteSchema>;\n\n/**\n * Locale-specific overrides of the site config. Only chrome text that a\n * translation overlay may translate is carried here; everything else is\n * inherited from the base-locale `config`.\n */\nexport const LedgerLocaleConfigOverrideSchema = LedgerConfigSchema.pick({\n announcement: true,\n navbarLinks: true\n});\nexport type LedgerLocaleConfigOverride = z.infer<typeof LedgerLocaleConfigOverrideSchema>;\n\nexport const LedgerConfigBlobSchema = z.object({\n version: z.string().nullable(),\n git: z\n .object({\n repoUrl: z.string(),\n branch: z.string(),\n commitSha: z.string().nullable().optional()\n })\n .optional(),\n /** Structural config with hot-path chrome text inlined for ADR 0016 page reads. */\n config: LedgerConfigSchema.nullable(),\n /** locale → overrides applied on top of `config` for non-default locales. Absent ⇒ every locale reads `config`. */\n localeConfigs: z.record(z.string(), LedgerLocaleConfigOverrideSchema).optional(),\n /** Large or legacy extracted config blobs. New manifests inline header/footer/css.inline/js.inline. */\n configRefs: z.object({\n header: ManifestBlobRefSchema.optional(),\n footer: ManifestBlobRefSchema.optional(),\n cssInline: ManifestBlobRefSchema.optional(),\n jsInline: ManifestBlobRefSchema.optional(),\n jsFiles: ManifestBlobRefSchema.optional()\n })\n});\nexport type LedgerConfigBlob = z.infer<typeof LedgerConfigBlobSchema>;\n\nexport const LedgerChromeBlobSchema = z.object({\n apiNameToId: z.record(z.string(), z.string())\n});\nexport type LedgerChromeBlob = z.infer<typeof LedgerChromeBlobSchema>;\n\nexport const LedgerSidebarBundleSchema = z.object({\n locale: z.string(),\n segmentHash: z.string(),\n routes: z.array(ManifestNavRouteSchema)\n});\nexport type LedgerSidebarBundle = z.infer<typeof LedgerSidebarBundleSchema>;\n\nexport const LedgerSidebarMapEntrySchema = z.discriminatedUnion(\"strategy\", [\n LedgerSidebarBundleSchema.extend({\n strategy: z.literal(\"inline\")\n }),\n ManifestBlobRefSchema.extend({\n strategy: z.literal(\"ref\")\n })\n]);\nexport type LedgerSidebarMapEntry = z.infer<typeof LedgerSidebarMapEntrySchema>;\n\n/**\n * Effective route index for one locale or semantic route partition. Entries\n * already include default-locale fallback for untranslated segments/routes.\n */\nexport const LedgerLocaleIndexSchema = z.object({\n locale: z.string(),\n segments: z.array(ManifestSegmentSchema),\n /** sidebarKey → inline sidebar routes, or a CAS ref when over budget. */\n sidebars: z.record(z.string(), LedgerSidebarMapEntrySchema),\n /** fullPath → route for this effective locale. */\n routes: z.record(z.string(), ManifestRouteSchema),\n /** pageId → page content reference for this effective locale. */\n pages: z.record(z.string(), ManifestPageSchema),\n /** apiDefinitionId → full + pruned API definition blobs. */\n apiDefs: z.record(z.string(), ManifestApiDefSchema),\n /** fullPath → file/image artifact metadata. */\n files: z.record(z.string(), ManifestFileSchema)\n});\nexport type LedgerLocaleIndex = z.infer<typeof LedgerLocaleIndexSchema>;\n\n/**\n * An immutable, scope-packed route shard (ADR 0016 revised, `docsledger/shard/20260601`).\n *\n * Holds the complete `{routes, sidebars}` for one or more whole navigation\n * scopes (`product × version × variant × tab`). A scope is never split across\n * shards, so a page's shard always contains the full set of sidebars its scope\n * references. The S3 key is the raw content hash.\n */\nexport const LedgerRouteShardSchema = z.object({\n schema: z.literal(LEDGER_SHARD_SCHEMA_VERSION),\n locale: z.string(),\n /** fullPath → route for the scopes packed into this shard. */\n routes: z.record(z.string(), ManifestRouteSchema),\n /** segmentHash → inline sidebar (or CAS ref) for every segment in this shard's scopes. */\n sidebars: z.record(z.string(), LedgerSidebarMapEntrySchema),\n /**\n * fileFullPath → lean file identity for every file/image referenced by a\n * page routed into this shard (ADR 0016, \"File metadata on the render\n * path\"). The union of identities for this shard's routes'\n * `referencedFiles`. Optional — absent on shards built before this field\n * existed or with no embedded files; the bundle then falls back to the\n * pointer's `files` map (`fileMetadata`/`fileArtifact`).\n */\n files: z.record(z.string(), LedgerShardFileSchema).optional()\n});\nexport type LedgerRouteShard = z.infer<typeof LedgerRouteShardSchema>;\n\n/**\n * Per-locale pages blob (immutable CAS blob; `pageId → ManifestPage`). Fetched\n * only by search / batch consumers, never on the page-render hot path.\n */\nexport const LedgerPagesBlobSchema = z.record(z.string(), ManifestPageSchema);\nexport type LedgerPagesBlob = z.infer<typeof LedgerPagesBlobSchema>;\n\n/**\n * Compact segment shape used ONLY in the mutable pointer's segments catalog\n * (ADR 0016 revised, Phase 9). Identical to {@link ManifestSegment} except the\n * inlined `product` / `version` SegmentDetail objects are replaced by indices\n * into the per-locale `productCatalog` / `versionCatalog`. A 478-segment site\n * has only ~7 unique products and ~17 unique versions, so inlining them per\n * segment duplicated ~282 KB; the index + catalog form removes that.\n *\n * The read client rehydrates each compact segment back into a full\n * {@link ManifestSegment} (product/version resolved from the catalogs) before\n * any read-method logic runs, so response shapes are unchanged.\n */\nexport const LedgerPointerSegmentSchema = ManifestSegmentSchema.omit({ product: true, version: true }).extend({\n /** Index into the locale's `productCatalog`, or null when the segment has no product. */\n productIdx: z.number().nullable(),\n /** Index into the locale's `versionCatalog`, or null when the segment has no version. */\n versionIdx: z.number().nullable()\n});\nexport type LedgerPointerSegment = z.infer<typeof LedgerPointerSegmentSchema>;\n\n/**\n * Per-locale routing table carried inline in the mutable pointer (ADR 0016\n * revised). Holds the compact segments catalog (product/version deduplicated\n * into `productCatalog` / `versionCatalog`), the explicit `fullPath → shard`\n * routing table, the `segmentHash → shard` map, the shard hash list, the\n * version switcher map, the pages-blob hash, and the global files / apiDefs maps.\n */\nexport const LedgerLocaleRoutingSchema = z.object({\n /** Compact segments catalog for the switcher chrome (product/version by index). */\n segments: z.array(LedgerPointerSegmentSchema),\n /** Deduplicated product details; `LedgerPointerSegment.productIdx` indexes into this. */\n productCatalog: z.array(SegmentDetailSchema),\n /** Deduplicated version details; `LedgerPointerSegment.versionIdx` indexes into this. */\n versionCatalog: z.array(SegmentDetailSchema),\n /** fullPath → index into `shards`. */\n routing: z.record(z.string(), z.number()),\n /** segmentHash → index into `shards`. */\n segmentShard: z.record(z.string(), z.number()),\n /** Ordered list of route shards; index matches `routing`/`segmentShard`. */\n shards: z.array(z.object({ hash: z.string() })),\n /** versionId → first routable fullPath (version switcher). */\n versionFirstRoute: z.record(z.string(), z.string()),\n /** CAS hash of the per-locale pages blob. */\n pagesHash: z.string(),\n /**\n * fullPath → file/image artifact metadata for files NOT materialised into\n * a route shard (ADR 0016, \"File metadata on the render path\"): config\n * files (logo/fonts/OG), well-known files (favicon/robots/context7),\n * API-description-embedded images, and any other non-page-referenced file.\n * Page-body images are pruned from here and live in their route shard's\n * `files` map instead. Read via `fileMetadata` / `fileArtifact`.\n */\n files: z.record(z.string(), ManifestFileSchema),\n /** apiDefinitionId → full + pruned API definition blobs. */\n apiDefs: z.record(z.string(), ManifestApiDefSchema)\n});\nexport type LedgerLocaleRouting = z.infer<typeof LedgerLocaleRoutingSchema>;\n\nexport const LedgerManifestSchema = z.object({\n schema: z.literal(LEDGER_MANIFEST_SCHEMA_VERSION),\n\n // ── Pointer / current-version fields ──────────────────────────────\n orgId: z.string(),\n domain: z.string(),\n basepath: z.string(),\n deploymentId: z.string(),\n deploymentHash: z.string(),\n siteId: z.string(),\n /** ISO-8601 timestamp the publish became live (request time). */\n assignedAt: z.string(),\n assignedBy: z.string().nullable(),\n isPreview: z.boolean(),\n isPrivate: z.boolean(),\n /**\n * Whether Ask AI is enabled for this URL, snapshotted from FAI's settings at\n * publish time so the static build renders Ask AI chrome without asking FAI\n * itself. Absent on pointers written before the field existed (or when the\n * lookup failed); readers then fall back to querying FAI.\n */\n askAiEnabled: z.boolean().optional(),\n /**\n * Every live site on this host (including this one and the root site, if\n * any), snapshotted from the registry at publish time so the fleet site\n * switcher renders without a runtime lookup. Only written for\n * basepath-aware (multi-source) production publishes; absent otherwise.\n * Publish-time snapshot: a newly added sibling appears here after this\n * site's next publish.\n */\n siblingSites: z.array(LedgerSiblingSiteSchema).optional(),\n\n /** Default locale for the deployment — read-path fallback when a translation is absent. */\n defaultLocale: z.string(),\n /**\n * Canonical fern domain all file bytes are anchored under (ADR 0010). The\n * read client builds the public `/_files/{fileAnchorDomain}/{hash}/{fullPath}`\n * URL (or presigns the private bucket) for the lean {@link LedgerShardFile}\n * entries, which omit `domain`. Optional for back-compat with pointers\n * written before shard-side files; absent ⇒ the client falls back to the\n * pointer `files` map (which still carries per-file `domain`).\n */\n fileAnchorDomain: z.string().optional(),\n config: LedgerConfigBlobSchema,\n chrome: LedgerChromeBlobSchema,\n locales: z.record(z.string(), LedgerLocaleRoutingSchema)\n});\nexport type LedgerManifest = z.infer<typeof LedgerManifestSchema>;\n\nexport const LedgerSiteArtifactSchema = z.union([\n z.object({\n schema: z.literal(LEDGER_MANIFEST_SCHEMA_VERSION),\n unpublished: z.literal(true),\n orgId: z.string(),\n domain: z.string(),\n basepath: z.string(),\n isPreview: z.boolean()\n }),\n LedgerManifestSchema\n]);\nexport type LedgerSiteArtifact = z.infer<typeof LedgerSiteArtifactSchema>;\nexport type UnpublishedSiteTombstone = Extract<LedgerSiteArtifact, { unpublished: true }>;\n","/**\n * `JSON.stringify` with deterministic (sorted) key ordering at every level.\n *\n * Arrays are left in their original order (positions are meaningful).\n * Object keys are sorted lexicographically via the replacer hook so two\n * inputs that differ only by insertion order serialize identically.\n * Dates and other `toJSON`-bearing values are handled by the engine —\n * `JSON.stringify` applies `toJSON()` before the replacer, so no special\n * cases are needed here.\n *\n * This is hash-critical for the docs ledger: both the CLI (deployment-hash\n * dedup in `publishDocsLedger`) and FDR (CAS hashing in `stableHash.ts` /\n * `buildLedgerManifest`) must serialize the same value to the same bytes,\n * so the serialization rule lives here in fdr-sdk and is shared by both\n * sides. Do not change this without considering both consumers.\n */\nexport function stableStringify(value: unknown): string {\n return JSON.stringify(value, (_key, val) => {\n if (val != null && typeof val === \"object\" && !Array.isArray(val)) {\n return Object.fromEntries(Object.entries(val).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)));\n }\n return val;\n });\n}\n","/**\n * Deterministic, key-sorted JSON serialization + sha256 helper.\n *\n * Shared utility — the docs-ledger hash and the api-definition content hash\n * both need byte-identical hashes for byte-identical inputs regardless of\n * object key ordering or `Map` iteration order. Centralizing the\n * serialization rule means both hash families stay in lockstep if the rule\n * ever needs to evolve.\n */\nimport { createHash } from \"node:crypto\";\n\nimport { stableStringify } from \"../orpc-client/index.js\";\n\n// The serialization rule itself lives in fdr-sdk so the CLI's deployment-hash\n// dedup and FDR's CAS hashing share one implementation; the node:crypto\n// hashing wrappers stay server-side.\nexport { stableStringify };\n\n/** SHA-256 hex digest of the input string. */\nexport function sha256Hex(input: string): string {\n return createHash(\"sha256\").update(input, \"utf-8\").digest(\"hex\");\n}\n\n/** Convenience: stable JSON + sha256 in one call. */\nexport function stableHash(value: unknown): string {\n return sha256Hex(stableStringify(value));\n}\n","/**\n * Strip exactly one leading `${basePrefix}/` (or a bare `basePrefix`) from\n * `fullPath`, yielding the basepath-RELATIVE remainder.\n *\n * Lives in its own leaf module because both `docsPublishTransform` and\n * `buildLedgerManifest` need it but cannot share a value import with each\n * other (`buildLedgerManifest` already imports `docsPublishTransform`'s\n * types).\n *\n * Write side (`buildLedgerManifest`): every fullPath the transform produces\n * is basepath-rooted, so stripping the first segment is unambiguous — even\n * for the pathological `docs/docs` page (the second segment is the page's\n * own slug). Only `navBySegment` keys are made relative; `routes`, `routing`,\n * `versionFirstRoute`, and `pages` keys stay ABSOLUTE.\n *\n * Transform side (`docsPublishTransform`): normalises a reconstructed\n * link-redirect parent slug before it is re-prefixed with the basepath. Most\n * products yield a basepath-relative parent slug (`astro`), but the root/home\n * product (`slug: /`) has an accumulated V1 slug that already equals the\n * basepath (`docs`) — `extractSlugSegment` cannot strip it, so the product\n * slug leaks the basepath. Normalising here makes the subsequent single\n * prefix idempotent and prevents a `docs/docs/...` key.\n */\nexport function toBasepathRelative(fullPath: string, basePrefix: string): string {\n if (basePrefix === \"\") {\n return fullPath;\n }\n if (fullPath === basePrefix) {\n return \"\";\n }\n const withSlash = `${basePrefix}/`;\n return fullPath.startsWith(withSlash) ? fullPath.slice(withSlash.length) : fullPath;\n}\n","import assertNever from \"@fern-api/ui-core-utils/assertNever\";\nimport type {\n LedgerChromeBlob,\n LedgerConfig,\n LedgerConfigBlob,\n LedgerLocaleConfigOverride,\n LedgerLocaleRouting,\n LedgerManifest,\n LedgerPagesBlob,\n LedgerPointerSegment,\n LedgerRouteShard,\n LedgerShardFile,\n LedgerSiblingSite,\n ManifestApiDef,\n ManifestBlobRef,\n ManifestFile,\n ManifestNavRoute,\n ManifestPage,\n ManifestRoute,\n ManifestSegment,\n PrunedApiDefinitionInput,\n SegmentDetail\n} from \"../orpc-client/index.js\";\nimport {\n collectConfigFilePaths,\n LEDGER_MANIFEST_SCHEMA_VERSION,\n LEDGER_SHARD_SCHEMA_VERSION,\n LedgerLocaleConfigOverrideSchema,\n LedgerSegmentDetailMetadataSchema,\n LedgerSegmentMetadataSchema,\n ledgerSegmentIdentity,\n selectLedgerSegmentsForLocale\n} from \"../orpc-client/index.js\";\nimport type { TransformResult } from \"./docsPublishTransform.js\";\nimport type {\n ArtifactInput,\n InlineTranslationParams,\n PublishParams,\n SegmentDetailInput,\n SegmentInput\n} from \"./inputTypes.js\";\nimport { stableHash, stableStringify } from \"./stableHash.js\";\nimport { toBasepathRelative } from \"./toBasepathRelative.js\";\n\n/**\n * Soft byte target for a single route shard's serialized JSON (ADR 0016). Scopes\n * are bin-packed (first-fit-decreasing) so each shard stays at or under this\n * size; a single scope larger than the target becomes its own oversized shard,\n * still well under the 1 MB per-object budget in practice.\n */\nconst LEDGER_SHARD_TARGET_BYTES = 700 * 1024;\n\n/**\n * Maps a pruned-API artifact's metadata id field to the `nodeType` discriminator\n * used by the read path. The manifest keys pruned blobs by `${nodeType}:${nodeId}`.\n */\nconst PRUNED_NODE_ID_FIELDS: ReadonlyArray<[field: string, nodeType: PrunedApiDefinitionInput[\"nodeType\"]]> = [\n [\"endpointId\", \"endpoint\"],\n [\"webSocketId\", \"webSocket\"],\n [\"webhookId\", \"webhook\"],\n [\"grpcId\", \"grpc\"],\n [\"graphqlOperationId\", \"graphql\"],\n [\"typeId\", \"graphqlType\"]\n];\n\nfunction defaultContentTypeForArtifactType(type: string): string {\n switch (type) {\n case \"markdown\":\n case \"changelog\":\n return \"text/markdown\";\n case \"rest\":\n case \"asyncapi\":\n case \"webhook\":\n case \"grpc\":\n case \"graphql\":\n case \"graphqlType\":\n return \"application/json\";\n default:\n return \"application/octet-stream\";\n }\n}\n\nfunction detailToManifest(detail: SegmentDetailInput | undefined): SegmentDetail | null {\n if (detail == null) {\n return null;\n }\n return {\n id: detail.hash,\n displayName: detail.displayName,\n icon: detail.icon ?? null,\n sortOrder: detail.sortOrder,\n hidden: detail.hidden,\n viewers: detail.viewers,\n orphaned: detail.orphaned,\n featureFlags: detail.featureFlags,\n metadata: LedgerSegmentDetailMetadataSchema.parse(detail.metadata)\n };\n}\n\nfunction metadataField(metadata: unknown, key: string): unknown {\n return metadata != null && typeof metadata === \"object\" && key in metadata\n ? (metadata as Record<string, unknown>)[key]\n : undefined;\n}\n\nfunction addFileIconPath(paths: Set<string>, icon: unknown): void {\n if (typeof icon === \"string\" && icon.startsWith(\"file:\")) {\n const fullPath = icon.slice(\"file:\".length);\n if (fullPath !== \"\") {\n paths.add(fullPath);\n }\n }\n}\n\nfunction addFilePath(paths: Set<string>, filePath: unknown): void {\n if (typeof filePath !== \"string\" || filePath === \"\") {\n return;\n }\n const fullPath = filePath.startsWith(\"file:\") ? filePath.slice(\"file:\".length) : filePath;\n if (fullPath !== \"\") {\n paths.add(fullPath);\n }\n}\n\n/**\n * File paths referenced by navigation chrome must remain in the pointer-level\n * `files` map because ProductSelectChrome/SidebarChrome resolve them via\n * `loader.resolveFiles()` (`fileMetadata`/`fileArtifact`), not via page route\n * shards. If the same asset is also embedded in page MDX, the page-file sharder\n * would otherwise move it into a shard and prune it from the pointer, making the\n * navigation icon/image disappear on the ledger path.\n */\nfunction collectNavigationChromeFilePaths({\n segmentDetails,\n segments,\n artifacts\n}: {\n segmentDetails: SegmentDetailInput[];\n segments: SegmentInput[];\n artifacts: ArtifactInput[];\n}): string[] {\n const paths = new Set<string>();\n\n for (const detail of segmentDetails) {\n addFileIconPath(paths, detail.icon);\n addFilePath(paths, metadataField(detail.metadata, \"image\"));\n }\n\n for (const segment of segments) {\n addFileIconPath(paths, metadataField(segment.metadata, \"icon\"));\n }\n\n for (const artifact of artifacts) {\n addFileIconPath(paths, metadataField(artifact.metadata, \"icon\"));\n }\n\n return [...paths];\n}\n\ntype ManifestRouteArtifactFields = ManifestRoute extends infer Route\n ? Route extends ManifestRoute\n ? Pick<Route, \"artifactType\" | \"artifactMetadata\">\n : never\n : never;\n\nfunction manifestRouteArtifactFields(artifact: ArtifactInput): ManifestRouteArtifactFields {\n switch (artifact.type) {\n case \"markdown\":\n return { artifactType: \"markdown\", artifactMetadata: artifact.metadata };\n case \"page\":\n return { artifactType: \"page\", artifactMetadata: artifact.metadata };\n case \"rest\":\n return { artifactType: \"rest\", artifactMetadata: artifact.metadata };\n case \"asyncapi\":\n return { artifactType: \"asyncapi\", artifactMetadata: artifact.metadata };\n case \"webhook\":\n return { artifactType: \"webhook\", artifactMetadata: artifact.metadata };\n case \"grpc\":\n return { artifactType: \"grpc\", artifactMetadata: artifact.metadata };\n case \"graphql\":\n return { artifactType: \"graphql\", artifactMetadata: artifact.metadata };\n case \"graphqlType\":\n return { artifactType: \"graphqlType\", artifactMetadata: artifact.metadata };\n case \"changelog\":\n return { artifactType: \"changelog\", artifactMetadata: artifact.metadata };\n case \"link\":\n return { artifactType: \"link\", artifactMetadata: artifact.metadata };\n case \"file\":\n return { artifactType: \"file\", artifactMetadata: artifact.metadata };\n case \"image\":\n return { artifactType: \"image\", artifactMetadata: artifact.metadata };\n case \"redirect\":\n return { artifactType: \"redirect\", artifactMetadata: artifact.metadata };\n default:\n return assertNever(artifact);\n }\n}\n\nexport interface BuildLedgerManifestArgs {\n /** Base-locale entities + deployment/site identity (canonical fern URL). */\n params: PublishParams;\n /** Base-locale transform result (carries config + file dimensions). */\n baseResult: TransformResult;\n /** Additional-locale entities, persisted in the same deployment. */\n inlineTranslations: InlineTranslationParams[];\n /**\n * pageId → bare `fullPath`s of the files each page embeds, merged across all\n * locales (ADR 0016, \"File metadata on the render path\"). Used to pack each\n * route shard's `files` identity map and to prune the relocated files from\n * the pointer's global `files` map. Empty ⇒ no shard-side files; the pointer\n * keeps every file (graceful when the publishing CLI predates the field).\n */\n referencedFilesByPageId: Record<string, string[]>;\n deploymentId: string;\n siteId: string;\n deploymentHash: string;\n orgId: string;\n /** Canonical fern domain (the per-URL manifest is written once per URL by the caller). */\n domain: string;\n /**\n * Domain used for file anchoring (S3 keys + manifest `files[].domain`).\n * When set, overrides `params.site.domain` so preview publishes anchor\n * files on the canonical production domain (ADR 0010).\n */\n fileDomain?: string;\n basepath: string;\n isPreview: boolean;\n isPrivate: boolean;\n /** FAI Ask AI enablement for this URL; omitted when it could not be resolved. */\n askAiEnabled?: boolean;\n /** Live sites on this host; only for basepath-aware production publishes. */\n siblingSites?: LedgerSiblingSite[];\n /** ISO-8601 — request time the publish became live. */\n assignedAt: string;\n assignedBy: string | null;\n /** artifact hash → ISO-8601 `created_at` from `docs_ledger_artifacts`. */\n artifactHashToCreatedAt?: Map<string, string>;\n}\n\nexport interface LedgerReadModelBlob {\n hash: string;\n bytes: Buffer;\n contentType: string;\n}\n\nexport interface BuildLedgerReadModelResult {\n pointer: LedgerManifest;\n blobs: LedgerReadModelBlob[];\n}\n\n/**\n * Overlay CAS content `created_at` onto the artifact-keyed `createdAt` map\n * used for manifest route entries (sitemap `<lastmod>`). Artifact hashes are\n * salted with `FDR_VERSION`, so their rows are re-minted on the first publish\n * after every FDR deploy; the unsalted content row survives deploys and\n * reflects when the page bytes first appeared. Content-less artifacts (links,\n * files) keep the artifact row's timestamp.\n */\nexport function overlayContentCreatedAt({\n artifacts,\n artifactHashToCreatedAt,\n contentHashToCreatedAt\n}: {\n artifacts: ReadonlyArray<Pick<ArtifactInput, \"hash\" | \"contentHash\">>;\n artifactHashToCreatedAt: ReadonlyMap<string, string>;\n contentHashToCreatedAt: ReadonlyMap<string, string>;\n}): Map<string, string> {\n const merged = new Map(artifactHashToCreatedAt);\n for (const artifact of artifacts) {\n if (artifact.contentHash == null) {\n continue;\n }\n const contentCreatedAt = contentHashToCreatedAt.get(artifact.contentHash);\n if (contentCreatedAt != null) {\n merged.set(artifact.hash, contentCreatedAt);\n }\n }\n return merged;\n}\n\n/**\n * Assemble the pointer + immutable CAS read model (ADR 0016) from the\n * in-memory transform result the DAO just persisted. No DB read-back: every\n * field comes from `params` / `baseResult` / `inlineTranslations`, and segment /\n * artifact ids are content hashes (the S3-only reader never correlates against\n * postgres).\n *\n * Leaf content (page markdown, API definitions) is referenced by CAS hash only\n * — the bundle fetches those blobs directly. Hot-path chrome text\n * (header/footer/css.inline/js.inline) is re-inlined into the pointer so page\n * renders do not pay extra CAS reads for site chrome.\n */\nexport function buildLedgerReadModel(args: BuildLedgerManifestArgs): BuildLedgerReadModelResult {\n const { params, baseResult, inlineTranslations } = args;\n\n // ── Merge base + translation locales ──────────────────────────────\n const segmentDetails: SegmentDetailInput[] = [\n ...params.segmentDetails,\n ...inlineTranslations.flatMap((t) => t.segmentDetails)\n ];\n const artifacts: ArtifactInput[] = [...params.artifacts, ...inlineTranslations.flatMap((t) => t.artifacts)];\n const segments: SegmentInput[] = [...params.segments, ...inlineTranslations.flatMap((t) => t.segments)];\n const nav = [...params.nav, ...inlineTranslations.flatMap((t) => t.nav)];\n const deploymentSegments = [\n ...params.deploymentSegments,\n ...inlineTranslations.flatMap((t) => t.deploymentSegments)\n ];\n\n const detailByHash = new Map<string, SegmentDetailInput>();\n for (const d of segmentDetails) {\n detailByHash.set(d.hash, d);\n }\n const artifactByHash = new Map<string, ArtifactInput>();\n for (const a of artifacts) {\n artifactByHash.set(a.hash, a);\n }\n const segmentByHash = new Map<string, SegmentInput>();\n for (const s of segments) {\n segmentByHash.set(s.hash, s);\n }\n const sortOrderBySegment = new Map<string, number>();\n for (const ds of deploymentSegments) {\n if (!sortOrderBySegment.has(ds.segmentHash)) {\n sortOrderBySegment.set(ds.segmentHash, ds.sortOrder);\n }\n }\n const contentTypeByHash = new Map<string, string>();\n for (const ref of baseResult.contentRefs.values()) {\n contentTypeByHash.set(ref.hash, ref.contentType);\n }\n const contentType = (hash: string, artifactType: string): string =>\n contentTypeByHash.get(hash) ?? defaultContentTypeForArtifactType(artifactType);\n\n // First nav entry per artifact (used to anchor pageId → fullPath/segment).\n const firstNavByArtifact = new Map<string, (typeof nav)[number]>();\n // Every locale an artifact is reachable from, via the segments navigating to it.\n const localesByArtifact = new Map<string, Set<string>>();\n for (const n of nav) {\n if (!firstNavByArtifact.has(n.artifactHash)) {\n firstNavByArtifact.set(n.artifactHash, n);\n }\n const navLocale = segmentByHash.get(n.segmentHash)?.locale;\n if (navLocale != null) {\n const artifactLocales = localesByArtifact.get(n.artifactHash) ?? new Set<string>();\n artifactLocales.add(navLocale);\n localesByArtifact.set(n.artifactHash, artifactLocales);\n }\n }\n\n // ── segments ──────────────────────────────────────────────────────\n const manifestSegments: ManifestSegment[] = segments.map((seg) => ({\n segmentId: seg.hash,\n segmentHash: seg.hash,\n section: seg.section,\n locale: seg.locale,\n sortOrder: sortOrderBySegment.get(seg.hash) ?? 0,\n hidden: seg.hidden,\n metadata: LedgerSegmentMetadataSchema.parse(seg.metadata),\n product: detailToManifest(seg.productHash != null ? detailByHash.get(seg.productHash) : undefined),\n version: detailToManifest(seg.versionHash != null ? detailByHash.get(seg.versionHash) : undefined),\n variant: detailToManifest(seg.variantHash != null ? detailByHash.get(seg.variantHash) : undefined),\n tab: detailToManifest(seg.tabHash != null ? detailByHash.get(seg.tabHash) : undefined)\n }));\n\n // ── nav (sidebar trees) + routes (routable artifacts) ─────────────\n // Cleaned deployment basepath (no leading/trailing slashes). Sidebar\n // `fullPath`s are stored basepath-RELATIVE so the read-side nav builder\n // re-prefixes them exactly once; see {@link toBasepathRelative}.\n const basePrefix = args.basepath.replace(/^\\/+|\\/+$/g, \"\");\n const navBySegment: Record<string, ManifestNavRoute[]> = {};\n // locale → fullPath → route.\n const routesByLocale: Record<string, Record<string, ManifestRoute>> = {};\n const pagesByLocale: Record<string, Record<string, ManifestPage>> = {};\n\n // Sidebar order is per (segment) by displaySortOrder; build a sortable list first.\n const sidebarEntries = nav\n .filter((n) => n.displaySortOrder != null)\n .sort((a, b) => (a.displaySortOrder ?? 0) - (b.displaySortOrder ?? 0));\n for (const n of sidebarEntries) {\n const artifact = artifactByHash.get(n.artifactHash);\n if (artifact == null) {\n continue;\n }\n const { hash: artifactId, contentHash: _contentHash, fileKey: _fileKey, ...artifactRouteFields } = artifact;\n (navBySegment[n.segmentHash] ??= []).push({\n ...artifactRouteFields,\n // Basepath-relative: the read-side builder re-joins the basepath.\n // Keeping it absolute here double-prefixes content node slugs on\n // non-empty-basepath sites (→ every page resolves to notFound).\n fullPath: n.fullPath != null ? toBasepathRelative(n.fullPath, basePrefix) : null,\n artifactId,\n // Preserve the absolute sidebar position so the read-side nav builder\n // can interleave leaf pages (displaySortOrder) with subsections\n // (childIndex) in the same coordinate space. Without this the reader\n // falls back to compacted array indices and misorders mixed levels.\n displaySortOrder: n.displaySortOrder\n });\n }\n\n // Track fullPaths already claimed by a canonical (sidebar) nav entry so\n // that cross-segment collisions (e.g. a section overview and its child\n // apiReference overview sharing the same slug via skipUrlSlug) are resolved\n // in favour of the first canonical entry — the parent section's artifact.\n const canonicalRoutes: Record<string, Set<string>> = {};\n\n for (const n of nav) {\n if (n.fullPath == null) {\n continue;\n }\n const artifact = artifactByHash.get(n.artifactHash);\n const segment = segmentByHash.get(n.segmentHash);\n if (artifact == null || segment == null) {\n continue;\n }\n const routesForLocale = (routesByLocale[segment.locale] ??= {});\n const canonicalForLocale = (canonicalRoutes[segment.locale] ??= new Set());\n if (routesForLocale[n.fullPath] != null) {\n // Route-only alias never overwrites an existing entry.\n if (n.displaySortOrder == null) {\n continue;\n }\n // First canonical entry wins — later canonical entries from sibling\n // segments must not overwrite (prevents content resolution picking\n // the wrong overview artifact when two segments share a fullPath).\n if (canonicalForLocale.has(n.fullPath)) {\n continue;\n }\n }\n if (n.displaySortOrder != null) {\n canonicalForLocale.add(n.fullPath);\n }\n const createdAt = args.artifactHashToCreatedAt?.get(n.artifactHash);\n routesForLocale[n.fullPath] = {\n segmentHash: n.segmentHash,\n sidebarKey: n.segmentHash,\n section: segment.section,\n locale: segment.locale,\n artifactId: n.artifactHash,\n pageId: typeof artifact.metadata?.pageId === \"string\" ? artifact.metadata.pageId : undefined,\n ...manifestRouteArtifactFields(artifact),\n contentHash: artifact.contentHash,\n contentType: artifact.contentHash != null ? contentType(artifact.contentHash, artifact.type) : null,\n ...(createdAt != null ? { createdAt } : {})\n };\n }\n\n // ── pages (pageId → content) ──────────────────────────────────────\n for (const artifact of artifactByHash.values()) {\n const pageId = artifact.metadata?.pageId;\n if (typeof pageId !== \"string\" || artifact.contentHash == null) {\n continue;\n }\n const anchorNav = firstNavByArtifact.get(artifact.hash);\n const anchorSegment = anchorNav != null ? segmentByHash.get(anchorNav.segmentHash) : undefined;\n const pageLocale = anchorSegment?.locale ?? params.deployment.defaultLocale ?? \"en\";\n const pages = (pagesByLocale[pageLocale] ??= {});\n pages[pageId] = {\n fullPath: anchorNav?.fullPath ?? null,\n segmentHash: anchorNav?.segmentHash ?? \"\",\n contentHash: artifact.contentHash,\n contentType: contentType(artifact.contentHash, artifact.type)\n };\n }\n\n const defaultLocale = params.deployment.defaultLocale ?? params.segments[0]?.locale ?? \"en\";\n\n // ── API definitions (full + pruned) ───────────────────────────────\n // Full-definition hashes are locale-independent; pruned blobs are NOT. A\n // translated locale's pruned artifacts carry the SAME apiDefinitionId and\n // node ids as the base locale's, so they must be bucketed by the locale of\n // the segment they are navigated from — a single shared map lets one\n // locale's content overwrite every other locale's.\n const apiDefs: Record<string, ManifestApiDef> = {};\n const apiNameToId: Record<string, string> = {};\n for (const def of params.apiDefinitions) {\n apiDefs[def.apiDefinitionId] = {\n hash: def.contentHash,\n contentType: \"application/json\",\n prunedHashes: {}\n };\n if (def.apiName != null) {\n apiNameToId[def.apiName] = def.apiDefinitionId;\n }\n }\n // locale → apiDefinitionId → `${nodeType}:${nodeId}` → pruned CAS blob.\n const prunedHashesByLocale: Record<string, Record<string, Record<string, ManifestBlobRef>>> = {};\n for (const artifact of artifactByHash.values()) {\n const apiDefinitionId = artifact.metadata?.apiDefinitionId;\n if (typeof apiDefinitionId !== \"string\" || artifact.contentHash == null) {\n continue;\n }\n const match = PRUNED_NODE_ID_FIELDS.map(([field, nodeType]) => {\n const nodeId = artifact.metadata?.[field];\n return typeof nodeId === \"string\" ? { nodeType, nodeId } : undefined;\n }).find((m) => m != null);\n if (match == null) {\n continue;\n }\n const ref: ManifestBlobRef = {\n hash: artifact.contentHash,\n contentType: contentType(artifact.contentHash, artifact.type)\n };\n // An identical artifact can be navigated from several locales (an\n // untranslated endpoint dedupes to one content hash), so register it\n // under every locale that reaches it rather than just the first.\n for (const artifactLocale of localesByArtifact.get(artifact.hash) ?? [defaultLocale]) {\n const forLocale = (prunedHashesByLocale[artifactLocale] ??= {});\n const forApi = (forLocale[apiDefinitionId] ??= {});\n forApi[`${match.nodeType}:${match.nodeId}`] = ref;\n }\n }\n\n // ── files (docs-bucket file/image artifacts) ──────────────────────\n const bucketByFullPath = new Map<string, \"public_docs\" | \"private_docs\">();\n for (const f of [...params.files, ...inlineTranslations.flatMap((t) => t.files)]) {\n if (!bucketByFullPath.has(f.fullPath)) {\n bucketByFullPath.set(f.fullPath, f.bucket);\n }\n }\n const files: Record<string, ManifestFile> = {};\n const defaultBucket: \"public_docs\" | \"private_docs\" = args.isPrivate ? \"private_docs\" : \"public_docs\";\n // File bytes are anchored on the canonical fern domain regardless of which\n // URL this manifest is served at (ADR 0010), so files.domain is always the\n // canonical site domain, not the per-URL pointer domain.\n const fileDomain = args.fileDomain ?? params.site.domain;\n for (const fe of baseResult.fileEntries) {\n const isImage = fe.width != null && fe.height != null;\n files[fe.fullPath] = {\n type: isImage ? \"image\" : \"file\",\n contentType: fe.contentType,\n contentLength: fe.contentLength,\n filename: fe.filename,\n hash: fe.hash,\n domain: fileDomain,\n bucket: bucketByFullPath.get(fe.fullPath) ?? defaultBucket,\n ...(fe.width != null ? { width: fe.width } : {}),\n ...(fe.height != null ? { height: fe.height } : {}),\n ...(fe.blurDataURL != null ? { blurDataURL: fe.blurDataURL } : {})\n };\n }\n // Translation-only files carry no dimensions; record them as plain files.\n for (const t of inlineTranslations) {\n for (const f of t.files) {\n if (files[f.fullPath] != null) {\n continue;\n }\n files[f.fullPath] = {\n type: \"file\",\n contentType: f.contentType,\n filename: f.fullPath.split(\"/\").pop() ?? f.fullPath,\n hash: f.hash,\n domain: fileDomain,\n bucket: f.bucket\n };\n }\n }\n\n const locales = new Set<string>([defaultLocale]);\n for (const seg of manifestSegments) {\n locales.add(seg.locale);\n }\n for (const locale of Object.keys(routesByLocale)) {\n locales.add(locale);\n }\n for (const locale of Object.keys(pagesByLocale)) {\n locales.add(locale);\n }\n\n const segmentsForLocale = (locale: string): ManifestSegment[] =>\n selectLedgerSegmentsForLocale(manifestSegments, locale, defaultLocale).sort(\n (a, b) => a.sortOrder - b.sortOrder\n );\n\n const effectiveRoutesForLocale = (locale: string, segmentsForEffectiveLocale: ManifestSegment[]) => {\n // Collect the identities of the effective segments, then allow ANY\n // segment hash that shares one of those identities. This ensures\n // default-locale routes (e.g. landing pages) whose segment was\n // shadowed by a locale-specific segment with the same identity are\n // still included. When a fallback route points at the shadowed segment\n // hash, rewrite it to the effective segment hash so routeContext can\n // recover the translated product/version/tab chrome from the compact\n // pointer's deduped segment list.\n const effectiveSegmentByIdentity = new Map(\n segmentsForEffectiveLocale.map((segment) => [ledgerSegmentIdentity(segment), segment])\n );\n const effectiveSegmentHashBySegmentHash = new Map<string, string>();\n for (const seg of manifestSegments) {\n const effective = effectiveSegmentByIdentity.get(ledgerSegmentIdentity(seg));\n if (effective != null) {\n effectiveSegmentHashBySegmentHash.set(seg.segmentHash, effective.segmentHash);\n }\n }\n const addRoute = (path: string, route: ManifestRoute, out: Record<string, ManifestRoute>) => {\n const effectiveSegmentHash = effectiveSegmentHashBySegmentHash.get(route.segmentHash);\n if (effectiveSegmentHash != null) {\n out[path] =\n effectiveSegmentHash === route.segmentHash\n ? route\n : {\n ...route,\n segmentHash: effectiveSegmentHash,\n sidebarKey: effectiveSegmentHash\n };\n }\n };\n const routes: Record<string, ManifestRoute> = {};\n const fallbackRoutes = routesByLocale[defaultLocale] ?? {};\n for (const [path, route] of Object.entries(fallbackRoutes)) {\n addRoute(path, route, routes);\n }\n const requestedRoutes = routesByLocale[locale] ?? {};\n for (const [path, route] of Object.entries(requestedRoutes)) {\n addRoute(path, route, routes);\n }\n return routes;\n };\n\n /**\n * API defs for one locale: locale-independent full hashes, plus pruned\n * blobs from this locale layered over the default locale's (so endpoints\n * with no translated artifact still resolve to the base content).\n */\n const apiDefsForLocale = (locale: string): Record<string, ManifestApiDef> => {\n const fallbackPruned = prunedHashesByLocale[defaultLocale] ?? {};\n const localePruned = prunedHashesByLocale[locale] ?? {};\n const apiDefinitionIds = new Set([\n ...Object.keys(apiDefs),\n ...Object.keys(fallbackPruned),\n ...Object.keys(localePruned)\n ]);\n const result: Record<string, ManifestApiDef> = {};\n for (const apiDefinitionId of apiDefinitionIds) {\n const base = apiDefs[apiDefinitionId];\n result[apiDefinitionId] = {\n ...base,\n hash: base?.hash ?? \"\",\n contentType: base?.contentType ?? \"application/json\",\n prunedHashes: {\n ...(fallbackPruned[apiDefinitionId] ?? {}),\n ...(localePruned[apiDefinitionId] ?? {})\n }\n };\n }\n return result;\n };\n\n const effectivePagesForLocale = (locale: string) => ({\n ...(pagesByLocale[defaultLocale] ?? {}),\n ...(pagesByLocale[locale] ?? {})\n });\n\n const jsonBlob = (value: unknown): LedgerReadModelBlob => {\n const bytes = Buffer.from(stableStringify(value), \"utf-8\");\n return {\n hash: stableHash(value),\n bytes,\n contentType: \"application/json\"\n };\n };\n\n const generatedText = (hash: string | undefined): string | undefined => {\n if (hash == null) {\n return undefined;\n }\n return baseResult.generatedBlobs.get(hash)?.bytes.toString(\"utf-8\");\n };\n\n const header = generatedText(baseResult.headerHash);\n const footer = generatedText(baseResult.footerHash);\n const cssInline = generatedText(baseResult.cssInlineHash);\n const jsInline = generatedText(baseResult.jsInlineHash);\n\n const configJson = (baseResult.configJson as LedgerConfig | null | undefined) ?? null;\n const configWithInlineChrome =\n configJson == null ? null : (structuredClone(configJson) as LedgerConfig & Record<string, unknown>);\n if (configWithInlineChrome != null) {\n const configRecord = configWithInlineChrome as Record<string, unknown>;\n if (header != null) {\n configRecord.header = header;\n }\n if (footer != null) {\n configRecord.footer = footer;\n }\n if (cssInline != null) {\n const css = (configRecord.css as Record<string, unknown> | undefined) ?? {};\n configRecord.css = { ...css, inline: cssInline.split(\"\\n\") };\n }\n if (jsInline != null) {\n const js = (configRecord.js as Record<string, unknown> | undefined) ?? {};\n configRecord.js = { ...js, inline: jsInline.split(\"\\n\") };\n }\n }\n\n const localeConfigs = buildLocaleConfigOverrides(configJson, inlineTranslations);\n\n const config = {\n version: baseResult.version ?? null,\n ...(baseResult.git != null\n ? {\n git: {\n repoUrl: baseResult.git.repoUrl,\n branch: baseResult.git.branch,\n ...(baseResult.git.commitSha != null ? { commitSha: baseResult.git.commitSha } : {})\n }\n }\n : {}),\n config: configWithInlineChrome,\n ...(localeConfigs != null ? { localeConfigs } : {}),\n configRefs: {\n ...(baseResult.headerHash != null && header == null\n ? {\n header: {\n hash: baseResult.headerHash,\n contentType: \"text/markdown\"\n }\n }\n : {}),\n ...(baseResult.footerHash != null && footer == null\n ? {\n footer: {\n hash: baseResult.footerHash,\n contentType: \"text/markdown\"\n }\n }\n : {}),\n ...(baseResult.cssInlineHash != null && cssInline == null\n ? {\n cssInline: {\n hash: baseResult.cssInlineHash,\n contentType: \"text/css\"\n }\n }\n : {}),\n ...(baseResult.jsInlineHash != null && jsInline == null\n ? {\n jsInline: {\n hash: baseResult.jsInlineHash,\n contentType: \"text/javascript\"\n }\n }\n : {}),\n ...(baseResult.jsFilesHash != null\n ? {\n jsFiles: {\n hash: baseResult.jsFilesHash,\n contentType: \"application/javascript\"\n }\n }\n : {})\n }\n } satisfies LedgerConfigBlob;\n const chrome = { apiNameToId } satisfies LedgerChromeBlob;\n const blobs = new Map<string, LedgerReadModelBlob>();\n\n /** Serialized byte size of a value under the same (stable) rule used to hash it. */\n const byteSize = (value: unknown): number => Buffer.byteLength(stableStringify(value), \"utf-8\");\n\n /** Scope key for a segment: identifies its (product, version, variant, tab) navigation scope. */\n const scopeKeyForSegment = (seg: ManifestSegment): string =>\n `${seg.product?.id ?? \"\"}|${seg.version?.id ?? \"\"}|${seg.variant?.id ?? \"\"}|${seg.tab?.id ?? \"\"}`;\n\n type ShardPayload = {\n routes: Record<string, ManifestRoute>;\n sidebars: LedgerRouteShard[\"sidebars\"];\n };\n\n // ── File materialization into shards (ADR 0016) ───────────────────\n // Files referenced by config (logo/fonts/OG) and navigation chrome\n // (product images, file:-prefixed product/sidebar icons) are resolved by\n // the bundle via the pointer's `files` map (`fileMetadata`/`fileArtifact`),\n // so they are NEVER moved into a shard and NEVER pruned from the pointer.\n // Everything else a page embeds is materialized into that page's route\n // shard and dropped from the pointer.\n const pointerResolvedFilePaths = new Set([\n ...collectConfigFilePaths((baseResult.configJson ?? {}) as Record<string, unknown>),\n ...collectNavigationChromeFilePaths({ segmentDetails, segments, artifacts })\n ]);\n const referencedFilesByPageId = args.referencedFilesByPageId ?? {};\n /** Project a full ManifestFile identity into a lean shard entry (drops domain; bucket only when it diverges). */\n const toShardFile = (fullPath: string, mf: ManifestFile): LedgerShardFile => ({\n hash: mf.hash,\n fullPath,\n contentType: mf.contentType,\n ...(mf.contentLength != null ? { contentLength: mf.contentLength } : {}),\n ...(mf.width != null ? { width: mf.width } : {}),\n ...(mf.height != null ? { height: mf.height } : {}),\n ...(mf.blurDataURL != null ? { blurDataURL: mf.blurDataURL } : {}),\n ...(mf.bucket !== defaultBucket ? { bucket: mf.bucket } : {})\n });\n const pageIdOfRoute = (route: ManifestRoute): string | undefined => {\n const meta = route.artifactMetadata as { pageId?: unknown } | null | undefined;\n return typeof meta?.pageId === \"string\" ? meta.pageId : undefined;\n };\n\n const pointerLocales: LedgerManifest[\"locales\"] = {};\n for (const locale of [...locales].sort()) {\n const effectiveSegments = segmentsForLocale(locale);\n const effectiveRoutes = effectiveRoutesForLocale(locale, effectiveSegments);\n const effectivePages = effectivePagesForLocale(locale);\n\n // segmentHash → scopeKey, for every segment in this effective locale.\n const scopeKeyBySegment = new Map<string, string>();\n // scopeKey → segments belonging to that scope (every segment lands in exactly one).\n const segmentsByScope = new Map<string, ManifestSegment[]>();\n for (const seg of effectiveSegments) {\n const key = scopeKeyForSegment(seg);\n scopeKeyBySegment.set(seg.segmentHash, key);\n (segmentsByScope.get(key) ?? segmentsByScope.set(key, []).get(key)!).push(seg);\n }\n\n // scopeKey → routes whose route.segmentHash belongs to a segment in that scope.\n const routesByScope = new Map<string, Record<string, ManifestRoute>>();\n for (const [fullPath, route] of Object.entries(effectiveRoutes)) {\n const key = scopeKeyBySegment.get(route.segmentHash);\n if (key == null) {\n // Route references a segment outside this effective locale — skip.\n continue;\n }\n (routesByScope.get(key) ?? routesByScope.set(key, {}).get(key)!)[fullPath] = route;\n }\n\n // Build a self-contained payload per scope: its routes plus a sidebar for\n // EVERY segment in the scope (even route-less segments, so folder/section\n // sidebars travel with the scope).\n type Scope = { key: string; payload: ShardPayload; size: number };\n const scopes: Scope[] = [];\n for (const [key, segs] of segmentsByScope) {\n const routes = routesByScope.get(key) ?? {};\n const sidebars: LedgerRouteShard[\"sidebars\"] = {};\n for (const seg of segs) {\n sidebars[seg.segmentHash] = {\n strategy: \"inline\",\n locale: seg.locale,\n segmentHash: seg.segmentHash,\n routes: navBySegment[seg.segmentHash] ?? []\n };\n }\n const payload: ShardPayload = { routes, sidebars };\n scopes.push({ key, payload, size: byteSize(payload) });\n }\n\n // First-fit-decreasing bin packing: sort scopes largest-first and place\n // each into the first existing shard it still fits in (measuring the merged\n // serialized {schema, locale, routes, sidebars}); else open a new shard. A\n // single scope over the target becomes its own (oversized but sub-1-MB) shard.\n scopes.sort((a, b) => b.size - a.size);\n const shardPayloads: ShardPayload[] = [];\n // scopeKey → shard index, used to populate routing/segmentShard.\n const shardIndexByScope = new Map<string, number>();\n for (const scope of scopes) {\n let placed = false;\n for (let i = 0; i < shardPayloads.length; i++) {\n const merged: ShardPayload = {\n routes: { ...shardPayloads[i]!.routes, ...scope.payload.routes },\n sidebars: {\n ...shardPayloads[i]!.sidebars,\n ...scope.payload.sidebars\n }\n };\n if (\n byteSize({\n schema: LEDGER_SHARD_SCHEMA_VERSION,\n locale,\n ...merged\n }) <= LEDGER_SHARD_TARGET_BYTES\n ) {\n shardPayloads[i] = merged;\n shardIndexByScope.set(scope.key, i);\n placed = true;\n break;\n }\n }\n if (!placed) {\n // New shard (a scope larger than the target lands here alone).\n shardPayloads.push({\n routes: { ...scope.payload.routes },\n sidebars: { ...scope.payload.sidebars }\n });\n shardIndexByScope.set(scope.key, shardPayloads.length - 1);\n }\n }\n\n // Emit each shard as a CAS blob; record its hash. Materialize the\n // page→file join: each shard carries the lean identities of every\n // (non-config) file its routes embed, resolved from the global `files`\n // map. Paths placed into a shard are pruned from the pointer below.\n const shards: LedgerLocaleRouting[\"shards\"] = [];\n const localeShardedFilePaths = new Set<string>();\n for (const payload of shardPayloads) {\n const shardFiles: Record<string, LedgerShardFile> = {};\n for (const route of Object.values(payload.routes)) {\n const pageId = pageIdOfRoute(route);\n if (pageId == null) {\n continue;\n }\n for (const fileFullPath of referencedFilesByPageId[pageId] ?? []) {\n if (pointerResolvedFilePaths.has(fileFullPath) || shardFiles[fileFullPath] != null) {\n continue;\n }\n const mf = files[fileFullPath];\n if (mf == null) {\n continue;\n }\n shardFiles[fileFullPath] = toShardFile(fileFullPath, mf);\n localeShardedFilePaths.add(fileFullPath);\n }\n }\n const shardBlob = jsonBlob({\n schema: LEDGER_SHARD_SCHEMA_VERSION,\n locale,\n routes: payload.routes,\n sidebars: payload.sidebars,\n // Omit when empty so file-less shards hash identically to before.\n ...(Object.keys(shardFiles).length > 0 ? { files: shardFiles } : {})\n } satisfies LedgerRouteShard);\n blobs.set(shardBlob.hash, shardBlob);\n shards.push({ hash: shardBlob.hash });\n }\n\n // Prune the pointer's per-locale `files` map: drop every file that was\n // relocated into a shard. Config / well-known / API-description /\n // orphan files are not page-referenced (or are config-excluded), so\n // they never land in `localeShardedFilePaths` and survive here.\n const prunedFiles: Record<string, ManifestFile> =\n localeShardedFilePaths.size === 0\n ? files\n : Object.fromEntries(Object.entries(files).filter(([fp]) => !localeShardedFilePaths.has(fp)));\n\n // routing: fullPath → shard index (via its scope). segmentShard: segmentHash → shard index.\n const routing: LedgerLocaleRouting[\"routing\"] = {};\n for (const [fullPath, route] of Object.entries(effectiveRoutes)) {\n const key = scopeKeyBySegment.get(route.segmentHash);\n const idx = key != null ? shardIndexByScope.get(key) : undefined;\n if (idx != null) {\n routing[fullPath] = idx;\n }\n }\n const segmentShard: LedgerLocaleRouting[\"segmentShard\"] = {};\n for (const seg of effectiveSegments) {\n const idx = shardIndexByScope.get(scopeKeyForSegment(seg));\n if (idx != null) {\n segmentShard[seg.segmentHash] = idx;\n }\n }\n\n // versionFirstRoute: versionId → first routable fullPath (insertion order).\n const versionFirstRoute: LedgerLocaleRouting[\"versionFirstRoute\"] = {};\n const segmentForHash = new Map(effectiveSegments.map((s) => [s.segmentHash, s]));\n for (const [fullPath, route] of Object.entries(effectiveRoutes)) {\n const vid = segmentForHash.get(route.segmentHash)?.version?.id;\n if (vid != null && versionFirstRoute[vid] == null) {\n versionFirstRoute[vid] = fullPath;\n }\n }\n\n // Pages blob (pageId → ManifestPage) — off the hot path; search/batch only.\n const pagesBlob = jsonBlob(effectivePages satisfies LedgerPagesBlob);\n blobs.set(pagesBlob.hash, pagesBlob);\n\n // Deduplicate product/version SegmentDetails. A site with hundreds of\n // segments has only a handful of distinct products/versions; inlining\n // them per segment duplicated ~282 KB on `astronomer`. Catalog them once\n // and reference by index from each compact pointer-segment. Dedup by id\n // (product/version SegmentDetail always carry a stable id).\n const productCatalog: SegmentDetail[] = [];\n const versionCatalog: SegmentDetail[] = [];\n const productIdxById = new Map<string, number>();\n const versionIdxById = new Map<string, number>();\n const catalogIndex = (\n detail: SegmentDetail | null,\n catalog: SegmentDetail[],\n idxById: Map<string, number>\n ): number | null => {\n if (detail == null) {\n return null;\n }\n const existing = idxById.get(detail.id);\n if (existing != null) {\n return existing;\n }\n const idx = catalog.length;\n catalog.push(detail);\n idxById.set(detail.id, idx);\n return idx;\n };\n const compactSegments: LedgerPointerSegment[] = effectiveSegments.map((seg) => ({\n segmentId: seg.segmentId,\n segmentHash: seg.segmentHash,\n section: seg.section,\n locale: seg.locale,\n sortOrder: seg.sortOrder,\n hidden: seg.hidden,\n metadata: seg.metadata,\n productIdx: catalogIndex(seg.product, productCatalog, productIdxById),\n versionIdx: catalogIndex(seg.version, versionCatalog, versionIdxById),\n variant: seg.variant,\n tab: seg.tab\n }));\n\n pointerLocales[locale] = {\n segments: compactSegments,\n productCatalog,\n versionCatalog,\n routing,\n segmentShard,\n shards,\n versionFirstRoute,\n pagesHash: pagesBlob.hash,\n files: prunedFiles,\n apiDefs: apiDefsForLocale(locale)\n } satisfies LedgerLocaleRouting;\n }\n\n return {\n pointer: {\n schema: LEDGER_MANIFEST_SCHEMA_VERSION,\n orgId: args.orgId,\n domain: args.domain,\n basepath: args.basepath,\n deploymentId: args.deploymentId,\n deploymentHash: args.deploymentHash,\n siteId: args.siteId,\n assignedAt: args.assignedAt,\n assignedBy: args.assignedBy,\n isPreview: args.isPreview,\n isPrivate: args.isPrivate,\n askAiEnabled: args.askAiEnabled,\n ...(args.siblingSites != null ? { siblingSites: args.siblingSites } : {}),\n defaultLocale,\n // All file bytes are anchored on the canonical fern domain (ADR\n // 0010); the lean shard file entries omit `domain` and the read\n // client rebuilds URLs from this.\n fileAnchorDomain: fileDomain,\n config,\n chrome,\n locales: pointerLocales\n },\n blobs: [...blobs.values()]\n };\n}\n\nconst LOCALE_CONFIG_OVERRIDE_KEYS = [\"announcement\", \"navbarLinks\"] as const satisfies ReadonlyArray<\n keyof LedgerLocaleConfigOverride\n>;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value != null && !Array.isArray(value);\n}\n\n/**\n * Diff each translation's config against the base-locale config and keep only\n * the overlay-translatable chrome fields that actually differ. Returns\n * `undefined` when no locale diverges so pointers for untranslated sites are\n * byte-identical to before.\n */\nfunction buildLocaleConfigOverrides(\n baseConfig: LedgerConfig | null,\n inlineTranslations: InlineTranslationParams[]\n): Record<string, LedgerLocaleConfigOverride> | undefined {\n const base: Record<string, unknown> = isRecord(baseConfig) ? baseConfig : {};\n const overrides: Record<string, LedgerLocaleConfigOverride> = {};\n for (const translation of inlineTranslations) {\n if (!isRecord(translation.configJson)) {\n continue;\n }\n const translated = translation.configJson;\n const override: Record<string, unknown> = {};\n for (const key of LOCALE_CONFIG_OVERRIDE_KEYS) {\n const value = translated[key];\n if (value == null || stableStringify(value) === stableStringify(base[key])) {\n continue;\n }\n override[key] = value;\n }\n if (Object.keys(override).length > 0) {\n overrides[translation.locale] = LedgerLocaleConfigOverrideSchema.parse(override);\n }\n }\n return Object.keys(overrides).length > 0 ? overrides : undefined;\n}\n\nexport function buildLedgerManifest(args: BuildLedgerManifestArgs): LedgerManifest {\n return buildLedgerReadModel(args).pointer;\n}\n","/**\n * Deterministic hash computation for docs-ledger entities.\n *\n * Server-internal — these functions are NOT shared with the client.\n * The server is the sole authority for structural hash computation.\n *\n * All hashes use SHA-256 over {@link stableStringify}, which produces\n * deterministic JSON by sorting object keys during serialization.\n * `JSON.stringify`'s replacer runs after `toJSON()`, so Dates and custom\n * serializers are handled by the engine — no special cases needed.\n */\nimport type { DocsPublishInput, LedgerSegmentDetailMetadata, LedgerSegmentMetadata } from \"../orpc-client/index.js\";\n\nimport { sha256Hex, stableStringify } from \"./stableHash.js\";\n\nexport { stableStringify } from \"./stableHash.js\";\n\n// ─── Helpers ─────────────────────────────────────────────────────────────\n\nfunction computeHash(parts: unknown[]): string {\n return sha256Hex(stableStringify(parts));\n}\n\n// ─── FDR version salt ───────────────────────────────────────────────────\n\n/**\n * The FDR release version, injected as an env var by the CDK deploy stack.\n * Included in deployment, segment, and artifact hashes so that every FDR\n * deploy invalidates cached structural rows — even when the publish input\n * is byte-identical.\n *\n * Falls back to \"local\" for local development (where no env var is set),\n * ensuring hashes are still deterministic within a single server instance.\n */\nexport const FDR_VERSION: string = process.env.FDR_VERSION ?? \"local\";\n\n/**\n * Compute the deployment hash directly from the publish input.\n *\n * Since the server-side transform is deterministic, identical inputs always\n * produce identical deployments. This lets us:\n * - Return a real deployment hash from register (before the transform runs)\n * - Short-circuit finish when the deployment hash matches the current one\n *\n * The hash covers everything that affects the deployment's content:\n * nav tree, page content hashes, API manifest hash, global blob hashes, locale,\n * and the {@link FDR_VERSION} salt.\n */\nexport function hashDeploymentInput(input: DocsPublishInput): string {\n // Hash each locale entry deterministically, sorted by locale for stability.\n const localeHashes = [...input.locales]\n .sort((a, b) => (a.locale < b.locale ? -1 : a.locale > b.locale ? 1 : 0))\n .map((locale) => hashLocaleEntry(locale, input.domain));\n\n return computeHash([FDR_VERSION, input.defaultLocale, localeHashes]);\n}\n\nfunction hashLocaleEntry(locale: DocsPublishInput[\"locales\"][number], domain: string): unknown[] {\n const pageEntries = Object.entries(locale.pages)\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n .map(([pageId, ref]) => [pageId, ref.hash]);\n\n const fileManifestEntries = locale.fileManifest\n ? Object.entries(locale.fileManifest)\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n .map(([fullPath, entry]) => [\n fullPath,\n domain,\n entry.hash,\n entry.contentType,\n entry.filename,\n entry.width ?? null,\n entry.height ?? null,\n entry.blurDataURL ?? null\n ])\n : null;\n\n return [\n locale.root,\n pageEntries,\n locale.apiManifest?.hash ?? null,\n locale.config ?? null,\n fileManifestEntries,\n locale.jsFiles?.hash ?? null,\n locale.redirects?.hash ?? null,\n locale.locale,\n locale.version ?? null,\n locale.repo ?? null,\n locale.git ?? null\n ];\n}\n\n// ─── Entity hashers (for CAS dedup of structural rows) ─────────────────\n\nexport interface SegmentDetailHashInput {\n type: string;\n displayName: string;\n icon?: string | null;\n sortOrder: number;\n metadata: LedgerSegmentDetailMetadata;\n hidden: boolean;\n viewers: string[];\n orphaned: boolean;\n featureFlags: string[];\n}\n\nexport function hashSegmentDetail(input: SegmentDetailHashInput): string {\n return computeHash([\n FDR_VERSION,\n input.type,\n input.displayName,\n input.icon,\n input.sortOrder,\n input.metadata,\n input.hidden,\n [...input.viewers].sort(),\n input.orphaned,\n [...input.featureFlags].sort()\n ]);\n}\n\nexport interface ArtifactHashInput {\n type: string;\n hidden: boolean;\n metadata: Record<string, unknown>;\n /** CAS content hash. Null for content-less artifacts (links). */\n contentHash: string | null;\n}\n\nexport function hashArtifact(input: ArtifactHashInput): string {\n return computeHash([FDR_VERSION, input.type, input.hidden, input.metadata, input.contentHash]);\n}\n\nexport interface SegmentHashInput {\n locale: string;\n productHash?: string;\n versionHash?: string;\n variantHash?: string;\n tabHash?: string;\n section: string;\n metadata: LedgerSegmentMetadata;\n hidden: boolean;\n /** Artifact hashes included in this segment — sorted internally for determinism. */\n artifactHashes: string[];\n /** Sidebar ordering: artifact hash + display position. Sorted by displaySortOrder for determinism. */\n displaySortOrder: Array<{ artifactHash: string; displaySortOrder: number }>;\n /** Route entries — sorted by fullPath internally for determinism. */\n routes: Array<{ fullPath: string; artifactHash: string }>;\n}\n\nexport function hashSegment(input: SegmentHashInput): string {\n const sortedRoutes = [...input.routes].sort((a, b) =>\n a.fullPath < b.fullPath ? -1 : a.fullPath > b.fullPath ? 1 : 0\n );\n const sortedDisplayOrder = [...input.displaySortOrder].sort((a, b) => {\n const orderDiff = a.displaySortOrder - b.displaySortOrder;\n if (orderDiff !== 0) {\n return orderDiff;\n }\n return a.artifactHash < b.artifactHash ? -1 : a.artifactHash > b.artifactHash ? 1 : 0;\n });\n return computeHash([\n FDR_VERSION,\n input.locale,\n input.productHash,\n input.versionHash,\n input.variantHash,\n input.tabHash,\n input.section,\n input.metadata,\n input.hidden,\n [...input.artifactHashes].sort(),\n sortedDisplayOrder,\n sortedRoutes\n ]);\n}\n","/**\n * Server-side transform: DocsPublishInput → TransformResult\n *\n * Entry point: {@link transformPublishInput} takes a wire-format DocsPublishInput\n * plus an {@link ApiManifest} and returns a {@link TransformResult} — the flat,\n * hash-addressed entities used by the docs-ledger write pipeline\n * (see `docsLedgerRouter.ts` finish handler and `DocsLedgerDao.persistDeployment`).\n *\n * ## Pipeline overview\n *\n * 1. The caller (finish handler) fetches the API manifest blob from CAS and\n * parses it into an `ApiManifest` (Record<apiDefinitionId, ApiDefinition>).\n * 2. `transformPublishInput` creates a {@link TransformContext} and walks the\n * V1 navigation tree depth-first via `walkRoot` → `walkProductGroup` →\n * `walkVersioned` → `walkTabbed` → `walkSidebarRoot` → `walkSection` /\n * `walkApiSection` / `walkChangelog`.\n * 3. At each leaf, artifact factory methods (`makePageArtifact`,\n * `makeEndpointArtifact`, `makeApiArtifact`, `makeLinkArtifact`,\n * `makeChangelogEntryArtifact`, `makeOverviewArtifact`) produce\n * `CollectedArtifact` entries. API artifacts are pruned inline via\n * `pruneApiContent` → `@fern-api/fdr-sdk/api-definition.prune()`.\n * 4. `createSegment` hashes and stores each segment, then `buildNavEntries`\n * computes fullPath routes (including default-elided variants via\n * `generateFullPaths`).\n * 5. `buildResult` collects global content refs and returns the final\n * `TransformResult`.\n *\n * ## Content model\n *\n * - **Pages** arrive as BlobRefs (hash + contentType + contentLength), not\n * inline markdown. Resolved via `resolvePageBlobRef`.\n * - **API definitions** arrive as a parsed manifest. The transform prunes\n * each API artifact via `pruneApiContent` and serializes the result as a\n * server-generated blob (`trackGeneratedJsonBlob` → `generatedBlobs`).\n * - **Links** are sidebar-only chrome items; they have no CAS content.\n * - **Config/files** are pre-extracted BlobRefs stored as deployment-level globals.\n * - **Redirects** are wired as artifacts (type `\"redirect\"`) in a dedicated segment.\n * - All structural entities (segment details, artifacts, segments) are hashed\n * inline for CAS dedup. Cross-references use hashes, not array indices.\n * - Nav entries (routing + sidebar ordering) are built inline as segments\n * are created via `buildNavEntries`.\n */\nimport { createHash } from \"node:crypto\";\nimport { ORPCError } from \"@orpc/client\";\nimport { kebabCase } from \"es-toolkit/string\";\nimport type { ApiDefinition } from \"../api-definition/index.js\";\nimport { type PruningNodeType, prune } from \"../api-definition/index.js\";\nimport {\n migrate as FernNavigationMigrate,\n utils as FernNavigationUtils,\n Slug as LatestSlug,\n toDefaultSlug,\n V1 as V1Runtime\n} from \"../navigation/index.js\";\nimport type * as V1 from \"../navigation/types/v1.js\";\nimport type {\n BlobRef,\n FileManifestEntry,\n LedgerArtifactTypeMetadata,\n LedgerConfig,\n LedgerPlaygroundMetadata,\n LedgerSegmentDetailMetadata,\n LedgerSegmentMetadata,\n LocaleEntry\n} from \"../orpc-client/index.js\";\nimport { GraphQlTypeCategorySchema } from \"../orpc-client/index.js\";\nimport { hashArtifact, hashSegment, hashSegmentDetail } from \"./docsLedgerHash.js\";\nimport type {\n ArtifactInput,\n DeploymentApiDefinitionInput,\n DeploymentSegmentInput,\n DocsSiteProduct,\n FileArtifactMetadata,\n NavInput,\n SegmentDetailInput,\n SegmentInput\n} from \"./inputTypes.js\";\nimport { toBasepathRelative } from \"./toBasepathRelative.js\";\n\n/**\n * Input type for `transformPublishInput`. A single locale's content fields\n * plus the deployment-scoped `domain` (needed for file-artifact S3 key\n * construction).\n */\nexport type TransformInput = LocaleEntry & {\n domain: string;\n /**\n * Override for the file-anchoring domain (S3 keys). When set, files\n * are keyed under this domain instead of `domain`, so preview\n * publishes can anchor on the canonical fern domain (ADR 0010).\n */\n fileDomain?: string;\n};\n\n/**\n * A fileManifest entry collected during the transform. Carries everything\n * the register/finish handlers need to route uploads to the correct S3\n * bucket and upsert `docs_ledger_file` rows. The asset domain is the\n * canonical `DocsPublishInput.domain`; custom domains share that namespace.\n * The bucket is determined by the handler (not the transform) from the\n * site's auth config.\n */\nexport interface TransformFileEntry {\n fullPath: string;\n hash: string;\n contentType: string;\n contentLength: number;\n filename: string;\n width?: number;\n height?: number;\n blurDataURL?: string;\n}\n\n// ── Public API ───────────────────────────────────────────────────────────\n\n/**\n * Parsed API manifest: full API definitions keyed by apiDefinitionId.\n * The finish handler fetches the manifest blob from S3 and parses it.\n */\nexport type ApiManifest = Record<string, ApiDefinition>;\n\n/**\n * A BlobRef whose bytes were generated server-side (pruned API content, link metadata).\n * The router must upload these to CAS before persisting the deployment.\n */\nexport interface GeneratedBlob {\n ref: BlobRef;\n bytes: Buffer;\n}\n\n/**\n * Transform result: hashed entities ready for the DAO, plus content\n * references and server-generated blobs for CAS upload.\n */\nexport interface TransformResult {\n segmentDetails: SegmentDetailInput[];\n artifacts: ArtifactInput[];\n segments: SegmentInput[];\n nav: NavInput[];\n deploymentSegments: DeploymentSegmentInput[];\n apiDefinitions: DeploymentApiDefinitionInput[];\n\n /** Visible top-level products in switcher order, snapshotted for sibling sites on the same host. */\n siteProducts: DocsSiteProduct[];\n\n // Global blob hashes (for DeploymentInput construction)\n jsFilesHash: string | undefined;\n\n /**\n * ADR 0009: structural config (everything except `header`, `footer`,\n * `css.inline`, `js.inline`) ready to be written into\n * `docs_ledger_deployments.config_json` as JSONB. The four extracted\n * variable-length pieces are content-addressed via the `*Hash` fields\n * below.\n */\n configJson: unknown | undefined;\n\n /** CAS hash for the extracted `config.header` blob, or undefined. */\n headerHash: string | undefined;\n /** CAS hash for the extracted `config.footer` blob, or undefined. */\n footerHash: string | undefined;\n /**\n * CAS hash for the extracted `config.css.inline` blob (joined with\n * `\\n`), or undefined.\n */\n cssInlineHash: string | undefined;\n /**\n * CAS hash for the extracted `config.js.inline` blob (joined with\n * `\\n`), or undefined.\n */\n jsInlineHash: string | undefined;\n\n // Passthrough metadata (for DeploymentInput construction)\n domain: string;\n /**\n * The domain files are anchored on (defaults to `domain` when omitted\n * in the input). Forwarded so callers can key S3 operations and\n * manifest entries on the canonical domain for preview publishes.\n */\n fileDomain: string;\n version?: string | null;\n repo?: string | null;\n /**\n * Git provenance pulled straight off the publish input (ADR 0012 /\n * FER-10489). Forwarded to {@link DeploymentInput} so the deployment\n * row captures the repo/branch/sha used by the read path to\n * synthesise `editThisPageUrl`.\n */\n git?: { repoUrl: string; branch: string; commitSha?: string };\n\n /** All content blobs referenced by this deployment (artifact content, globals, generated). */\n contentRefs: Map<string, BlobRef>;\n /** Blobs generated by the transform (pruned API defs). Must be uploaded to CAS. */\n generatedBlobs: Map<string, GeneratedBlob>;\n /**\n * File manifest entries (images, fonts, pdfs). Tracked separately from\n * `contentRefs` because file bytes land in the public/private docs bucket\n * (key `{assetDomain}/{hash}/{fullPath}`), not in CAS. The register handler\n * routes their uploads accordingly; the finish handler upserts a\n * `docs_ledger_file` row per entry and resolves the resulting IDs onto\n * file/image artifacts.\n */\n fileEntries: TransformFileEntry[];\n /**\n * pageId → bare `fullPath`s of the files that page's markdown embeds (ADR\n * 0014, \"File metadata on the render path\"). Copied straight off the publish\n * input's `pages[pageId].referencedFiles` (captured CLI-side). Lets the read\n * model materialise the page→file join into each route shard. Empty for\n * pages with no embedded files or from CLIs that predate the field.\n */\n referencedFilesByPageId: Record<string, string[]>;\n}\n\n/**\n * Transform a single locale's content into hash-addressed entities ready for persistence.\n *\n * @param input - One locale entry (content fields) plus the deployment's `domain`.\n * @param apiManifest - Parsed API definitions (fetched from CAS by the caller).\n * Pass an empty object if there are no API references in the nav tree.\n */\nexport function transformPublishInput(input: TransformInput, apiManifest: ApiManifest = {}): TransformResult {\n const rawRoot = input.root;\n if (rawRoot == null) {\n throw new ORPCError(\"BAD_REQUEST\", { message: \"DocsPublishInput.root (V1 RootNode) is required\" });\n }\n if (!isV1RootNode(rawRoot)) {\n const got = describeRootDiscriminants(rawRoot);\n throw new ORPCError(\"BAD_REQUEST\", {\n message: `DocsPublishInput.root must be a V1 RootNode (type=\"root\", version=\"v1\") but got type=\"${got.type}\", version=\"${got.version}\"`\n });\n }\n\n const ctx = new TransformContext(input, apiManifest);\n ctx.walkRoot(rawRoot);\n\n return ctx.buildResult(input);\n}\n\n// ── Helpers ──────────────────────────────────────────────────────────\n\n/**\n * The shape check the legacy register flow has always performed on the wire\n * root: a `type: \"root\"`, `version: \"v1\"` discriminated object. The rest of\n * the V1 tree is intentionally NOT structurally validated here — the wire type\n * is the same `V1.RootNode` the legacy flow stores/serves, and the walk\n * tolerates the same variants.\n */\nfunction isV1RootNode(value: unknown): value is V1.RootNode {\n return (\n typeof value === \"object\" &&\n value != null &&\n \"type\" in value &&\n \"version\" in value &&\n value.type === \"root\" &&\n value.version === \"v1\"\n );\n}\n\n/** Best-effort read of the `type`/`version` discriminants for error messages. */\nfunction describeRootDiscriminants(value: unknown): {\n type: unknown;\n version: unknown;\n} {\n if (typeof value !== \"object\" || value == null) {\n return { type: undefined, version: undefined };\n }\n return {\n type: \"type\" in value ? value.type : undefined,\n version: \"version\" in value ? value.version : undefined\n };\n}\n\n/**\n * Extract the individual slug segment from an accumulated slug.\n *\n * `basePrefix` handles nodes whose published V1 slug omits the site basepath\n * (a node with an explicit `slug:` under a product on a basepath site): the\n * slug still nests under the parent once the basepath is dropped from the\n * parent, so strip it there rather than returning the whole slug — otherwise\n * the read side re-applies the scope prefix on top of a slug that already\n * carries it (`docs/core/core/documentation`).\n */\nfunction extractSlugSegment(nodeSlug: string, parentSlug: string, basePrefix = \"\"): string {\n if (!parentSlug) {\n return nodeSlug;\n }\n // skipUrlSlug: node shares its parent's slug (e.g. apiReference that\n // doesn't add a URL segment). Return \"\" so the section path is not\n // polluted with the full accumulated slug.\n if (nodeSlug === parentSlug) {\n return \"\";\n }\n const prefix = parentSlug + \"/\";\n if (nodeSlug.startsWith(prefix)) {\n return nodeSlug.slice(prefix.length);\n }\n const relativeParent = toBasepathRelative(parentSlug, basePrefix);\n if (relativeParent !== \"\" && relativeParent !== parentSlug) {\n if (nodeSlug === relativeParent) {\n return \"\";\n }\n if (nodeSlug.startsWith(`${relativeParent}/`)) {\n return nodeSlug.slice(relativeParent.length + 1);\n }\n }\n // Fallback: if the slug isn't accumulated, return as-is\n return nodeSlug;\n}\n\n/** Join non-empty path parts with '/'. */\nfunction joinPath(...parts: (string | undefined)[]): string {\n return parts.filter(Boolean).join(\"/\");\n}\n\n/** Append a slug segment to a parent section path. */\nfunction appendSectionPath(parent: string, slug: string): string {\n if (!slug) {\n return parent;\n }\n return parent ? `${parent}/${slug}` : slug;\n}\n\n/**\n * Normalise an INTERNAL (root-relative) link `href` to a slug key, or return\n * `null` for external / protocol-relative URLs (which can never be a\n * self-redirect). Used to detect a synthetic link redirect that points at its\n * OWN key — e.g. a home-product link titled \"Astro\" whose href `/docs/astro`\n * kebab-resolves to the key `docs/astro`, which is also the Astro product's\n * landing slug. Emitting `docs/astro → /docs/astro` both 307-loops and shadows\n * the real product node, so it must be dropped (the node's `pointsTo` then\n * resolves the landing). Mirrors the read path's `canonicalSlugKey` normaliser.\n */\nfunction internalHrefSlug(href: string): string | null {\n // Scheme (`https:`) or protocol-relative (`//host`) URLs are external.\n if (/^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith(\"//\")) {\n return null;\n }\n const pathOnly = href.split(/[?#]/)[0] ?? href;\n return FernNavigationUtils.canonicalSlugKey(pathOnly.replace(/^\\/+|\\/+$/g, \"\"));\n}\n\n/**\n * Resolve `pointsTo` for a V1 node that has `WithRedirect`.\n * The CLI always sends `pointsTo: undefined`, so we compute it by traversing\n * the node's children to find the first visible page slug.\n */\nfunction resolvePointsTo(node: V1Runtime.NavigationNode): string | undefined {\n const slug = V1Runtime.followRedirect(node);\n return slug != null ? String(slug) : undefined;\n}\n\n/**\n * Resolve root redirects through the same latest-navigation semantics used by\n * legacy rendering. V1's helper predates page-level auth handling and can point\n * at an authed page; `mutableUpdatePointsTo` on the migrated tree skips authed\n * pages, which is the behavior legacy callers observe.\n */\nfunction resolveRootPointsTo(root: V1.RootNode): V1.Slug | undefined {\n const latestRoot = FernNavigationMigrate.FernNavigationV1ToLatest.create().root(root);\n FernNavigationUtils.mutableUpdatePointsTo(latestRoot);\n return latestRoot.pointsTo != null ? V1Runtime.Slug(latestRoot.pointsTo) : undefined;\n}\n\n// ── Internal types ───────────────────────────────────────────────────────\n\ninterface Scope {\n productHash: string | undefined;\n productSlug: string | undefined;\n productDefault: boolean;\n versionHash: string | undefined;\n versionSlug: string | undefined;\n versionDefault: boolean;\n variantHash: string | undefined;\n variantSlug: string | undefined;\n variantDefault: boolean;\n tabHash: string | undefined;\n tabSlug: string | undefined;\n}\n\nconst EMPTY_SCOPE: Scope = {\n productHash: undefined,\n productSlug: undefined,\n productDefault: false,\n versionHash: undefined,\n versionSlug: undefined,\n versionDefault: false,\n variantHash: undefined,\n variantSlug: undefined,\n variantDefault: false,\n tabHash: undefined,\n tabSlug: undefined\n};\n\n/** The API-backed subset of the artifact `type`/`metadata` discriminated pairs. */\ntype ApiArtifactTypeMetadata = Extract<\n LedgerArtifactTypeMetadata,\n { type: \"rest\" | \"asyncapi\" | \"webhook\" | \"grpc\" | \"graphql\" | \"graphqlType\" }\n>;\n\n/** Metadata fields shared by every API artifact type, supplied by {@link TransformContext.makeApiArtifact}. */\ntype ApiArtifactCommonMetadata = Pick<\n Extract<ApiArtifactTypeMetadata, { type: \"rest\" }>[\"metadata\"],\n | \"title\"\n | \"slug\"\n | \"icon\"\n | \"authed\"\n | \"apiDefinitionId\"\n | \"availability\"\n | \"viewers\"\n | \"orphaned\"\n | \"featureFlags\"\n | \"playground\"\n | \"noindex\"\n>;\n\ninterface CollectedArtifact {\n artifactHash: string;\n slug: string;\n isLink: boolean;\n /** Position in the parent's full children array (for interleave ordering). */\n childPosition?: number;\n /**\n * The node's original V1 accumulated slug (full URL path from root).\n * Used by {@link generateFullPathsFromV1Slug} to derive correct routing\n * fullPaths — this is the source of truth for the URL, avoiding the\n * need to reconstruct it from scope + section + artifact slug (which\n * breaks when sections don't contribute to child URLs or when pages\n * have custom slug overrides).\n */\n v1Slug?: string;\n /**\n * For `isLink` artifacts only: the link's title and resolved href. Used to\n * synthesise a routable `type:\"redirect\"` row at\n * `<closest-parent-with-slug>/kebab(title)` → href (see\n * {@link TransformContext.linkRedirectCandidates}). Mirrors the read-side\n * `collectLinkRedirects` derivation byte-for-byte.\n */\n linkTitle?: string;\n linkHref?: string;\n}\n\n/**\n * A pending synthetic `link:` redirect, collected during the walk and\n * materialised in {@link TransformContext.buildResult} once every real route is\n * known. `fullPath` is the synthetic slug\n * (`{basepath}/<closest-parent-with-slug>/kebab(title)`, basepath-ABSOLUTE to\n * match real route keys); `href` is the\n * link's configured target. A real page at the same `fullPath` wins, so these\n * are filtered against {@link TransformContext.realRoutePaths} before emission.\n */\ntype StructuralRedirectKind = \"root\" | \"product\" | \"version\" | \"variant\" | \"tab\" | \"section\" | \"api-section\";\n\ntype RedirectKind = \"structural\" | \"link\";\n\ninterface LinkRedirectCandidate {\n segmentHash: string;\n fullPath: string;\n href: string;\n redirectKind: RedirectKind;\n structuralKind?: StructuralRedirectKind;\n}\n\ninterface StructuralRedirectCandidate {\n fullPath: string;\n href: string;\n overrideExistingRoute: boolean;\n structuralKind: StructuralRedirectKind;\n}\n\n// ── Default-elision route generation ─────────────────────────────────────\n\n/**\n * Derive all route fullPaths from a node's V1 accumulated slug.\n *\n * The V1 slug is the source of truth for the URL path — it already encodes\n * the correct structure (including custom slug overrides and sections that\n * don't contribute to child URLs). This function strips known default scope\n * prefixes (product, version, variant) from the front of the V1 slug, then\n * generates the power set of elision variants.\n *\n * Replaces the previous reconstruction approach ({@link generateFullPaths})\n * for routing, which broke when `extractSlugSegment` could not strip the\n * section prefix from a custom-slug page's accumulated path.\n *\n * BASEPATH handling (ADR-0014 #6): the `scope.*Slug` entries are basepath-\n * RELATIVE (e.g. `astro/cli`, `v-1-42` — see `extractSlugSegment`), but the V1\n * slug is basepath-ABSOLUTE (begins with the deployment basepath, e.g.\n * `docs/astro/cli/v-1-42/overview`). The prefix checks below match against the\n * relative scope slugs, so on a `/docs` site the leading basepath would never\n * match and NO elision variants would be emitted — leaving the default\n * version's clean URL (`docs/astro/cli/overview`) un-routable (404). To fix\n * this we strip the basepath off the front first, run the elision power-set on\n * the basepath-relative remainder, then re-prepend the basepath to every\n * variant — so the emitted routes stay basepath-ABSOLUTE (matching the `routes`\n * dict / `routing` table) and carry a single `docs/` prefix. Root sites\n * (`basePrefix === \"\"`) are unaffected (the strip/prepend are no-ops).\n *\n * This is the WRITE half of the #6 fix; it makes the elided routes resolvable\n * in the `routing` table so `getScopedRoot`'s `routeContext` can find their\n * scope. The coordinated READ half lives in `ledger-root-builder.buildVersioned`\n * (the default version node must carry its full versioned slug so\n * `NodeCollector`'s default-version pruning emits the elided alias into the nav\n * `slugMap` that `findNode` gates on).\n */\nfunction generateFullPathsFromV1Slug(scope: Scope, v1Slug: string, basePrefix: string): string[] {\n const scopePrefixes: { slug: string; isDefault: boolean }[] = [];\n // The scope slugs are basepath-relative, so strip the basepath off the V1\n // slug before matching them; we re-prepend it to every emitted variant.\n let remaining = toBasepathRelative(v1Slug, basePrefix);\n\n for (const entry of [\n { slug: scope.productSlug, isDefault: scope.productDefault },\n { slug: scope.versionSlug, isDefault: scope.versionDefault },\n { slug: scope.variantSlug, isDefault: scope.variantDefault }\n ]) {\n if (!entry.slug) {\n continue;\n }\n const prefix = entry.slug + \"/\";\n if (remaining.startsWith(prefix)) {\n scopePrefixes.push({ slug: entry.slug, isDefault: entry.isDefault });\n remaining = remaining.slice(prefix.length);\n } else if (remaining === entry.slug) {\n scopePrefixes.push({ slug: entry.slug, isDefault: entry.isDefault });\n remaining = \"\";\n break;\n } else {\n break;\n }\n }\n\n const defaultIndices = scopePrefixes.map((p, i) => (p.isDefault ? i : -1)).filter((i) => i >= 0);\n\n if (defaultIndices.length === 0) {\n return [joinPath(basePrefix, ...scopePrefixes.map((p) => p.slug), remaining)];\n }\n\n const paths: string[] = [];\n for (let mask = 0; mask < 1 << defaultIndices.length; mask++) {\n const elidedSet = new Set<number>();\n for (let j = 0; j < defaultIndices.length; j++) {\n if (mask & (1 << j)) {\n elidedSet.add(defaultIndices[j]!);\n }\n }\n const kept = scopePrefixes.filter((_, i) => !elidedSet.has(i)).map((p) => p.slug);\n paths.push(joinPath(basePrefix, ...kept, remaining));\n }\n\n return paths;\n}\n\n/**\n * Generate all route fullPaths for an artifact, including default-elided\n * variants. Products, versions, and variants marked as `default` create\n * additional routes with their slug prefix omitted -- the power set of\n * elidable slugs produces all valid path variants.\n *\n * @deprecated Prefer {@link generateFullPathsFromV1Slug} for routing. This\n * function is retained for non-routing uses (link redirect slug computation)\n * where the decomposed scope + section + artifact structure is needed.\n */\nfunction generateFullPaths(scope: Scope, sectionPath: string, artifactSlug: string): string[] {\n // Ordered prefix components that may be elidable\n const prefixes: { slug: string; isDefault: boolean }[] = [];\n if (scope.productSlug) {\n prefixes.push({ slug: scope.productSlug, isDefault: scope.productDefault });\n }\n if (scope.versionSlug) {\n prefixes.push({ slug: scope.versionSlug, isDefault: scope.versionDefault });\n }\n if (scope.variantSlug) {\n prefixes.push({ slug: scope.variantSlug, isDefault: scope.variantDefault });\n }\n\n // Fixed suffix: tab + section + artifact slug (never elided)\n const suffix = joinPath(scope.tabSlug, sectionPath, artifactSlug);\n\n const defaultIndices = prefixes.map((p, i) => (p.isDefault ? i : -1)).filter((i) => i >= 0);\n\n if (defaultIndices.length === 0) {\n return [joinPath(...prefixes.map((p) => p.slug), suffix)];\n }\n\n // Power set over default indices\n const paths: string[] = [];\n for (let mask = 0; mask < 1 << defaultIndices.length; mask++) {\n const elidedSet = new Set<number>();\n for (let j = 0; j < defaultIndices.length; j++) {\n if (mask & (1 << j)) {\n elidedSet.add(defaultIndices[j]!);\n }\n }\n const kept = prefixes.filter((_, i) => !elidedSet.has(i)).map((p) => p.slug);\n paths.push(joinPath(...kept, suffix));\n }\n\n return paths;\n}\n\n// ── Transform context ────────────────────────────────────────────────────\n\nclass TransformContext {\n readonly segmentDetails: SegmentDetailInput[] = [];\n readonly artifacts: ArtifactInput[] = [];\n readonly segments: SegmentInput[] = [];\n readonly nav: NavInput[] = [];\n readonly siteProducts: DocsSiteProduct[] = [];\n readonly apiDefinitions: DeploymentApiDefinitionInput[] = [];\n readonly contentRefs = new Map<string, BlobRef>();\n readonly generatedBlobs = new Map<string, GeneratedBlob>();\n readonly fileEntries: TransformFileEntry[] = [];\n\n /** Dedup file entries by (hash, fullPath) — see {@link TransformFileEntry}. */\n private readonly fileEntryKeys = new Set<string>();\n\n /** Segment hashes in creation order, for deploymentSegments. */\n private readonly segmentOrder: string[] = [];\n\n /**\n * Every real (non-link) routable `fullPath` emitted by any segment.\n * Synthetic `link:` redirects are skipped when they collide with one of\n * these so a real page always wins (write-side dedup, ADR 0013).\n */\n private readonly realRoutePaths = new Set<string>();\n\n /**\n * Synthetic `link:` redirects collected during the walk, materialised in\n * {@link buildResult} once `realRoutePaths` is complete.\n */\n private readonly linkRedirectCandidates: LinkRedirectCandidate[] = [];\n private readonly structuralRedirectCandidates: StructuralRedirectCandidate[] = [];\n\n private readonly segmentDetailHashSet = new Set<string>();\n private readonly artifactHashSet = new Set<string>();\n private readonly apiDefIdSet = new Set<string>();\n\n private readonly pages: Record<string, BlobRef>;\n private readonly apiManifest: ApiManifest;\n private readonly locale: string;\n private readonly assetDomain: string;\n\n /**\n * The deployment basepath — the V1 root node's slug, which seeds every\n * accumulated node slug (so real-route `fullPath`s are basepath-ABSOLUTE).\n * Set once in {@link walkRoot}. Synthetic `link:` redirect keys, whose\n * parent slug is reconstructed basepath-RELATIVE via {@link generateFullPaths},\n * are prefixed with this so they match the absolute route keys / `routing`\n * table (see {@link collectSegmentLinkRedirects}).\n */\n private basePrefix = \"\";\n private rootPointsTo: V1.Slug | undefined;\n\n /**\n * Default-version slug elisions collected during the walk, used to\n * canonicalise the SITE-ROOT structural-redirect target (Postman\n * root-redirect regression; sibling to #13147, #12417). Each\n * entry maps a default version's full accumulated slug (`from`, e.g.\n * `latest-v-12` or `docs/latest-v-12`) to the parent scope prefix it should\n * collapse to (`to`, the enclosing product slug or the deployment basepath).\n *\n * A versioned site's default version can be reached versionlessly (the read\n * path's `toDefaultSlug` / `markDefaultVersionCanonicalSlugs` elision), so\n * the redirect that serves the site root (`/`) must point at that versionless\n * target — otherwise a derived default-version slug (no explicit `slug:`)\n * leaks into the root redirect (`/ → /latest-v-12`) and every version switch\n * from there carries the bad segment. Applied ONLY to the site-root source\n * (`fullPath === basePrefix`) in {@link flushStructuralRedirects}; scoped\n * (product/version/variant) redirect targets keep their full non-elided slug,\n * matching the read-side canonical convention (default product retained,\n * default version elided).\n */\n private readonly defaultVersionElisions: { from: string; to: string }[] = [];\n\n constructor(input: TransformInput, apiManifest: ApiManifest) {\n this.pages = input.pages as Record<string, BlobRef>;\n this.apiManifest = apiManifest;\n this.locale = input.locale ?? \"en\";\n this.assetDomain = input.fileDomain ?? input.domain;\n }\n\n // ── Generated blob tracking ─────────────────────────────────────\n\n /** Hash and track a JSON-serializable value as a generated blob for CAS upload. */\n private trackGeneratedJsonBlob(value: unknown): BlobRef {\n const json = JSON.stringify(value);\n const bytes = Buffer.from(json, \"utf-8\");\n const hash = createHash(\"sha256\").update(bytes).digest(\"hex\");\n\n if (!this.generatedBlobs.has(hash)) {\n this.generatedBlobs.set(hash, {\n ref: { hash, contentType: \"application/json\", contentLength: bytes.byteLength },\n bytes\n });\n }\n\n return { hash, contentType: \"application/json\", contentLength: bytes.byteLength };\n }\n\n /**\n * Hash and track a raw text value as a generated blob for CAS upload.\n *\n * Used for the four config fields extracted by ADR 0009 (`header`,\n * `footer`, joined `css.inline`, joined `js.inline`) which are raw\n * MDX / CSS / JS strings, not JSON. Stored with `contentType: text/plain`\n * — the loader treats them as opaque byte streams.\n */\n private trackGeneratedTextBlob(value: string): BlobRef {\n const bytes = Buffer.from(value, \"utf-8\");\n const hash = createHash(\"sha256\").update(bytes).digest(\"hex\");\n\n if (!this.generatedBlobs.has(hash)) {\n this.generatedBlobs.set(hash, {\n ref: { hash, contentType: \"text/plain\", contentLength: bytes.byteLength },\n bytes\n });\n }\n\n return { hash, contentType: \"text/plain\", contentLength: bytes.byteLength };\n }\n\n /**\n * Prune a full API definition for a single node and return a real BlobRef.\n * The pruned JSON bytes are tracked in `generatedBlobs` for the router to upload.\n */\n private pruneApiContent(apiDefinitionId: string, node: PruningNodeType): BlobRef | null {\n const fullDef = this.apiManifest[apiDefinitionId];\n if (fullDef == null) {\n // API definition not in manifest — no content to prune.\n // This happens when the CLI publishes without an apiManifest (e.g. the\n // initial ledger integration that doesn't yet bundle API definitions).\n return null;\n }\n return this.trackGeneratedJsonBlob(prune(fullDef, node));\n }\n\n /**\n * Serialize a full API definition and track as a generated blob.\n * Returns the content BlobRef for the deployment → API definition join.\n */\n private serializeApiDefinition(apiDefinitionId: string): BlobRef | null {\n const fullDef = this.apiManifest[apiDefinitionId];\n if (fullDef == null) {\n return null;\n }\n return this.trackGeneratedJsonBlob(fullDef);\n }\n\n // ── Deduplicating adders ──────────────────────────────────────────\n\n /**\n * Deduplicate and store a segment detail (product, version, variant, or tab).\n * Returns the content-addressed hash used as a foreign key in segments.\n */\n addSegmentDetail(detail: Omit<SegmentDetailInput, \"hash\">): string {\n const hash = hashSegmentDetail({\n type: detail.type,\n displayName: detail.displayName,\n icon: detail.icon,\n sortOrder: detail.sortOrder,\n metadata: detail.metadata,\n hidden: detail.hidden,\n viewers: detail.viewers,\n orphaned: detail.orphaned,\n featureFlags: detail.featureFlags\n });\n if (!this.segmentDetailHashSet.has(hash)) {\n this.segmentDetailHashSet.add(hash);\n this.segmentDetails.push({ hash, ...detail });\n }\n return hash;\n }\n\n /**\n * Deduplicate and store an artifact (page, API endpoint, link, changelog\n * entry, file, image, etc.). For CAS-backed content, tracks the BlobRef\n * for upload routing. For file/image artifacts, the caller passes\n * `fileKey` instead — those bytes go to the docs bucket, not CAS.\n *\n * Exactly one of `content` and `fileKey` should be non-null for\n * content-bearing artifacts; both are null for link artifacts.\n *\n * Returns the content-addressed artifact hash.\n */\n addArtifact(\n artifact: LedgerArtifactTypeMetadata & {\n hidden: boolean;\n content: BlobRef | null;\n fileKey?: { hash: string; fullPath: string } | null;\n }\n ): string {\n const contentHash = artifact.content?.hash ?? null;\n const fileKey = artifact.fileKey ?? null;\n\n // Identity hash must distinguish artifacts that resolve to different\n // bytes. We feed the CAS hash for content-backed artifacts and the\n // file hash for file-backed ones (they're both SHA-256 of the bytes,\n // just stored in different tables). For file artifacts, also include\n // `assetDomain` and `fullPath` — the same bytes at different paths or\n // canonical upload domains produce different docs-bucket keys and so\n // must produce different artifacts (the FK points at one specific\n // (domain, hash, fullPath) row).\n const identityContentHash =\n fileKey != null ? `file:${this.assetDomain}|${fileKey.hash}|${fileKey.fullPath}` : contentHash;\n const hash = hashArtifact({\n type: artifact.type,\n hidden: artifact.hidden,\n metadata: artifact.metadata,\n contentHash: identityContentHash\n });\n\n if (!this.artifactHashSet.has(hash)) {\n const { content: _content, fileKey: _inputFileKey, ...artifactFields } = artifact;\n this.artifactHashSet.add(hash);\n this.artifacts.push({\n hash,\n ...artifactFields,\n contentHash: fileKey != null ? null : contentHash,\n fileKey\n });\n }\n\n // Track content reference for CAS — only for CAS-backed artifacts.\n // File/image artifacts land in the docs bucket and are tracked via\n // `fileEntries` instead (see {@link addFileEntry}).\n if (fileKey == null && artifact.content != null && artifact.content.hash !== \"\") {\n this.contentRefs.set(artifact.content.hash, artifact.content);\n }\n\n return hash;\n }\n\n /**\n * Record a file manifest entry for the register/finish handlers.\n * Deduped by `(hash, fullPath)` — the same file at the same path is a\n * single docs_ledger_file row regardless of how many places reference it.\n */\n addFileEntry(entry: TransformFileEntry): void {\n const key = `${entry.hash}|${entry.fullPath}`;\n if (this.fileEntryKeys.has(key)) {\n return;\n }\n this.fileEntryKeys.add(key);\n this.fileEntries.push(entry);\n }\n\n /**\n * Register an API definition for the deployment → API definition join table.\n * Serializes the full definition as a generated blob (deduplicated by ID).\n */\n trackApiDefinition(apiDefinitionId: string): void {\n if (this.apiDefIdSet.has(apiDefinitionId)) {\n return;\n }\n this.apiDefIdSet.add(apiDefinitionId);\n\n // Serialize the full API definition for the deployment join\n const ref = this.serializeApiDefinition(apiDefinitionId);\n if (ref != null) {\n const apiName = this.apiManifest[apiDefinitionId]?.apiName ?? null;\n this.apiDefinitions.push({ apiDefinitionId, apiName, contentHash: ref.hash });\n this.contentRefs.set(ref.hash, ref);\n }\n }\n\n // ── Segment creation ──────────────────────────────────────────────\n\n /**\n * Hash and store a segment — a group of artifacts scoped by product/version/variant/tab\n * at a given section path. Delegates to {@link buildNavEntries} for routing and sidebar\n * ordering, and records the segment in deployment order.\n */\n createSegment(\n scope: Scope,\n sectionPath: string,\n metadata: LedgerSegmentMetadata,\n collected: CollectedArtifact[],\n hidden: boolean\n ): void {\n const artifactHashes = collected.map((a) => a.artifactHash);\n const displaySortOrder = collected.map((a, order) => ({\n artifactHash: a.artifactHash,\n displaySortOrder: a.childPosition ?? order\n }));\n\n // Compute routes (skip link artifacts — they're sidebar-only chrome).\n // First-writer-wins: when a fullPath is already claimed by a\n // previously-walked segment (e.g. a parent section's overview), skip\n // the duplicate so the DAO's LIMIT 1 lookup always returns the\n // canonical artifact.\n //\n // Sidebar paths: even when an artifact's routes are all deduped\n // (another segment already claimed the same fullPaths), the sidebar\n // entry still needs a fullPath so the nav link renders the correct\n // href instead of falling back to \"/\". This matches v2 behavior\n // where multiple nav nodes could share the same target URL.\n const routes: Array<{ fullPath: string; artifactHash: string }> = [];\n const sidebarPaths = new Map<string, string>();\n for (const a of collected) {\n if (a.isLink) {\n continue;\n }\n const paths =\n a.v1Slug != null\n ? generateFullPathsFromV1Slug(scope, a.v1Slug, this.basePrefix)\n : generateFullPaths(scope, FernNavigationUtils.stripSyntheticSegments(sectionPath), a.slug);\n if (paths.length > 0 && !sidebarPaths.has(a.artifactHash)) {\n sidebarPaths.set(a.artifactHash, paths[0]!);\n }\n for (const fullPath of paths) {\n if (this.realRoutePaths.has(fullPath)) {\n continue;\n }\n routes.push({ artifactHash: a.artifactHash, fullPath });\n this.realRoutePaths.add(fullPath);\n }\n }\n\n const segmentHash = hashSegment({\n locale: this.locale,\n productHash: scope.productHash,\n versionHash: scope.versionHash,\n variantHash: scope.variantHash,\n tabHash: scope.tabHash,\n section: sectionPath,\n metadata,\n hidden,\n artifactHashes,\n displaySortOrder,\n routes\n });\n\n this.segments.push({\n hash: segmentHash,\n locale: this.locale,\n productHash: scope.productHash,\n versionHash: scope.versionHash,\n variantHash: scope.variantHash,\n tabHash: scope.tabHash,\n section: sectionPath,\n metadata,\n hidden\n });\n\n // Build nav entries inline\n this.buildNavEntries(segmentHash, collected, routes, sidebarPaths);\n\n // Collect synthetic `link:` redirects for this segment. The read path\n // historically synthesised `<closest-parent-with-slug>/kebab(title)` →\n // href by walking the reconstructed tree (`collectLinkRedirects`); we\n // compute the same slug here so the route is byte-identical.\n // Materialisation (with real-page-wins dedup) is deferred to\n // `buildResult` once every real route is known.\n this.collectSegmentLinkRedirects(segmentHash, scope, sectionPath, collected);\n\n this.segmentOrder.push(segmentHash);\n }\n\n /**\n * Compute the segment's reconstructed node slug — the\n * `closest-parent-with-slug` a `link:` child resolves against in\n * `collectLinkRedirects` over the read-side reconstructed tree\n * (`ledger-root-builder`). Returns the parent slug basepath-RELATIVE\n * (reconstructed from scope/section slugs, which never carry the basepath);\n * {@link collectSegmentLinkRedirects} prefixes `basePrefix` to make the\n * final redirect key absolute and line up with `routeContext` lookups.\n *\n * - **Sectioned segment** (`sectionPath !== \"\"`): the section node's slug,\n * which the builder takes as the overview route's `fullPath` when an\n * overview exists, else the bare section path\n * (`ledger-root-builder.sectionNode`).\n * - **tabRoot segment** (`sectionPath === \"\"`): links live directly under\n * the scope's sidebar root, so the closest parent with a slug is the\n * enclosing scope node; its slug is the scope's canonical route prefix\n * (`generateFullPaths(scope, \"\", \"\")[0]`, i.e. no default-elision).\n */\n private segmentParentSlug(scope: Scope, sectionPath: string, collected: CollectedArtifact[]): string {\n const cleanPath = FernNavigationUtils.stripSyntheticSegments(sectionPath);\n if (cleanPath === \"\") {\n return generateFullPaths(scope, \"\", \"\")[0] ?? \"\";\n }\n const hasOverview = collected.some((a) => !a.isLink && a.slug === \"\");\n if (hasOverview) {\n return generateFullPaths(scope, cleanPath, \"\")[0] ?? cleanPath;\n }\n return cleanPath;\n }\n\n /**\n * Queue a synthetic `type:\"redirect\"` route for every `link:` artifact in a\n * segment. Slug derivation mirrors `collectLinkRedirects` exactly: the\n * closest parent's slug + `/` + `kebabCase(title)`, then `canonicalSlugKey`\n * (the read path's percent-decode normaliser). Links with an empty kebab\n * title contribute no route (matching the read-side guard).\n */\n private collectSegmentLinkRedirects(\n segmentHash: string,\n scope: Scope,\n sectionPath: string,\n collected: CollectedArtifact[]\n ): void {\n const links = collected.filter((a) => a.isLink && a.linkHref != null);\n if (links.length === 0) {\n return;\n }\n const parentSlug = this.segmentParentSlug(scope, sectionPath, collected);\n for (const link of links) {\n const segment = kebabCase(link.linkTitle ?? \"\");\n if (!segment) {\n continue;\n }\n // `parentSlug` is normally basepath-RELATIVE (reconstructed from\n // scope/section slugs, which don't carry the basepath), but the\n // root/home product (`slug: /`) leaks the basepath into its scope\n // slug. Real route keys and the `routing` table are basepath-\n // ABSOLUTE (derived from each node's V1 accumulated slug, rooted at\n // `root.slug` = the basepath). Normalise the parent to relative,\n // then prefix the basepath exactly once so the synthetic redirect\n // key lines up with both the `routeContext` lookup\n // (`getLinkRedirectHref` queries the absolute request path) and the\n // `realRoutePaths` collision check below — otherwise a `/docs`\n // site's link redirects 404 and the real-page-wins dedup never\n // fires. Root sites (empty basepath) are unaffected: `joinPath`\n // drops the empty prefix.\n const relativeParent = toBasepathRelative(parentSlug, this.basePrefix);\n const fullPath = FernNavigationUtils.canonicalSlugKey(joinPath(this.basePrefix, relativeParent, segment));\n // Drop self-referential redirects (`docs/astro → /docs/astro`): they\n // 307-loop and shadow the real product/version node at that slug.\n // Without the synthetic row, `getLinkRedirectHref` misses and the\n // read path falls through to the node's `pointsTo` (its landing).\n if (internalHrefSlug(link.linkHref!) === fullPath) {\n continue;\n }\n this.linkRedirectCandidates.push({\n segmentHash,\n fullPath,\n href: link.linkHref!,\n redirectKind: \"link\"\n });\n }\n }\n\n /**\n * Emit routable `type:\"redirect\"` nav rows for every collected\n * {@link LinkRedirectCandidate}, applying ADR 0013's write-side dedup:\n * 1. A real page (or file / config-redirect route) at the same `full_path`\n * always wins — skip the synthetic redirect.\n * 2. Among synthetic redirects, first occurrence at a `full_path` wins\n * (deterministic, matching `collectLinkRedirects`'s `if (!out.has(...))`).\n *\n * Each surviving redirect produces a `type:\"redirect\"` artifact (no content;\n * `metadata.href` carries the target) attached to its owning segment via a\n * routable nav row — so `routeContext` resolves it inline (page:null,\n * artifactType:\"redirect\") and the read path issues a 307 to `href`.\n */\n private makeRedirectArtifact(\n candidate: Pick<LinkRedirectCandidate, \"href\" | \"redirectKind\" | \"structuralKind\">\n ): string {\n return this.addArtifact({\n type: \"redirect\",\n hidden: true,\n metadata: stripUndefined({\n href: candidate.href,\n redirectKind: candidate.redirectKind,\n structuralKind: candidate.structuralKind\n }),\n content: null\n });\n }\n\n private emitRedirectRoute(candidate: LinkRedirectCandidate): void {\n this.nav.push({\n segmentHash: candidate.segmentHash,\n artifactHash: this.makeRedirectArtifact(candidate),\n fullPath: candidate.fullPath\n });\n this.realRoutePaths.add(candidate.fullPath);\n }\n\n /**\n * Route keys are basepath-absolute. A `pointsTo` computed from a published\n * V1 slug that omitted the basepath would never match one, silently\n * dropping the node's structural redirect (its landing 404s), so re-apply\n * the prefix when it is missing.\n */\n private absolutizeSlug(slug: string): string {\n if (this.basePrefix === \"\" || slug === this.basePrefix || slug.startsWith(`${this.basePrefix}/`)) {\n return slug;\n }\n return joinPath(this.basePrefix, slug);\n }\n\n private resolveAbsolutePointsTo(node: V1Runtime.NavigationNode): string | undefined {\n const pointsTo = resolvePointsTo(node);\n return pointsTo != null ? this.absolutizeSlug(pointsTo) : undefined;\n }\n\n private queueStructuralRedirect(\n scope: Scope,\n v1Slug: string,\n href: string | undefined,\n overrideExistingRoute: boolean,\n structuralKind: StructuralRedirectKind\n ): void {\n const rawTarget = href != null ? internalHrefSlug(href) : undefined;\n if (href == null || rawTarget == null) {\n return;\n }\n const target = this.absolutizeSlug(rawTarget);\n const resolvedHref = target === rawTarget ? href : target;\n for (const fullPath of generateFullPathsFromV1Slug(scope, v1Slug, this.basePrefix)) {\n if (target !== fullPath) {\n this.structuralRedirectCandidates.push({\n fullPath,\n href: resolvedHref,\n overrideExistingRoute,\n structuralKind\n });\n }\n }\n }\n\n private dropRoutablePath(fullPath: string): void {\n for (let i = this.nav.length - 1; i >= 0; i--) {\n const entry = this.nav[i]!;\n if (entry.fullPath !== fullPath) {\n continue;\n }\n if (entry.displaySortOrder != null) {\n entry.fullPath = undefined;\n } else {\n this.nav.splice(i, 1);\n }\n }\n }\n\n private buildRouteToSegmentHash(): Map<string, string> {\n const routeToSegmentHash = new Map<string, string>();\n for (const entry of this.nav) {\n if (entry.fullPath != null) {\n routeToSegmentHash.set(entry.fullPath, entry.segmentHash);\n }\n }\n return routeToSegmentHash;\n }\n\n /**\n * Collapse default-version slugs out of a SITE-ROOT redirect target so the\n * `/` redirect points at the versionless canonical path (sibling to #13147). Applied\n * only to the site-root source; scoped redirect targets keep their full\n * slug. Idempotent when the target is already elided (`toDefaultSlug` is a\n * no-op once the version prefix is gone), so re-running it on a migrated\n * `rootPointsTo` that already elided the version does nothing.\n */\n private canonicalizeRootRedirectTarget(target: string): string {\n let result = target;\n for (const { from, to } of this.defaultVersionElisions) {\n result = toDefaultSlug(LatestSlug(result), LatestSlug(to), LatestSlug(from));\n }\n return result;\n }\n\n private flushStructuralRedirects(): void {\n const emitted = new Set<string>();\n const routeToSegmentHash = this.buildRouteToSegmentHash();\n for (const candidate of this.structuralRedirectCandidates) {\n const rawTarget = internalHrefSlug(candidate.href);\n // Only the SCOPED aliases (version/product/variant/tab/section) that\n // land on the site-root source (`fullPath === basePrefix`) get their\n // target version-elided: they carry a full, non-elided `pointsTo`, so\n // one elision produces the versionless path. The `\"root\"` candidate is\n // skipped — its target (`rootPointsTo`) is ALREADY canonical from the\n // migrate/pointsTo resolution, and re-eliding it can double-strip when\n // a non-version segment coincidentally shares the default version's\n // slug (e.g. a section slug equal to the version slug). Scoped sources\n // below basepath keep their full slug so version-scoped URLs still\n // redirect within their own version.\n const canonicalizeTarget = candidate.fullPath === this.basePrefix && candidate.structuralKind !== \"root\";\n const target =\n rawTarget != null && canonicalizeTarget ? this.canonicalizeRootRedirectTarget(rawTarget) : rawTarget;\n // A root target that collapses to the root itself is a self-redirect\n // (e.g. `/ → /latest-v-12` where the default version is elided to the\n // basepath). Drop it — the versionless route serves the root directly,\n // or a sibling elided alias fills the slot with a versionless target.\n if (target != null && target === candidate.fullPath) {\n continue;\n }\n const segmentHash = target != null ? routeToSegmentHash.get(target) : undefined;\n if (\n emitted.has(candidate.fullPath) ||\n segmentHash == null ||\n (!candidate.overrideExistingRoute && this.realRoutePaths.has(candidate.fullPath))\n ) {\n continue;\n }\n emitted.add(candidate.fullPath);\n if (candidate.overrideExistingRoute) {\n this.dropRoutablePath(candidate.fullPath);\n routeToSegmentHash.delete(candidate.fullPath);\n }\n this.emitRedirectRoute({\n segmentHash,\n fullPath: candidate.fullPath,\n // Emit the (possibly elided) target so the 307 Location is\n // versionless for the site root.\n href: canonicalizeTarget && target != null ? target : candidate.href,\n redirectKind: \"structural\",\n structuralKind: candidate.structuralKind\n });\n routeToSegmentHash.set(candidate.fullPath, segmentHash);\n }\n }\n\n private flushLinkRedirects(): void {\n const emitted = new Set<string>();\n for (const candidate of this.linkRedirectCandidates) {\n // Real-page-wins: never shadow a routable page/file/config redirect.\n if (this.realRoutePaths.has(candidate.fullPath)) {\n continue;\n }\n // First synthetic redirect at a given full_path wins.\n if (emitted.has(candidate.fullPath)) {\n continue;\n }\n emitted.add(candidate.fullPath);\n this.emitRedirectRoute(candidate);\n }\n }\n\n /**\n * Create a route-only segment: artifacts are routable by fullPath but have\n * no sidebar presence (no displaySortOrder). Used for infrastructure segments\n * like files that should be findable by path but invisible in nav chrome.\n */\n createRouteOnlySegment(metadata: LedgerSegmentMetadata, collected: CollectedArtifact[]): void {\n if (collected.length === 0) {\n return;\n }\n\n const artifactHashes = collected.map((a) => a.artifactHash);\n const routes: Array<{ fullPath: string; artifactHash: string }> = [];\n for (const a of collected) {\n routes.push({ artifactHash: a.artifactHash, fullPath: a.slug });\n this.realRoutePaths.add(a.slug);\n }\n\n const segmentHash = hashSegment({\n locale: this.locale,\n productHash: undefined,\n versionHash: undefined,\n variantHash: undefined,\n tabHash: undefined,\n section: \"\",\n metadata,\n hidden: true,\n artifactHashes,\n displaySortOrder: [],\n routes\n });\n\n this.segments.push({\n hash: segmentHash,\n locale: this.locale,\n section: \"\",\n metadata,\n hidden: true\n });\n\n // Route-only nav: fullPath set, no displaySortOrder\n for (const r of routes) {\n this.nav.push({\n segmentHash,\n artifactHash: r.artifactHash,\n fullPath: r.fullPath\n });\n }\n\n this.segmentOrder.push(segmentHash);\n }\n\n /**\n * Build nav entries for a segment. Each artifact gets a sidebar entry\n * (with displaySortOrder); each route gets a routable entry (with fullPath).\n * Canonical routes (first per artifact) merge both into a single row.\n *\n * @param navPaths - Maps artifactHash → its first computed fullPath (for\n * sidebar display), even if that path was deduped from the routes array\n * by the cross-segment first-writer-wins guard. This ensures every\n * artifact's sidebar entry gets a valid href.\n *\n * `sidebarPaths` carries the primary fullPath for each artifact computed\n * BEFORE first-writer-wins route dedup. When an artifact's routes are all\n * claimed by a previously-walked segment (e.g. two \"Redirects\" API\n * subsections sharing the same endpoint slugs), the sidebar entry still\n * receives the correct fullPath so the nav link renders the right href\n * instead of falling back to \"/\". This matches v2 behavior.\n */\n private buildNavEntries(\n segmentHash: string,\n collected: CollectedArtifact[],\n routes: Array<{ fullPath: string; artifactHash: string }>,\n sidebarPaths: Map<string, string>\n ): void {\n // Determine canonical path for each artifact (first route wins)\n const canonicalPaths = new Map<string, string>();\n for (const r of routes) {\n if (!canonicalPaths.has(r.artifactHash)) {\n canonicalPaths.set(r.artifactHash, r.fullPath);\n }\n }\n\n const coveredRoutes = new Set<string>();\n\n // Sidebar entries: one per artifact in order.\n // Canonical routes get both fullPath and displaySortOrder in one row.\n // When an artifact has no canonical route (all deduped), fall back to\n // sidebarPaths so the nav link still has the correct href.\n for (let ai = 0; ai < collected.length; ai++) {\n const a = collected[ai]!;\n const canonicalPath = canonicalPaths.get(a.artifactHash) ?? sidebarPaths.get(a.artifactHash);\n\n this.nav.push({\n segmentHash,\n artifactHash: a.artifactHash,\n fullPath: canonicalPath,\n displaySortOrder: a.childPosition ?? ai\n });\n\n if (canonicalPath != null) {\n coveredRoutes.add(`${segmentHash}:${a.artifactHash}:${canonicalPath}`);\n }\n }\n\n // Route-only entries: non-canonical routes not already covered\n for (const r of routes) {\n const key = `${segmentHash}:${r.artifactHash}:${r.fullPath}`;\n if (!coveredRoutes.has(key)) {\n this.nav.push({\n segmentHash,\n artifactHash: r.artifactHash,\n fullPath: r.fullPath\n });\n coveredRoutes.add(key);\n }\n }\n }\n\n // ── Artifact factories ────────────────────────────────────────────\n\n /**\n * Resolve a page blob ref from the input's pages map.\n * Throws if the pageId is not present — callers must supply all referenced pages.\n */\n private resolvePageBlobRef(pageId: string): BlobRef {\n const ref = this.pages[pageId];\n if (ref != null) {\n return ref;\n }\n throw new ORPCError(\"BAD_REQUEST\", {\n message: `Page \"${pageId}\" is referenced in the nav tree but missing from input.pages`\n });\n }\n\n makePageArtifact(\n pageId: string,\n node: V1.WithNodeMetadata & Partial<V1.WithPage> & { availability?: string | undefined },\n slugPrefix: string\n ): CollectedArtifact {\n const slug = extractSlugSegment(String(node.slug), slugPrefix);\n\n const artifactHash = this.addArtifact({\n type: \"markdown\",\n hidden: node.hidden ?? false,\n metadata: stripUndefined({\n title: node.title,\n slug,\n icon: node.icon,\n authed: node.authed,\n pageId,\n noindex: node.noindex,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags,\n availability: node.availability\n }),\n content: this.resolvePageBlobRef(pageId)\n });\n\n return { artifactHash, slug, isLink: false, v1Slug: String(node.slug) };\n }\n\n makeOverviewArtifact(\n pageId: string,\n parentNode: V1.WithNodeMetadata & Partial<V1.WithOverviewPage>\n ): CollectedArtifact {\n const artifactHash = this.addArtifact({\n type: \"markdown\",\n hidden: parentNode.hidden ?? false,\n metadata: stripUndefined({\n title: parentNode.title,\n slug: \"\",\n icon: parentNode.icon,\n authed: parentNode.authed,\n pageId,\n isOverview: true,\n noindex: parentNode.noindex,\n viewers: parentNode.viewers,\n orphaned: parentNode.orphaned,\n featureFlags: parentNode.featureFlags\n }),\n content: this.resolvePageBlobRef(pageId)\n });\n\n // slug \"\" means the route resolves to the section path itself\n return { artifactHash, slug: \"\", isLink: false, v1Slug: String(parentNode.slug) };\n }\n\n /**\n * Create a CAS artifact for an API node (endpoint, websocket, webhook, grpc, graphql).\n * All API artifact types share the same structure: extract slug, track API def,\n * build metadata from the node's common fields + type-specific extras, prune\n * content. `buildArtifact` receives the common metadata fields and returns the\n * fully-discriminated `type`/`metadata` pair, so each artifact type's required\n * metadata is checked against its schema-derived type at the call site.\n */\n private makeApiArtifact(\n // `playground` lives on the endpoint/webSocket/apiReference variants but not on\n // the shared `WithNodeMetadata & WithApiDefinitionId` type, so declare it optionally.\n node: V1.WithNodeMetadata & V1.WithApiDefinitionId & { playground?: V1.PlaygroundSettings; noindex?: boolean },\n slugPrefix: string,\n buildArtifact: (common: ApiArtifactCommonMetadata) => ApiArtifactTypeMetadata,\n pruneNode: PruningNodeType\n ): CollectedArtifact {\n const slug = extractSlugSegment(String(node.slug), slugPrefix);\n const apiDefId = String(node.apiDefinitionId);\n this.trackApiDefinition(apiDefId);\n\n const artifactHash = this.addArtifact({\n ...buildArtifact(\n stripUndefined({\n title: node.title,\n slug,\n icon: node.icon,\n authed: node.authed,\n apiDefinitionId: apiDefId,\n availability: node.availability,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags,\n playground: toLedgerPlayground(node.playground),\n noindex: node.noindex\n })\n ),\n hidden: node.hidden ?? false,\n content: this.pruneApiContent(apiDefId, pruneNode)\n });\n\n return { artifactHash, slug, isLink: false, v1Slug: String(node.slug) };\n }\n\n makeEndpointArtifact(\n node: V1.EndpointNode,\n slugPrefix: string,\n endpointPairKey?: string,\n isResponseStream?: boolean\n ): CollectedArtifact {\n const resolvedIsResponseStream = isResponseStream ?? node.isResponseStream;\n const resolvedEndpointPairKey =\n endpointPairKey ?? (node as V1.EndpointNode & { endpointPairKey?: string }).endpointPairKey;\n return this.makeApiArtifact(\n node,\n slugPrefix,\n (common) => ({\n type: \"rest\",\n metadata: {\n ...common,\n endpointId: String(node.endpointId),\n method: node.method,\n ...(resolvedIsResponseStream !== undefined ? { isResponseStream: resolvedIsResponseStream } : {}),\n ...(resolvedEndpointPairKey != null ? { endpointPairKey: resolvedEndpointPairKey } : {})\n }\n }),\n { type: \"endpoint\", endpointId: node.endpointId }\n );\n }\n\n makeWebSocketArtifact(node: V1.WebSocketNode, slugPrefix: string): CollectedArtifact {\n return this.makeApiArtifact(\n node,\n slugPrefix,\n (common) => ({ type: \"asyncapi\", metadata: { ...common, webSocketId: String(node.webSocketId) } }),\n { type: \"webSocket\", webSocketId: node.webSocketId }\n );\n }\n\n makeWebhookArtifact(node: V1.WebhookNode, slugPrefix: string): CollectedArtifact {\n return this.makeApiArtifact(\n node,\n slugPrefix,\n (common) => ({\n type: \"webhook\",\n metadata: { ...common, webhookId: String(node.webhookId), method: node.method }\n }),\n { type: \"webhook\", webhookId: node.webhookId }\n );\n }\n\n makeGrpcArtifact(node: V1.GrpcNode, slugPrefix: string): CollectedArtifact {\n return this.makeApiArtifact(\n node,\n slugPrefix,\n (common) => ({ type: \"grpc\", metadata: { ...common, grpcId: String(node.grpcId), method: node.method } }),\n { type: \"grpc\", grpcId: node.grpcId }\n );\n }\n\n makeGraphQlArtifact(node: V1.GraphQlNode, slugPrefix: string): CollectedArtifact {\n // Resolve operationType from the V1 node first, falling back to the\n // authoritative API definition when the node field is missing at\n // runtime (e.g. older V1 trees that pre-date the field).\n const operationType =\n node.operationType ??\n this.apiManifest[String(node.apiDefinitionId)]?.graphqlOperations[String(node.graphqlOperationId)]\n ?.operationType;\n return this.makeApiArtifact(\n node,\n slugPrefix,\n (common) => ({\n type: \"graphql\",\n metadata: {\n ...common,\n graphqlOperationId: String(node.graphqlOperationId),\n operationType\n }\n }),\n { type: \"graphql\", graphqlOperationId: node.graphqlOperationId }\n );\n }\n\n makeGraphQlTypeArtifact(node: V1.GraphQlTypeNode, slugPrefix: string): CollectedArtifact {\n // `typeCategory` cannot be recovered from the API definition — the FDR type\n // model has no GraphQL kind — and there is no manifest fallback of the sort\n // `makeGraphQlArtifact` uses for `operationType`. So a missing or misspelled\n // category has no repair path: reject it here, where the message names the\n // offending node, rather than letting it reach the ledger and silently drop\n // the page out of the sidebar at read time (see `apiLeafNodeFromNavRouteInternal`).\n const typeCategory = GraphQlTypeCategorySchema.safeParse(node.typeCategory);\n if (!typeCategory.success) {\n throw new ORPCError(\"BAD_REQUEST\", {\n message:\n `graphqlType node \"${String(node.slug)}\" (typeId \"${String(node.typeId)}\") has ` +\n `an invalid typeCategory ${JSON.stringify(node.typeCategory)}; expected one of ` +\n `${GraphQlTypeCategorySchema.options.join(\", \")}`\n });\n }\n return this.makeApiArtifact(\n node,\n slugPrefix,\n (common) => ({\n type: \"graphqlType\",\n metadata: {\n ...common,\n typeId: String(node.typeId),\n typeCategory: typeCategory.data\n }\n }),\n { type: \"graphqlType\", typeId: node.typeId }\n );\n }\n\n makeLinkArtifact(node: V1.LinkNode): CollectedArtifact {\n // Links are sidebar-only chrome — no CAS content, just metadata.\n const artifactHash = this.addArtifact({\n type: \"link\",\n hidden: false,\n metadata: stripUndefined({\n title: node.title,\n slug: \"\",\n icon: node.icon,\n url: String(node.url),\n target: node.target\n }),\n content: null\n });\n\n // Links don't contribute to their own page route (slug is empty), but\n // they do get a synthetic `type:\"redirect\"` route emitted at the end of\n // the walk — see {@link createSegment} / {@link buildResult}.\n return { artifactHash, slug: \"\", isLink: true, linkTitle: node.title, linkHref: String(node.url) };\n }\n\n makeChangelogEntryArtifact(node: V1.ChangelogEntryNode, slugPrefix: string): CollectedArtifact {\n const pageId = String(node.pageId);\n const slug = extractSlugSegment(String(node.slug), slugPrefix);\n\n const artifactHash = this.addArtifact({\n type: \"changelog\",\n hidden: node.hidden ?? false,\n metadata: stripUndefined({\n title: node.title,\n slug,\n icon: node.icon,\n authed: node.authed,\n pageId,\n noindex: node.noindex,\n date: node.date,\n tags: node.tags,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n }),\n content: this.resolvePageBlobRef(pageId)\n });\n\n return { artifactHash, slug, isLink: false, v1Slug: String(node.slug) };\n }\n\n /**\n * Create a file or image artifact from a fileManifest entry.\n * Files use type \"file\", images (entries with width/height) use type \"image\".\n *\n * File bytes land in the public/private docs bucket (not CAS); the\n * artifact's `fileKey` resolves to a `docs_ledger_file` row during\n * publish. The transform also records a {@link TransformFileEntry} so\n * the register handler can issue presigned upload URLs and the finish\n * handler can upsert the file row.\n */\n makeFileArtifact(fullPath: string, entry: FileManifestEntry): CollectedArtifact {\n const isImage = entry.width != null && entry.height != null;\n const type = isImage ? \"image\" : \"file\";\n\n const metadata: FileArtifactMetadata = {\n contentType: entry.contentType,\n contentLength: entry.contentLength,\n filename: entry.filename,\n width: entry.width,\n height: entry.height,\n blurDataURL: entry.blurDataURL\n };\n\n this.addFileEntry({\n fullPath,\n hash: entry.hash,\n contentType: entry.contentType,\n contentLength: entry.contentLength,\n filename: entry.filename,\n width: entry.width,\n height: entry.height,\n blurDataURL: entry.blurDataURL\n });\n\n const artifactHash = this.addArtifact({\n type,\n hidden: true,\n metadata: stripUndefined(metadata),\n content: null,\n fileKey: { hash: entry.hash, fullPath }\n });\n\n // slug is the fullPath itself — nav routing uses fullPath directly\n return { artifactHash, slug: fullPath, isLink: false };\n }\n\n // ── Tree walking ──────────────────────────────────────────────────\n //\n // Depth-first walk of the V1 nav tree. Each level refines the Scope\n // (product → version → variant → tab) and accumulates artifacts into\n // segments. The walk order matches sidebar display order.\n\n /** Entry point: walk the root node and dispatch to its single child. */\n walkRoot(root: V1.RootNode): void {\n const slugPrefix = String(root.slug);\n // The root slug IS the deployment basepath; remember it so synthetic\n // link-redirect keys can be made absolute to match real route keys.\n this.basePrefix = slugPrefix;\n this.rootPointsTo = root.pointsTo ?? resolveRootPointsTo(root);\n this.queueStructuralRedirect({ ...EMPTY_SCOPE }, slugPrefix, this.rootPointsTo, false, \"root\");\n this.walkRootChild(root.child, { ...EMPTY_SCOPE }, slugPrefix);\n }\n\n private walkRootChild(child: V1.RootChild, scope: Scope, slugPrefix: string): void {\n switch (child.type) {\n case \"productgroup\":\n this.walkProductGroup(child, scope, slugPrefix);\n break;\n case \"versioned\":\n this.walkVersioned(child, scope, slugPrefix);\n break;\n case \"unversioned\":\n this.walkUnversioned(child, scope, slugPrefix);\n break;\n }\n }\n\n /** Walk a product group: create segment details per product, recurse into each product's children. */\n private walkProductGroup(node: V1.ProductGroupNode, scope: Scope, slugPrefix: string): void {\n // Landing page at the product group level -- uses tabRoot segment type\n if (node.landingPage) {\n const artifacts = [this.makePageArtifact(String(node.landingPage.pageId), node.landingPage, slugPrefix)];\n this.createSegment(scope, \"\", { type: \"tabRoot\", landingPage: true }, artifacts, false);\n }\n\n for (let i = 0; i < node.children.length; i++) {\n const product = node.children[i]!;\n\n if (product.hidden !== true) {\n this.siteProducts.push(\n stripUndefined({\n title: product.title,\n href: product.type === \"productLink\" ? String(product.href) : `/${String(product.slug)}/`,\n subtitle: product.subtitle !== \"\" ? product.subtitle : undefined\n })\n );\n }\n\n if (product.type === \"productLink\") {\n // External product -- create segment detail for chrome (product switcher)\n // and a marker segment so the detail is discoverable via the\n // segment→detail join in the read path.\n const detailHash = this.addSegmentDetail({\n type: \"product\",\n displayName: product.title,\n icon: product.icon,\n sortOrder: i,\n metadata: stripUndefined({\n default: product.default,\n subtitle: product.subtitle,\n href: String(product.href),\n target: product.target,\n image: product.image ? String(product.image) : undefined\n }),\n hidden: product.hidden ?? false,\n viewers: product.viewers?.map(String) ?? [],\n orphaned: product.orphaned ?? false,\n featureFlags: []\n });\n\n const markerScope: Scope = {\n ...scope,\n productHash: detailHash,\n productSlug: undefined,\n productDefault: product.default\n };\n this.createSegment(markerScope, \"\", { type: \"productLink\" }, [], product.hidden ?? false);\n continue;\n }\n\n const individualSlug = extractSlugSegment(String(product.slug), slugPrefix, this.basePrefix);\n const detailHash = this.addSegmentDetail({\n type: \"product\",\n displayName: product.title,\n icon: product.icon,\n sortOrder: i,\n metadata: stripUndefined({\n slug: individualSlug,\n default: product.default,\n subtitle: product.subtitle,\n image: product.image ? String(product.image) : undefined,\n announcementText: product.announcement?.text,\n pointsTo: this.resolveAbsolutePointsTo(product)\n }),\n hidden: product.hidden ?? false,\n viewers: product.viewers?.map(String) ?? [],\n orphaned: product.orphaned ?? false,\n featureFlags: product.featureFlags?.map(String) ?? []\n });\n\n const productScope: Scope = {\n ...scope,\n productHash: detailHash,\n productSlug: individualSlug,\n productDefault: product.default\n };\n\n this.queueStructuralRedirect(\n productScope,\n String(product.slug),\n this.resolveAbsolutePointsTo(product),\n true,\n \"product\"\n );\n this.walkProductChild(product.child, productScope, String(product.slug));\n }\n\n if (node.changelog) {\n this.walkChangelog(node.changelog, scope, slugPrefix, \"\");\n }\n }\n\n private walkProductChild(child: V1.ProductChild, scope: Scope, slugPrefix: string): void {\n switch (child.type) {\n case \"versioned\":\n this.walkVersioned(child, scope, slugPrefix);\n break;\n case \"unversioned\":\n this.walkUnversioned(child, scope, slugPrefix);\n break;\n }\n }\n\n /** Walk a versioned node: create segment details per version, handle landing pages, recurse. */\n private walkVersioned(node: V1.VersionedNode, scope: Scope, slugPrefix: string): void {\n for (let i = 0; i < node.children.length; i++) {\n const version = node.children[i]!;\n const individualSlug = extractSlugSegment(String(version.slug), slugPrefix, this.basePrefix);\n const detailHash = this.addSegmentDetail({\n type: \"version\",\n displayName: version.title,\n icon: version.icon,\n sortOrder: i,\n metadata: stripUndefined({\n slug: individualSlug,\n default: version.default,\n availability: version.availability,\n announcementText: version.announcement?.text,\n pointsTo: this.resolveAbsolutePointsTo(version)\n }),\n hidden: version.hidden ?? false,\n viewers: version.viewers?.map(String) ?? [],\n orphaned: version.orphaned ?? false,\n featureFlags: version.featureFlags?.map(String) ?? []\n });\n\n const versionScope: Scope = {\n ...scope,\n versionHash: detailHash,\n versionSlug: individualSlug,\n versionDefault: version.default\n };\n\n // Record the default version's slug elision so the site-root\n // redirect target collapses to the versionless path (sibling to #13147).\n // `slugPrefix` is the enclosing scope (product slug or deployment\n // basepath), which is exactly the replacement `toDefaultSlug` uses.\n if (version.default) {\n this.defaultVersionElisions.push({ from: String(version.slug), to: slugPrefix });\n }\n\n if (!version.landingPage) {\n this.queueStructuralRedirect(\n versionScope,\n String(version.slug),\n this.resolveAbsolutePointsTo(version),\n true,\n \"version\"\n );\n }\n\n // Version-level landing page -- uses tabRoot segment type\n if (version.landingPage) {\n const artifacts = [\n this.makePageArtifact(String(version.landingPage.pageId), version.landingPage, String(version.slug))\n ];\n this.createSegment(versionScope, \"\", { type: \"tabRoot\", landingPage: true }, artifacts, false);\n }\n\n this.walkVersionChild(version.child, versionScope, String(version.slug));\n }\n }\n\n private walkUnversioned(node: V1.UnversionedNode, scope: Scope, slugPrefix: string): void {\n if (node.landingPage) {\n const artifacts = [this.makePageArtifact(String(node.landingPage.pageId), node.landingPage, slugPrefix)];\n this.createSegment(scope, \"\", { type: \"tabRoot\", landingPage: true }, artifacts, false);\n }\n\n this.walkVersionChild(node.child, scope, slugPrefix);\n }\n\n private walkVersionChild(child: V1.VersionChild, scope: Scope, slugPrefix: string): void {\n switch (child.type) {\n case \"tabbed\":\n this.walkTabbed(child, scope, slugPrefix);\n break;\n case \"sidebarRoot\":\n this.walkSidebarRoot(child, scope, slugPrefix);\n break;\n case \"varianted\":\n this.walkVarianted(child, scope, slugPrefix);\n break;\n }\n }\n\n /** Walk a tabbed node: create segment details per tab, handle tab-level links and changelogs. */\n private walkTabbed(node: V1.TabbedNode, scope: Scope, slugPrefix: string): void {\n for (let i = 0; i < node.children.length; i++) {\n const tabChild = node.children[i]!;\n\n switch (tabChild.type) {\n case \"tab\": {\n const individualSlug = extractSlugSegment(String(tabChild.slug), slugPrefix, this.basePrefix);\n const detailHash = this.addSegmentDetail({\n type: \"tab\",\n displayName: tabChild.title,\n icon: tabChild.icon,\n sortOrder: i,\n metadata: stripUndefined({\n slug: individualSlug,\n pointsTo: this.resolveAbsolutePointsTo(tabChild),\n tab_type: \"tab\" as const\n }) as LedgerSegmentDetailMetadata,\n hidden: tabChild.hidden ?? false,\n viewers: tabChild.viewers?.map(String) ?? [],\n orphaned: tabChild.orphaned ?? false,\n featureFlags: tabChild.featureFlags?.map(String) ?? []\n });\n\n const tabScope: Scope = {\n ...scope,\n tabHash: detailHash,\n tabSlug: individualSlug\n };\n\n // A skip-slug tab (slug === enclosing slug) shares the base\n // path with its sibling tabs and the root. It must NOT emit a\n // route-OVERRIDING redirect there: doing so drops a real page\n // that legitimately lives at that path (e.g. the first tab's\n // landing / root overview). Use a non-destructive redirect so\n // it only fills the base path when nothing real occupies it.\n // Tabs that contribute their own slug segment keep the\n // overriding behavior (their tab-root is theirs to claim).\n this.queueStructuralRedirect(\n tabScope,\n String(tabChild.slug),\n this.resolveAbsolutePointsTo(tabChild),\n String(tabChild.slug) !== slugPrefix,\n \"tab\"\n );\n this.walkSidebarRoot(tabChild.child, tabScope, String(tabChild.slug));\n break;\n }\n case \"link\": {\n // Tab-level link -- no sidebar content, just a detail for the chrome\n // and a marker segment so the detail is discoverable via the\n // segment→detail join in the read path.\n const linkDetailHash = this.addSegmentDetail({\n type: \"tab\",\n displayName: tabChild.title,\n icon: tabChild.icon,\n sortOrder: i,\n metadata: stripUndefined({\n url: String(tabChild.url),\n target: tabChild.target,\n tab_type: \"link\" as const\n }) as LedgerSegmentDetailMetadata,\n hidden: false,\n viewers: [],\n orphaned: false,\n featureFlags: []\n });\n\n const linkTabScope: Scope = { ...scope, tabHash: linkDetailHash };\n this.createSegment(linkTabScope, \"\", { type: \"tabLink\" }, [], false);\n break;\n }\n case \"changelog\": {\n const individualSlug = extractSlugSegment(String(tabChild.slug), slugPrefix, this.basePrefix);\n const detailHash = this.addSegmentDetail({\n type: \"tab\",\n displayName: tabChild.title,\n icon: tabChild.icon,\n sortOrder: i,\n metadata: stripUndefined({\n slug: individualSlug,\n pointsTo: this.resolveAbsolutePointsTo(tabChild),\n tab_type: \"changelog\" as const\n }) as LedgerSegmentDetailMetadata,\n hidden: tabChild.hidden ?? false,\n viewers: tabChild.viewers?.map(String) ?? [],\n orphaned: tabChild.orphaned ?? false,\n featureFlags: tabChild.featureFlags?.map(String) ?? []\n });\n\n const tabScope: Scope = {\n ...scope,\n tabHash: detailHash,\n tabSlug: individualSlug\n };\n\n // See the skip-slug rationale in the \"tab\" case above.\n this.queueStructuralRedirect(\n tabScope,\n String(tabChild.slug),\n this.resolveAbsolutePointsTo(tabChild),\n String(tabChild.slug) !== slugPrefix,\n \"tab\"\n );\n this.walkChangelog(tabChild, tabScope, String(tabChild.slug), \"\");\n break;\n }\n }\n }\n }\n\n // ── Variant walking ──────────────────────────────────────────────\n\n /**\n * Walk a varianted node (used both at version-level and inside sidebars).\n * Each variant becomes a segment detail + scoped child walk.\n */\n private walkVarianted(node: V1.VariantedNode, scope: Scope, slugPrefix: string): void {\n for (let i = 0; i < node.children.length; i++) {\n const variant = node.children[i]!;\n const individualSlug = extractSlugSegment(String(variant.slug), slugPrefix, this.basePrefix);\n const detailHash = this.addSegmentDetail({\n type: \"variant\",\n displayName: variant.title,\n icon: variant.icon,\n sortOrder: i,\n metadata: stripUndefined({\n slug: individualSlug,\n default: variant.default,\n subtitle: variant.subtitle,\n image: variant.image ? String(variant.image) : undefined,\n pointsTo: this.resolveAbsolutePointsTo(variant)\n }),\n hidden: variant.hidden ?? false,\n viewers: variant.viewers?.map(String) ?? [],\n orphaned: variant.orphaned ?? false,\n featureFlags: variant.featureFlags?.map(String) ?? []\n });\n\n const variantScope: Scope = {\n ...scope,\n variantHash: detailHash,\n variantSlug: individualSlug,\n variantDefault: variant.default\n };\n\n this.queueStructuralRedirect(\n variantScope,\n String(variant.slug),\n this.resolveAbsolutePointsTo(variant),\n true,\n \"variant\"\n );\n this.walkVariantChildren(variant.children, variantScope, String(variant.slug));\n }\n }\n\n private walkVariantChildren(children: V1.VariantChild[], scope: Scope, slugPrefix: string): void {\n // Pass 1: collect leaf artifacts (pages, links; recurse into sidebar groups).\n // Use a running offset so childPosition is globally unique across\n // sidebarGroups (same fix as walkSidebarRoot).\n const rootArtifacts: CollectedArtifact[] = [];\n let offset = 0;\n for (const child of children) {\n switch (child.type) {\n case \"page\": {\n const a = this.makePageArtifact(String(child.pageId), child, slugPrefix);\n a.childPosition = offset;\n rootArtifacts.push(a);\n offset++;\n break;\n }\n case \"link\": {\n const a = this.makeLinkArtifact(child);\n a.childPosition = offset;\n rootArtifacts.push(a);\n offset++;\n break;\n }\n case \"sidebarGroup\": {\n const leaves = this.collectNavLeaves(child.children, slugPrefix);\n for (const leaf of leaves) {\n if (leaf.childPosition != null) {\n leaf.childPosition += offset;\n }\n }\n rootArtifacts.push(...leaves);\n offset += child.children.length;\n break;\n }\n default:\n offset++;\n break;\n }\n }\n\n if (rootArtifacts.length > 0) {\n this.createSegment(\n scope,\n \"\",\n stripUndefined({\n type: \"tabRoot\",\n pointsTo:\n scope.productHash == null &&\n scope.versionHash == null &&\n scope.variantHash == null &&\n scope.tabHash == null\n ? this.rootPointsTo\n : undefined\n }),\n rootArtifacts,\n false\n );\n }\n\n // Pass 2: walk sub-trees (sections, API refs, changelogs; recurse into sidebar groups).\n // sidebarDepth=0 marks these as root-level peers so the read side\n // does not infer parent-child relationships from slug prefixes.\n //\n // Direct children (not in a sidebarGroup) with skipUrlSlug\n // (slug === parent slug) must keep childIndex=undefined so the\n // read-side hasTrueRootWrapper detection is preserved. Non-skip\n // children get the global offset for correct interleaving.\n offset = 0;\n for (const child of children) {\n switch (child.type) {\n case \"section\": {\n const skip = String(child.slug) === slugPrefix;\n this.walkSection(child, scope, slugPrefix, \"\", skip ? undefined : offset, 0);\n offset++;\n break;\n }\n case \"apiReference\": {\n const skip = String(child.slug) === slugPrefix;\n this.walkApiSection(child, scope, slugPrefix, \"\", skip ? undefined : offset, 0);\n offset++;\n break;\n }\n case \"changelog\":\n this.walkChangelog(child, scope, slugPrefix, \"\");\n offset++;\n break;\n case \"sidebarGroup\":\n this.walkNavSubTrees(child.children, scope, slugPrefix, \"\", 0, offset);\n offset += child.children.length;\n break;\n default:\n offset++;\n break;\n }\n }\n }\n\n // ── Sidebar walking ───────────────────────────────────────────────\n\n /**\n * Walk the sidebar root: two-pass approach ensures the root segment is\n * created before child segments (correct sidebar ordering).\n */\n private walkSidebarRoot(node: V1.SidebarRootNode, scope: Scope, slugPrefix: string): void {\n // Pass 1: collect leaf artifacts from sidebar groups. Sidebar roots\n // cannot contain pages/links directly in V1, but sidebar-group leaves\n // still belong to the root segment and participate in root redirect\n // behavior.\n //\n // When non-collapsible sections sit between sidebarGroups at the\n // sidebarRoot level, groupSidebarRootChildren splits pages into\n // multiple sidebarGroups. Each group's collectNavLeaves resets\n // childPosition to 0, causing displaySortOrder collisions in the\n // tabRoot segment. Track a running offset so every child gets a\n // globally-unique position that the read-side interleave can sort.\n const rootArtifacts: CollectedArtifact[] = [];\n let offset = 0;\n for (const child of node.children) {\n if (child.type === \"sidebarGroup\") {\n const leaves = this.collectNavLeaves(child.children, slugPrefix);\n for (const leaf of leaves) {\n if (leaf.childPosition != null) {\n leaf.childPosition += offset;\n }\n }\n rootArtifacts.push(...leaves);\n offset += child.children.length;\n } else {\n offset++;\n }\n }\n\n if (rootArtifacts.length > 0) {\n this.createSegment(\n scope,\n \"\",\n stripUndefined({\n type: \"tabRoot\",\n pointsTo:\n scope.productHash == null &&\n scope.versionHash == null &&\n scope.variantHash == null &&\n scope.tabHash == null\n ? this.rootPointsTo\n : undefined\n }),\n rootArtifacts,\n false\n );\n }\n\n // Pass 2: walk sub-trees in child order with global offsets so\n // section childIndex values align with the leaf displaySortOrder\n // values from Pass 1, enabling correct interleaving on the read side.\n offset = 0;\n for (const child of node.children) {\n switch (child.type) {\n case \"sidebarGroup\":\n this.walkNavSubTrees(child.children, scope, slugPrefix, \"\", 0, offset);\n offset += child.children.length;\n break;\n case \"section\": {\n const skip = String(child.slug) === slugPrefix;\n this.walkSection(child, scope, slugPrefix, \"\", skip ? undefined : offset, 0);\n offset++;\n break;\n }\n case \"apiReference\": {\n const skip = String(child.slug) === slugPrefix;\n this.walkApiSection(child, scope, slugPrefix, \"\", skip ? undefined : offset, 0);\n offset++;\n break;\n }\n case \"varianted\":\n this.walkVarianted(child, scope, slugPrefix);\n offset++;\n break;\n }\n }\n }\n\n /** Collect leaf artifacts (pages, links) from navigation children, tracking position. */\n private collectNavLeaves(\n children: V1.NavigationChild[],\n slugPrefix: string,\n overviewPageId?: string\n ): CollectedArtifact[] {\n const artifacts: CollectedArtifact[] = [];\n for (let i = 0; i < children.length; i++) {\n const child = children[i]!;\n switch (child.type) {\n case \"page\": {\n const pageId = String(child.pageId);\n if (overviewPageId != null && pageId === overviewPageId) {\n break;\n }\n const a = this.makePageArtifact(pageId, child, slugPrefix);\n a.childPosition = i;\n artifacts.push(a);\n break;\n }\n case \"link\": {\n const a = this.makeLinkArtifact(child);\n a.childPosition = i;\n artifacts.push(a);\n break;\n }\n }\n }\n return artifacts;\n }\n\n /** Walk sub-tree navigation children (sections, API refs, changelogs, variants). */\n private walkNavSubTrees(\n children: V1.NavigationChild[],\n scope: Scope,\n slugPrefix: string,\n parentSectionPath: string,\n sidebarDepth?: number,\n childIndexOffset?: number\n ): void {\n const base = childIndexOffset ?? 0;\n for (let i = 0; i < children.length; i++) {\n const child = children[i]!;\n switch (child.type) {\n case \"section\":\n this.walkSection(child, scope, slugPrefix, parentSectionPath, base + i, sidebarDepth);\n break;\n case \"apiReference\":\n this.walkApiSection(child, scope, slugPrefix, parentSectionPath, base + i, sidebarDepth);\n break;\n case \"changelog\":\n this.walkChangelog(child, scope, slugPrefix, parentSectionPath, undefined, base + i);\n break;\n case \"varianted\":\n this.walkVarianted(child, scope, slugPrefix);\n break;\n }\n }\n }\n\n /** Walk a section: collect overview + leaf children, create segment, then walk sub-trees. */\n private walkSection(\n node: V1.SectionNode,\n scope: Scope,\n slugPrefix: string,\n parentSectionPath: string,\n childIndex?: number,\n sidebarDepth?: number\n ): void {\n const individualSlug = extractSlugSegment(String(node.slug), slugPrefix);\n const effectiveSlug =\n individualSlug === \"\" && childIndex != null\n ? `${FernNavigationUtils.SKIP_URL_SLUG_PREFIX}${childIndex}`\n : individualSlug;\n const sectionPath = appendSectionPath(parentSectionPath, effectiveSlug);\n const currentPrefix = String(node.slug);\n\n const pointsTo = node.pointsTo != null ? String(node.pointsTo) : resolvePointsTo(node);\n this.queueStructuralRedirect(scope, String(node.slug), pointsTo, false, \"section\");\n\n const ovPageId = node.overviewPageId ? String(node.overviewPageId) : undefined;\n // Overview occupies position -1 so it sorts before children (whose\n // childPosition starts at 0) without colliding in displaySortOrder.\n const sectionArtifacts = [\n ...(ovPageId != null ? [{ ...this.makeOverviewArtifact(ovPageId, node), childPosition: -1 }] : []),\n ...this.collectNavLeaves(node.children, currentPrefix, ovPageId)\n ];\n\n const hasSubTrees = node.children.some(\n (c) => c.type === \"section\" || c.type === \"apiReference\" || c.type === \"changelog\"\n );\n if (sectionArtifacts.length > 0 || hasSubTrees) {\n this.createSegment(\n scope,\n sectionPath,\n stripUndefined({\n type: \"section\",\n title: node.title,\n icon: node.icon,\n authed: node.authed,\n collapsed: node.collapsed,\n collapsible: node.collapsible,\n collapsedByDefault: node.collapsedByDefault,\n availability: node.availability,\n overviewPageId: node.overviewPageId ? String(node.overviewPageId) : undefined,\n noindex: node.noindex,\n pointsTo,\n childIndex,\n sidebarDepth,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n }),\n sectionArtifacts,\n node.hidden ?? false\n );\n }\n\n const nextDepth = sidebarDepth != null ? sidebarDepth + 1 : undefined;\n this.walkNavSubTrees(node.children, scope, currentPrefix, sectionPath, nextDepth);\n }\n\n // ── API reference / package walking ───────────────────────────────\n\n /**\n * Walk an API reference or API package node. Both share the same structure:\n * compute section path, track API def, collect overview + leaf children,\n * create segment, then walk sub-packages and changelog.\n */\n private walkApiSection(\n node: V1.ApiReferenceNode | V1.ApiPackageNode,\n scope: Scope,\n slugPrefix: string,\n parentSectionPath: string,\n childIndex?: number,\n sidebarDepth?: number\n ): void {\n const individualSlug = extractSlugSegment(String(node.slug), slugPrefix);\n const effectiveSlug =\n individualSlug === \"\" && childIndex != null\n ? `${FernNavigationUtils.SKIP_URL_SLUG_PREFIX}${childIndex}`\n : individualSlug;\n const sectionPath = appendSectionPath(parentSectionPath, effectiveSlug);\n const currentPrefix = String(node.slug);\n\n this.trackApiDefinition(String(node.apiDefinitionId));\n const pointsTo = node.pointsTo != null ? String(node.pointsTo) : resolvePointsTo(node);\n this.queueStructuralRedirect(scope, String(node.slug), pointsTo, false, \"api-section\");\n\n // Pass 1: collect leaf API artifacts (endpoints, webhooks, etc.)\n const artifacts: CollectedArtifact[] = [];\n const ovPageId = node.overviewPageId ? String(node.overviewPageId) : undefined;\n if (ovPageId != null) {\n // Overview occupies position -1 so it sorts before children (whose\n // childPosition starts at 0) without colliding in displaySortOrder.\n artifacts.push({ ...this.makeOverviewArtifact(ovPageId, node), childPosition: -1 });\n }\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i]!;\n switch (child.type) {\n case \"endpoint\":\n artifacts.push({ ...this.makeEndpointArtifact(child, currentPrefix), childPosition: i });\n break;\n case \"endpointPair\": {\n const pairKey = String(child.nonStream.endpointId);\n artifacts.push({\n ...this.makeEndpointArtifact(child.nonStream, currentPrefix, pairKey, false),\n childPosition: i\n });\n artifacts.push({\n ...this.makeEndpointArtifact(child.stream, currentPrefix, pairKey, true),\n childPosition: i\n });\n break;\n }\n case \"webSocket\":\n artifacts.push({ ...this.makeWebSocketArtifact(child, currentPrefix), childPosition: i });\n break;\n case \"webhook\":\n artifacts.push({ ...this.makeWebhookArtifact(child, currentPrefix), childPosition: i });\n break;\n case \"grpc\":\n artifacts.push({ ...this.makeGrpcArtifact(child, currentPrefix), childPosition: i });\n break;\n case \"graphql\":\n artifacts.push({ ...this.makeGraphQlArtifact(child, currentPrefix), childPosition: i });\n break;\n case \"graphqlType\":\n artifacts.push({ ...this.makeGraphQlTypeArtifact(child, currentPrefix), childPosition: i });\n break;\n case \"page\": {\n const pageId = String(child.pageId);\n if (ovPageId != null && pageId === ovPageId) {\n break;\n }\n artifacts.push({\n ...this.makePageArtifact(pageId, child, currentPrefix),\n childPosition: i\n });\n break;\n }\n case \"link\":\n artifacts.push({ ...this.makeLinkArtifact(child), childPosition: i });\n break;\n }\n }\n\n const metadata = stripUndefined({\n type: node.type,\n title: node.title,\n icon: node.icon,\n authed: node.authed,\n collapsed: node.collapsed,\n apiDefinitionId: String(node.apiDefinitionId),\n overviewPageId: node.overviewPageId ? String(node.overviewPageId) : undefined,\n noindex: node.noindex,\n availability: node.availability,\n pointsTo,\n childIndex,\n sidebarDepth,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags,\n playground: toLedgerPlayground(node.playground),\n // ApiReference-specific fields (undefined values stripped for apiPackage)\n ...(node.type === \"apiReference\"\n ? { paginated: node.paginated, showErrors: node.showErrors, hideTitle: node.hideTitle }\n : {})\n });\n\n const hasApiPackageChildren = node.children.some((c) => c.type === \"apiPackage\");\n const hasChangelog = node.type === \"apiReference\" && node.changelog != null;\n if (artifacts.length > 0 || hasApiPackageChildren || hasChangelog) {\n this.createSegment(scope, sectionPath, metadata, artifacts, node.hidden ?? false);\n }\n\n // Pass 2: walk sub-packages (the only sub-tree in API packages)\n const nextDepth = sidebarDepth != null ? sidebarDepth + 1 : undefined;\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i]!;\n if (child.type === \"apiPackage\") {\n this.walkApiSection(child, scope, currentPrefix, sectionPath, i, nextDepth);\n }\n }\n\n if (node.type === \"apiReference\" && node.changelog) {\n this.walkChangelog(node.changelog, scope, currentPrefix, sectionPath, String(node.apiDefinitionId));\n }\n }\n\n // ── Changelog walking ─────────────────────────────────────────────\n\n /** Walk a changelog: flatten year/month/entry hierarchy into a single segment. */\n private walkChangelog(\n node: V1.ChangelogNode,\n scope: Scope,\n slugPrefix: string,\n parentSectionPath: string,\n apiDefinitionId?: string,\n childIndex?: number\n ): void {\n const individualSlug = extractSlugSegment(String(node.slug), slugPrefix);\n const sectionPath = appendSectionPath(parentSectionPath, individualSlug);\n const currentPrefix = String(node.slug);\n\n const artifacts: CollectedArtifact[] = [];\n\n // Overview page — position -1 so it sorts before entries without\n // colliding in displaySortOrder (entries start at 0).\n if (node.overviewPageId) {\n artifacts.push({ ...this.makeOverviewArtifact(String(node.overviewPageId), node), childPosition: -1 });\n }\n\n // Flatten year/month/entry hierarchy. Each entry gets an explicit\n // childPosition so displaySortOrder doesn't rely on array-index\n // fallback — keeps ordering deterministic across re-publishes.\n let entryPos = 0;\n for (const year of node.children) {\n for (const month of year.children) {\n for (const entry of month.children) {\n artifacts.push({\n ...this.makeChangelogEntryArtifact(entry, currentPrefix),\n childPosition: entryPos\n });\n entryPos++;\n }\n }\n }\n\n if (artifacts.length > 0) {\n this.createSegment(\n scope,\n sectionPath,\n stripUndefined({\n type: \"changelog\",\n title: node.title,\n icon: node.icon,\n overviewPageId: node.overviewPageId ? String(node.overviewPageId) : undefined,\n noindex: node.noindex,\n authed: node.authed,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags,\n apiDefinitionId,\n childIndex\n }),\n artifacts,\n node.hidden ?? false\n );\n }\n }\n\n // ── Final assembly ───────────────────────────────────────────────\n\n /**\n * Build the TransformResult from collected structural data.\n * Collects global content refs and assembles deployment segments.\n */\n buildResult(input: TransformInput): TransformResult {\n // ADR 0009: split the config into (a) structural JSONB inlined on\n // the deployment row, and (b) four extracted content rows for the\n // variable-length fields (`header`, `footer`, `css.inline`,\n // `js.inline`). ADR 0016 re-inlines those text fields into the S3\n // pointer so site chrome does not add page-render reads.\n let configJson: unknown | undefined;\n let headerBlobRef: BlobRef | undefined;\n let footerBlobRef: BlobRef | undefined;\n let cssInlineBlobRef: BlobRef | undefined;\n let jsInlineBlobRef: BlobRef | undefined;\n if (input.config != null) {\n const { stripped, header, footer, cssInline, jsInline } = splitConfig(input.config);\n configJson = { ...stripped, rootSlug: this.basePrefix };\n if (header !== undefined) {\n headerBlobRef = this.trackGeneratedTextBlob(header);\n }\n if (footer !== undefined) {\n footerBlobRef = this.trackGeneratedTextBlob(footer);\n }\n if (cssInline !== undefined) {\n cssInlineBlobRef = this.trackGeneratedTextBlob(cssInline);\n }\n if (jsInline !== undefined) {\n jsInlineBlobRef = this.trackGeneratedTextBlob(jsInline);\n }\n } else {\n configJson = { rootSlug: this.basePrefix };\n }\n\n // Track global content refs (files, jsFiles, apiManifest)\n for (const ref of [input.jsFiles, input.apiManifest]) {\n if (ref != null) {\n this.contentRefs.set(ref.hash, ref);\n }\n }\n\n // Wire redirects as a first-class artifact in a dedicated segment.\n // The segment uses EMPTY_SCOPE (no product/version/variant/tab) and an\n // empty section path — no sentinel value is needed because the segment\n // is identified by its content-addressed hash, which is unique to this\n // combination of scope, metadata ({ type: \"redirects\" }), and the\n // redirect artifact's content hash.\n if (input.redirects != null) {\n const redirectsRef = input.redirects as BlobRef;\n this.contentRefs.set(redirectsRef.hash, redirectsRef);\n\n const artifactHash = this.addArtifact({\n type: \"redirect\",\n hidden: true,\n metadata: {},\n content: redirectsRef\n });\n\n this.createRouteOnlySegment({ type: \"redirects\" }, [{ artifactHash, slug: \"\", isLink: false }]);\n }\n\n // Wire file manifest entries as artifacts in a dedicated \"files\" segment.\n // Files are route-only (fullPath set, no displaySortOrder) — they must be\n // findable by path but must not appear in sidebar navigation or nav chrome.\n if (input.fileManifest != null) {\n const entries = Object.entries(input.fileManifest);\n if (entries.length > 0) {\n entries.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));\n\n const fileArtifacts: CollectedArtifact[] = [];\n for (const [fullPath, entry] of entries) {\n fileArtifacts.push(this.makeFileArtifact(fullPath, entry as FileManifestEntry));\n }\n\n this.createRouteOnlySegment({ type: \"files\" }, fileArtifacts);\n }\n }\n\n // Materialise structural redirects before synthetic `link:` redirects.\n // Structural rows are existing flat routes (`type:\"redirect\"` artifacts)\n // for implicit product/version/tab URLs whose legacy pointsTo is derived\n // from the full navigation tree.\n this.flushStructuralRedirects();\n\n // Materialise synthetic `link:` redirects now that every real route is\n // known (pages + files + config redirects). ADR 0013: each `link:` node\n // becomes a routable `type:\"redirect\"` row at\n // `<closest-parent-with-slug>/kebab(title)` → href, EXCEPT where a real\n // page already owns that `full_path` (real-page-wins dedup). Emitted\n // last so the dedup set is complete.\n this.flushLinkRedirects();\n\n // Track generated blobs as content refs too\n for (const [hash, blob] of this.generatedBlobs) {\n this.contentRefs.set(hash, blob.ref);\n }\n\n return {\n segmentDetails: this.segmentDetails,\n artifacts: this.artifacts,\n segments: this.segments,\n nav: this.nav,\n deploymentSegments: this.segmentOrder.map((segmentHash, sortOrder) => ({ segmentHash, sortOrder })),\n apiDefinitions: this.apiDefinitions,\n siteProducts: this.siteProducts,\n\n jsFilesHash: input.jsFiles?.hash,\n\n configJson,\n headerHash: headerBlobRef?.hash,\n footerHash: footerBlobRef?.hash,\n cssInlineHash: cssInlineBlobRef?.hash,\n jsInlineHash: jsInlineBlobRef?.hash,\n\n domain: input.domain,\n fileDomain: input.fileDomain ?? input.domain,\n version: input.version,\n repo: input.repo,\n git: input.git,\n\n contentRefs: this.contentRefs,\n generatedBlobs: this.generatedBlobs,\n fileEntries: this.fileEntries,\n referencedFilesByPageId: collectReferencedFilesByPageId(input.pages)\n };\n }\n}\n\n/**\n * Project the publish input's `pages` map into `pageId → referencedFiles`,\n * dropping pages with no embedded files (ADR 0016). Keys mirror the `pages`\n * record's keys (the `pageId`), which is exactly how artifacts carry\n * `metadata.pageId`, so the read model can join routes to their files.\n */\nfunction collectReferencedFilesByPageId(pages: TransformInput[\"pages\"]): Record<string, string[]> {\n const out: Record<string, string[]> = {};\n for (const [pageId, page] of Object.entries(pages)) {\n const refs = page?.referencedFiles;\n if (refs != null && refs.length > 0) {\n out[pageId] = refs;\n }\n }\n return out;\n}\n\n// ── Utility functions ────────────────────────────────────────────────────\n\n/** Remove keys with undefined values from an object. */\nfunction stripUndefined<T extends Record<string, unknown>>(obj: T): T {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (value !== undefined) {\n result[key] = value;\n }\n }\n return result as T;\n}\n\n/**\n * Coerce a nav node's `playground` (branded Fern types) into the plain ledger\n * metadata shape written into segment / artifact metadata. `stripUndefined` drops\n * absent options at runtime, so the resulting object matches the all-optional\n * schema type — the cast just widens the branded `EnvironmentId`/`Url` to strings.\n */\nfunction toLedgerPlayground(pg: V1.PlaygroundSettings | undefined): LedgerPlaygroundMetadata | undefined {\n if (pg == null) {\n return undefined;\n }\n return stripUndefined({\n hidden: pg.hidden,\n environments: pg.environments,\n button: pg.button?.href != null ? { href: String(pg.button.href) } : undefined,\n \"limit-websocket-messages-per-connection\": pg[\"limit-websocket-messages-per-connection\"],\n \"send-optional-defaults\": pg[\"send-optional-defaults\"]\n }) as LedgerPlaygroundMetadata;\n}\n\n/**\n * Result of {@link splitConfig}: the structural `stripped` config (written\n * inline as JSONB on the deployment row) plus the four extracted CAS blobs.\n */\nexport interface SplitConfigResult {\n /**\n * `config` with `header`, `footer`, `css.inline`, `js.inline` removed.\n * `css` / `js` are dropped entirely if `inline` was their only key.\n */\n stripped: Omit<LedgerConfig, \"header\" | \"footer\" | \"css\" | \"js\"> & {\n css?: Omit<NonNullable<LedgerConfig[\"css\"]>, \"inline\">;\n js?: Omit<NonNullable<LedgerConfig[\"js\"]>, \"inline\">;\n };\n header: string | undefined;\n footer: string | undefined;\n cssInline: string | undefined;\n jsInline: string | undefined;\n}\n\n/**\n * Split a {@link LedgerConfig} into the structural portion (to be written\n * inline as JSONB) and the four variable-length fields that are extracted\n * to their own CAS blobs (ADR 0009).\n *\n * - `header`, `footer`: returned as the raw strings if non-empty.\n * - `css.inline`, `js.inline`: arrays of strings, joined with `\\n` into a\n * single text blob if non-empty. The `inline` key is removed from `css`\n * and `js` in the stripped config; any other sibling fields (`js.files`,\n * `js.remote`) are preserved. `css.inline` is currently the only field\n * on `css`, so `stripped.css` is dropped in practice — the empty-keys\n * check is kept for symmetry with `js` and to stay correct if the\n * schema grows new `css` siblings.\n *\n * The returned `stripped` object is a shallow-cloned subset of `config` so\n * that callers can safely mutate it without affecting the original.\n *\n * The input has already been validated against `LedgerConfigSchema` by\n * Zod upstream — no runtime shape checks are needed here.\n *\n * Exported for testing.\n *\n * @internal\n */\nexport function splitConfig(config: LedgerConfig): SplitConfigResult {\n const { header: rawHeader, footer: rawFooter, css: rawCss, js: rawJs, ...rest } = config;\n\n const stripped: SplitConfigResult[\"stripped\"] = { ...rest };\n\n let cssInline: string | undefined;\n if (rawCss != null) {\n const { inline, ...cssRest } = rawCss;\n if (inline != null && inline.length > 0) {\n cssInline = inline.join(\"\\n\");\n }\n if (Object.keys(cssRest).length > 0) {\n stripped.css = cssRest;\n }\n }\n\n let jsInline: string | undefined;\n if (rawJs != null) {\n const { inline, ...jsRest } = rawJs;\n if (inline != null && inline.length > 0) {\n jsInline = inline.join(\"\\n\");\n }\n if (Object.keys(jsRest).length > 0) {\n stripped.js = jsRest;\n }\n }\n\n return {\n stripped,\n header: rawHeader != null && rawHeader.length > 0 ? rawHeader : undefined,\n footer: rawFooter != null && rawFooter.length > 0 ? rawFooter : undefined,\n cssInline,\n jsInline\n };\n}\n","export * from \"./collect-referenced-types\";\nexport * from \"./collect-type-tree\";\nexport * from \"./endpoint-context\";\nexport * from \"./endpoint-path-literal\";\nexport * from \"./graphql-type-references\";\nexport * from \"./join\";\nexport * from \"./lang\";\nexport * from \"./latest\";\nexport * from \"./migrators/v1ToV2\";\nexport * from \"./prune\";\nexport * from \"./prune-endpoint-example\";\nexport * from \"./prune-endpoint-schema\";\nexport * from \"./snippets\";\nexport * from \"./status-message\";\nexport * from \"./transformer\";\nexport * from \"./types\";\nexport * from \"./unwrap\";\nexport * from \"./url\";\nexport * from \"./wrapOpenRPCRequest\";\n","/**\n * The maximum number of times to loop while unwrapping a type reference.\n * This may need to be increased if the API definition contains extremely deeply nested type references.\n */\nexport const LOOP_TOLERANCE = 100;\n\n/**\n * The maximum number of times to loop while expanding type IDs.\n * Since there can be many type ids to expand, this number is an order of magnitude larger than `LOOP_TOLERANCE`.\n */\nexport const LARGE_LOOP_TOLERANCE = 100 ** 2;\n","export const EMPTY_ARRAY = Object.freeze([]);\nexport const EMPTY_OBJECT = Object.freeze({});\n","export function identity<T>(value: T): T {\n return value;\n}\n\nexport default identity;\n","export function isNonNullish<T>(x: T | null | undefined): x is T {\n return x != null;\n}\n\nexport function assertNonNullish<T>(x: T | null | undefined, message?: string): asserts x is T {\n if (x == null) {\n throw new Error(message ?? \"Value is null or undefined\");\n }\n}\n","// https://github.com/lodash/lodash/blob/master/isPlainObject.js\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n if (!isObjectLike(value) || String(value) !== \"[object Object]\") {\n return false;\n }\n if (Object.getPrototypeOf(value) == null) {\n return true;\n }\n let proto = value;\n while (Object.getPrototypeOf(proto) != null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(value) === proto;\n}\n\nfunction isObjectLike(value: unknown) {\n return typeof value === \"object\" && value != null;\n}\n\nexport default isPlainObject;\n","/**\n * validates and sanitizes a base URL.\n * returns null if the URL cannot be coerced into a valid URL.\n */\nexport function sanitizeUrl(url: string | undefined): string | undefined {\n if (!url) {\n return undefined;\n }\n\n // handle protocol-relative URLs (starting with //)\n if (url.startsWith(\"//\")) {\n try {\n const parsedUrl = new URL(`https:${url}`);\n return parsedUrl.toString();\n } catch {\n return undefined;\n }\n }\n\n // handle URLs without protocol\n if (\n !url.startsWith(\"http://\") &&\n !url.startsWith(\"https://\") &&\n !url.startsWith(\"wss://\") &&\n !url.startsWith(\"ws://\") &&\n !url.startsWith(\"mailto:\") &&\n !url.startsWith(\"tel:\")\n ) {\n try {\n const parsedUrl = new URL(`https://${url}`);\n return parsedUrl.toString();\n } catch {\n return undefined;\n }\n }\n\n // validate complete URLs\n try {\n const parsedUrl = new URL(url);\n return parsedUrl.toString();\n } catch {\n return undefined;\n }\n}\n","const conjunctions = [\n \"for\",\n \"and\",\n \"nor\",\n \"but\",\n \"or\",\n \"yet\",\n \"so\"\n];\nconst articles = [\n \"a\",\n \"an\",\n \"the\"\n];\nconst prepositions = [\n \"aboard\",\n \"about\",\n \"above\",\n \"across\",\n \"after\",\n \"against\",\n \"along\",\n \"amid\",\n \"among\",\n \"anti\",\n \"around\",\n \"as\",\n \"at\",\n \"before\",\n \"behind\",\n \"below\",\n \"beneath\",\n \"beside\",\n \"besides\",\n \"between\",\n \"beyond\",\n \"but\",\n \"by\",\n \"concerning\",\n \"considering\",\n \"despite\",\n \"down\",\n \"during\",\n \"except\",\n \"excepting\",\n \"excluding\",\n \"following\",\n \"for\",\n \"from\",\n \"in\",\n \"inside\",\n \"into\",\n \"like\",\n \"minus\",\n \"near\",\n \"of\",\n \"off\",\n \"on\",\n \"onto\",\n \"opposite\",\n \"over\",\n \"past\",\n \"per\",\n \"plus\",\n \"regarding\",\n \"round\",\n \"save\",\n \"since\",\n \"than\",\n \"through\",\n \"to\",\n \"toward\",\n \"towards\",\n \"under\",\n \"underneath\",\n \"unlike\",\n \"until\",\n \"up\",\n \"upon\",\n \"versus\",\n \"via\",\n \"with\",\n \"within\",\n \"without\"\n];\nconst lowerCase = /* @__PURE__ */ new Set([\n ...conjunctions,\n ...articles,\n ...prepositions\n]);\nexport {\n lowerCase\n};\n","const specials = [\n \"ZEIT\",\n \"ZEIT Inc.\",\n \"Vercel\",\n \"Vercel Inc.\",\n \"CLI\",\n \"API\",\n \"HTTP\",\n \"HTTPS\",\n \"JSX\",\n \"DNS\",\n \"URL\",\n \"now.sh\",\n \"now.json\",\n \"vercel.app\",\n \"vercel.json\",\n \"CI\",\n \"CD\",\n \"CDN\",\n \"package.json\",\n \"package.lock\",\n \"yarn.lock\",\n \"GitHub\",\n \"GitLab\",\n \"CSS\",\n \"Sass\",\n \"JS\",\n \"JavaScript\",\n \"TypeScript\",\n \"HTML\",\n \"WordPress\",\n \"Next.js\",\n \"Node.js\",\n \"Webpack\",\n \"Docker\",\n \"Bash\",\n \"Kubernetes\",\n \"SWR\",\n \"TinaCMS\",\n \"UI\",\n \"UX\",\n \"TS\",\n \"TSX\",\n \"iPhone\",\n \"iPad\",\n \"watchOS\",\n \"iOS\",\n \"iPadOS\",\n \"macOS\",\n \"PHP\",\n \"composer.json\",\n \"composer.lock\",\n \"CMS\",\n \"SQL\",\n \"C\",\n \"C#\",\n \"GraphQL\",\n \"GraphiQL\",\n \"JWT\",\n \"JWTs\"\n];\nexport {\n specials\n};\n","import { lowerCase } from \"./lower-case.js\";\nimport { specials } from \"./specials.js\";\nconst word = `[^\\\\s'\\u2019\\\\(\\\\)!?;:\"-]`;\nconst regex = new RegExp(`(?:(?:(\\\\s?(?:^|[.\\\\(\\\\)!?;:\"-])\\\\s*)(${word}))|(${word}))(${word}*[\\u2019']*${word}*)`, \"g\");\nconst convertToRegExp = (specials2) => specials2.map((s) => [new RegExp(`\\\\b${s}\\\\b`, \"gi\"), s]);\nfunction parseMatch(match) {\n const firstCharacter = match[0];\n if (/\\s/.test(firstCharacter)) {\n return match.slice(1);\n }\n if (/[\\(\\)]/.test(firstCharacter)) {\n return null;\n }\n return match;\n}\nvar src_default = (str, options = {}) => {\n str = str.toLowerCase().replace(regex, (m, lead = \"\", forced, lower, rest, offset, string) => {\n const isLastWord = m.length + offset >= string.length;\n const parsedMatch = parseMatch(m);\n if (!parsedMatch) {\n return m;\n }\n if (!forced) {\n const fullLower = lower + rest;\n if (lowerCase.has(fullLower) && !isLastWord) {\n return parsedMatch;\n }\n }\n return lead + (lower || forced).toUpperCase() + rest;\n });\n const customSpecials = options.special || [];\n const replace = [...specials, ...customSpecials];\n const replaceRegExp = convertToRegExp(replace);\n replaceRegExp.forEach(([pattern, s]) => {\n str = str.replace(pattern, s);\n });\n return str;\n};\nexport {\n src_default as default\n};\n","export const SPECIAL_TOKENS = [\n // privacy\n \"PII\",\n \"PHI\",\n \"PCI\",\n \"GDPR\",\n \"CCPA\",\n \"HIPAA\",\n \"COPPA\",\n \"FERPA\",\n \"GLBA\",\n \"SOX\",\n \"FISMA\",\n \"NIST\",\n \"CIS\",\n \"ISO\",\n \"IEC\",\n \"ITAR\",\n \"EAR\",\n \"CMMC\",\n \"CUI\",\n \"CDI\",\n \"FTC\",\n \"FCC\",\n \"SEC\",\n \"FINRA\",\n\n // security\n \"XSS\",\n \"CSRF\",\n \"SSRF\",\n \"XSRF\",\n \"TLS\",\n \"SSL\",\n \"SSH\",\n \"API\",\n \"OAuth\",\n \"OAuth1\",\n \"OAuth1.0\",\n \"OAuth2\",\n \"OAuth2.0\",\n \"SAML\",\n \"SCIM\",\n \"SSO\",\n \"OpenID\",\n \"OpenID Connect\",\n \"CAPTCHA\",\n \"reCAPTCHA\",\n \"2FA\",\n \"MFA\",\n \"OTP\",\n \"TOTP\",\n \"HOTP\",\n \"U2F\",\n \"FIDO\",\n \"FIDO2\",\n \"PKI\",\n \"HMAC\",\n \"AES\",\n \"RSA\",\n \"SHA\",\n \"MD5\",\n \"BCrypt\",\n \"PBKDF2\",\n \"Argon2\",\n \"SCrypt\",\n \"JWT\",\n \"JWE\",\n \"JWS\",\n \"JWK\",\n \"JWA\",\n \"JOSE\",\n\n // shopping\n \"SKU\",\n \"SKUs\",\n \"UPC\",\n \"EAN\",\n \"ISBN\",\n \"ASIN\",\n \"MPN\",\n \"MSRP\",\n \"RRP\",\n \"MSRP\",\n\n // time\n \"AM\",\n \"PM\",\n \"UTC\",\n \"GMT\",\n \"PST\",\n \"PDT\",\n \"EST\",\n \"EDT\",\n \"CST\",\n \"CDT\",\n \"MST\",\n \"MDT\",\n\n // geography\n \"USA\",\n \"UK\",\n \"EU\",\n \"UAE\",\n \"APAC\",\n \"EMEA\",\n \"LATAM\",\n \"ANZ\",\n \"SEA\",\n \"MEA\",\n \"MENA\",\n \"NATO\",\n \"NA\",\n \"SA\",\n \"CA\",\n \"EU\",\n \"AU\",\n \"NZ\",\n \"JP\",\n \"KR\",\n \"CN\",\n \"HK\",\n \"TW\",\n \"SG\",\n \"MY\",\n \"TH\",\n \"ID\",\n \"PH\",\n \"VN\",\n \"IN\",\n \"PK\",\n \"BD\",\n \"LK\",\n \"NP\",\n \"MM\",\n \"KH\",\n \"LA\",\n \"MM\",\n \"BT\",\n \"MV\",\n\n // finance\n \"ACH\",\n \"USD\",\n \"EUR\",\n \"GBP\",\n \"JPY\",\n \"CNY\",\n \"RUB\",\n \"INR\",\n \"AUD\",\n \"CAD\",\n \"CHF\",\n \"SGD\",\n \"MYR\",\n \"THB\",\n \"IDR\",\n \"KRW\",\n \"PHP\",\n \"VND\",\n \"HKD\",\n \"TWD\",\n \"MXN\",\n \"BRL\",\n \"ARS\",\n \"CLP\",\n \"COP\",\n \"PEN\",\n \"ZAR\",\n \"NGN\",\n \"EGP\",\n \"AED\",\n \"SAR\",\n \"ILS\",\n \"TRY\",\n \"SEK\",\n \"NOK\",\n \"DKK\",\n \"ISK\",\n \"HUF\",\n \"PLN\",\n \"CZK\",\n \"RON\",\n \"BGN\",\n\n // programming\n \"API\",\n \"APIs\",\n \"SDK\",\n \"SDKs\",\n \"AI\",\n \"OCR\",\n \"REST\",\n \"SOAP\",\n \"JSON\",\n \"XML\",\n \"HTTP\",\n \"HTTPS\",\n \"URI\",\n \"URL\",\n \"CRUD\",\n \"RESTful\",\n \"KYB\",\n \"KYC\",\n \"AML\",\n \"HTML\",\n \"CSS\",\n \"JS\",\n \"SQL\",\n \"DB\",\n \"UI\",\n \"UX\",\n \"SaaS\",\n \"PaaS\",\n \"IaaS\",\n \"IP\",\n \"TCP\",\n \"UDP\",\n \"DNS\",\n \"FTP\",\n \"SMTP\",\n \"IMAP\",\n \"POP3\",\n \"CSV\",\n \"MVC\",\n \"MVP\",\n \"MVVM\",\n \"DOM\",\n \"SPA\",\n \"SSR\",\n \"CSR\",\n \"DDoS\",\n \"CDN\",\n \"IoT\",\n \"ML\",\n \"DL\",\n \"NLP\",\n \"CLI\",\n \"GUI\",\n \"BI\",\n \"ETL\",\n \"RDBMS\",\n \"NoSQL\",\n \"IDE\",\n \"CMS\",\n \"CCPA\",\n \"POSIX\",\n \"ABI\",\n \"API\",\n \"AST\",\n \"COBOL\",\n \"DDL\",\n \"DML\",\n\n // AI-related\n \"NN\", // Neural Network\n \"CNN\", // Convolutional Neural Network\n \"RNN\", // Recurrent Neural Network\n \"LSTM\", // Long Short Term Memory\n \"GRU\", // Gated Recurrent Unit\n \"ANN\", // Artificial Neural Network\n \"GAN\", // Generative Adversarial Network\n \"RL\", // Reinforcement Learning\n \"DL\", // Deep Learning\n \"ML\", // Machine Learning\n \"NLP\", // Natural Language Processing\n \"NLG\", // Natural Language Generation\n \"NLU\", // Natural Language Understanding\n \"BERT\", // Bidirectional Encoder Representations from Transformers\n \"GPT\", // Generative Pre-training Transformer\n \"SVM\", // Support Vector Machine\n \"PCA\", // Principal Component Analysis\n \"AI\", // Artificial Intelligence\n \"CV\", // Computer Vision\n \"TF\", // TensorFlow\n \"TTS\", // Text-to-Speech\n \"ASR\", // Automatic Speech Recognition\n \"HMM\", // Hidden Markov Model\n \"DNN\", // Deep Neural Network\n \"MLP\", // Multi-Layer Perceptron\n \"RBM\", // Restricted Boltzmann Machine\n \"CRF\", // Conditional Random Field\n\n // Media\n \"PDF\",\n \"PDFs\",\n \"RTF\",\n \"TXT\",\n \"XLS\",\n \"XLSX\",\n \"PPT\",\n\n // Image\n \"JPG\",\n \"JPEG\",\n \"PNG\",\n \"GIF\",\n \"GIFs\",\n \"SVG\",\n \"TIFF\",\n \"BMP\",\n \"ICO\",\n \"PSD\",\n \"WebP\",\n \"AVIF\",\n \"HEIF\",\n \"HEIC\",\n \"EPS\",\n\n // Audio\n \"MP3\",\n \"WAV\",\n \"AIFF\",\n \"FLAC\",\n \"WMA\",\n \"AAC\",\n \"OGG\",\n\n // Video\n \"AVI\",\n \"WMV\",\n \"MOV\",\n \"M4V\",\n \"MP4\",\n \"MPG\",\n \"MPEG\",\n \"FLV\",\n \"SWF\",\n \"MKV\",\n \"WebM\",\n\n // Cloud Computing\n \"GCP\", // Google Cloud Platform\n \"AWS\", // Amazon Web Services\n \"VM\", // Virtual Machines\n \"VPC\", // Virtual Private Cloud\n \"S3\", // AWS Simple Storage Service\n \"EC2\", // AWS Elastic Compute Cloud\n\n // Data Storage and Databases\n \"DynamoDB\",\n \"CosmosDB\",\n \"BigQuery\",\n \"CI/CD\",\n\n // Security and Compliance\n \"SOC1\", // Service Organization Control 1\n \"SOC2\", // Service Organization Control 2\n \"SOC3\", // Service Organization Control 3\n \"PCI DSS\", // Payment Card Industry Data Security Standard\n \"WAF\", // Web Application Firewall\n \"IAM\", // Identity and Access Management\n\n // Networking\n \"SDN\", // Software-Defined Networking\n \"MPLS\", // Multi-Protocol Label Switching\n \"BGP\", // Border Gateway Protocol\n\n // Frameworks and Libraries\n \"Vue.js\",\n \"Node.js\",\n \".NET\"\n];\n","import title from \"title\";\n\nimport { SPECIAL_TOKENS } from \"./specialTokens\";\n\nexport function titleCase(name: string): string {\n // regex match pascalCase or CamelCase and add spaces between words\n name = name.replace(/([a-z])([A-Z])/g, \"$1 $2\");\n\n // regex match single uppercase letter(s) followed by an uppercase letter and lowercase letter\n // e.g. \"AShopperProfile\" -> \"A Shopper Profile\", \"HTMLParser\" -> \"HTML Parser\"\n name = name.replace(/([A-Z]+)([A-Z][a-z])/g, \"$1 $2\");\n\n // regex match snake_case and replace \"_\" with \" \"\n name = name.replace(/_/g, \" \");\n\n // regex match kebab-case and replace \"-\" with \" \"\n name = name.replace(/-/g, \" \");\n\n const titleCased = title(name, { special: SPECIAL_TOKENS });\n\n // regex match \"V 2\", \"V 4\", etc. and replace it with \"V2\", \"V4\", etc.\n const versionedTitle = titleCased.replace(/V\\s(\\d)/g, \"V$1\");\n return versionedTitle;\n}\n\nexport default titleCase;\n","interface Opts {\n renderNull?: boolean;\n}\n\nexport function unknownToString(value: unknown, { renderNull = false }: Opts = {}): string {\n if (value == null || typeof value === \"function\") {\n return renderNull ? \"null\" : \"\";\n } else if (typeof value === \"string\") {\n return value;\n }\n return JSON.stringify(value);\n}\n\nexport default unknownToString;\n","import { assertNever } from \"./assertNever\";\n\nexport type DiscriminatedUnionVisitor<T extends Record<Discriminant, string>, U, Discriminant extends string> = {\n [D in T[Discriminant]]: (value: Extract<T, Record<Discriminant, D>>) => U;\n} & {\n _other?: (value: Record<Discriminant, string>) => U;\n};\n\nexport function visitDiscriminatedUnion<T extends Record<\"type\", string>>(\n item: T\n): { _visit: <U>(visitor: DiscriminatedUnionVisitor<T, U, \"type\">) => U };\nexport function visitDiscriminatedUnion<T extends Record<Discriminant, string>, Discriminant extends string>(\n item: T,\n discriminant: Discriminant\n): { _visit: <U>(visitor: DiscriminatedUnionVisitor<T, U, Discriminant>) => U };\nexport function visitDiscriminatedUnion<T extends Record<Discriminant, string>, Discriminant extends string>(\n item: T,\n discriminant: Discriminant = \"type\" as Discriminant\n): {\n _visit: <U>(visitor: DiscriminatedUnionVisitor<T, U, Discriminant>) => U;\n} {\n return {\n _visit: (visitor) => {\n const visit = visitor[item[discriminant]];\n if (visit != null) {\n return visit(item as Extract<T, Record<Discriminant, string>>);\n } else {\n if (visitor._other == null) {\n assertNever(item as never);\n }\n return visitor._other(item);\n }\n }\n };\n}\n\nexport default visitDiscriminatedUnion;\n","import { isPlainObject } from \"@fern-api/ui-core-utils\";\nimport visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\nimport { compact, sortBy } from \"es-toolkit/array\";\n\nimport { AvailabilityOrder, coalesceAvailability } from \"./availability\";\nimport { LOOP_TOLERANCE } from \"./const\";\nimport * as Latest from \"./latest\";\nimport type { DereferencedNonOptionalTypeShapeOrReference, TypeShapeOrReference } from \"./types\";\n\nexport type UnwrappedReference = {\n shape: DereferencedNonOptionalTypeShapeOrReference;\n availability: Latest.Availability | undefined;\n descriptions: string[];\n visitedTypeIds: Set<Latest.TypeId>;\n isOptional: boolean;\n isNullable: boolean;\n default?: unknown;\n};\n\nexport type UnwrappedObjectType = {\n properties: Latest.ObjectProperty[];\n extraProperties: Latest.TypeReference | null | undefined;\n descriptions: string[];\n visitedTypeIds: Set<Latest.TypeId>;\n};\n\ntype InternalDefaultValue =\n | { type: \"unknown\"; value: unknown }\n | { type: \"typeReferenceId\"; value: Latest.TypeReferenceIdDefault };\n\n/**\n * Cache for unwrapped references. Perform the unwrapping only once.\n */\nconst UnwrapReferenceCache = new WeakMap<TypeShapeOrReference, UnwrappedReference>();\n\n/**\n * A TypeShape or TypeReference might be an alias or reference to another type.\n * This function unwraps the reference, including any optional wrappers, to get the actual shape.\n *\n * When optionals are detected, attempt to find the default value for the shape.\n * Since aliases can be recursive, the first default value found is returned, which can be contained in:\n * - the optional wrapper\n * - the type reference id\n * - the primitive or literal shape itself\n *\n * @param typeRef to unwrap\n * @param types from the API definition\n * @returns UnwrappedReference containing the shape, whether it is optional, and the default value if it exists\n */\nexport function unwrapReference(\n typeRef: TypeShapeOrReference,\n types: Record<string, Latest.TypeDefinition>\n): UnwrappedReference;\nexport function unwrapReference(\n typeRef: TypeShapeOrReference | undefined,\n types: Record<string, Latest.TypeDefinition>\n): UnwrappedReference | undefined;\nexport function unwrapReference(\n typeRef: TypeShapeOrReference | undefined,\n types: Record<string, Latest.TypeDefinition>\n): UnwrappedReference | undefined {\n if (typeRef == null) {\n return undefined;\n }\n\n const cached = UnwrapReferenceCache.get(typeRef);\n if (cached != null) {\n return cached;\n }\n\n let isOptional = false;\n let isNullable = false;\n const defaults: InternalDefaultValue[] = [];\n const descriptions: string[] = [];\n const availabilities: Latest.Availability[] = [];\n\n const visitedTypeIds = new Set<Latest.TypeId>();\n let internalTypeRef: TypeShapeOrReference | undefined = typeRef;\n let loop = 0;\n let circularReference = false;\n while (internalTypeRef != null) {\n if (loop > LOOP_TOLERANCE) {\n // infinite loop detected\n internalTypeRef = undefined;\n break;\n }\n\n if (internalTypeRef.type === \"nullable\") {\n isNullable = true;\n internalTypeRef = internalTypeRef.shape;\n } else if (internalTypeRef.type === \"optional\") {\n isOptional = true;\n if (internalTypeRef.default != null) {\n defaults.push({\n type: \"unknown\",\n value: internalTypeRef.default\n });\n }\n internalTypeRef = internalTypeRef.shape;\n } else if (internalTypeRef.type === \"alias\") {\n internalTypeRef = internalTypeRef.value;\n } else if (internalTypeRef.type === \"id\") {\n if (visitedTypeIds.has(internalTypeRef.id)) {\n // circular reference detected\n internalTypeRef = undefined;\n circularReference = true;\n break;\n }\n\n if (internalTypeRef.default != null) {\n defaults.push({\n type: \"typeReferenceId\",\n value: internalTypeRef.default\n });\n }\n const typeDef: Latest.TypeDefinition | undefined = types[internalTypeRef.id];\n visitedTypeIds.add(internalTypeRef.id);\n internalTypeRef = typeDef?.shape;\n if (typeDef != null) {\n if (typeDef.availability) {\n availabilities.push(typeDef.availability);\n }\n\n if (typeDef.description != null) {\n descriptions.push(typeDef.description);\n }\n }\n } else {\n break;\n }\n\n loop++;\n }\n\n if (internalTypeRef == null) {\n // Note: this should be a fatal error, but we're handling it gracefully for now\n if (circularReference) {\n console.error(\n `Circular reference detected. Falling back to unknown type. types=[${[...visitedTypeIds].join(\", \")}]`\n );\n } else {\n console.error(\n `Type reference is invalid. Falling back to unknown type. types=[${[...visitedTypeIds].join(\", \")}]`\n );\n }\n }\n\n const toRet = {\n shape: internalTypeRef ?? { type: \"unknown\", displayName: undefined },\n availability: coalesceAvailability(availabilities),\n visitedTypeIds,\n isOptional,\n isNullable,\n default: selectDefaultValue(internalTypeRef, defaults),\n descriptions\n };\n\n UnwrapReferenceCache.set(typeRef, toRet);\n\n return toRet;\n}\n\nfunction selectDefaultValue(\n shape: DereferencedNonOptionalTypeShapeOrReference | undefined,\n defaults: InternalDefaultValue[]\n): unknown | undefined {\n const defaultValue = defaults.find((d) => {\n // If the shape is unknown, we can't validate the default value, so we assume it's always the first one\n if (shape == null) {\n return true;\n }\n\n // if a typeReferenceId is found, we need to validate that the default value is compatible with the shape\n else if (d.type === \"typeReferenceId\") {\n return visitDiscriminatedUnion(d.value)._visit({\n enum: () => shape?.type === \"enum\"\n });\n }\n\n // TODO: validate that the default value is compatible with the shape\n else {\n return true;\n }\n });\n\n if (defaultValue?.type === \"unknown\") {\n return defaultValue.value;\n } else if (defaultValue?.type === \"typeReferenceId\") {\n return defaultValue.value.value;\n } else if (shape?.type === \"primitive\") {\n return primitiveToDefault(shape.value);\n } else if (shape?.type === \"enum\") {\n return shape.default;\n } else {\n return undefined;\n }\n}\n\nconst UnwrapObjectTypeCache = new WeakMap<Latest.ObjectType, UnwrappedObjectType>();\n\n/**\n * Dereferences extended objects and returns all properties of the object.\n * If an object extends another object, the properties of the extended object will be sorted alphabetically.\n * Additionally, required properties will come before optional properties.\n *\n * @param object to dereference\n * @param types from the API definition\n * @returns the properties of the object, including properties from extended objects\n */\nexport function unwrapObjectType(\n object: Latest.ObjectType,\n types: Record<Latest.TypeId, Latest.TypeDefinition>,\n parentVisitedTypeIds?: Set<Latest.TypeId>\n): UnwrappedObjectType {\n const cached = UnwrapObjectTypeCache.get(object);\n if (cached != null) {\n return cached;\n }\n\n const directProperties = object.properties;\n const extraProperties = object.extraProperties;\n const descriptions: string[] = [];\n const visitedTypeIds = new Set<Latest.TypeId>();\n const extendedProperties = object.extends.flatMap((typeId): Latest.ObjectProperty[] => {\n if (parentVisitedTypeIds?.has(typeId)) {\n console.error(`Circular reference detected. Cannot extend type=${typeId}`);\n return [];\n }\n\n const typeDef = types[typeId];\n visitedTypeIds.add(typeId);\n if (typeDef?.description) {\n descriptions.push(typeDef.description);\n }\n\n const unwrapped = unwrapReference(typeDef?.shape, types);\n unwrapped?.descriptions.forEach((description) => descriptions.push(description));\n unwrapped?.visitedTypeIds.forEach((typeId) => visitedTypeIds.add(typeId));\n\n // TODO: should we be able to extend discriminated and undiscriminated unions?\n if (unwrapped?.shape.type !== \"object\") {\n console.warn(\"Object extends non-object\", typeId);\n return [];\n }\n const extended = unwrapObjectType(unwrapped.shape, types, visitedTypeIds);\n extended.visitedTypeIds.forEach((typeId) => visitedTypeIds.add(typeId));\n\n // merge the availability of the extended object with the availability of the properties\n // use a local variable to avoid mutating the cached result\n const extendedPropsWithAvailability = extended.properties.map((property) => {\n return {\n ...property,\n availability: coalesceAvailability(\n compact([typeDef?.availability, unwrapped.availability, property.availability])\n )\n };\n });\n\n descriptions.push(...extended.descriptions);\n\n if (!unwrapped.isOptional) {\n return extendedPropsWithAvailability;\n }\n\n // if the extended object is optional, we need to make all properties optional\n return extendedPropsWithAvailability.map((property): Latest.ObjectProperty => {\n // if a default value is present for the referenced object, we can find the default value for this property\n const defaultProperty = isPlainObject(unwrapped.default) ? unwrapped.default[property.key] : undefined;\n\n const valueShape: Latest.TypeReference.Optional =\n property.valueShape.type === \"alias\" && property.valueShape.value.type === \"optional\"\n ? {\n ...property.valueShape.value,\n default: defaultProperty ?? property.valueShape.value.default\n }\n : {\n type: \"optional\",\n shape: property.valueShape,\n default: defaultProperty\n };\n\n return {\n ...property,\n valueShape: { type: \"alias\", value: valueShape }\n };\n });\n });\n\n const propertyKeys = new Set(object.properties.map((property) => property.key));\n // deduplicate extended properties: remove those that conflict with direct properties,\n // and also remove duplicates between different extends chains (keep first occurrence)\n const seenExtendedKeys = new Set<string>();\n const filteredExtendedProperties = extendedProperties.filter((extendedProperty) => {\n if (propertyKeys.has(extendedProperty.key) || seenExtendedKeys.has(extendedProperty.key)) {\n return false;\n }\n seenExtendedKeys.add(extendedProperty.key);\n return true;\n });\n\n if (filteredExtendedProperties.length === 0) {\n // no property comes from an extended object, so the declared order is still meaningful and\n // must be preserved: only required-before-optional ordering is applied.\n const properties = sortBy(\n [...directProperties],\n [\n (property) => unwrapReference(property.valueShape, types)?.isOptional,\n (property) => AvailabilityOrder.indexOf(property.availability ?? Latest.Availability.Stable)\n ]\n );\n const toRet = {\n properties,\n descriptions,\n extraProperties,\n visitedTypeIds\n };\n UnwrapObjectTypeCache.set(object, toRet);\n return toRet;\n }\n\n // required properties should come before optional properties\n // since there are extended properties, the initial order of properties are not significant, and we should sort by key\n const properties = sortBy(\n [...directProperties, ...filteredExtendedProperties],\n [\n (property) => unwrapReference(property.valueShape, types)?.isOptional,\n (property) => AvailabilityOrder.indexOf(property.availability ?? Latest.Availability.Stable),\n (property) => property.key\n ]\n );\n const toRet = { properties, descriptions, extraProperties, visitedTypeIds };\n UnwrapObjectTypeCache.set(object, toRet);\n return toRet;\n}\n\n/**\n * The discriminant of a discriminated union is converted to a literal type, *prepended* to the additional properties.\n */\nexport function unwrapDiscriminatedUnionVariant(\n union: Pick<Latest.DiscriminatedUnionType, \"discriminant\">,\n variant: Latest.DiscriminatedUnionVariant,\n types: Record<string, Latest.TypeDefinition>\n): UnwrappedObjectType {\n const { properties, descriptions, visitedTypeIds } = unwrapObjectType(variant, types); // this is already cached\n return {\n properties: [\n {\n key: union.discriminant,\n valueShape: {\n type: \"alias\",\n value: {\n type: \"literal\",\n value: {\n type: \"stringLiteral\",\n value: variant.discriminantValue\n }\n }\n },\n propertyAccess: undefined,\n // the description and availability of the discriminant should not be included here\n // because they are already included in the union variant itself\n description: undefined,\n availability: undefined\n },\n ...properties\n ],\n extraProperties: undefined,\n descriptions,\n visitedTypeIds\n };\n}\n\nfunction primitiveToDefault(shape: Latest.PrimitiveType): unknown | undefined {\n return visitDiscriminatedUnion(shape, \"type\")._visit<unknown | undefined>({\n string: (value) => value.default,\n integer: (value) => value.default,\n double: (value) => value.default,\n uint: () => undefined,\n uint64: () => undefined,\n boolean: (value) => value.default,\n long: (value) => value.default,\n datetime: (datetime) => datetime.default,\n uuid: (uuid) => uuid.default,\n base64: (base64) => base64.default,\n date: (value) => value.default,\n bigInteger: (value) => value.default,\n scalar: (value) => value.default\n });\n}\n","import * as Latest from \"./latest\";\n\n/**\n * The order of availability levels, from most stable to least stable.\n *\n * This is used to sort the availability levels in the UI, and to determine the stability level of a type reference when multiple are available.\n */\nexport const AvailabilityOrder = [\n Latest.Availability.Stable,\n Latest.Availability.GenerallyAvailable,\n Latest.Availability.Beta,\n Latest.Availability.Preview,\n Latest.Availability.PreRelease,\n Latest.Availability.Alpha,\n Latest.Availability.InDevelopment,\n Latest.Availability.Deprecated,\n Latest.Availability.Legacy\n] as const;\n\n/**\n * @param availabilities an array of availability levels\n * @returns the **least** stable availability level from the input array\n */\nexport function coalesceAvailability(\n availabilities: (Latest.Availability | null | undefined)[]\n): Latest.Availability | undefined {\n for (const availability of [...AvailabilityOrder].reverse()) {\n if (availabilities.includes(availability)) {\n return availability;\n }\n }\n return undefined;\n}\n\n// the following code is used to check that the contents of the AvailabilityOrder array contains all the values of the Availability enum\ntype AvailabilityValues = (typeof Latest.Availability)[keyof typeof Latest.Availability];\ntype CheckAvailabilityOrder<T extends readonly AvailabilityValues[]> = T[number] extends AvailabilityValues\n ? AvailabilityValues extends T[number]\n ? true\n : false\n : false;\ntype Assert<T extends true> = T;\nexport type CheckAssert = Assert<CheckAvailabilityOrder<typeof AvailabilityOrder>>;\n","import type { TypeId } from \"../navigation\";\nimport { LARGE_LOOP_TOLERANCE } from \"./const\";\nimport type { TypeDefinition } from \"./latest\";\nimport type { TypeShapeOrReference } from \"./types\";\nimport { unwrapObjectType, unwrapReference } from \"./unwrap\";\n\ninterface CollectReferencedTypeIdsOptions {\n maxDepth?: number;\n}\n\n/**\n * Collects all TypeIds that are referenced (directly or transitively) from a given type shape.\n * This is useful for filtering down a large types map to only the types needed for rendering\n * a specific schema, significantly reducing payload size.\n *\n * @param type - The root type shape to start traversal from\n * @param types - The full map of all type definitions\n * @param options - Optional configuration (maxDepth defaults to 10)\n * @returns A Set of TypeIds that are referenced from the root type\n */\nexport function collectReferencedTypeIds(\n type: TypeShapeOrReference,\n types: Record<TypeId, TypeDefinition>,\n { maxDepth = 10 }: CollectReferencedTypeIdsOptions = {}\n): Set<TypeId> {\n const referencedIds = new Set<TypeId>();\n\n const stack: {\n shape: TypeShapeOrReference;\n visitedTypeIds: Set<TypeId>;\n depth: number;\n }[] = [{ shape: type, visitedTypeIds: new Set(), depth: 0 }];\n\n let loop = 0;\n while (stack.length > 0) {\n if (loop++ > LARGE_LOOP_TOLERANCE) {\n console.error(\"Infinite loop detected when collecting referenced type IDs\");\n break;\n }\n\n const { shape, visitedTypeIds: parentVisitedTypeIds, depth } = stack.pop()!;\n\n if (depth > maxDepth) {\n continue;\n }\n\n const unwrapped = unwrapReference(shape, types);\n\n // Check for circular references\n let circularReferenceDetected = false;\n for (const typeId of unwrapped.visitedTypeIds) {\n if (parentVisitedTypeIds.has(typeId)) {\n circularReferenceDetected = true;\n break;\n }\n referencedIds.add(typeId);\n }\n\n if (circularReferenceDetected) {\n continue;\n }\n\n const visitedTypeIds = new Set([...parentVisitedTypeIds, ...unwrapped.visitedTypeIds]);\n\n // Handle object types - need to traverse properties and extended types\n if (unwrapped.shape.type === \"object\") {\n const obj = unwrapObjectType(unwrapped.shape, types, parentVisitedTypeIds);\n\n // Add type IDs from object unwrapping (extended types)\n for (const typeId of obj.visitedTypeIds) {\n referencedIds.add(typeId);\n visitedTypeIds.add(typeId);\n }\n\n // Traverse each property's value shape\n for (const property of obj.properties) {\n stack.push({\n shape: property.valueShape,\n visitedTypeIds,\n depth: depth + 1\n });\n // Traverse field arguments' type shapes\n if (property.arguments) {\n for (const arg of property.arguments) {\n stack.push({\n shape: arg.type,\n visitedTypeIds,\n depth: depth + 1\n });\n }\n }\n }\n\n // Traverse extra properties if present\n if (obj.extraProperties) {\n stack.push({\n shape: obj.extraProperties,\n visitedTypeIds,\n depth: depth + 1\n });\n }\n } else if (unwrapped.shape.type === \"undiscriminatedUnion\") {\n // Traverse each variant\n for (const variant of unwrapped.shape.variants) {\n stack.push({\n shape: variant.shape,\n visitedTypeIds,\n depth: depth + 1\n });\n }\n } else if (unwrapped.shape.type === \"discriminatedUnion\") {\n // Traverse each variant (variants extend ObjectType)\n for (const variant of unwrapped.shape.variants) {\n stack.push({\n shape: { ...variant, type: \"object\" },\n visitedTypeIds,\n depth: depth + 1\n });\n }\n } else if (unwrapped.shape.type === \"list\" || unwrapped.shape.type === \"set\") {\n // Traverse item shape\n stack.push({\n shape: unwrapped.shape.itemShape,\n visitedTypeIds,\n depth: depth + 1\n });\n } else if (unwrapped.shape.type === \"map\") {\n // Traverse both key and value shapes\n stack.push({\n shape: unwrapped.shape.keyShape,\n visitedTypeIds,\n depth: depth + 1\n });\n stack.push({\n shape: unwrapped.shape.valueShape,\n visitedTypeIds,\n depth: depth + 1\n });\n }\n // Primitives, enums, literals, and unknown types don't reference other types\n }\n\n return referencedIds;\n}\n\n/**\n * Filters a types map to only include types that are referenced from the given root type.\n * This is a convenience function that combines collectReferencedTypeIds with filtering.\n *\n * @param rootType - The root type shape to start traversal from\n * @param types - The full map of all type definitions\n * @param options - Optional configuration (maxDepth defaults to 10)\n * @returns A filtered types map containing only referenced types\n */\nexport function filterReferencedTypes(\n rootType: TypeShapeOrReference,\n types: Record<TypeId, TypeDefinition>,\n options?: CollectReferencedTypeIdsOptions\n): Record<TypeId, TypeDefinition> {\n const referencedIds = collectReferencedTypeIds(rootType, types, options);\n\n return Object.fromEntries(Object.entries(types).filter(([id]) => referencedIds.has(id as TypeId))) as Record<\n TypeId,\n TypeDefinition\n >;\n}\n","import type { Availability, TypeId } from \"../navigation\";\nimport { coalesceAvailability } from \"./availability\";\nimport { LARGE_LOOP_TOLERANCE } from \"./const\";\nimport type { ObjectProperty, TypeDefinition } from \"./latest\";\nimport type { TypeShapeOrReference } from \"./types\";\nimport { unwrapObjectType, unwrapReference } from \"./unwrap\";\n\n/**\n * A path through the type tree, used to identify a type definition.\n *\n * i.e. it may be represented as a jq:\n *\n * - a.b.c.d\n * - a[].b.c\n * - a.b[key].c\n *\n * We collect the true shape of the path here so that the frontend can determine how to render it.\n */\nexport type KeyPathItem =\n | { type: \"meta\"; value: string; displayName: string | null | undefined }\n | { type: \"objectProperty\"; key: string; optional: boolean | undefined }\n | { type: \"graphqlArgument\"; name: string; optional: boolean | undefined }\n | {\n type: \"undiscriminatedUnionVariant\";\n displayName: string | null | undefined;\n idx: number;\n }\n | {\n type: \"discriminatedUnionVariant\";\n discriminant: string;\n discriminantDisplayName: string | null | undefined;\n discriminantValue: string;\n }\n | { type: \"list\" | \"set\" | \"mapValue\" | \"extra\" }\n | { type: \"enumValue\"; value: string };\n\nexport interface TypeDefinitionTreeItem {\n /**\n * The path to the type definition\n */\n path: KeyPathItem[];\n descriptions: string[];\n availability: Availability | null | undefined;\n}\n\ninterface CollectTypeDefinitionTreeOptions {\n path?: KeyPathItem[];\n availability?: Availability | null;\n maxDepth?: number;\n}\n\n/**\n * This function is intended to be used to generate a tree of all type definitions, and is intended to be used\n * for indexing the type tree and their descriptions into algolia.\n */\nexport function collectTypeDefinitionTree(\n type: TypeShapeOrReference,\n types: Record<TypeId, TypeDefinition>,\n { availability: rootAvailability, maxDepth = 5, path: rootpath = [] }: CollectTypeDefinitionTreeOptions = {}\n): TypeDefinitionTreeItem[] {\n const toRet: TypeDefinitionTreeItem[] = [];\n\n const stack: {\n type: TypeShapeOrReference;\n path: KeyPathItem[];\n descriptions: string[];\n availability: Availability | null | undefined;\n visitedTypeIds: Set<TypeId>;\n }[] = [\n {\n type,\n path: rootpath,\n availability: rootAvailability,\n descriptions: [],\n visitedTypeIds: new Set()\n }\n ];\n\n let loop = 0;\n while (stack.length > 0) {\n if (loop++ > LARGE_LOOP_TOLERANCE) {\n console.error(\"Infinite loop detected when traversing type definitions\");\n break;\n }\n\n const {\n type: last,\n path: parentpath,\n descriptions: parentDescriptions,\n visitedTypeIds: parentVisitedTypeIds,\n availability: parentAvailability\n } = stack.pop()!;\n\n if (parentpath.length > maxDepth) {\n continue;\n }\n\n const unwrapped = unwrapReference(last, types);\n\n // the child's availability must be the least stable availability of the parent and the child\n const availability = coalesceAvailability([parentAvailability, unwrapped.availability]);\n const descriptions = [...parentDescriptions, ...unwrapped.descriptions];\n\n // check if this reference has been unwrapped already by its parents\n let circularReferenceDetected = false;\n unwrapped.visitedTypeIds.forEach((typeId) => {\n if (parentVisitedTypeIds.has(typeId)) {\n circularReferenceDetected = true;\n }\n });\n\n if (circularReferenceDetected) {\n continue;\n }\n\n const visitedTypeIds = new Set([...parentVisitedTypeIds, ...unwrapped.visitedTypeIds]);\n\n if (unwrapped.shape.type === \"object\") {\n const obj = unwrapObjectType(unwrapped.shape, types);\n descriptions.push(...obj.descriptions);\n\n obj.visitedTypeIds.forEach((typeId) => visitedTypeIds.add(typeId));\n\n obj.properties.forEach((property) => {\n stack.push({\n type: property.valueShape,\n path: [\n ...parentpath,\n {\n type: \"objectProperty\",\n key: property.key,\n optional: unwrapReference(property.valueShape, types).isOptional\n }\n ],\n descriptions: property.description ? [property.description] : [],\n visitedTypeIds,\n availability\n });\n property.arguments?.forEach((arg) => {\n stack.push({\n type: arg.type,\n path: [\n ...parentpath,\n {\n type: \"objectProperty\",\n key: property.key,\n optional: unwrapReference(property.valueShape, types).isOptional\n },\n {\n type: \"graphqlArgument\",\n name: arg.name,\n optional: unwrapReference(arg.type, types).isOptional\n }\n ],\n descriptions: arg.description ? [arg.description] : [],\n visitedTypeIds,\n availability: coalesceAvailability([availability, property.availability, arg.availability])\n });\n });\n });\n\n if (obj.extraProperties) {\n stack.push({\n type: obj.extraProperties,\n path: [...parentpath, { type: \"extra\" }],\n descriptions: [],\n visitedTypeIds,\n availability\n });\n }\n }\n\n toRet.push({\n path: parentpath,\n descriptions,\n availability\n });\n\n if (unwrapped.shape.type === \"undiscriminatedUnion\") {\n unwrapped.shape.variants.forEach((variant, idx) => {\n stack.push({\n type: variant.shape,\n path: [\n ...parentpath,\n {\n type: \"undiscriminatedUnionVariant\",\n displayName: variant.displayName,\n idx\n }\n ],\n descriptions: variant.description ? [variant.description] : [],\n visitedTypeIds,\n availability: coalesceAvailability([availability, variant.availability])\n });\n });\n } else if (unwrapped.shape.type === \"discriminatedUnion\") {\n const discriminant = unwrapped.shape.discriminant;\n\n unwrapped.shape.variants.forEach((variant) => {\n const path: KeyPathItem[] = [\n ...parentpath,\n {\n type: \"discriminatedUnionVariant\",\n discriminant,\n discriminantDisplayName: variant.displayName,\n discriminantValue: variant.discriminantValue\n }\n ];\n stack.push({\n type: { ...variant, type: \"object\" },\n path,\n descriptions: variant.description ? [variant.description] : [],\n visitedTypeIds,\n availability: coalesceAvailability([availability, variant.availability])\n });\n });\n } else if (unwrapped.shape.type === \"list\" || unwrapped.shape.type === \"set\") {\n stack.push({\n type: unwrapped.shape.itemShape,\n path: [...parentpath, { type: unwrapped.shape.type }],\n descriptions,\n visitedTypeIds,\n availability\n });\n } else if (unwrapped.shape.type === \"map\") {\n stack.push({\n type: unwrapped.shape.valueShape,\n path: [...parentpath, { type: \"mapValue\" }],\n // we don't need to add the descriptions of the key shape here, but the descriptions from the key are appended here:\n descriptions: [...descriptions, ...unwrapReference(unwrapped.shape.keyShape, types).descriptions],\n visitedTypeIds,\n availability\n });\n } else if (unwrapped.shape.type === \"enum\") {\n unwrapped.shape.values.forEach((value) => {\n toRet.push({\n path: [...parentpath, { type: \"enumValue\", value: value.value }],\n descriptions: value.description ? [value.description] : [],\n availability\n });\n });\n }\n }\n\n return toRet;\n}\n\nexport function collectTypeDefinitionTreeForObjectProperty(\n property: ObjectProperty,\n types: Record<TypeId, TypeDefinition>,\n rootPath: KeyPathItem[] = [],\n maxDepth = 5\n): TypeDefinitionTreeItem[] {\n return [\n {\n path: [\n ...rootPath,\n {\n type: \"objectProperty\",\n key: property.key,\n optional: unwrapReference(property.valueShape, types).isOptional\n }\n ],\n descriptions: property.description ? [property.description] : [],\n availability: property.availability ?? undefined\n },\n ...collectTypeDefinitionTree(property.valueShape, types, {\n maxDepth: maxDepth - 1,\n availability: property.availability ?? undefined,\n path: [\n ...rootPath,\n {\n type: \"objectProperty\",\n key: property.key,\n optional: unwrapReference(property.valueShape, types).isOptional\n }\n ]\n }),\n ...(property.arguments ?? []).flatMap((arg) => [\n {\n path: [\n ...rootPath,\n {\n type: \"objectProperty\" as const,\n key: property.key,\n optional: unwrapReference(property.valueShape, types).isOptional\n },\n {\n type: \"graphqlArgument\" as const,\n name: arg.name,\n optional: unwrapReference(arg.type, types).isOptional\n }\n ],\n descriptions: arg.description ? [arg.description] : [],\n availability: coalesceAvailability([property.availability, arg.availability])\n },\n ...collectTypeDefinitionTree(arg.type, types, {\n maxDepth: maxDepth - 1,\n availability: coalesceAvailability([property.availability, arg.availability]),\n path: [\n ...rootPath,\n {\n type: \"objectProperty\",\n key: property.key,\n optional: unwrapReference(property.valueShape, types).isOptional\n },\n {\n type: \"graphqlArgument\",\n name: arg.name,\n optional: unwrapReference(arg.type, types).isOptional\n }\n ]\n })\n ])\n ];\n}\n","import visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\nimport { noop } from \"ts-essentials\";\n\nimport type * as Latest from \"./latest\";\n\nexport class ApiTypeIdVisitor {\n public static visitEndpointDefinition(\n endpoint: Latest.EndpointDefinition,\n visit: (typeId: Latest.TypeId) => void\n ): void {\n endpoint.pathParameters?.forEach((pathParameter) => {\n ApiTypeIdVisitor.visitTypeShape(pathParameter.valueShape, visit);\n });\n endpoint.queryParameters?.forEach((queryParameter) => {\n ApiTypeIdVisitor.visitTypeShape(queryParameter.valueShape, visit);\n });\n endpoint.requestHeaders?.forEach((header) => {\n ApiTypeIdVisitor.visitTypeShape(header.valueShape, visit);\n });\n endpoint.responseHeaders?.forEach((header) => {\n ApiTypeIdVisitor.visitTypeShape(header.valueShape, visit);\n });\n endpoint.requests?.forEach((request) => {\n if (request.body != null) {\n ApiTypeIdVisitor.visitHttpRequestBodyShape(request.body, visit);\n }\n });\n endpoint.responses?.forEach((response) => {\n if (response.body != null) {\n ApiTypeIdVisitor.visitHttpResponseBodyShape(response.body, visit);\n }\n });\n endpoint.errors?.forEach((error) => {\n if (error.shape != null) {\n ApiTypeIdVisitor.visitTypeShape(error.shape, visit);\n }\n });\n }\n\n public static visitWebSocketChannel(\n channel: Latest.WebSocketChannel,\n visit: (typeId: Latest.TypeId) => void\n ): void {\n channel.requestHeaders?.forEach((header) => {\n ApiTypeIdVisitor.visitTypeShape(header.valueShape, visit);\n });\n channel.pathParameters?.forEach((pathParameter) => {\n ApiTypeIdVisitor.visitTypeShape(pathParameter.valueShape, visit);\n });\n channel.queryParameters?.forEach((queryParameter) => {\n ApiTypeIdVisitor.visitTypeShape(queryParameter.valueShape, visit);\n });\n channel.messages.forEach((message) => {\n ApiTypeIdVisitor.visitTypeShape(message.body, visit);\n });\n }\n\n public static visitWebhookDefinition(\n webhook: Latest.WebhookDefinition,\n visit: (typeId: Latest.TypeId) => void\n ): void {\n webhook.headers?.forEach((header) => {\n ApiTypeIdVisitor.visitTypeShape(header.valueShape, visit);\n });\n if (webhook.payloads?.[0] != null) {\n ApiTypeIdVisitor.visitWebhookPayloadShape(webhook.payloads[0].shape, visit);\n }\n webhook.responses?.forEach((response) => {\n if (response.body != null) {\n ApiTypeIdVisitor.visitHttpResponseBodyShape(response.body, visit);\n }\n });\n }\n\n public static visitGraphQlOperation(\n operation: Latest.GraphQlOperation,\n visit: (typeId: Latest.TypeId) => void\n ): void {\n operation.arguments?.forEach((arg) => {\n ApiTypeIdVisitor.visitTypeShape(arg.type, visit);\n });\n ApiTypeIdVisitor.visitTypeShape(operation.returnType, visit);\n }\n\n public static visitWebhookPayloadShape(\n payloadShape: Latest.WebhookPayloadShape,\n visit: (typeId: Latest.TypeId) => void\n ): void {\n return visitDiscriminatedUnion(payloadShape)._visit({\n object: (value) => ApiTypeIdVisitor.visitObjectType(value, visit),\n alias: (value) => ApiTypeIdVisitor.visitTypeReference(value.value, visit),\n formData: (value) => ApiTypeIdVisitor.visitFormDataRequest(value, visit)\n });\n }\n\n public static visitHttpRequestBodyShape(\n bodyShape: Latest.HttpRequestBodyShape,\n visit: (typeId: Latest.TypeId) => void\n ): void {\n return visitDiscriminatedUnion(bodyShape)._visit({\n object: (value) => ApiTypeIdVisitor.visitObjectType(value, visit),\n alias: (value) => ApiTypeIdVisitor.visitTypeReference(value.value, visit),\n bytes: noop,\n formData: (value) => ApiTypeIdVisitor.visitFormDataRequest(value, visit)\n });\n }\n\n public static visitHttpResponseBodyShape(\n bodyShape: Latest.HttpResponseBodyShape,\n visit: (typeId: Latest.TypeId) => void\n ): void {\n return visitDiscriminatedUnion(bodyShape)._visit({\n object: (value) => ApiTypeIdVisitor.visitObjectType(value, visit),\n alias: (value) => ApiTypeIdVisitor.visitTypeReference(value.value, visit),\n fileDownload: noop,\n streamingText: noop,\n stream: (value) => ApiTypeIdVisitor.visitTypeShape(value.shape, visit),\n empty: noop\n });\n }\n\n public static visitFormDataRequest(\n typeDefinition: Latest.FormDataRequest,\n visit: (typeId: Latest.TypeId) => void\n ): void {\n return typeDefinition.fields.forEach((field) =>\n visitDiscriminatedUnion(field)._visit({\n file: noop,\n files: noop,\n property: (property) => ApiTypeIdVisitor.visitTypeShape(property.valueShape, visit)\n })\n );\n }\n\n public static visitTypeDefinition(\n typeDefinition: Latest.TypeDefinition,\n visit: (typeId: Latest.TypeId) => void\n ): void {\n return ApiTypeIdVisitor.visitTypeShape(typeDefinition.shape, visit);\n }\n\n public static visitTypeShape(typeShape: Latest.TypeShape, visit: (typeId: Latest.TypeId) => void): void {\n return visitDiscriminatedUnion(typeShape)._visit({\n object: (value) => ApiTypeIdVisitor.visitObjectType(value, visit),\n alias: (value) => ApiTypeIdVisitor.visitTypeReference(value.value, visit),\n enum: noop,\n undiscriminatedUnion: (value) =>\n value.variants.forEach((variant) => ApiTypeIdVisitor.visitTypeShape(variant.shape, visit)),\n discriminatedUnion: (value) =>\n value.variants.forEach((variant) => ApiTypeIdVisitor.visitObjectType(variant, visit))\n });\n }\n\n public static visitObjectType(typeShape: Latest.ObjectType, visit: (typeId: Latest.TypeId) => void): void {\n typeShape.extends.forEach(visit);\n typeShape.properties.forEach((property) => {\n ApiTypeIdVisitor.visitTypeShape(property.valueShape, visit);\n property.arguments?.forEach((arg) => {\n ApiTypeIdVisitor.visitTypeShape(arg.type, visit);\n });\n });\n }\n\n public static visitTypeReference(\n typeReference: Latest.TypeReference,\n visit: (typeId: Latest.TypeId) => void\n ): void {\n return visitDiscriminatedUnion(typeReference)._visit({\n id: (value) => visit(value.id),\n primitive: noop,\n optional: (value) => ApiTypeIdVisitor.visitTypeShape(value.shape, visit),\n nullable: (value) => ApiTypeIdVisitor.visitTypeShape(value.shape, visit),\n list: (value) => ApiTypeIdVisitor.visitTypeShape(value.itemShape, visit),\n set: (value) => ApiTypeIdVisitor.visitTypeShape(value.itemShape, visit),\n map: (value) => {\n ApiTypeIdVisitor.visitTypeShape(value.keyShape, visit);\n ApiTypeIdVisitor.visitTypeShape(value.valueShape, visit);\n },\n literal: noop,\n unknown: noop\n });\n }\n}\n","import type { GraphQlOperationId, TypeId } from \"../navigation\";\nimport type * as Latest from \"./latest\";\nimport { ApiTypeIdVisitor } from \"./typeid-visitor\";\n\n/**\n * Where a GraphQL type is incorporated: the types and operations that name it, with the\n * exact field, argument or return position, so a type page can link back to the field\n * anchor it is used at.\n */\nexport type GraphqlTypeReferrer =\n | {\n type: \"type\";\n typeId: TypeId;\n /** Display name of the referring type, falling back to its id. */\n name: string;\n /** Fields of the referring type whose value is the referenced type. */\n fields: string[];\n /** Field arguments of the referring type whose type is the referenced type. */\n fieldArguments: { field: string; argument: string }[];\n /** Whether the referring type names it as a union variant (or aliases it directly). */\n isVariant: boolean;\n }\n | {\n type: \"operation\";\n operationId: GraphQlOperationId;\n /** Display name of the operation, falling back to its GraphQL field name. */\n name: string;\n operationType: Latest.GraphQlOperationType;\n /** Arguments of the operation whose type is the referenced type. */\n arguments: string[];\n /** Whether the operation returns the referenced type. */\n isReturnType: boolean;\n };\n\nfunction shapeReferences(shape: Latest.TypeShape, typeIds: ReadonlySet<TypeId>): boolean {\n let found = false;\n ApiTypeIdVisitor.visitTypeShape(shape, (typeId) => {\n if (typeIds.has(typeId)) {\n found = true;\n }\n });\n return found;\n}\n\nfunction definitionReferences(definition: Latest.TypeDefinition, typeIds: ReadonlySet<TypeId>): boolean {\n return shapeReferences(definition.shape, typeIds);\n}\n\n/**\n * The referring type as it is needed for a back-reference list: the fields that actually\n * reference one of `typeIds`, and nothing else. A pruned type page payload carries these\n * alongside the page type's own (forward) closure, so trimming keeps the payload\n * proportional to the references being listed rather than to the referring types' own\n * closures -- which matters for a widely used scalar or enum.\n */\nexport function trimTypeDefinitionToReferences(\n definition: Latest.TypeDefinition,\n typeIds: ReadonlySet<TypeId>\n): Latest.TypeDefinition {\n if (definition.shape.type !== \"object\") {\n return definition;\n }\n const properties = definition.shape.properties.filter(\n (property) =>\n shapeReferences(property.valueShape, typeIds) ||\n (property.arguments?.some((argument) => shapeReferences(argument.type, typeIds)) ?? false)\n );\n return {\n ...definition,\n shape: {\n ...definition.shape,\n properties,\n extraProperties: undefined\n }\n };\n}\n\n/**\n * The operation as it is needed for a back-reference list -- arguments narrowed to the ones\n * that reference `typeIds`, examples and snippets dropped -- or undefined when the operation\n * does not reference any of them.\n */\nexport function trimGraphQlOperationToReferences(\n operation: Latest.GraphQlOperation,\n typeIds: ReadonlySet<TypeId>\n): Latest.GraphQlOperation | undefined {\n const args = (operation.arguments ?? []).filter((argument) => shapeReferences(argument.type, typeIds));\n const isReturnType = shapeReferences(operation.returnType, typeIds);\n if (args.length === 0 && !isReturnType) {\n return undefined;\n }\n return {\n ...operation,\n arguments: args.length > 0 ? args : undefined,\n examples: undefined,\n snippets: undefined\n };\n}\n\n/**\n * The types that reference any of `typeIds`, keyed by definition order. Returned as ids so\n * the caller decides what to do with them (seed them into a pruned payload, count them).\n */\nexport function collectReferencingTypeIds(\n types: Record<TypeId, Latest.TypeDefinition>,\n typeIds: ReadonlySet<TypeId>\n): TypeId[] {\n const referencing: TypeId[] = [];\n for (const [rawId, definition] of Object.entries(types)) {\n const candidateId = rawId as TypeId;\n if (typeIds.has(candidateId)) {\n continue;\n }\n if (definitionReferences(definition, typeIds)) {\n referencing.push(candidateId);\n }\n }\n return referencing;\n}\n\n/**\n * Everything in `api` that incorporates `typeId`: the types that have it as a field, field\n * argument or union variant, and the operations that take it as an argument or return it.\n * Order follows the definition's own order, so the rendered list is stable.\n *\n * Only sees what the (pruned) definition it is given contains -- {@link trimTypeDefinitionToReferences}\n * and {@link trimGraphQlOperationToReferences} are how the pruner puts the referring\n * entries there in the first place.\n */\nexport function collectGraphqlTypeReferrers(\n api: Pick<Latest.ApiDefinition, \"types\" | \"graphqlOperations\">,\n typeId: TypeId\n): GraphqlTypeReferrer[] {\n const target: ReadonlySet<TypeId> = new Set([typeId]);\n const referrers: GraphqlTypeReferrer[] = [];\n\n for (const [rawId, definition] of Object.entries(api.types)) {\n const candidateId = rawId as TypeId;\n if (candidateId === typeId) {\n continue;\n }\n const fields: string[] = [];\n const fieldArguments: { field: string; argument: string }[] = [];\n if (definition.shape.type === \"object\") {\n for (const property of definition.shape.properties) {\n if (shapeReferences(property.valueShape, target)) {\n fields.push(property.key);\n }\n for (const argument of property.arguments ?? []) {\n if (shapeReferences(argument.type, target)) {\n fieldArguments.push({ field: property.key, argument: argument.name });\n }\n }\n }\n if (fields.length === 0 && fieldArguments.length === 0) {\n continue;\n }\n } else if (!definitionReferences(definition, target)) {\n continue;\n }\n referrers.push({\n type: \"type\",\n typeId: candidateId,\n name: definition.displayName ?? definition.name ?? candidateId,\n fields,\n fieldArguments,\n isVariant: fields.length === 0 && fieldArguments.length === 0\n });\n }\n\n for (const operation of Object.values(api.graphqlOperations)) {\n const args = (operation.arguments ?? [])\n .filter((argument) => shapeReferences(argument.type, target))\n .map((argument) => argument.name);\n const isReturnType = shapeReferences(operation.returnType, target);\n if (args.length === 0 && !isReturnType) {\n continue;\n }\n referrers.push({\n type: \"operation\",\n operationId: operation.id,\n name: operation.displayName ?? operation.name,\n operationType: operation.operationType,\n arguments: args,\n isReturnType\n });\n }\n\n return referrers;\n}\n","import { getGraphqlOperationIds, TypeId } from \"../orpc-client/api/shared\";\nimport {\n collectReferencingTypeIds,\n trimGraphQlOperationToReferences,\n trimTypeDefinitionToReferences\n} from \"./graphql-type-references\";\nimport type * as Latest from \"./latest\";\nimport { EndpointId } from \"./latest\";\nimport { ApiTypeIdVisitor } from \"./typeid-visitor\";\n\nexport type PruningNodeType =\n | { type: \"endpoint\"; endpointId: Latest.EndpointId }\n | { type: \"webSocket\"; webSocketId: Latest.WebSocketId }\n | { type: \"webhook\"; webhookId: Latest.WebhookId }\n | { type: \"grpc\"; grpcId: Latest.GrpcId }\n | {\n type: \"graphql\";\n graphqlOperationId: Latest.GraphQlOperationId;\n graphqlOperationIds?: Latest.GraphQlOperationId[];\n }\n | { type: \"graphqlType\"; typeId: Latest.TypeId };\n\nclass ApiDefinitionPruner {\n static instances = new WeakMap<Latest.ApiDefinition, ApiDefinitionPruner>();\n\n static from(api: Latest.ApiDefinition): ApiDefinitionPruner {\n const toRet = ApiDefinitionPruner.instances.get(api) ?? new ApiDefinitionPruner(api);\n ApiDefinitionPruner.instances.set(api, toRet);\n return toRet;\n }\n\n private constructor(private api: Latest.ApiDefinition) {}\n\n /**\n * This utility is designed to prune an API definition to only include the desired endpoints, websockets, and webhooks\n * based on the provided node of the navigation tree, which will reduce the size of the API definition that is sent to the client.\n *\n * @param node of the navigation tree to prune the API definition to\n * @returns a new API definition that is the result of pruning the input API definition to the desired node\n */\n public prune(...nodes: PruningNodeType[]): Latest.ApiDefinition {\n const toRet: Latest.ApiDefinition = {\n ...this.api,\n endpoints: {},\n websockets: {},\n webhooks: {},\n graphqlOperations: {},\n types: {},\n subpackages: {},\n auths: {}\n };\n\n const namespaces = new Set<Latest.SubpackageId>();\n const authSchemes = new Set<Latest.AuthSchemeId>();\n const seedTypeIds = new Set<Latest.TypeId>();\n const graphqlTypePageIds = new Set<Latest.TypeId>();\n\n for (const node of nodes) {\n if (node.type === \"endpoint\") {\n const found = this.api.endpoints[node.endpointId];\n if (found) {\n toRet.endpoints[node.endpointId] = found;\n found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));\n found.auth?.forEach((authSchemeId) => authSchemes.add(authSchemeId));\n }\n } else if (node.type === \"webSocket\") {\n const found = this.api.websockets[node.webSocketId];\n if (found) {\n toRet.websockets[node.webSocketId] = found;\n found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));\n found.auth?.forEach((authSchemeId) => authSchemes.add(authSchemeId));\n }\n } else if (node.type === \"webhook\") {\n const found = this.api.webhooks[node.webhookId];\n if (found) {\n toRet.webhooks[node.webhookId] = found;\n found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));\n }\n } else if (node.type === \"grpc\") {\n const grpcIdAsEndpointId = EndpointId(node.grpcId);\n const found = this.api.endpoints[grpcIdAsEndpointId];\n if (found) {\n toRet.endpoints[grpcIdAsEndpointId] = found;\n found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));\n }\n } else if (node.type === \"graphql\") {\n for (const opId of getGraphqlOperationIds(node)) {\n const found = this.api.graphqlOperations[opId];\n if (found) {\n toRet.graphqlOperations[opId] = found;\n found.namespace?.forEach((subpackageId) => namespaces.add(subpackageId));\n }\n }\n } else if (node.type === \"graphqlType\") {\n const found = this.api.types[node.typeId];\n if (found) {\n seedTypeIds.add(node.typeId);\n graphqlTypePageIds.add(node.typeId);\n // `extends` points from an implementation to the interface it implements, and the\n // closure below only walks references forward. An interface page's \"Implemented by\"\n // list therefore has to seed the implementations explicitly.\n for (const implementorId of this.getImplementorTypeIds(node.typeId)) {\n seedTypeIds.add(implementorId);\n }\n }\n }\n }\n\n toRet.types = this.pruneTypes(toRet, seedTypeIds);\n if (graphqlTypePageIds.size > 0) {\n this.addBackReferences(toRet, graphqlTypePageIds);\n }\n namespaces.forEach((subpackageId) => {\n const subpackage = this.api.subpackages[subpackageId];\n if (subpackage) {\n toRet.subpackages[subpackageId] = subpackage;\n }\n });\n authSchemes.forEach((authSchemeId) => {\n const authScheme = this.api.auths[authSchemeId];\n if (authScheme) {\n toRet.auths[authSchemeId] = authScheme;\n }\n });\n\n return toRet;\n }\n\n /**\n * Add what *references* the type a page documents. The closure above walks references\n * forward, so \"what incorporates this type\" is absent from a type page's payload unless it\n * is seeded here; the referring entries are trimmed to the referencing fields and\n * arguments only, and are deliberately added after `pruneTypes` so their own closures are\n * not pulled in with them.\n */\n private addBackReferences(toRet: Latest.ApiDefinition, pageTypeIds: ReadonlySet<Latest.TypeId>): void {\n for (const referencingId of collectReferencingTypeIds(this.api.types, pageTypeIds)) {\n if (toRet.types[referencingId] != null) {\n continue;\n }\n const definition = this.api.types[referencingId];\n if (definition != null) {\n toRet.types[referencingId] = trimTypeDefinitionToReferences(definition, pageTypeIds);\n }\n }\n for (const [operationId, operation] of Object.entries(this.api.graphqlOperations)) {\n if (toRet.graphqlOperations[operationId] != null) {\n continue;\n }\n const trimmed = trimGraphQlOperationToReferences(operation, pageTypeIds);\n if (trimmed != null) {\n toRet.graphqlOperations[operationId] = trimmed;\n }\n }\n }\n\n private getImplementorTypeIds(typeId: Latest.TypeId): Latest.TypeId[] {\n return getImplementorTypeIds(this.api.types, typeId);\n }\n\n private pruneTypes(\n partiallyPrunedApi: Latest.ApiDefinition,\n seedTypeIds: ReadonlySet<Latest.TypeId> = new Set()\n ): Record<string, Latest.TypeDefinition> {\n let typeIds = new Set<Latest.TypeId>(seedTypeIds);\n partiallyPrunedApi.globalHeaders?.forEach((header) => {\n ApiTypeIdVisitor.visitTypeShape(header.valueShape, (typeId) => typeIds.add(typeId));\n });\n\n for (const endpoint of Object.values(partiallyPrunedApi.endpoints)) {\n ApiTypeIdVisitor.visitEndpointDefinition(endpoint, (typeId) => typeIds.add(typeId));\n }\n\n for (const websocket of Object.values(partiallyPrunedApi.websockets)) {\n ApiTypeIdVisitor.visitWebSocketChannel(websocket, (typeId) => typeIds.add(typeId));\n }\n\n for (const webhook of Object.values(partiallyPrunedApi.webhooks)) {\n ApiTypeIdVisitor.visitWebhookDefinition(webhook, (typeId) => typeIds.add(typeId));\n }\n\n for (const graphqlOperation of Object.values(partiallyPrunedApi.graphqlOperations)) {\n ApiTypeIdVisitor.visitGraphQlOperation(graphqlOperation, (typeId) => typeIds.add(typeId));\n }\n\n typeIds = this.expandTypeIds(typeIds);\n\n const types: Record<string, Latest.TypeDefinition> = {};\n\n typeIds.forEach((typeId) => {\n const type = this.api.types[typeId];\n if (type != null) {\n types[typeId] = type;\n }\n });\n\n return types;\n }\n\n private expandTypeIds(typeIds: ReadonlySet<Latest.TypeId>): Set<Latest.TypeId> {\n const visitedTypeIds = new Set<Latest.TypeId>();\n const queue = Array.from(typeIds);\n // Ensure each type is enqueued at most once. Because a type can be\n // referenced by many others, enqueueing without deduping would push the\n // same id repeatedly, making the traversal scale with the number of\n // references rather than the number of distinct types.\n const enqueuedTypeIds = new Set<Latest.TypeId>(typeIds);\n\n // Defensive guard against a genuine runaway loop (e.g. a future bug that\n // breaks the dedup invariant). With deduped enqueues, each distinct type\n // is processed at most once, so the number of iterations can never\n // exceed the number of types in the definition plus the seed ids.\n // Deriving the cap from the actual definition size (rather than a fixed\n // constant) keeps the safety net without falsely rejecting legitimately\n // large specs.\n const maxIterations = Object.keys(this.api.types).length + typeIds.size;\n\n let loop = 0;\n while (queue.length > 0) {\n if (loop++ > maxIterations) {\n throw new Error(\"Infinite loop detected while expanding type references.\");\n }\n\n const typeId = queue.pop();\n if (typeId != null && !visitedTypeIds.has(typeId)) {\n visitedTypeIds.add(typeId);\n const type = this.api.types[typeId];\n if (type) {\n ApiTypeIdVisitor.visitTypeDefinition(type, (nestedTypeId) => {\n // Only enqueue types that exist in the definition; missing\n // references contribute nothing to the pruned output and\n // must not count against the iteration bound above.\n if (!enqueuedTypeIds.has(nestedTypeId) && this.api.types[nestedTypeId] != null) {\n enqueuedTypeIds.add(nestedTypeId);\n queue.push(nestedTypeId);\n }\n });\n }\n }\n }\n\n return visitedTypeIds;\n }\n}\n\n/**\n * The types that declare `typeId` in their `extends` -- i.e. the GraphQL types that implement\n * an interface -- sorted by display name, since the order of a pruned definition's type map\n * depends on how the closure was walked.\n */\nexport function getImplementorTypeIds(\n types: Record<Latest.TypeId, Latest.TypeDefinition>,\n typeId: Latest.TypeId\n): Latest.TypeId[] {\n return Object.entries(types)\n .filter(\n ([candidateId, candidate]) =>\n candidateId !== typeId && candidate.shape.type === \"object\" && candidate.shape.extends.includes(typeId)\n )\n .sort(([, a], [, b]) => displayNameOf(a).localeCompare(displayNameOf(b)))\n .map(([candidateId]) => TypeId(candidateId));\n}\n\nfunction displayNameOf(type: Latest.TypeDefinition): string {\n return type.displayName ?? type.name;\n}\n\nexport function prune(api: Latest.ApiDefinition, ...nodes: PruningNodeType[]): Latest.ApiDefinition {\n return ApiDefinitionPruner.from(api).prune(...nodes);\n}\n","import type {\n EndpointNode,\n GraphQlNode,\n GraphQlTypeNode,\n GrpcNode,\n TypeId,\n WebhookNode,\n WebSocketNode\n} from \"../navigation\";\nimport { collectGraphqlTypeReferrers, type GraphqlTypeReferrer } from \"./graphql-type-references\";\nimport type {\n ApiDefinition,\n AuthScheme,\n AuthSchemeId,\n EndpointDefinition,\n EndpointId,\n GraphQlOperation,\n ObjectProperty,\n TypeDefinition,\n WebhookDefinition,\n WebSocketChannel\n} from \"./latest\";\nimport { getImplementorTypeIds, prune } from \"./prune\";\n\nexport type AuthSchemeWithKey = {\n key: AuthSchemeId;\n scheme: AuthScheme;\n};\n\nexport type AuthOptionEntry = {\n key: string;\n schemeIds: AuthSchemeId[];\n schemes: AuthScheme[];\n label: string;\n};\n\nexport type EndpointContext = {\n node: EndpointNode;\n endpoint: EndpointDefinition;\n globalHeaders: ObjectProperty[];\n auths: AuthScheme[];\n authsWithKeys: AuthSchemeWithKey[];\n authOptions: AuthScheme[][];\n authOptionEntries: AuthOptionEntry[];\n types: Record<TypeId, TypeDefinition>;\n};\n\nfunction getAuthSchemeLabel(scheme: AuthScheme): string {\n if (scheme.type === \"basicAuth\") {\n return \"Basic Auth\";\n }\n if (scheme.type === \"bearerAuth\") {\n return \"Bearer\";\n }\n if (scheme.type === \"header\") {\n return scheme.prefix || \"API Key\";\n }\n if (scheme.type === \"oAuth\") {\n return \"OAuth\";\n }\n return \"Auth\";\n}\n\nfunction constructAuthOptions(\n endpoint: EndpointDefinition,\n authsMap: Record<AuthSchemeId, AuthScheme>\n): AuthScheme[][] {\n if (endpoint.multiAuth != null && endpoint.multiAuth.length > 0) {\n return endpoint.multiAuth\n .map((multiAuthGroup) =>\n multiAuthGroup.schemes\n .map((schemeId) => authsMap[schemeId])\n .filter((scheme): scheme is AuthScheme => scheme != null)\n )\n .filter((group) => group.length > 0);\n }\n\n if (endpoint.auth != null && endpoint.auth.length > 0) {\n return endpoint.auth\n .map((schemeId) => {\n const scheme = authsMap[schemeId];\n return scheme ? [scheme] : null;\n })\n .filter((group): group is AuthScheme[] => group != null);\n }\n\n return [];\n}\n\nfunction constructAuthOptionEntries(\n endpoint: EndpointDefinition,\n authsMap: Record<AuthSchemeId, AuthScheme>\n): AuthOptionEntry[] {\n if (endpoint.multiAuth != null && endpoint.multiAuth.length > 0) {\n return endpoint.multiAuth\n .map((multiAuthGroup) => {\n const schemeIds = multiAuthGroup.schemes;\n const schemes = schemeIds\n .map((schemeId) => authsMap[schemeId])\n .filter((scheme): scheme is AuthScheme => scheme != null);\n\n if (schemes.length === 0) {\n return null;\n }\n\n const sortedSchemeIds = [...schemeIds].sort();\n const key = schemes.length === 1 ? String(schemeIds[0]) : `multi:${sortedSchemeIds.join(\"+\")}`;\n const label = schemes.map(getAuthSchemeLabel).join(\" + \");\n\n return {\n key,\n schemeIds,\n schemes,\n label\n };\n })\n .filter((entry): entry is AuthOptionEntry => entry != null);\n }\n\n if (endpoint.auth != null && endpoint.auth.length > 0) {\n return endpoint.auth\n .map((schemeId) => {\n const scheme = authsMap[schemeId];\n if (!scheme) {\n return null;\n }\n return {\n key: String(schemeId),\n schemeIds: [schemeId],\n schemes: [scheme],\n label: getAuthSchemeLabel(scheme)\n };\n })\n .filter((entry): entry is AuthOptionEntry => entry != null);\n }\n\n return [];\n}\n\nexport function createEndpointContext(\n node: EndpointNode | undefined,\n apiDefinition: ApiDefinition | undefined\n): EndpointContext | undefined {\n if (!node) {\n console.warn(\"[createEndpointContext] node is undefined\");\n return undefined;\n }\n if (apiDefinition == null) {\n console.warn(\n `[createEndpointContext] apiDefinition is undefined for node id=${node.id}, endpointId=${node.endpointId}`\n );\n return undefined;\n }\n const api = prune(apiDefinition, node);\n const endpoint = api.endpoints[node.endpointId];\n if (!endpoint) {\n const availableEndpointIds = Object.keys(api.endpoints);\n console.warn(\n `[createEndpointContext] endpoint not found after pruning. endpointId=${node.endpointId}, apiDefinitionId=${node.apiDefinitionId}, availableEndpointIds=[${availableEndpointIds.join(\", \")}]`\n );\n return undefined;\n }\n return {\n node,\n endpoint,\n auths: endpoint.auth?.map((id) => api.auths[id]).filter((auth): auth is AuthScheme => auth != null) ?? [],\n authsWithKeys:\n endpoint.auth\n ?.map((id) => {\n const scheme = api.auths[id];\n return scheme ? { key: id, scheme } : null;\n })\n .filter((item): item is AuthSchemeWithKey => item != null) ?? [],\n authOptions: constructAuthOptions(endpoint, api.auths),\n authOptionEntries: constructAuthOptionEntries(endpoint, api.auths),\n globalHeaders: api.globalHeaders ?? [],\n types: api.types\n };\n}\n\nexport type WebSocketContext = {\n node: WebSocketNode;\n channel: WebSocketChannel;\n globalHeaders: ObjectProperty[];\n auths: AuthScheme[];\n authsWithKeys: AuthSchemeWithKey[];\n authOptions: AuthScheme[][];\n authOptionEntries: AuthOptionEntry[];\n types: Record<TypeId, TypeDefinition>;\n};\n\nfunction constructWebSocketAuthOptions(\n channel: WebSocketChannel,\n authsMap: Record<AuthSchemeId, AuthScheme>\n): AuthScheme[][] {\n if (channel.auth != null && channel.auth.length > 0) {\n return channel.auth\n .map((schemeId) => {\n const scheme = authsMap[schemeId];\n return scheme ? [scheme] : null;\n })\n .filter((group): group is AuthScheme[] => group != null);\n }\n\n return [];\n}\n\nfunction constructWebSocketAuthOptionEntries(\n channel: WebSocketChannel,\n authsMap: Record<AuthSchemeId, AuthScheme>\n): AuthOptionEntry[] {\n if (channel.auth != null && channel.auth.length > 0) {\n return channel.auth\n .map((schemeId) => {\n const scheme = authsMap[schemeId];\n if (!scheme) {\n return null;\n }\n return {\n key: String(schemeId),\n schemeIds: [schemeId],\n schemes: [scheme],\n label: getAuthSchemeLabel(scheme)\n };\n })\n .filter((entry): entry is AuthOptionEntry => entry != null);\n }\n\n return [];\n}\n\nexport function createWebSocketContext(\n node: WebSocketNode | undefined,\n apiDefinition: ApiDefinition | undefined\n): WebSocketContext | undefined {\n if (!node) {\n console.warn(\"[createWebSocketContext] node is undefined\");\n return undefined;\n }\n if (apiDefinition == null) {\n console.warn(\n `[createWebSocketContext] apiDefinition is undefined for node id=${node.id}, webSocketId=${node.webSocketId}`\n );\n return undefined;\n }\n const api = prune(apiDefinition, node);\n const channel = api.websockets[node.webSocketId];\n if (!channel) {\n const availableWebSocketIds = Object.keys(api.websockets);\n console.warn(\n `[createWebSocketContext] webSocket channel not found after pruning. webSocketId=${node.webSocketId}, apiDefinitionId=${node.apiDefinitionId}, availableWebSocketIds=[${availableWebSocketIds.join(\", \")}]`\n );\n return undefined;\n }\n return {\n node,\n channel,\n auths: channel.auth?.map((id) => api.auths[id]).filter((auth): auth is AuthScheme => auth != null) ?? [],\n authsWithKeys:\n channel.auth\n ?.map((id) => {\n const scheme = api.auths[id];\n return scheme ? { key: id, scheme } : null;\n })\n .filter((item): item is AuthSchemeWithKey => item != null) ?? [],\n authOptions: constructWebSocketAuthOptions(channel, api.auths),\n authOptionEntries: constructWebSocketAuthOptionEntries(channel, api.auths),\n globalHeaders: api.globalHeaders ?? [],\n types: api.types\n };\n}\n\nexport type WebhookContext = {\n node: WebhookNode;\n webhook: WebhookDefinition;\n types: Record<TypeId, TypeDefinition>;\n};\n\nexport function createWebhookContext(\n node: WebhookNode | undefined,\n apiDefinition: ApiDefinition | undefined\n): WebhookContext | undefined {\n if (!node) {\n console.warn(\"[createWebhookContext] node is undefined\");\n return undefined;\n }\n if (apiDefinition == null) {\n console.warn(\n `[createWebhookContext] apiDefinition is undefined for node id=${node.id}, webhookId=${node.webhookId}`\n );\n return undefined;\n }\n const api = prune(apiDefinition, node);\n const webhook = api.webhooks[node.webhookId];\n if (!webhook) {\n const availableWebhookIds = Object.keys(api.webhooks);\n console.warn(\n `[createWebhookContext] webhook not found after pruning. webhookId=${node.webhookId}, apiDefinitionId=${node.apiDefinitionId}, availableWebhookIds=[${availableWebhookIds.join(\", \")}]`\n );\n return undefined;\n }\n return {\n node,\n webhook,\n types: api.types\n };\n}\n\nexport type GrpcContext = {\n node: GrpcNode;\n grpc: EndpointDefinition;\n types: Record<TypeId, TypeDefinition>;\n};\n\nexport function createGrpcContext(\n node: GrpcNode | undefined,\n apiDefinition: ApiDefinition | undefined\n): GrpcContext | undefined {\n if (!node) {\n console.warn(\"[createGrpcContext] node is undefined\");\n return undefined;\n }\n if (apiDefinition == null) {\n console.warn(`[createGrpcContext] apiDefinition is undefined for node id=${node.id}, grpcId=${node.grpcId}`);\n return undefined;\n }\n const api = prune(apiDefinition, node);\n const grpc = api.endpoints[node.grpcId as unknown as EndpointId];\n if (!grpc) {\n const availableEndpointIds = Object.keys(api.endpoints);\n console.warn(\n `[createGrpcContext] grpc endpoint not found after pruning. grpcId=${node.grpcId}, apiDefinitionId=${node.apiDefinitionId}, availableEndpointIds=[${availableEndpointIds.join(\", \")}]`\n );\n return undefined;\n }\n return {\n node,\n grpc,\n types: api.types\n };\n}\n\nexport type GraphqlContext = {\n node: GraphQlNode;\n /** Primary operation (first in the group, or the only operation). */\n operation: GraphQlOperation;\n /** All operations for this page. For namespace groups this includes every grouped operation. */\n operations: GraphQlOperation[];\n types: Record<TypeId, TypeDefinition>;\n};\n\nexport function createGraphqlContext(\n node: GraphQlNode | undefined,\n apiDefinition: ApiDefinition | undefined\n): GraphqlContext | undefined {\n if (!node) {\n console.warn(\"[createGraphqlContext] node is undefined\");\n return undefined;\n }\n if (apiDefinition == null) {\n console.warn(\n `[createGraphqlContext] apiDefinition is undefined for node id=${node.id}, graphqlOperationId=${node.graphqlOperationId}`\n );\n return undefined;\n }\n const api = prune(apiDefinition, node);\n const operation = api.graphqlOperations[node.graphqlOperationId];\n if (!operation) {\n const availableOperationIds = Object.keys(api.graphqlOperations);\n console.warn(\n `[createGraphqlContext] graphql operation not found after pruning. graphqlOperationId=${node.graphqlOperationId}, apiDefinitionId=${node.apiDefinitionId}, availableOperationIds=[${availableOperationIds.join(\", \")}]`\n );\n return undefined;\n }\n\n // Collect all operations for namespace groups, preserving order.\n const allIds = node.graphqlOperationIds ?? [node.graphqlOperationId];\n const operations: GraphQlOperation[] = [];\n for (const id of allIds) {\n const op = api.graphqlOperations[id];\n if (op) {\n operations.push(op);\n }\n }\n // Fallback: if no grouped operations were resolved, use the primary operation.\n if (operations.length === 0) {\n operations.push(operation);\n }\n\n return {\n node,\n operation,\n operations,\n types: api.types\n };\n}\n\nexport type GraphqlTypeContext = {\n node: GraphQlTypeNode;\n /** The type this page documents. */\n type: TypeDefinition;\n /** The type plus everything it reaches, as pruned for this page. */\n types: Record<TypeId, TypeDefinition>;\n /** The types that implement this type, for the \"Implemented by\" list of an interface page. */\n implementors: TypeId[];\n /**\n * What incorporates this type -- the fields, field arguments, union variants, queries and\n * mutations that reference it -- for the \"Referenced by\" map of a type page.\n */\n referencedBy: GraphqlTypeReferrer[];\n};\n\nexport function createGraphqlTypeContext(\n node: GraphQlTypeNode | undefined,\n apiDefinition: ApiDefinition | undefined\n): GraphqlTypeContext | undefined {\n if (!node) {\n console.warn(\"[createGraphqlTypeContext] node is undefined\");\n return undefined;\n }\n if (apiDefinition == null) {\n console.warn(\n `[createGraphqlTypeContext] apiDefinition is undefined for node id=${node.id}, typeId=${node.typeId}`\n );\n return undefined;\n }\n const api = prune(apiDefinition, node);\n const type = api.types[node.typeId];\n if (!type) {\n const availableTypeIds = Object.keys(api.types);\n console.warn(\n `[createGraphqlTypeContext] type not found after pruning. typeId=${node.typeId}, apiDefinitionId=${node.apiDefinitionId}, availableTypeIds=[${availableTypeIds.join(\", \")}]`\n );\n return undefined;\n }\n\n return {\n node,\n type,\n types: api.types,\n implementors: getImplementorTypeIds(api.types, node.typeId),\n referencedBy: collectGraphqlTypeReferrers(api, node.typeId)\n };\n}\n","import type { EndpointPathPart } from \"../orpc-client/api/shared.js\";\nimport { EndpointPathLiteral } from \"../orpc-client/shared.js\";\n\n/**\n * Commonly used in Express.js and how we render paths in the UI.\n */\nexport function toColonEndpointPathLiteral(pathParts: EndpointPathPart[]): EndpointPathLiteral {\n return EndpointPathLiteral(\n pathParts.map((part) => (part.type === \"literal\" ? part.value : `:${part.value}`)).join(\"\")\n );\n}\n\n/**\n * Used in OpenAPI specification and Fern Definition. This is how we store EndpointPathLiteral in the snippet resolver.\n */\nexport function toCurlyBraceEndpointPathLiteral(pathParts: EndpointPathPart[]): EndpointPathLiteral {\n return EndpointPathLiteral(\n pathParts.map((part) => (part.type === \"literal\" ? part.value : `{${part.value}}`)).join(\"\")\n );\n}\n","import * as Latest from \"./latest\";\n\n/**\n * This utility is designed to join multiple API definitions into a single API definition.\n * After pruning the API definitions server-side to only include the desired endpoints, websockets, and webhooks,\n * this utility can be used to join the pruned API definitions back together on the client-side.\n *\n * @param apis list of API definitions to join (must have the same ID)\n * @returns a new API definition that is the result of joining the input API definitions\n */\nexport function joiner(\n force = false\n): (first: Latest.ApiDefinition, ...apis: Latest.ApiDefinition[]) => Latest.ApiDefinition {\n return (first, ...apis) => {\n const joined: Latest.ApiDefinition = {\n id: first.id,\n apiName: first.apiName,\n endpoints: { ...first.endpoints },\n websockets: { ...first.websockets },\n webhooks: { ...first.webhooks },\n graphqlOperations: { ...first.graphqlOperations },\n types: { ...first.types },\n subpackages: { ...first.subpackages },\n auths: { ...first.auths },\n globalHeaders: first.globalHeaders ? [...first.globalHeaders] : undefined,\n snippetsConfiguration: first.snippetsConfiguration ? { ...first.snippetsConfiguration } : undefined\n };\n\n let isJoined = false;\n for (const api of apis) {\n if (api.id !== joined.id) {\n throw new Error(\"Cannot join API definitions with different IDs\");\n }\n\n for (const [endpointId, endpoint] of Object.entries(api.endpoints)) {\n if (!isJoined && !first.endpoints[Latest.EndpointId(endpointId)]) {\n isJoined = true;\n }\n joined.endpoints[Latest.EndpointId(endpointId)] = endpoint;\n }\n\n for (const [webSocketId, webSocket] of Object.entries(api.websockets)) {\n if (!isJoined && !first.websockets[Latest.WebSocketId(webSocketId)]) {\n isJoined = true;\n }\n joined.websockets[Latest.WebSocketId(webSocketId)] = webSocket;\n }\n\n for (const [webhookId, webhook] of Object.entries(api.webhooks)) {\n if (!isJoined && !first.webhooks[Latest.WebhookId(webhookId)]) {\n isJoined = true;\n }\n joined.webhooks[Latest.WebhookId(webhookId)] = webhook;\n }\n\n for (const [typeId, type] of Object.entries(api.types)) {\n if (!isJoined && !first.types[Latest.TypeId(typeId)]) {\n isJoined = true;\n }\n joined.types[Latest.TypeId(typeId)] = type;\n }\n\n for (const [subpackageId, subpackage] of Object.entries(api.subpackages)) {\n if (!isJoined && !first.subpackages[Latest.SubpackageId(subpackageId)]) {\n isJoined = true;\n }\n joined.subpackages[Latest.SubpackageId(subpackageId)] = subpackage;\n }\n\n for (const [authId, auth] of Object.entries(api.auths)) {\n if (!isJoined && !first.auths[Latest.AuthSchemeId(authId)]) {\n isJoined = true;\n }\n joined.auths[Latest.AuthSchemeId(authId)] = auth;\n }\n\n const globalHeaders = (joined.globalHeaders ??= []);\n api.globalHeaders?.forEach((header) => {\n if (!globalHeaders.find((h) => h.key === header.key)) {\n isJoined = true;\n globalHeaders.push(header);\n }\n });\n }\n\n if (!isJoined && !force) {\n return first;\n }\n\n return joined;\n };\n}\n","export function cleanLanguage(language: string): string {\n language = language.toLowerCase().trim();\n if ([\"node\", \"nodejs\", \"js\", \"javascript\"].includes(language)) {\n return \"javascript\";\n }\n\n if ([\"py\", \"python\"].includes(language)) {\n return \"python\";\n }\n\n if ([\"ts\", \"typescript\", \"ts-node\"].includes(language)) {\n return \"typescript\";\n }\n\n if ([\"go\", \"golang\"].includes(language)) {\n return \"go\";\n }\n\n return language;\n}\n","import { isNonNullish } from \"@fern-api/ui-core-utils\";\nimport titleCase from \"@fern-api/ui-core-utils/titleCase\";\nimport visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\nimport { mapValues } from \"es-toolkit/object\";\n\nimport type { APIV1Read } from \"../../client\";\nimport { ROOT_PACKAGE_ID } from \"../../navigation/consts\";\nimport { SupportedLanguage } from \"../../orpc-client/shared.js\";\nimport { LOOP_TOLERANCE } from \"../const\";\nimport { cleanLanguage } from \"../lang\";\nimport * as V2 from \"../latest\";\nimport { convertToCurl } from \"../snippets/curl\";\nimport { toSnippetHttpRequest } from \"../snippets/SnippetHttpRequest\";\nimport { sortKeysByShape } from \"../sort-keys\";\nimport { getMessageForStatus } from \"../status-message\";\n\nfunction isSubpackage(package_: APIV1Read.ApiDefinitionPackage): package_ is APIV1Read.ApiDefinitionSubpackage {\n return typeof (package_ as APIV1Read.ApiDefinitionSubpackage).subpackageId === \"string\";\n}\n\nconst AUTH_SCHEME_ID = V2.AuthSchemeId(\"default\");\n\n/**\n * Shared default constants used as fallback return values when migration fails or input is null.\n */\nconst DEFAULT_TYPE_REFERENCE: V2.TypeReference = { type: \"unknown\", displayName: undefined };\nconst DEFAULT_TYPE_SHAPE: V2.TypeShape = { type: \"alias\", value: DEFAULT_TYPE_REFERENCE };\nconst DEFAULT_WEBHOOK_PAYLOAD_SHAPE: V2.WebhookPayloadShape = { type: \"alias\", value: DEFAULT_TYPE_REFERENCE };\nconst DEFAULT_WEBHOOK_PAYLOAD: V2.WebhookPayload = { description: undefined, shape: DEFAULT_WEBHOOK_PAYLOAD_SHAPE };\nconst DEFAULT_GRAPHQL_ARGUMENT: V2.GraphQlArgument = {\n name: \"\",\n description: undefined,\n availability: undefined,\n type: DEFAULT_TYPE_SHAPE,\n defaultValue: undefined\n};\n\n/**\n * Wraps a function with a try-catch that returns a default value on error.\n */\nfunction withDefault<Args extends unknown[], T>(\n fn: (...args: Args) => T,\n defaultValue: T,\n label: string\n): (...args: Args) => T {\n return (...args: Args): T => {\n try {\n return fn(...args);\n } catch (e) {\n const argsSummary = args.map((arg) => {\n try {\n const str = JSON.stringify(arg);\n return str != null && str.length > 200 ? `${str.slice(0, 200)}...` : str;\n } catch {\n return String(arg);\n }\n });\n console.error(`Error in ${label}:`, e, \"args:\", argsSummary);\n return defaultValue;\n }\n };\n}\n\n/**\n * Wraps a void callback in a try-catch that logs errors.\n */\nfunction trySafe(fn: () => void, label: string): void {\n try {\n fn();\n } catch (e) {\n console.error(`Error in ${label}:`, e);\n }\n}\n\nexport class ApiDefinitionV1ToLatest {\n static from(v1: APIV1Read.ApiDefinition): ApiDefinitionV1ToLatest {\n return new ApiDefinitionV1ToLatest(v1);\n }\n\n private auth: APIV1Read.ApiAuth | undefined;\n private constructor(private readonly v1: APIV1Read.ApiDefinition) {\n this.auth = v1.auth ?? undefined;\n }\n\n static createEndpointId(\n endpoint: APIV1Read.EndpointDefinition,\n subpackageId: string = ROOT_PACKAGE_ID\n ): V2.EndpointId {\n return V2.EndpointId(endpoint.originalEndpointId ?? `${subpackageId}.${endpoint.id}`);\n }\n\n static createWebSocketId(\n webSocket: APIV1Read.WebSocketChannel,\n subpackageId: string = ROOT_PACKAGE_ID\n ): V2.WebSocketId {\n return V2.WebSocketId(`${subpackageId}.${webSocket.id}`);\n }\n\n static createWebhookId(webhook: APIV1Read.WebhookDefinition, subpackageId: string = ROOT_PACKAGE_ID): V2.WebhookId {\n return V2.WebhookId(`${subpackageId}.${webhook.id}`);\n }\n\n static createGrpcEndpointId(\n grpc: APIV1Read.EndpointDefinition,\n subpackageId: string = ROOT_PACKAGE_ID\n ): V2.EndpointId {\n return V2.EndpointId(`${subpackageId}.${grpc.id}`);\n }\n\n private endpoints: Record<V2.EndpointId, V2.EndpointDefinition> = {};\n private websockets: Record<V2.WebSocketId, V2.WebSocketChannel> = {};\n private webhooks: Record<V2.WebhookId, V2.WebhookDefinition> = {};\n private graphqlOperations: Record<V2.GraphQlOperationId, V2.GraphQlOperation> = {};\n private subpackages: Record<V2.SubpackageId, V2.SubpackageMetadata> = {};\n private types: Record<string, V2.TypeDefinition> = {};\n public migrate = (): V2.ApiDefinition => {\n Object.entries(this.v1.types)?.forEach(([id, type]) =>\n trySafe(() => {\n if (type == null) {\n return;\n }\n this.types[V2.TypeId(id)] = {\n name: type?.name,\n description: type?.description,\n availability: type?.availability,\n shape: this.migrateTypeShape(type?.shape),\n displayName: type?.displayName\n };\n }, `migrate type ${id}`)\n );\n\n [this.v1.rootPackage, ...Object.values(this.v1.subpackages)].forEach((pkg) =>\n trySafe(() => {\n if (pkg == null) {\n return;\n }\n const [subpackageId, namespace] = this.collectNamespace(pkg, this.v1.subpackages);\n pkg?.endpoints?.forEach((endpoint) =>\n trySafe(() => {\n const id =\n endpoint?.protocol?.type === \"grpc\"\n ? ApiDefinitionV1ToLatest.createGrpcEndpointId(endpoint, subpackageId)\n : ApiDefinitionV1ToLatest.createEndpointId(endpoint, subpackageId);\n this.endpoints[id] = this.migrateEndpoint(id, endpoint, namespace);\n }, `migrate endpoint ${endpoint?.id}`)\n );\n pkg?.websockets?.forEach((webSocket) =>\n trySafe(() => {\n const id = ApiDefinitionV1ToLatest.createWebSocketId(webSocket, subpackageId);\n this.websockets[id] = this.migrateWebSocket(id, webSocket, namespace);\n }, `migrate webSocket ${webSocket?.id}`)\n );\n pkg?.webhooks?.forEach((webhook) =>\n trySafe(() => {\n const id = ApiDefinitionV1ToLatest.createWebhookId(webhook, subpackageId);\n this.webhooks[id] = this.migrateWebhook(id, webhook, namespace);\n }, `migrate webhook ${webhook?.id}`)\n );\n pkg?.graphqlOperations?.forEach((graphqlOp) =>\n trySafe(() => {\n const id = graphqlOp?.id;\n this.graphqlOperations[id] = this.migrateGraphQlOperation(graphqlOp, namespace);\n }, `migrate graphqlOp ${graphqlOp?.id}`)\n );\n }, \"migrate package\")\n );\n\n Object.values(this.v1.subpackages)?.forEach((subpackage) =>\n trySafe(() => {\n if (subpackage == null) {\n return;\n }\n this.subpackages[subpackage?.subpackageId] = this.migrateSubpackage(subpackage);\n }, `migrate subpackage ${subpackage?.subpackageId}`)\n );\n\n return {\n id: this.v1.id,\n apiName: this.v1.apiName,\n specVersion: this.v1.specVersion,\n endpoints: this.endpoints,\n websockets: this.websockets,\n webhooks: this.webhooks,\n graphqlOperations: this.graphqlOperations,\n types: this.types,\n subpackages: this.subpackages,\n auths: this.v1.authSchemes ? this.v1.authSchemes : this.v1.auth ? { [AUTH_SCHEME_ID]: this.v1.auth } : {},\n globalHeaders: this.migrateParameters(this.v1.globalHeaders ?? undefined),\n snippetsConfiguration: this.v1.snippetsConfiguration\n };\n };\n\n collectNamespace = (\n pkg: APIV1Read.ApiDefinitionPackage,\n subpackages: Record<string, APIV1Read.ApiDefinitionSubpackage>\n ): [string, V2.SubpackageId[]] => {\n if (!pkg || !isSubpackage(pkg)) {\n return [ROOT_PACKAGE_ID, []];\n }\n const namespace: V2.SubpackageId[] = [pkg.subpackageId];\n\n let subpackage = pkg;\n let loop = 0;\n while (subpackage.parent != null) {\n if (loop > LOOP_TOLERANCE) {\n throw new Error(\"Circular subpackage reference detected\");\n }\n\n const next = subpackages[subpackage.parent];\n if (next == null) {\n break;\n }\n namespace.unshift(subpackage.parent);\n subpackage = next;\n loop++;\n }\n\n return [pkg.subpackageId, namespace];\n };\n\n migrateEndpoint = (\n id: V2.EndpointId,\n v1: APIV1Read.EndpointDefinition,\n namespace: V2.SubpackageId[]\n ): V2.EndpointDefinition => {\n const toRet: V2.EndpointDefinition = {\n id,\n namespace,\n displayName: v1?.name,\n operationId: v1?.urlSlug?.split(\"/\")?.pop(),\n description: v1?.description,\n subtitle: v1?.subtitle,\n availability: v1?.availability,\n method: v1?.method,\n path: v1?.path?.parts?.filter((part) => part?.value !== \"\") ?? [],\n auth: v1?.authV2 ? v1.authV2 : v1?.authed ? [AUTH_SCHEME_ID] : undefined,\n multiAuth: v1?.multiAuth,\n defaultEnvironment: v1?.defaultEnvironment,\n environments: v1?.environments,\n pathParameters: this.migratePathOrQueryParameters(v1?.path?.pathParameters),\n queryParameters: this.migratePathOrQueryParameters(v1?.queryParameters),\n requestHeaders: this.migrateParameters(v1?.headers),\n responseHeaders: this.migrateParameters(v1?.responseHeaders ?? undefined),\n requests: (() => {\n const requests = (v1?.requestsV2?.requests ?? undefined)\n ?.map((request) => this.migrateHttpRequest(request))\n ?.filter(isNonNullish);\n\n if (requests != null && requests.length > 0) {\n return requests;\n }\n\n return [this.migrateHttpRequest(v1?.request ?? undefined)].filter(isNonNullish);\n })(),\n responses: (() => {\n const responses = (v1?.responsesV2?.responses ?? undefined)\n ?.map((response) => this.migrateHttpResponse(response))\n ?.filter(isNonNullish);\n\n if (responses != null && responses.length > 0) {\n return responses;\n }\n\n return [this.migrateHttpResponse(v1?.response ?? undefined)].filter(isNonNullish);\n })(),\n errors: this.migrateHttpErrors(v1?.errorsV2 ?? undefined),\n examples: undefined,\n snippetTemplates: (v1 as Record<string, unknown>)?.snippetTemplates as unknown,\n protocol: v1?.protocol,\n includeInApiExplorer: v1?.includeInApiExplorer ?? true\n };\n\n toRet.examples = this.migrateHttpExamples(v1?.examples, toRet);\n\n return toRet;\n };\n\n migrateWebSocket = (\n id: V2.WebSocketId,\n v1: APIV1Read.WebSocketChannel,\n namespace: V2.SubpackageId[]\n ): V2.WebSocketChannel => {\n const messages = this.migrateChannelMessages(v1?.messages);\n const auth = v1?.auth\n ? this.v1.authSchemes && Object.keys(this.v1.authSchemes).length > 0\n ? Object.keys(this.v1.authSchemes).map((k) => V2.AuthSchemeId(k))\n : [AUTH_SCHEME_ID]\n : undefined;\n return {\n id,\n namespace,\n displayName: v1?.name,\n operationId: v1?.urlSlug?.split(\"/\")?.pop(),\n description: v1?.description,\n availability: v1?.availability,\n path: v1?.path?.parts?.filter((part) => part?.value !== \"\") ?? [],\n messages,\n auth,\n defaultEnvironment: v1?.defaultEnvironment,\n environments: v1?.environments,\n pathParameters: this.migratePathOrQueryParameters(v1?.path?.pathParameters),\n queryParameters: this.migratePathOrQueryParameters(v1?.queryParameters),\n requestHeaders: this.migrateParameters(v1?.headers),\n examples: this.migrateChannelExamples(v1?.examples, messages),\n includeInApiExplorer: v1?.includeInApiExplorer ?? true\n };\n };\n\n migrateWebhook = (\n id: V2.WebhookId,\n v1: APIV1Read.WebhookDefinition,\n namespace: V2.SubpackageId[]\n ): V2.WebhookDefinition => {\n const payload = this.migrateWebhookPayload(v1?.payload);\n return {\n id,\n namespace,\n displayName: v1?.name,\n operationId: v1?.urlSlug?.split(\"/\")?.pop(),\n description: v1?.description,\n availability: v1?.availability,\n method: v1?.method,\n path: v1?.path,\n headers: this.migrateParameters(v1?.headers),\n payloads: [payload],\n responses: v1?.responses?.map(this.migrateHttpResponse)?.filter(isNonNullish),\n examples:\n v1?.examples?.map((example) => ({\n ...example,\n payload: sortKeysByShape(example?.payload, payload?.shape, this.types)\n })) ?? []\n };\n };\n\n migrateSubpackage = (subpackage: APIV1Read.ApiDefinitionSubpackage): V2.SubpackageMetadata => {\n return {\n id: subpackage?.subpackageId,\n name: subpackage?.name,\n displayName: subpackage?.displayName,\n description: subpackage?.description\n };\n };\n\n migrateParameters = (\n v1: APIV1Read.PathParameter[] | APIV1Read.QueryParameter[] | APIV1Read.Header[] | undefined\n ): V2.ObjectProperty[] | undefined => {\n if (v1 == null || v1.length === 0) {\n return undefined;\n }\n return v1\n .filter((parameter) => parameter?.type != null)\n .map((parameter) => ({\n key: V2.PropertyKey(parameter?.key),\n valueShape: {\n type: \"alias\",\n value: this.migrateTypeReference(parameter?.type)\n },\n propertyAccess: undefined,\n description: parameter?.description ?? undefined,\n availability: parameter?.availability ?? undefined\n }));\n };\n\n migratePathOrQueryParameters = (\n v1: APIV1Read.PathParameter[] | APIV1Read.QueryParameter[] | undefined\n ): V2.ParameterProperty[] | undefined => {\n if (v1 == null || v1.length === 0) {\n return undefined;\n }\n return v1\n .filter((parameter) => parameter?.type != null)\n .map((parameter) => ({\n key: V2.PropertyKey(parameter?.key),\n valueShape: {\n type: \"alias\",\n value: this.migrateTypeReference(parameter?.type)\n },\n propertyAccess: undefined,\n description: parameter?.description ?? undefined,\n availability: parameter?.availability ?? undefined,\n explode: parameter?.explode ?? undefined\n }));\n };\n\n migrateTypeReference = withDefault(\n (typeRef: APIV1Read.TypeReference): V2.TypeReference => {\n if (typeRef == null) {\n return DEFAULT_TYPE_REFERENCE;\n }\n return visitDiscriminatedUnion(typeRef)._visit<V2.TypeReference>({\n map: (value) => ({\n type: \"map\",\n keyShape: {\n type: \"alias\",\n value: this.migrateTypeReference(value?.keyType)\n },\n valueShape: {\n type: \"alias\",\n value: this.migrateTypeReference(value?.valueType)\n },\n minProperties: value?.minProperties ?? undefined,\n maxProperties: value?.maxProperties ?? undefined\n }),\n id: (value) => ({\n type: \"id\",\n id: value?.value,\n default: value?.default ?? undefined\n }),\n primitive: (value) => value,\n nullable: (value) => ({\n type: \"nullable\",\n shape: {\n type: \"alias\",\n value: this.migrateTypeReference(value?.itemType)\n }\n }),\n optional: (value) => ({\n type: \"optional\",\n shape: {\n type: \"alias\",\n value: this.migrateTypeReference(value?.itemType)\n },\n default: value?.defaultValue\n }),\n list: (value) => ({\n type: \"list\",\n itemShape: {\n type: \"alias\",\n value: this.migrateTypeReference(value?.itemType)\n },\n minItems: value?.minItems ?? undefined,\n maxItems: value?.maxItems ?? undefined\n }),\n set: (value) => ({\n type: \"set\",\n itemShape: {\n type: \"alias\",\n value: this.migrateTypeReference(value?.itemType)\n },\n minItems: value?.minItems ?? undefined,\n maxItems: value?.maxItems ?? undefined\n }),\n literal: (value) => value,\n unknown: () => ({\n type: \"unknown\",\n displayName: undefined\n })\n });\n },\n DEFAULT_TYPE_REFERENCE,\n \"migrateTypeReference\"\n );\n\n migrateTypeShape = withDefault(\n (shape: APIV1Read.TypeShape): V2.TypeShape => {\n if (shape == null) {\n return DEFAULT_TYPE_SHAPE;\n }\n return visitDiscriminatedUnion(shape)._visit<V2.TypeShape>({\n object: (value) => ({\n type: \"object\",\n extends: value?.extends,\n properties: this.migrateObjectProperties(value?.properties ?? []),\n extraProperties:\n value?.extraProperties != null ? this.migrateTypeReference(value.extraProperties) : undefined\n }),\n alias: (value) => ({\n type: \"alias\",\n value: this.migrateTypeReference(value?.value)\n }),\n enum: (value) => value,\n undiscriminatedUnion: (value) => ({\n type: \"undiscriminatedUnion\",\n variants: (value?.variants ?? [])\n .filter((variant) => variant?.type != null)\n .map((variant) => ({\n displayName: variant?.displayName ?? undefined,\n shape: {\n type: \"alias\",\n value: this.migrateTypeReference(variant?.type)\n },\n description: variant?.description ?? undefined,\n availability: variant?.availability ?? undefined\n }))\n }),\n discriminatedUnion: (value) => ({\n type: \"discriminatedUnion\",\n discriminant: V2.PropertyKey(value?.discriminant),\n variants: (value?.variants ?? []).map((variant) => ({\n discriminantValue: variant?.discriminantValue,\n displayName: variant?.displayName ?? undefined,\n description: variant?.description ?? undefined,\n availability: variant?.availability ?? undefined,\n extends: variant?.additionalProperties?.extends,\n properties: this.migrateObjectProperties(variant?.additionalProperties?.properties ?? []),\n extraProperties: undefined\n }))\n })\n });\n },\n DEFAULT_TYPE_SHAPE,\n \"migrateTypeShape\"\n );\n\n migrateObjectProperties = withDefault(\n (properties: APIV1Read.ObjectProperty[]): V2.ObjectProperty[] => {\n if (properties == null) {\n return [];\n }\n return properties\n .filter((value) => value?.valueType != null)\n .map((value) => ({\n key: V2.PropertyKey(value?.key),\n valueShape: {\n type: \"alias\",\n value: this.migrateTypeReference(value?.valueType)\n },\n propertyAccess: value?.propertyAccess ?? undefined,\n description: value?.description ?? undefined,\n availability: value?.availability ?? undefined,\n arguments: value?.arguments?.map((arg) => this.migrateGraphQlArgument(arg))\n }));\n },\n [] as V2.ObjectProperty[],\n \"migrateObjectProperties\"\n );\n\n migrateJsonShape = withDefault(\n (shape: APIV1Read.JsonBodyShape): V2.TypeShape => {\n if (shape == null) {\n return DEFAULT_TYPE_SHAPE;\n }\n return visitDiscriminatedUnion(shape)._visit<V2.TypeShape>({\n object: this.migrateTypeShape,\n reference: (ref) => ({\n type: \"alias\",\n value: this.migrateTypeReference(ref?.value)\n })\n });\n },\n DEFAULT_TYPE_SHAPE,\n \"migrateJsonShape\"\n );\n\n migrateWebhookPayloadShape = withDefault(\n (shape: APIV1Read.WebhookPayloadShape): V2.WebhookPayloadShape => {\n if (shape == null) {\n return DEFAULT_WEBHOOK_PAYLOAD_SHAPE;\n }\n return visitDiscriminatedUnion(shape)._visit<V2.WebhookPayloadShape>({\n object: (obj) => ({\n type: \"object\",\n extends: obj?.extends,\n properties: this.migrateObjectProperties(obj?.properties ?? []),\n extraProperties: undefined\n }),\n reference: (ref) => ({\n type: \"alias\",\n value: this.migrateTypeReference(ref?.value)\n }),\n formData: (formData) => ({\n type: \"formData\",\n description: formData?.description,\n availability: formData?.availability,\n fields: this.migrateFormDataProperties(formData?.properties ?? [])\n })\n });\n },\n DEFAULT_WEBHOOK_PAYLOAD_SHAPE,\n \"migrateWebhookPayloadShape\"\n );\n\n migrateWebhookPayload = withDefault(\n (payload: APIV1Read.WebhookPayload): V2.WebhookPayload => {\n if (payload == null) {\n return DEFAULT_WEBHOOK_PAYLOAD;\n }\n return {\n description: payload?.description,\n shape: this.migrateWebhookPayloadShape(payload?.type)\n };\n },\n DEFAULT_WEBHOOK_PAYLOAD,\n \"migrateWebhookPayload\"\n );\n\n migrateChannelExamples = withDefault(\n (\n examples: APIV1Read.ExampleWebSocketSession[],\n messages: V2.WebSocketMessage[]\n ): V2.ExampleWebSocketSession[] | undefined => {\n if (examples == null || examples.length === 0) {\n return undefined;\n }\n\n return examples.map((example) => ({\n description: example?.description,\n path: example?.path,\n name: example?.name,\n pathParameters: example?.pathParameters,\n queryParameters: example?.queryParameters,\n requestHeaders: example?.headers,\n messages: (example?.messages ?? []).map((example) => ({\n ...example,\n body: sortKeysByShape(\n example.body,\n messages.find((message) => message.type === example.type)?.body,\n this.types\n )\n }))\n }));\n },\n undefined,\n \"migrateChannelExamples\"\n );\n\n migrateChannelMessages = withDefault(\n (messages: APIV1Read.WebSocketMessage[]): V2.WebSocketMessage[] => {\n if (messages == null) {\n return [];\n }\n return messages.map((message) => ({\n type: message?.type,\n displayName: message?.displayName,\n origin: message?.origin,\n body: this.migrateJsonShape(message?.body),\n description: message?.description,\n availability: message?.availability\n }));\n },\n [] as V2.WebSocketMessage[],\n \"migrateChannelMessages\"\n );\n\n migrateHttpExamples = withDefault(\n (\n examples: APIV1Read.ExampleEndpointCall[],\n endpoint: V2.EndpointDefinition\n ): V2.ExampleEndpointCall[] | undefined => {\n if (examples == null || examples.length === 0) {\n return undefined;\n }\n\n return examples.map((example): V2.ExampleEndpointCall => {\n const toRet: V2.ExampleEndpointCall = {\n path: example?.path,\n responseStatusCode: example?.responseStatusCode,\n name: example?.name,\n contentType: example?.contentType ?? undefined,\n description: example?.description,\n pathParameters: example?.pathParameters,\n queryParameters: example?.queryParameters,\n headers: example?.headers,\n requestBody: example?.requestBodyV3,\n responseBody: example?.responseBodyV3,\n responseHeaders: example?.responseHeaders,\n snippets: undefined\n };\n\n if (example?.requestBodyV3) {\n toRet.requestBody = visitDiscriminatedUnion(\n example.requestBodyV3\n )._visit<APIV1Read.ExampleEndpointRequest>({\n bytes: (value) => value,\n json: (value) => ({\n type: \"json\",\n value: sortKeysByShape(value.value, endpoint.requests?.[0]?.body, this.types)\n }),\n form: (value) => ({\n type: \"form\",\n value: mapValues(value.value, (formValue, key): APIV1Read.FormValue => {\n const typedFormValue = formValue as APIV1Read.FormValue;\n if (typedFormValue.type === \"json\") {\n const shape =\n endpoint.requests?.[0]?.body.type === \"formData\"\n ? endpoint.requests?.[0]?.body.fields.find(\n (field): field is V2.FormDataPropertyVariant =>\n field.key === key && field.type === \"property\"\n )?.valueShape\n : undefined;\n return {\n type: \"json\",\n value: sortKeysByShape(typedFormValue.value, shape, this.types)\n };\n } else {\n return typedFormValue;\n }\n })\n })\n });\n }\n\n if (toRet.responseBody) {\n toRet.responseBody.value = sortKeysByShape(\n toRet.responseBody.value,\n endpoint.responses?.[0]?.body,\n this.types\n );\n }\n\n toRet.snippets = this.migrateEndpointSnippets(\n endpoint,\n toRet,\n example?.codeSamples,\n example?.codeExamples\n );\n\n return toRet;\n });\n },\n undefined,\n \"migrateHttpExamples\"\n );\n\n migrateHttpErrors = withDefault(\n (errors: APIV1Read.ErrorDeclarationV2[] | null | undefined): V2.ErrorResponse[] | undefined => {\n if (errors == null || errors.length === 0) {\n return undefined;\n }\n\n return errors.map((value) => {\n const shape = value?.type != null ? this.migrateTypeShape(value.type) : undefined;\n return {\n isWildcard: value?.isWildcard,\n description: value?.description,\n availability: value?.availability,\n name:\n (value?.name != null ? titleCase(value.name) : undefined) ??\n getMessageForStatus(value?.statusCode),\n statusCode: value?.statusCode,\n shape,\n examples: value?.examples?.map(\n (example): APIV1Read.ErrorExample => ({\n description: example?.description,\n name: example?.name,\n responseBody: {\n type: \"json\" as const,\n value: sortKeysByShape(example?.responseBody?.value, shape, this.types)\n }\n })\n ),\n headers: this.migrateParameters(value?.headers ?? undefined)\n };\n });\n },\n undefined,\n \"migrateHttpErrors\"\n );\n\n migrateHttpResponse = withDefault(\n (response: APIV1Read.HttpResponse | undefined): V2.HttpResponse | undefined => {\n if (response == null) {\n return undefined;\n }\n\n if (response.type == null) {\n return undefined;\n }\n\n return {\n description: response?.description,\n statusCode: response?.statusCode ?? 200,\n isWildcard: response?.isWildcard,\n body: visitDiscriminatedUnion(response?.type)._visit<V2.HttpResponseBodyShape>({\n object: (value) => ({\n type: \"object\",\n extends: value?.extends,\n properties: this.migrateObjectProperties(value?.properties ?? []),\n extraProperties: undefined\n }),\n reference: (value) => ({\n type: \"alias\",\n value: this.migrateTypeReference(value?.value)\n }),\n fileDownload: (value) => value,\n streamingText: (value) => value,\n stream: (value) => ({\n type: \"stream\",\n terminator: value?.terminator,\n shape: this.migrateJsonShape(value?.shape)\n }),\n\n // Careful! we're dropping non-streaming response shape in the following migration:\n streamCondition: (value) => ({\n type: \"stream\",\n terminator: undefined,\n shape: this.migrateJsonShape(value?.streamResponse?.shape)\n })\n })\n };\n },\n undefined,\n \"migrateHttpResponse\"\n );\n\n migrateHttpRequest = withDefault(\n (request: APIV1Read.HttpRequest | undefined): V2.HttpRequest | undefined => {\n if (request == null) {\n return undefined;\n }\n\n if (request.type == null) {\n return undefined;\n }\n\n return {\n description: request?.description,\n contentType: request?.contentType,\n body: visitDiscriminatedUnion(request?.type)._visit<V2.HttpRequestBodyShape>({\n object: (value) => ({\n type: \"object\",\n extends: value?.extends,\n properties: this.migrateObjectProperties(value?.properties ?? []),\n extraProperties: undefined\n }),\n reference: (value) => ({\n type: \"alias\",\n value: this.migrateTypeReference(value?.value)\n }),\n bytes: (value) => ({\n type: \"bytes\",\n isOptional: value?.isOptional,\n contentType: value?.contentType\n }),\n formData: (value) => ({\n type: \"formData\",\n description: value?.description,\n availability: value?.availability,\n fields: this.migrateFormDataProperties(value?.properties ?? [])\n }),\n fileUpload: (value) => ({\n type: \"formData\",\n description: value?.value?.description,\n availability: value?.value?.availability,\n fields: this.migrateFormDataProperties(value?.value?.properties ?? [])\n })\n })\n };\n },\n undefined,\n \"migrateHttpRequest\"\n );\n\n migrateFormDataProperties = withDefault(\n (properties: APIV1Read.FormDataProperty[]): V2.FormDataField[] => {\n if (properties == null) {\n return [];\n }\n return properties\n .map((prop) =>\n visitDiscriminatedUnion(prop)._visit<V2.FormDataField | undefined>({\n file: (file) =>\n visitDiscriminatedUnion(file?.value)._visit<V2.FormDataField>({\n file: (single) => ({\n type: \"file\",\n key: single?.key,\n isOptional: single?.isOptional,\n contentType: single?.contentType ?? undefined,\n description: single?.description ?? undefined,\n availability: single?.availability ?? undefined\n }),\n fileArray: (multiple) => ({\n type: \"files\",\n key: multiple?.key,\n isOptional: multiple?.isOptional,\n contentType: multiple?.contentType ?? undefined,\n description: multiple?.description ?? undefined,\n availability: multiple?.availability ?? undefined\n })\n }),\n bodyProperty: (bodyProp) => {\n if (bodyProp?.valueType == null) {\n return undefined;\n }\n return {\n type: \"property\",\n key: bodyProp?.key,\n contentType: bodyProp?.contentType ?? undefined,\n description: bodyProp?.description ?? undefined,\n availability: bodyProp?.availability ?? undefined,\n exploded: bodyProp?.exploded ?? undefined,\n valueShape: {\n type: \"alias\",\n value: this.migrateTypeReference(bodyProp.valueType)\n },\n propertyAccess: bodyProp?.propertyAccess ?? undefined\n };\n }\n })\n )\n .filter(isNonNullish);\n },\n [] as V2.FormDataField[],\n \"migrateFormDataProperties\"\n );\n\n migrateEndpointSnippets(\n endpoint: V2.EndpointDefinition,\n example: V2.ExampleEndpointCall,\n codeSamples: APIV1Read.CustomCodeSample[],\n codeExamples: APIV1Read.CodeExamples\n ): Record<string, V2.CodeSnippet[]> {\n const toRet: Record<string, V2.CodeSnippet[]> = {};\n function push(language: string, snippet: V2.CodeSnippet) {\n (toRet[language] ??= []).push(snippet);\n }\n\n const userProvidedLanguages = new Set<string>();\n\n // Add user-provided code snippets\n codeSamples?.forEach((codeSample) => {\n const language = cleanLanguage(codeSample?.language);\n userProvidedLanguages.add(language);\n\n push(language, {\n name: codeSample?.name,\n language,\n install: codeSample?.install,\n code: codeSample?.code,\n generated: false,\n description: codeSample?.description\n });\n });\n\n if (!userProvidedLanguages.has(SupportedLanguage.Curl)) {\n const code = convertToCurl(toSnippetHttpRequest(endpoint, example, this.auth));\n push(SupportedLanguage.Curl, {\n language: SupportedLanguage.Curl,\n code,\n name: undefined,\n install: undefined,\n generated: true,\n description: undefined\n });\n }\n\n if (!userProvidedLanguages.has(SupportedLanguage.Python) && codeExamples?.pythonSdk != null) {\n push(SupportedLanguage.Python, {\n name: undefined,\n language: SupportedLanguage.Python,\n install: codeExamples?.pythonSdk?.install,\n code: codeExamples?.pythonSdk?.sync_client,\n generated: true,\n description: undefined\n });\n }\n\n if (!userProvidedLanguages.has(SupportedLanguage.Typescript) && codeExamples?.typescriptSdk != null) {\n push(SupportedLanguage.Typescript, {\n name: undefined,\n language: SupportedLanguage.Typescript,\n install: codeExamples?.typescriptSdk?.install,\n code: codeExamples?.typescriptSdk?.client,\n generated: true,\n description: undefined\n });\n }\n\n if (!userProvidedLanguages.has(SupportedLanguage.Go) && codeExamples?.goSdk != null) {\n push(SupportedLanguage.Go, {\n name: undefined,\n language: SupportedLanguage.Go,\n install: codeExamples?.goSdk?.install,\n code: codeExamples?.goSdk?.client,\n generated: true,\n description: undefined\n });\n }\n\n if (!userProvidedLanguages.has(SupportedLanguage.Ruby) && codeExamples?.rubySdk != null) {\n push(SupportedLanguage.Ruby, {\n name: undefined,\n language: SupportedLanguage.Ruby,\n install: codeExamples?.rubySdk?.install,\n code: codeExamples?.rubySdk?.client,\n generated: true,\n description: undefined\n });\n }\n\n if (!userProvidedLanguages.has(SupportedLanguage.Csharp) && codeExamples?.csharpSdk != null) {\n push(SupportedLanguage.Csharp, {\n name: undefined,\n language: SupportedLanguage.Csharp,\n install: codeExamples?.csharpSdk?.install,\n code: codeExamples?.csharpSdk?.client,\n generated: true,\n description: undefined\n });\n }\n\n return toRet;\n }\n\n migrateGraphQlOperation = (v1: APIV1Read.GraphQlOperation, namespace: V2.SubpackageId[]): V2.GraphQlOperation => {\n if (v1 == null) {\n return {\n id: \"\" as V2.GraphQlOperationId,\n operationType: \"QUERY\",\n name: \"\",\n displayName: undefined,\n description: undefined,\n availability: undefined,\n namespace,\n arguments: undefined,\n returnType: DEFAULT_TYPE_SHAPE,\n examples: [],\n snippets: undefined\n };\n }\n return {\n id: v1?.id,\n operationType: v1?.operationType,\n name: v1?.name,\n displayName: v1?.displayName,\n description: v1?.description,\n availability: v1?.availability,\n namespace,\n fieldPath: v1?.fieldPath,\n arguments: v1?.arguments?.map((arg) => this.migrateGraphQlArgument(arg)),\n returnType: {\n type: \"alias\",\n value: this.migrateTypeReference(v1?.returnType)\n },\n examples: v1?.examples,\n snippets: v1?.snippets\n };\n };\n\n migrateGraphQlArgument = withDefault(\n (v1: APIV1Read.GraphQlArgument): V2.GraphQlArgument => {\n if (v1 == null) {\n return DEFAULT_GRAPHQL_ARGUMENT;\n }\n return {\n name: v1?.name,\n description: v1?.description,\n availability: v1?.availability,\n type: {\n type: \"alias\",\n value: this.migrateTypeReference(v1?.type)\n },\n defaultValue: v1?.defaultValue\n };\n },\n DEFAULT_GRAPHQL_ARGUMENT,\n \"migrateGraphQlArgument\"\n );\n}\n","export const ROOT_PACKAGE_ID = \"__package__\" as const;\n","import { isPlainObject, unknownToString } from \"@fern-api/ui-core-utils\";\nimport { compact } from \"es-toolkit/array\";\nimport qs from \"qs\";\nimport { UnreachableCaseError } from \"ts-essentials\";\n\nimport { obfuscateSecret } from \"../../utils/obfuscate-secret\";\nimport type * as Latest from \"../latest\";\nimport { wrapOpenRPCRequest } from \"../wrapOpenRPCRequest\";\nimport { replaceMultipartTemplateStrings } from \"./multipart-filename-placeholder\";\nimport type {\n SnippetHttpRequest,\n SnippetHttpRequestBodyFormValue,\n SnippetHttpRequestBodyFormValueFilename,\n SnippetHttpRequestBodyFormValueFilenames\n} from \"./SnippetHttpRequest\";\n\nfunction requiresUrlEncode(str: string): boolean {\n return encodeURIComponent(str) !== str;\n}\n\nexport function convertToCurl(request: SnippetHttpRequest): string {\n try {\n return unsafeStringifyHttpRequestExampleToCurl(request);\n } catch (e) {\n console.error(`[convert-to-curl] ${JSON.stringify(e)}`);\n\n return \"\";\n }\n}\n\nfunction getHttpRequest(method: string, url: string, searchParams: Record<string, unknown>): string {\n const queryParams = toUrlEncoded(searchParams)\n .map(([key, value]) => `${key}=${encodeURIComponent(unknownToString(value))}`)\n .join(\"&\");\n if (method !== \"GET\") {\n return queryParams.length > 0 ? `-X ${method} \"${url}?${queryParams}\"` : `-X ${method} ${url}`;\n }\n // if the method is GET, we don't need to include the query params in URL, but instead we'll include it as --data-urlencode\n return queryParams.length > 0 ? `-G ${url}` : url;\n}\n\nfunction getHeadersString(headers: Record<string, unknown>): string[] {\n return Object.entries(headers).map(([key, value]) => `-H \"${key}: ${unknownToString(value)}\"`);\n}\n\nfunction getBasicAuthString(\n basicAuth: {\n username: string;\n password: string;\n },\n redacted?: boolean\n): string[] {\n if (redacted) {\n return [`-u \"${basicAuth.username}:${obfuscateSecret(basicAuth.password)}\"`];\n }\n return [`-u \"${basicAuth.username}:${basicAuth.password}\"`];\n}\n\nexport function getUrlQueriesGetString(searchParams: Record<string, unknown>, forceManualEncoding = false): string[] {\n return toUrlEncoded(searchParams).map(([key, value]) => {\n // If we're dealing with form-urlencoded content-type, always use -d with pre-encoded values\n const encodedValue = forceManualEncoding ? encodeURIComponent(value) : value;\n const flag = forceManualEncoding || !requiresUrlEncode(value) ? \"-d\" : \"--data-urlencode\";\n\n if (forceManualEncoding || key.includes(\" \") || value.includes(\" \") || key.includes(\"[\")) {\n return `${flag} \"${key}=${encodedValue}\"`;\n }\n return `${flag} ${key}=${encodedValue}`;\n });\n}\n\nfunction getBodyJsonString(value: unknown | null | undefined, protocol?: Latest.Protocol): string[] {\n if (protocol?.type === \"openrpc\") {\n const payload = wrapOpenRPCRequest(value, protocol.methodName);\n const stringifiedValue = JSON.stringify(payload, null, 2).replace(/'/g, \"'\\\\''\");\n return [`-d '${stringifiedValue}'`];\n }\n\n if (value == null) {\n return [];\n }\n\n if (typeof value === \"string\") {\n return [`-d \"${value.replace(/\"/g, '\\\\\"')}\"`];\n }\n\n const stringifiedValue = JSON.stringify(value, null, 2).replace(/'/g, \"'\\\\''\");\n return [`-d '${stringifiedValue}'`];\n}\n\nfunction getBodyBytesString(filename: string): string[] {\n return [`--data-binary @${filename.includes(\" \") ? `\"${filename}\"` : filename}`];\n}\n\nfunction getBodyFormValueJsonString(value: unknown | null | undefined, key: string): string[] {\n if (value == null) {\n return [];\n }\n\n // TODO: this is a little sus\n if (typeof value === \"string\") {\n return [`-F ${key}=\"${value.replace(/\"/g, '\\\\\"')}\"`];\n }\n\n const stringValue = JSON.stringify(value, null, 2);\n\n return [`-F ${key}='${stringValue.replace(/'/g, \"'\\\\''\")}'`];\n}\n\nfunction formatFormFileValue(filename: string, contentType: string | undefined): string {\n if (filename.includes(\" \") || contentType != null) {\n return `\"${filename}${contentType != null ? `;type=${contentType}` : \"\"}\"`;\n }\n return filename;\n}\n\nfunction getBodyFormValueFilenamesStrings({ files }: SnippetHttpRequestBodyFormValueFilenames, key: string): string[] {\n return files\n .filter((file) => file.filename != null)\n .map(({ filename, contentType }) => {\n // When the property name carries a multipart template token (e.g.\n // `{filename}`) we emit one field per file using its resolved name\n // and omit the legacy `[]` array suffix because the keys are\n // already unique. Otherwise we preserve the existing `[]` behavior\n // for non-templated multi-file fields.\n const resolvedKey = replaceMultipartTemplateStrings(key, { filename });\n const finalKey = resolvedKey !== key ? resolvedKey : `${key}[]`;\n return `-F \"${finalKey}\"=@${formatFormFileValue(filename, contentType)}`;\n });\n}\n\nfunction getBodyFormValueFilenameString(\n { filename, contentType }: SnippetHttpRequestBodyFormValueFilename,\n key: string\n): string[] {\n if (filename == null) {\n return [];\n }\n const resolvedKey = replaceMultipartTemplateStrings(key, { filename });\n if (resolvedKey !== key) {\n return [`-F \"${resolvedKey}\"=@${formatFormFileValue(filename, contentType)}`];\n }\n return [`-F ${key}=@${formatFormFileValue(filename, contentType)}`];\n}\n\nfunction getBodyFormValueString(value: SnippetHttpRequestBodyFormValue, key: string): string[] {\n switch (value.type) {\n case \"json\":\n return getBodyFormValueJsonString(value.value, key);\n case \"filename\":\n return getBodyFormValueFilenameString(value, key);\n case \"filenames\":\n return getBodyFormValueFilenamesStrings(value, key);\n case \"exploded\":\n return (value.value ?? []).flatMap((item) => getBodyFormValueJsonString(item, key));\n default:\n throw new UnreachableCaseError(value);\n }\n}\n\nfunction getBodyFormString(value: Record<string, SnippetHttpRequestBodyFormValue>): string[] {\n return Object.entries(value).flatMap(([key, value]) => getBodyFormValueString(value, key));\n}\n\nfunction getBodyDataString(\n method: string,\n body: SnippetHttpRequest[\"body\"] | null | undefined,\n protocol: Latest.Protocol | undefined\n): string[] {\n if (method === \"GET\") {\n return [];\n }\n\n if (body == null) {\n if (protocol?.type === \"openrpc\") {\n return getBodyJsonString(undefined, protocol);\n }\n return [];\n }\n\n switch (body.type) {\n case \"json\":\n return getBodyJsonString(body.value, protocol);\n case \"bytes\":\n return getBodyBytesString(body.filename);\n case \"form\":\n return getBodyFormString(body.value);\n default:\n throw new UnreachableCaseError(body);\n }\n}\n\nfunction unsafeStringifyHttpRequestExampleToCurl({\n method,\n url,\n searchParams,\n headers,\n basicAuth,\n body,\n protocol,\n redacted\n}: SnippetHttpRequest): string {\n const httpRequest = getHttpRequest(method, url, searchParams);\n\n const headersStrings = getHeadersString(\n // If basicAuth is provided, we filter out any existing Authorization header\n // to avoid conflicts, as the basicAuth will be added separately with -u flag\n basicAuth != null\n ? Object.fromEntries(Object.entries(headers).filter(([key]) => key.toLowerCase() !== \"authorization\"))\n : headers\n );\n const basicAuthStrings = basicAuth != null ? getBasicAuthString(basicAuth, redacted) : [];\n\n // special handling for application/x-www-form-urlencoded\n const isFormUrlEncoded =\n method !== \"GET\" &&\n unknownToString(headers[\"Content-Type\"] ?? headers[\"content-type\"])\n .toLowerCase()\n .includes(\"form-urlencoded\");\n\n // GET requests don't have a body, so `--data-urlencode` is used to pass query parameters\n\n const urlQueriesGetStrings = getUrlQueriesGetString(\n {\n ...(method === \"GET\" ? searchParams : {}),\n // HACK: combine search params and body.value if body.type is json, because we expect the body.json to include url-encoded params\n ...(isFormUrlEncoded && body?.type === \"json\" && isPlainObject(body.value) ? body.value : {})\n },\n isFormUrlEncoded\n );\n\n const bodyDataStrings = isFormUrlEncoded ? [] : getBodyDataString(method, body, protocol);\n\n const allStrings = compact([...headersStrings, ...basicAuthStrings, ...urlQueriesGetStrings, ...bodyDataStrings]);\n\n function withNewLine(line: string): string {\n return ` \\\\\\n ${line}`;\n }\n\n return `curl ${httpRequest}${allStrings.map(withNewLine).join(\"\")}`;\n}\n\nfunction toUrlEncoded(urlQueries: Record<string, unknown>): [string, string][] {\n const queryString = qs.stringify(urlQueries, {\n encode: false,\n arrayFormat: \"repeat\",\n skipNulls: true,\n filter: (prefix, value) => {\n if (value != null && typeof value !== \"object\") {\n return String(value);\n }\n return value;\n }\n });\n\n if (!queryString) {\n return [];\n }\n\n return queryString.split(\"&\").map((pair) => {\n const [key, value] = pair.split(\"=\");\n return [key, value || \"\"] as [string, string];\n });\n}\n","export function obfuscateSecret(secret: string): string {\n if (secret.trimEnd().length === 0) {\n return secret;\n }\n if (secret.length < 28) {\n return secret.slice(0, 1) + \"*\".repeat(25) + secret.slice(-2);\n }\n return secret.slice(0, 12) + \"....\" + secret.slice(-12);\n}\n","/**\n * Wraps a request body in the OpenRPC format.\n *\n * @param body - The request body to wrap\n * @param methodName - The OpenRPC method name\n * @returns The wrapped request body in OpenRPC format\n */\nexport function wrapOpenRPCRequest(\n body: unknown,\n methodName: string\n): {\n jsonrpc: string;\n method: string;\n params: unknown[];\n id: number;\n} {\n let params: unknown[] = [];\n if (body && typeof body === \"object\") {\n params = Object.values(body);\n }\n return {\n jsonrpc: \"2.0\",\n method: methodName,\n params,\n id: 1\n };\n}\n","// Some OpenAPI specs (e.g. Uploadcare's /base/ direct upload) declare a\n// multipart property whose name is the literal token `{filename}`. The intent\n// is that the actual form field name should be the uploaded file's filename\n// rather than the placeholder itself. Code that emits multipart payloads\n// (curl/python/typescript snippets and the playground proxy fetch) must\n// resolve this placeholder per file before serializing the form-data.\n\nexport const MULTIPART_FILENAME_PLACEHOLDER = \"{filename}\";\n\n/**\n * Replaces every occurrence of each token key in `input` with the\n * corresponding value. Tokens whose replacement is `undefined` are left\n * in place. Returns the input unchanged if no token matches.\n */\nexport function replaceTemplateStrings(input: string, replacements: Record<string, string | undefined>): string {\n let result = input;\n for (const [token, replacement] of Object.entries(replacements)) {\n if (replacement != null && result.includes(token)) {\n result = result.split(token).join(replacement);\n }\n }\n return result;\n}\n\n/**\n * Resolves multipart-specific template placeholders (currently just\n * `{filename}`) in a form field name. Thin wrapper around\n * `replaceTemplateStrings` that fixes the supported token set.\n */\nexport function replaceMultipartTemplateStrings(input: string, vars: { filename?: string }): string {\n return replaceTemplateStrings(input, {\n [MULTIPART_FILENAME_PLACEHOLDER]: vars.filename\n });\n}\n","import { sanitizeUrl, unknownToString } from \"@fern-api/ui-core-utils\";\nimport visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\nimport { compact } from \"es-toolkit/array\";\nimport { noop } from \"ts-essentials\";\nimport urljoin from \"url-join\";\n\nimport type * as Latest from \"../latest\";\nimport { preprocessQueryParameters } from \"../url\";\n\nfunction buildPathForSnippet(\n path: Latest.PathPart[] | undefined,\n pathParameters: Record<string, unknown> | undefined\n): string {\n if (path == null) {\n return \"\";\n }\n return path\n .map((part) => {\n if (part.type === \"pathParameter\") {\n const key = part.value;\n const value = unknownToString(pathParameters?.[key]);\n return value.length > 0 ? value : `{${key}}`;\n }\n return part.value;\n })\n .join(\"\");\n}\n\ninterface SnippetHttpRequestBodyJson {\n type: \"json\";\n value?: unknown;\n}\n\ninterface SnippetHttpRequestBodyJsonExploded {\n type: \"exploded\";\n value?: unknown[];\n}\n\nexport interface SnippetHttpRequestBodyForm {\n type: \"form\";\n value: Record<string, SnippetHttpRequestBodyFormValue>;\n}\n\nexport interface SnippetHttpRequestBodyFormValueFilename {\n type: \"filename\";\n filename: string;\n contentType: string | undefined;\n}\n\nexport interface SnippetHttpRequestBodyFormValueFilenames {\n type: \"filenames\";\n files: Omit<SnippetHttpRequestBodyFormValueFilename, \"type\">[];\n}\n\nexport type SnippetHttpRequestBodyFormValue =\n | SnippetHttpRequestBodyJson\n | SnippetHttpRequestBodyJsonExploded\n | SnippetHttpRequestBodyFormValueFilename\n | SnippetHttpRequestBodyFormValueFilenames;\n\ninterface SnippetHttpRequestBodyBytes {\n type: \"bytes\";\n filename: string;\n}\n\nexport type SnippetHttpRequestBody =\n | SnippetHttpRequestBodyJson\n | SnippetHttpRequestBodyForm\n | SnippetHttpRequestBodyBytes;\n\nexport interface SnippetHttpRequest {\n method: string;\n url: string;\n searchParams: Record<string, unknown>;\n headers: Record<string, unknown>;\n basicAuth?: {\n username: string;\n password: string;\n };\n body: SnippetHttpRequestBody | undefined;\n protocol?: Latest.Protocol;\n redacted?: boolean;\n}\n\n/**\n * Whether the example actually sends a payload. Endpoints with an optional request\n * body may have examples that omit it entirely.\n */\nexport function hasRequestBodyPayload<T extends { type: string; value?: unknown }>(\n body: T | undefined | null\n): body is T {\n if (body == null) {\n return false;\n }\n switch (body.type) {\n case \"json\":\n return body.value !== undefined;\n case \"form\":\n return Object.keys((body.value as Record<string, unknown> | undefined) ?? {}).length > 0;\n default:\n return true;\n }\n}\n\n/**\n * Whether the endpoint declares a body that is sent even though the example can't render it:\n * binary uploads have no representable example payload, so their content type must be kept.\n *\n * Whole-body optionality isn't modeled anywhere else in the definition — only `bytes` bodies\n * carry `isOptional`, and object bodies are usually a reference (`{ type: \"alias\", value: { type:\n * \"id\" } }`) that says nothing about whether the body itself may be omitted — so payload presence\n * in the example is the only available signal.\n */\nexport function declaresUnrenderableBody(request: Latest.HttpRequest | undefined): boolean {\n return request?.body.type === \"bytes\" && !request.body.isOptional;\n}\n\nexport function getDeclaredContentType(request: Latest.HttpRequest | undefined): string | undefined {\n if (request == null) {\n return undefined;\n }\n const contentType = request.contentType ?? (request.body.type === \"bytes\" ? request.body.contentType : undefined);\n return typeof contentType === \"string\" ? contentType : (contentType?.[0] ?? undefined);\n}\n\n// TODO: validate that global headers are also included in the example by CLI or FDR\nexport function toSnippetHttpRequest(\n endpoint: Latest.EndpointDefinition,\n example: Latest.ExampleEndpointCall,\n auth: Latest.AuthScheme | undefined\n): SnippetHttpRequest {\n const environmentUrl = (\n endpoint.environments?.find((env) => env.id === endpoint.defaultEnvironment) ?? endpoint.environments?.[0]\n )?.baseUrl;\n const sanitizedEnvironment = sanitizeUrl(environmentUrl);\n\n const endpointPathRaw = buildPathForSnippet(endpoint.path, example.pathParameters ?? undefined);\n const examplePathRaw = example.path ? (example.path.startsWith(\"/\") ? example.path : `/${example.path}`) : \"\";\n\n // Normalize for comparison only (strip trailing slash, treat empty as \"/\")\n const normalize = (p: string): string => (p.endsWith(\"/\") ? p.slice(0, -1) : p) || \"/\";\n const endpointPath = normalize(endpointPathRaw);\n const examplePath = normalize(examplePathRaw);\n\n // Use endpoint.path if example.path is missing, or if endpoint.path equals / extends example.path\n // (endpoint.path carries the base path prefix)\n const useEndpointPath =\n examplePathRaw === \"\" ||\n endpointPath === examplePath ||\n (endpointPath.length > examplePath.length && endpointPath.endsWith(examplePath));\n const fullPath = useEndpointPath ? endpointPathRaw : examplePathRaw;\n\n const url = urljoin(compact([sanitizedEnvironment, fullPath]));\n\n const headers: Record<string, unknown> = { ...example.headers };\n\n let basicAuth: { username: string; password: string } | undefined;\n\n if (endpoint.auth && endpoint.auth.length > 0 && auth) {\n visitDiscriminatedUnion(auth, \"type\")._visit({\n basicAuth: ({ usernameName = \"username\", passwordName = \"password\", passwordAlwaysEmpty }) => {\n basicAuth = {\n username: `<${usernameName}>`,\n password: passwordAlwaysEmpty ? \"\" : `<${passwordName}>`\n };\n },\n bearerAuth: ({ tokenName = \"token\" }) => {\n headers.Authorization = `Bearer <${tokenName}>`;\n },\n header: ({ headerWireValue, nameOverride = headerWireValue, prefix }) => {\n headers[headerWireValue] = prefix != null ? `${prefix} <${nameOverride}>` : `<${nameOverride}>`;\n },\n oAuth: ({ value: clientCredentials }) => {\n visitDiscriminatedUnion(clientCredentials, \"type\")._visit({\n clientCredentials: () => {\n headers.Authorization = \"Bearer <token>\";\n },\n _other: noop\n });\n },\n _other: noop\n });\n }\n\n const body: Latest.ExampleEndpointRequest | undefined = example.requestBody ?? undefined;\n\n const request = endpoint.requests?.[0];\n const declaredContentType = getDeclaredContentType(request);\n\n if (example.contentType != null) {\n // an example-level content type is authored explicitly, so it always applies\n headers[\"Content-Type\"] = example.contentType;\n } else if (hasRequestBodyPayload(body) || declaresUnrenderableBody(request)) {\n // otherwise an example that renders no payload shouldn't advertise a Content-Type\n if (declaredContentType != null) {\n headers[\"Content-Type\"] = declaredContentType;\n } else if (body?.type === \"json\") {\n headers[\"Content-Type\"] = \"application/json\";\n } else if (body?.type === \"form\") {\n headers[\"Content-Type\"] = \"multipart/form-data\";\n }\n }\n\n // If endpoint is OpenRPC, ensure Content-Type is application/json\n if (endpoint.protocol?.type === \"openrpc\") {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n // Preprocess query parameters based on explode metadata\n const processedQueryParams =\n preprocessQueryParameters(example.queryParameters ?? undefined, endpoint.queryParameters ?? undefined) ?? {};\n\n return {\n method: endpoint.method,\n url,\n searchParams: processedQueryParams,\n headers: JSON.parse(JSON.stringify(headers)),\n basicAuth,\n protocol: endpoint.protocol ?? undefined,\n body:\n body == null\n ? undefined\n : visitDiscriminatedUnion(body)._visit<SnippetHttpRequestBody | undefined>({\n json: (value) => value,\n form: (value) => {\n const toRet: Record<string, SnippetHttpRequestBodyFormValue> = {};\n for (const [key, val] of Object.entries(value.value)) {\n const typedVal = val as {\n type: string;\n value?: unknown;\n filename?: string;\n files?: { filename: string }[];\n };\n const formValue = visitDiscriminatedUnion(typedVal, \"type\")._visit<\n SnippetHttpRequestBodyFormValue | undefined\n >({\n exploded: (value) => ({ type: \"exploded\", value: value.value as unknown[] }),\n json: (value) => ({ type: \"json\", value: value.value }),\n filename: (value) => ({\n type: \"filename\",\n filename: String(value.value ?? \"\"),\n contentType: undefined // TODO: infer content type?\n }),\n filenames: (value) => ({\n type: \"filenames\",\n files: (value.value as string[]).map((filename: string) => ({\n filename,\n contentType: undefined // TODO: infer content type?\n }))\n }),\n filenameWithData: (value) => ({\n type: \"filename\",\n filename: String(value.filename ?? \"\"),\n contentType: undefined // TODO: infer content type?\n }),\n filenamesWithData: (value) => ({\n type: \"filenames\",\n files: ((value.value as { filename: string }[]) ?? []).map(\n ({ filename }: { filename: string }) => ({\n filename,\n contentType: undefined // TODO: infer content type?\n })\n )\n }),\n _other: () => undefined\n });\n if (formValue != null) {\n toRet[key] = formValue;\n }\n }\n return { type: \"form\", value: toRet };\n },\n // TODO: filename should be provided in the example from the API definition\n bytes: () => ({ type: \"bytes\", filename: \"<filename>\" }),\n _other: () => undefined\n })\n };\n}\n","import { sanitizeUrl, unknownToString } from \"@fern-api/ui-core-utils\";\nimport qs from \"qs\";\n\nimport type { EndpointDefinition, ParameterProperty, PathPart } from \"./latest\";\n\n/**\n * Preprocesses query parameters based on explode metadata.\n * When explode=false, arrays are joined with commas instead of being repeated.\n */\nexport function preprocessQueryParameters(\n queryParameters: Record<string, unknown> | undefined,\n parameterMetadata: ParameterProperty[] | undefined\n): Record<string, unknown> | undefined {\n if (queryParameters == null) {\n return undefined;\n }\n\n // If no metadata, return as-is (default behavior is explode=true)\n if (parameterMetadata == null || parameterMetadata.length === 0) {\n return queryParameters;\n }\n\n // Create a map of parameter key to explode setting\n const explodeMap = new Map<string, boolean | undefined>();\n for (const param of parameterMetadata) {\n explodeMap.set(param.key, param.explode ?? undefined);\n }\n\n // Process each query parameter\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(queryParameters)) {\n const explode = explodeMap.get(key);\n\n // If explode is explicitly false and value is an array, join with commas\n if (explode === false && Array.isArray(value)) {\n result[key] = value.map((v) => unknownToString(v)).join(\",\");\n } else {\n result[key] = value;\n }\n }\n\n return result;\n}\n\nfunction buildQueryParams(queryParameters: Record<string, unknown> | undefined): string {\n if (queryParameters == null) {\n return \"\";\n }\n\n const filteredParams = Object.entries(queryParameters).reduce<Record<string, unknown>>((acc, [key, value]) => {\n if (value != null) {\n acc[key] = value;\n }\n return acc;\n }, {});\n\n if (Object.keys(filteredParams).length === 0) {\n return \"\";\n }\n\n const queryString = qs.stringify(filteredParams, {\n encode: false,\n arrayFormat: \"repeat\",\n skipNulls: true,\n serializeDate: (date: Date) => date.toISOString()\n });\n\n return queryString ? \"?\" + queryString : \"\";\n}\n\nfunction buildPath(path: PathPart[] = [], pathParameters?: Record<string, unknown>): string {\n return path\n .map((part) => {\n if (part.type === \"pathParameter\") {\n const key = part.value;\n const stateValue = unknownToString(pathParameters?.[key]);\n return stateValue.length > 0 ? encodeURIComponent(stateValue) : \":\" + key;\n }\n return part.value;\n })\n .join(\"\");\n}\n\ninterface BuildRequestUrlOptions {\n path?: PathPart[];\n pathParameters?: Record<string, unknown>;\n queryParameters?: Record<string, unknown>;\n baseUrl?: string;\n}\nexport function buildRequestUrl({\n baseUrl = \"\",\n path,\n pathParameters,\n queryParameters\n}: BuildRequestUrlOptions): string {\n const sanitizedBaseUrl = sanitizeUrl(baseUrl) || \"\";\n\n if (sanitizedBaseUrl.endsWith(\"/\")) {\n return sanitizedBaseUrl.slice(0, -1) + buildPath(path, pathParameters) + buildQueryParams(queryParameters);\n }\n return sanitizedBaseUrl + buildPath(path, pathParameters) + buildQueryParams(queryParameters);\n}\n\ninterface BuildEndpointUrlOptions {\n endpoint?: EndpointDefinition;\n pathParameters?: Record<string, unknown>;\n queryParameters?: Record<string, unknown>;\n baseUrl?: string;\n}\nexport function buildEndpointUrl({\n endpoint,\n pathParameters,\n queryParameters,\n baseUrl\n}: BuildEndpointUrlOptions): string {\n const environmentBaseUrl =\n baseUrl ??\n (endpoint?.environments?.find((env) => env.id === endpoint.defaultEnvironment) ?? endpoint?.environments?.[0])\n ?.baseUrl;\n\n // sanitize the base URL - if invalid, it will be null\n const sanitizedBaseUrl = sanitizeUrl(environmentBaseUrl);\n\n // Preprocess query parameters based on explode metadata\n const processedQueryParameters = preprocessQueryParameters(queryParameters, endpoint?.queryParameters ?? undefined);\n\n return buildRequestUrl({\n baseUrl: sanitizedBaseUrl || \"\",\n path: endpoint?.path,\n pathParameters,\n queryParameters: processedQueryParameters\n });\n}\n","import isPlainObject from \"@fern-api/ui-core-utils/isPlainObject\";\nimport visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\nimport { difference, keyBy } from \"es-toolkit/array\";\nimport { mapValues } from \"es-toolkit/object\";\n\nimport type * as Latest from \"./latest\";\nimport type { TypeShapeOrReference } from \"./types\";\nimport { unwrapDiscriminatedUnionVariant, unwrapObjectType } from \"./unwrap\";\n\nfunction sortKeysBy(obj: Record<string, unknown>, order: string[]): Record<string, unknown> {\n return mapValues(\n // difference() is used to ensure that all keys are included in the result\n keyBy([...order, ...difference(Object.keys(obj), order)], (key) => key),\n (key) => obj[key]\n );\n}\n\nexport function sortKeysByShape(\n obj: unknown,\n shape: TypeShapeOrReference | Latest.HttpRequestBodyShape | Latest.HttpResponseBodyShape | null | undefined,\n types: Record<string, Latest.TypeDefinition>\n): unknown {\n if ((!isPlainObject(obj) && !Array.isArray(obj)) || shape == null) {\n return obj;\n }\n return visitDiscriminatedUnion(shape, \"type\")._visit<unknown>({\n id: ({ id }) => sortKeysByShape(obj, types[id]?.shape, types),\n primitive: () => obj,\n literal: () => obj,\n optional: ({ shape }) => sortKeysByShape(obj, shape, types),\n nullable: ({ shape }) => sortKeysByShape(obj, shape, types),\n list: ({ itemShape }) => (Array.isArray(obj) ? obj.map((o) => sortKeysByShape(o, itemShape, types)) : obj),\n set: ({ itemShape }) => (Array.isArray(obj) ? obj.map((o) => sortKeysByShape(o, itemShape, types)) : obj),\n map: ({ valueShape }) =>\n isPlainObject(obj) ? mapValues(obj, (value) => sortKeysByShape(value, valueShape, types)) : obj,\n unknown: () => obj,\n object: (object) => {\n const objectProperties = unwrapObjectType(object, types).properties;\n return isPlainObject(obj)\n ? mapValues(\n sortKeysBy(\n obj,\n objectProperties.map((p) => p.key)\n ),\n (value, key) => {\n const property = objectProperties.find((p) => p.key === key);\n if (property == null) {\n return value;\n }\n return sortKeysByShape(value, property?.valueShape, types);\n }\n )\n : obj;\n },\n undiscriminatedUnion: () => obj, // TODO: match variant and sort nested objects\n discriminatedUnion: (union) => {\n const { discriminant, variants } = union;\n if (!isPlainObject(obj)) {\n return obj;\n }\n const variant = obj[discriminant];\n if (variant == null) {\n return obj;\n }\n const variantShape = variants.find((v) => v.discriminantValue === variant);\n if (variantShape == null) {\n return obj;\n }\n const variantProperties = unwrapDiscriminatedUnionVariant(union, variantShape, types).properties;\n return mapValues(sortKeysBy(obj, [discriminant, ...variantProperties.map((p) => p.key)]), (value, key) => {\n if (key === discriminant) {\n return value;\n }\n const property = variantProperties.find((p) => p.key === key);\n if (property == null) {\n return value;\n }\n return sortKeysByShape(value, property.valueShape, types);\n });\n },\n enum: () => obj,\n alias: ({ value: typeRef }) => sortKeysByShape(obj, typeRef, types),\n formData: ({ fields }) => {\n if (!isPlainObject(obj)) {\n return obj;\n }\n\n return mapValues(\n sortKeysBy(\n obj,\n fields.map((p) => p.key)\n ),\n (v, key) => {\n const property = fields.find((p) => p.key === key);\n\n if (property == null) {\n return v;\n }\n\n if (property.type === \"property\") {\n return sortKeysByShape(v, property.valueShape, types);\n }\n\n return undefined;\n }\n );\n },\n bytes: () => obj,\n fileDownload: () => obj,\n streamingText: () => obj,\n stream: () => obj,\n empty: () => obj,\n _other: () => obj\n });\n}\n\nexport function safeSortKeysByShape(\n value: unknown,\n shape: TypeShapeOrReference | Latest.HttpRequestBodyShape | Latest.HttpResponseBodyShape | null | undefined,\n types: Record<string, Latest.TypeDefinition>\n): unknown {\n if (value == null) {\n return value;\n }\n try {\n return stripUndefines(sortKeysByShape(value, shape, types));\n } catch (e) {\n console.error(\"Failed to sort JSON keys by type shape\", e);\n\n return value;\n }\n}\n\nfunction stripUndefines(obj: unknown): unknown {\n return JSON.parse(JSON.stringify(obj));\n}\n","import type { HttpMethod } from \"./latest\";\n\ntype StatusCodeMessagesByMethod = Partial<Record<HttpMethod, string>>;\n\ntype StatusCodeMessages = Record<number, StatusCodeMessagesByMethod>;\n\ntype DefaultStatusCodeMessages = Record<number, string>;\n\nexport const STATUS_CODE_MESSAGES: DefaultStatusCodeMessages = {\n 100: \"Continue\",\n 101: \"Switching Protocols\",\n 102: \"Processing\",\n 103: \"Early Hints\",\n 200: \"OK\",\n 201: \"Created\",\n 202: \"Accepted\",\n 203: \"Non-Authoritative Information\",\n 204: \"No Content\",\n 205: \"Reset Content\",\n 206: \"Partial Content\",\n 207: \"Multi-Status\",\n 208: \"Already Reported\",\n 226: \"IM Used\",\n 300: \"Multiple Choices\",\n 301: \"Moved Permanently\",\n 302: \"Found\",\n 303: \"See Other\",\n 304: \"Not Modified\",\n 305: \"Use Proxy\",\n 306: \"Switch Proxy\",\n 307: \"Temporary Redirect\",\n 308: \"Permanent Redirect\",\n 400: \"Bad Request\",\n 401: \"Unauthorized\",\n 402: \"Payment Required\",\n 403: \"Forbidden\",\n 404: \"Not Found\",\n 405: \"Method Not Allowed\",\n 406: \"Not Acceptable\",\n 407: \"Proxy Authentication Required\",\n 408: \"Request Timeout\",\n 409: \"Conflict\",\n 410: \"Gone\",\n 411: \"Length Required\",\n 412: \"Precondition Failed\",\n 413: \"Payload Too Large\",\n 414: \"URI Too Long\",\n 415: \"Unsupported Media Type\",\n 416: \"Range Not Satisfiable\",\n 417: \"Expectation Failed\",\n 418: \"I'm a teapot\",\n 421: \"Misdirected Request\",\n 422: \"Unprocessable Entity\",\n 423: \"Locked\",\n 424: \"Failed Dependency\",\n 425: \"Too Early\",\n 426: \"Upgrade Required\",\n 428: \"Precondition Required\",\n 429: \"Too Many Requests\",\n 431: \"Request Header Fields Too Large\",\n 451: \"Unavailable For Legal Reasons\",\n 500: \"Internal Server Error\",\n 501: \"Not Implemented\",\n 502: \"Bad Gateway\",\n 503: \"Service Unavailable\",\n 504: \"Gateway Timeout\",\n 505: \"HTTP Version Not Supported\",\n 506: \"Variant Also Negotiates\",\n 507: \"Insufficient Storage\",\n 508: \"Loop Detected\",\n 510: \"Not Extended\",\n 511: \"Network Authentication Required\"\n};\n\nexport const STATUS_CODE_MESSAGES_METHOD_OVERRIDES: StatusCodeMessages = {\n 200: {\n GET: \"Retrieved\",\n POST: \"Successful\", // more accurate than \"Created\" for POST\n PUT: \"Updated\",\n PATCH: \"Updated\",\n DELETE: \"Deleted\"\n }\n};\n\nexport function getMessageForStatus(statusCode: number, method?: HttpMethod): string {\n // return the method-specific message if it exists\n if (method != null) {\n const methodOverrides = STATUS_CODE_MESSAGES_METHOD_OVERRIDES[statusCode];\n if (methodOverrides != null) {\n const message = methodOverrides[method];\n if (message != null) {\n return message;\n }\n }\n }\n\n // return the official status message if it exists\n const message = STATUS_CODE_MESSAGES[statusCode];\n if (message != null) {\n return message;\n }\n\n // return the default message if it exists\n if (statusCode >= 100 && statusCode < 200) {\n return \"Informational\";\n } else if (statusCode >= 200 && statusCode < 300) {\n return \"Success\";\n } else if (statusCode >= 300 && statusCode < 400) {\n return \"Redirection\";\n } else if (statusCode >= 400 && statusCode < 500) {\n return \"Client Error\";\n } else if (statusCode >= 500 && statusCode < 600) {\n return \"Server Error\";\n } else {\n return \"Unknown Status\";\n }\n}\n","import type * as Latest from \"./latest\";\n\n/**\n * Reduces an endpoint to what `EndpointRequestSnippet` / `EndpointResponseSnippet`\n * render: locator, environments, examples (and error examples). Request/response\n * schemas, parameter definitions and descriptions are dropped since these\n * components never display them, and the whole object is inlined into the\n * compiled MDX for every snippet on a page.\n *\n * When `exampleName` matches at least one example, only matching examples are kept.\n */\nexport function pruneEndpointForExampleSnippet(\n endpoint: Latest.EndpointDefinition,\n exampleName: string | null | undefined\n): Latest.EndpointDefinition {\n const matching =\n exampleName != null ? endpoint.examples?.filter((example) => example.name === exampleName) : undefined;\n const examples = matching != null && matching.length > 0 ? matching : endpoint.examples;\n\n return {\n id: endpoint.id,\n namespace: endpoint.namespace,\n method: endpoint.method,\n path: endpoint.path,\n displayName: endpoint.displayName,\n operationId: endpoint.operationId,\n availability: endpoint.availability,\n auth: endpoint.auth,\n multiAuth: endpoint.multiAuth,\n defaultEnvironment: endpoint.defaultEnvironment,\n environments: endpoint.environments,\n errors: endpoint.errors?.map((error) => ({\n name: error.name,\n statusCode: error.statusCode,\n isWildcard: error.isWildcard,\n examples: error.examples\n })),\n examples,\n protocol: endpoint.protocol,\n includeInApiExplorer: endpoint.includeInApiExplorer\n };\n}\n","import type * as Latest from \"./latest\";\nimport { ApiTypeIdVisitor } from \"./typeid-visitor\";\n\ntype SchemaSection = \"request.path\" | \"request.query\" | \"request.body\" | \"response.body\";\n\nconst ALL_SECTIONS: readonly SchemaSection[] = [\"request.path\", \"request.query\", \"request.body\", \"response.body\"];\n\n/**\n * Resolves a schema selector (e.g. `\"request\"`, `\"request.body\"`, `\"response.body\"`) to the\n * set of sections it exposes. A `null` selector exposes every section.\n */\nexport function getSchemaSectionsForSelector(selector: string | null | undefined): Set<SchemaSection> {\n if (selector == null) {\n return new Set(ALL_SECTIONS);\n }\n const sections = ALL_SECTIONS.filter((section) => section === selector || section.split(\".\")[0] === selector);\n // unknown selector: keep everything rather than pruning to nothing\n return new Set(sections.length > 0 ? sections : ALL_SECTIONS);\n}\n\n/**\n * Narrows an endpoint definition and its type map to what is needed to render the schema sections\n * exposed by `selector`. Unselected sections, examples and errors are dropped from the endpoint,\n * and only the types transitively reachable from the remaining sections are kept.\n */\nexport function pruneEndpointToSchemaSelector(\n endpoint: Latest.EndpointDefinition,\n types: Record<Latest.TypeId, Latest.TypeDefinition>,\n selector: string | null | undefined\n): { endpoint: Latest.EndpointDefinition; types: Record<Latest.TypeId, Latest.TypeDefinition> } {\n const sections = getSchemaSectionsForSelector(selector);\n\n const pruned: Latest.EndpointDefinition = {\n ...endpoint,\n pathParameters: sections.has(\"request.path\") ? endpoint.pathParameters : undefined,\n queryParameters: sections.has(\"request.query\") ? endpoint.queryParameters : undefined,\n requestHeaders: undefined,\n responseHeaders: undefined,\n requests: sections.has(\"request.body\") ? endpoint.requests?.slice(0, 1) : undefined,\n responses: sections.has(\"response.body\") ? endpoint.responses?.slice(0, 1) : undefined,\n errors: undefined,\n examples: undefined\n };\n\n const seeds = new Set<Latest.TypeId>();\n ApiTypeIdVisitor.visitEndpointDefinition(pruned, (typeId) => seeds.add(typeId));\n\n return { endpoint: pruned, types: collectReachableTypes(types, seeds) };\n}\n\nfunction collectReachableTypes(\n types: Record<Latest.TypeId, Latest.TypeDefinition>,\n seeds: ReadonlySet<Latest.TypeId>\n): Record<Latest.TypeId, Latest.TypeDefinition> {\n const reachable: Record<Latest.TypeId, Latest.TypeDefinition> = {};\n const queue = Array.from(seeds);\n const enqueued = new Set<Latest.TypeId>(seeds);\n\n while (queue.length > 0) {\n const typeId = queue.pop();\n if (typeId == null) {\n continue;\n }\n const type = types[typeId];\n if (type == null) {\n continue;\n }\n reachable[typeId] = type;\n ApiTypeIdVisitor.visitTypeDefinition(type, (nested) => {\n if (!enqueued.has(nested)) {\n enqueued.add(nested);\n queue.push(nested);\n }\n });\n }\n\n return reachable;\n}\n","import type { HTTPSnippetClient } from \"./types\";\n\n/**\n * HTTP snippet client configurations for each supported language.\n * These define which httpsnippet-lite target and client to use for each language.\n */\nexport const HTTP_SNIPPET_CLIENTS: HTTPSnippetClient[] = [\n { targetId: \"python\", clientId: \"requests\" },\n { targetId: \"javascript\", clientId: \"fetch\" },\n { targetId: \"go\", clientId: \"native\" },\n { targetId: \"ruby\", clientId: \"native\" },\n { targetId: \"java\", clientId: \"unirest\" },\n { targetId: \"php\", clientId: \"guzzle\" },\n { targetId: \"csharp\", clientId: \"restsharp\" },\n { targetId: \"swift\", clientId: \"nsurlsession\" }\n];\n","import type { ApiAuth } from \"../../client/APIV1Read\";\nimport type { AuthScheme, AuthSchemeId, CodeSnippet, EndpointDefinition, ExampleEndpointCall } from \"../latest\";\nimport { hasRequestBodyPayload } from \"./SnippetHttpRequest\";\n\n/**\n * Get the first auth scheme ID for an endpoint, preferring multiAuth over legacy auth.\n * multiAuth provides proper OR-of-AND semantics for endpoint-specific security.\n */\nexport function getFirstAuthSchemeId(endpoint: EndpointDefinition): AuthSchemeId | undefined {\n if (endpoint.multiAuth != null && endpoint.multiAuth.length > 0) {\n const firstGroup = endpoint.multiAuth[0];\n if (firstGroup && firstGroup.schemes.length > 0) {\n return firstGroup.schemes[0];\n }\n }\n return endpoint.auth?.[0];\n}\n\n/**\n * Get the first auth scheme for an endpoint from the auths record.\n * Uses getFirstAuthSchemeId to select the correct auth scheme.\n */\nexport function getFirstAuthScheme<T extends AuthScheme | ApiAuth>(\n endpoint: EndpointDefinition,\n auths: Record<AuthSchemeId, T>\n): T | undefined {\n const authId = getFirstAuthSchemeId(endpoint);\n return authId != null ? auths[authId] : undefined;\n}\n\n/**\n * Get the header name for an auth scheme.\n * Returns the header wire value for header auth, \"Authorization\" for bearer/OAuth, or undefined.\n */\nexport function getAuthHeaderName(auth: AuthScheme | ApiAuth | undefined): string | undefined {\n if (auth == null) {\n return undefined;\n }\n if (auth.type === \"header\") {\n return (auth as { headerWireValue?: string }).headerWireValue;\n }\n if (auth.type === \"bearerAuth\" || auth.type === \"oAuth\") {\n return \"Authorization\";\n }\n return undefined;\n}\n\n/**\n * Check if a snippet is likely auto-generated (not user-provided).\n * A snippet is considered likely generated if:\n * - generated === true, OR\n * - generated is undefined AND name, install, and description are all null\n */\nexport function isLikelyGeneratedSnippet(snippet: CodeSnippet): boolean {\n if (snippet.generated === true) {\n return true;\n }\n if (snippet.generated === false) {\n return false;\n }\n return snippet.name == null && snippet.install == null && snippet.description == null;\n}\n\n/**\n * Determine if a curl snippet should be regenerated because it has the wrong auth header or URL.\n * Only regenerates if:\n * - No existing snippets exist, OR\n * - All existing snippets are likely generated AND none contain the expected header, OR\n * - For basic auth: existing snippets use -H \"Authorization: Basic\" instead of -u flag, OR\n * - The endpoint has a non-trivial path but no existing snippet's URL contains it\n * (targeted repair for snippets generated before the empty-example-path fix), OR\n * - The example sends no body but an existing snippet still advertises a Content-Type\n * (targeted repair for snippets generated before the bodyless-Content-Type fix)\n */\nexport function shouldRegenerateCurlSnippet(\n existingSnippets: CodeSnippet[] | undefined,\n expectedHeaderName: string | undefined,\n authScheme?: AuthScheme | ApiAuth,\n endpoint?: EndpointDefinition,\n example?: ExampleEndpointCall\n): boolean {\n if (existingSnippets == null || existingSnippets.length === 0) {\n return true;\n }\n\n const allLikelyGenerated = existingSnippets.every(isLikelyGeneratedSnippet);\n if (!allLikelyGenerated) {\n return false;\n }\n\n // Regenerate if the endpoint has a non-trivial path but no existing snippet's URL contains it.\n // This catches pre-stored snippets that were generated with a broken URL (base only, no path).\n if (endpoint != null && isMissingEndpointPath(existingSnippets, endpoint)) {\n return true;\n }\n\n if (example != null && hasStaleContentType(existingSnippets, example)) {\n return true;\n }\n\n // For basic auth, check if snippets use -H \"Authorization: Basic\" instead of -u flag\n // If so, regenerate to use -u flag\n if (authScheme?.type === \"basicAuth\") {\n const usesBasicAuthHeader = existingSnippets.some(\n (s) => s.code.includes('-H \"Authorization: Basic') || s.code.includes(\"-H 'Authorization: Basic\")\n );\n if (usesBasicAuthHeader) {\n return true;\n }\n\n // If passwordAlwaysEmpty, regenerate if existing snippet still contains a password placeholder\n if (authScheme.passwordAlwaysEmpty) {\n const passwordName = authScheme.passwordName ?? \"password\";\n const hasPasswordPlaceholder = existingSnippets.some((s) => s.code.includes(`:<${passwordName}>`));\n if (hasPasswordPlaceholder) {\n return true;\n }\n }\n\n // If basic auth and no header found, check if -u flag is present\n const usesUFlag = existingSnippets.some((s) => s.code.includes(\"-u \"));\n // If -u flag is present, no need to regenerate\n return !usesUFlag;\n }\n\n if (expectedHeaderName == null) {\n return false;\n }\n\n const hasCorrectHeader = existingSnippets.some(\n (s) => s.code.includes(`\"${expectedHeaderName}:`) || s.code.includes(`'${expectedHeaderName}:`)\n );\n return !hasCorrectHeader;\n}\n\n/**\n * Determine if an HTTP snippet for a given language should be regenerated.\n * Always regenerates auto-generated snippets so they pick up the latest\n * generation logic. Only preserves user-provided snippets (generated === false).\n */\nexport function shouldRegenerateHttpSnippet(existingSnippets: CodeSnippet[] | undefined): boolean {\n if (existingSnippets == null || existingSnippets.length === 0) {\n return false; // nothing to regenerate; will be generated fresh\n }\n\n return existingSnippets.every(isLikelyGeneratedSnippet);\n}\n\n/**\n * Check whether none of the existing curl snippets contain any literal segment of the\n * endpoint path. Returns true only when the endpoint has at least one non-empty literal\n * segment (ignoring bare slashes) and not a single snippet references any of those segments.\n */\nfunction isMissingEndpointPath(existingSnippets: CodeSnippet[], endpoint: EndpointDefinition): boolean {\n const literalSegments = (endpoint.path ?? [])\n .filter((part): part is { type: \"literal\"; value: string } => part.type === \"literal\")\n .flatMap((part) => part.value.split(\"/\"))\n .map((segment) => segment.trim())\n .filter((segment) => segment.length > 0);\n\n if (literalSegments.length === 0) {\n return false;\n }\n\n return existingSnippets.every((snippet) => literalSegments.every((segment) => !snippet.code.includes(segment)));\n}\n\n/**\n * Whether a stored snippet advertises a Content-Type even though the example sends no payload.\n * An authored `example.contentType` still applies, so such examples are left alone.\n */\nfunction hasStaleContentType(existingSnippets: CodeSnippet[], example: ExampleEndpointCall): boolean {\n if (example.contentType != null || hasRequestBodyPayload(example.requestBody)) {\n return false;\n }\n\n return existingSnippets.some((snippet) => snippet.code.toLowerCase().includes(\"content-type:\"));\n}\n","import { unknownToString, visitDiscriminatedUnion } from \"@fern-api/ui-core-utils\";\nimport type { HarRequest } from \"httpsnippet-lite\";\nimport type { ApiAuth } from \"../../client/APIV1Read\";\nimport {\n type AuthSchemeId,\n buildEndpointUrl,\n type EndpointDefinition,\n type ExampleEndpointCall,\n type ExampleEndpointRequest,\n preprocessQueryParameters\n} from \"../\";\nimport { getFirstAuthScheme } from \"./auth-scheme\";\nimport type { BasicAuthInfo } from \"./HttpSnippetConverter\";\nimport { declaresUnrenderableBody, getDeclaredContentType, hasRequestBodyPayload } from \"./SnippetHttpRequest\";\n\nexport function getHarRequest(\n endpoint: EndpointDefinition,\n example: ExampleEndpointCall,\n auths: Record<AuthSchemeId, ApiAuth>,\n requestBody: ExampleEndpointRequest | undefined\n): HarRequest {\n const request: HarRequest = {\n httpVersion: \"1.1\",\n method: \"GET\",\n url: \"\",\n headers: [],\n headersSize: -1,\n queryString: [],\n cookies: [],\n bodySize: -1\n };\n const builtUrl = buildEndpointUrl({\n endpoint,\n // omit query parameters here because they are included in the `queryString` field\n pathParameters: example.pathParameters ?? undefined\n });\n\n // HTTPSnippet requires a full URL with protocol and host\n // If the built URL is a relative path, prepend a placeholder base URL\n request.url =\n builtUrl.startsWith(\"http://\") || builtUrl.startsWith(\"https://\")\n ? builtUrl\n : `https://api.example.com${builtUrl.startsWith(\"/\") ? \"\" : \"/\"}${builtUrl}`;\n\n request.method = endpoint.method;\n\n // Preprocess query parameters based on explode metadata\n const processedQueryParams =\n preprocessQueryParameters(example.queryParameters ?? undefined, endpoint.queryParameters ?? undefined) ?? {};\n request.queryString = Object.entries(processedQueryParams).map(([name, value]) => ({\n name,\n value: unknownToString(value)\n }));\n request.headers = Object.entries(example.headers ?? {}).map(([name, value]) => ({\n name,\n value: unknownToString(value)\n }));\n\n // an example that renders no payload shouldn't advertise a Content-Type\n let contentTypeHeader: string | undefined;\n\n if (!hasRequestBodyPayload(requestBody)) {\n if (example.contentType != null) {\n contentTypeHeader = example.contentType;\n } else if (declaresUnrenderableBody(endpoint.requests?.[0])) {\n contentTypeHeader = getDeclaredContentType(endpoint.requests?.[0]);\n }\n } else {\n // the serialized mime type drives httpsnippet's payload rendering, so it stays inferred\n // from the example body rather than from an example-level Content-Type override\n const mimeType =\n endpoint.requests?.[0]?.contentType ??\n (requestBody.type === \"json\" ? \"application/json\" : \"multipart/form-data\");\n contentTypeHeader = example.contentType ?? mimeType;\n request.postData = {\n mimeType\n };\n\n // filter out request parameters that have no value and are not an array\n if (requestBody.value && typeof requestBody.value === \"object\" && !Array.isArray(requestBody.value)) {\n requestBody.value = Object.fromEntries(\n Object.entries(requestBody.value).filter(([_, valueObj]) => {\n // Keep arrays and primitive values\n if (Array.isArray(valueObj) || typeof valueObj !== \"object\" || valueObj == null) {\n return true;\n }\n // For objects, only filter out empty objects without a value property\n return Object.keys(valueObj).length > 0;\n })\n );\n }\n\n if (requestBody.type === \"json\") {\n request.postData.text = JSON.stringify(requestBody.value, null, 2);\n } else if (requestBody.type === \"form\") {\n request.postData.params = [];\n\n for (const [name, rawValue] of Object.entries(requestBody.value)) {\n const value = rawValue as {\n type: string;\n value?: unknown;\n filename?: string;\n };\n if (value.type === \"json\") {\n request.postData.params.push({\n name,\n value: typeof value.value === \"string\" ? value.value : JSON.stringify(value.value, null, 2)\n });\n } else if (value.type === \"filename\") {\n request.postData.params.push({\n name,\n fileName: String(value.value ?? \"\")\n });\n } else if (value.type === \"filenameWithData\") {\n request.postData.params.push({\n name,\n fileName: String(value.filename ?? \"\")\n });\n } else if (value.type === \"filenames\") {\n for (const fileName of value.value as string[]) {\n request.postData.params.push({\n name,\n fileName\n });\n }\n } else if (value.type === \"filenamesWithData\") {\n for (const { filename } of value.value as { filename: string }[]) {\n request.postData.params.push({\n name,\n fileName: filename\n });\n }\n }\n }\n } else if (requestBody.type === \"bytes\") {\n // TODO: verify this is correct\n request.postData.params = [\n {\n name: \"file\",\n value: String((requestBody.value as { value?: unknown })?.value ?? \"\")\n }\n ];\n }\n }\n\n const auth = getFirstAuthScheme(endpoint, auths);\n\n if (auth != null) {\n visitDiscriminatedUnion(auth)._visit({\n basicAuth: ({ usernameName = \"username\", passwordName = \"password\", passwordAlwaysEmpty }) => {\n request.headers.push({\n name: \"Authorization\",\n value: passwordAlwaysEmpty\n ? `Basic <${usernameName}>:`\n : `Basic <${usernameName}>:<${passwordName}>`\n });\n },\n bearerAuth: ({ tokenName = \"token\" }) => {\n request.headers.push({\n name: \"Authorization\",\n value: `Bearer <${tokenName}>`\n });\n },\n header: ({ headerWireValue, nameOverride = headerWireValue, prefix }) => {\n request.headers.push({\n name: headerWireValue,\n value: prefix != null ? `${prefix} <${nameOverride}>` : `<${nameOverride}>`\n });\n },\n oAuth: (oAuth) => {\n visitDiscriminatedUnion(oAuth.value, \"type\")._visit({\n clientCredentials: (clientCredentials) => {\n visitDiscriminatedUnion(clientCredentials.value, \"type\")._visit({\n referencedEndpoint: () => {\n request.headers.push({\n name: clientCredentials.value.headerName || \"Authorization\",\n value: `${clientCredentials.value.tokenPrefix ? `${clientCredentials.value.tokenPrefix ?? \"Bearer\"} ` : \"\"}<token>.`\n });\n }\n });\n }\n });\n }\n });\n }\n\n // If endpoint is OpenRPC, ensure Content-Type is application/json\n if (endpoint.protocol?.type === \"openrpc\") {\n contentTypeHeader = \"application/json\";\n }\n\n if (contentTypeHeader != null) {\n request.headers.push({\n name: \"Content-Type\",\n value: contentTypeHeader\n });\n }\n\n return request;\n}\n\n/**\n * Extract basic auth info from an endpoint's auth scheme, if present.\n * Returns the placeholder username and password names used in HAR headers.\n */\nexport function getHarRequestBasicAuth(\n endpoint: EndpointDefinition,\n auths: Record<AuthSchemeId, ApiAuth>\n): BasicAuthInfo | undefined {\n const auth = getFirstAuthScheme(endpoint, auths);\n if (auth?.type === \"basicAuth\") {\n const { usernameName = \"username\", passwordName = \"password\", passwordAlwaysEmpty } = auth;\n return {\n username: `<${usernameName}>`,\n password: passwordAlwaysEmpty ? \"\" : `<${passwordName}>`,\n passwordAlwaysEmpty: passwordAlwaysEmpty ?? false\n };\n }\n return undefined;\n}\n","import type { GraphQlTypeCategory, TypeId } from \"../../navigation\";\nimport type {\n GraphQlOperation,\n GraphQlOperationType,\n ObjectProperty,\n PrimitiveType,\n TypeDefinition,\n TypeReference,\n TypeShape\n} from \"../latest\";\nimport { unwrapReference } from \"../unwrap\";\n\n/**\n * Context needed to generate a GraphQL snippet\n */\nexport interface GraphQlSnippetContext {\n operation: GraphQlOperation;\n types: Record<TypeId, TypeDefinition>;\n}\n\n/**\n * Generated GraphQL snippet\n */\nexport interface GraphQlSnippet {\n query: string;\n variables: Record<string, unknown>;\n response: unknown;\n}\n\n/**\n * A single GraphQL code example for an operation (structurally matches the\n * docs `GraphqlExample`). Shared so the Next.js bundle and the Astro static\n * loader build examples identically.\n */\nexport interface GraphqlOperationExample {\n name?: string;\n description?: string;\n query: string;\n variables: Record<string, unknown> | undefined;\n response: unknown;\n}\n\n/**\n * Build the code examples for a single GraphQL operation: use the operation's\n * own examples when present, otherwise generate a query/response snippet. Shared\n * by the bundle's `GraphqlContent` and the Astro loader's `graphql` branch so\n * the two can't drift (they previously each kept a copy).\n */\nexport function buildGraphqlExamplesForOperation(\n operation: GraphQlOperation,\n types: Record<TypeId, TypeDefinition>\n): GraphqlOperationExample[] {\n if (operation.examples != null && operation.examples.length > 0) {\n return operation.examples.map((ex) => ({\n name: ex.name ?? undefined,\n description: ex.description ?? undefined,\n query: ex.query,\n variables: ex.variables ?? undefined,\n response: ex.response\n }));\n }\n const generated = generateGraphQlSnippet({ operation, types });\n return [\n {\n query: generated.query,\n variables: Object.keys(generated.variables).length > 0 ? generated.variables : undefined,\n response: generated.response\n }\n ];\n}\n\n// Cache for generated snippets to avoid regenerating on re-renders\nconst snippetCache = new WeakMap<GraphQlOperation, GraphQlSnippet>();\n\n/**\n * Generate a GraphQL snippet from an operation definition\n */\nexport function generateGraphQlSnippet(context: GraphQlSnippetContext): GraphQlSnippet {\n const cached = snippetCache.get(context.operation);\n if (cached) {\n return cached;\n }\n const { operation, types } = context;\n\n const operationKeyword = getOperationKeyword(operation.operationType);\n const operationName = getExampleOperationName(operation.operationType);\n\n const args = operation.arguments ?? [];\n const variables: Record<string, unknown> = {};\n\n // Build variable definitions and collect example values\n const variableDefinitions = args.map((arg) => {\n const graphqlType = typeShapeToGraphQlType(arg.type, types);\n const exampleValue = generateExampleValue(arg.type, types, 5, new Set(), arg.defaultValue);\n variables[arg.name] = exampleValue;\n return `$${arg.name}: ${graphqlType}`;\n });\n\n // Build argument usage in the query\n const argumentUsage = args.map((arg) => `${arg.name}: $${arg.name}`);\n\n // Build the selection set from the return type, adjusting indent for fieldPath nesting.\n const fieldPath = operation.fieldPath;\n const hasFieldPath = fieldPath != null && fieldPath.length > 0;\n const selectionSetIndent = hasFieldPath ? 2 + fieldPath.length : 2;\n // Namespace types (all fields have arguments) are structural wrappers that\n // don't represent meaningful depth, so they get one extra level.\n const initialDepth = isReturnTypeNamespace(operation.returnType, types) ? DEFAULT_MAX_DEPTH + 1 : DEFAULT_MAX_DEPTH;\n const selectionSet = generateSelectionSet(operation.returnType, types, initialDepth, new Set(), selectionSetIndent);\n\n // Construct the query\n let query = operationKeyword;\n if (operationName || variableDefinitions.length > 0) {\n query += ` ${operationName}`;\n if (variableDefinitions.length > 0) {\n query += `(${variableDefinitions.join(\", \")})`;\n }\n }\n\n query += \" {\\n\";\n\n const baseIndent = 2;\n\n if (hasFieldPath) {\n for (let i = 0; i < fieldPath.length; i++) {\n const indent = \" \".repeat(baseIndent + i * 2);\n query += `${indent}${fieldPath[i]} {\\n`;\n }\n }\n\n const operationIndent = hasFieldPath ? \" \".repeat(baseIndent + fieldPath.length * 2) : \" \";\n query += `${operationIndent}${operation.name}`;\n\n if (argumentUsage.length > 0) {\n query += `(${argumentUsage.join(\", \")})`;\n }\n\n if (selectionSet) {\n query += ` ${selectionSet}`;\n }\n\n query += \"\\n\";\n\n // Close the fieldPath nesting brackets\n if (hasFieldPath) {\n for (let i = fieldPath.length - 1; i >= 0; i--) {\n const indent = \" \".repeat(baseIndent + i * 2);\n query += `${indent}}\\n`;\n }\n }\n\n query += \"}\";\n\n // Generate example response based on return type\n const response = generateResponseExample(operation.name, operation.returnType, types, fieldPath);\n\n const result = { query, variables, response };\n snippetCache.set(operation, result);\n return result;\n}\n\nconst SDL_KEYWORD: Record<GraphQlTypeCategory, string> = {\n object: \"type\",\n input: \"input\",\n interface: \"interface\",\n enum: \"enum\",\n union: \"union\",\n scalar: \"scalar\"\n};\n\n/**\n * Reconstruct the SDL declaration of a named GraphQL type, for the aside of a type page.\n *\n * The FDR type shape is a lossy projection of SDL -- an interface and an object share the\n * `object` shape, a custom scalar becomes an `alias` -- so the declared category has to be\n * supplied by the caller (the nav node carries it) rather than sniffed from the shape.\n */\nexport function generateGraphQlTypeSdl({\n name,\n category,\n type,\n types\n}: {\n name: string;\n category: GraphQlTypeCategory;\n type: TypeDefinition;\n types: Record<TypeId, TypeDefinition>;\n}): string {\n const keyword = SDL_KEYWORD[category];\n const shape = type.shape;\n\n if (category === \"scalar\") {\n return `scalar ${name}`;\n }\n\n if (category === \"union\") {\n const members =\n shape.type === \"undiscriminatedUnion\"\n ? shape.variants.map((variant) => typeShapeToGraphQlType(variant.shape, types, false))\n : shape.type === \"discriminatedUnion\"\n ? shape.variants.map((variant) => variant.displayName ?? variant.discriminantValue)\n : [];\n return members.length > 0 ? `union ${name} = ${members.join(\" | \")}` : `union ${name}`;\n }\n\n if (shape.type === \"enum\") {\n const values = shape.values.map((value) => ` ${value.value}`);\n return `enum ${name} {\\n${values.join(\"\\n\")}\\n}`;\n }\n\n if (shape.type === \"object\") {\n const implemented = shape.extends\n .map((typeId) => types[typeId])\n .filter((implementedType) => implementedType != null)\n .map((implementedType) => implementedType.displayName ?? unnamespacedName(implementedType.name));\n const heading =\n implemented.length > 0 ? `${keyword} ${name} implements ${implemented.join(\" & \")}` : `${keyword} ${name}`;\n const fields = shape.properties.map((property) => ` ${objectPropertyToSdlField(property, types)}`);\n return fields.length > 0 ? `${heading} {\\n${fields.join(\"\\n\")}\\n}` : heading;\n }\n\n return `${keyword} ${name}`;\n}\n\nfunction objectPropertyToSdlField(property: ObjectProperty, types: Record<TypeId, TypeDefinition>): string {\n const args = property.arguments ?? [];\n const argList =\n args.length > 0\n ? `(${args.map((arg) => `${arg.name}: ${typeShapeToGraphQlType(arg.type, types)}`).join(\", \")})`\n : \"\";\n return `${property.key}${argList}: ${typeShapeToGraphQlType(property.valueShape, types)}`;\n}\n\n/**\n * Get the GraphQL operation keyword (query, mutation, subscription)\n */\nfunction getOperationKeyword(operationType: GraphQlOperationType): string {\n switch (operationType) {\n case \"QUERY\":\n return \"query\";\n case \"MUTATION\":\n return \"mutation\";\n case \"SUBSCRIPTION\":\n return \"subscription\";\n default:\n return \"query\";\n }\n}\n\n/**\n * Get the example operation name based on operation type\n */\nfunction getExampleOperationName(operationType: GraphQlOperationType): string {\n switch (operationType) {\n case \"QUERY\":\n return \"ExampleQuery\";\n case \"MUTATION\":\n return \"ExampleMutation\";\n case \"SUBSCRIPTION\":\n return \"ExampleSubscription\";\n default:\n return \"ExampleQuery\";\n }\n}\n\n/**\n * Convert a TypeShape to a GraphQL type string.\n * @param nonNull - when true (default), appends `!` for non-null types.\n * The optional/nullable branches pass false to suppress the suffix.\n */\nfunction typeShapeToGraphQlType(shape: TypeShape, types: Record<TypeId, TypeDefinition>, nonNull = true): string {\n if (shape.type === \"alias\") {\n return typeReferenceToGraphQlType(shape.value, types, nonNull);\n }\n const base =\n shape.type === \"enum\"\n ? \"String\"\n : shape.type === \"object\" || shape.type === \"undiscriminatedUnion\" || shape.type === \"discriminatedUnion\"\n ? \"Object\"\n : \"String\";\n return nonNull ? `${base}!` : base;\n}\n\n/**\n * Convert a TypeReference to a GraphQL type string.\n * @param nonNull - when true (default), appends `!` for non-null types.\n */\nfunction typeReferenceToGraphQlType(ref: TypeReference, types: Record<TypeId, TypeDefinition>, nonNull = true): string {\n switch (ref.type) {\n case \"primitive\": {\n const base = primitiveToGraphQlType(ref.value);\n return nonNull ? `${base}!` : base;\n }\n case \"id\": {\n const typeDef = types[ref.id];\n const base = typeDef ? (typeDef.displayName ?? unnamespacedName(typeDef.name) ?? \"Object\") : \"Object\";\n return nonNull ? `${base}!` : base;\n }\n case \"optional\":\n return typeShapeToGraphQlType(ref.shape, types, false);\n case \"nullable\":\n return typeShapeToGraphQlType(ref.shape, types, false);\n case \"list\": {\n const inner = typeShapeToGraphQlType(ref.itemShape, types);\n return nonNull ? `[${inner}]!` : `[${inner}]`;\n }\n case \"set\": {\n const inner = typeShapeToGraphQlType(ref.itemShape, types);\n return nonNull ? `[${inner}]!` : `[${inner}]`;\n }\n case \"map\":\n return nonNull ? \"Object!\" : \"Object\";\n case \"literal\":\n return nonNull ? \"String!\" : \"String\";\n case \"unknown\":\n return nonNull ? \"Object!\" : \"Object\";\n default:\n return nonNull ? \"String!\" : \"String\";\n }\n}\n\n/**\n * Extract the un-namespaced type name from a Fern type name.\n * e.g., \"orders_UserInput\" -> \"UserInput\"\n */\nfunction unnamespacedName(name: string): string {\n const lastUnderscoreIndex = name.lastIndexOf(\"_\");\n return lastUnderscoreIndex !== -1 ? name.slice(lastUnderscoreIndex + 1) : name;\n}\n\n/**\n * Convert a primitive type to GraphQL type\n */\nfunction primitiveToGraphQlType(primitive: PrimitiveType): string {\n switch (primitive.type) {\n case \"scalar\":\n return primitive.name;\n case \"integer\":\n case \"long\":\n case \"uint\":\n case \"uint64\":\n case \"bigInteger\":\n return \"Int\";\n case \"double\":\n return \"Float\";\n case \"boolean\":\n return \"Boolean\";\n case \"string\":\n case \"uuid\":\n case \"base64\":\n case \"datetime\":\n case \"date\":\n default:\n return \"String\";\n }\n}\n\n/**\n * Collect all properties for an object type, including inherited properties from `extends`.\n */\nfunction collectObjectProperties(\n shape: { extends: TypeId[]; properties: ObjectProperty[] },\n types: Record<TypeId, TypeDefinition>\n): ObjectProperty[] {\n const properties: ObjectProperty[] = [];\n for (const parentId of shape.extends) {\n const parentDef = types[parentId];\n if (parentDef?.shape?.type === \"object\") {\n properties.push(...collectObjectProperties(parentDef.shape, types));\n }\n }\n properties.push(...shape.properties);\n return properties;\n}\n\n/**\n * Generate an example value for a type\n */\nfunction generateExampleValue(\n shape: TypeShape,\n types: Record<TypeId, TypeDefinition>,\n depth: number,\n visited: Set<TypeId>,\n defaultValue?: unknown\n): unknown {\n if (defaultValue !== undefined) {\n return defaultValue;\n }\n\n if (depth <= 0) {\n return null;\n }\n\n if (shape.type === \"alias\") {\n return generateExampleValueFromReference(shape.value, types, depth, visited);\n }\n if (shape.type === \"enum\") {\n // Return the first enum value if available\n const firstValue = shape.values?.[0];\n return firstValue?.value ?? \"EXAMPLE_VALUE\";\n }\n if (shape.type === \"object\") {\n const properties = collectObjectProperties(shape, types);\n if (properties.length === 0) {\n return {};\n }\n const result: Record<string, unknown> = {};\n for (const prop of properties.slice(0, 10)) {\n result[prop.key] = generateExampleValue(prop.valueShape, types, depth - 1, visited);\n }\n return result;\n }\n if (shape.type === \"undiscriminatedUnion\") {\n const firstVariant = shape.variants?.[0];\n if (firstVariant?.shape) {\n return generateExampleValue(firstVariant.shape, types, depth, visited);\n }\n return {};\n }\n if (shape.type === \"discriminatedUnion\") {\n const firstVariant = shape.variants?.[0];\n if (firstVariant) {\n const result: Record<string, unknown> = {\n [shape.discriminant]: firstVariant.discriminantValue\n };\n const properties = collectObjectProperties(firstVariant, types);\n for (const prop of properties.slice(0, 10)) {\n result[prop.key] = generateExampleValue(prop.valueShape, types, depth - 1, visited);\n }\n return result;\n }\n return {};\n }\n\n return \"example\";\n}\n\n/**\n * Generate an example value from a type reference\n */\nfunction generateExampleValueFromReference(\n ref: TypeReference,\n types: Record<TypeId, TypeDefinition>,\n depth: number,\n visited: Set<TypeId>\n): unknown {\n switch (ref.type) {\n case \"primitive\":\n return generateExamplePrimitiveValue(ref.value);\n case \"id\": {\n if (visited.has(ref.id)) {\n return null;\n }\n const typeDef = types[ref.id];\n if (typeDef?.shape) {\n visited.add(ref.id);\n const result = generateExampleValue(typeDef.shape, types, depth, visited);\n visited.delete(ref.id);\n return result;\n }\n return {};\n }\n case \"optional\":\n case \"nullable\":\n return generateExampleValue(ref.shape, types, depth, visited);\n case \"list\":\n case \"set\":\n return [generateExampleValue(ref.itemShape, types, depth, visited)];\n case \"map\":\n return {};\n case \"literal\":\n return ref.value.value;\n case \"unknown\":\n return {};\n default:\n return \"example\";\n }\n}\n\n/**\n * Generate example primitive values\n */\nfunction generateExamplePrimitiveValue(primitive: PrimitiveType): unknown {\n switch (primitive.type) {\n case \"integer\":\n case \"long\":\n case \"uint\":\n case \"uint64\":\n case \"bigInteger\":\n return 0;\n case \"double\":\n return 0.0;\n case \"boolean\":\n return true;\n case \"string\":\n return \"example\";\n case \"uuid\":\n return \"00000000-0000-0000-0000-000000000000\";\n case \"datetime\":\n return new Date().toISOString();\n case \"date\":\n return new Date().toISOString().split(\"T\")[0];\n case \"base64\":\n return \"ZXhhbXBsZQ==\";\n case \"scalar\":\n return primitive.default ?? primitive.name;\n default:\n return \"example\";\n }\n}\n\nconst DEFAULT_MAX_DEPTH = 2;\n\n/**\n * Check if the operation's return type is a namespace type (all fields have arguments).\n * Only checked at the top level to give namespace types one extra depth level.\n */\nfunction isReturnTypeNamespace(returnType: TypeShape, types: Record<TypeId, TypeDefinition>): boolean {\n // unwrapReference resolves aliases, optionals, nullables, and type refs\n // (cycle-safe + cached) down to the underlying shape.\n const { shape } = unwrapReference(returnType, types);\n if (shape.type !== \"object\") {\n return false;\n }\n const properties = shape.properties ?? [];\n if (properties.length === 0) {\n return false;\n }\n return properties.every((prop) => prop.arguments != null && prop.arguments.length > 0);\n}\n\n/**\n * Generate a selection set for the return type.\n * Bounded by depth plus the `visited` set (circular refs)\n * and the 10-field-per-level cap.\n */\nfunction generateSelectionSet(\n shape: TypeShape,\n types: Record<TypeId, TypeDefinition>,\n depth: number,\n visited: Set<TypeId> = new Set(),\n indentLevel: number = 2\n): string {\n if (depth <= 0) {\n return \"\";\n }\n\n if (shape.type === \"alias\") {\n return generateSelectionSetFromReference(shape.value, types, depth, visited, indentLevel);\n }\n\n if (shape.type === \"object\") {\n const properties = shape.properties ?? [];\n if (properties.length === 0) {\n return \"\";\n }\n\n const indent = \" \".repeat(indentLevel);\n const closingIndent = \" \".repeat(indentLevel - 1);\n\n const fields = properties\n .slice(0, 10) // Limit to first 10 fields\n .map((prop) => {\n const nestedSelection = generateSelectionSet(\n prop.valueShape,\n types,\n depth - 1,\n visited,\n indentLevel + 1\n );\n\n if (nestedSelection) {\n return `${indent}${prop.key} ${nestedSelection}`;\n }\n return `${indent}${prop.key}`;\n });\n\n return `{\\n${fields.join(\"\\n\")}\\n${closingIndent}}`;\n }\n\n if (shape.type === \"enum\") {\n return \"\"; // Enums don't have selection sets\n }\n\n if (shape.type === \"undiscriminatedUnion\" || shape.type === \"discriminatedUnion\") {\n // For unions, just return the field name without nested selection\n return \"\";\n }\n\n return \"\";\n}\n\n/**\n * Generate selection set from a type reference\n */\nfunction generateSelectionSetFromReference(\n ref: TypeReference,\n types: Record<TypeId, TypeDefinition>,\n depth: number,\n visited: Set<TypeId>,\n indentLevel: number\n): string {\n switch (ref.type) {\n case \"id\": {\n if (visited.has(ref.id)) {\n return \"\"; // Prevent infinite recursion\n }\n const typeDef = types[ref.id];\n if (typeDef?.shape) {\n visited.add(ref.id);\n const result = generateSelectionSet(typeDef.shape, types, depth, visited, indentLevel);\n visited.delete(ref.id);\n return result;\n }\n return \"\";\n }\n case \"optional\":\n case \"nullable\":\n return generateSelectionSet(ref.shape, types, depth, visited, indentLevel);\n case \"list\":\n case \"set\":\n return generateSelectionSet(ref.itemShape, types, depth, visited, indentLevel);\n case \"primitive\":\n case \"literal\":\n case \"unknown\":\n case \"map\":\n default:\n return \"\";\n }\n}\n\n/**\n * Generate a GraphQL response example\n */\nfunction generateResponseExample(\n operationName: string,\n returnType: TypeShape,\n types: Record<TypeId, TypeDefinition>,\n fieldPath?: string[] | null\n): unknown {\n const data = generateResponseData(returnType, types, 3, new Set());\n\n // Build the nested response structure following the fieldPath\n let responseData: Record<string, unknown> = { [operationName]: data };\n if (fieldPath != null && fieldPath.length > 0) {\n for (let i = fieldPath.length - 1; i >= 0; i--) {\n const key = fieldPath[i];\n if (key != null) {\n responseData = { [key]: responseData };\n }\n }\n }\n\n return { data: responseData };\n}\n\n/**\n * Generate response data from a type shape\n */\nfunction generateResponseData(\n shape: TypeShape,\n types: Record<TypeId, TypeDefinition>,\n depth: number,\n visited: Set<TypeId>\n): unknown {\n if (depth <= 0) {\n return null;\n }\n\n if (shape.type === \"alias\") {\n return generateResponseDataFromReference(shape.value, types, depth, visited);\n }\n\n if (shape.type === \"object\") {\n const properties = shape.properties ?? [];\n if (properties.length === 0) {\n return {};\n }\n\n const result: Record<string, unknown> = {};\n for (const prop of properties.slice(0, 10)) {\n result[prop.key] = generateResponseData(prop.valueShape, types, depth - 1, visited);\n }\n return result;\n }\n\n if (shape.type === \"enum\") {\n const firstValue = shape.values?.[0];\n return firstValue?.value ?? \"EXAMPLE_VALUE\";\n }\n\n if (shape.type === \"undiscriminatedUnion\") {\n // Return example for the first variant\n const firstVariant = shape.variants?.[0];\n if (firstVariant?.shape) {\n return generateResponseData(firstVariant.shape, types, depth, visited);\n }\n return {};\n }\n\n if (shape.type === \"discriminatedUnion\") {\n // Return example for the first variant\n const firstVariant = shape.variants?.[0];\n if (firstVariant) {\n const result: Record<string, unknown> = {\n [shape.discriminant]: firstVariant.discriminantValue\n };\n if (firstVariant.properties) {\n for (const prop of firstVariant.properties.slice(0, 10)) {\n result[prop.key] = generateResponseData(prop.valueShape, types, depth - 1, visited);\n }\n }\n return result;\n }\n return {};\n }\n\n return null;\n}\n\n/**\n * Generate response data from a type reference\n */\nfunction generateResponseDataFromReference(\n ref: TypeReference,\n types: Record<TypeId, TypeDefinition>,\n depth: number,\n visited: Set<TypeId>\n): unknown {\n switch (ref.type) {\n case \"primitive\":\n return generateExamplePrimitiveValue(ref.value);\n case \"id\": {\n if (visited.has(ref.id)) {\n return null; // Prevent infinite recursion\n }\n const typeDef = types[ref.id];\n if (typeDef?.shape) {\n visited.add(ref.id);\n const result = generateResponseData(typeDef.shape, types, depth, visited);\n visited.delete(ref.id);\n return result;\n }\n return {};\n }\n case \"optional\":\n case \"nullable\":\n return generateResponseData(ref.shape, types, depth, visited);\n case \"list\":\n case \"set\":\n return [generateResponseData(ref.itemShape, types, depth, visited)];\n case \"map\":\n return {};\n case \"literal\":\n return ref.value.value;\n case \"unknown\":\n return {};\n default:\n return null;\n }\n}\n","import { type HarRequest, HTTPSnippet, type TargetId } from \"httpsnippet-lite\";\n\nimport { HTTP_SNIPPET_CLIENTS } from \"./constants\";\n\nconst IMPORT_PREFIXES: Partial<Record<TargetId, string>> = {\n csharp: \"using RestSharp;\\n\\n\",\n java: \"import com.mashape.unirest.http.HttpResponse;\\nimport com.mashape.unirest.http.Unirest;\\n\\n\"\n};\n\nconst PHP_AUTOLOAD_INSERT = \"\\nrequire_once('vendor/autoload.php');\\n\";\n\nexport interface BasicAuthInfo {\n username: string;\n password: string;\n passwordAlwaysEmpty?: boolean;\n}\n\nexport class HttpSnippetConverter {\n private readonly snippet: HTTPSnippet;\n private readonly basicAuth: BasicAuthInfo | undefined;\n\n constructor(harRequest: HarRequest, basicAuth?: BasicAuthInfo) {\n this.snippet = new HTTPSnippet(harRequest);\n this.basicAuth = basicAuth;\n }\n\n async convert(targetId: TargetId, clientId: string): Promise<string | undefined> {\n const convertedCode = await this.snippet.convert(targetId, clientId);\n const raw =\n typeof convertedCode === \"string\" ? convertedCode : convertedCode != null ? convertedCode[0] : undefined;\n\n if (raw == null) {\n return undefined;\n }\n\n let code = this.addImports(raw, targetId);\n if (this.basicAuth != null) {\n code = applyBasicAuth(code, targetId, this.basicAuth);\n }\n return code;\n }\n\n async convertAll(): Promise<{ targetId: TargetId; code: string }[]> {\n const results: { targetId: TargetId; code: string }[] = [];\n\n for (const { targetId, clientId } of HTTP_SNIPPET_CLIENTS) {\n const code = await this.convert(targetId, clientId);\n if (code != null) {\n results.push({ targetId, code });\n }\n }\n\n return results;\n }\n\n private addImports(code: string, targetId: TargetId): string {\n if (targetId === \"php\") {\n return code.replace(/^<\\?php\\n/, `<?php${PHP_AUTOLOAD_INSERT}`);\n }\n\n const prefix = IMPORT_PREFIXES[targetId];\n if (prefix != null) {\n return `${prefix}${code}`;\n }\n\n return code;\n }\n}\n\n/**\n * Replace the literal \"Basic <username>:<password>\" header value with\n * native auth support or idiomatic base64 encoding for each target language.\n *\n * Languages with native HTTP basic auth support (Python, Ruby, Java, PHP, C#, Go)\n * use their own internal pattern matching to find and replace the Authorization header,\n * so they don't require the exact quoted literal pattern to match.\n *\n * Languages without native support (JavaScript, Swift) use a regex-based replacement\n * on the exact literal value, so they require the quoted pattern to match.\n */\nfunction applyBasicAuth(code: string, targetId: TargetId, auth: BasicAuthInfo): string {\n const literalValue = `Basic ${auth.username}:${auth.password}`;\n\n // Build a regex that matches the literal value in single or double quotes\n const escapedLiteral = literalValue.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const quotedPattern = new RegExp(`([\"'])${escapedLiteral}\\\\1`);\n\n // Languages with native auth support use their own patterns to find the\n // Authorization header, so they don't need the exact literal to match.\n // This is important for passwordAlwaysEmpty where the literal is \"Basic <key>:\"\n // which may not match the quoted pattern exactly.\n switch (targetId) {\n case \"python\":\n return applyPythonBasicAuth(code, quotedPattern, auth);\n case \"go\":\n return applyGoBasicAuth(code, auth);\n case \"ruby\":\n return applyRubyBasicAuth(code, quotedPattern, auth);\n case \"java\":\n return applyJavaBasicAuth(code, quotedPattern, auth);\n case \"php\":\n return applyPhpBasicAuth(code, quotedPattern, auth);\n case \"csharp\":\n return applyCSharpBasicAuth(code, quotedPattern, auth);\n default:\n break;\n }\n\n // For languages without native auth (JS, Swift), we need the exact literal to match\n if (!quotedPattern.test(code)) {\n return code;\n }\n\n switch (targetId) {\n case \"javascript\":\n return applyJavaScriptBasicAuth(code, quotedPattern, auth);\n case \"swift\":\n return applySwiftBasicAuth(code, quotedPattern, auth);\n default:\n return code;\n }\n}\n\nfunction applyPythonBasicAuth(code: string, _pattern: RegExp, auth: BasicAuthInfo): string {\n // Python requests has native auth= parameter support\n // Remove the Authorization header from the headers dict and add auth= to requests call\n\n // Match Authorization header in dict - could be on same line or separate line\n const authHeaderInDictPattern = /,?\\s*\"Authorization\":\\s*\"[^\"]*\",?/;\n const hasAuthHeader = authHeaderInDictPattern.test(code);\n\n if (hasAuthHeader) {\n // Remove the Authorization header entry from the headers dict\n code = code.replace(authHeaderInDictPattern, \"\");\n\n // Clean up empty headers dict: `headers = {}` with surrounding whitespace\n const emptyHeadersPattern = /\\nheaders = \\{\\s*\\}\\n\\n/;\n const headersAreEmpty = emptyHeadersPattern.test(code);\n\n if (headersAreEmpty) {\n // Remove the empty headers dict\n code = code.replace(emptyHeadersPattern, \"\\n\");\n // Remove headers= parameter from the requests call\n code = code.replace(/,?\\s*headers=headers/, \"\");\n }\n\n // Add auth= parameter to the requests call\n const authTuple = auth.passwordAlwaysEmpty\n ? `auth=(\"${auth.username}\", \"\")`\n : `auth=(\"${auth.username}\", \"${auth.password}\")`;\n code = code.replace(/(response = requests\\.\\w+\\([^)]+)\\)/, `$1, ${authTuple})`);\n\n return code;\n }\n\n // Fallback: if we can't find the header pattern, use base64 encoding\n const importLine = \"import base64\\n\";\n const credentialsVar = `credentials = base64.b64encode(f\"${auth.username}:${auth.password}\".encode()).decode()\\n`;\n code = code.replace(/^(import requests\\n)/, `$1${importLine}`);\n code = code.replace(/^(headers = \\{)/m, `${credentialsVar}\\n$1`);\n code = code.replace(_pattern, `f\"Basic {credentials}\"`);\n return code;\n}\n\nfunction applyJavaScriptBasicAuth(code: string, pattern: RegExp, auth: BasicAuthInfo): string {\n const credentialsLine = `const credentials = btoa(\"${auth.username}:${auth.password}\");\\n`;\n\n // Add credentials variable before the options\n code = code.replace(/^(const options)/m, `${credentialsLine}\\n$1`);\n\n // Replace the literal with template literal\n code = code.replace(pattern, \"`Basic ${credentials}`\");\n\n return code;\n}\n\nfunction applyGoBasicAuth(code: string, auth: BasicAuthInfo): string {\n // Go has a built-in SetBasicAuth method on http.Request\n // Replace Header.Add(\"Authorization\", \"Basic ...\") with req.SetBasicAuth(username, password)\n const headerPattern = new RegExp(\n `req\\\\.Header\\\\.Add\\\\(\"Authorization\",\\\\s*\"Basic ${auth.username.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")}:${auth.password.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")}\"\\\\)`\n );\n code = code.replace(headerPattern, `req.SetBasicAuth(\"${auth.username}\", \"${auth.password}\")`);\n\n return code;\n}\n\nfunction applyRubyBasicAuth(code: string, pattern: RegExp, auth: BasicAuthInfo): string {\n // Ruby's Net::HTTP has native basic_auth support\n const authHeaderPattern = /request\\[\"Authorization\"\\]\\s*=\\s*[^\\n]+\\n/;\n const hasAuthHeader = authHeaderPattern.test(code);\n\n if (hasAuthHeader) {\n const password = auth.passwordAlwaysEmpty ? \"\" : auth.password;\n code = code.replace(authHeaderPattern, `request.basic_auth(\"${auth.username}\", \"${password}\")\\n`);\n return code;\n }\n\n // Fallback: use Base64 encoding\n const requireLine = \"require 'base64'\\n\";\n code = code.replace(/^(require 'uri'\\n)/, `$1${requireLine}`);\n code = code.replace(pattern, `\"Basic #{Base64.strict_encode64(\"${auth.username}:${auth.password}\")}\"`);\n return code;\n}\n\nfunction applyJavaBasicAuth(code: string, pattern: RegExp, auth: BasicAuthInfo): string {\n // Java Unirest has native .basicAuth() support\n const headerPattern = /\\.header\\(\"Authorization\",\\s*\"Basic [^\"]*\"\\)/;\n const hasAuthHeader = headerPattern.test(code);\n\n if (hasAuthHeader) {\n const password = auth.passwordAlwaysEmpty ? \"\" : auth.password;\n code = code.replace(headerPattern, `.basicAuth(\"${auth.username}\", \"${password}\")`);\n return code;\n }\n\n // Fallback: use Base64 encoding\n const importLine = \"import java.util.Base64;\\n\";\n code = code.replace(/^(import com\\.mashape)/m, `${importLine}$1`);\n code = code.replace(\n pattern,\n `\"Basic \" + Base64.getEncoder().encodeToString(\"${auth.username}:${auth.password}\".getBytes())`\n );\n return code;\n}\n\nfunction applyPhpBasicAuth(code: string, pattern: RegExp, auth: BasicAuthInfo): string {\n // PHP Guzzle has native 'auth' option support\n const headerPattern = /'Authorization'\\s*=>\\s*'Basic [^']*'/;\n const hasAuthHeader = headerPattern.test(code);\n\n if (hasAuthHeader) {\n // Remove the Authorization header\n code = code.replace(/\\s*'Authorization'\\s*=>\\s*'Basic [^']*',?/, \"\");\n\n // Add auth option to the Guzzle request options\n const password = auth.passwordAlwaysEmpty ? \"\" : auth.password;\n const authOption = `'auth' => ['${auth.username}', '${password}']`;\n\n // Insert auth option into the request options array\n // Look for the 'headers' key in the options array and add auth after it\n if (code.includes(\"'headers'\")) {\n code = code.replace(/('headers'\\s*=>\\s*\\[[^\\]]*\\]),?/, `$1,\\n ${authOption},`);\n } else {\n // Add before the closing bracket of options\n code = code.replace(/(\\$client->request\\([^,]+,\\s*[^,]+,\\s*\\[)/, `$1\\n ${authOption},`);\n }\n\n return code;\n }\n\n // Fallback: use base64_encode\n code = code.replace(pattern, `'Basic ' . base64_encode('${auth.username}:${auth.password}')`);\n return code;\n}\n\nfunction applyCSharpBasicAuth(code: string, pattern: RegExp, auth: BasicAuthInfo): string {\n // C# RestSharp has native Authenticator support\n const headerPattern = /request\\.AddHeader\\(\"Authorization\",\\s*\"Basic [^\"]*\"\\);/;\n const hasAuthHeader = headerPattern.test(code);\n\n if (hasAuthHeader) {\n const password = auth.passwordAlwaysEmpty ? \"\" : auth.password;\n // Remove the Authorization header line\n code = code.replace(headerPattern, \"\");\n // Add using for RestSharp.Authenticators\n code = code.replace(/^(using RestSharp;\\n)/, `$1using RestSharp.Authenticators;\\n`);\n // Add authenticator after client creation\n code = code.replace(\n /(var client = new RestClient\\([^)]*\\);)/,\n `$1\\nclient.Authenticator = new HttpBasicAuthenticator(\"${auth.username}\", \"${password}\");`\n );\n return code;\n }\n\n // Fallback: use Convert.ToBase64String\n const usingLine = \"using System;\\nusing System.Text;\\n\";\n code = code.replace(/^(using RestSharp;\\n)/, `$1${usingLine}`);\n code = code.replace(\n pattern,\n `\"Basic \" + Convert.ToBase64String(Encoding.UTF8.GetBytes(\"${auth.username}:${auth.password}\"))`\n );\n return code;\n}\n\nfunction applySwiftBasicAuth(code: string, pattern: RegExp, auth: BasicAuthInfo): string {\n // Add credentials variable after import Foundation\n const credentialsCode = `\\nlet credentials = Data(\"${auth.username}:${auth.password}\".utf8).base64EncodedString()\\n`;\n code = code.replace(/^(import Foundation\\n)/, `$1${credentialsCode}`);\n\n // Replace the literal with string interpolation\n code = code.replace(pattern, `\"Basic \\\\(credentials)\"`);\n\n return code;\n}\n","import type { ApiDefinition, CodeSnippet, EndpointDefinition, ExampleEndpointCall } from \"../latest\";\nimport {\n getAuthHeaderName,\n getFirstAuthScheme,\n shouldRegenerateCurlSnippet,\n shouldRegenerateHttpSnippet\n} from \"./auth-scheme\";\nimport { HTTP_SNIPPET_CLIENTS } from \"./constants\";\nimport { convertToCurl } from \"./curl\";\nimport { getHarRequest, getHarRequestBasicAuth } from \"./get-har-request\";\nimport { type BasicAuthInfo, HttpSnippetConverter } from \"./HttpSnippetConverter\";\nimport { toSnippetHttpRequest } from \"./SnippetHttpRequest\";\nimport type { HttpSnippetLanguage, SnippetGenerationFlags, SnippetGenerators } from \"./types\";\n\n/**\n * Options for HTTP snippet generation\n */\nexport interface HttpSnippetOptions {\n /** HTTP snippet generation flags */\n flags: SnippetGenerationFlags;\n /** Dynamic generators to check for available SDK snippets (optional) */\n dynamicGenerators?: SnippetGenerators;\n /** Existing snippets that should not be regenerated */\n existingSnippets?: Record<string, CodeSnippet[]>;\n}\n\n/**\n * Generate a curl snippet for an endpoint example\n */\nexport function generateCurlSnippet(\n apiDefinition: ApiDefinition,\n endpoint: EndpointDefinition,\n example: ExampleEndpointCall\n): CodeSnippet {\n const authScheme = getFirstAuthScheme(endpoint, apiDefinition.auths);\n const curlCode = convertToCurl(toSnippetHttpRequest(endpoint, example, authScheme));\n\n return {\n name: undefined,\n language: \"curl\",\n install: undefined,\n code: curlCode,\n generated: true,\n description: undefined\n };\n}\n\n/**\n * Generate HTTP snippets for an endpoint example using httpsnippet-lite\n */\nexport async function generateHttpSnippets(\n apiDefinition: ApiDefinition,\n endpoint: EndpointDefinition,\n example: ExampleEndpointCall,\n options: HttpSnippetOptions\n): Promise<CodeSnippet[]> {\n const { flags, dynamicGenerators = {}, existingSnippets = {} } = options;\n const snippets: CodeSnippet[] = [];\n\n const isHttpSnippetsEnabled = flags.httpSnippets !== false;\n const httpSnippetLanguages = Array.isArray(flags.httpSnippets) ? flags.httpSnippets : null;\n\n // Check if a language should be included based on the httpSnippets configuration\n const shouldIncludeLanguage = (language: string): boolean => {\n if (!isHttpSnippetsEnabled) {\n return language === \"curl\";\n }\n return httpSnippetLanguages == null || httpSnippetLanguages.includes(language as HttpSnippetLanguage);\n };\n\n // Generate or regenerate curl snippet if needed\n // Regenerate if existing snippet has wrong auth header (targeted repair for pre-stored snippets)\n // Also regenerate if basic auth uses -H \"Authorization: Basic\" instead of -u flag\n const authScheme = getFirstAuthScheme(endpoint, apiDefinition.auths);\n const expectedHeaderName = getAuthHeaderName(authScheme);\n const needsCurlRegeneration = shouldRegenerateCurlSnippet(\n existingSnippets.curl,\n expectedHeaderName,\n authScheme,\n endpoint,\n example\n );\n\n if (needsCurlRegeneration && shouldIncludeLanguage(\"curl\")) {\n snippets.push(generateCurlSnippet(apiDefinition, endpoint, example));\n }\n\n // Generate HTTP snippets for other languages\n if (isHttpSnippetsEnabled) {\n const harRequest = getHarRequest(endpoint, example, apiDefinition.auths, example.requestBody ?? undefined);\n const basicAuth: BasicAuthInfo | undefined = getHarRequestBasicAuth(endpoint, apiDefinition.auths);\n const converter = new HttpSnippetConverter(harRequest, basicAuth);\n\n for (const { clientId, targetId } of HTTP_SNIPPET_CLIENTS) {\n // Skip if snippet already exists and is user-provided; always regenerate auto-generated snippets\n if (existingSnippets[targetId]?.length && !shouldRegenerateHttpSnippet(existingSnippets[targetId])) {\n continue;\n }\n\n // Skip if dynamic SDK snippets are available for this language\n if (dynamicGenerators[targetId === \"javascript\" ? \"typescript\" : targetId]) {\n continue;\n }\n\n // Skip JavaScript if TypeScript snippets exist and alwaysEnableJavaScriptFetch is disabled\n if (\n targetId === \"javascript\" &&\n existingSnippets.typescript?.length &&\n !flags.alwaysEnableJavaScriptFetch\n ) {\n continue;\n }\n\n // Check if this language should be included\n if (!shouldIncludeLanguage(targetId)) {\n continue;\n }\n\n const code = await converter.convert(targetId, clientId);\n\n if (code != null) {\n snippets.push({\n name: undefined,\n language: targetId,\n install: undefined,\n code,\n generated: true,\n description: undefined\n });\n }\n }\n }\n\n return snippets;\n}\n\n/**\n * Check if a language should be included for HTTP snippet generation based on flags\n */\nexport function shouldIncludeHttpSnippetLanguage(\n language: string,\n flags: Pick<SnippetGenerationFlags, \"httpSnippets\">\n): boolean {\n const isHttpSnippetsEnabled = flags.httpSnippets !== false;\n const httpSnippetLanguages = Array.isArray(flags.httpSnippets) ? flags.httpSnippets : null;\n\n if (!isHttpSnippetsEnabled) {\n return language === \"curl\";\n }\n return httpSnippetLanguages == null || httpSnippetLanguages.includes(language as HttpSnippetLanguage);\n}\n","import type { ApiDefinition, AuthScheme, CodeSnippet, EndpointDefinition, ExampleEndpointCall } from \"../latest\";\nimport { getFirstAuthScheme } from \"./auth-scheme\";\nimport type { SnippetGenerators } from \"./types\";\n\n/**\n * Auth values accepted by the @fern-api/snippets generators. The discriminant must match the auth\n * type the SDK was generated with, otherwise the generators drop every constructor argument.\n */\ntype SnippetAuthValues =\n | { type: \"bearer\"; token: string }\n | { type: \"basic\"; username: string; password?: string }\n | { type: \"header\"; value: string }\n | { type: \"oauth\"; clientId: string; clientSecret: string };\n\n/**\n * Build the auth object for SDK snippet generators based on the auth scheme.\n * Returns a properly formatted auth object compatible with @fern-api/snippets generators.\n */\nfunction buildSnippetAuth(authScheme: AuthScheme | undefined): SnippetAuthValues | undefined {\n if (!authScheme) {\n return undefined;\n }\n\n switch (authScheme.type) {\n case \"bearerAuth\":\n return {\n type: \"bearer\",\n token: \"YOUR_TOKEN_HERE\"\n };\n case \"basicAuth\": {\n const userLabel = (authScheme.usernameName ?? \"username\").toUpperCase().replace(/\\s+/g, \"_\");\n const passLabel = (authScheme.passwordName ?? \"password\").toUpperCase().replace(/\\s+/g, \"_\");\n return {\n type: \"basic\",\n username: `YOUR_${userLabel}_HERE`,\n ...(authScheme.passwordAlwaysEmpty ? {} : { password: `YOUR_${passLabel}_HERE` })\n };\n }\n case \"header\":\n return {\n type: \"header\",\n value: \"YOUR_API_KEY_HERE\"\n };\n case \"oAuth\":\n return buildOAuthSnippetAuth();\n default:\n return undefined;\n }\n}\n\nfunction buildOAuthSnippetAuth(): SnippetAuthValues {\n return {\n type: \"oauth\",\n clientId: \"YOUR_CLIENT_ID\",\n clientSecret: \"YOUR_CLIENT_SECRET\"\n };\n}\n\n/**\n * The auth values in a snippet request must have the same type as the auth the SDK was generated\n * with, otherwise the generators drop every client constructor argument. The API definition's auth\n * scheme and the SDK's auth can disagree (e.g. an OAuth SDK whose documented scheme is a bearer\n * token), so realign the values to whatever the SDK expects.\n */\nfunction alignAuthWithSdk(\n auth: SnippetAuthValues | undefined,\n sdkAuthType: string | undefined\n): SnippetAuthValues | undefined {\n if (sdkAuthType == null || auth?.type === sdkAuthType) {\n return auth;\n }\n switch (sdkAuthType) {\n case \"bearer\":\n return {\n type: \"bearer\",\n token: \"YOUR_TOKEN_HERE\"\n };\n case \"basic\":\n return {\n type: \"basic\",\n username: \"YOUR_USERNAME_HERE\",\n password: \"YOUR_PASSWORD_HERE\"\n };\n case \"header\":\n return {\n type: \"header\",\n value: \"YOUR_API_KEY_HERE\"\n };\n case \"oauth\":\n return buildOAuthSnippetAuth();\n default:\n // Inferred auth is parameterized by the token endpoint, so there is nothing to realign to.\n return auth;\n }\n}\n\n/**\n * Build the SDK snippet request from an endpoint example.\n * Returns a request object compatible with @fern-api/snippets generators.\n */\nexport function buildSdkSnippetRequest(\n apiDefinition: ApiDefinition,\n endpoint: EndpointDefinition,\n example: ExampleEndpointCall\n): any {\n // Build auth configuration using multiAuth-aware selection\n const authDefinition = getFirstAuthScheme(endpoint, apiDefinition.auths);\n const auth = buildSnippetAuth(authDefinition);\n\n // Process request body (filter out empty objects)\n let bodyValue: unknown = undefined;\n if (example.requestBody != null && example.requestBody.type === \"json\" && example.requestBody.value) {\n if (typeof example.requestBody.value === \"object\" && !Array.isArray(example.requestBody.value)) {\n const filteredValue = Object.fromEntries(\n Object.entries(example.requestBody.value).filter(([_, valueObj]) => {\n // Keep arrays and primitive values\n if (Array.isArray(valueObj) || typeof valueObj !== \"object\" || valueObj == null) {\n return true;\n }\n // For objects, only filter out empty objects without a value property\n return Object.keys(valueObj).length > 0;\n })\n );\n bodyValue = filteredValue;\n } else {\n bodyValue = example.requestBody.value;\n }\n }\n\n return {\n baseURL: undefined,\n environment: undefined,\n auth,\n pathParameters: example.pathParameters,\n queryParameters: example.queryParameters,\n headers: example.headers,\n requestBody: bodyValue,\n method: endpoint.method\n };\n}\n\nfunction logCriticalErrors(language: string, result: { errors?: { severity?: string; message?: string }[] }): void {\n for (const error of result?.errors ?? []) {\n if (error.severity === \"CRITICAL\") {\n console.error(`[sdk-snippets] error generating ${language} snippet:`, error.message);\n }\n }\n}\n\n/**\n * Generate SDK snippets for an endpoint example using the provided generators\n */\nexport function generateSdkSnippets(\n apiDefinition: ApiDefinition,\n endpoint: EndpointDefinition,\n example: ExampleEndpointCall,\n generators: SnippetGenerators\n): CodeSnippet[] {\n if (endpoint.method === \"HEAD\") {\n return [];\n }\n\n const snippets: CodeSnippet[] = [];\n const request = buildSdkSnippetRequest(apiDefinition, endpoint, example);\n\n for (const [language, generator] of Object.entries(generators)) {\n if (!generator) {\n continue;\n }\n\n try {\n const auth = alignAuthWithSdk(request.auth, generator.getAuthType?.());\n const result = generator.generateSync({ ...request, auth });\n logCriticalErrors(language, result);\n\n if (result?.snippet) {\n snippets.push({\n name: undefined,\n language,\n install: undefined,\n code: result.snippet,\n generated: true,\n description: undefined\n });\n }\n } catch (error) {\n console.error(`[sdk-snippets] error generating ${language} snippet:`, error);\n }\n }\n\n return snippets;\n}\n\n/**\n * Generate a single SDK snippet for a specific language\n */\nexport function generateSdkSnippetForLanguage(\n apiDefinition: ApiDefinition,\n endpoint: EndpointDefinition,\n example: ExampleEndpointCall,\n generators: SnippetGenerators,\n language: string\n): CodeSnippet | undefined {\n if (endpoint.method === \"HEAD\") {\n return undefined;\n }\n\n const generator = generators[language];\n if (!generator) {\n return undefined;\n }\n\n const request = buildSdkSnippetRequest(apiDefinition, endpoint, example);\n\n try {\n const auth = alignAuthWithSdk(request.auth, generator.getAuthType?.());\n const result = generator.generateSync({ ...request, auth });\n logCriticalErrors(language, result);\n\n if (result?.snippet) {\n return {\n name: undefined,\n language,\n install: undefined,\n code: result.snippet,\n generated: true,\n description: undefined\n };\n }\n } catch (error) {\n console.error(`[sdk-snippets] error generating ${language} snippet:`, error);\n }\n\n return undefined;\n}\n","import type { TargetId } from \"httpsnippet-lite\";\nimport type { DynamicIr } from \"../../client/APIV1Write\";\nimport type { HttpSnippetLanguage } from \"../../orpc-client/shared.js\";\n\n/**\n * Map of language identifiers to their dynamic IR data\n */\nexport type DynamicIRsByLanguage = Record<string, DynamicIr>;\n\n/**\n * Configuration for an HTTP snippet client\n */\nexport interface HTTPSnippetClient {\n targetId: TargetId;\n clientId: string;\n}\n\n/**\n * Flags controlling snippet generation behavior\n */\nexport interface SnippetGenerationFlags {\n /**\n * Controls HTTP snippet generation.\n * - `false`: Only generate curl snippets\n * - `true`: Generate HTTP snippets for all supported languages\n * - `HttpSnippetLanguage[]`: Generate HTTP snippets only for specified languages\n */\n httpSnippets: boolean | HttpSnippetLanguage[];\n\n /**\n * When true, always generate JavaScript fetch snippets even if TypeScript snippets exist\n */\n alwaysEnableJavaScriptFetch: boolean;\n}\n\n/**\n * Supported languages for SDK snippet generation\n */\nexport type SdkSnippetLanguage = \"typescript\" | \"python\" | \"java\" | \"ruby\" | \"swift\" | \"csharp\" | \"go\" | \"php\";\n\nexport const SDK_SNIPPET_LANGUAGES: SdkSnippetLanguage[] = [\n \"typescript\",\n \"python\",\n \"java\",\n \"ruby\",\n \"swift\",\n \"csharp\",\n \"go\",\n \"php\"\n];\n\n/**\n * Map of language identifiers to their snippet generators.\n * Uses `any` type because the actual generator type from @fern-api/snippets\n * has complex type requirements that we don't need to enforce here.\n */\nexport type SnippetGenerators = Record<string, any>;\n\nexport type { HttpSnippetLanguage };\n","import identity from \"@fern-api/ui-core-utils/identity\";\nimport visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\n\nimport type * as Latest from \"./latest\";\n\n/**\n * Visitor for API definitions.\n * This is used to traverse the API definition and apply functions to each node.\n */\nexport interface ApiDefinitionVisitor {\n // endpoints\n EndpointDefinition(endpoint: Latest.EndpointDefinition, key: string): Latest.EndpointDefinition;\n HttpRequest(request: Latest.HttpRequest, key: string): Latest.HttpRequest;\n HttpResponse(response: Latest.HttpResponse, key: string): Latest.HttpResponse;\n ErrorResponse(error: Latest.ErrorResponse, key: string): Latest.ErrorResponse;\n ExampleEndpointCall(example: Latest.ExampleEndpointCall, key: string): Latest.ExampleEndpointCall;\n CodeSnippet(snippet: Latest.CodeSnippet, key: string): Latest.CodeSnippet;\n ErrorExample(error: Latest.ErrorExample, key: string): Latest.ErrorExample;\n\n // webhooks\n WebhookDefinition(webhook: Latest.WebhookDefinition, key: string): Latest.WebhookDefinition;\n WebhookPayload(payload: Latest.WebhookPayload, key: string): Latest.WebhookPayload;\n\n // websockets\n WebSocketChannel(channel: Latest.WebSocketChannel, key: string): Latest.WebSocketChannel;\n WebSocketMessage(message: Latest.WebSocketMessage, key: string): Latest.WebSocketMessage;\n ExampleWebSocketSession(session: Latest.ExampleWebSocketSession, key: string): Latest.ExampleWebSocketSession;\n\n // types\n TypeDefinition(type: Latest.TypeDefinition, key: string): Latest.TypeDefinition;\n TypeShape(shape: Latest.TypeShape, key: string): Latest.TypeShape;\n WebhookPayloadShape(shape: Latest.WebhookPayloadShape, key: string): Latest.WebhookPayloadShape;\n ObjectType(property: Latest.ObjectType, key: string): Latest.ObjectType;\n ObjectProperty(property: Latest.ObjectProperty, key: string): Latest.ObjectProperty;\n EnumValue(value: Latest.EnumValue, key: string): Latest.EnumValue;\n UndiscriminatedUnionVariant(\n variant: Latest.UndiscriminatedUnionVariant,\n key: string\n ): Latest.UndiscriminatedUnionVariant;\n DiscriminatedUnionVariant(variant: Latest.DiscriminatedUnionVariant, key: string): Latest.DiscriminatedUnionVariant;\n FormDataRequest(request: Latest.FormDataRequest, key: string): Latest.FormDataRequest;\n FormDataField(field: Latest.FormDataField, key: string): Latest.FormDataField;\n FormDataFile(file: Latest.FormDataFile, key: string): Latest.FormDataFile;\n FormDataFiles(files: Latest.FormDataFiles, key: string): Latest.FormDataFiles;\n}\n\nexport class Transformer {\n public static with(visitor: Partial<ApiDefinitionVisitor>): Transformer {\n return new Transformer({\n EndpointDefinition: visitor.EndpointDefinition ?? identity,\n HttpRequest: visitor.HttpRequest ?? identity,\n HttpResponse: visitor.HttpResponse ?? identity,\n ErrorResponse: visitor.ErrorResponse ?? identity,\n ExampleEndpointCall: visitor.ExampleEndpointCall ?? identity,\n CodeSnippet: visitor.CodeSnippet ?? identity,\n ErrorExample: visitor.ErrorExample ?? identity,\n WebhookDefinition: visitor.WebhookDefinition ?? identity,\n WebhookPayload: visitor.WebhookPayload ?? identity,\n WebSocketChannel: visitor.WebSocketChannel ?? identity,\n WebSocketMessage: visitor.WebSocketMessage ?? identity,\n ExampleWebSocketSession: visitor.ExampleWebSocketSession ?? identity,\n TypeDefinition: visitor.TypeDefinition ?? identity,\n TypeShape: visitor.TypeShape ?? identity,\n WebhookPayloadShape: visitor.WebhookPayloadShape ?? identity,\n ObjectType: visitor.ObjectType ?? identity,\n ObjectProperty: visitor.ObjectProperty ?? identity,\n EnumValue: visitor.EnumValue ?? identity,\n UndiscriminatedUnionVariant: visitor.UndiscriminatedUnionVariant ?? identity,\n DiscriminatedUnionVariant: visitor.DiscriminatedUnionVariant ?? identity,\n FormDataRequest: visitor.FormDataRequest ?? identity,\n FormDataField: visitor.FormDataField ?? identity,\n FormDataFile: visitor.FormDataFile ?? identity,\n FormDataFiles: visitor.FormDataFiles ?? identity\n });\n }\n\n public static descriptions(transformer: (description: string, key: string) => string): Transformer {\n function internalTransformer<T extends Latest.WithDescription>(withDescription: T, key: string): T {\n const description =\n withDescription.description != null ? transformer(withDescription.description, key) : undefined;\n return { ...withDescription, description };\n }\n\n return Transformer.with({\n EndpointDefinition: internalTransformer,\n HttpRequest: internalTransformer,\n HttpResponse: internalTransformer,\n ErrorResponse: internalTransformer,\n ExampleEndpointCall: internalTransformer,\n CodeSnippet: internalTransformer,\n ErrorExample: internalTransformer,\n WebhookDefinition: internalTransformer,\n WebhookPayload: internalTransformer,\n WebSocketChannel: internalTransformer,\n WebSocketMessage: internalTransformer,\n ExampleWebSocketSession: internalTransformer,\n TypeDefinition: internalTransformer,\n ObjectProperty: internalTransformer,\n EnumValue: internalTransformer,\n UndiscriminatedUnionVariant: internalTransformer,\n DiscriminatedUnionVariant: internalTransformer,\n FormDataRequest: internalTransformer,\n FormDataField: internalTransformer,\n FormDataFile: internalTransformer,\n FormDataFiles: internalTransformer\n });\n }\n\n /**\n * @internal visible for testing only\n */\n public static keys(collect: (key: string) => void): Transformer {\n function visit<T>(value: T, key: string): T {\n collect(key);\n return value;\n }\n return Transformer.with({\n EndpointDefinition: visit,\n HttpRequest: visit,\n HttpResponse: visit,\n ErrorResponse: visit,\n ExampleEndpointCall: visit,\n CodeSnippet: visit,\n ErrorExample: visit,\n WebhookDefinition: visit,\n WebhookPayload: visit,\n WebSocketChannel: visit,\n WebSocketMessage: visit,\n ExampleWebSocketSession: visit,\n TypeDefinition: visit,\n TypeShape: visit,\n WebhookPayloadShape: visit,\n ObjectType: visit,\n ObjectProperty: visit,\n EnumValue: visit,\n UndiscriminatedUnionVariant: visit,\n DiscriminatedUnionVariant: visit,\n FormDataRequest: visit,\n FormDataField: visit,\n FormDataFile: visit,\n FormDataFiles: visit\n });\n }\n\n private visitor: ApiDefinitionVisitor;\n private constructor(visitor: ApiDefinitionVisitor) {\n this.visitor = this.#wrapVisitor(visitor);\n }\n\n /**\n * Visits an API definition and applies the visitor transformations to each node.\n *\n * This function treats the API Definition as an AST. The purpose is to apply transformations to the \"description\" field of each node.\n *\n * @param api the API definition to visit\n * @param visitor the visitor to apply to the API definition\n * @returns the API definition with the visitor transformations applied\n */\n apiDefinition = (api: Latest.ApiDefinition): Latest.ApiDefinition => {\n const endpoints = Object.entries(api.endpoints).map(([id, endpoint]) => [\n id,\n this.visitor.EndpointDefinition(endpoint, `${api.id}/endpoint/${id}`)\n ]);\n\n const websockets = Object.entries(api.websockets).map(([id, websocket]) => [\n id,\n this.visitor.WebSocketChannel(websocket, `${api.id}/websocket/${id}`)\n ]);\n\n const webhooks = Object.entries(api.webhooks).map(([id, webhook]) => [\n id,\n this.visitor.WebhookDefinition(webhook, `${api.id}/webhoook/${id}`)\n ]);\n\n const types = Object.entries(api.types).map(([id, type]) => [\n id,\n this.visitor.TypeDefinition(type, `${api.id}/type-definition/${id}`)\n ]);\n\n const globalHeaders =\n api.globalHeaders?.map((header) =>\n this.visitor.ObjectProperty(header, `${api.id}/global-headers/${header.key}`)\n ) ?? [];\n\n return {\n id: api.id,\n apiName: api.apiName,\n endpoints: Object.fromEntries(endpoints),\n websockets: Object.fromEntries(websockets),\n webhooks: Object.fromEntries(webhooks),\n graphqlOperations: api.graphqlOperations,\n types: Object.fromEntries(types),\n globalHeaders,\n auths: api.auths,\n subpackages: api.subpackages,\n snippetsConfiguration: api.snippetsConfiguration\n };\n };\n\n #wrapVisitor = (visitor: ApiDefinitionVisitor): ApiDefinitionVisitor => {\n const innerVisitor: ApiDefinitionVisitor = {\n /**\n * The following types do not have any nested types that need to be visited.\n */\n\n CodeSnippet: visitor.CodeSnippet,\n ErrorExample: visitor.ErrorExample,\n ExampleWebSocketSession: visitor.ExampleWebSocketSession,\n ObjectProperty: visitor.ObjectProperty,\n EnumValue: visitor.EnumValue,\n UndiscriminatedUnionVariant: visitor.UndiscriminatedUnionVariant,\n FormDataFile: visitor.FormDataFile,\n FormDataFiles: visitor.FormDataFiles,\n\n /**\n * The following types have nested types that need to be visited.\n */\n\n EndpointDefinition: (endpoint, key) => visitor.EndpointDefinition(this.endpoint(endpoint, key), key),\n HttpRequest: (request, key) => visitor.HttpRequest(this.httpRequest(request, key), key),\n HttpResponse: (response, key) => visitor.HttpResponse(this.httpResponse(response, key), key),\n ErrorResponse: (error, key) => visitor.ErrorResponse(this.errorResponse(error, key), key),\n ExampleEndpointCall: (example, key) =>\n visitor.ExampleEndpointCall(this.exampleEndpointCall(example, key), key),\n WebhookDefinition: (webhook, key) => visitor.WebhookDefinition(this.webhookDefinition(webhook, key), key),\n WebhookPayload: (payload, key) => visitor.WebhookPayload(this.webhookPayload(payload, key), key),\n WebSocketChannel: (channel, key) => visitor.WebSocketChannel(this.webSocketChannel(channel, key), key),\n WebSocketMessage: (message, key) => visitor.WebSocketMessage(this.webSocketMessage(message, key), key),\n TypeDefinition: (type, key) => visitor.TypeDefinition(this.typeDefinition(type, key), key),\n TypeShape: (shape, key) => visitor.TypeShape(this.typeShape(shape, key), key),\n WebhookPayloadShape: (shape, key) => visitor.WebhookPayloadShape(this.webhookPayloadShape(shape, key), key),\n ObjectType: (type, key) => visitor.ObjectType(this.objectType(type, key), key),\n DiscriminatedUnionVariant: (variant, key) =>\n visitor.DiscriminatedUnionVariant(this.objectType(variant, key), key),\n FormDataRequest: (request, key) => visitor.FormDataRequest(this.formDataRequest(request, key), key),\n FormDataField: (field, key) => visitor.FormDataField(this.formDataField(field, key), key)\n };\n return innerVisitor;\n };\n\n endpoint = (endpoint: Latest.EndpointDefinition, parentKey: string): Latest.EndpointDefinition => {\n const pathParameters =\n endpoint.pathParameters?.map((param) => ({\n ...this.visitor.ObjectProperty(param, `${parentKey}/path/${param.key}`),\n explode: param.explode\n })) ?? [];\n const queryParameters =\n endpoint.queryParameters?.map((param) => ({\n ...this.visitor.ObjectProperty(param, `${parentKey}/query/${param.key}`),\n explode: param.explode\n })) ?? [];\n const requestHeaders =\n endpoint.requestHeaders?.map((param) =>\n this.visitor.ObjectProperty(param, `${parentKey}/requestHeader/${param.key}`)\n ) ?? [];\n const responseHeaders =\n endpoint.responseHeaders?.map((param) =>\n this.visitor.ObjectProperty(param, `${parentKey}/responseHeader/${param.key}`)\n ) ?? [];\n const requests = endpoint.requests?.map((request, i) =>\n // this has changed\n this.visitor.HttpRequest(request, `${parentKey}/request/${i}`)\n );\n const responses = endpoint.responses?.map((response, i) =>\n // this has changed discretely\n this.visitor.HttpResponse(response, `${parentKey}/response/${i}/${response.statusCode}`)\n );\n const errors =\n endpoint.errors?.map((error, i) =>\n this.visitor.ErrorResponse(error, `${parentKey}/error/${i}/${error.statusCode}`)\n ) ?? [];\n const examples =\n endpoint.examples?.map((example, i) =>\n this.visitor.ExampleEndpointCall(example, `${parentKey}/example/${i}`)\n ) ?? [];\n\n return {\n ...endpoint,\n pathParameters: pathParameters.length > 0 ? pathParameters : undefined,\n queryParameters: queryParameters.length > 0 ? queryParameters : undefined,\n requestHeaders: requestHeaders.length > 0 ? requestHeaders : undefined,\n responseHeaders: responseHeaders.length > 0 ? responseHeaders : undefined,\n requests,\n responses,\n errors: errors.length > 0 ? errors : undefined,\n examples: examples.length > 0 ? examples : undefined\n };\n };\n\n httpRequest = (request: Latest.HttpRequest, parentKey: string): Latest.HttpRequest => {\n const body = visitDiscriminatedUnion(request.body)._visit<Latest.HttpRequestBodyShape>({\n object: (value) => ({\n ...value,\n ...this.visitor.ObjectType(value, `${parentKey}/object`)\n }),\n alias: identity,\n bytes: identity,\n formData: (value) => ({\n ...value,\n ...this.visitor.FormDataRequest(value, `${parentKey}/formdata`)\n })\n });\n return { ...request, body };\n };\n\n formDataField = (field: Latest.FormDataField, parentKey: string): Latest.FormDataField => {\n return visitDiscriminatedUnion(field)._visit<Latest.FormDataField>({\n file: (value) => ({\n ...value,\n ...this.visitor.FormDataFile(value, `${parentKey}/file/${value.key}`)\n }),\n files: (value) => ({\n ...value,\n ...this.visitor.FormDataFiles(value, `${parentKey}/files/${value.key}`)\n }),\n property: (value) => ({\n ...value,\n ...this.visitor.ObjectProperty(value, `${parentKey}/property/${value.key}`)\n })\n });\n };\n\n httpResponse = (response: Latest.HttpResponse, parentKey: string): Latest.HttpResponse => {\n const body = visitDiscriminatedUnion(response.body)._visit<Latest.HttpResponseBodyShape>({\n object: (value) => ({\n ...value,\n ...this.visitor.ObjectType(value, `${parentKey}/object`)\n }),\n alias: identity,\n fileDownload: identity,\n streamingText: identity,\n stream: (value) => ({\n ...value,\n shape: this.visitor.TypeShape(value.shape, `${parentKey}/stream/shape`)\n }),\n empty: identity\n });\n return { ...response, body };\n };\n\n objectType = <T extends Latest.ObjectType>(type: T, parentKey: string): T => {\n const properties = type.properties.map((prop) =>\n this.visitor.ObjectProperty(prop, `${parentKey}/property/${prop.key}`)\n );\n return { ...type, properties };\n };\n\n errorResponse = (error: Latest.ErrorResponse, parentKey: string): Latest.ErrorResponse => {\n const shape = error.shape ? this.visitor.TypeShape(error.shape, `${parentKey}/error/shape`) : undefined;\n const examples =\n error.examples?.map((example, i) => this.visitor.ErrorExample(example, `${parentKey}/example/${i}`)) ?? [];\n return {\n ...error,\n shape,\n examples: examples.length > 0 ? examples : undefined\n };\n };\n\n exampleEndpointCall = (example: Latest.ExampleEndpointCall, parentKey: string): Latest.ExampleEndpointCall => {\n const snippetsEntries = Object.entries(example.snippets ?? {})\n .map(\n ([language, snippets]) =>\n [\n language,\n snippets.map((snippet, i) =>\n this.visitor.CodeSnippet(snippet, `${parentKey}/snippet/${language}/${i}`)\n )\n ] as const\n )\n .filter(([, snippets]) => snippets.length > 0);\n\n const snippets = Object.fromEntries(snippetsEntries);\n return {\n ...example,\n snippets: snippetsEntries.length > 0 ? snippets : undefined\n };\n };\n\n webhookDefinition = (webhook: Latest.WebhookDefinition, parentKey: string): Latest.WebhookDefinition => {\n const payload =\n webhook.payloads?.[0] != null\n ? this.visitor.WebhookPayload(webhook.payloads[0], `${parentKey}/payload`)\n : undefined;\n const headers =\n webhook.headers?.map((header) =>\n this.visitor.ObjectProperty(header, `${parentKey}/header/${header.key}`)\n ) ?? [];\n const responses = webhook.responses?.map((response, i) =>\n this.visitor.HttpResponse(response, `${parentKey}/response/${i}/${response.statusCode}`)\n );\n return {\n ...webhook,\n payloads: payload != null ? [payload] : undefined,\n headers: headers.length > 0 ? headers : undefined,\n responses\n };\n };\n\n webhookPayload = (payload: Latest.WebhookPayload, parentKey: string): Latest.WebhookPayload => {\n const shape = this.visitor.WebhookPayloadShape(payload.shape, `${parentKey}/shape`);\n return { ...payload, shape };\n };\n\n webhookPayloadShape = (shape: Latest.WebhookPayloadShape, parentKey: string): Latest.WebhookPayloadShape => {\n return visitDiscriminatedUnion(shape)._visit<Latest.WebhookPayloadShape>({\n object: (value) => ({\n ...value,\n ...this.visitor.ObjectType(value, `${parentKey}/object`)\n }),\n alias: identity,\n formData: (value) => ({\n ...value,\n ...this.visitor.FormDataRequest(value, `${parentKey}/formData`)\n })\n });\n };\n\n webSocketChannel = (channel: Latest.WebSocketChannel, parentKey: string): Latest.WebSocketChannel => {\n const pathParameters =\n channel.pathParameters?.map((param) => ({\n ...this.visitor.ObjectProperty(param, `${parentKey}/path/${param.key}`),\n explode: param.explode\n })) ?? [];\n const queryParameters =\n channel.queryParameters?.map((param) => ({\n ...this.visitor.ObjectProperty(param, `${parentKey}/query/${param.key}`),\n explode: param.explode\n })) ?? [];\n const requestHeaders =\n channel.requestHeaders?.map((param) =>\n this.visitor.ObjectProperty(param, `${parentKey}/requestHeader/${param.key}`)\n ) ?? [];\n const messages = channel.messages.map((message) =>\n this.visitor.WebSocketMessage(message, `${parentKey}/message/${message.origin}/${message.type}`)\n );\n const examples =\n channel.examples?.map((example, i) =>\n this.visitor.ExampleWebSocketSession(example, `${parentKey}/example/${i}`)\n ) ?? [];\n return {\n ...channel,\n pathParameters: pathParameters.length > 0 ? pathParameters : undefined,\n queryParameters: queryParameters.length > 0 ? queryParameters : undefined,\n requestHeaders: requestHeaders.length > 0 ? requestHeaders : undefined,\n messages,\n examples: examples.length > 0 ? examples : undefined\n };\n };\n\n webSocketMessage = (message: Latest.WebSocketMessage, parentKey: string): Latest.WebSocketMessage => {\n const body = this.visitor.TypeShape(message.body, `${parentKey}/body`);\n return { ...message, body };\n };\n\n typeShape = (shape: Latest.TypeShape, parentKey: string): Latest.TypeShape => {\n return visitDiscriminatedUnion(shape)._visit<Latest.TypeShape>({\n object: (value) => ({\n ...value,\n ...this.visitor.ObjectType(value, `${parentKey}/object`)\n }),\n alias: identity,\n enum: (value) => ({\n ...value,\n values: value.values.map((enumValue) =>\n this.visitor.EnumValue(enumValue, `${parentKey}/enum/value/${enumValue.value}`)\n )\n }),\n undiscriminatedUnion: (value) => ({\n ...value,\n variants: value.variants.map((variant, i) =>\n this.visitor.UndiscriminatedUnionVariant(variant, `${parentKey}/undiscriminatedUnion/variant/${i}`)\n )\n }),\n discriminatedUnion: (value) => ({\n ...value,\n variants: value.variants.map((variant) =>\n this.visitor.DiscriminatedUnionVariant(\n variant,\n `${parentKey}/discriminatedUnion/variant/${variant.discriminantValue}`\n )\n )\n })\n });\n };\n\n formDataRequest = (request: Latest.FormDataRequest, parentKey: string): Latest.FormDataRequest => {\n return {\n ...request,\n fields: request.fields.map((field) => this.visitor.FormDataField(field, `${parentKey}/field/${field.key}`))\n };\n };\n\n typeDefinition = (type: Latest.TypeDefinition, parentKey: string): Latest.TypeDefinition => {\n return {\n ...type,\n shape: this.visitor.TypeShape(type.shape, `${parentKey}/shape`)\n };\n };\n}\n","import { ApiDefinitionHolder } from \"./ApiDefinitionHolder\";\nimport { ApiDefinitionPruner } from \"./ApiDefinitionPruner\";\nimport { ApiTypeIdVisitor } from \"./ApiTypeIdVisitor\";\nimport { NodeCollector } from \"./NodeCollector\";\n\nexport * from \"../orpc-client/api/shared.js\";\nexport * from \"../orpc-client/shared.js\";\nexport * from \"./ApiDefinitionHolder\";\nexport * as migrate from \"./migrators\";\nexport * as utils from \"./utils\";\nexport * from \"./utils/pruneNavigationTree\";\nexport * from \"./versions\";\nexport { ApiDefinitionHolder, ApiDefinitionPruner, ApiTypeIdVisitor, NodeCollector };\n","import type { APIV1Read } from \"../../client/types\";\n\nexport function isSubpackage(package_: APIV1Read.ApiDefinitionPackage): package_ is APIV1Read.ApiDefinitionSubpackage {\n return typeof (package_ as APIV1Read.ApiDefinitionSubpackage).subpackageId === \"string\";\n}\n","import type {\n EndpointId,\n EnvironmentId,\n FileId,\n GraphQlOperationId,\n GraphQlOperationType,\n GraphQlTypeCategory,\n TypeId,\n WebhookId,\n WebSocketId\n} from \"../../orpc-client/api/shared.js\";\nimport type {\n AnnouncementConfig,\n ApiDefinitionId,\n Availability,\n GrpcId,\n GrpcMethod,\n HttpMethod,\n LinkTarget,\n PageId,\n RoleId,\n Url,\n VersionId\n} from \"../../orpc-client/shared.js\";\n\nexport type Slug = string & {\n navigation_latest_Slug: void;\n};\n\nexport function Slug(value: string): Slug {\n return value as unknown as Slug;\n}\n\nexport type TabId = string & {\n navigation_latest_TabId: void;\n};\n\nexport function TabId(value: string): TabId {\n return value as unknown as TabId;\n}\n\nexport type NodeId = string & {\n navigation_latest_NodeId: void;\n};\n\nexport function NodeId(value: string): NodeId {\n return value as unknown as NodeId;\n}\n\nexport type ProductId = string & {\n navigation_latest_ProductId: void;\n};\n\nexport function ProductId(value: string): ProductId {\n return value as unknown as ProductId;\n}\n\nexport type VariantId = string & {\n navigation_latest_VariantId: void;\n};\n\nexport function VariantId(value: string): VariantId {\n return value as unknown as VariantId;\n}\n\nexport type RootChild = VersionedNode | UnversionedNode | ProductGroupNode;\n\nexport type ProductNode = InternalProductNode | ExternalProductNode;\n\nexport type ProductChild = VersionedNode | UnversionedNode;\n\nexport type VersionChild = TabbedNode | SidebarRootNode | VariantedNode;\n\nexport type VariantChild = ApiReferenceNode | SectionNode | SidebarGroupNode | PageNode | LinkNode | ChangelogNode;\n\nexport type TabChild = TabNode | LinkNode | ChangelogNode;\n\nexport type SidebarRootChild = SidebarGroupNode | ApiReferenceNode | SectionNode | VariantedNode;\n\nexport type NavigationChild = ApiReferenceNode | SectionNode | PageNode | LinkNode | ChangelogNode | VariantedNode;\n\nexport type ApiPackageChild =\n | ApiPackageNode\n | EndpointNode\n | EndpointPairNode\n | WebSocketNode\n | WebhookNode\n | GrpcNode\n | GraphQlNode\n | GraphQlTypeNode\n | PageNode\n | LinkNode;\n\nexport interface WithNodeId {\n id: NodeId;\n collapsed: boolean | \"open-by-default\" | undefined;\n}\n\nexport interface WithPermissions {\n viewers: RoleId[] | undefined;\n orphaned: boolean | undefined;\n}\n\nexport interface WithFeatureFlags {\n featureFlags: FeatureFlagOptions[] | undefined;\n}\n\nexport interface WithNodeMetadata extends WithNodeId, WithPermissions, WithFeatureFlags {\n title: string;\n slug: Slug;\n canonicalSlug: Slug | undefined;\n icon: string | undefined;\n hidden: boolean | undefined;\n authed: boolean | undefined;\n}\n\nexport interface WithPage {\n pageId: PageId;\n noindex: boolean | undefined;\n}\n\nexport interface WithOverviewPage {\n overviewPageId: PageId | undefined;\n noindex: boolean | undefined;\n}\n\nexport interface WithApiDefinitionId {\n apiDefinitionId: ApiDefinitionId;\n availability: Availability | undefined;\n}\n\nexport interface WithRedirect {\n pointsTo: Slug | undefined;\n}\n\nexport interface FeatureFlagOptions {\n flag: string;\n fallbackValue: unknown | undefined;\n match: unknown | undefined;\n}\n\nexport interface BreadcrumbItem {\n title: string;\n pointsTo: Slug | undefined;\n}\n\nexport interface PlaygroundButtonSettings {\n href: Url | undefined;\n}\n\nexport interface PlaygroundSettings {\n environments: EnvironmentId[] | undefined;\n button: PlaygroundButtonSettings | undefined;\n \"limit-websocket-messages-per-connection\": number | undefined;\n hidden: boolean | undefined;\n // when true, optional parameters that declare a default (or x-fern-default) are\n // pre-filled and sent from the API Explorer playground. defaults to false.\n \"send-optional-defaults\": boolean | undefined;\n}\n\nexport type { GraphQlOperationType };\nexport type { GraphQlTypeCategory };\n\nexport interface ProductGroupNode extends WithNodeId {\n type: \"productgroup\";\n landingPage: LandingPageNode | undefined;\n children: ProductNode[];\n /** Site-level changelog shared by all products; slugged off the root, not shown in the product switcher. */\n changelog?: ChangelogNode | undefined;\n}\n\nexport interface VersionedNode extends WithNodeId {\n type: \"versioned\";\n children: VersionNode[];\n}\n\nexport interface UnversionedNode extends WithNodeId {\n type: \"unversioned\";\n child: VersionChild;\n landingPage: LandingPageNode | undefined;\n}\n\nexport interface VariantedNode extends WithNodeId {\n type: \"varianted\";\n children: VariantNode[];\n}\n\nexport interface TabbedNode extends WithNodeId {\n type: \"tabbed\";\n children: TabChild[];\n}\n\nexport interface SidebarRootNode extends WithNodeId {\n type: \"sidebarRoot\";\n children: SidebarRootChild[];\n}\n\nexport interface SidebarGroupNode extends WithNodeId {\n type: \"sidebarGroup\";\n children: NavigationChild[];\n}\n\nexport interface EndpointPairNode extends WithNodeId {\n type: \"endpointPair\";\n stream: EndpointNode;\n nonStream: EndpointNode;\n}\n\nexport interface LinkNode extends WithNodeId {\n type: \"link\";\n title: string;\n icon: string | undefined;\n url: Url;\n target: LinkTarget | undefined;\n}\n\nexport interface RootNode extends WithNodeMetadata, WithRedirect {\n type: \"root\";\n version: \"v2\";\n child: RootChild;\n roles: RoleId[] | undefined;\n}\n\nexport interface InternalProductNode extends WithNodeMetadata, WithRedirect {\n type: \"product\";\n default: boolean;\n productId: ProductId;\n child: ProductChild;\n subtitle: string;\n image: FileId | undefined;\n announcement: AnnouncementConfig | undefined;\n}\n\nexport interface ExternalProductNode extends WithNodeId, WithPermissions, WithFeatureFlags {\n type: \"productLink\";\n default: boolean;\n productId: ProductId;\n title: string;\n href: Url;\n target: LinkTarget | undefined;\n subtitle: string;\n icon: string | undefined;\n image: FileId | undefined;\n hidden: boolean | undefined;\n authed: boolean | undefined;\n}\n\nexport interface VersionNode extends WithNodeMetadata, WithRedirect {\n type: \"version\";\n default: boolean;\n versionId: VersionId;\n child: VersionChild;\n availability: Availability | undefined;\n landingPage: LandingPageNode | undefined;\n announcement: AnnouncementConfig | undefined;\n}\n\nexport interface VariantNode extends WithNodeMetadata, WithRedirect {\n type: \"variant\";\n default: boolean;\n variantId: VariantId;\n subtitle: string | undefined;\n image: FileId | undefined;\n children: VariantChild[];\n}\n\nexport interface TabNode extends WithNodeMetadata, WithRedirect {\n type: \"tab\";\n child: SidebarRootNode;\n}\n\nexport interface PageNode extends WithNodeMetadata, WithPage {\n type: \"page\";\n availability: Availability | undefined;\n}\n\nexport interface LandingPageNode extends WithNodeMetadata, WithPage {\n type: \"landingPage\";\n}\n\nexport interface SectionNode extends WithNodeMetadata, WithOverviewPage, WithRedirect {\n type: \"section\";\n collapsible: boolean | undefined;\n collapsedByDefault: boolean | undefined;\n children: NavigationChild[];\n availability: Availability | undefined;\n}\n\nexport interface ChangelogNode extends WithNodeMetadata, WithOverviewPage {\n type: \"changelog\";\n children: ChangelogYearNode[];\n}\n\nexport interface ChangelogYearNode extends WithNodeMetadata {\n type: \"changelogYear\";\n year: number;\n children: ChangelogMonthNode[];\n}\n\nexport interface ChangelogMonthNode extends WithNodeMetadata {\n type: \"changelogMonth\";\n month: number;\n children: ChangelogEntryNode[];\n}\n\nexport interface ChangelogEntryNode extends WithNodeMetadata, WithPage {\n type: \"changelogEntry\";\n date: string;\n tags: string[] | undefined;\n}\n\nexport interface ApiReferenceNode extends WithNodeMetadata, WithOverviewPage, WithApiDefinitionId, WithRedirect {\n type: \"apiReference\";\n paginated: boolean | undefined;\n showErrors: boolean | undefined;\n hideTitle: boolean | undefined;\n children: ApiPackageChild[];\n changelog: ChangelogNode | undefined;\n playground: PlaygroundSettings | undefined;\n postmanCollectionUrl: string | undefined;\n}\n\nexport interface EndpointNode extends WithNodeMetadata, WithApiDefinitionId {\n noindex?: boolean | undefined;\n type: \"endpoint\";\n method: HttpMethod;\n endpointId: EndpointId;\n isResponseStream: boolean | undefined;\n playground: PlaygroundSettings | undefined;\n}\n\nexport interface WebSocketNode extends WithNodeMetadata, WithApiDefinitionId {\n noindex?: boolean | undefined;\n type: \"webSocket\";\n webSocketId: WebSocketId;\n playground: PlaygroundSettings | undefined;\n}\n\nexport interface WebhookNode extends WithNodeMetadata, WithApiDefinitionId {\n noindex?: boolean | undefined;\n type: \"webhook\";\n method: HttpMethod;\n webhookId: WebhookId;\n}\n\nexport interface GrpcNode extends WithNodeMetadata, WithApiDefinitionId {\n noindex?: boolean | undefined;\n type: \"grpc\";\n method: GrpcMethod;\n grpcId: GrpcId;\n}\n\nexport interface GraphQlNode extends WithNodeMetadata, WithApiDefinitionId {\n noindex?: boolean | undefined;\n type: \"graphql\";\n operationType: GraphQlOperationType;\n graphqlOperationId: GraphQlOperationId;\n /** Additional operation IDs when this node represents a namespace group (e.g. fieldPath grouping). */\n graphqlOperationIds: GraphQlOperationId[] | undefined;\n playground: PlaygroundSettings | undefined;\n}\n\n/**\n * A navigation node representing a single GraphQL schema type (object, input,\n * enum, scalar, interface, or union) as opposed to a GraphQL operation.\n *\n * This node is a navigable leaf, mirroring {@link GraphQlNode}. Generating these\n * nodes from a schema (FER-10879) and rendering a dedicated type page\n * (FER-10880) are tracked separately.\n */\nexport interface GraphQlTypeNode extends WithNodeMetadata, WithApiDefinitionId {\n noindex?: boolean | undefined;\n type: \"graphqlType\";\n typeId: TypeId;\n typeCategory: GraphQlTypeCategory;\n}\n\nexport interface ApiPackageNode extends WithNodeMetadata, WithOverviewPage, WithApiDefinitionId, WithRedirect {\n type: \"apiPackage\";\n children: ApiPackageChild[];\n playground: PlaygroundSettings | undefined;\n}\n","import type { EndpointNode, GraphQlNode, GraphQlTypeNode, GrpcNode, WebhookNode, WebSocketNode } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\n\n/**\n * A node in the navigation tree that represents an API endpoint, web socket, or webhook.\n */\nexport type NavigationNodeApiLeaf =\n | EndpointNode\n | WebSocketNode\n | WebhookNode\n | GrpcNode\n | GraphQlNode\n | GraphQlTypeNode;\n\nexport function isApiLeaf(node: NavigationNode): node is NavigationNodeApiLeaf {\n return (\n node.type === \"endpoint\" ||\n node.type === \"webSocket\" ||\n node.type === \"webhook\" ||\n node.type === \"grpc\" ||\n node.type === \"graphql\" ||\n node.type === \"graphqlType\"\n );\n}\n","import type { ChangelogEntryNode, LandingPageNode, PageNode } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\n\n/**\n * A leaf node that contains primarily markdown content\n */\nexport type NavigationNodeMarkdownLeaf = ChangelogEntryNode | PageNode | LandingPageNode;\n\nexport function isMarkdownLeaf(node: NavigationNode): node is NavigationNodeMarkdownLeaf {\n return node.type === \"page\" || node.type === \"landingPage\" || node.type === \"changelogEntry\";\n}\n","import type { LinkNode } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\nimport { isApiLeaf, type NavigationNodeApiLeaf } from \"./NavigationNodeApiLeaf\";\nimport { isMarkdownLeaf, type NavigationNodeMarkdownLeaf } from \"./NavigationNodePageLeaf\";\n\n/**\n * A navigation node that represents a leaf in the navigation tree (i.e. a node that does not have children)\n */\nexport type NavigationNodeLeaf = NavigationNodeApiLeaf | NavigationNodeMarkdownLeaf | LinkNode;\n\nexport function isLeaf(node: NavigationNode): node is NavigationNodeLeaf {\n return isApiLeaf(node) || isMarkdownLeaf(node) || node.type === \"link\";\n}\n","import { assertNever } from \"@fern-api/ui-core-utils\";\n\nimport type { NavigationNode } from \"./NavigationNode\";\nimport { isLeaf } from \"./NavigationNodeLeaf\";\n\nexport function getChildren(node: NavigationNode): readonly NavigationNode[] {\n if (isLeaf(node)) {\n return [];\n }\n\n switch (node.type) {\n case \"apiPackage\":\n case \"changelog\":\n case \"changelogMonth\":\n case \"changelogYear\":\n case \"section\":\n case \"sidebarGroup\":\n case \"sidebarRoot\":\n case \"tabbed\":\n case \"versioned\":\n case \"varianted\":\n return node.children;\n case \"product\":\n case \"root\":\n case \"tab\":\n return [node.child];\n case \"productLink\":\n return [];\n case \"variant\":\n return node.children;\n case \"apiReference\":\n return [...node.children, ...(node.changelog ? [node.changelog] : [])];\n case \"endpointPair\":\n return [node.nonStream, node.stream];\n case \"productgroup\":\n return [\n ...(node.landingPage ? [node.landingPage] : []),\n ...node.children,\n ...(node.changelog ? [node.changelog] : [])\n ];\n case \"unversioned\":\n case \"version\":\n return [...(node.landingPage ? [node.landingPage] : []), node.child];\n default:\n return assertNever(node);\n }\n}\n","import visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\n\nimport type { NavigationNodePage, PageId } from \".\";\n\nconst RETURN_PAGEID = (node: { pageId: PageId }) => node.pageId;\nconst RETURN_OVERVIEW_PAGEID = (node: { overviewPageId?: PageId }) => node.overviewPageId;\nconst RETURN_UNDEFINED = () => undefined;\n\nexport function getPageId(node: NavigationNodePage): PageId | undefined {\n return visitDiscriminatedUnion(node)._visit({\n section: RETURN_OVERVIEW_PAGEID,\n apiReference: RETURN_OVERVIEW_PAGEID,\n changelog: RETURN_OVERVIEW_PAGEID,\n apiPackage: RETURN_OVERVIEW_PAGEID,\n changelogEntry: RETURN_PAGEID,\n page: RETURN_PAGEID,\n landingPage: RETURN_PAGEID,\n\n // if the following changes, make sure to update the algolia records generator\n endpoint: RETURN_UNDEFINED,\n webSocket: RETURN_UNDEFINED,\n webhook: RETURN_UNDEFINED,\n grpc: RETURN_UNDEFINED,\n graphql: RETURN_UNDEFINED,\n graphqlType: RETURN_UNDEFINED\n // changelogYear: RETURN_UNDEFINED,\n // changelogMonth: RETURN_UNDEFINED,\n });\n}\n","import type { FernNavigation } from \"../../..\";\n\nexport function isApiReferenceNode(node: FernNavigation.NavigationNode): node is FernNavigation.ApiReferenceNode {\n return node.type === \"apiReference\";\n}\n","import type { ExternalProductNode, NavigationNode } from \".\";\n\nexport function isExternalProductNode(node: NavigationNode): node is ExternalProductNode {\n return node.type === \"productLink\";\n}\n","import type { InternalProductNode, NavigationNode } from \".\";\n\nexport function isInternalProductNode(node: NavigationNode): node is InternalProductNode {\n return node.type === \"product\";\n}\n","import type { ApiPackageNode, ApiReferenceNode, ChangelogNode, SectionNode } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\n\n/**\n * A navigation node that isn't a leaf node and contains markdown content\n */\nexport type NavigationNodeSection = SectionNode | ApiReferenceNode | ChangelogNode | ApiPackageNode;\n\nexport function isSection(node: NavigationNode): node is NavigationNodeSection {\n return (\n node.type === \"section\" ||\n node.type === \"apiReference\" ||\n node.type === \"changelog\" ||\n node.type === \"apiPackage\"\n );\n}\n","import type { PageId, WithOverviewPage } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\nimport { isSection, type NavigationNodeSection } from \"./NavigationNodeSection\";\n\ntype WithRequiredOverviewPage<T extends WithOverviewPage> = T & {\n overviewPageId: PageId;\n};\n\n/**\n * A navigation node that isn't a leaf node and contains markdown content\n */\nexport type NavigationNodeSectionOverview = WithRequiredOverviewPage<NavigationNodeSection>;\n\nexport function isSectionOverview(node: NavigationNode): node is NavigationNodeSectionOverview {\n return isSection(node) && node.overviewPageId != null;\n}\n","import type { NavigationNode } from \"./NavigationNode\";\nimport { isMarkdownLeaf, type NavigationNodeMarkdownLeaf } from \"./NavigationNodePageLeaf\";\nimport { isSectionOverview, type NavigationNodeSectionOverview } from \"./NavigationNodeSectionOverview\";\n\n/**\n * A navigation node that contains markdown content\n */\nexport type NavigationNodeWithMarkdown = NavigationNodeSectionOverview | NavigationNodeMarkdownLeaf;\n\nexport function hasMarkdown(node: NavigationNode): node is NavigationNodeWithMarkdown {\n return isMarkdownLeaf(node) || isSectionOverview(node);\n}\n","import type { NavigationNode } from \"./NavigationNode\";\nimport { isApiLeaf } from \"./NavigationNodeApiLeaf\";\nimport { hasMarkdown } from \"./NavigationNodeMarkdown\";\n\n/**\n * Whether a markdown page or API leaf is marked `noindex` (excluded from search\n * engines, sitemaps, and llms.txt).\n */\nexport function isNoindexNode(node: NavigationNode): boolean {\n return (hasMarkdown(node) || isApiLeaf(node)) && node.noindex === true;\n}\n","import type { NavigationNode, ProductGroupNode } from \".\";\n\nexport function isProductGroupNode(node: NavigationNode): node is ProductGroupNode {\n return node.type === \"productgroup\";\n}\n","import type { NavigationNode, ProductNode } from \".\";\n\nexport function isProductNode(node: NavigationNode): node is ProductNode {\n return node.type === \"product\" || node.type === \"productLink\";\n}\n","import type { FernNavigation } from \"../../..\";\n\nexport function isSidebarRootNode(node: FernNavigation.NavigationNode): node is FernNavigation.SidebarRootNode {\n return node.type === \"sidebarRoot\";\n}\n","import type { FernNavigation } from \"../../..\";\n\nexport function isTabbedNode(node: FernNavigation.NavigationNode): node is FernNavigation.TabbedNode {\n return node.type === \"tabbed\";\n}\n","import type { FernNavigation } from \"../../..\";\n\nexport function isUnversionedNode(node: FernNavigation.NavigationNode): node is FernNavigation.UnversionedNode {\n return node.type === \"unversioned\";\n}\n","import type { NavigationNode, VariantedNode } from \".\";\n\nexport function isVariantedNode(node: NavigationNode | undefined): node is VariantedNode {\n return node?.type === \"varianted\";\n}\n","import type { NavigationNode, VariantNode } from \".\";\n\nexport function isVariantNode(node: NavigationNode | undefined): node is VariantNode {\n return node?.type === \"variant\";\n}\n","import type { NavigationNode, VersionNode } from \".\";\n\nexport function isVersionNode(node: NavigationNode): node is VersionNode {\n return node.type === \"version\";\n}\n","import type { ChangelogEntryNode, ChangelogNode, PageNode } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\nimport { isApiLeaf, type NavigationNodeApiLeaf } from \"./NavigationNodeApiLeaf\";\nimport { isSectionOverview, type NavigationNodeSectionOverview } from \"./NavigationNodeSectionOverview\";\n\nexport type NavigationNodeNeighbor =\n | NavigationNodeApiLeaf\n | PageNode\n | ChangelogNode\n | ChangelogEntryNode\n | NavigationNodeSectionOverview;\n\nexport function isNeighbor(node: NavigationNode): node is NavigationNodeNeighbor {\n return (\n isApiLeaf(node) ||\n node.type === \"page\" ||\n node.type === \"changelog\" ||\n node.type === \"changelogEntry\" ||\n isSectionOverview(node)\n );\n}\n","import type { ChangelogNode } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\nimport { isApiLeaf, type NavigationNodeApiLeaf } from \"./NavigationNodeApiLeaf\";\nimport { hasMarkdown, type NavigationNodeWithMarkdown } from \"./NavigationNodeMarkdown\";\n\n/**\n * A navigation node that represents a visitable page in the documentation\n */\nexport type NavigationNodePage = NavigationNodeWithMarkdown | NavigationNodeApiLeaf | ChangelogNode;\n// | ChangelogYearNode\n// | ChangelogMonthNode;\n\nexport function isPage<N extends NavigationNode>(node: N): node is N & NavigationNodePage {\n return (\n isApiLeaf(node) ||\n node.type === \"changelog\" ||\n // TODO: Uncomment when changelog years and months are visitable\n // node.type === \"changelogYear\" ||\n // node.type === \"changelogMonth\" ||\n hasMarkdown(node)\n );\n}\n","import type { WithNodeMetadata } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\n\n/**\n * A navigation node that has a title and a slug\n */\nexport type NavigationNodeWithMetadata = Extract<NavigationNode, WithNodeMetadata>;\n\nexport function hasMetadata(node: Partial<NavigationNode>): node is NavigationNodeWithMetadata {\n return (\n typeof (node as NavigationNodeWithMetadata).title === \"string\" &&\n typeof (node as NavigationNodeWithMetadata).slug === \"string\"\n );\n}\n","import type { Slug, WithRedirect } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\n\n/**\n * Navigation nodes that can have a redirect\n */\nexport type NavigationNodeWithPointsTo = Extract<NavigationNode, WithRedirect>;\n\nexport function hasPointsTo(node: NavigationNode): node is NavigationNodeWithPointsTo {\n return (\n node.type === \"root\" ||\n node.type === \"product\" ||\n node.type === \"version\" ||\n node.type === \"tab\" ||\n node.type === \"section\" ||\n node.type === \"apiReference\" ||\n node.type === \"apiPackage\"\n );\n}\n\n/**\n * Navigation nodes that extend WithRedirect\n */\n\nexport function hasRedirect(node: NavigationNode): node is NavigationNodeWithPointsTo & { pointsTo: Slug } {\n if (!hasPointsTo(node)) {\n return false;\n }\n return node.pointsTo != null;\n}\n","import type { Slug } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\n\n/**\n * A navigation node that has a slug.\n */\nexport type NavigationNodeWithSlug = Extract<NavigationNode, { slug: Slug }>;\n\nexport function hasSlug(node: NavigationNode): node is NavigationNodeWithSlug {\n return typeof (node as NavigationNodeWithSlug).slug === \"string\";\n}\n","import { isNonNullish } from \"@fern-api/ui-core-utils\";\nimport urljoin from \"url-join\";\n\nimport { Slug } from \".\";\n\n// normalizes slug parts and joins them with a single slash\nexport function slugjoin(...parts: (string | string[] | null | undefined)[]): Slug {\n const slugArray = parts\n .filter(isNonNullish)\n .flatMap((part) => (typeof part === \"string\" ? [part.trim()] : part.map((part) => part.trim())))\n .map((part) => decodeURIComponent(part));\n\n const joined = urljoin(slugArray) ?? \"\";\n const normalized = joined\n .replaceAll(\"//*\", \"/\") // Remove duplicate slashes\n .replace(/^\\//, \"\") // Remove leading slash\n .replace(/\\/$/, \"\"); // Remove trailing slash\n\n return Slug(normalized);\n}\n","import { escapeRegExp } from \"es-toolkit/string\";\n\nimport { Slug } from \".\";\n\n/**\n * All versioned slugs are prefixed with the version slug, but the default version may be accessed without the version prefix.\n * toDefaultSlug creates the \"unversioned\" slug for pages under the default version.\n * This should be treated as the cannonical slug for that page.\n */\nexport function toDefaultSlug(slug: Slug, rootSlug: Slug, versionSlug: Slug): Slug;\nexport function toDefaultSlug(slug: Slug | undefined, rootSlug: Slug, versionSlug: Slug): Slug | undefined;\nexport function toDefaultSlug(slug: Slug | undefined, rootSlug: Slug, versionSlug: Slug): Slug | undefined {\n if (slug == null) {\n return undefined;\n }\n if (slug.startsWith(versionSlug)) {\n return Slug(slug.replace(new RegExp(`^${escapeRegExp(versionSlug)}`), rootSlug).replace(/^\\//, \"\"));\n }\n return slug;\n}\n","export const SKIP = \"skip\" as const;\nexport const STOP = false;\nexport const CONTINUE = true;\n\nexport type Action = typeof CONTINUE | typeof SKIP | typeof STOP | void;\n\nexport type TraverserVisit<N, P extends N = N> = (node: N, parents: readonly P[]) => Action;\nexport type TraverserGetChildren<N, P extends N = N> = (parent: P) => readonly N[];\n\nexport type DeleterAction = \"deleted\" | \"should-delete-parent\" | \"noop\";\n","import { SKIP, STOP, type TraverserGetChildren, type TraverserVisit } from \"./types\";\n\nexport function bfs<N, P extends N = N>(\n root: N,\n visit: TraverserVisit<N, P>,\n getChildren: TraverserGetChildren<N, P>,\n isParent: (node: N) => node is P = (node): node is P => true\n): void {\n const queue: [N, P[]][] = [[root, []]];\n while (queue.length > 0) {\n const [node, parents] = queue.shift() ?? [];\n if (!node) {\n continue;\n }\n const next = visit(node, parents ?? []);\n\n if (next === SKIP) {\n continue;\n } else if (next === STOP) {\n return;\n }\n\n if (isParent(node)) {\n for (const child of [...getChildren(node)]) {\n queue.push([child, [...(parents ?? []), node]]);\n }\n }\n }\n}\n","import { bfs } from \"../../../utils/traversers/bfs\";\nimport type { TraverserVisit } from \"../../../utils/traversers/types\";\nimport { getChildren } from \"./getChildren\";\nimport type { NavigationNode } from \"./NavigationNode\";\nimport type { NavigationNodeParent } from \"./NavigationNodeParent\";\n\n/**\n * Traverse the navigation tree in a depth-first manner (pre-order).\n */\nexport function traverseBF(node: NavigationNode, visit: TraverserVisit<NavigationNode, NavigationNodeParent>) {\n return bfs(node, visit, getChildren);\n}\n","import { SKIP, STOP, type TraverserGetChildren, type TraverserVisit } from \"./types\";\n\nexport function dfs<N, P extends N = N>(\n root: N,\n visit: TraverserVisit<N, P>,\n getChildren: TraverserGetChildren<N, P>,\n isParent: (node: N) => node is P = (node): node is P => true\n): void {\n const stack: [N, P[]][] = [[root, []]];\n while (stack.length > 0) {\n const [node, parents] = stack.pop() ?? [];\n if (!node) {\n continue;\n }\n const next = visit(node, parents ?? []);\n\n if (next === SKIP) {\n continue;\n } else if (next === STOP) {\n return;\n }\n\n if (isParent(node)) {\n for (const child of [...getChildren(node)].reverse()) {\n stack.push([child, [...(parents ?? []), node]]);\n }\n }\n }\n}\n","import { dfs } from \"../../../utils/traversers/dfs\";\nimport type { TraverserVisit } from \"../../../utils/traversers/types\";\nimport { getChildren } from \"./getChildren\";\nimport type { NavigationNode } from \"./NavigationNode\";\nimport type { NavigationNodeParent } from \"./NavigationNodeParent\";\n\n/**\n * Traverse the navigation tree in a depth-first manner (pre-order).\n */\nexport function traverseDF(node: NavigationNode, visit: TraverserVisit<NavigationNode, NavigationNodeParent>): void {\n return dfs(node, visit, getChildren);\n}\n","import type { APIV1Read } from \"../client/types\";\nimport { ROOT_PACKAGE_ID } from \"./consts\";\nimport { isSubpackage } from \"./utils/isSubpackage\";\nimport * as FernNavigation from \"./versions/latest\";\n\nexport class ApiDefinitionHolder {\n public static create(api: APIV1Read.ApiDefinition): ApiDefinitionHolder {\n return new ApiDefinitionHolder(api);\n }\n\n #endpoints = new Map<FernNavigation.EndpointId, APIV1Read.EndpointDefinition>();\n #webSockets = new Map<FernNavigation.WebSocketId, APIV1Read.WebSocketChannel>();\n #webhooks = new Map<FernNavigation.WebhookId, APIV1Read.WebhookDefinition>();\n #graphqlOperations = new Map<FernNavigation.GraphQlOperationId, APIV1Read.GraphQlOperation>();\n\n private constructor(public readonly api: APIV1Read.ApiDefinition) {\n [api.rootPackage, ...Object.values(api.subpackages)].forEach((package_) => {\n const subpackageId = isSubpackage(package_) ? package_.subpackageId : ROOT_PACKAGE_ID;\n package_.endpoints.forEach((endpoint) => {\n this.#endpoints.set(ApiDefinitionHolder.createEndpointId(endpoint, subpackageId), endpoint);\n });\n package_.websockets.forEach((webSocket) => {\n this.#webSockets.set(ApiDefinitionHolder.createWebSocketId(webSocket, subpackageId), webSocket);\n });\n package_.webhooks.forEach((webhook) => {\n this.#webhooks.set(ApiDefinitionHolder.createWebhookId(webhook, subpackageId), webhook);\n });\n package_.graphqlOperations?.forEach((graphqlOperation) => {\n this.#graphqlOperations.set(\n ApiDefinitionHolder.createGraphQlOperationId(graphqlOperation),\n graphqlOperation\n );\n });\n });\n }\n\n get endpoints(): ReadonlyMap<FernNavigation.EndpointId, APIV1Read.EndpointDefinition> {\n return this.#endpoints;\n }\n\n get webSockets(): ReadonlyMap<FernNavigation.WebSocketId, APIV1Read.WebSocketChannel> {\n return this.#webSockets;\n }\n\n get webhooks(): ReadonlyMap<FernNavigation.WebhookId, APIV1Read.WebhookDefinition> {\n return this.#webhooks;\n }\n\n get graphqlOperations(): ReadonlyMap<FernNavigation.GraphQlOperationId, APIV1Read.GraphQlOperation> {\n return this.#graphqlOperations;\n }\n\n public static createEndpointId(\n endpoint: APIV1Read.EndpointDefinition,\n subpackageId: string = ROOT_PACKAGE_ID\n ): FernNavigation.EndpointId {\n return FernNavigation.EndpointId(endpoint.originalEndpointId ?? `${subpackageId}.${endpoint.id}`);\n }\n\n public static createWebSocketId(\n webSocket: APIV1Read.WebSocketChannel,\n subpackageId: string = ROOT_PACKAGE_ID\n ): FernNavigation.WebSocketId {\n return FernNavigation.WebSocketId(`${subpackageId}.${webSocket.id}`);\n }\n\n public static createWebhookId(\n webhook: APIV1Read.WebhookDefinition,\n subpackageId: string = ROOT_PACKAGE_ID\n ): FernNavigation.WebhookId {\n return FernNavigation.WebhookId(`${subpackageId}.${webhook.id}`);\n }\n\n public static createGrpcId(\n grpcEndpoint: APIV1Read.EndpointDefinition,\n subpackageId: string = ROOT_PACKAGE_ID\n ): FernNavigation.GrpcId {\n return FernNavigation.GrpcId(`${subpackageId}.${grpcEndpoint.id}`);\n }\n\n public static createGraphQlOperationId(\n graphqlOperation: APIV1Read.GraphQlOperation\n ): FernNavigation.GraphQlOperationId {\n return graphqlOperation.id;\n }\n}\n","import visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\n\nimport type { APIV1Read } from \"../client/types\";\n\nexport class ApiTypeIdVisitor {\n public static visitEndpointDefinition(\n endpoint: APIV1Read.EndpointDefinition,\n visit: (typeId: APIV1Read.TypeId) => void\n ): void {\n endpoint.path.pathParameters.forEach((pathParameter) => {\n ApiTypeIdVisitor.visitTypeReference(pathParameter.type, visit);\n });\n endpoint.queryParameters.forEach((queryParameter) => {\n ApiTypeIdVisitor.visitTypeReference(queryParameter.type, visit);\n });\n endpoint.headers.forEach((header) => {\n ApiTypeIdVisitor.visitTypeReference(header.type, visit);\n });\n if (endpoint.request != null) {\n ApiTypeIdVisitor.visitHttpRequestBodyShape(endpoint.request.type, visit);\n }\n if (endpoint.response != null) {\n ApiTypeIdVisitor.visitHttpResponseBodyShape(endpoint.response.type, visit);\n }\n if (endpoint.errorsV2 != null) {\n endpoint.errorsV2.forEach((error) => {\n if (error.type != null) {\n ApiTypeIdVisitor.visitTypeShape(error.type, visit);\n }\n });\n }\n }\n\n public static visitWebSocketChannel(\n channel: APIV1Read.WebSocketChannel,\n visit: (typeId: APIV1Read.TypeId) => void\n ): void {\n channel.headers.forEach((header) => {\n ApiTypeIdVisitor.visitTypeReference(header.type, visit);\n });\n channel.path.pathParameters.forEach((pathParameter) => {\n ApiTypeIdVisitor.visitTypeReference(pathParameter.type, visit);\n });\n channel.queryParameters.forEach((queryParameter) => {\n ApiTypeIdVisitor.visitTypeReference(queryParameter.type, visit);\n });\n channel.messages.forEach((message) => {\n ApiTypeIdVisitor.visitObjectOrReference(message.body, visit);\n });\n }\n\n public static visitWebhookDefinition(\n webhook: APIV1Read.WebhookDefinition,\n visit: (typeId: APIV1Read.TypeId) => void\n ): void {\n webhook.headers.forEach((header) => {\n ApiTypeIdVisitor.visitTypeReference(header.type, visit);\n });\n ApiTypeIdVisitor.visitWebhookPayloadShape(webhook.payload.type, visit);\n }\n\n public static visitGraphQlOperation(\n graphqlOperation: APIV1Read.GraphQlOperation,\n visit: (typeId: APIV1Read.TypeId) => void\n ): void {\n graphqlOperation.arguments?.forEach((arg) => {\n ApiTypeIdVisitor.visitTypeReference(arg.type, visit);\n });\n ApiTypeIdVisitor.visitTypeReference(graphqlOperation.returnType, visit);\n }\n\n public static visitWebhookPayloadShape(\n payloadShape: APIV1Read.WebhookPayloadShape,\n visit: (typeId: APIV1Read.TypeId) => void\n ): void {\n return visitDiscriminatedUnion(payloadShape)._visit({\n object: (value) => ApiTypeIdVisitor.visitObjectType(value, visit),\n reference: (value) => ApiTypeIdVisitor.visitTypeReference(value.value, visit),\n formData: (value) => ApiTypeIdVisitor.visitFormDataRequest(value, visit)\n });\n }\n\n public static visitHttpRequestBodyShape(\n bodyShape: APIV1Read.HttpRequestBodyShape,\n visit: (typeId: APIV1Read.TypeId) => void\n ): void {\n return visitDiscriminatedUnion(bodyShape)._visit({\n object: (value) => ApiTypeIdVisitor.visitObjectType(value, visit),\n reference: (value) => ApiTypeIdVisitor.visitTypeReference(value.value, visit),\n bytes: () => undefined,\n formData: (value) => ApiTypeIdVisitor.visitFormDataRequest(value, visit),\n fileUpload: (value) =>\n value.value != null ? ApiTypeIdVisitor.visitFormDataRequest(value.value, visit) : undefined\n });\n }\n\n public static visitHttpResponseBodyShape(\n bodyShape: APIV1Read.HttpResponseBodyShape,\n visit: (typeId: APIV1Read.TypeId) => void\n ): void {\n return visitDiscriminatedUnion(bodyShape)._visit({\n object: (value) => ApiTypeIdVisitor.visitObjectType(value, visit),\n reference: (value) => ApiTypeIdVisitor.visitTypeReference(value.value, visit),\n fileDownload: () => undefined,\n streamingText: () => undefined,\n stream: (value) => ApiTypeIdVisitor.visitObjectOrReference(value.shape, visit),\n streamCondition: (value) => {\n ApiTypeIdVisitor.visitObjectOrReference(value.response.shape, visit);\n ApiTypeIdVisitor.visitObjectOrReference(value.streamResponse.shape, visit);\n }\n });\n }\n\n public static visitObjectOrReference(\n bodyShape: APIV1Read.JsonBodyShape,\n visit: (typeId: APIV1Read.TypeId) => void\n ): void {\n return visitDiscriminatedUnion(bodyShape)._visit({\n object: (value) => ApiTypeIdVisitor.visitObjectType(value, visit),\n reference: (value) => ApiTypeIdVisitor.visitTypeReference(value.value, visit)\n });\n }\n\n public static visitFormDataRequest(\n typeDefinition: APIV1Read.FormDataRequest,\n visit: (typeId: APIV1Read.TypeId) => void\n ): void {\n return typeDefinition.properties.forEach((property) =>\n visitDiscriminatedUnion(property)._visit({\n file: () => undefined,\n bodyProperty: (bodyProperty) => ApiTypeIdVisitor.visitTypeReference(bodyProperty.valueType, visit)\n })\n );\n }\n\n public static visitTypeDefinition(\n typeDefinition: APIV1Read.TypeDefinition,\n visit: (typeId: APIV1Read.TypeId) => void\n ): void {\n return ApiTypeIdVisitor.visitTypeShape(typeDefinition.shape, visit);\n }\n\n public static visitTypeShape(typeShape: APIV1Read.TypeShape, visit: (typeId: APIV1Read.TypeId) => void): void {\n return visitDiscriminatedUnion(typeShape)._visit({\n object: (value) => ApiTypeIdVisitor.visitObjectType(value, visit),\n alias: (value) => ApiTypeIdVisitor.visitTypeReference(value.value, visit),\n enum: () => undefined,\n undiscriminatedUnion: (value) =>\n value.variants.forEach((variant) => ApiTypeIdVisitor.visitTypeReference(variant.type, visit)),\n discriminatedUnion: (value) =>\n value.variants.forEach((variant) =>\n ApiTypeIdVisitor.visitObjectType(variant.additionalProperties, visit)\n )\n });\n }\n\n public static visitObjectType(typeShape: APIV1Read.ObjectType, visit: (typeId: APIV1Read.TypeId) => void): void {\n typeShape.extends.forEach(visit);\n typeShape.properties.forEach((property) => {\n ApiTypeIdVisitor.visitTypeReference(property.valueType, visit);\n property.arguments?.forEach((arg) => {\n ApiTypeIdVisitor.visitTypeReference(arg.type, visit);\n });\n });\n }\n\n public static visitTypeReference(\n typeReference: APIV1Read.TypeReference,\n visit: (typeId: APIV1Read.TypeId) => void\n ): void {\n return visitDiscriminatedUnion(typeReference)._visit({\n id: (value) => visit(value.value),\n primitive: () => undefined,\n nullable: (value) => ApiTypeIdVisitor.visitTypeReference(value.itemType, visit),\n optional: (value) => ApiTypeIdVisitor.visitTypeReference(value.itemType, visit),\n list: (value) => ApiTypeIdVisitor.visitTypeReference(value.itemType, visit),\n set: (value) => ApiTypeIdVisitor.visitTypeReference(value.itemType, visit),\n map: (value) => {\n ApiTypeIdVisitor.visitTypeReference(value.keyType, visit);\n ApiTypeIdVisitor.visitTypeReference(value.valueType, visit);\n },\n literal: () => undefined,\n unknown: () => undefined\n });\n }\n}\n","import type { FernNavigation } from \"./..\";\nimport type { APIV1Read } from \"../client/types\";\nimport { getGraphqlOperationIds } from \"../orpc-client/api/shared\";\nimport { ApiDefinitionHolder } from \"./ApiDefinitionHolder\";\nimport { ApiTypeIdVisitor } from \"./ApiTypeIdVisitor\";\n\nexport class ApiDefinitionPruner {\n constructor(private api: APIV1Read.ApiDefinition) {}\n\n public prune(\n node: FernNavigation.NavigationNodeApiLeaf | FernNavigation.EndpointPairNode\n ): APIV1Read.ApiDefinition {\n const rootPackage = this.pruneRootPackage(node);\n const subpackages = this.pruneSubpackages(node);\n const types = this.pruneTypes(rootPackage, subpackages, this.api.globalHeaders ?? undefined);\n\n return {\n id: this.api.id,\n apiName: this.api.apiName,\n rootPackage,\n subpackages,\n snippetsConfiguration: this.api.snippetsConfiguration,\n types,\n auth: this.api.auth,\n authSchemes: this.api.authSchemes,\n hasMultipleBaseUrls: this.api.hasMultipleBaseUrls,\n navigation: undefined,\n globalHeaders: this.api.globalHeaders\n };\n }\n\n private pruneTypes(\n rootPackage: APIV1Read.ApiDefinitionPackage,\n subpackages: Record<string, APIV1Read.ApiDefinitionSubpackage>,\n globalHeaders: APIV1Read.Header[] | undefined\n ): Record<string, APIV1Read.TypeDefinition> {\n let typeIds = new Set<APIV1Read.TypeId>();\n globalHeaders?.forEach((header) => {\n ApiTypeIdVisitor.visitTypeReference(header.type, (typeId) => typeIds.add(typeId));\n });\n typeIds = this.expandTypeIds(typeIds);\n\n [rootPackage, ...Object.values(subpackages)].forEach((subpackage) => {\n subpackage.types.forEach((typeId) => typeIds.add(typeId));\n });\n\n const types: Record<string, APIV1Read.TypeDefinition> = {};\n\n typeIds.forEach((typeId) => {\n const type = this.api.types[typeId];\n if (type != null) {\n types[typeId] = type;\n }\n });\n\n return types;\n }\n\n private expandTypeIds(typeIds: Set<APIV1Read.TypeId>): Set<APIV1Read.TypeId> {\n const visitedTypeIds = new Set<APIV1Read.TypeId>();\n const queue = Array.from(typeIds);\n\n while (queue.length > 0) {\n const typeId = queue.pop();\n if (typeId != null && !visitedTypeIds.has(typeId)) {\n visitedTypeIds.add(typeId);\n const type = this.api.types[typeId];\n if (type) {\n ApiTypeIdVisitor.visitTypeDefinition(type, (nestedTypeId) => {\n queue.push(nestedTypeId);\n });\n }\n }\n }\n\n return visitedTypeIds;\n }\n\n private pruneRootPackage(\n node: FernNavigation.NavigationNodeApiLeaf | FernNavigation.EndpointPairNode\n ): APIV1Read.ApiDefinitionPackage {\n return this.prunePackage(node, this.api.rootPackage);\n }\n\n private pruneSubpackages(\n node: FernNavigation.NavigationNodeApiLeaf | FernNavigation.EndpointPairNode\n ): Record<string, APIV1Read.ApiDefinitionSubpackage> {\n const subpackages: Record<string, APIV1Read.ApiDefinitionSubpackage> = {};\n\n for (const [subpackageId, subpackage] of Object.entries(this.api.subpackages)) {\n subpackages[subpackageId] = this.prunePackage(node, subpackage, subpackageId);\n }\n\n return subpackages;\n }\n\n private prunePackage<T extends APIV1Read.ApiDefinitionPackage>(\n node: FernNavigation.NavigationNodeApiLeaf | FernNavigation.EndpointPairNode,\n pkg: T,\n subpackageId?: string\n ): T {\n const endpoints = this.pruneEndpoints(node, pkg.endpoints, subpackageId);\n const websockets = this.pruneWebSockets(node, pkg.websockets, subpackageId);\n const webhooks = this.pruneWebhooks(node, pkg.webhooks, subpackageId);\n const graphqlOperations = this.pruneGraphqlOperations(node, pkg.graphqlOperations);\n const typeIds = new Set<APIV1Read.TypeId>();\n endpoints.forEach((endpoint) => {\n ApiTypeIdVisitor.visitEndpointDefinition(endpoint, (typeId) => typeIds.add(typeId));\n });\n websockets.forEach((websocket) => {\n ApiTypeIdVisitor.visitWebSocketChannel(websocket, (typeId) => typeIds.add(typeId));\n });\n webhooks.forEach((webhook) => {\n ApiTypeIdVisitor.visitWebhookDefinition(webhook, (typeId) => typeIds.add(typeId));\n });\n graphqlOperations.forEach((graphqlOperation) => {\n ApiTypeIdVisitor.visitGraphQlOperation(graphqlOperation, (typeId) => typeIds.add(typeId));\n });\n const expandedTypeIds = this.expandTypeIds(typeIds);\n return {\n ...pkg,\n endpoints,\n websockets,\n webhooks,\n graphqlOperations,\n types: Array.from(expandedTypeIds)\n };\n }\n\n private pruneEndpoints(\n node: FernNavigation.NavigationNodeApiLeaf | FernNavigation.EndpointPairNode,\n endpoints: APIV1Read.EndpointDefinition[],\n subpackageId?: string\n ): APIV1Read.EndpointDefinition[] {\n if (node.type !== \"endpoint\" && node.type !== \"endpointPair\") {\n return [];\n }\n\n if (node.type === \"endpointPair\") {\n return [\n ...this.pruneEndpoints(node.stream, endpoints, subpackageId),\n ...this.pruneEndpoints(node.nonStream, endpoints, subpackageId)\n ];\n }\n\n const endpointId = node.endpointId;\n const found = endpoints.find(\n (endpoint) => ApiDefinitionHolder.createEndpointId(endpoint, subpackageId) === endpointId\n );\n\n return found ? [found] : [];\n }\n\n private pruneWebSockets(\n node: FernNavigation.NavigationNodeApiLeaf | FernNavigation.EndpointPairNode,\n websockets: APIV1Read.WebSocketChannel[],\n subpackageId?: string\n ): APIV1Read.WebSocketChannel[] {\n if (node.type !== \"webSocket\") {\n return [];\n }\n\n const websocketId = node.webSocketId;\n const found = websockets.find(\n (websocket) => ApiDefinitionHolder.createWebSocketId(websocket, subpackageId) === websocketId\n );\n\n return found ? [found] : [];\n }\n\n private pruneWebhooks(\n node: FernNavigation.NavigationNodeApiLeaf | FernNavigation.EndpointPairNode,\n webhooks: APIV1Read.WebhookDefinition[],\n subpackageId?: string\n ): APIV1Read.WebhookDefinition[] {\n if (node.type !== \"webhook\") {\n return [];\n }\n\n const webhookId = node.webhookId;\n const found = webhooks.find(\n (webhook) => ApiDefinitionHolder.createWebhookId(webhook, subpackageId) === webhookId\n );\n\n return found ? [found] : [];\n }\n\n private pruneGraphqlOperations(\n node: FernNavigation.NavigationNodeApiLeaf | FernNavigation.EndpointPairNode,\n graphqlOperations: APIV1Read.GraphQlOperation[] | undefined\n ): APIV1Read.GraphQlOperation[] {\n if (node.type !== \"graphql\" || graphqlOperations == null) {\n return [];\n }\n\n const idsToInclude = new Set(getGraphqlOperationIds(node));\n return graphqlOperations.filter((op) => idsToInclude.has(ApiDefinitionHolder.createGraphQlOperationId(op)));\n }\n}\n","import { EMPTY_ARRAY } from \"@fern-api/ui-core-utils\";\nimport { once } from \"es-toolkit/function\";\nimport type { FernNavigation } from \"./..\";\nimport { getGraphqlOperationIds } from \"../orpc-client/api/ids\";\nimport { canonicalSlugKey } from \"./utils/canonicalSlugKey\";\nimport { pruneVersionNode } from \"./utils/pruneVersionNode\";\nimport {\n hasMetadata,\n hasRedirect,\n isNeighbor,\n isNoindexNode,\n isPage,\n isProductNode,\n type NavigationNodeWithMetadata,\n traverseDF\n} from \"./versions\";\n\ninterface NavigationNodeWithMetadataAndParents {\n node: FernNavigation.NavigationNodeWithMetadata;\n parents: readonly FernNavigation.NavigationNodeParent[];\n next: FernNavigation.NavigationNodeNeighbor | undefined;\n prev: FernNavigation.NavigationNodeNeighbor | undefined;\n}\n\n/**\n * Wraps a slug-keyed map so that `.get()` and `.has()` canonicalize the lookup\n * key. Keys in `slugToNode` are already stored in canonical (decoded) form via\n * {@link canonicalSlugKey}; this helper makes callers resilient to passing in\n * a percent-encoded slug without having to sprinkle canonicalization at every\n * call site.\n */\nfunction withCanonicalLookup<K extends string, V>(map: Map<K, V>): Map<K, V> {\n const originalGet = map.get.bind(map);\n const originalHas = map.has.bind(map);\n map.get = (key: K) => originalGet(key) ?? originalGet(canonicalSlugKey(key));\n map.has = (key: K) => originalHas(key) || originalHas(canonicalSlugKey(key));\n return map;\n}\n\n/**\n * Index key for a GraphQL type page: the API definition, the scope the page sits in, and the\n * type id.\n *\n * Every part is load-bearing. `typeId` is unique only within an API definition, so a docs site\n * with several GraphQL APIs can document a `Product` in each. And the same API definition can be\n * surfaced under more than one product, variant or version -- without the scope, the non-default\n * ones collapse into the default and an operation page in one scope links to another's type page.\n *\n * Prefer {@link NodeCollector.getGraphQlTypeNodeFor}, which derives the scope from the node doing\n * the asking; this is exported for callers that already hold a resolved scope.\n */\nexport function graphQlTypeKey(\n apiDefinitionId: FernNavigation.ApiDefinitionId,\n typeId: FernNavigation.TypeId,\n scope: GraphQlTypeScope = {}\n): string {\n return [apiDefinitionId, scope.productId ?? \"\", scope.variantId ?? \"\", scope.versionId ?? \"\", typeId].join(\":\");\n}\n\n/**\n * Index key for a GraphQL operation page. Scoped exactly like {@link graphQlTypeKey}: the same\n * operation id can appear under more than one product, variant or version, and an operation id is\n * unique only within an API definition.\n */\nexport function graphQlOperationKey(\n apiDefinitionId: FernNavigation.ApiDefinitionId,\n operationId: FernNavigation.GraphQlOperationId,\n scope: GraphQlTypeScope = {}\n): string {\n return [apiDefinitionId, scope.productId ?? \"\", scope.variantId ?? \"\", scope.versionId ?? \"\", operationId].join(\n \":\"\n );\n}\n\n/**\n * The product / variant / version a node sits under. Any part is undefined when the site does not\n * use that dimension. These are the only three node types that scope an API reference, so a scope\n * built from a node's parents addresses it completely.\n */\nexport interface GraphQlTypeScope {\n productId?: FernNavigation.ProductId;\n variantId?: FernNavigation.VariantId;\n versionId?: FernNavigation.VersionId;\n}\n\n/** The scope a node sits in, read from its parents. */\nfunction scopeOf(parents: readonly FernNavigation.NavigationNodeParent[]): GraphQlTypeScope {\n const scope: GraphQlTypeScope = {};\n for (const parent of parents) {\n if (parent.type === \"product\") {\n scope.productId = parent.productId;\n } else if (parent.type === \"variant\") {\n scope.variantId = parent.variantId;\n } else if (parent.type === \"version\") {\n scope.versionId = parent.versionId;\n }\n }\n return scope;\n}\n\nconst NodeCollectorInstances = new WeakMap<FernNavigation.NavigationNode, NodeCollector>();\n\nexport class NodeCollector {\n private static readonly EMPTY = new NodeCollector(undefined);\n private nodesInOrder: FernNavigation.NavigationNode[] = [];\n private idToNode = new Map<FernNavigation.NodeId, FernNavigation.NavigationNode>();\n private idToNodeParents = new Map<FernNavigation.NodeId, readonly FernNavigation.NavigationNodeParent[]>();\n private slugToNode = new Map<FernNavigation.Slug, NavigationNodeWithMetadataAndParents>();\n /** Keyed by {@link graphQlTypeKey} -- `typeId` alone is only unique within one API definition. */\n private typeIdToGraphQlTypeNode = new Map<string, FernNavigation.GraphQlTypeNode>();\n /** Keyed by {@link graphQlOperationKey}. A namespace-group node is recorded under every id it covers. */\n private operationIdToGraphQlNode = new Map<string, FernNavigation.GraphQlNode>();\n private orphanedNodes: FernNavigation.NavigationNodeWithMetadata[] = [];\n\n public static collect(rootNode: FernNavigation.NavigationNode | undefined): NodeCollector {\n if (rootNode == null) {\n return NodeCollector.EMPTY;\n }\n const existing = NodeCollectorInstances.get(rootNode);\n if (existing != null) {\n return existing;\n }\n const instance = new NodeCollector(rootNode);\n NodeCollectorInstances.set(rootNode, instance);\n return instance;\n }\n\n #last: NavigationNodeWithMetadataAndParents | undefined;\n #lastNeighboringNode: FernNavigation.NavigationNodeNeighbor | undefined;\n #setNode(\n slug: FernNavigation.Slug,\n node: FernNavigation.NavigationNodeWithMetadata,\n parents: readonly FernNavigation.NavigationNodeParent[]\n ) {\n const toSet = {\n node,\n parents,\n prev: this.#lastNeighboringNode,\n next: undefined\n };\n // Map keys are stored in canonical (decoded) form so lookups succeed\n // regardless of whether the incoming slug is raw Unicode or percent-encoded.\n this.slugToNode.set(canonicalSlugKey(slug), toSet);\n\n if (isNeighbor(node)) {\n this.#lastNeighboringNode = node;\n if (this.#last != null) {\n this.#last.next = node;\n }\n this.#last = toSet;\n }\n }\n\n private versionNodes: FernNavigation.VersionNode[] = [];\n private defaultVersion: FernNavigation.VersionNode | undefined;\n\n private productNodes: FernNavigation.ProductNode[] = [];\n private defaultProduct: FernNavigation.ProductNode | undefined;\n\n private variantNodes: FernNavigation.VariantNode[] = [];\n private defaultVariant: FernNavigation.VariantNode | undefined;\n\n constructor(rootNode: FernNavigation.NavigationNode | undefined) {\n if (rootNode == null) {\n return;\n }\n traverseDF(rootNode, (node, parents) => {\n if (node.type === \"product\") {\n this.productNodes.push(node);\n }\n\n // if the node is the default version, make a copy of it and \"prune\" the version slug from all children nodes\n if (node.type === \"version\") {\n this.versionNodes.push(node);\n }\n\n // collect variant nodes\n if (node.type === \"variant\") {\n this.variantNodes.push(node);\n }\n\n if (node.type === \"version\" && node.default && rootNode.type === \"root\") {\n // if the node is the default version OF a product, we want to prune using the product slug, not the root slug.\n const productNode = parents.find(isProductNode);\n const copy = JSON.parse(JSON.stringify(node)) as FernNavigation.VersionNode;\n // External product nodes (productLink) don't have slugs, so we use the root slug in that case\n const pruneSlug = productNode?.type === \"product\" ? productNode.slug : rootNode.slug;\n this.defaultVersion = pruneVersionNode(copy, pruneSlug, node.slug);\n traverseDF(this.defaultVersion, (node, innerParents) => {\n this.visitNode(node, [...parents, ...innerParents], true);\n });\n }\n\n this.visitNode(node, parents);\n });\n }\n\n private visitNode(\n node: FernNavigation.NavigationNode,\n parents: readonly FernNavigation.NavigationNodeParent[],\n isDefaultVersion = false\n ): void {\n if (!this.idToNode.has(node.id) || isDefaultVersion) {\n this.idToNode.set(node.id, node);\n this.idToNodeParents.set(node.id, parents);\n this.nodesInOrder.push(node);\n }\n\n if (node.type === \"graphqlType\") {\n // Indexed per version, so a non-default version keeps its own type\n // pages instead of being shadowed by the default one.\n //\n // Within one version the default version's pruned copy is traversed\n // first (see the constructor), so first-write-wins lands on its\n // unversioned slug -- the clean URL an operation page should link to.\n // Note that is `slug`, not `canonicalSlug`: `pruneVersionNode` rewrites\n // `slug` to the unversioned form and leaves `canonicalSlug` pointing at\n // the version-prefixed one, so preferring the canonical would send the\n // default version's links back through `/v1/`.\n //\n // A visible node still supersedes a hidden one, matching `slugToNode`'s\n // precedence below.\n const key = graphQlTypeKey(node.apiDefinitionId, node.typeId, scopeOf(parents));\n const existingTypeNode = this.typeIdToGraphQlTypeNode.get(key);\n if (existingTypeNode == null || (existingTypeNode.hidden === true && node.hidden !== true)) {\n this.typeIdToGraphQlTypeNode.set(key, node);\n }\n }\n\n if (node.type === \"graphql\") {\n // A namespace-group node stands in for several operations, so every id it covers has to\n // resolve to it -- a \"referenced by\" entry names one operation id, not the group.\n // Scoped and precedence-ordered exactly like the type index above.\n const scope = scopeOf(parents);\n for (const operationId of getGraphqlOperationIds(node)) {\n const key = graphQlOperationKey(node.apiDefinitionId, operationId, scope);\n const existing = this.operationIdToGraphQlNode.get(key);\n if (existing == null || (existing.hidden === true && node.hidden !== true)) {\n this.operationIdToGraphQlNode.set(key, node);\n }\n }\n }\n\n if (node.type === \"sidebarRoot\") {\n this.#last = undefined;\n this.#lastNeighboringNode = undefined;\n }\n\n // there's currently no visitable page for changelog months and years\n if (!hasMetadata(node) || node.type === \"changelogMonth\" || node.type === \"changelogYear\") {\n return;\n }\n\n const existing = this.slugToNode.get(canonicalSlugKey(node.slug));\n if (existing == null) {\n this.#setNode(node.slug, node, parents);\n } else if (!node.hidden && isPage(node) && (existing.node.hidden || !isPage(existing.node))) {\n this.orphanedNodes.push(existing.node);\n this.#setNode(node.slug, node, parents);\n } else {\n this.orphanedNodes.push(node);\n }\n }\n\n public getOrphanedNodes(): FernNavigation.NavigationNodeWithMetadata[] {\n return this.orphanedNodes;\n }\n\n public getOrphanedPages = once((): FernNavigation.NavigationNodeWithMetadata[] => {\n return this.orphanedNodes.filter(isPage);\n });\n\n private getSlugMap = once((): Map<string, FernNavigation.NavigationNodeWithMetadata> => {\n const map = new Map([...this.slugToNode.entries()].map(([slug, { node }]) => [slug, node]));\n return withCanonicalLookup(map);\n });\n\n get slugMap(): Map<string, FernNavigation.NavigationNodeWithMetadata> {\n return this.getSlugMap();\n }\n\n /**\n * GraphQL schema types that have their own page, keyed by\n * {@link graphQlTypeKey} -- `apiDefinitionId` *and* `typeId`.\n *\n * Exists so that a field whose value is `Product` can be rendered as a link\n * to `Product`'s page without every consumer re-walking the tree and picking\n * its own winner when a type appears under multiple versions or products.\n *\n * The key includes the API definition because `typeId` is only unique within\n * one definition: a docs site with several GraphQL APIs can legitimately have\n * a `Product` in each, and keying on `typeId` alone would link an operation in\n * one API to a type page in another.\n */\n public getGraphQlTypeNodes = once((): ReadonlyMap<string, FernNavigation.GraphQlTypeNode> => {\n return this.typeIdToGraphQlTypeNode;\n });\n\n /**\n * The type node documenting `typeId`, as seen from the node doing the asking.\n *\n * `fromNodeId` is the node that wants to link -- an operation page, typically. Its product,\n * variant and version are read from the tree, so a caller never has to know which of those\n * dimensions a given site uses, and a new dimension does not change this signature.\n *\n * There is deliberately no fallback to another scope: sending a reader in one version or\n * product to another's type page is worse than not linking, since the type may differ.\n */\n public getGraphQlTypeNodeFor = (\n fromNodeId: FernNavigation.NodeId,\n apiDefinitionId: FernNavigation.ApiDefinitionId,\n typeId: FernNavigation.TypeId\n ): FernNavigation.GraphQlTypeNode | undefined => {\n const parents = this.idToNodeParents.get(fromNodeId) ?? [];\n return this.typeIdToGraphQlTypeNode.get(graphQlTypeKey(apiDefinitionId, typeId, scopeOf(parents)));\n };\n\n /**\n * The operation page for `operationId`, as seen from the node doing the asking.\n *\n * Mirrors {@link getGraphQlTypeNodeFor}, for the operation half of a type page's \"referenced\n * by\" list: a type page names the queries and mutations that take or return it, and those\n * names have to become links. Resolves ids covered by a namespace-group node too.\n */\n public getGraphQlOperationNodeFor = (\n fromNodeId: FernNavigation.NodeId,\n apiDefinitionId: FernNavigation.ApiDefinitionId,\n operationId: FernNavigation.GraphQlOperationId\n ): FernNavigation.GraphQlNode | undefined => {\n const parents = this.idToNodeParents.get(fromNodeId) ?? [];\n return this.operationIdToGraphQlNode.get(graphQlOperationKey(apiDefinitionId, operationId, scopeOf(parents)));\n };\n\n /** Slug of the page documenting `operationId`. See {@link getGraphQlOperationNodeFor}. */\n public getGraphQlOperationSlugFor = (\n fromNodeId: FernNavigation.NodeId,\n apiDefinitionId: FernNavigation.ApiDefinitionId,\n operationId: FernNavigation.GraphQlOperationId\n ): FernNavigation.Slug | undefined => {\n return this.getGraphQlOperationNodeFor(fromNodeId, apiDefinitionId, operationId)?.slug;\n };\n\n /** Slug of the page documenting `typeId`. See {@link getGraphQlTypeNodeFor}. */\n public getGraphQlTypeSlugFor = (\n fromNodeId: FernNavigation.NodeId,\n apiDefinitionId: FernNavigation.ApiDefinitionId,\n typeId: FernNavigation.TypeId\n ): FernNavigation.Slug | undefined => {\n return this.getGraphQlTypeNodeFor(fromNodeId, apiDefinitionId, typeId)?.slug;\n };\n\n get defaultVersionNode(): FernNavigation.VersionNode | undefined {\n return this.defaultVersion;\n }\n\n get defaultProductNode(): FernNavigation.ProductNode | undefined {\n return this.defaultProduct;\n }\n\n get defaultVariantNode(): FernNavigation.VariantNode | undefined {\n return this.defaultVariant;\n }\n\n public get(id: FernNavigation.NodeId): FernNavigation.NavigationNode | undefined {\n return this.idToNode.get(id);\n }\n\n public getParents(id: FernNavigation.NodeId): readonly FernNavigation.NavigationNodeParent[] {\n return this.idToNodeParents.get(id) ?? EMPTY_ARRAY;\n }\n\n private getSlugMapWithParentsOnce = once(\n (): ReadonlyMap<FernNavigation.Slug, NavigationNodeWithMetadataAndParents> => {\n return withCanonicalLookup(this.slugToNode);\n }\n );\n\n public getSlugMapWithParents = (): ReadonlyMap<FernNavigation.Slug, NavigationNodeWithMetadataAndParents> => {\n return this.getSlugMapWithParentsOnce();\n };\n\n #getSlugs = once((): string[] => {\n return [...this.slugToNode.keys()];\n });\n get slugs(): string[] {\n return this.#getSlugs();\n }\n\n /**\n * Returns a list of slugs for all pages in the navigation tree.\n *\n * This includes hidden pages and noindex pages, but not authed pages, and is intended for revalidation purposes.\n *\n * @returns {string[]} A list of slugs for all canonical pages in the navigation tree.\n */\n #getStaticPageSlugs = once((): string[] => {\n return Array.from(\n new Set(\n [...this.slugToNode.values()]\n .filter(({ node }) => isPage(node))\n .filter(({ node }) => !node.authed)\n .map(({ node }) => node.slug)\n )\n );\n });\n get staticPageSlugs(): string[] {\n return this.#getStaticPageSlugs();\n }\n\n /**\n * Returns all page slugs grouped by auth requirement for revalidation.\n * Each page is categorized as either requiring auth or not based on the node's authed property.\n * Also collects unique roles from the `viewers` field of authed nodes.\n *\n * Filters applied:\n * - Pages under deprecated versions are excluded.\n * - Old changelog entries are excluded: per changelog, only the last 6 months\n * or the last 15 entries (whichever keeps more) are warmed.\n */\n #getRevalidationPageSlugs = once(\n (): {\n authedSlugs: string[];\n unauthedSlugs: string[];\n authedRoles: string[];\n skippedDeprecatedVersionSlugs: number;\n skippedOldChangelogSlugs: number;\n } => {\n const authedSlugs: string[] = [];\n const unauthedSlugs: string[] = [];\n const rolesSet = new Set<string>();\n const seenSlugs = new Set<string>();\n\n // --- Build set of old changelog entry IDs to exclude ---\n const excludedChangelogIds = buildExcludedChangelogEntryIds(this.slugToNode);\n\n let skippedDeprecatedVersionSlugs = 0;\n let skippedOldChangelogSlugs = 0;\n\n for (const { node, parents } of this.slugToNode.values()) {\n if (!isPage(node)) {\n continue;\n }\n if (seenSlugs.has(node.slug)) {\n continue;\n }\n seenSlugs.add(node.slug);\n\n if (isUnderDeprecatedVersion(parents)) {\n skippedDeprecatedVersionSlugs++;\n continue;\n }\n\n if (node.type === \"changelogEntry\" && excludedChangelogIds.has(node.id)) {\n skippedOldChangelogSlugs++;\n continue;\n }\n\n if (node.authed) {\n authedSlugs.push(node.slug);\n if (node.viewers != null) {\n for (const role of node.viewers) {\n rolesSet.add(role);\n }\n }\n } else {\n unauthedSlugs.push(node.slug);\n }\n }\n\n return {\n authedSlugs,\n unauthedSlugs,\n authedRoles: Array.from(rolesSet),\n skippedDeprecatedVersionSlugs,\n skippedOldChangelogSlugs\n };\n }\n );\n get revalidationPageSlugs(): {\n authedSlugs: string[];\n unauthedSlugs: string[];\n authedRoles: string[];\n skippedDeprecatedVersionSlugs: number;\n skippedOldChangelogSlugs: number;\n } {\n return this.#getRevalidationPageSlugs();\n }\n\n /**\n * Returns slugs for redirect/container nodes (product, version, tab, section, etc.)\n * that have a `pointsTo` target but are not pages themselves. These slugs need to be\n * warmed during revalidation because clicking a product switcher or version selector\n * navigates to the container slug, which must resolve via the Full Route Cache.\n *\n * Excludes redirect slugs under deprecated versions.\n */\n #getRevalidationRedirectSlugs = once((): string[] => {\n const redirectSlugs: string[] = [];\n const seenSlugs = new Set<string>();\n\n for (const { node, parents } of this.slugToNode.values()) {\n if (isPage(node)) {\n continue;\n }\n if (!hasRedirect(node)) {\n continue;\n }\n if (seenSlugs.has(node.slug)) {\n continue;\n }\n if (isDeprecatedVersionNode(node) || isUnderDeprecatedVersion(parents)) {\n continue;\n }\n seenSlugs.add(node.slug);\n redirectSlugs.push(node.slug);\n }\n\n return redirectSlugs;\n });\n get revalidationRedirectSlugs(): string[] {\n return this.#getRevalidationRedirectSlugs();\n }\n\n /**\n * Returns a list of slugs for pages that should be indexed by search engines, and by algolia.\n *\n * This excludes hidden pages and noindex pages, and uses the canonical slug if it exists.\n */\n #getIndexablePageSlugs = once((): string[] => {\n return Array.from(\n new Set(\n [...this.slugToNode.values()]\n .filter(({ node }) => isPage(node))\n .filter(({ node }) => !node.hidden && !node.authed)\n .filter(({ node }) => node.type !== \"changelogEntry\")\n .filter(({ node }) => !isNoindexNode(node))\n .map(({ node }) => node.canonicalSlug ?? node.slug)\n )\n );\n });\n get indexablePageSlugs(): string[] {\n return this.#getIndexablePageSlugs();\n }\n\n #getIndexablePageNodesWithAuth = once((): NavigationNodeWithMetadata[] => {\n const slugRecord: Record<string, NavigationNodeWithMetadata> = {};\n\n [...this.slugToNode.values()]\n .filter(({ node }) => isPage(node))\n .filter(({ node }) => !node.hidden)\n .filter(({ node }) => !isNoindexNode(node))\n .forEach((node) => {\n const canonicalSlug = node.node.canonicalSlug ?? node.node.slug;\n // Only keep the first node we see for each canonical slug\n if (!(canonicalSlug in slugRecord)) {\n slugRecord[canonicalSlug] = node.node;\n }\n });\n\n return Object.values(slugRecord);\n });\n get indexablePageNodesWithAuth(): NavigationNodeWithMetadata[] {\n return this.#getIndexablePageNodesWithAuth();\n }\n\n public getProductNodes = (): FernNavigation.ProductNode[] => {\n return this.productNodes;\n };\n\n public getVersionNodes = (): FernNavigation.VersionNode[] => {\n return this.versionNodes;\n };\n\n public getVariantNodes = (): FernNavigation.VariantNode[] => {\n return this.variantNodes;\n };\n\n public getNodesInOrder = (): FernNavigation.NavigationNode[] => {\n return this.nodesInOrder;\n };\n\n /**\n * The distinct RBAC roles referenced anywhere in the navigation, collected from every node's\n * `viewers`. This is the authoritative source of \"which roles gate content on this site\" — the\n * top-level `root.roles` is not populated by the nav builders, and docs.yml's declared `roles`\n * list is not serialized into the docs definition, so the roles that actually exist are the ones\n * appearing in node `viewers` (e.g. the implicit `everyone` plus any custom roles like `beta`).\n *\n * NOTE: this is a faithful collection of every role in `viewers` — it INCLUDES the implicit\n * `everyone` role when present (kept deliberately, so callers can e.g. detect whether a site uses\n * RBAC at all). Consumers that want only masquerade-able custom roles MUST filter `everyone`\n * themselves (the preview widget does this via `EVERYONE_ROLE`).\n */\n public getRoles = once((): FernNavigation.RoleId[] => {\n const roles = new Set<FernNavigation.RoleId>();\n for (const node of this.nodesInOrder) {\n const viewers = (node as { viewers?: FernNavigation.RoleId[] }).viewers;\n if (viewers != null) {\n for (const role of viewers) {\n roles.add(role);\n }\n }\n }\n return Array.from(roles);\n });\n}\n\n// ---------------------------------------------------------------------------\n// Helpers for revalidation filtering\n// ---------------------------------------------------------------------------\n\nconst MAX_CHANGELOG_ENTRIES_MINIMUM = 15;\nconst CHANGELOG_RECENCY_MONTHS = 6;\n\nfunction isDeprecatedVersionNode(node: FernNavigation.NavigationNode): boolean {\n return node.type === \"version\" && node.availability === \"Deprecated\";\n}\n\nfunction isUnderDeprecatedVersion(parents: readonly FernNavigation.NavigationNodeParent[]): boolean {\n return parents.some((p) => isDeprecatedVersionNode(p));\n}\n\n/**\n * For each changelog in the navigation tree, determines which old entries\n * should be excluded from warming. Keeps the last 6 months of entries or\n * the last 15 entries, whichever is more.\n */\nfunction buildExcludedChangelogEntryIds(\n slugToNode: ReadonlyMap<FernNavigation.Slug, NavigationNodeWithMetadataAndParents>\n): Set<FernNavigation.NodeId> {\n const changelogGroups = new Map<\n FernNavigation.NodeId,\n { node: FernNavigation.ChangelogEntryNode; parents: readonly FernNavigation.NavigationNodeParent[] }[]\n >();\n\n for (const { node, parents } of slugToNode.values()) {\n if (node.type !== \"changelogEntry\") {\n continue;\n }\n const changelogParent = parents.find((p) => p.type === \"changelog\");\n if (changelogParent == null) {\n continue;\n }\n let group = changelogGroups.get(changelogParent.id);\n if (group == null) {\n group = [];\n changelogGroups.set(changelogParent.id, group);\n }\n group.push({ node, parents });\n }\n\n const excluded = new Set<FernNavigation.NodeId>();\n const cutoff = new Date();\n cutoff.setMonth(cutoff.getMonth() - CHANGELOG_RECENCY_MONTHS);\n\n for (const entries of changelogGroups.values()) {\n // sort newest-first\n const sorted = [...entries].sort((a, b) => new Date(b.node.date).getTime() - new Date(a.node.date).getTime());\n const recentCount = sorted.filter((e) => new Date(e.node.date) >= cutoff).length;\n const keepCount = Math.max(recentCount, MAX_CHANGELOG_ENTRIES_MINIMUM);\n\n for (let i = keepCount; i < sorted.length; i++) {\n excluded.add(sorted[i]!.node.id);\n }\n }\n\n return excluded;\n}\n","/**\n * Returns the canonical form of a slug used as a key in the slug-to-node map.\n *\n * Slugs can arrive in two shapes:\n * - Raw Unicode (e.g. \"📝-support\")\n * - Percent-encoded ASCII (e.g. \"%F0%9F%93%9D-support\")\n *\n * Nav trees built from different code paths historically stored the former,\n * while request-time route params (after middleware percent-encoding) arrive\n * as the latter. Normalizing both sides to the decoded form ensures lookups\n * succeed regardless of which representation either side produced.\n *\n * decodeURIComponent is idempotent for plain ASCII and raw Unicode, so ASCII\n * slugs are unaffected. Malformed input (bare `%` not followed by two hex\n * digits) falls back to the original string — this preserves the existing\n * miss behavior for fuzzing/garbage traffic rather than throwing.\n *\n * Generic over the string-like input so branded types (e.g. `FernNavigation.Slug`)\n * flow through without requiring `as` casts at call sites.\n */\nexport function canonicalSlugKey<T extends string>(slug: T): T {\n try {\n return decodeURIComponent(slug) as T;\n } catch {\n return slug;\n }\n}\n","export * from \"../../../orpc-client/api/shared.js\";\nexport * from \"../../../orpc-client/shared.js\";\nexport * from \"../../types/v1.js\";\nexport * from \"./convertAvailability\";\nexport * from \"./converters/ApiReferenceNavigationConverter\";\nexport * from \"./converters/SlugGenerator\";\nexport * from \"./converters/toRootNode\";\nexport * from \"./followRedirect\";\nexport * from \"./getPageId\";\nexport * from \"./NavigationNode\";\nexport * from \"./NavigationNodeApiLeaf\";\nexport * from \"./NavigationNodeLeaf\";\nexport * from \"./NavigationNodeMarkdown\";\nexport * from \"./NavigationNodeNeighbor\";\nexport * from \"./NavigationNodePage\";\nexport * from \"./NavigationNodePageLeaf\";\nexport * from \"./NavigationNodeSection\";\nexport * from \"./NavigationNodeSectionOverview\";\nexport * from \"./NavigationNodeWithMetadata\";\nexport * from \"./NavigationNodeWithRedirect\";\nexport * from \"./slugjoin\";\nexport * from \"./toDefaultSlug\";\nexport * from \"./traverseDF\";\n","import type {\n EndpointId,\n EnvironmentId,\n FileId,\n GraphQlOperationId,\n GraphQlOperationType,\n GraphQlTypeCategory,\n TypeId,\n WebhookId,\n WebSocketId\n} from \"../../orpc-client/api/shared.js\";\nimport type {\n AnnouncementConfig,\n ApiDefinitionId,\n GrpcId,\n GrpcMethod,\n HttpMethod,\n LinkTarget,\n PageId,\n RoleId,\n Url,\n VersionId\n} from \"../../orpc-client/shared.js\";\nimport type { FeatureFlagOptions, WithFeatureFlags } from \"./latest.js\";\n\nexport type Slug = string & {\n navigation_v1_Slug: void;\n};\n\nexport function Slug(value: string): Slug {\n return value as unknown as Slug;\n}\n\nexport type TabId = string & {\n navigation_v1_TabId: void;\n};\n\nexport function TabId(value: string): TabId {\n return value as unknown as TabId;\n}\n\nexport type NodeId = string & {\n navigation_v1_NodeId: void;\n};\n\nexport function NodeId(value: string): NodeId {\n return value as unknown as NodeId;\n}\n\nexport type ProductId = string & {\n navigation_v1_ProductId: void;\n};\n\nexport function ProductId(value: string): ProductId {\n return value as unknown as ProductId;\n}\n\nexport type VariantId = string & {\n navigation_v1_VariantId: void;\n};\n\nexport function VariantId(value: string): VariantId {\n return value as unknown as VariantId;\n}\n\nexport const NavigationV1Availability = {\n Alpha: \"alpha\",\n Stable: \"stable\",\n GenerallyAvailable: \"generally-available\",\n InDevelopment: \"in-development\",\n PreRelease: \"pre-release\",\n Beta: \"beta\",\n Preview: \"preview\",\n Deprecated: \"deprecated\",\n Legacy: \"legacy\"\n} as const;\nexport type NavigationV1Availability = (typeof NavigationV1Availability)[keyof typeof NavigationV1Availability];\n\nexport type RootChild = VersionedNode | UnversionedNode | ProductGroupNode;\n\nexport type ProductNode = InternalProductNode | ExternalProductNode;\n\nexport type ProductChild = VersionedNode | UnversionedNode;\n\nexport type VersionChild = TabbedNode | SidebarRootNode | VariantedNode;\n\nexport type VariantChild = ApiReferenceNode | SectionNode | SidebarGroupNode | PageNode | LinkNode | ChangelogNode;\n\nexport type TabChild = TabNode | LinkNode | ChangelogNode;\n\nexport type SidebarRootChild = SidebarGroupNode | ApiReferenceNode | SectionNode | VariantedNode;\n\nexport type NavigationChild = ApiReferenceNode | SectionNode | PageNode | LinkNode | ChangelogNode | VariantedNode;\n\nexport type ApiPackageChild =\n | ApiPackageNode\n | EndpointNode\n | EndpointPairNode\n | WebSocketNode\n | WebhookNode\n | GrpcNode\n | GraphQlNode\n | GraphQlTypeNode\n | PageNode\n | LinkNode;\n\nexport interface WithNodeId {\n id: NodeId;\n collapsed: boolean | \"open-by-default\" | undefined;\n}\n\nexport interface WithPermissions {\n viewers: RoleId[] | undefined;\n orphaned: boolean | undefined;\n}\n\nexport interface WithNodeMetadata extends WithNodeId, WithPermissions, WithFeatureFlags {\n title: string;\n slug: Slug;\n icon: string | undefined;\n hidden: boolean | undefined;\n authed: boolean | undefined;\n}\n\nexport interface WithPage {\n pageId: PageId;\n noindex: boolean | undefined;\n}\n\nexport interface WithOverviewPage {\n overviewPageId: PageId | undefined;\n noindex: boolean | undefined;\n}\n\nexport interface WithApiDefinitionId {\n apiDefinitionId: ApiDefinitionId;\n availability: NavigationV1Availability | undefined;\n}\n\nexport interface WithRedirect {\n pointsTo: Slug | undefined;\n}\n\nexport interface PlaygroundButtonSettings {\n href: Url | undefined;\n}\n\nexport interface PlaygroundSettings {\n environments: EnvironmentId[] | undefined;\n button: PlaygroundButtonSettings | undefined;\n \"limit-websocket-messages-per-connection\": number | undefined;\n hidden: boolean | undefined;\n // when true, optional parameters that declare a default (or x-fern-default) are\n // pre-filled and sent from the API Explorer playground. defaults to false.\n \"send-optional-defaults\": boolean | undefined;\n}\n\nexport type { GraphQlOperationType };\n\nexport interface ProductGroupNode extends WithNodeId {\n type: \"productgroup\";\n landingPage: LandingPageNode | undefined;\n children: ProductNode[];\n /** Site-level changelog shared by all products; slugged off the root, not shown in the product switcher. */\n changelog?: ChangelogNode | undefined;\n}\n\nexport interface VersionedNode extends WithNodeId {\n type: \"versioned\";\n children: VersionNode[];\n}\n\nexport interface UnversionedNode extends WithNodeId {\n type: \"unversioned\";\n child: VersionChild;\n landingPage: LandingPageNode | undefined;\n}\n\nexport interface VariantedNode extends WithNodeId {\n type: \"varianted\";\n children: VariantNode[];\n}\n\nexport interface TabbedNode extends WithNodeId {\n type: \"tabbed\";\n children: TabChild[];\n}\n\nexport interface SidebarRootNode extends WithNodeId {\n type: \"sidebarRoot\";\n children: SidebarRootChild[];\n}\n\nexport interface SidebarGroupNode extends WithNodeId {\n type: \"sidebarGroup\";\n children: NavigationChild[];\n}\n\nexport interface EndpointPairNode extends WithNodeId {\n type: \"endpointPair\";\n stream: EndpointNode;\n nonStream: EndpointNode;\n}\n\nexport interface LinkNode extends WithNodeId {\n type: \"link\";\n title: string;\n icon: string | undefined;\n url: Url;\n target: LinkTarget | undefined;\n}\n\nexport interface RootNode extends WithNodeMetadata, WithRedirect {\n type: \"root\";\n version: \"v1\";\n child: RootChild;\n roles: RoleId[] | undefined;\n}\n\nexport interface InternalProductNode extends WithNodeMetadata, WithRedirect {\n type: \"product\";\n default: boolean;\n productId: ProductId;\n child: ProductChild;\n subtitle: string;\n image: FileId | undefined;\n announcement: AnnouncementConfig | undefined;\n}\n\nexport interface ExternalProductNode extends WithNodeId, WithPermissions {\n type: \"productLink\";\n default: boolean;\n productId: ProductId;\n title: string;\n href: Url;\n target: LinkTarget | undefined;\n subtitle: string;\n icon: string | undefined;\n image: FileId | undefined;\n hidden: boolean | undefined;\n authed: boolean | undefined;\n}\n\nexport interface VersionNode extends WithNodeMetadata, WithRedirect {\n type: \"version\";\n default: boolean;\n versionId: VersionId;\n child: VersionChild;\n availability: NavigationV1Availability | undefined;\n landingPage: LandingPageNode | undefined;\n announcement: AnnouncementConfig | undefined;\n}\n\nexport interface VariantNode extends WithNodeMetadata, WithRedirect {\n type: \"variant\";\n default: boolean;\n variantId: VariantId;\n subtitle: string | undefined;\n image: FileId | undefined;\n children: VariantChild[];\n}\n\nexport interface TabNode extends WithNodeMetadata, WithRedirect {\n type: \"tab\";\n child: SidebarRootNode;\n}\n\nexport interface PageNode extends WithNodeMetadata, WithPage {\n type: \"page\";\n availability: NavigationV1Availability | undefined;\n}\n\nexport interface LandingPageNode extends WithNodeMetadata, WithPage {\n type: \"landingPage\";\n}\n\nexport interface SectionNode extends WithNodeMetadata, WithOverviewPage, WithRedirect {\n type: \"section\";\n collapsible: boolean | undefined;\n collapsedByDefault: boolean | undefined;\n children: NavigationChild[];\n availability: NavigationV1Availability | undefined;\n}\n\nexport interface ChangelogNode extends WithNodeMetadata, WithOverviewPage {\n type: \"changelog\";\n children: ChangelogYearNode[];\n}\n\nexport interface ChangelogYearNode extends WithNodeMetadata {\n type: \"changelogYear\";\n year: number;\n children: ChangelogMonthNode[];\n}\n\nexport interface ChangelogMonthNode extends WithNodeMetadata {\n type: \"changelogMonth\";\n month: number;\n children: ChangelogEntryNode[];\n}\n\nexport interface ChangelogEntryNode extends WithNodeMetadata, WithPage {\n type: \"changelogEntry\";\n date: string;\n tags: string[] | undefined;\n}\n\nexport interface ApiReferenceNode extends WithNodeMetadata, WithOverviewPage, WithApiDefinitionId, WithRedirect {\n type: \"apiReference\";\n paginated: boolean | undefined;\n showErrors: boolean | undefined;\n hideTitle: boolean | undefined;\n children: ApiPackageChild[];\n changelog: ChangelogNode | undefined;\n playground: PlaygroundSettings | undefined;\n postmanCollectionUrl: string | undefined;\n}\n\nexport interface EndpointNode extends WithNodeMetadata, WithApiDefinitionId {\n noindex?: boolean | undefined;\n type: \"endpoint\";\n method: HttpMethod;\n endpointId: EndpointId;\n isResponseStream: boolean | undefined;\n playground: PlaygroundSettings | undefined;\n}\n\nexport interface WebSocketNode extends WithNodeMetadata, WithApiDefinitionId {\n noindex?: boolean | undefined;\n type: \"webSocket\";\n webSocketId: WebSocketId;\n playground: PlaygroundSettings | undefined;\n}\n\nexport interface WebhookNode extends WithNodeMetadata, WithApiDefinitionId {\n noindex?: boolean | undefined;\n type: \"webhook\";\n method: HttpMethod;\n webhookId: WebhookId;\n}\n\nexport interface GrpcNode extends WithNodeMetadata, WithApiDefinitionId {\n noindex?: boolean | undefined;\n type: \"grpc\";\n method: GrpcMethod;\n grpcId: GrpcId;\n}\n\nexport interface GraphQlNode extends WithNodeMetadata, WithApiDefinitionId {\n noindex?: boolean | undefined;\n type: \"graphql\";\n operationType: GraphQlOperationType;\n graphqlOperationId: GraphQlOperationId;\n /** Additional operation IDs when this node represents a namespace group (e.g. fieldPath grouping). */\n graphqlOperationIds: GraphQlOperationId[] | undefined;\n playground: PlaygroundSettings | undefined;\n}\n\n/**\n * A navigation node representing a single GraphQL schema type (object, input,\n * enum, scalar, interface, or union) as opposed to a GraphQL operation.\n *\n * Mirrors {@link FernNavigation.GraphQlTypeNode} in the latest model; this is the\n * shape the CLI writes, which the v1 -> latest migrator converts.\n */\nexport interface GraphQlTypeNode extends WithNodeMetadata, WithApiDefinitionId {\n noindex?: boolean | undefined;\n type: \"graphqlType\";\n typeId: TypeId;\n typeCategory: GraphQlTypeCategory;\n}\n\nexport interface ApiPackageNode extends WithNodeMetadata, WithOverviewPage, WithApiDefinitionId, WithRedirect {\n type: \"apiPackage\";\n children: ApiPackageChild[];\n playground: PlaygroundSettings | undefined;\n}\n\nexport { type FeatureFlagOptions, type WithFeatureFlags };\n","import { UnreachableCaseError } from \"ts-essentials\";\n\nimport { FernNavigation } from \"../../..\";\nimport { FdrAPI } from \"../../../client/types\";\n\nexport function convertAvailability(\n availability: FdrAPI.Availability | null | undefined\n): FernNavigation.V1.NavigationV1Availability | undefined {\n if (availability == null) {\n return undefined;\n }\n switch (availability) {\n case FdrAPI.Availability.Alpha:\n return FernNavigation.V1.NavigationV1Availability.Alpha;\n case FdrAPI.Availability.Beta:\n return FernNavigation.V1.NavigationV1Availability.Beta;\n case FdrAPI.Availability.Stable:\n return FernNavigation.V1.NavigationV1Availability.Stable;\n case FdrAPI.Availability.GenerallyAvailable:\n return FernNavigation.V1.NavigationV1Availability.GenerallyAvailable;\n case FdrAPI.Availability.Preview:\n return FernNavigation.V1.NavigationV1Availability.Preview;\n case FdrAPI.Availability.Deprecated:\n return FernNavigation.V1.NavigationV1Availability.Deprecated;\n case FdrAPI.Availability.Legacy:\n return FernNavigation.V1.NavigationV1Availability.Legacy;\n case FdrAPI.Availability.InDevelopment:\n return FernNavigation.V1.NavigationV1Availability.InDevelopment;\n case FdrAPI.Availability.PreRelease:\n return FernNavigation.V1.NavigationV1Availability.PreRelease;\n default:\n throw new UnreachableCaseError(availability);\n }\n}\n","export * from \"../orpc-client/api/contract-db.js\";\nexport * from \"../orpc-client/api/contract-register.js\";\nexport * from \"../orpc-client/api/shared.js\";\n\n// Re-export constructor functions and types from shared that aren't in api/shared\n// Note: ApiDefinitionIdSchema is already re-exported via api/shared.js\nexport { ApiDefinitionId, DocsConfigId, DocsConfigIdSchema } from \"../orpc-client/shared.js\";\n","// Re-export types from contract-db that consumers depend on\nexport { type EndpointSnippetTemplates, EndpointSnippetTemplatesSchema } from \"../orpc-client/api/contract-db.js\";\nexport * from \"../orpc-client/api/contract-read.js\";\n// Backward-compatible type aliases (Read-prefixed → unprefixed)\nexport {\n type ReadApiDefinition as ApiDefinition,\n type ReadApiDefinitionPackage as ApiDefinitionPackage,\n ReadApiDefinitionPackageSchema as ApiDefinitionPackageSchema,\n ReadApiDefinitionSchema as ApiDefinitionSchema,\n type ReadApiDefinitionSubpackage as ApiDefinitionSubpackage,\n ReadApiDefinitionSubpackageSchema as ApiDefinitionSubpackageSchema,\n type ReadBytesRequest as BytesRequest,\n ReadBytesRequestSchema as BytesRequestSchema,\n type ReadCodeExamples as CodeExamples,\n ReadCodeExamplesSchema as CodeExamplesSchema,\n type ReadCsharpSnippet as CsharpSnippet,\n ReadCsharpSnippetSchema as CsharpSnippetSchema,\n type ReadCustomCodeSample as CustomCodeSample,\n ReadCustomCodeSampleSchema as CustomCodeSampleSchema,\n type ReadEndpointDefinition as EndpointDefinition,\n ReadEndpointDefinitionSchema as EndpointDefinitionSchema,\n type ReadErrorDeclarationV2 as ErrorDeclarationV2,\n ReadErrorDeclarationV2Schema as ErrorDeclarationV2Schema,\n type ReadExampleEndpointCall as ExampleEndpointCall,\n ReadExampleEndpointCallSchema as ExampleEndpointCallSchema,\n type ReadGoSnippet as GoSnippet,\n ReadGoSnippetSchema as GoSnippetSchema,\n type ReadHttpRequest as HttpRequest,\n type ReadHttpRequestBodyShape as HttpRequestBodyShape,\n ReadHttpRequestBodyShapeSchema as HttpRequestBodyShapeSchema,\n ReadHttpRequestSchema as HttpRequestSchema,\n type ReadHttpRequestsV2 as HttpRequestsV2,\n ReadHttpRequestsV2Schema as HttpRequestsV2Schema,\n type ReadHttpResponse as HttpResponse,\n type ReadHttpResponseBodyShape as HttpResponseBodyShape,\n ReadHttpResponseBodyShapeSchema as HttpResponseBodyShapeSchema,\n ReadHttpResponseSchema as HttpResponseSchema,\n type ReadHttpResponsesV2 as HttpResponsesV2,\n ReadHttpResponsesV2Schema as HttpResponsesV2Schema,\n type ReadLanguage as Language,\n ReadLanguageSchema as LanguageSchema,\n type ReadNonStreamResponse as NonStreamResponse,\n ReadNonStreamResponseSchema as NonStreamResponseSchema,\n type ReadPythonSnippet as PythonSnippet,\n ReadPythonSnippetSchema as PythonSnippetSchema,\n type ReadRubySnippet as RubySnippet,\n ReadRubySnippetSchema as RubySnippetSchema,\n type ReadStreamConditionResponse as StreamConditionResponse,\n ReadStreamConditionResponseSchema as StreamConditionResponseSchema,\n type ReadStreamResponse as StreamResponse,\n ReadStreamResponseSchema as StreamResponseSchema,\n type ReadSupportedLanguage as SupportedLanguage,\n ReadSupportedLanguageSchema as SupportedLanguageSchema,\n type ReadTypeDefinition as TypeDefinition,\n ReadTypeDefinitionSchema as TypeDefinitionSchema,\n type ReadTypeShape as TypeShape,\n ReadTypeShapeSchema as TypeShapeSchema,\n type ReadTypescriptSnippet as TypescriptSnippet,\n ReadTypescriptSnippetSchema as TypescriptSnippetSchema,\n type ReadUndiscriminatedUnionType as UndiscriminatedUnionType,\n ReadUndiscriminatedUnionTypeSchema as UndiscriminatedUnionTypeSchema,\n type ReadUndiscriminatedUnionVariant as UndiscriminatedUnionVariant,\n ReadUndiscriminatedUnionVariantSchema as UndiscriminatedUnionVariantSchema,\n type ReadWebhookDefinition as WebhookDefinition,\n ReadWebhookDefinitionSchema as WebhookDefinitionSchema,\n type ReadWebSocketChannel as WebSocketChannel,\n ReadWebSocketChannelSchema as WebSocketChannelSchema\n} from \"../orpc-client/api/contract-read.js\";\nexport * from \"../orpc-client/api/contract-register.js\";\nexport * from \"../orpc-client/api/shared.js\";\n// Re-export GrpcMethod and Availability from shared (const objects for value access like GrpcMethod.Unary, Availability.Stable)\nexport { Availability, GrpcMethod } from \"../orpc-client/shared.js\";\n\n// Namespace re-exports for backward compatibility\nimport type { OAuthClientCredentialsReferencedEndpoint } from \"../orpc-client/api/shared.js\";\nexport declare namespace OAuthClientCredentials {\n export type ReferencedEndpoint = OAuthClientCredentialsReferencedEndpoint;\n}\n\n// Const value object for WebSocketMessageOrigin (consumers use APIV1Read.WebSocketMessageOrigin.Client, etc.)\nexport const WebSocketMessageOrigin = {\n Client: \"client\",\n Server: \"server\"\n} as const;\n\nexport type WebSocketMessageOrigin = (typeof WebSocketMessageOrigin)[keyof typeof WebSocketMessageOrigin];\n","export * from \"../orpc-client/api/contract-register.js\";\n// Backward-compatible type aliases (Register-prefixed → unprefixed)\nexport {\n type DynamicIR as DynamicIr,\n type RegisterApiDefinition as ApiDefinition,\n type RegisterApiDefinitionPackage as ApiDefinitionPackage,\n RegisterApiDefinitionPackageSchema as ApiDefinitionPackageSchema,\n type RegisterApiDefinitionResponse as ApiDefinitionResponse,\n RegisterApiDefinitionResponseSchema as ApiDefinitionResponseSchema,\n RegisterApiDefinitionSchema as ApiDefinitionSchema,\n type RegisterApiDefinitionSubpackage as ApiDefinitionSubpackage,\n RegisterApiDefinitionSubpackageSchema as ApiDefinitionSubpackageSchema,\n type RegisterBytesRequest as BytesRequest,\n RegisterBytesRequestSchema as BytesRequestSchema,\n type RegisterCustomCodeSample as CustomCodeSample,\n RegisterCustomCodeSampleSchema as CustomCodeSampleSchema,\n type RegisterEndpointDefinition as EndpointDefinition,\n RegisterEndpointDefinitionSchema as EndpointDefinitionSchema,\n type RegisterErrorDeclarationV2 as ErrorDeclarationV2,\n RegisterErrorDeclarationV2Schema as ErrorDeclarationV2Schema,\n type RegisterExampleEndpointCall as ExampleEndpointCall,\n RegisterExampleEndpointCallSchema as ExampleEndpointCallSchema,\n type RegisterHttpRequest as HttpRequest,\n type RegisterHttpRequestBodyShape as HttpRequestBodyShape,\n RegisterHttpRequestBodyShapeSchema as HttpRequestBodyShapeSchema,\n RegisterHttpRequestSchema as HttpRequestSchema,\n type RegisterHttpRequestsV2 as HttpRequestsV2,\n RegisterHttpRequestsV2Schema as HttpRequestsV2Schema,\n type RegisterHttpResponse as HttpResponse,\n type RegisterHttpResponseBodyShape as HttpResponseBodyShape,\n RegisterHttpResponseBodyShapeSchema as HttpResponseBodyShapeSchema,\n RegisterHttpResponseSchema as HttpResponseSchema,\n type RegisterHttpResponsesV2 as HttpResponsesV2,\n RegisterHttpResponsesV2Schema as HttpResponsesV2Schema,\n type RegisterJsonRequestBody as JsonRequestBody,\n RegisterJsonRequestBodySchema as JsonRequestBodySchema,\n type RegisterLanguage as Language,\n RegisterLanguageSchema as LanguageSchema,\n type RegisterNonStreamResponse as NonStreamResponse,\n RegisterNonStreamResponseSchema as NonStreamResponseSchema,\n type RegisterStreamConditionResponse as StreamConditionResponse,\n RegisterStreamConditionResponseSchema as StreamConditionResponseSchema,\n type RegisterStreamResponse as StreamResponse,\n RegisterStreamResponseSchema as StreamResponseSchema,\n type RegisterTypeDefinition as TypeDefinition,\n RegisterTypeDefinitionSchema as TypeDefinitionSchema,\n type RegisterTypeShape as TypeShape,\n RegisterTypeShapeSchema as TypeShapeSchema,\n type RegisterUndiscriminatedUnionType as UndiscriminatedUnionType,\n RegisterUndiscriminatedUnionTypeSchema as UndiscriminatedUnionTypeSchema,\n type RegisterUndiscriminatedUnionVariant as UndiscriminatedUnionVariant,\n RegisterUndiscriminatedUnionVariantSchema as UndiscriminatedUnionVariantSchema,\n type RegisterWebhookDefinition as WebhookDefinition,\n RegisterWebhookDefinitionSchema as WebhookDefinitionSchema,\n type RegisterWebSocketChannel as WebSocketChannel,\n RegisterWebSocketChannelSchema as WebSocketChannelSchema\n} from \"../orpc-client/api/contract-register.js\";\nexport * from \"../orpc-client/api/shared.js\";\n// Re-export EndpointPathLiteral constructor from shared\nexport { EndpointPathLiteral } from \"../orpc-client/shared.js\";\n","export * from \"./docs-types/db\";\n","import * as z from \"zod\";\n\nimport type { RootNode } from \"../../navigation/types/v1.js\";\nimport type { PageId, Url } from \"./db-commons\";\nimport {\n ApiDefinitionIdSchema,\n AvailabilitySchema,\n FileIdSchema,\n PageIdSchema,\n UrlSchema,\n VersionIdSchema\n} from \"./db-commons\";\nimport {\n AgentsConfigSchema,\n AIChatConfigSchema,\n AnalyticsConfigSchema,\n AnnouncementConfigSchema,\n ColorsConfigSchema,\n ColorsConfigV2Schema,\n CssConfigSchema,\n DocsLayoutConfigSchema,\n DocsSettingsConfigSchema,\n DocsThemeConfigSchema,\n DocsTypographyConfigSchema,\n DocsTypographyConfigV2Schema,\n EditThisPageLaunchSchema,\n FooterLinkSchema,\n IframeConfigSchema,\n IntegrationsConfigSchema,\n JsConfigSchema,\n LanguageSchema,\n MetadataConfigSchema,\n NavbarLinkSchema,\n PageActionsConfigSchema,\n ProgrammingLanguageSchema,\n RedirectConfigSchema,\n ThemedFileIdSchema\n} from \"./db-docsCommons\";\nimport {\n ApiArtifactsSchema,\n ApiNavigationConfigRootSchema,\n ApiSectionV2Schema,\n ChangelogSectionSchema,\n ChangelogSectionV3Schema,\n ColorsConfigV3Schema,\n HeightSchema,\n LinkMetadataSchema,\n NavigationTabLinkSchema,\n PageContentSchema,\n PageMetadataSchema\n} from \"./db-docsRead\";\nimport { DocsTranslationsConfigSchema } from \"./shared\";\n\nexport const DbFileInfoSchema = z.object({\n s3Key: z.string()\n});\nexport type DbFileInfo = z.infer<typeof DbFileInfoSchema>;\n\nexport const DbImageFileInfoSchema = z.object({\n s3Key: z.string(),\n width: z.number(),\n height: z.number(),\n blurDataUrl: z.string().optional(),\n alt: z.string().optional()\n});\nexport type DbImageFileInfo = z.infer<typeof DbImageFileInfoSchema>;\n\nexport const DbFileInfoV2Schema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"s3Key\"), ...DbFileInfoSchema.shape }),\n z.object({ type: z.literal(\"image\"), ...DbImageFileInfoSchema.shape })\n]);\nexport type DbFileInfoV2 = z.infer<typeof DbFileInfoV2Schema>;\n\nexport const NavigationTabGroupSchema: z.ZodType<NavigationTabGroup> = z.lazy(() =>\n z.object({\n title: z.string(),\n icon: z.string().optional(),\n items: z.array(NavigationItemSchema),\n urlSlug: z.string(),\n skipUrlSlug: z.boolean().optional()\n })\n);\n\nexport interface NavigationTabGroup {\n title: string;\n icon?: string;\n items: NavigationItem[];\n urlSlug: string;\n skipUrlSlug?: boolean;\n}\n\nexport const NavigationTabSchema = z.union([NavigationTabGroupSchema, NavigationTabLinkSchema]);\nexport type NavigationTab = z.infer<typeof NavigationTabSchema>;\n\nexport const NavigationTabV2Schema: z.ZodType<NavigationTabV2> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"group\"),\n title: z.string(),\n icon: z.string().optional(),\n items: z.array(NavigationItemSchema),\n urlSlug: z.string(),\n skipUrlSlug: z.boolean().optional()\n }),\n z.object({ type: z.literal(\"link\"), ...NavigationTabLinkSchema.shape }),\n z.object({ type: z.literal(\"changelog\"), ...ChangelogSectionSchema.shape }),\n z.object({ type: z.literal(\"changelogV3\"), ...ChangelogSectionV3Schema.shape })\n ])\n) as z.ZodType<NavigationTabV2>;\n\nexport type NavigationTabV2 =\n | NavigationTabV2.Group\n | NavigationTabV2.Link\n | NavigationTabV2.Changelog\n | NavigationTabV2.ChangelogV3;\n\nexport namespace NavigationTabV2 {\n export interface Group extends NavigationTabGroup {\n type: \"group\";\n }\n export interface Link {\n type: \"link\";\n title: string;\n icon?: string;\n url: Url;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\";\n }\n export interface Changelog {\n type: \"changelog\";\n icon?: string;\n hidden?: boolean;\n urlSlug: string;\n fullSlug?: string[];\n title?: string;\n description?: string;\n pageId?: PageId;\n items: Array<{ date: string; pageId: PageId; tags?: string[] }>;\n }\n export interface ChangelogV3 {\n type: \"changelogV3\";\n node?: unknown;\n }\n}\n\nexport const ApiSectionSchema = z.object({\n title: z.string(),\n icon: z.string().optional(),\n api: ApiDefinitionIdSchema,\n urlSlug: z.string(),\n skipUrlSlug: z.boolean(),\n artifacts: ApiArtifactsSchema.optional(),\n showErrors: z.boolean().optional(),\n changelog: ChangelogSectionSchema.optional(),\n hidden: z.boolean().optional(),\n fullSlug: z.array(z.string()).optional(),\n navigation: ApiNavigationConfigRootSchema.optional(),\n longScrolling: z.boolean().optional(),\n flattened: z.boolean().optional()\n});\nexport type ApiSection = z.infer<typeof ApiSectionSchema>;\n\nexport type DocsSection = {\n title: string;\n icon?: string;\n items: NavigationItem[];\n urlSlug: string;\n skipUrlSlug: boolean;\n collapsed: boolean | \"open-by-default\";\n collapsible?: boolean;\n collapsedByDefault?: boolean;\n hidden?: boolean;\n fullSlug?: string[];\n overviewPageId?: PageId;\n};\n\nexport const DocsSectionSchema: z.ZodType<DocsSection> = z.lazy(() =>\n z.object({\n title: z.string(),\n icon: z.string().optional(),\n items: z.array(NavigationItemSchema),\n urlSlug: z.string(),\n skipUrlSlug: z.boolean(),\n collapsed: z.union([z.boolean(), z.literal(\"open-by-default\")]),\n collapsible: z.boolean().optional(),\n collapsedByDefault: z.boolean().optional(),\n hidden: z.boolean().optional(),\n fullSlug: z.array(z.string()).optional(),\n overviewPageId: PageIdSchema.optional()\n })\n);\n\nexport type NavigationItem =\n | NavigationItem.Page\n | NavigationItem.Api\n | NavigationItem.ApiV2\n | NavigationItem.Section\n | NavigationItem.Link\n | NavigationItem.Changelog\n | NavigationItem.ChangelogV3;\n\nexport namespace NavigationItem {\n export interface Page {\n type: \"page\";\n icon?: string;\n hidden?: boolean;\n urlSlug: string;\n fullSlug?: string[];\n id: PageId;\n title: string;\n }\n export interface Api extends ApiSection {\n type: \"api\";\n }\n export interface ApiV2 {\n type: \"apiV2\";\n node?: unknown;\n }\n export interface Section extends DocsSection {\n type: \"section\";\n }\n export interface Link {\n type: \"link\";\n title: string;\n icon?: string;\n url: Url;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\";\n }\n export interface Changelog {\n type: \"changelog\";\n icon?: string;\n hidden?: boolean;\n urlSlug: string;\n fullSlug?: string[];\n title?: string;\n description?: string;\n pageId?: PageId;\n items: Array<{ date: string; pageId: PageId; tags?: string[] }>;\n }\n export interface ChangelogV3 {\n type: \"changelogV3\";\n node?: unknown;\n }\n}\n\nexport const NavigationItemSchema: z.ZodType<NavigationItem> = z.lazy(() =>\n z.discriminatedUnion(\"type\", [\n z.object({\n type: z.literal(\"page\"),\n ...PageMetadataSchema.shape\n }),\n z.object({\n type: z.literal(\"api\"),\n ...ApiSectionSchema.shape\n }),\n z.object({\n type: z.literal(\"apiV2\"),\n ...ApiSectionV2Schema.shape\n }),\n z.object({\n type: z.literal(\"section\"),\n title: z.string(),\n icon: z.string().optional(),\n items: z.array(NavigationItemSchema),\n urlSlug: z.string(),\n skipUrlSlug: z.boolean(),\n collapsed: z.union([z.boolean(), z.literal(\"open-by-default\")]),\n collapsible: z.boolean().optional(),\n collapsedByDefault: z.boolean().optional(),\n hidden: z.boolean().optional(),\n fullSlug: z.array(z.string()).optional(),\n overviewPageId: PageIdSchema.optional()\n }),\n z.object({\n type: z.literal(\"link\"),\n ...LinkMetadataSchema.shape\n }),\n z.object({\n type: z.literal(\"changelog\"),\n ...ChangelogSectionSchema.shape\n }),\n z.object({\n type: z.literal(\"changelogV3\"),\n ...ChangelogSectionV3Schema.shape\n })\n ])\n) as z.ZodType<NavigationItem>;\n\nexport const UnversionedTabbedNavigationConfigSchema = z.object({\n tabs: z.array(NavigationTabSchema).optional(),\n tabsV2: z.array(NavigationTabV2Schema).optional(),\n landingPage: PageMetadataSchema.optional()\n});\nexport type UnversionedTabbedNavigationConfig = z.infer<typeof UnversionedTabbedNavigationConfigSchema>;\n\nexport const UnversionedUntabbedNavigationConfigSchema = z.object({\n items: z.array(NavigationItemSchema),\n landingPage: PageMetadataSchema.optional()\n});\nexport type UnversionedUntabbedNavigationConfig = z.infer<typeof UnversionedUntabbedNavigationConfigSchema>;\n\nexport const UnversionedNavigationConfigSchema = z.union([\n UnversionedTabbedNavigationConfigSchema,\n UnversionedUntabbedNavigationConfigSchema\n]);\nexport type UnversionedNavigationConfig = z.infer<typeof UnversionedNavigationConfigSchema>;\n\nexport const VersionedNavigationConfigDataSchema = z.object({\n version: VersionIdSchema,\n urlSlug: z.string().optional(),\n availability: AvailabilitySchema.optional(),\n config: UnversionedNavigationConfigSchema\n});\nexport type VersionedNavigationConfigData = z.infer<typeof VersionedNavigationConfigDataSchema>;\n\nexport const VersionedNavigationConfigSchema = z.object({\n versions: z.array(VersionedNavigationConfigDataSchema)\n});\nexport type VersionedNavigationConfig = z.infer<typeof VersionedNavigationConfigSchema>;\n\nexport const NavigationConfigSchema = z.union([UnversionedNavigationConfigSchema, VersionedNavigationConfigSchema]);\nexport type NavigationConfig = z.infer<typeof NavigationConfigSchema>;\n\nexport const DocsDbConfigSchema = z.object({\n title: z.string().optional(),\n defaultLanguage: ProgrammingLanguageSchema.optional(),\n languages: z.array(LanguageSchema).optional(),\n translations: DocsTranslationsConfigSchema.optional(),\n announcement: AnnouncementConfigSchema.optional(),\n navigation: NavigationConfigSchema.optional(),\n root: z.custom<RootNode>().optional(),\n navbarLinks: z.array(NavbarLinkSchema).optional(),\n footerLinks: z.array(FooterLinkSchema).optional(),\n hideNavLinks: z.boolean().optional(),\n logoHeight: HeightSchema.optional(),\n logoHref: UrlSchema.optional(),\n logoRightText: z.string().optional(),\n favicon: FileIdSchema.optional(),\n agents: AgentsConfigSchema.optional(),\n metadata: MetadataConfigSchema.optional(),\n redirects: z.array(RedirectConfigSchema).optional(),\n backgroundImage: FileIdSchema.optional(),\n colorsV3: ColorsConfigV3Schema.optional(),\n layout: DocsLayoutConfigSchema.optional(),\n theme: DocsThemeConfigSchema.optional(),\n globalTheme: z.string().optional(),\n settings: DocsSettingsConfigSchema.optional(),\n typographyV2: DocsTypographyConfigV2Schema.optional(),\n analyticsConfig: AnalyticsConfigSchema.optional(),\n integrations: IntegrationsConfigSchema.optional(),\n css: CssConfigSchema.optional(),\n js: JsConfigSchema.optional(),\n aiChatConfig: AIChatConfigSchema.optional(),\n pageActions: PageActionsConfigSchema.optional(),\n editThisPageLaunch: EditThisPageLaunchSchema.optional(),\n iframe: IframeConfigSchema.optional(),\n header: z.string().optional(),\n footer: z.string().optional(),\n logo: FileIdSchema.optional(),\n logoV2: ThemedFileIdSchema.optional(),\n colors: ColorsConfigSchema.optional(),\n colorsV2: ColorsConfigV2Schema.optional(),\n typography: DocsTypographyConfigSchema.optional()\n});\nexport type DocsDbConfig = z.infer<typeof DocsDbConfigSchema>;\n\nexport const DocsDefinitionDbV1Schema = z.object({\n pages: z.record(PageIdSchema, PageContentSchema),\n referencedApis: z.array(ApiDefinitionIdSchema),\n files: z.record(FileIdSchema, DbFileInfoSchema),\n config: DocsDbConfigSchema,\n colors: ColorsConfigSchema.optional()\n});\nexport type DocsDefinitionDbV1 = z.infer<typeof DocsDefinitionDbV1Schema>;\n\nexport const DocsDefinitionDbV2Schema = z.object({\n pages: z.record(PageIdSchema, PageContentSchema),\n referencedApis: z.array(ApiDefinitionIdSchema),\n files: z.record(FileIdSchema, DbFileInfoSchema),\n config: DocsDbConfigSchema,\n colors: ColorsConfigSchema.optional(),\n typography: DocsTypographyConfigSchema.optional()\n});\nexport type DocsDefinitionDbV2 = z.infer<typeof DocsDefinitionDbV2Schema>;\n\nexport const DocsDefinitionDbV3Schema = z.object({\n pages: z.record(PageIdSchema, PageContentSchema),\n referencedApis: z.array(ApiDefinitionIdSchema),\n files: z.record(FileIdSchema, DbFileInfoV2Schema),\n config: DocsDbConfigSchema,\n jsFiles: z.record(z.string(), z.string()).optional()\n});\nexport type DocsDefinitionDbV3 = z.infer<typeof DocsDefinitionDbV3Schema>;\n\nexport const DocsDefinitionDbSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"v1\"), ...DocsDefinitionDbV1Schema.shape }),\n z.object({ type: z.literal(\"v2\"), ...DocsDefinitionDbV2Schema.shape }),\n z.object({ type: z.literal(\"v3\"), ...DocsDefinitionDbV3Schema.shape })\n]);\nexport type DocsDefinitionDb = z.infer<typeof DocsDefinitionDbSchema>;\n\nexport namespace DocsDefinitionDb {\n export type V1 = DocsDefinitionDbV1 & { type: \"v1\" };\n export type V2 = DocsDefinitionDbV2 & { type: \"v2\" };\n export type V3 = DocsDefinitionDbV3 & { type: \"v3\" };\n}\n\nexport * from \"./db-commons\";\nexport * from \"./db-docsCommons\";\nexport * from \"./db-docsRead\";\n","import * as z from \"zod\";\n\nimport { FileIdSchema } from \"./db-commons\";\nimport { RgbaColorSchema } from \"./db-docsCommons\";\n\nexport type {\n ApiArtifacts,\n ApiNavigationConfigItem,\n ApiNavigationConfigRoot,\n ApiSectionV2,\n ChangelogItem,\n ChangelogSection,\n ChangelogSectionV3,\n GitHubRepo,\n Height,\n LinkMetadata,\n MavenPackage,\n NavigationNodeMetadata,\n NavigationTabLink,\n NpmPackage,\n PageContent,\n PageMetadata,\n PublishedPostmanCollection,\n PublishedSdk,\n PypiPackage\n} from \"./shared\";\nexport {\n ApiArtifactsSchema,\n ApiNavigationConfigItemSchema,\n ApiNavigationConfigRootSchema,\n ApiSectionV2Schema,\n ChangelogItemSchema,\n ChangelogSectionSchema,\n ChangelogSectionV3Schema,\n GitHubRepoSchema,\n HeightSchema,\n LinkMetadataSchema,\n MavenPackageSchema,\n NavigationNodeMetadataSchema,\n NavigationTabLinkSchema,\n NpmPackageSchema,\n PageContentSchema,\n PageMetadataSchema,\n PublishedPostmanCollectionSchema,\n PublishedSdkSchema,\n PypiPackageSchema\n} from \"./shared\";\n\nexport const BackgroundSchema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"solid\"), ...RgbaColorSchema.shape }),\n z.object({ type: z.literal(\"gradient\") })\n]);\nexport type Background = z.infer<typeof BackgroundSchema>;\n\nexport const ThemeConfigSchema = z.object({\n logo: FileIdSchema.optional(),\n backgroundImage: FileIdSchema.optional(),\n accentPrimary: RgbaColorSchema,\n background: BackgroundSchema,\n border: RgbaColorSchema.optional(),\n sidebarBackground: RgbaColorSchema.optional(),\n headerBackground: RgbaColorSchema.optional(),\n cardBackground: RgbaColorSchema.optional(),\n accent1: RgbaColorSchema.optional(),\n accent2: RgbaColorSchema.optional(),\n accent3: RgbaColorSchema.optional(),\n accent4: RgbaColorSchema.optional(),\n accent5: RgbaColorSchema.optional(),\n accent6: RgbaColorSchema.optional(),\n accent7: RgbaColorSchema.optional(),\n accent8: RgbaColorSchema.optional(),\n accent9: RgbaColorSchema.optional(),\n accent10: RgbaColorSchema.optional(),\n accent11: RgbaColorSchema.optional(),\n accent12: RgbaColorSchema.optional()\n});\nexport type ThemeConfig = z.infer<typeof ThemeConfigSchema>;\n\nexport const DarkAndLightModeConfigSchema = z.object({\n dark: ThemeConfigSchema,\n light: ThemeConfigSchema\n});\nexport type DarkAndLightModeConfig = z.infer<typeof DarkAndLightModeConfigSchema>;\n\nexport const ColorsConfigV3Schema = z.discriminatedUnion(\"type\", [\n z.object({ type: z.literal(\"dark\"), ...ThemeConfigSchema.shape }),\n z.object({ type: z.literal(\"light\"), ...ThemeConfigSchema.shape }),\n z.object({ type: z.literal(\"darkAndLight\"), ...DarkAndLightModeConfigSchema.shape })\n]);\nexport type ColorsConfigV3 = z.infer<typeof ColorsConfigV3Schema>;\n","export * from \"./docs-types/read\";\n","export * from \"./docs-types/write\";\n","// Flat re-exports (all types available directly as FdrAPI.*)\nexport * from \"../orpc-client/api/contract-db.js\";\nexport * from \"../orpc-client/api/contract-latest.js\";\nexport * from \"../orpc-client/api/contract-read.js\";\nexport * from \"../orpc-client/api/contract-register.js\";\nexport * from \"../orpc-client/api/shared.js\";\nexport * from \"../orpc-client/shared.js\";\n\n// Re-export types from oRPC sub-contracts that consumers use as FdrAPI.*\nexport { type SdkSnippetsCreate } from \"../orpc-client/snippets/contract.js\";\nexport {\n type EndpointSnippetTemplate as EndpointSnippetTemplateRaw,\n EndpointSnippetTemplateSchema,\n type RegisterBatchInput as RegisterSnippetTemplateBatchRequest,\n RegisterBatchInputSchema as RegisterSnippetTemplateBatchRequestSchema,\n type SnippetRegistryEntry,\n SnippetRegistryEntrySchema\n} from \"../orpc-client/templates/contract.js\";\n\n/**\n * Full endpoint snippet template object returned from loadSnippetTemplate.\n * This extends beyond the raw EndpointSnippetTemplate (Record<string, unknown>)\n * to include all metadata fields used by the server.\n */\nexport interface EndpointSnippetTemplate {\n apiDefinitionId: string;\n endpointId: {\n path: string;\n method: import(\"../orpc-client/shared.js\").HttpMethod;\n identifierOverride: string | undefined;\n };\n sdk: import(\"../orpc-client/shared.js\").Sdk;\n snippetTemplate: {\n type: \"v1\";\n functionInvocation: unknown;\n clientInstantiation: string;\n };\n additionalTemplates: Record<string, unknown> | undefined;\n}\n\nimport * as _NavigationLatest from \"../navigation/types/latest\";\nimport * as _NavigationV1 from \"../navigation/types/v1\";\nimport * as _DocsV2Read from \"../orpc-client/docs/v2/read/contract.js\";\nimport * as _DocsV2Write from \"../orpc-client/docs/v2/write/contract.js\";\nimport * as _APIV1Db from \"./APIV1Db\";\n// Namespace re-exports for backward compatibility with generated code structure\n// Downstream packages use patterns like FdrAPI.docs.v2.read.LoadDocsForUrlResponse\nimport * as _APIV1Read from \"./APIV1Read\";\nimport * as _APIV1Write from \"./APIV1Write\";\nimport * as _ApiLatestWithSubs from \"./ApiLatestWithSubs\";\nimport * as _DocsLatest from \"./DocsLatest\";\nimport * as _DocsV1Commons from \"./DocsV1Commons\";\nimport * as _DocsV1Db from \"./DocsV1Db\";\nimport * as _DocsV1Read from \"./DocsV1Read\";\nimport * as _DocsV1Write from \"./DocsV1Write\";\nimport * as _libraryDocs from \"./libraryDocs\";\nimport * as _Sdks from \"./Sdks\";\n\nexport namespace docs {\n export namespace v1 {\n export import read = _DocsV1Read;\n export import db = _DocsV1Db;\n export import write = _DocsV1Write;\n export import commons = _DocsV1Commons;\n }\n export namespace v2 {\n export import read = _DocsV2Read;\n export import write = _DocsV2Write;\n }\n export import latest = _DocsLatest;\n}\n\nexport namespace api {\n export namespace v1 {\n export import read = _APIV1Read;\n export import db = _APIV1Db;\n export import register = _APIV1Write;\n }\n export import latest = _ApiLatestWithSubs;\n}\n\nexport import libraryDocs = _libraryDocs;\nexport import sdks = _Sdks;\n\nexport namespace navigation {\n export import v1 = _NavigationV1;\n export import latest = _NavigationLatest;\n}\n","export * from \"../orpc-client/api/contract-latest.js\";\nexport * as endpoint from \"./ApiLatestEndpoint\";\nexport * as webhook from \"./ApiLatestWebhook\";\nexport * as websocket from \"./ApiLatestWebsocket\";\n","export { type LatestEndpointDefinition as EndpointDefinition } from \"../orpc-client/api/contract-latest.js\";\n","export { type LatestWebhookDefinition as WebhookDefinition } from \"../orpc-client/api/contract-latest.js\";\n","export { type LatestWebSocketChannel as WebSocketChannel } from \"../orpc-client/api/contract-latest.js\";\n","export * from \"./docs-types/latest\";\n","import * as z from \"zod\";\n\nimport { FileIdOrUrlSchema } from \"./shared\";\n\nexport type { FileIdOrUrl } from \"./shared\";\nexport { FileIdOrUrlSchema } from \"./shared\";\n\nexport const StringOrStringListSchema = z.union([z.string(), z.array(z.string())]);\nexport type StringOrStringList = z.infer<typeof StringOrStringListSchema>;\n\nexport const TwitterCardSettingSchema = z.enum([\"summary\", \"summary_large_image\", \"app\", \"player\"]);\nexport type TwitterCardSetting = z.infer<typeof TwitterCardSettingSchema>;\n\nexport const JsonLdBreadcrumbListElementSchema = z.object({\n \"@type\": z.literal(\"ListItem\"),\n position: z.number(),\n name: z.string(),\n item: z.string().optional()\n});\nexport type JsonLdBreadcrumbListElement = z.infer<typeof JsonLdBreadcrumbListElementSchema>;\n\nexport const JsonLdBreadcrumbListSchema = z.object({\n \"@context\": z.literal(\"https://schema.org\"),\n \"@type\": z.literal(\"BreadcrumbList\"),\n itemListElement: z.array(JsonLdBreadcrumbListElementSchema)\n});\nexport type JsonLdBreadcrumbList = z.infer<typeof JsonLdBreadcrumbListSchema>;\n\nexport const WithJsonLdBreadcrumbsSchema = z.object({\n /** Set to `false` to suppress the built-in JSON-LD for the page. */\n jsonld: z.boolean().optional(),\n \"jsonld:breadcrumb\": JsonLdBreadcrumbListSchema.optional()\n});\nexport type WithJsonLdBreadcrumbs = z.infer<typeof WithJsonLdBreadcrumbsSchema>;\n\nexport const WithMetadataConfigSchema = z.object({\n \"og:site_name\": z.string().optional(),\n \"og:title\": z.string().optional(),\n \"og:description\": z.string().optional(),\n \"og:url\": z.string().optional(),\n \"og:image\": FileIdOrUrlSchema.optional(),\n \"og:image:width\": z.number().optional(),\n \"og:image:height\": z.number().optional(),\n \"og:locale\": z.string().optional(),\n \"og:logo\": FileIdOrUrlSchema.optional(),\n \"twitter:title\": z.string().optional(),\n \"twitter:description\": z.string().optional(),\n \"twitter:handle\": z.string().optional(),\n \"twitter:image\": FileIdOrUrlSchema.optional(),\n \"twitter:site\": z.string().optional(),\n \"twitter:url\": z.string().optional(),\n \"twitter:card\": TwitterCardSettingSchema.optional(),\n \"og:background-image\": FileIdOrUrlSchema.optional(),\n \"og:dynamic\": z.boolean().optional(),\n \"og:dynamic:background-image\": FileIdOrUrlSchema.optional(),\n \"og:dynamic:text-color\": z.string().optional(),\n \"og:dynamic:background-color\": z.string().optional(),\n \"og:dynamic:show-logo\": z.boolean().optional(),\n \"og:dynamic:show-section\": z.boolean().optional(),\n \"og:dynamic:show-description\": z.boolean().optional(),\n \"og:dynamic:show-url\": z.boolean().optional(),\n \"og:dynamic:show-gradient\": z.boolean().optional(),\n noindex: z.boolean().optional(),\n nofollow: z.boolean().optional(),\n keywords: StringOrStringListSchema.optional()\n});\nexport type WithMetadataConfig = z.infer<typeof WithMetadataConfigSchema>;\n\nexport const LayoutSchema = z.enum([\"guide\", \"overview\", \"reference\", \"page\", \"custom\", \"classic\", \"timeline\"]);\nexport type Layout = z.infer<typeof LayoutSchema>;\n\nexport const LogoConfigurationSchema = z.object({\n light: FileIdOrUrlSchema.optional(),\n dark: FileIdOrUrlSchema.optional()\n});\nexport type LogoConfiguration = z.infer<typeof LogoConfigurationSchema>;\n\nexport const LogoSchema = z.union([FileIdOrUrlSchema, LogoConfigurationSchema]);\nexport type Logo = z.infer<typeof LogoSchema>;\n\nexport const BreadcrumbItemSchema = z.object({\n title: z.string(),\n pointsTo: z.string().optional()\n});\nexport type BreadcrumbItem = z.infer<typeof BreadcrumbItemSchema>;\n\nexport const FrontmatterSchema = WithMetadataConfigSchema.merge(WithJsonLdBreadcrumbsSchema).merge(\n z.object({\n layout: LayoutSchema.optional(),\n slug: z.string().optional(),\n title: z.string().optional(),\n headline: z.string().optional(),\n description: z.string().optional(),\n subtitle: z.string().optional(),\n logo: LogoSchema.optional(),\n image: FileIdOrUrlSchema.optional(),\n \"edit-this-page-url\": z.string().optional(),\n \"hide-toc\": z.boolean().optional(),\n \"force-toc\": z.boolean().optional(),\n \"hide-nav-links\": z.boolean().optional(),\n \"max-toc-depth\": z.number().optional(),\n \"hide-feedback\": z.boolean().optional(),\n \"hide-page-actions\": z.boolean().optional(),\n \"no-image-zoom\": z.boolean().optional(),\n breadcrumb: z.array(BreadcrumbItemSchema).optional(),\n excerpt: z.string().optional(),\n \"canonical-url\": z.string().optional(),\n tags: StringOrStringListSchema.optional(),\n \"last-updated\": z.string().optional(),\n /**\n * Arbitrary author-defined metadata that is copied onto this page's search\n * records, so it can be faceted and filtered on by full path\n * (`search_metadata.<key>`) via the search API. Not interpreted by Fern.\n */\n \"search-metadata\": z.record(z.unknown()).optional()\n })\n);\nexport type Frontmatter = z.infer<typeof FrontmatterSchema>;\n\nexport const ResolvedMdxSchema = z.object({\n code: z.string(),\n frontmatter: FrontmatterSchema,\n scope: z.record(z.string(), z.unknown()),\n jsxRefs: z.array(z.string()).optional()\n});\nexport type ResolvedMdx = z.infer<typeof ResolvedMdxSchema>;\n","export * from \"./docs-types/write-commons\";\n","/**\n * Library Docs IR types.\n *\n * These types describe the intermediate representation produced by the\n * server-side library documentation parser. They are consumed by the\n * library-docs-generator package in the fern CLI to render MDX pages.\n */\n\n// ---------------------------------------------------------------------------\n// Shared / IR types\n// ---------------------------------------------------------------------------\n\nexport interface DocstringExampleIr {\n code: string;\n description: string | undefined;\n}\n\nexport interface DocstringParamIr {\n name: string;\n type: string | undefined;\n description: string | undefined;\n default: string | undefined;\n}\n\nexport interface DocstringRaisesIr {\n type: string;\n description: string | undefined;\n}\n\nexport interface DocstringReturnsIr {\n type: string | undefined;\n description: string | undefined;\n}\n\nexport interface DocstringIr {\n summary: string | undefined;\n description: string | undefined;\n params: DocstringParamIr[];\n returns: DocstringReturnsIr | undefined;\n raises: DocstringRaisesIr[];\n examples: DocstringExampleIr[];\n notes: string[];\n warnings: string[];\n}\n\nexport interface IrMetadata {\n packageName: string;\n language: string;\n sourceUrl: string | undefined;\n branch: string | undefined;\n version: string | undefined;\n}\n\nexport interface TypeInfo {\n display: string | undefined;\n resolvedPath: string | undefined;\n basePath: string | undefined;\n}\n\nexport interface AttributeIr {\n name: string;\n path: string;\n typeInfo: TypeInfo | undefined;\n value: string | undefined;\n docstring: DocstringIr | undefined;\n}\n\n// ---------------------------------------------------------------------------\n// Python-specific types\n// ---------------------------------------------------------------------------\n\nexport interface BaseClassRef {\n name: string;\n typeInfo: TypeInfo | undefined;\n}\n\nexport interface EnumMemberIr {\n name: string;\n value: string;\n}\n\nexport const PythonClassKind = {\n Class: \"CLASS\",\n Dataclass: \"DATACLASS\",\n Typeddict: \"TYPEDDICT\",\n Protocol: \"PROTOCOL\",\n Enum: \"ENUM\",\n Exception: \"EXCEPTION\"\n} as const;\nexport type PythonClassKind = (typeof PythonClassKind)[keyof typeof PythonClassKind];\n\nexport const PythonParameterKind = {\n Positional: \"POSITIONAL\",\n Keyword: \"KEYWORD\",\n VarPositional: \"VAR_POSITIONAL\",\n VarKeyword: \"VAR_KEYWORD\",\n KeywordOnly: \"KEYWORD_ONLY\"\n} as const;\nexport type PythonParameterKind = (typeof PythonParameterKind)[keyof typeof PythonParameterKind];\n\nexport interface PythonParameterIr {\n name: string;\n typeInfo: TypeInfo | undefined;\n default: string | undefined;\n description: string | undefined;\n kind: PythonParameterKind;\n}\n\nexport interface TypedDictFieldIr {\n name: string;\n typeInfo: TypeInfo | undefined;\n description: string | undefined;\n required: boolean;\n}\n\nexport interface PythonFunctionIr {\n name: string;\n path: string;\n signature: string;\n docstring: DocstringIr | undefined;\n parameters: PythonParameterIr[];\n returnTypeInfo: TypeInfo | undefined;\n isAsync: boolean;\n decorators: string[];\n isClassmethod: boolean;\n isStaticmethod: boolean;\n isProperty: boolean;\n}\n\nexport interface PythonClassIr {\n name: string;\n path: string;\n kind: PythonClassKind;\n bases: BaseClassRef[];\n docstring: DocstringIr | undefined;\n constructorParams: PythonParameterIr[];\n methods: PythonFunctionIr[];\n attributes: AttributeIr[];\n decorators: string[];\n metaclass: string | undefined;\n isAbstract: boolean;\n hasSlots: boolean;\n typedDictFields: TypedDictFieldIr[] | undefined;\n enumMembers: EnumMemberIr[] | undefined;\n}\n\nexport interface PythonModuleIr {\n name: string;\n path: string;\n docstring: DocstringIr | undefined;\n classes: PythonClassIr[];\n functions: PythonFunctionIr[];\n attributes: AttributeIr[];\n submodules: PythonModuleIr[];\n}\n\nexport interface PythonLibraryDocsIr {\n metadata: IrMetadata;\n rootModule: PythonModuleIr;\n}\n\n// ---------------------------------------------------------------------------\n// C++ IR types (derived from fern/apis/cpp-library-docs-ir/openapi.json)\n// ---------------------------------------------------------------------------\n\nexport namespace cpp {\n export interface CppTypeRef {\n text: string;\n refid: string;\n kindref: string;\n }\n\n export type CppTypeInfoPartsItem = string | CppTypeRef;\n\n export interface CppTypeInfo {\n parts: CppTypeInfoPartsItem[];\n display: string | undefined;\n resolvedPath: string | undefined;\n basePath: string | undefined;\n }\n\n export type CppClassKind = \"class\" | \"struct\";\n export type CppVirtuality = \"non-virtual\" | \"virtual\" | \"pure-virtual\";\n export type CppRefQualifier = \"lvalue\" | \"rvalue\";\n export type CppAccessSpecifier = \"public\" | \"private\" | \"protected\";\n export type CppParameterDirection = \"in\" | \"out\" | \"inout\";\n\n // -- Doc segments (inline content) --\n\n export interface CppDocTextSegment {\n type: \"text\";\n text: string;\n }\n export interface CppDocCodeSegment {\n type: \"code\";\n code: string;\n }\n export interface CppDocCodeRefSegment {\n type: \"codeRef\";\n code: string;\n refid: string;\n kindref: string;\n }\n export interface CppDocRefSegment {\n type: \"ref\";\n text: string;\n refid: string;\n kindref: string;\n }\n export interface CppDocBoldSegment {\n type: \"bold\";\n text: string;\n }\n export interface CppDocEmphasisSegment {\n type: \"emphasis\";\n text: string;\n }\n export interface CppDocLinkSegment {\n type: \"link\";\n text: string;\n url: string;\n }\n export interface CppDocSubscriptSegment {\n type: \"subscript\";\n text: string;\n }\n export interface CppDocSuperscriptSegment {\n type: \"superscript\";\n text: string;\n }\n\n export type CppDocSegment =\n | CppDocTextSegment\n | CppDocCodeSegment\n | CppDocCodeRefSegment\n | CppDocRefSegment\n | CppDocBoldSegment\n | CppDocEmphasisSegment\n | CppDocLinkSegment\n | CppDocSubscriptSegment\n | CppDocSuperscriptSegment;\n\n // -- Doc blocks (block-level content) --\n\n export interface CppParagraphBlock {\n type: \"paragraph\";\n segments: CppDocSegment[];\n }\n export interface CppCodeBlock {\n type: \"codeBlock\";\n code: string;\n language: string | undefined;\n }\n export interface CppVerbatimBlock {\n type: \"verbatim\";\n content: string;\n format: string | undefined;\n }\n export interface CppListBlock {\n type: \"list\";\n ordered: boolean;\n items: CppDocBlock[][];\n }\n export interface CppImageBlock {\n type: \"image\";\n path: string;\n caption: string | undefined;\n isInline: boolean;\n }\n export interface CppTitledSectionBlock {\n type: \"titledSection\";\n title: string | undefined;\n blocks: CppDocBlock[];\n }\n\n export type CppDocBlock =\n | CppParagraphBlock\n | CppCodeBlock\n | CppVerbatimBlock\n | CppListBlock\n | CppImageBlock\n | CppTitledSectionBlock;\n\n // -- Docstring --\n\n export interface CppParamDoc {\n name: string;\n description: CppDocSegment[];\n direction: CppParameterDirection | undefined;\n }\n\n export interface CppRaisesDoc {\n exception: string;\n description: CppDocSegment[];\n }\n\n export interface CppDocstringIr {\n summary: CppDocSegment[];\n description: CppDocBlock[];\n params: CppParamDoc[];\n templateParamsDoc: CppParamDoc[];\n returns: CppDocSegment[] | undefined;\n raises: CppRaisesDoc[];\n examples: CppCodeBlock[];\n notes: CppDocSegment[][];\n warnings: CppDocSegment[][];\n remarks: CppDocSegment[][];\n preconditions: CppDocSegment[][];\n postconditions: CppDocSegment[][];\n seeAlso: CppDocSegment[][];\n sinceVersion: string | undefined;\n deprecated: CppDocSegment[] | undefined;\n }\n\n // -- IR node types --\n\n export interface CppTemplateParamIr {\n type: string;\n name: string | undefined;\n defaultValue: CppTypeInfo | undefined;\n isVariadic: boolean;\n }\n\n export interface CppParameterIr {\n name: string;\n typeInfo: CppTypeInfo | undefined;\n defaultValue: CppTypeInfo | undefined;\n arraySuffix: string | undefined;\n direction: CppParameterDirection | undefined;\n }\n\n export interface CppEnumValueIr {\n name: string;\n id: string | undefined;\n initializer: string | undefined;\n docstring: CppDocstringIr | undefined;\n }\n\n export interface CppEnumIr {\n name: string;\n path: string;\n isScoped: boolean;\n underlyingType: string | undefined;\n values: CppEnumValueIr[];\n docstring: CppDocstringIr | undefined;\n }\n\n export interface CppTypedefIr {\n name: string;\n path: string;\n typeInfo: CppTypeInfo | undefined;\n templateParams: CppTemplateParamIr[];\n docstring: CppDocstringIr | undefined;\n }\n\n export interface CppVariableIr {\n name: string;\n path: string;\n typeInfo: CppTypeInfo | undefined;\n initializer: string | undefined;\n templateParams: CppTemplateParamIr[];\n isStatic: boolean;\n isConstexpr: boolean;\n isMutable: boolean;\n docstring: CppDocstringIr | undefined;\n }\n\n export interface CppMacroIr {\n name: string;\n path: string;\n parameters: string[] | undefined;\n initializer: string | undefined;\n docstring: CppDocstringIr | undefined;\n }\n\n export interface CppBaseClassRef {\n name: string;\n typeInfo: CppTypeInfo | undefined;\n access: CppAccessSpecifier;\n isVirtual: boolean;\n }\n\n export interface CppFunctionIr {\n name: string;\n path: string;\n signature: string;\n templateParams: CppTemplateParamIr[];\n parameters: CppParameterIr[];\n returnType: CppTypeInfo | undefined;\n docstring: CppDocstringIr | undefined;\n isStatic: boolean;\n isConst: boolean;\n isConstexpr: boolean;\n isVolatile: boolean;\n isInline: boolean;\n isExplicit: boolean;\n isNoexcept: boolean;\n noexceptExpression: string | undefined;\n isNoDiscard: boolean;\n virtuality: CppVirtuality;\n refQualifier: CppRefQualifier | undefined;\n requiresClause: string | undefined;\n isDeleted: boolean;\n }\n\n export interface CppClassIr {\n name: string;\n path: string;\n kind: CppClassKind;\n templateParams: CppTemplateParamIr[];\n baseClasses: CppBaseClassRef[];\n derivedClasses: CppBaseClassRef[];\n docstring: CppDocstringIr | undefined;\n isAbstract: boolean;\n isFinal: boolean;\n includeHeader: string | undefined;\n methods: CppFunctionIr[];\n staticMethods: CppFunctionIr[];\n friendFunctions: CppFunctionIr[];\n typedefs: CppTypedefIr[];\n memberVariables: CppVariableIr[];\n enums: CppEnumIr[];\n innerClasses: CppClassIr[];\n relatedMemberRefs: string[];\n sectionLabels: Record<string, string>;\n }\n\n export interface CppConceptIr {\n name: string;\n path: string;\n templateParams: CppTemplateParamIr[];\n constraintExpression: string | undefined;\n docstring: CppDocstringIr | undefined;\n }\n\n export interface CppNamespaceIr {\n name: string;\n path: string;\n docstring: CppDocstringIr | undefined;\n classes: CppClassIr[];\n functions: CppFunctionIr[];\n enums: CppEnumIr[];\n typedefs: CppTypedefIr[];\n variables: CppVariableIr[];\n concepts: CppConceptIr[];\n namespaces: CppNamespaceIr[];\n macros: CppMacroIr[] | undefined;\n }\n\n export interface CppGroupIr {\n id: string;\n name: string;\n title: string;\n docstring: CppDocstringIr | undefined;\n memberRefs: string[];\n innerClassRefs: string[];\n innerNamespaceRefs: string[];\n classes: CppClassIr[];\n functions: CppFunctionIr[];\n enums: CppEnumIr[];\n typedefs: CppTypedefIr[];\n variables: CppVariableIr[];\n macros: CppMacroIr[] | undefined;\n subgroups: CppGroupIr[];\n }\n\n export interface CppLibraryDocsIr {\n metadata: IrMetadata;\n rootNamespace: CppNamespaceIr;\n groups: CppGroupIr[];\n }\n}\n","export * from \"../orpc-client/sdks/contract\";\n","import type { DocsV1Read } from \"./types\";\n\nexport interface ReadNavigationConfigVisitor<T> {\n versioned: (config: DocsV1Read.VersionedNavigationConfig) => T;\n unversioned: (config: DocsV1Read.UnversionedNavigationConfig) => T;\n}\n\nexport interface ReadUnversionedNavigationConfigVisitor<T> {\n tabbed: (config: DocsV1Read.UnversionedTabbedNavigationConfig) => T;\n untabbed: (config: DocsV1Read.UnversionedUntabbedNavigationConfig) => T;\n}\n\nexport function visitReadNavigationConfig<T>(\n config: DocsV1Read.NavigationConfig,\n visitor: ReadNavigationConfigVisitor<T>\n): T {\n if (isVersionedNavigationConfig(config)) {\n return visitor.versioned(config);\n } else {\n return visitor.unversioned(config);\n }\n}\n\nexport function visitUnversionedReadNavigationConfig<T>(\n config: DocsV1Read.UnversionedNavigationConfig,\n visitor: ReadUnversionedNavigationConfigVisitor<T>\n): T {\n if (isTabbedNavigationConfig(config)) {\n return visitor.tabbed(config);\n } else {\n return visitor.untabbed(config);\n }\n}\n\nfunction isVersionedNavigationConfig(\n config: DocsV1Read.NavigationConfig\n): config is DocsV1Read.VersionedNavigationConfig {\n return Array.isArray((config as DocsV1Read.VersionedNavigationConfig).versions);\n}\n\nexport function isTabbedNavigationConfig(\n config: DocsV1Read.UnversionedNavigationConfig\n): config is DocsV1Read.UnversionedTabbedNavigationConfig {\n return Array.isArray((config as DocsV1Read.UnversionedTabbedNavigationConfig).tabs);\n}\n","import titleCase from \"@fern-api/ui-core-utils/titleCase\";\nimport visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\nimport { noop } from \"ts-essentials\";\nimport urljoin from \"url-join\";\n\nimport { FernNavigation } from \"../../../..\";\nimport { APIV1Read, type DocsV1Read } from \"../../../../client/types\";\nimport { ApiDefinitionHolder } from \"../../../ApiDefinitionHolder\";\nimport { ROOT_PACKAGE_ID } from \"../../../consts\";\nimport { isSubpackage } from \"../../../utils/isSubpackage\";\nimport { stringifyEndpointPathParts } from \"../../../utils/stringifyEndpointPathParts\";\nimport { ChangelogNavigationConverter } from \"./ChangelogConverter\";\nimport { NodeIdGenerator } from \"./NodeIdGenerator\";\nimport { SlugGenerator } from \"./SlugGenerator\";\n\nexport class ApiReferenceNavigationConverter {\n public static convert(\n apiSection: DocsV1Read.ApiSection,\n api: APIV1Read.ApiDefinition,\n fullSlugMap?: Record<FernNavigation.V1.PageId, FernNavigation.V1.Slug>,\n noindexMap?: Record<FernNavigation.V1.PageId, boolean>,\n parentSlug?: SlugGenerator,\n idgen?: NodeIdGenerator,\n lexicographic?: boolean,\n disableEndpointPairs?: boolean,\n paginated?: boolean\n ) {\n return new ApiReferenceNavigationConverter(\n apiSection,\n api,\n fullSlugMap,\n noindexMap,\n parentSlug,\n idgen ?? new NodeIdGenerator(),\n lexicographic,\n disableEndpointPairs,\n paginated\n ).convert();\n }\n\n apiDefinitionId: FernNavigation.V1.ApiDefinitionId;\n #holder: ApiDefinitionHolder;\n #visitedEndpoints = new Set<FernNavigation.V1.EndpointId>();\n #visitedWebSockets = new Set<FernNavigation.V1.WebSocketId>();\n #visitedWebhooks = new Set<FernNavigation.V1.WebhookId>();\n #visitedGrpcs = new Set<FernNavigation.V1.GrpcId>();\n #visitedGraphqlOperations = new Set<FernNavigation.V1.GraphQlOperationId>();\n #visitedSubpackages = new Set<string>();\n #idgen: NodeIdGenerator;\n private constructor(\n private apiSection: DocsV1Read.ApiSection,\n private api: APIV1Read.ApiDefinition,\n private fullSlugMap: Record<FernNavigation.V1.PageId, FernNavigation.V1.Slug> = {},\n private noindexMap: Record<FernNavigation.V1.PageId, boolean> = {},\n private parentSlug: SlugGenerator = SlugGenerator.init(\"\"),\n idgen: NodeIdGenerator = new NodeIdGenerator(),\n private lexicographic: boolean = false,\n private disableEndpointPairs: boolean = false,\n private paginated: boolean | undefined\n ) {\n this.apiDefinitionId = FernNavigation.V1.ApiDefinitionId(api.id);\n this.#holder = ApiDefinitionHolder.create(api);\n this.#idgen = idgen;\n }\n\n private convert(): FernNavigation.V1.ApiReferenceNode {\n return this.#idgen.with(this.apiSection.urlSlug, (id) => {\n const overviewPageId =\n this.apiSection.navigation?.summaryPageId != null\n ? FernNavigation.V1.PageId(this.apiSection.navigation.summaryPageId)\n : undefined;\n const noindex = overviewPageId != null ? this.noindexMap[overviewPageId] : undefined;\n\n let slug = this.parentSlug.apply(this.apiSection);\n\n const frontmatterSlug = overviewPageId != null ? this.fullSlugMap[overviewPageId] : undefined;\n if (frontmatterSlug != null) {\n slug = this.parentSlug.set(frontmatterSlug);\n }\n\n const children = this.convertChildren(slug);\n const changelog =\n this.apiSection.changelog != null\n ? ChangelogNavigationConverter.convert(\n this.apiSection.changelog,\n this.fullSlugMap,\n this.noindexMap,\n slug,\n this.#idgen\n )\n : undefined;\n const pointsTo = FernNavigation.V1.followRedirects(children) ?? changelog?.slug;\n return {\n id,\n type: \"apiReference\",\n title: this.apiSection.title,\n apiDefinitionId: FernNavigation.V1.ApiDefinitionId(this.apiSection.api),\n overviewPageId,\n noindex,\n paginated: this.paginated ?? (this.apiSection.longScrolling === false ? true : undefined),\n slug: slug.get(),\n icon: this.apiSection.icon,\n hidden: this.apiSection.hidden,\n hideTitle: this.apiSection.flattened,\n showErrors: this.apiSection.showErrors,\n changelog,\n children,\n availability: undefined,\n pointsTo,\n playground: undefined,\n postmanCollectionUrl: undefined,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n };\n });\n }\n\n private convertChildren(parentSlug: SlugGenerator): FernNavigation.V1.ApiPackageChild[] {\n if (this.apiSection.navigation != null) {\n return this.convertApiNavigationItems(\n this.apiSection.navigation.items,\n parentSlug,\n APIV1Read.SubpackageId(\"root\")\n );\n }\n\n return this.convertPackageToChildren(this.api.rootPackage, parentSlug);\n }\n\n private convertEndpointNode(\n endpointId: FernNavigation.V1.EndpointId,\n endpoint: APIV1Read.EndpointDefinition,\n parentSlug: SlugGenerator\n ): FernNavigation.V1.EndpointNode | FernNavigation.V1.EndpointPairNode {\n return this.#idgen.with(endpointId, (id) => {\n return {\n id,\n type: \"endpoint\",\n title: endpoint.name ?? stringifyEndpointPathParts(endpoint.path.parts),\n endpointId,\n slug: parentSlug.apply(endpoint).get(),\n icon: undefined,\n hidden: undefined,\n method: endpoint.method,\n apiDefinitionId: this.apiDefinitionId,\n availability: FernNavigation.V1.convertAvailability(endpoint.availability),\n isResponseStream: endpoint.response?.type.type === \"stream\",\n playground: undefined,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n };\n });\n }\n\n private convertGrpcNode(\n grpcId: FernNavigation.V1.GrpcId,\n grpcEndpoint: APIV1Read.EndpointDefinition,\n grpcMethodType: APIV1Read.GrpcMethod,\n parentSlug: SlugGenerator\n ): FernNavigation.V1.GrpcNode {\n return this.#idgen.with(grpcId, (id) => {\n return {\n id,\n type: \"grpc\",\n title: grpcEndpoint.name ?? stringifyEndpointPathParts(grpcEndpoint.path.parts),\n grpcId,\n slug: parentSlug.apply(grpcEndpoint).get(),\n icon: undefined,\n hidden: undefined,\n method: grpcMethodType,\n apiDefinitionId: this.apiDefinitionId,\n availability: undefined,\n isResponseStream: false,\n playground: undefined,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n };\n });\n }\n\n private convertWebSocketNode(\n webSocketId: FernNavigation.V1.WebSocketId,\n webSocket: APIV1Read.WebSocketChannel,\n parentSlug: SlugGenerator\n ): FernNavigation.V1.WebSocketNode {\n return this.#idgen.with(webSocketId, (id) => ({\n id,\n type: \"webSocket\",\n title: webSocket.name ?? stringifyEndpointPathParts(webSocket.path.parts),\n webSocketId,\n slug: parentSlug.apply(webSocket).get(),\n icon: undefined,\n hidden: undefined,\n apiDefinitionId: this.apiDefinitionId,\n availability: FernNavigation.V1.convertAvailability(webSocket.availability),\n playground: undefined,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n }));\n }\n\n private convertWebhookNode(\n webhookId: FernNavigation.V1.WebhookId,\n webhook: APIV1Read.WebhookDefinition,\n parentSlug: SlugGenerator\n ): FernNavigation.V1.WebhookNode {\n return this.#idgen.with(webhookId, (id) => ({\n id,\n type: \"webhook\",\n title: webhook.name ?? urljoin(\"/\", ...webhook.path),\n webhookId,\n slug: parentSlug.apply(webhook).get(),\n icon: undefined,\n hidden: undefined,\n method: webhook.method,\n apiDefinitionId: this.apiDefinitionId,\n availability: undefined,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n }));\n }\n\n private convertGraphQlNode(\n graphqlOperationId: FernNavigation.V1.GraphQlOperationId,\n graphqlOperation: APIV1Read.GraphQlOperation,\n parentSlug: SlugGenerator\n ): FernNavigation.V1.GraphQlNode {\n const fieldPath = graphqlOperation.fieldPath;\n const urlSlug =\n fieldPath != null && fieldPath.length > 0\n ? [...fieldPath, graphqlOperation.name].join(\"-\")\n : graphqlOperation.name;\n return this.#idgen.with(graphqlOperationId, (id) => ({\n id,\n type: \"graphql\",\n title: graphqlOperation.displayName ?? graphqlOperation.name,\n graphqlOperationId,\n graphqlOperationIds: undefined,\n slug: parentSlug.apply({ urlSlug }).get(),\n icon: undefined,\n hidden: undefined,\n operationType: graphqlOperation.operationType,\n apiDefinitionId: this.apiDefinitionId,\n availability: FernNavigation.V1.convertAvailability(graphqlOperation.availability),\n playground: undefined,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n }));\n }\n\n private convertGraphQlOperationsToChildren(\n graphqlOperations: APIV1Read.GraphQlOperation[],\n parentSlug: SlugGenerator\n ): FernNavigation.V1.ApiPackageChild[] {\n // Only group queries by fieldPath; mutations and subscriptions stay flat.\n // Maintain insertion order: groups appear at the position of their first member.\n const groupedByParent = new Map<string, APIV1Read.GraphQlOperation[]>();\n const insertionOrder: Array<\n { type: \"group\"; parentField: string } | { type: \"flat\"; op: APIV1Read.GraphQlOperation }\n > = [];\n\n for (const op of graphqlOperations) {\n const graphqlOperationId = ApiDefinitionHolder.createGraphQlOperationId(op);\n if (this.#visitedGraphqlOperations.has(graphqlOperationId)) {\n continue;\n }\n this.#visitedGraphqlOperations.add(graphqlOperationId);\n\n const parentField = op.fieldPath?.[0];\n if (parentField != null && op.operationType === \"QUERY\") {\n const group = groupedByParent.get(parentField);\n if (group != null) {\n group.push(op);\n } else {\n groupedByParent.set(parentField, [op]);\n insertionOrder.push({ type: \"group\", parentField });\n }\n } else {\n insertionOrder.push({ type: \"flat\", op });\n }\n }\n\n // Identify parent operations: flat queries whose name matches a group's parentField\n // and have no fieldPath. These are namespace parent operations created by the CLI\n // to represent the top-level namespace field itself. They may or may not have\n // arguments (e.g., storeHash on BigCommerce namespace queries).\n const parentOps = new Map<string, APIV1Read.GraphQlOperation>();\n const filteredInsertionOrder = insertionOrder.filter((entry) => {\n if (entry.type === \"flat\" && entry.op.operationType === \"QUERY\") {\n const fp = entry.op.fieldPath;\n const hasNoFieldPath = fp == null || fp.length === 0;\n if (hasNoFieldPath && groupedByParent.has(entry.op.name)) {\n parentOps.set(entry.op.name, entry.op);\n return false;\n }\n }\n return true;\n });\n\n const children: FernNavigation.V1.ApiPackageChild[] = [];\n\n // Collect all intended url slugs across every entry to detect collisions.\n const allSlugs = new Set<string>();\n for (const entry of filteredInsertionOrder) {\n if (entry.type === \"flat\") {\n const fp = entry.op.fieldPath;\n allSlugs.add(fp != null && fp.length > 0 ? [...fp, entry.op.name].join(\"-\") : entry.op.name);\n } else {\n allSlugs.add(entry.parentField);\n }\n }\n\n for (const entry of filteredInsertionOrder) {\n if (entry.type === \"flat\") {\n const opId = ApiDefinitionHolder.createGraphQlOperationId(entry.op);\n children.push(this.convertGraphQlNode(opId, entry.op, parentSlug));\n } else {\n const operations = groupedByParent.get(entry.parentField);\n if (operations == null) {\n continue;\n }\n // Use the parent operation (if available) as the primary so the page shows\n // the namespace type's own fields. Child operations are stored for snippet generation.\n const parentOp = parentOps.get(entry.parentField);\n const primaryOp = parentOp ?? operations[0]!;\n const opId = ApiDefinitionHolder.createGraphQlOperationId(primaryOp);\n const childOpIds = operations.map((op) => ApiDefinitionHolder.createGraphQlOperationId(op));\n\n // Disambiguate: if a flat sibling already claims this slug, suffix with \"-fields\".\n let slugSegment = entry.parentField;\n const flatHasSameSlug = filteredInsertionOrder.some(\n (e) =>\n e.type === \"flat\" &&\n ((): boolean => {\n const fp = e.op.fieldPath;\n const s = fp != null && fp.length > 0 ? [...fp, e.op.name].join(\"-\") : e.op.name;\n return s === slugSegment;\n })()\n );\n if (flatHasSameSlug) {\n slugSegment = `${entry.parentField}-fields`;\n }\n\n children.push(\n this.#idgen.with(opId, (id) => ({\n id,\n type: \"graphql\" as const,\n title: entry.parentField,\n graphqlOperationId: opId,\n graphqlOperationIds: childOpIds.length > 0 ? childOpIds : undefined,\n slug: parentSlug.apply({ urlSlug: slugSegment }).get(),\n icon: undefined,\n hidden: undefined,\n operationType: primaryOp.operationType,\n apiDefinitionId: this.apiDefinitionId,\n availability: FernNavigation.V1.convertAvailability(primaryOp.availability),\n playground: undefined,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n }))\n );\n }\n }\n\n return children;\n }\n\n private convertPackageToChildren(\n package_: APIV1Read.ApiDefinitionPackage,\n parentSlug: SlugGenerator\n ): FernNavigation.V1.ApiPackageChild[] {\n const children: FernNavigation.V1.ApiPackageChild[] = [];\n\n let subpackageId = isSubpackage(package_) ? package_.subpackageId : \"__package__\";\n while (package_.pointsTo != null) {\n subpackageId = package_.pointsTo;\n const pointsToSubpackage = this.api.subpackages[package_.pointsTo];\n if (pointsToSubpackage == null) {\n return [];\n }\n package_ = pointsToSubpackage;\n }\n\n if (this.#visitedSubpackages.has(subpackageId)) {\n return children;\n }\n\n (package_.endpoints ?? []).forEach((endpoint) => {\n if (endpoint.protocol?.type === \"grpc\" && endpoint.protocol.methodType != null) {\n const grpcId = ApiDefinitionHolder.createGrpcId(endpoint, subpackageId);\n if (this.#visitedGrpcs.has(grpcId)) {\n return;\n }\n children.push(this.convertGrpcNode(grpcId, endpoint, endpoint.protocol.methodType, parentSlug));\n this.#visitedGrpcs.add(grpcId);\n } else {\n const endpointId = ApiDefinitionHolder.createEndpointId(endpoint, subpackageId);\n if (this.#visitedEndpoints.has(endpointId)) {\n return;\n }\n children.push(this.convertEndpointNode(endpointId, endpoint, parentSlug));\n this.#visitedEndpoints.add(endpointId);\n }\n });\n\n (package_.websockets ?? []).forEach((webSocket) => {\n const webSocketId = ApiDefinitionHolder.createWebSocketId(webSocket, subpackageId);\n if (this.#visitedWebSockets.has(webSocketId)) {\n return;\n }\n children.push(this.convertWebSocketNode(webSocketId, webSocket, parentSlug));\n this.#visitedWebSockets.add(webSocketId);\n });\n\n (package_.webhooks ?? []).forEach((webhook) => {\n const webhookId = ApiDefinitionHolder.createWebhookId(webhook, subpackageId);\n if (this.#visitedWebhooks.has(webhookId)) {\n return;\n }\n children.push(this.convertWebhookNode(webhookId, webhook, parentSlug));\n this.#visitedWebhooks.add(webhookId);\n });\n\n children.push(...this.convertGraphQlOperationsToChildren(package_.graphqlOperations ?? [], parentSlug));\n\n (package_.subpackages ?? []).forEach((subpackageId) => {\n const subpackage = this.api.subpackages[subpackageId];\n if (subpackage == null) {\n console.error(`Subpackage ${subpackageId} not found in ${this.apiDefinitionId}`);\n return;\n }\n const child = this.#idgen.with(subpackageId, (id): FernNavigation.V1.ApiPackageNode | undefined => {\n const slug = parentSlug.apply(subpackage);\n const subpackageChildren = this.convertPackageToChildren(subpackage, slug);\n if (subpackageChildren.length === 0) {\n return;\n }\n const pointsTo = FernNavigation.V1.followRedirects(subpackageChildren);\n return {\n id,\n type: \"apiPackage\",\n children: subpackageChildren,\n title: subpackage.displayName ?? titleCase(subpackage.name),\n slug: slug.get(),\n icon: undefined,\n hidden: undefined,\n overviewPageId: undefined,\n noindex: undefined,\n availability: undefined,\n apiDefinitionId: this.apiDefinitionId,\n pointsTo,\n playground: undefined,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n };\n });\n if (child != null) {\n children.push(child);\n }\n });\n\n this.#visitedSubpackages.add(subpackageId);\n\n const toRet = this.mergeEndpointPairs(children);\n\n if (this.lexicographic) {\n toRet.sort((a, b) => {\n const aTitle = a.type === \"endpointPair\" ? a.nonStream.title : a.title;\n const bTitle = b.type === \"endpointPair\" ? b.nonStream.title : b.title;\n return aTitle.localeCompare(bTitle);\n });\n }\n\n return toRet;\n }\n\n private convertApiNavigationItems(\n items: DocsV1Read.ApiNavigationConfigItem[],\n parentSlug: SlugGenerator,\n subpackageId: APIV1Read.SubpackageId\n ): FernNavigation.V1.ApiPackageChild[] {\n const children: FernNavigation.V1.ApiPackageChild[] = [];\n let subpackage = subpackageId === \"root\" ? this.api.rootPackage : this.api.subpackages[subpackageId];\n if (subpackage == null) {\n throw new Error(\n `${subpackageId} is not present within known subpackages: ${Object.keys(this.api.subpackages).join(\", \")}`\n );\n }\n while (subpackage.pointsTo != null) {\n subpackage = this.api.subpackages[subpackage.pointsTo];\n if (subpackage == null) {\n return [];\n }\n }\n const targetSubpackageId = isSubpackage(subpackage) ? subpackage.subpackageId : ROOT_PACKAGE_ID;\n const endpoints = new Map<string, APIV1Read.EndpointDefinition>();\n const webSockets = new Map<string, APIV1Read.WebSocketChannel>();\n const webhooks = new Map<string, APIV1Read.WebhookDefinition>();\n const grpc = new Map<string, APIV1Read.EndpointDefinition>();\n (subpackage.endpoints ?? []).forEach((endpoint) => {\n endpoints.set(endpoint.id, endpoint);\n });\n (subpackage.websockets ?? []).forEach((webSocket) => {\n webSockets.set(webSocket.id, webSocket);\n });\n (subpackage.webhooks ?? []).forEach((webhook) => {\n webhooks.set(webhook.id, webhook);\n });\n (subpackage.endpoints ?? []).forEach((endpoint) => {\n if (endpoint.protocol?.type === \"grpc\") {\n grpc.set(endpoint.id, endpoint);\n }\n });\n items.forEach((item) => {\n visitDiscriminatedUnion(item, \"type\")._visit({\n page: (page) => {\n children.push(\n this.#idgen.with(page.urlSlug, (id) => {\n const pageId = FernNavigation.V1.PageId(page.id);\n const noindex = this.noindexMap[pageId];\n return {\n id,\n type: \"page\",\n title: page.title,\n pageId,\n noindex,\n slug: parentSlug.apply(page).get(),\n icon: page.icon,\n hidden: page.hidden,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined,\n availability: undefined\n };\n })\n );\n },\n endpointId: (oldEndpointId) => {\n const endpoint = endpoints.get(oldEndpointId.value);\n if (endpoint == null) {\n console.error(`Endpoint ${oldEndpointId.value} not found in ${targetSubpackageId}`);\n return;\n }\n\n if (endpoint.protocol?.type === \"grpc\") {\n const grpcId = ApiDefinitionHolder.createGrpcId(endpoint, targetSubpackageId);\n children.push(\n this.convertGrpcNode(grpcId, endpoint, endpoint.protocol.methodType ?? \"UNARY\", parentSlug)\n );\n this.#visitedGrpcs.add(grpcId);\n } else {\n const endpointId = ApiDefinitionHolder.createEndpointId(endpoint, targetSubpackageId);\n children.push(this.convertEndpointNode(endpointId, endpoint, parentSlug));\n this.#visitedEndpoints.add(endpointId);\n }\n },\n websocketId: (oldWebSocketId) => {\n const webSocket = webSockets.get(oldWebSocketId.value);\n if (webSocket == null) {\n console.error(`WebSocket ${oldWebSocketId.value} not found in ${targetSubpackageId}`);\n return;\n }\n const webSocketId = ApiDefinitionHolder.createWebSocketId(webSocket, targetSubpackageId);\n children.push(this.convertWebSocketNode(webSocketId, webSocket, parentSlug));\n this.#visitedWebSockets.add(webSocketId);\n },\n webhookId: (oldWebhookId) => {\n const webhook = webhooks.get(oldWebhookId.value);\n if (webhook == null) {\n console.error(`Webhook ${oldWebhookId.value} not found in ${targetSubpackageId}`);\n return;\n }\n const webhookId = ApiDefinitionHolder.createWebhookId(webhook, targetSubpackageId);\n children.push(this.convertWebhookNode(webhookId, webhook, parentSlug));\n this.#visitedWebhooks.add(webhookId);\n },\n subpackage: ({ subpackageId, items, summaryPageId }) => {\n const subpackage = this.api.subpackages[subpackageId as APIV1Read.SubpackageId];\n if (subpackage == null) {\n console.error(`Subpackage ${subpackageId} not found in ${targetSubpackageId}`);\n return;\n }\n let slug = parentSlug.apply(subpackage);\n\n const overviewPageId = summaryPageId != null ? FernNavigation.V1.PageId(summaryPageId) : undefined;\n const noindex = overviewPageId != null ? this.noindexMap[overviewPageId] : undefined;\n\n const frontmatterSlug = overviewPageId != null ? this.fullSlugMap[overviewPageId] : undefined;\n if (frontmatterSlug != null) {\n slug = this.parentSlug.set(frontmatterSlug);\n }\n\n this.#idgen.with(subpackageId, (id) => {\n const convertedItems = this.convertApiNavigationItems(\n items,\n slug,\n subpackageId as APIV1Read.SubpackageId\n );\n children.push({\n id,\n type: \"apiPackage\",\n children: convertedItems,\n title: subpackage.displayName ?? titleCase(subpackage.name),\n slug: slug.get(),\n icon: undefined,\n hidden: undefined,\n overviewPageId,\n noindex,\n availability: undefined,\n apiDefinitionId: this.apiDefinitionId,\n pointsTo: FernNavigation.V1.followRedirects(convertedItems),\n playground: undefined,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n });\n });\n },\n _other: noop\n });\n });\n\n children.push(...this.convertPackageToChildren(subpackage, parentSlug));\n return this.mergeEndpointPairs(children);\n }\n\n private mergeEndpointPairs(children: FernNavigation.V1.ApiPackageChild[]): FernNavigation.V1.ApiPackageChild[] {\n // if batch stream toggle is disabled, return children as is and skip merging\n if (this.disableEndpointPairs) {\n return children;\n }\n\n const toRet: FernNavigation.V1.ApiPackageChild[] = [];\n\n const methodAndPathToEndpointNode = new Map<string, FernNavigation.V1.EndpointNode>();\n children.forEach((child) => {\n if (child.type !== \"endpoint\") {\n toRet.push(child);\n return;\n }\n\n const endpoint = this.#holder.endpoints.get(child.endpointId);\n if (endpoint == null) {\n throw new Error(`Endpoint ${child.endpointId} not found`);\n }\n\n const methodAndPath = `${endpoint.method} ${stringifyEndpointPathParts(endpoint.path.parts)}`;\n\n const existing = methodAndPathToEndpointNode.get(methodAndPath);\n methodAndPathToEndpointNode.set(methodAndPath, child);\n\n if (\n existing == null ||\n toRet.indexOf(existing) === -1 ||\n existing.isResponseStream === child.isResponseStream\n ) {\n toRet.push(child);\n return;\n }\n\n const idx = toRet.indexOf(existing);\n const pairNode: FernNavigation.V1.EndpointPairNode = this.#idgen.with(\"endpoint-pair\", (id) => ({\n id,\n type: \"endpointPair\",\n collapsed: undefined,\n stream: child.isResponseStream ? child : existing,\n nonStream: child.isResponseStream ? existing : child\n }));\n\n toRet[idx] = pairNode;\n });\n\n return toRet;\n }\n}\n","import urljoin from \"url-join\";\n\nimport type { APIV1Read } from \"../../client/types\";\n\nexport function stringifyEndpointPathParts(path: APIV1Read.EndpointPathPart[]): string {\n return urljoin(\"/\", ...path.map((part) => (part.type === \"literal\" ? part.value : `:${part.value}`)));\n}\n","import dayjs from \"dayjs\";\nimport utc from \"dayjs/plugin/utc.js\";\n\nimport { FernNavigation } from \"../../../..\";\nimport type { DocsV1Read } from \"../../../../client/types\";\nimport type { NodeIdGenerator } from \"./NodeIdGenerator\";\nimport type { SlugGenerator } from \"./SlugGenerator\";\n\ndayjs.extend(utc);\n\nexport class ChangelogNavigationConverter {\n public static convert(\n changelog: DocsV1Read.ChangelogSection,\n fullSlugMap: Record<FernNavigation.V1.PageId, FernNavigation.V1.Slug>,\n noindexMap: Record<FernNavigation.V1.PageId, boolean>,\n slug: SlugGenerator,\n idgen: NodeIdGenerator\n ): FernNavigation.V1.ChangelogNode {\n return new ChangelogNavigationConverter(idgen, fullSlugMap, noindexMap).convert(changelog, slug);\n }\n\n #idgen: NodeIdGenerator;\n private constructor(\n idgen: NodeIdGenerator,\n private fullSlugMap: Record<FernNavigation.V1.PageId, FernNavigation.V1.Slug>,\n private noindexMap: Record<FernNavigation.V1.PageId, boolean>\n ) {\n this.#idgen = idgen;\n }\n\n private convert(\n changelog: DocsV1Read.ChangelogSection,\n parentSlug: SlugGenerator\n ): FernNavigation.V1.ChangelogNode {\n return this.#idgen.with(\"log\", (id) => {\n let slug = parentSlug.apply(changelog);\n const overviewPageId = changelog.pageId != null ? FernNavigation.V1.PageId(changelog.pageId) : undefined;\n const noindex = overviewPageId != null ? this.noindexMap[overviewPageId] : undefined;\n\n const frontmatterSlug = overviewPageId != null ? this.fullSlugMap[overviewPageId] : undefined;\n if (frontmatterSlug != null) {\n slug = parentSlug.set(frontmatterSlug);\n }\n\n return {\n id,\n type: \"changelog\",\n title: changelog.title ?? \"Changelog\",\n overviewPageId,\n noindex,\n slug: slug.get(),\n icon: changelog.icon,\n hidden: changelog.hidden,\n children: this.convertYear(changelog.items, slug),\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n };\n });\n }\n\n private convertYear(items: DocsV1Read.ChangelogItem[], slug: SlugGenerator): FernNavigation.V1.ChangelogYearNode[] {\n const entries = orderBy(\n items.map((item) => this.convertChangelogEntry(item, slug)),\n (entry) => entry.date,\n \"desc\"\n );\n return this.groupByYear(entries, slug);\n }\n private groupByYear(\n entries: FernNavigation.V1.ChangelogEntryNode[],\n parentSlug: SlugGenerator\n ): FernNavigation.V1.ChangelogYearNode[] {\n const years = groupByYear(entries);\n return orderBy(\n Array.from(years.entries()).map(([year, entries]) =>\n this.#idgen.with(year.toString(), (id) => {\n const slug = parentSlug.append(year.toString());\n return {\n id,\n type: \"changelogYear\" as const,\n title: year.toString(),\n year,\n slug: slug.get(),\n icon: undefined,\n hidden: undefined,\n children: this.groupByMonth(entries, slug),\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n };\n })\n ),\n \"year\",\n \"desc\"\n );\n }\n\n private groupByMonth(\n entries: FernNavigation.V1.ChangelogEntryNode[],\n parentSlug: SlugGenerator\n ): FernNavigation.V1.ChangelogMonthNode[] {\n const months = groupByMonth(entries);\n return orderBy(\n Array.from(months.entries()).map(([month, [year, entries]]) =>\n this.#idgen.with(month.toString(), (id) => ({\n id,\n type: \"changelogMonth\" as const,\n title: dayjs(new Date(year, month - 1)).format(\"MMMM YYYY\"),\n month,\n slug: parentSlug.append(month.toString()).get(),\n icon: undefined,\n hidden: undefined,\n children: entries,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n }))\n ),\n \"month\",\n \"desc\"\n );\n }\n\n private convertChangelogEntry(\n item: DocsV1Read.ChangelogItem,\n parentSlug: SlugGenerator\n ): FernNavigation.V1.ChangelogEntryNode {\n const date = dayjs.utc(item.date);\n return this.#idgen.with(date.format(\"YYYY-M-D\"), (id) => {\n const pageId = FernNavigation.V1.PageId(item.pageId);\n const noindex = this.noindexMap[pageId];\n return {\n id,\n type: \"changelogEntry\",\n title: date.format(\"MMMM D, YYYY\"),\n date: item.date,\n pageId,\n noindex,\n slug: parentSlug.append(date.format(\"YYYY/M/D\")).get(),\n icon: undefined,\n hidden: undefined,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined,\n tags: item.tags\n };\n });\n }\n}\n\nfunction orderBy<K extends string, T extends Record<K, string | number>>(\n items: T[],\n key: K,\n order?: \"asc\" | \"desc\"\n): T[];\nfunction orderBy<T>(items: T[], key: (item: T) => string | number, order?: \"asc\" | \"desc\"): T[];\nfunction orderBy<K extends string, T extends Record<K, string | number>>(\n items: T[],\n key: K | ((item: T) => string | number),\n order: \"asc\" | \"desc\" = \"asc\"\n): T[] {\n return items.concat().sort((a, b) => {\n const aValue = typeof key === \"function\" ? key(a) : a[key];\n const bValue = typeof key === \"function\" ? key(b) : b[key];\n if (aValue < bValue) {\n return order === \"asc\" ? -1 : 1;\n } else if (aValue > bValue) {\n return order === \"asc\" ? 1 : -1;\n }\n return 0;\n });\n}\n\nexport function groupByYear(entries: FernNavigation.V1.ChangelogEntryNode[]) {\n const years = new Map<number, FernNavigation.V1.ChangelogEntryNode[]>();\n for (const entry of entries) {\n const year = dayjs.utc(entry.date).year();\n const yearEntries = years.get(year) ?? [];\n yearEntries.push(entry);\n years.set(year, yearEntries);\n }\n return years;\n}\n\nexport function groupByMonth(entries: FernNavigation.V1.ChangelogEntryNode[]) {\n const months = new Map<number, [number, FernNavigation.V1.ChangelogEntryNode[]]>();\n for (const entry of entries) {\n const date = dayjs.utc(entry.date);\n const month = date.month() + 1;\n const year = date.year();\n const monthEntries = months.get(month) ?? [year, []];\n monthEntries[1].push(entry);\n months.set(month, monthEntries);\n }\n return months;\n}\n","import { FernNavigation } from \"../../../..\";\n\nexport class NodeIdGenerator {\n #ids: string[] = [];\n public with<T>(key: string, cb: (id: FernNavigation.V1.NodeId) => T): T {\n this.#ids.push(key);\n const result = cb(this.#stableId());\n this.#ids.pop();\n return result;\n }\n\n #generatedIds = new Set<string>();\n #stableId(): FernNavigation.V1.NodeId {\n const id = this.#ids.join(\".\");\n let uniqId = id;\n let i = 0;\n while (this.#generatedIds.has(uniqId)) {\n uniqId = `${id}-${i}`;\n i++;\n }\n this.#generatedIds.add(uniqId);\n return FernNavigation.V1.NodeId(uniqId);\n }\n}\n","import { FernNavigation } from \"../../../..\";\n\n/**\n * Whether `slug` is `prefix` or lives underneath it, comparing whole segments so\n * that `core-utils` is not treated as being scoped to `core`.\n */\nfunction isScopedTo(slug: string, prefix: string): boolean {\n return prefix.length > 0 && (slug === prefix || slug.startsWith(`${prefix}/`));\n}\n\n/** Whether `slug` lives strictly underneath `prefix`, i.e. it carries a remainder. */\nfunction isNestedUnder(slug: string, prefix: string): boolean {\n return prefix.length > 0 && slug.startsWith(`${prefix}/`);\n}\n\nexport class SlugGenerator {\n public static init(baseSlug: string): SlugGenerator {\n return new SlugGenerator(baseSlug, undefined, undefined, baseSlug);\n }\n private constructor(\n private baseSlug: string,\n private productSlug: string | undefined,\n private versionSlug: string | undefined,\n private slug: string\n ) {}\n\n public get(): FernNavigation.V1.Slug {\n return FernNavigation.V1.Slug(FernNavigation.V1.slugjoin(this.slug));\n }\n\n public setProductSlug(productSlug: string): SlugGenerator {\n if (this.productSlug != null) {\n if (this.productSlug === FernNavigation.V1.slugjoin(this.baseSlug, productSlug)) {\n return this;\n }\n throw new Error(\"Product already set\");\n }\n const slug = FernNavigation.V1.slugjoin(this.baseSlug, productSlug);\n if (this.baseSlug === productSlug) {\n throw new Error(\"Product slug is the same as base slug\");\n }\n return new SlugGenerator(this.baseSlug, slug, this.versionSlug, slug);\n }\n\n public setVersionSlug(versionSlug: string): SlugGenerator {\n if (this.versionSlug != null) {\n // If we have a product slug, we should always join with it\n if (this.productSlug) {\n const expectedSlug = FernNavigation.V1.slugjoin(this.productSlug, versionSlug);\n if (this.versionSlug === expectedSlug) {\n return this;\n }\n } else {\n // Only check base slug join if we don't have a product\n if (this.versionSlug === FernNavigation.V1.slugjoin(this.baseSlug, versionSlug)) {\n return this;\n }\n }\n throw new Error(\"Version already set\");\n }\n\n // When creating a new version slug, always include product if present\n const slug = this.productSlug\n ? FernNavigation.V1.slugjoin(this.productSlug, versionSlug)\n : FernNavigation.V1.slugjoin(this.baseSlug, versionSlug);\n\n if (this.baseSlug === versionSlug) {\n throw new Error(\"Version slug is the same as base slug\");\n }\n\n return new SlugGenerator(this.baseSlug, this.productSlug, slug, slug);\n }\n\n public append(slug: string): SlugGenerator {\n return new SlugGenerator(\n this.baseSlug,\n this.productSlug,\n this.versionSlug,\n FernNavigation.V1.slugjoin(this.slug, slug)\n );\n }\n\n public set(slug: string): SlugGenerator {\n // Normalize the input slug\n slug = FernNavigation.V1.slugjoin(slug);\n\n // Helper function to create a new SlugGenerator with the given slug\n const createWithSlug = (newSlug: string) => {\n return new SlugGenerator(this.baseSlug, this.productSlug, this.versionSlug, newSlug);\n };\n\n // Helper function to get the remaining part of the slug after the base\n const getRemainingAfterBase = (fullSlug: string) => fullSlug.substring(this.baseSlug.length);\n\n // Helper function to get the remaining part of the slug after the product\n const getRemainingAfterProduct = (fullSlug: string) => {\n if (this.productSlug && fullSlug.startsWith(this.productSlug)) {\n return fullSlug.substring(this.productSlug.length);\n }\n return fullSlug;\n };\n\n // The product/version slugs as written in the config, i.e. without the\n // basepath. Explicit `slug:` values are authored relative to the basepath, so\n // on a basepath site they are scoped by these rather than by the absolute ones.\n const relativeProductSlug = this.relativeToBase(this.productSlug);\n const relativeVersionSlug = this.relativeToBase(this.versionSlug);\n\n // If we have both product and version slugs\n if (this.productSlug != null && this.versionSlug != null) {\n // If the slug starts with the product, insert version\n if (slug.startsWith(this.productSlug)) {\n const remaining = getRemainingAfterProduct(slug);\n return createWithSlug(FernNavigation.V1.slugjoin(this.versionSlug, remaining));\n }\n\n // If the slug starts with the base, handle appropriately\n if (this.baseSlug.length > 0 && slug.startsWith(this.baseSlug)) {\n const remaining = getRemainingAfterBase(slug);\n return createWithSlug(FernNavigation.V1.slugjoin(this.baseSlug, remaining));\n }\n\n // The slug is scoped to the version, but written relative to the basepath\n if (relativeVersionSlug != null && isScopedTo(slug, relativeVersionSlug)) {\n return createWithSlug(FernNavigation.V1.slugjoin(this.baseSlug, slug));\n }\n\n // The slug is scoped to the product, but written relative to the basepath\n if (relativeProductSlug != null && isScopedTo(slug, relativeProductSlug)) {\n const remaining = slug.substring(relativeProductSlug.length);\n return createWithSlug(FernNavigation.V1.slugjoin(this.versionSlug, remaining));\n }\n\n // Otherwise, join with version\n return createWithSlug(FernNavigation.V1.slugjoin(this.versionSlug, slug));\n }\n\n // If we have a version slug\n if (this.versionSlug != null) {\n if (slug.startsWith(this.versionSlug)) {\n return createWithSlug(slug);\n }\n\n if (this.baseSlug.length > 0 && slug.startsWith(this.baseSlug)) {\n return createWithSlug(FernNavigation.V1.slugjoin(this.versionSlug, getRemainingAfterBase(slug)));\n }\n\n // The slug is scoped to the version, but written relative to the basepath\n if (relativeVersionSlug != null && isScopedTo(slug, relativeVersionSlug)) {\n return createWithSlug(FernNavigation.V1.slugjoin(this.baseSlug, slug));\n }\n\n return createWithSlug(FernNavigation.V1.slugjoin(this.versionSlug, slug));\n }\n\n // If we have a product slug\n if (this.productSlug != null) {\n if (slug.startsWith(this.productSlug)) {\n return createWithSlug(slug);\n }\n\n if (this.baseSlug.length > 0 && slug.startsWith(this.baseSlug)) {\n return createWithSlug(FernNavigation.V1.slugjoin(getRemainingAfterBase(slug)));\n }\n\n // The slug is scoped to the product, but written relative to the basepath\n if (relativeProductSlug != null && isScopedTo(slug, relativeProductSlug)) {\n return createWithSlug(FernNavigation.V1.slugjoin(this.baseSlug, slug));\n }\n\n return createWithSlug(FernNavigation.V1.slugjoin(this.productSlug, slug));\n }\n\n // If we have a base slug\n if (this.baseSlug.length > 0) {\n if (slug.startsWith(this.baseSlug)) {\n return createWithSlug(slug);\n }\n\n return createWithSlug(FernNavigation.V1.slugjoin(this.baseSlug, slug));\n }\n\n // If no special handling is needed, just use the slug as is\n return createWithSlug(slug);\n }\n\n public apply({\n fullSlug,\n urlSlug,\n skipUrlSlug\n }: {\n fullSlug?: string[];\n skipUrlSlug?: boolean;\n urlSlug: string;\n }): SlugGenerator {\n if (skipUrlSlug) {\n return this;\n }\n\n if (fullSlug != null) {\n return this.set(fullSlug.join(\"/\"));\n }\n\n // An explicit `slug:` written at the root of a product or version is authored\n // relative to the basepath, so it may restate the scope segment it already\n // lives under. Appending it verbatim would emit that segment twice. A slug\n // that only equals the scope segment (a tab or section named after its\n // product) restates nothing, so it still nests underneath it.\n if (\n this.slug === this.scopeSlug &&\n isNestedUnder(FernNavigation.V1.slugjoin(urlSlug), this.relativeScopeSlug)\n ) {\n return this.set(urlSlug);\n }\n\n return this.append(urlSlug);\n }\n\n /** The product/version prefix that child slugs hang off of. */\n private get scopeSlug(): string {\n return this.versionSlug ?? this.productSlug ?? this.baseSlug;\n }\n\n /** {@link scopeSlug} as authored in the config, i.e. without the basepath. */\n private get relativeScopeSlug(): string {\n return this.relativeToBase(this.scopeSlug);\n }\n\n private relativeToBase(slug: string): string;\n private relativeToBase(slug: string | undefined): string | undefined;\n private relativeToBase(slug: string | undefined): string | undefined {\n if (slug == null || this.baseSlug.length === 0 || !isScopedTo(slug, this.baseSlug)) {\n return slug;\n }\n return slug.substring(this.baseSlug.length + 1);\n }\n}\n","import { mapValues } from \"es-toolkit/object\";\n\nimport { FernNavigation } from \"../../../..\";\nimport { APIV1Read, type DocsV2Read } from \"../../../../client/types\";\nimport { getFrontmatter } from \"../../../utils/getFrontmatter\";\nimport { getNoIndexFromFrontmatter } from \"../../../utils/getNoIndexFromFrontmatter\";\nimport { getFullSlugFromFrontmatter } from \"./getFullSlugFromFrontmatter\";\nimport { NavigationConfigConverter } from \"./NavigationConfigConverter\";\n\nexport function toRootNode(\n response: DocsV2Read.LoadDocsForUrlResponse,\n disableEndpointPairs: boolean = false,\n paginated?: boolean\n): FernNavigation.V1.RootNode {\n const noindexMap: Record<FernNavigation.V1.PageId, boolean> = {};\n const fullSlugMap: Record<FernNavigation.V1.PageId, FernNavigation.V1.Slug> = {};\n Object.entries(response.definition.pages).forEach(([pageId, page]) => {\n if (page == null) {\n return;\n }\n const frontmatter = getFrontmatter(page.markdown);\n if (frontmatter == null) {\n return;\n }\n\n const noindex = getNoIndexFromFrontmatter(frontmatter);\n if (noindex != null) {\n noindexMap[FernNavigation.V1.PageId(pageId)] = noindex;\n }\n\n // get full slug from frontmatter\n const fullSlug = getFullSlugFromFrontmatter(frontmatter);\n if (fullSlug != null) {\n fullSlugMap[FernNavigation.V1.PageId(pageId)] = fullSlug;\n }\n });\n\n if (response.definition.config.root) {\n return response.definition.config.root as FernNavigation.V1.RootNode;\n } else if (response.definition.config.navigation) {\n return NavigationConfigConverter.convert(\n response.definition.config.title,\n response.definition.config.navigation,\n fullSlugMap,\n noindexMap,\n hackReorderApis(\n response.definition.apis as Record<string, APIV1Read.ApiDefinition>,\n response.baseUrl.domain\n ),\n response.baseUrl.basePath,\n isLexicographicSortEnabled(response.baseUrl.domain),\n disableEndpointPairs,\n paginated\n );\n } else {\n console.error(\"No root node found\");\n return {\n type: \"root\",\n version: \"v1\",\n child: {\n type: \"unversioned\",\n id: FernNavigation.V1.NodeId(\"root-unversioned\"),\n collapsed: undefined,\n child: {\n type: \"sidebarRoot\",\n id: FernNavigation.V1.NodeId(\"root-sidebar\"),\n collapsed: undefined,\n children: []\n },\n landingPage: undefined\n },\n title: response.definition.config.title ?? \"\",\n slug: FernNavigation.V1.Slug(\"\"),\n icon: undefined,\n hidden: undefined,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined,\n id: FernNavigation.V1.NodeId(\"root\"),\n pointsTo: undefined,\n roles: undefined\n };\n }\n}\n\nfunction isLexicographicSortEnabled(domain: string): boolean {\n // HACKHACK: This is a temporary solution to enable lexicographic sorting for AIA docs.\n // Vercel's edge config UI is broken right now so we can't modify it there.\n return domain.toLowerCase().includes(\"aia.docs.buildwithfern.com\");\n}\n\nfunction hackReorderApis(\n apis: Record<string, APIV1Read.ApiDefinition>,\n domain: string\n): Record<string, APIV1Read.ApiDefinition> {\n if (!domain.includes(\"assemblyai\")) {\n return apis;\n }\n\n return mapValues(apis, (api) => hackReorderAssemblyApi(api));\n}\n\nfunction hackReorderAssemblyApi(api: APIV1Read.ApiDefinition): APIV1Read.ApiDefinition {\n const SUBPACKAGE_REALTIME = APIV1Read.SubpackageId(\"subpackage_realtime\");\n const SUBPACKAGE_STREAMING = APIV1Read.SubpackageId(\"subpackage_streaming\");\n\n const realtime = api.subpackages[SUBPACKAGE_REALTIME];\n const streaming = api.subpackages[SUBPACKAGE_STREAMING];\n\n if (realtime == null || streaming == null) {\n return api;\n }\n\n streaming.endpoints = [...realtime.endpoints, ...streaming.endpoints];\n streaming.websockets = [...realtime.websockets, ...streaming.websockets];\n streaming.webhooks = [...realtime.webhooks, ...streaming.webhooks];\n\n delete api.subpackages[SUBPACKAGE_REALTIME];\n\n api.rootPackage.subpackages = api.rootPackage.subpackages.filter(\n (subpackageId) => subpackageId !== SUBPACKAGE_REALTIME\n );\n\n return api;\n}\n","/**\n * The use of gray-matter package is not allowed in edge-side code, because it uses `eval` internally.\n * https://github.com/jonschlinkert/gray-matter/blob/ce67a86dba419381db0dd01cc84e2d30a1d1e6a5/lib/engines.js#L43\n */\nexport function getFrontmatter(markdown: string): string | undefined {\n const frontmatterMatch = /^---\\s*([\\s\\S]*?)\\s*---/.exec(markdown.trimStart());\n if (!frontmatterMatch || frontmatterMatch[1] == null) {\n return undefined;\n }\n return frontmatterMatch[1];\n}\n","/**\n * As as temporary workaround, we'll use a simple regex to extract the frontmatter and check for `noindex: true` or `noindex: false`.\n */\nexport function getNoIndexFromFrontmatter(frontmatter: string): boolean | undefined {\n if (/noindex:\\s*true/.test(frontmatter)) {\n return true;\n } else if (/noindex:\\s*false/.test(frontmatter)) {\n return false;\n }\n return undefined;\n}\n","import { FernNavigation } from \"../../../..\";\n\n/**\n * As as temporary workaround, we'll use a simple regex to extract the frontmatter and check for\n * `slug: a/b/c` or `slug: /a/b/c` or `slug: \"a/b/c\"` or `slug: \"/a/b/c/\"`.\n */\nexport function getFullSlugFromFrontmatter(frontmatter: string): FernNavigation.V1.Slug | undefined {\n const match = frontmatter.match(/slug:\\s*\"?([^\"\\n\\s]+)\"?/);\n if (match != null && match[1] != null) {\n return FernNavigation.V1.slugjoin(match[1]);\n }\n return undefined;\n}\n","import assertNever from \"@fern-api/ui-core-utils/assertNever\";\nimport visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\nimport { kebabCase } from \"es-toolkit/string\";\n\nimport { FernNavigation } from \"../../../..\";\nimport type { APIV1Read, DocsV1Read } from \"../../../../client/types\";\nimport {\n visitReadNavigationConfig,\n visitUnversionedReadNavigationConfig\n} from \"../../../../client/visitReadNavigationConfig\";\nimport { ApiReferenceNavigationConverter } from \"./ApiReferenceNavigationConverter\";\nimport { ChangelogNavigationConverter } from \"./ChangelogConverter\";\nimport { NodeIdGenerator } from \"./NodeIdGenerator\";\nimport { SlugGenerator } from \"./SlugGenerator\";\n\nexport class NavigationConfigConverter {\n private constructor(\n private title: string | undefined,\n private config: DocsV1Read.NavigationConfig,\n private fullSlugMap: Record<FernNavigation.V1.PageId, FernNavigation.V1.Slug>,\n private noindexMap: Record<FernNavigation.V1.PageId, boolean>,\n private apis: Record<string, APIV1Read.ApiDefinition>,\n private basePath: string | undefined,\n private lexicographic?: boolean,\n private disableEndpointPairs?: boolean,\n private paginated?: boolean\n ) {}\n\n public static convert(\n title: string | undefined,\n config: DocsV1Read.NavigationConfig,\n fullSlugMap: Record<FernNavigation.V1.PageId, FernNavigation.V1.Slug>,\n noindexMap: Record<FernNavigation.V1.PageId, boolean>,\n apis: Record<string, APIV1Read.ApiDefinition>,\n basePath: string | undefined,\n lexicographic?: boolean,\n disableEndpointPairs?: boolean,\n paginated?: boolean\n ): FernNavigation.V1.RootNode {\n return new NavigationConfigConverter(\n title,\n config,\n fullSlugMap,\n noindexMap,\n apis,\n basePath,\n lexicographic,\n disableEndpointPairs,\n paginated\n ).convert();\n }\n\n #idgen = new NodeIdGenerator();\n private convert(): FernNavigation.V1.RootNode {\n return this.#idgen.with(\"root\", (id) => {\n const baseSlug = SlugGenerator.init(this.basePath ?? \"\");\n const child = visitReadNavigationConfig<FernNavigation.V1.RootChild>(this.config, {\n versioned: (versioned) => this.convertVersionedNavigationConfig(versioned, baseSlug),\n unversioned: (unversioned) => this.convertUnversionedNavigationConfig(unversioned, baseSlug)\n });\n let pointsTo = FernNavigation.V1.followRedirect(child);\n if (pointsTo != null && child.type === \"versioned\") {\n const defaultVersion = child.children.find((v) => v.default);\n if (defaultVersion != null) {\n pointsTo = FernNavigation.V1.toDefaultSlug(pointsTo, baseSlug.get(), defaultVersion.slug);\n }\n }\n\n const toRet: FernNavigation.V1.RootNode = {\n id,\n type: \"root\",\n version: \"v1\",\n child,\n slug: baseSlug.get(),\n\n title: this.title ?? \"Documentation\",\n hidden: false,\n icon: undefined,\n pointsTo,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n roles: undefined,\n featureFlags: undefined\n };\n\n // tag all children of hidden nodes as hidden\n FernNavigation.V1.traverseDF(toRet, (node, parents) => {\n if (\n FernNavigation.V1.hasMetadata(node) &&\n parents.some((p) => FernNavigation.V1.hasMetadata(p) && p.hidden)\n ) {\n node.hidden = true;\n }\n });\n\n return toRet;\n });\n }\n\n private convertVersionedNavigationConfig(\n versioned: DocsV1Read.VersionedNavigationConfig,\n parentSlug: SlugGenerator\n ): FernNavigation.V1.VersionedNode {\n return this.#idgen.with(\"\", (id) => {\n const children = versioned.versions.map((version, idx): FernNavigation.V1.VersionNode => {\n const slug = parentSlug.setVersionSlug(version.urlSlug);\n return this.#idgen.with(version.urlSlug, (id): FernNavigation.V1.VersionNode => {\n const child = this.convertUnversionedNavigationConfig(version.config, slug);\n const pointsTo = FernNavigation.V1.followRedirect(child);\n return {\n id,\n type: \"version\",\n title: version.version,\n default: idx === 0,\n // the versionId must match `indexSegmentsByVersionId`\n versionId: FernNavigation.V1.VersionId(version.version),\n slug: slug.get(),\n icon: undefined,\n hidden: false,\n child: child.child,\n availability: FernNavigation.V1.convertAvailability(version.availability),\n pointsTo,\n landingPage: child.landingPage,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined,\n announcement: undefined\n };\n });\n });\n return { id, type: \"versioned\", collapsed: undefined, children };\n });\n }\n\n private convertUnversionedNavigationConfig(\n unversioned: DocsV1Read.UnversionedNavigationConfig,\n parentSlug: SlugGenerator\n ): FernNavigation.V1.UnversionedNode {\n return this.#idgen.with(\"uv\", (id) => {\n const child = visitUnversionedReadNavigationConfig<FernNavigation.V1.VersionChild>(unversioned, {\n tabbed: (tabbed) => ({\n id,\n type: \"tabbed\",\n collapsed: undefined,\n children: tabbed.tabs.map((tab): FernNavigation.V1.TabChild => {\n if (tab.type === \"group\" || tab.type == null) {\n return this.#idgen.with(tab.urlSlug, (id) => {\n const slug = parentSlug.apply(tab);\n const child: FernNavigation.V1.SidebarRootNode = this.#idgen.with(\n tab.urlSlug,\n (id) => ({\n id,\n type: \"sidebarRoot\",\n collapsed: undefined,\n children: this.groupSidebarRootChildren(\n tab.items.map((item) => this.convertNavigationItem(item, slug))\n )\n })\n );\n const pointsTo = FernNavigation.V1.followRedirect(child);\n return {\n id,\n type: \"tab\",\n title: tab.title,\n slug: slug.get(),\n icon: tab.icon,\n hidden: tab.hidden,\n child,\n pointsTo,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n };\n });\n } else if (tab.type === \"link\") {\n return this.#idgen.with(\"link\", (id) => ({\n id,\n type: \"link\",\n collapsed: undefined,\n title: tab.title,\n url: FernNavigation.V1.Url(tab.url),\n icon: tab.icon,\n target: tab.target\n }));\n } else if (tab.type === \"changelog\") {\n const slug = parentSlug.apply(tab);\n return ChangelogNavigationConverter.convert(\n tab,\n this.fullSlugMap,\n this.noindexMap,\n slug,\n this.#idgen\n );\n } else if (tab.type === \"changelogV3\") {\n return tab.node as unknown as FernNavigation.V1.ChangelogNode;\n } else {\n assertNever(tab);\n }\n })\n }),\n untabbed: (untabbed) => ({\n id,\n type: \"sidebarRoot\",\n collapsed: undefined,\n children: this.groupSidebarRootChildren(\n untabbed.items.map((item) => this.convertNavigationItem(item, parentSlug))\n )\n })\n });\n return {\n id,\n type: \"unversioned\",\n collapsed: undefined,\n child,\n landingPage: this.#idgen.with(\"landing-page\", (id) => {\n if (unversioned.landingPage == null) {\n return undefined;\n }\n\n const pageId = FernNavigation.V1.PageId(unversioned.landingPage.id);\n return {\n id,\n type: \"landingPage\",\n pageId,\n title: unversioned.landingPage.title,\n slug: parentSlug.apply(unversioned.landingPage).get(),\n icon: unversioned.landingPage.icon,\n hidden: unversioned.landingPage.hidden,\n noindex: this.noindexMap[pageId],\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n };\n }),\n authed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n };\n });\n }\n\n private groupSidebarRootChildren(\n children: FernNavigation.V1.NavigationChild[]\n ): FernNavigation.V1.SidebarRootChild[] {\n const grouped: FernNavigation.V1.SidebarRootChild[] = [];\n children.forEach((child) => {\n if (child.type === \"apiReference\") {\n grouped.push(child);\n return;\n }\n\n if (child.type === \"section\" && !child.collapsible) {\n grouped.push(child);\n return;\n }\n\n const lastChild = grouped.length > 0 ? grouped[grouped.length - 1] : undefined;\n let sidebarGroup: FernNavigation.V1.SidebarGroupNode;\n if (lastChild?.type === \"sidebarGroup\") {\n sidebarGroup = lastChild;\n } else {\n sidebarGroup = this.#idgen.with(\"group\", (id) => ({\n id,\n type: \"sidebarGroup\",\n collapsed: undefined,\n children: []\n }));\n grouped.push(sidebarGroup);\n }\n\n sidebarGroup.children.push(child);\n });\n return grouped;\n }\n\n private convertNavigationItem(\n item: DocsV1Read.NavigationItem,\n parentSlug: SlugGenerator\n ): FernNavigation.V1.NavigationChild {\n return visitDiscriminatedUnion(item, \"type\")._visit<FernNavigation.V1.NavigationChild>({\n page: (page) =>\n this.#idgen.with(page.urlSlug, (id) => {\n const pageId = FernNavigation.V1.PageId(page.id);\n return {\n id,\n type: \"page\",\n pageId,\n title: page.title,\n slug: parentSlug.apply(page).get(),\n icon: page.icon,\n hidden: page.hidden,\n noindex: this.noindexMap[pageId],\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined,\n availability: undefined\n };\n }),\n link: (link) =>\n this.#idgen.with(kebabCase(link.title), (id) => ({\n id,\n type: \"link\",\n collapsed: undefined,\n title: link.title,\n url: FernNavigation.V1.Url(link.url),\n icon: link.icon,\n target: link.target\n })),\n section: (section) =>\n this.#idgen.with(section.urlSlug, (id) => {\n let slug = parentSlug.apply(section);\n\n const children = section.items.map((item) => this.convertNavigationItem(item, slug));\n const pointsTo = FernNavigation.V1.followRedirects(children);\n const overviewPageId =\n section.overviewPageId != null ? FernNavigation.V1.PageId(section.overviewPageId) : undefined;\n const noindex = overviewPageId != null ? this.noindexMap[overviewPageId] : undefined;\n\n const frontmatterSlug = overviewPageId != null ? this.fullSlugMap[overviewPageId] : undefined;\n if (frontmatterSlug != null) {\n slug = parentSlug.set(frontmatterSlug);\n }\n\n const resolvedCollapsible = section.collapsible ?? (section.collapsed === true ? true : undefined);\n const resolvedCollapsedByDefault =\n section.collapsedByDefault ?? (section.collapsed === true ? true : undefined);\n\n return {\n id,\n type: \"section\",\n collapsed: section.collapsed,\n collapsible: resolvedCollapsible,\n collapsedByDefault: resolvedCollapsedByDefault,\n title: section.title,\n icon: section.icon,\n hidden: section.hidden,\n overviewPageId,\n noindex,\n slug: slug.get(),\n children,\n pointsTo,\n authed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined,\n availability: undefined\n };\n }),\n api: (apiSection) => {\n const api = this.apis[apiSection.api];\n if (api == null) {\n console.error(`API ${apiSection.api} not found in available APIs, rendering empty API reference`);\n return this.#idgen.with(apiSection.urlSlug, (id) => ({\n id,\n type: \"apiReference\" as const,\n title: apiSection.title,\n apiDefinitionId: FernNavigation.V1.ApiDefinitionId(apiSection.api),\n overviewPageId: undefined,\n noindex: undefined,\n paginated: undefined,\n slug: parentSlug.apply(apiSection).get(),\n icon: apiSection.icon,\n hidden: apiSection.hidden,\n hideTitle: apiSection.flattened,\n showErrors: apiSection.showErrors,\n changelog: undefined,\n children: [],\n availability: undefined,\n pointsTo: undefined,\n playground: undefined,\n postmanCollectionUrl: undefined,\n authed: undefined,\n collapsed: undefined,\n viewers: undefined,\n orphaned: undefined,\n featureFlags: undefined\n }));\n }\n return ApiReferenceNavigationConverter.convert(\n apiSection,\n api,\n this.fullSlugMap,\n this.noindexMap,\n parentSlug,\n this.#idgen,\n this.lexicographic,\n this.disableEndpointPairs,\n this.paginated\n );\n },\n changelog: (changelog) =>\n ChangelogNavigationConverter.convert(\n changelog,\n this.fullSlugMap,\n this.noindexMap,\n parentSlug,\n this.#idgen\n ),\n // Note: apiSection.node is imported from `navigation`, and is guaranteed to be a FernNavigation.V1.ApiReferenceNode\n apiV2: (apiSection) => {\n const node = apiSection.node as unknown as FernNavigation.V1.ApiReferenceNode;\n if (this.paginated) {\n node.paginated = true;\n }\n return node;\n },\n changelogV3: (changelog) => changelog.node as unknown as FernNavigation.V1.ChangelogNode,\n _other: (value) => assertNever(value as never)\n });\n }\n}\n","import type { WithNodeMetadata } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\n\n/**\n * A navigation node that has a title and a slug\n */\nexport type NavigationNodeWithMetadata = Extract<NavigationNode, WithNodeMetadata>;\n\nexport function hasMetadata(node: NavigationNode): node is NavigationNodeWithMetadata {\n return (\n typeof (node as NavigationNodeWithMetadata).title === \"string\" &&\n typeof (node as NavigationNodeWithMetadata).slug === \"string\"\n );\n}\n","import visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\n\nimport type { FernNavigation } from \"../../..\";\nimport { hasMetadata } from \"./NavigationNodeWithMetadata\";\n\nexport function followRedirect(\n nodeToFollow: FernNavigation.V1.NavigationNode | undefined\n): FernNavigation.V1.Slug | undefined {\n if (nodeToFollow == null) {\n return undefined;\n }\n return visitDiscriminatedUnion(nodeToFollow)._visit<FernNavigation.V1.Slug | undefined>({\n link: () => undefined,\n\n // leaf nodes\n page: (node) => node.slug,\n changelog: (node) => node.slug,\n changelogYear: (node) => node.slug,\n changelogMonth: (node) => node.slug,\n changelogEntry: (node) => node.slug,\n endpoint: (node) => node.slug,\n webSocket: (node) => node.slug,\n webhook: (node) => node.slug,\n grpc: (node) => node.slug,\n graphql: (node) => node.slug,\n graphqlType: (node) => node.slug,\n landingPage: (node) => node.slug,\n\n // nodes with overview\n apiPackage: (node) => (node.overviewPageId != null ? node.slug : followRedirects(node.children)),\n section: (node) => (node.overviewPageId != null ? node.slug : followRedirects(node.children)),\n apiReference: (node) => (node.overviewPageId != null ? node.slug : followRedirects(node.children)),\n\n product: (node) => followRedirect(node.child),\n productLink: () => undefined,\n productgroup: (node) => followRedirect(node.landingPage ?? node.children.filter((node) => !node.hidden)[0]),\n // version is a special case where it should only consider it's first child (the first version)\n versioned: (node) => followRedirect(node.children.filter((node) => !node.hidden)[0]),\n unversioned: (node) => followRedirect(node.landingPage ?? node.child),\n varianted: (node) => followRedirect(node.children.filter((node) => !node.hidden)[0]),\n variant: (node) => followRedirects(node.children),\n tabbed: (node) => followRedirects(node.children),\n sidebarRoot: (node) => followRedirects(node.children),\n endpointPair: (node) => followRedirect(node.nonStream),\n root: (node) => followRedirect(node.child),\n version: (node) => followRedirect(node.child),\n tab: (node) => followRedirect(node.child),\n sidebarGroup: (node) => followRedirects(node.children)\n });\n}\n\nexport function followRedirects(nodes: FernNavigation.V1.NavigationNode[]): FernNavigation.V1.Slug | undefined {\n for (const node of nodes) {\n // skip hidden nodes\n if (hasMetadata(node) && node.hidden) {\n continue;\n }\n const redirect = followRedirect(node);\n if (redirect != null) {\n return redirect;\n }\n }\n return;\n}\n","import visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\n\nimport type { NavigationNodePage, PageId } from \".\";\n\nconst RETURN_PAGEID = (node: { pageId: PageId }) => node.pageId;\nconst RETURN_OVERVIEW_PAGEID = (node: { overviewPageId?: PageId }) => node.overviewPageId;\nconst RETURN_UNDEFINED = () => undefined;\n\nexport function getPageId(node: NavigationNodePage): PageId | undefined {\n return visitDiscriminatedUnion(node)._visit({\n section: RETURN_OVERVIEW_PAGEID,\n apiReference: RETURN_OVERVIEW_PAGEID,\n changelog: RETURN_OVERVIEW_PAGEID,\n apiPackage: RETURN_OVERVIEW_PAGEID,\n changelogEntry: RETURN_PAGEID,\n page: RETURN_PAGEID,\n landingPage: RETURN_PAGEID,\n\n // if the following changes, make sure to update the algolia records generator\n endpoint: RETURN_UNDEFINED,\n webSocket: RETURN_UNDEFINED,\n webhook: RETURN_UNDEFINED,\n grpc: RETURN_UNDEFINED,\n graphql: RETURN_UNDEFINED,\n graphqlType: RETURN_UNDEFINED,\n changelogYear: RETURN_UNDEFINED,\n changelogMonth: RETURN_UNDEFINED\n });\n}\n","import type { EndpointNode, GraphQlNode, GraphQlTypeNode, GrpcNode, WebhookNode, WebSocketNode } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\n\n/**\n * A node in the navigation tree that represents an API endpoint, web socket, or webhook.\n */\nexport type NavigationNodeApiLeaf =\n | EndpointNode\n | WebSocketNode\n | WebhookNode\n | GrpcNode\n | GraphQlNode\n | GraphQlTypeNode;\n\nexport function isApiLeaf(node: NavigationNode): node is NavigationNodeApiLeaf {\n return (\n node.type === \"endpoint\" ||\n node.type === \"webSocket\" ||\n node.type === \"webhook\" ||\n node.type === \"grpc\" ||\n node.type === \"graphql\" ||\n node.type === \"graphqlType\"\n );\n}\n","import type { ChangelogEntryNode, LandingPageNode, PageNode } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\n\n/**\n * A leaf node that contains primarily markdown content\n */\nexport type NavigationNodeMarkdownLeaf = ChangelogEntryNode | PageNode | LandingPageNode;\n\nexport function isMarkdownLeaf(node: NavigationNode): node is NavigationNodeMarkdownLeaf {\n return node.type === \"page\" || node.type === \"landingPage\" || node.type === \"changelogEntry\";\n}\n","import type { LinkNode } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\nimport { isApiLeaf, type NavigationNodeApiLeaf } from \"./NavigationNodeApiLeaf\";\nimport { isMarkdownLeaf, type NavigationNodeMarkdownLeaf } from \"./NavigationNodePageLeaf\";\n\n/**\n * A navigation node that represents a leaf in the navigation tree (i.e. a node that does not have children)\n */\nexport type NavigationNodeLeaf = NavigationNodeApiLeaf | NavigationNodeMarkdownLeaf | LinkNode;\n\nexport function isLeaf(node: NavigationNode): node is NavigationNodeLeaf {\n return isApiLeaf(node) || isMarkdownLeaf(node) || node.type === \"link\";\n}\n","import type { ApiPackageNode, ApiReferenceNode, ChangelogNode, SectionNode } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\n\n/**\n * A navigation node that isn't a leaf node and contains markdown content\n */\nexport type NavigationNodeSection = SectionNode | ApiReferenceNode | ChangelogNode | ApiPackageNode;\n\nexport function isSection(node: NavigationNode): node is NavigationNodeSection {\n return (\n node.type === \"section\" ||\n node.type === \"apiReference\" ||\n node.type === \"changelog\" ||\n node.type === \"apiPackage\"\n );\n}\n","import type { PageId, WithOverviewPage } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\nimport { isSection, type NavigationNodeSection } from \"./NavigationNodeSection\";\n\ntype WithRequiredOverviewPage<T extends WithOverviewPage> = T & {\n overviewPageId: PageId;\n};\n\n/**\n * A navigation node that isn't a leaf node and contains markdown content\n */\nexport type NavigationNodeSectionOverview = WithRequiredOverviewPage<NavigationNodeSection>;\n\nexport function isSectionOverview(node: NavigationNode): node is NavigationNodeSectionOverview {\n return isSection(node) && node.overviewPageId != null;\n}\n","import type { NavigationNode } from \"./NavigationNode\";\nimport { isMarkdownLeaf, type NavigationNodeMarkdownLeaf } from \"./NavigationNodePageLeaf\";\nimport { isSectionOverview, type NavigationNodeSectionOverview } from \"./NavigationNodeSectionOverview\";\n\n/**\n * A navigation node that contains markdown content\n */\nexport type NavigationNodeWithMarkdown = NavigationNodeSectionOverview | NavigationNodeMarkdownLeaf;\n\nexport function hasMarkdown(node: NavigationNode): node is NavigationNodeWithMarkdown {\n return isMarkdownLeaf(node) || isSectionOverview(node);\n}\n","import type { ChangelogEntryNode, ChangelogNode, PageNode } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\nimport { isApiLeaf, type NavigationNodeApiLeaf } from \"./NavigationNodeApiLeaf\";\nimport { isSectionOverview, type NavigationNodeSectionOverview } from \"./NavigationNodeSectionOverview\";\n\nexport type NavigationNodeNeighbor =\n | NavigationNodeApiLeaf\n | PageNode\n | ChangelogNode\n | ChangelogEntryNode\n | NavigationNodeSectionOverview;\n\nexport function isNeighbor(node: NavigationNode): node is NavigationNodeNeighbor {\n return (\n isApiLeaf(node) ||\n node.type === \"page\" ||\n node.type === \"changelog\" ||\n node.type === \"changelogEntry\" ||\n isSectionOverview(node)\n );\n}\n","import type { ChangelogMonthNode, ChangelogNode, ChangelogYearNode } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\nimport { isApiLeaf, type NavigationNodeApiLeaf } from \"./NavigationNodeApiLeaf\";\nimport { hasMarkdown, type NavigationNodeWithMarkdown } from \"./NavigationNodeMarkdown\";\n\n/**\n * A navigation node that represents a visitable page in the documentation\n */\nexport type NavigationNodePage =\n | NavigationNodeWithMarkdown\n | NavigationNodeApiLeaf\n | ChangelogNode\n | ChangelogYearNode\n | ChangelogMonthNode;\n\nexport function isPage(node: NavigationNode): node is NavigationNodePage {\n return (\n isApiLeaf(node) ||\n node.type === \"changelog\" ||\n // TODO: Uncomment when changelog years and months are visitable\n // node.type === \"changelogYear\" ||\n // node.type === \"changelogMonth\" ||\n hasMarkdown(node)\n );\n}\n","import type { WithRedirect } from \".\";\nimport type { NavigationNode } from \"./NavigationNode\";\n\n/**\n * Navigation nodes that extend WithRedirect\n */\nexport type NavigationNodeWithRedirect = Extract<NavigationNode, WithRedirect>;\n\nexport function hasRedirect(node: NavigationNode): node is NavigationNodeWithRedirect {\n return typeof (node as NavigationNodeWithRedirect).pointsTo === \"string\";\n}\n","import urljoin from \"url-join\";\n\nimport { Slug } from \".\";\n\n// normalizes slug parts and joins them with a single slash\nexport function slugjoin(...parts: string[]): Slug {\n const trimmedParts = parts.map((part) => part.trim());\n const joined = urljoin(trimmedParts) ?? \"\";\n const normalized = joined.replaceAll(\"//*\", \"/\").replace(/^\\//, \"\").replace(/\\/$/, \"\");\n\n return Slug(normalized);\n}\n","import { escapeRegExp } from \"es-toolkit/string\";\n\nimport { Slug } from \".\";\n\n/**\n * All versioned slugs are prefixed with the version slug, but the default version may be accessed without the version prefix.\n * toDefaultSlug creates the \"unversioned\" slug for pages under the default version.\n * This should be treated as the cannonical slug for that page.\n */\nexport function toDefaultSlug(slug: Slug, rootSlug: Slug, versionSlug: Slug): Slug;\nexport function toDefaultSlug(slug: Slug | undefined, rootSlug: Slug, versionSlug: Slug): Slug | undefined;\nexport function toDefaultSlug(slug: Slug | undefined, rootSlug: Slug, versionSlug: Slug): Slug | undefined {\n if (slug == null) {\n return undefined;\n }\n if (slug.startsWith(versionSlug)) {\n return Slug(slug.replace(new RegExp(`^${escapeRegExp(versionSlug)}`), rootSlug).replace(/^\\//, \"\"));\n }\n return slug;\n}\n","import { UnreachableCaseError } from \"ts-essentials\";\n\nimport type { NavigationNode } from \"./NavigationNode\";\nimport { isLeaf } from \"./NavigationNodeLeaf\";\n\nexport function getChildren(node: NavigationNode): readonly NavigationNode[] {\n if (isLeaf(node)) {\n return [];\n }\n\n switch (node.type) {\n case \"apiPackage\":\n case \"changelog\":\n case \"changelogMonth\":\n case \"changelogYear\":\n case \"section\":\n case \"sidebarGroup\":\n case \"sidebarRoot\":\n case \"tabbed\":\n case \"versioned\":\n case \"varianted\":\n case \"variant\":\n return node.children;\n case \"product\":\n case \"root\":\n case \"tab\":\n return [node.child];\n case \"productLink\":\n return [];\n case \"apiReference\":\n return [...node.children, ...(node.changelog ? [node.changelog] : [])];\n case \"endpointPair\":\n return [node.nonStream, node.stream];\n case \"productgroup\":\n return [\n ...(node.landingPage ? [node.landingPage] : []),\n ...node.children,\n ...(node.changelog ? [node.changelog] : [])\n ];\n case \"unversioned\":\n case \"version\":\n return [...(node.landingPage ? [node.landingPage] : []), node.child];\n default:\n throw new UnreachableCaseError(node);\n }\n}\n","import { dfs } from \"../../../utils/traversers/dfs\";\nimport type { TraverserVisit } from \"../../../utils/traversers/types\";\nimport { getChildren } from \"./getChildren\";\nimport type { NavigationNode } from \"./NavigationNode\";\n\nexport function traverseDF(node: NavigationNode, visit: TraverserVisit<NavigationNode>): void {\n return dfs(node, visit, getChildren);\n}\n","import type { FernNavigation } from \"../..\";\nimport { hasMetadata, hasRedirect, toDefaultSlug, traverseDF } from \"../versions\";\n\nexport function pruneVersionNode<T extends FernNavigation.NavigationNode>(\n node: T,\n rootSlug: FernNavigation.Slug,\n versionSlug: FernNavigation.Slug\n): T;\nexport function pruneVersionNode<T extends FernNavigation.NavigationNode>(\n node: T | undefined,\n rootSlug: FernNavigation.Slug,\n versionSlug: FernNavigation.Slug\n): T | undefined;\nexport function pruneVersionNode<T extends FernNavigation.NavigationNode>(\n node: T | undefined,\n rootSlug: FernNavigation.Slug,\n versionSlug: FernNavigation.Slug\n): T | undefined {\n if (node == null) {\n return undefined;\n }\n traverseDF(node, (node) => {\n if (hasMetadata(node)) {\n const newSlug = toDefaultSlug(node.slug, rootSlug, versionSlug);\n // children of this node was already pruned\n if (node.slug === newSlug) {\n return \"skip\";\n }\n node.canonicalSlug = node.canonicalSlug ?? node.slug;\n node.slug = newSlug;\n }\n\n if (hasRedirect(node)) {\n node.pointsTo = toDefaultSlug(node.pointsTo, rootSlug, versionSlug);\n }\n return;\n });\n return node;\n}\n","export * from \"./v1ToV2\";\n","import visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\nimport { UnreachableCaseError } from \"ts-essentials\";\n\nimport { FernNavigation } from \"../..\";\n\n/**\n * This migration accounts for the following changes:\n * - add canonicalSlug to all nodes\n * - align availability enum with the rest of FDR\n */\nexport class FernNavigationV1ToLatest {\n static create(): FernNavigationV1ToLatest {\n return new FernNavigationV1ToLatest();\n }\n\n private constructor() {}\n\n // store the base slug\n #baseUrl: string | undefined;\n\n // this will store the product slug we are currently parsing\n // to be used when setting the canonical URL\n #currentProductSlug: string | undefined;\n\n // this will store the product slug we are currently parsing\n // to be used when setting the canonical URL\n #currentDefaultVersionSlug: string | undefined;\n\n public root = (node: FernNavigation.V1.RootNode): FernNavigation.RootNode => {\n this.#baseUrl = FernNavigation.Slug(node.slug);\n const latest: FernNavigation.RootNode = {\n type: \"root\",\n child: visitDiscriminatedUnion(node.child)._visit<FernNavigation.RootChild>({\n versioned: (value) => this.versioned(value, [node]),\n unversioned: (value) => this.unversioned(value, [node]),\n productgroup: (value) => this.productGroup(value, [node])\n }),\n version: \"v2\",\n title: node.title,\n id: FernNavigation.NodeId(node.id),\n pointsTo: node.pointsTo ? FernNavigation.Slug(node.pointsTo) : undefined,\n slug: FernNavigation.Slug(node.slug),\n canonicalSlug: undefined,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n viewers: node.viewers,\n orphaned: node.orphaned,\n roles: node.roles,\n featureFlags: node.featureFlags\n };\n\n return latest;\n };\n\n public versioned = (\n node: FernNavigation.V1.VersionedNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.VersionedNode => {\n if (node.children.length === 0) {\n return {\n type: \"versioned\",\n id: FernNavigation.NodeId(node.id),\n collapsed: node.collapsed,\n children: []\n };\n }\n\n let defaultVersionIdx = node.children.findIndex((child) => child.default);\n if (defaultVersionIdx === -1) {\n defaultVersionIdx = 0;\n }\n\n /**\n * the default version should be the preferred canonical slug\n */\n const defaultVersionV1 = node.children[defaultVersionIdx];\n if (!defaultVersionV1) {\n throw new Error(\"default version is undefined\");\n }\n\n this.#currentDefaultVersionSlug = FernNavigation.Slug(defaultVersionV1.slug);\n\n const defaultVersion = this.version(defaultVersionV1, [...parents, node]);\n\n /**\n * visit the rest of the children, but splice the default version in its original position\n */\n const children = [\n ...node.children.slice(0, defaultVersionIdx).map((child) => this.version(child, [...parents, node])),\n defaultVersion,\n ...node.children.slice(defaultVersionIdx + 1).map((child) => this.version(child, [...parents, node]))\n ];\n\n const latest: FernNavigation.VersionedNode = {\n type: \"versioned\",\n id: FernNavigation.NodeId(node.id),\n collapsed: node.collapsed,\n children\n };\n\n return latest;\n };\n\n public version = (\n node: FernNavigation.V1.VersionNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.VersionNode => {\n const landingPage = node.landingPage ? this.landingPage(node.landingPage, [...parents, node]) : undefined;\n const latest: FernNavigation.VersionNode = {\n type: \"version\",\n default: node.default,\n versionId: node.versionId,\n landingPage,\n child: visitDiscriminatedUnion(node.child)._visit<FernNavigation.VersionChild>({\n tabbed: (value) => this.tabbed(value, [...parents, node]),\n sidebarRoot: (value) => this.sidebarRoot(value, [...parents, node]),\n varianted: (value) => this.varianted(value, [...parents, node])\n }),\n availability: this.#availability(node.availability),\n title: node.title,\n slug: FernNavigation.Slug(node.slug),\n canonicalSlug: undefined,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n id: FernNavigation.NodeId(node.id),\n pointsTo: node.pointsTo ? FernNavigation.Slug(node.pointsTo) : undefined,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags,\n announcement: node.announcement\n };\n return latest;\n };\n\n public landingPage = (\n node: FernNavigation.V1.LandingPageNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.LandingPageNode => {\n const slug = FernNavigation.Slug(node.slug);\n const canonicalSlug = this.#getAndSetCanonicalSlug(\n [node.pageId, this.#createTitleDisambiguationKey(node, parents)],\n slug\n );\n const latest: FernNavigation.LandingPageNode = {\n type: \"landingPage\",\n title: node.title,\n slug,\n canonicalSlug,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n id: FernNavigation.NodeId(node.id),\n pageId: FernNavigation.PageId(node.pageId),\n noindex: node.noindex,\n collapsed: node.collapsed,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n };\n return latest;\n };\n\n public tabbed = (\n node: FernNavigation.V1.TabbedNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.TabbedNode => {\n const latest: FernNavigation.TabbedNode = {\n type: \"tabbed\",\n id: FernNavigation.NodeId(node.id),\n collapsed: node.collapsed,\n children: node.children.map((child) =>\n visitDiscriminatedUnion(child)._visit<FernNavigation.TabChild>({\n tab: (value) => this.tab(value, [...parents, node]),\n link: (value) => this.link(value, [...parents, node]),\n changelog: (value) => this.changelog(value, [...parents, node])\n })\n )\n };\n return latest;\n };\n\n public varianted = (\n node: FernNavigation.V1.VariantedNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.VariantedNode => {\n const latest: FernNavigation.VariantedNode = {\n type: \"varianted\",\n id: FernNavigation.NodeId(node.id),\n collapsed: node.collapsed,\n children: node.children.map((child) => this.variant(child, [...parents, node]))\n };\n return latest;\n };\n\n public variant = (\n node: FernNavigation.V1.VariantNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.VariantNode => {\n const children = node.children.map((child) => this.#variantChild(child, [...parents, node]));\n\n // If pointsTo is not set, find the first page in the variant's children\n let pointsTo: FernNavigation.Slug | undefined = node.pointsTo ? FernNavigation.Slug(node.pointsTo) : undefined;\n if (pointsTo == null) {\n pointsTo = this.#findFirstPageSlugInChildren(children);\n }\n\n const latest: FernNavigation.VariantNode = {\n type: \"variant\",\n default: node.default,\n variantId: FernNavigation.VariantId(node.variantId),\n subtitle: node.subtitle,\n image: node.image,\n children,\n title: node.title,\n slug: FernNavigation.Slug(node.slug),\n canonicalSlug: undefined,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n id: FernNavigation.NodeId(node.id),\n pointsTo,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n };\n return latest;\n };\n\n public tab = (\n node: FernNavigation.V1.TabNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.TabNode => {\n const latest: FernNavigation.TabNode = {\n type: \"tab\",\n child: this.sidebarRoot(node.child, [...parents, node]),\n title: node.title,\n slug: FernNavigation.Slug(node.slug),\n canonicalSlug: undefined,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n id: FernNavigation.NodeId(node.id),\n pointsTo: node.pointsTo ? FernNavigation.Slug(node.pointsTo) : undefined,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n };\n return latest;\n };\n\n public link = (\n node: FernNavigation.V1.LinkNode,\n _parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.LinkNode => {\n const latest: FernNavigation.LinkNode = {\n type: \"link\",\n id: FernNavigation.NodeId(node.id),\n collapsed: node.collapsed,\n title: node.title,\n url: node.url,\n icon: node.icon,\n target: node.target\n };\n return latest;\n };\n\n public unversioned = (\n node: FernNavigation.V1.UnversionedNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.UnversionedNode => {\n const latest: FernNavigation.UnversionedNode = {\n type: \"unversioned\",\n collapsed: node.collapsed,\n child: visitDiscriminatedUnion(node.child)._visit<FernNavigation.VersionChild>({\n tabbed: (value) => this.tabbed(value, [...parents, node]),\n sidebarRoot: (value) => this.sidebarRoot(value, [...parents, node]),\n varianted: (value) => this.varianted(value, [...parents, node])\n }),\n landingPage: node.landingPage ? this.landingPage(node.landingPage, [...parents, node]) : undefined,\n id: FernNavigation.NodeId(node.id)\n };\n\n return latest;\n };\n\n public productGroup = (\n node: FernNavigation.V1.ProductGroupNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.ProductGroupNode => {\n const landingPage = node.landingPage ? this.landingPage(node.landingPage, [...parents, node]) : undefined;\n const changelog = node.changelog ? this.changelog(node.changelog, [...parents, node]) : undefined;\n if (node.children.length === 0) {\n return {\n type: \"productgroup\",\n landingPage,\n id: FernNavigation.NodeId(node.id),\n collapsed: node.collapsed,\n children: [],\n changelog\n };\n }\n\n let defaultProductIdx = node.children.findIndex((child) => child.default);\n\n if (defaultProductIdx === -1) {\n defaultProductIdx = 0;\n }\n\n /**\n * the default product should be the preferred canonical slug\n */\n const defaultProductV1 = node.children[defaultProductIdx];\n if (!defaultProductV1) {\n throw new Error(\"default product is undefined\");\n }\n const defaultProduct = this.product(defaultProductV1, [...parents, node]);\n\n /**\n * visit the rest of the children, but splice the default product in its original position\n */\n const children = [\n ...node.children.slice(0, defaultProductIdx).map((child) => this.product(child, [...parents, node])),\n defaultProduct,\n ...node.children.slice(defaultProductIdx + 1).map((child) => this.product(child, [...parents, node]))\n ];\n\n const latest: FernNavigation.ProductGroupNode = {\n type: \"productgroup\",\n landingPage,\n children,\n id: FernNavigation.NodeId(node.id),\n collapsed: node.collapsed,\n changelog\n };\n return latest;\n };\n\n public product = (\n node: FernNavigation.V1.ProductNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.ProductNode => {\n return visitDiscriminatedUnion(node)._visit<FernNavigation.ProductNode>({\n product: (internalNode) => this.internalProduct(internalNode, parents),\n productLink: (externalNode) => this.externalProduct(externalNode)\n });\n };\n\n public internalProduct = (\n node: FernNavigation.V1.InternalProductNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.InternalProductNode => {\n this.#currentProductSlug = node.slug;\n const latest: FernNavigation.InternalProductNode = {\n type: \"product\",\n id: FernNavigation.NodeId(node.id),\n title: node.title,\n slug: FernNavigation.Slug(node.slug),\n canonicalSlug: undefined,\n icon: node.icon,\n image: node.image,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n pointsTo: node.pointsTo ? FernNavigation.Slug(node.pointsTo) : undefined,\n default: node.default,\n productId: FernNavigation.ProductId(node.productId),\n child: visitDiscriminatedUnion(node.child)._visit<FernNavigation.ProductChild>({\n unversioned: (value) => this.unversioned(value, [...parents, node]),\n versioned: (value) => this.versioned(value, [...parents, node])\n }),\n subtitle: node.subtitle,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags,\n announcement: node.announcement\n };\n return latest;\n };\n\n public externalProduct = (node: FernNavigation.V1.ExternalProductNode): FernNavigation.ExternalProductNode => {\n const latest: FernNavigation.ExternalProductNode = {\n type: \"productLink\",\n id: FernNavigation.NodeId(node.id),\n collapsed: node.collapsed,\n title: node.title,\n href: node.href,\n target: node.target,\n default: node.default,\n productId: FernNavigation.ProductId(node.productId),\n subtitle: node.subtitle,\n icon: node.icon,\n image: node.image,\n hidden: node.hidden,\n authed: node.authed,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: undefined\n };\n return latest;\n };\n\n public sidebarRoot = (\n node: FernNavigation.V1.SidebarRootNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.SidebarRootNode => {\n const latest: FernNavigation.SidebarRootNode = {\n type: \"sidebarRoot\",\n id: FernNavigation.NodeId(node.id),\n collapsed: node.collapsed,\n children: node.children.map((child) =>\n visitDiscriminatedUnion(child)._visit<FernNavigation.SidebarRootChild>({\n sidebarGroup: (value) => this.sidebarGroup(value, [...parents, node]),\n apiReference: (value) => this.apiReference(value, [...parents, node]),\n section: (value) => this.section(value, [...parents, node]),\n varianted: (value) => this.varianted(value, [...parents, node])\n })\n )\n };\n return latest;\n };\n\n public sidebarGroup = (\n node: FernNavigation.V1.SidebarGroupNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.SidebarGroupNode => {\n const latest: FernNavigation.SidebarGroupNode = {\n type: \"sidebarGroup\",\n id: FernNavigation.NodeId(node.id),\n collapsed: node.collapsed,\n children: node.children.map((child) => this.#navigationChild(child, [...parents, node]))\n };\n return latest;\n };\n\n public page = (\n node: FernNavigation.V1.PageNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.PageNode => {\n const slug = FernNavigation.Slug(node.slug);\n const canonicalSlug = this.#getAndSetCanonicalSlug(\n [node.pageId, this.#createTitleDisambiguationKey(node, parents)],\n slug\n );\n const latest: FernNavigation.PageNode = {\n type: \"page\",\n id: FernNavigation.NodeId(node.id),\n title: node.title,\n slug,\n canonicalSlug,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n pageId: FernNavigation.PageId(node.pageId),\n noindex: node.noindex,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags,\n availability: this.#availability(node.availability)\n };\n return latest;\n };\n\n public section = (\n node: FernNavigation.V1.SectionNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.SectionNode => {\n const slug = FernNavigation.Slug(node.slug);\n const overviewPageId = node.overviewPageId ? FernNavigation.PageId(node.overviewPageId) : undefined;\n const canonicalSlug =\n overviewPageId != null\n ? this.#getAndSetCanonicalSlug(\n [overviewPageId, this.#createTitleDisambiguationKey(node, parents)],\n slug\n )\n : undefined;\n const latest: FernNavigation.SectionNode = {\n type: \"section\",\n id: FernNavigation.NodeId(node.id),\n children: node.children.map((child) => this.#navigationChild(child, [...parents, node])),\n title: node.title,\n slug,\n canonicalSlug,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n pointsTo: node.pointsTo ? FernNavigation.Slug(node.pointsTo) : undefined,\n collapsed: node.collapsed,\n collapsible: node.collapsible ?? (node.collapsed === true ? true : undefined),\n collapsedByDefault: node.collapsedByDefault ?? (node.collapsed === true ? true : undefined),\n overviewPageId,\n noindex: node.noindex,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags,\n availability: this.#availability(node.availability)\n };\n return latest;\n };\n\n public apiReference = (\n node: FernNavigation.V1.ApiReferenceNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.ApiReferenceNode => {\n const slug = FernNavigation.Slug(node.slug);\n const overviewPageId = node.overviewPageId ? FernNavigation.PageId(node.overviewPageId) : undefined;\n const canonicalSlug =\n overviewPageId != null\n ? this.#getAndSetCanonicalSlug(\n [overviewPageId, this.#createTitleDisambiguationKey(node, parents)],\n slug\n )\n : undefined;\n const latest: FernNavigation.ApiReferenceNode = {\n type: \"apiReference\",\n paginated: node.paginated,\n showErrors: node.showErrors,\n hideTitle: node.hideTitle,\n children: node.children.map((child) => this.#apiPackageChild(child, [...parents, node])),\n changelog: node.changelog ? this.changelog(node.changelog, [...parents, node]) : undefined,\n playground: node.playground,\n postmanCollectionUrl: node.postmanCollectionUrl,\n title: node.title,\n slug,\n canonicalSlug,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n id: FernNavigation.NodeId(node.id),\n overviewPageId,\n noindex: node.noindex,\n apiDefinitionId: node.apiDefinitionId,\n availability: this.#availability(node.availability),\n pointsTo: node.pointsTo ? FernNavigation.Slug(node.pointsTo) : undefined,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n };\n return latest;\n };\n\n public changelog = (\n node: FernNavigation.V1.ChangelogNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.ChangelogNode => {\n const slug = FernNavigation.Slug(node.slug);\n const overviewPageId = node.overviewPageId ? FernNavigation.PageId(node.overviewPageId) : undefined;\n const canonicalSlug = overviewPageId != null ? this.#getAndSetCanonicalSlug(overviewPageId, slug) : undefined;\n const latest: FernNavigation.ChangelogNode = {\n type: \"changelog\",\n id: FernNavigation.NodeId(node.id),\n children: node.children.map((child) => this.changelogYear(child, [...parents, node])),\n title: node.title,\n slug,\n canonicalSlug,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n overviewPageId,\n noindex: node.noindex,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n };\n return latest;\n };\n\n public changelogYear = (\n node: FernNavigation.V1.ChangelogYearNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.ChangelogYearNode => {\n const latest: FernNavigation.ChangelogYearNode = {\n type: \"changelogYear\",\n id: FernNavigation.NodeId(node.id),\n children: node.children.map((child) => this.changelogMonth(child, [...parents, node])),\n title: node.title,\n slug: FernNavigation.Slug(node.slug),\n canonicalSlug: undefined,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n year: node.year,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n };\n return latest;\n };\n\n public changelogMonth = (\n node: FernNavigation.V1.ChangelogMonthNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.ChangelogMonthNode => {\n const latest: FernNavigation.ChangelogMonthNode = {\n type: \"changelogMonth\",\n id: FernNavigation.NodeId(node.id),\n children: node.children.map((child) => this.changelogEntry(child, [...parents, node])),\n title: node.title,\n slug: FernNavigation.Slug(node.slug),\n canonicalSlug: undefined,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n month: node.month,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n };\n return latest;\n };\n\n public changelogEntry = (\n node: FernNavigation.V1.ChangelogEntryNode,\n _parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.ChangelogEntryNode => {\n const slug = FernNavigation.Slug(node.slug);\n // NOTE: do NOT use title disambiguation key here, since the title may not always be unique\n const canonicalSlug = this.#getAndSetCanonicalSlug(node.pageId, slug);\n const latest: FernNavigation.ChangelogEntryNode = {\n type: \"changelogEntry\",\n id: FernNavigation.NodeId(node.id),\n title: node.title,\n slug,\n canonicalSlug,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n date: node.date,\n pageId: FernNavigation.PageId(node.pageId),\n noindex: node.noindex,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags,\n tags: node.tags\n };\n return latest;\n };\n\n public apiPackage = (\n node: FernNavigation.V1.ApiPackageNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.ApiPackageNode => {\n const slug = FernNavigation.Slug(node.slug);\n const overviewPageId = node.overviewPageId ? FernNavigation.PageId(node.overviewPageId) : undefined;\n const canonicalSlug =\n overviewPageId != null\n ? this.#getAndSetCanonicalSlug(\n [overviewPageId, this.#createTitleDisambiguationKey(node, parents)],\n slug\n )\n : undefined;\n const latest: FernNavigation.ApiPackageNode = {\n type: \"apiPackage\",\n id: FernNavigation.NodeId(node.id),\n children: node.children.map((child) => this.#apiPackageChild(child, [...parents, node])),\n title: node.title,\n slug,\n canonicalSlug,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n pointsTo: node.pointsTo ? FernNavigation.Slug(node.pointsTo) : undefined,\n playground: node.playground,\n overviewPageId,\n noindex: node.noindex,\n apiDefinitionId: node.apiDefinitionId,\n availability: this.#availability(node.availability),\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n };\n return latest;\n };\n\n public endpoint = (\n node: FernNavigation.V1.EndpointNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.EndpointNode => {\n const apiDisambiguation = this.#createApiDisambiguationKey(parents);\n const slug = FernNavigation.Slug(node.slug);\n const canonicalSlug = this.#getAndSetCanonicalSlug(\n [\n `${apiDisambiguation}:api:endpoint:${node.method}:${node.endpointId}`,\n this.#createTitleDisambiguationKey(node, parents)\n ],\n slug\n );\n const latest: FernNavigation.EndpointNode = {\n type: \"endpoint\",\n id: FernNavigation.NodeId(node.id),\n title: node.title,\n slug,\n canonicalSlug,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n playground: node.playground,\n apiDefinitionId: node.apiDefinitionId,\n availability: this.#availability(node.availability),\n noindex: node.noindex,\n method: node.method,\n endpointId: node.endpointId,\n isResponseStream: node.isResponseStream,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n };\n return latest;\n };\n\n public endpointPair = (\n node: FernNavigation.V1.EndpointPairNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.EndpointPairNode => {\n const latest: FernNavigation.EndpointPairNode = {\n type: \"endpointPair\",\n id: FernNavigation.NodeId(node.id),\n collapsed: node.collapsed,\n nonStream: this.endpoint(node.nonStream, [...parents, node]),\n stream: this.endpoint(node.stream, [...parents, node])\n };\n return latest;\n };\n\n public webSocket = (\n node: FernNavigation.V1.WebSocketNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.WebSocketNode => {\n const apiDisambiguation = this.#createApiDisambiguationKey(parents);\n const slug = FernNavigation.Slug(node.slug);\n const canonicalSlug = this.#getAndSetCanonicalSlug(\n [\n `${apiDisambiguation}:api:websocket:${node.webSocketId}`,\n this.#createTitleDisambiguationKey(node, parents)\n ],\n slug\n );\n const latest: FernNavigation.WebSocketNode = {\n type: \"webSocket\",\n id: FernNavigation.NodeId(node.id),\n title: node.title,\n slug,\n canonicalSlug,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n playground: node.playground,\n apiDefinitionId: node.apiDefinitionId,\n availability: this.#availability(node.availability),\n noindex: node.noindex,\n webSocketId: node.webSocketId,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n };\n return latest;\n };\n\n public webhook = (\n node: FernNavigation.V1.WebhookNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.WebhookNode => {\n const apiDisambiguation = this.#createApiDisambiguationKey(parents);\n const slug = FernNavigation.Slug(node.slug);\n const canonicalSlug = this.#getAndSetCanonicalSlug(\n [\n `${apiDisambiguation}:api:webhook:${node.method}:${node.webhookId}`,\n this.#createTitleDisambiguationKey(node, parents)\n ],\n slug\n );\n const latest: FernNavigation.WebhookNode = {\n type: \"webhook\",\n id: FernNavigation.NodeId(node.id),\n title: node.title,\n slug,\n canonicalSlug,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n apiDefinitionId: node.apiDefinitionId,\n availability: this.#availability(node.availability),\n noindex: node.noindex,\n method: node.method,\n webhookId: node.webhookId,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n };\n return latest;\n };\n\n public grpc = (\n node: FernNavigation.V1.GrpcNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.GrpcNode => {\n const apiDisambiguation = this.#createApiDisambiguationKey(parents);\n const slug = FernNavigation.Slug(node.slug);\n const canonicalSlug = this.#getAndSetCanonicalSlug(\n [\n `${apiDisambiguation}:api:grpc:${node.method}:${node.grpcId}`,\n this.#createTitleDisambiguationKey(node, parents)\n ],\n slug\n );\n const latest: FernNavigation.GrpcNode = {\n type: \"grpc\",\n id: FernNavigation.NodeId(node.id),\n title: node.title,\n slug,\n canonicalSlug,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n apiDefinitionId: node.apiDefinitionId,\n availability: this.#availability(node.availability),\n noindex: node.noindex,\n method: node.method,\n grpcId: node.grpcId,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n };\n return latest;\n };\n\n public graphql = (\n node: FernNavigation.V1.GraphQlNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.GraphQlNode => {\n const apiDisambiguation = this.#createApiDisambiguationKey(parents);\n const slug = FernNavigation.Slug(node.slug);\n const canonicalSlug = this.#getAndSetCanonicalSlug(\n [`${apiDisambiguation}:api:graphql:${node.id}`, this.#createTitleDisambiguationKey(node, parents)],\n slug\n );\n const latest: FernNavigation.GraphQlNode = {\n type: \"graphql\",\n id: FernNavigation.NodeId(node.id),\n title: node.title,\n slug,\n canonicalSlug,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n apiDefinitionId: node.apiDefinitionId,\n graphqlOperationId: node.graphqlOperationId,\n graphqlOperationIds: node.graphqlOperationIds,\n operationType: node.operationType,\n playground: node.playground,\n availability: this.#availability(node.availability),\n noindex: node.noindex,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n };\n return latest;\n };\n\n public graphqlType = (\n node: FernNavigation.V1.GraphQlTypeNode,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.GraphQlTypeNode => {\n const apiDisambiguation = this.#createApiDisambiguationKey(parents);\n const slug = FernNavigation.Slug(node.slug);\n const canonicalSlug = this.#getAndSetCanonicalSlug(\n [\n `${apiDisambiguation}:api:graphqlType:${node.typeCategory}:${node.typeId}`,\n this.#createTitleDisambiguationKey(node, parents)\n ],\n slug\n );\n const latest: FernNavigation.GraphQlTypeNode = {\n type: \"graphqlType\",\n id: FernNavigation.NodeId(node.id),\n title: node.title,\n slug,\n canonicalSlug,\n icon: node.icon,\n hidden: node.hidden,\n authed: node.authed,\n collapsed: node.collapsed,\n apiDefinitionId: node.apiDefinitionId,\n typeId: node.typeId,\n typeCategory: node.typeCategory,\n availability: this.#availability(node.availability),\n noindex: node.noindex,\n viewers: node.viewers,\n orphaned: node.orphaned,\n featureFlags: node.featureFlags\n };\n return latest;\n };\n\n #variantChild = (\n child: FernNavigation.V1.VariantChild,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.VariantChild => {\n return visitDiscriminatedUnion(child)._visit<FernNavigation.VariantChild>({\n apiReference: (value) => this.apiReference(value, parents),\n section: (value) => this.section(value, parents),\n sidebarGroup: (value) => this.sidebarGroup(value, parents),\n link: (value) => this.link(value, parents),\n page: (value) => this.page(value, parents),\n changelog: (value) => this.changelog(value, parents)\n });\n };\n\n #navigationChild = (\n child: FernNavigation.V1.NavigationChild,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.NavigationChild => {\n return visitDiscriminatedUnion(child)._visit<FernNavigation.NavigationChild>({\n apiReference: (value) => this.apiReference(value, parents),\n section: (value) => this.section(value, parents),\n link: (value) => this.link(value, parents),\n page: (value) => this.page(value, parents),\n changelog: (value) => this.changelog(value, parents),\n varianted: (value) => this.varianted(value, parents)\n });\n };\n\n #apiPackageChild = (\n child: FernNavigation.V1.ApiPackageChild,\n parents: FernNavigation.V1.NavigationNode[]\n ): FernNavigation.ApiPackageChild => {\n return visitDiscriminatedUnion(child)._visit<FernNavigation.ApiPackageChild>({\n page: (value) => this.page(value, parents),\n link: (value) => this.link(value, parents),\n apiPackage: (value) => this.apiPackage(value, parents),\n endpoint: (value) => this.endpoint(value, parents),\n endpointPair: (value) => this.endpointPair(value, parents),\n webSocket: (value) => this.webSocket(value, parents),\n webhook: (value) => this.webhook(value, parents),\n grpc: (value) => this.grpc(value, parents),\n graphql: (value) => this.graphql(value, parents),\n graphqlType: (value) => this.graphqlType(value, parents)\n });\n };\n\n /**\n * Recursively searches for the first page node within a list of children\n */\n #findFirstPageSlugInChildren = (\n children: readonly FernNavigation.NavigationNode[]\n ): FernNavigation.Slug | undefined => {\n for (const child of children) {\n if (FernNavigation.isPage(child)) {\n return child.slug;\n }\n\n const childChildren = FernNavigation.getChildren(child);\n if (childChildren != null && childChildren.length > 0) {\n const firstPage = this.#findFirstPageSlugInChildren(childChildren);\n if (firstPage != null) {\n return firstPage;\n }\n }\n }\n return undefined;\n };\n\n #availability(v1: FernNavigation.V1.NavigationV1Availability | undefined): FernNavigation.Availability | undefined {\n if (v1 == null) {\n return undefined;\n }\n switch (v1) {\n case \"alpha\":\n return FernNavigation.Availability.Alpha;\n case \"beta\":\n return FernNavigation.Availability.Beta;\n case \"preview\":\n return FernNavigation.Availability.Preview;\n case \"deprecated\":\n return FernNavigation.Availability.Deprecated;\n case \"legacy\":\n return FernNavigation.Availability.Legacy;\n case \"generally-available\":\n return FernNavigation.Availability.GenerallyAvailable;\n case \"in-development\":\n return FernNavigation.Availability.InDevelopment;\n case \"pre-release\":\n return FernNavigation.Availability.PreRelease;\n case \"stable\":\n return FernNavigation.Availability.Stable;\n default:\n throw new UnreachableCaseError(v1);\n }\n }\n\n #canonicalSlugs = new Map<string, FernNavigation.Slug>();\n\n // return a match found with any key\n #getCanonicalSlug = (keyOrKeys: string | string[]) => {\n if (typeof keyOrKeys === \"string\") {\n return this.#canonicalSlugs.get(keyOrKeys);\n }\n\n for (const key of keyOrKeys) {\n const existing = this.#canonicalSlugs.get(key);\n\n // explicitly check for undefined because empty string is valid\n if (existing !== undefined) {\n return existing;\n }\n }\n\n return undefined;\n };\n\n // set all keys to use the same canonical url\n #setCanonicalSlug = (keyOrKeys: string | string[], fullCanonical: FernNavigation.Slug) => {\n const baseSlug = this.#currentProductSlug ?? \"\" + this.#baseUrl;\n\n // if the canonical slug includes the default version, prefer an unversioned slug\n const normalizedCanonical = this.#currentDefaultVersionSlug\n ? fullCanonical.replace(new RegExp(`(^|/)${this.#currentDefaultVersionSlug}(/|$)`, \"g\"), `$1${baseSlug}$2`)\n : fullCanonical;\n\n // canonical slug should always begin without a slash\n const canonicalSlug = FernNavigation.Slug(normalizedCanonical.replace(/^\\//, \"\"));\n\n if (typeof keyOrKeys === \"string\") {\n this.#canonicalSlugs.set(keyOrKeys, canonicalSlug);\n return canonicalSlug;\n }\n\n // canonical slug should apply to all keys of a given page\n for (const key of keyOrKeys) {\n this.#canonicalSlugs.set(key, canonicalSlug);\n }\n\n return canonicalSlug;\n };\n\n // TODO: canonical url logic should account for RBAC, since we should always prefer the publicly available url over the private one (for SEO)\n #getAndSetCanonicalSlug = (\n keyOrKeys: string | string[],\n slug: FernNavigation.Slug\n ): FernNavigation.Slug | undefined => {\n if (keyOrKeys == null) {\n return undefined;\n }\n\n const existing = this.#getCanonicalSlug(keyOrKeys);\n if (existing != null) {\n return existing;\n }\n\n const canonicalSlug = this.#setCanonicalSlug(keyOrKeys, slug);\n return canonicalSlug;\n };\n\n #createTitleDisambiguationKey = (\n node: FernNavigation.V1.NavigationNodeWithMetadata,\n parents: FernNavigation.V1.NavigationNode[]\n ): string => {\n const unversionedParents = this.#findUnversionedParents(parents);\n const unversionedParentTitles = unversionedParents\n .filter(FernNavigation.V1.hasMetadata)\n .map((parent) => parent.title);\n // Include product slug to prevent cross-product canonical slug contamination.\n // Without this, pages with the same title hierarchy in different products\n // (e.g., \"Reference > Core > Overview\" in both Browser SDK and Server SDK)\n // would share the same disambiguation key, causing version switching to\n // navigate to the wrong product.\n const productPrefix = this.#currentProductSlug ?? \"\";\n return [productPrefix, ...unversionedParentTitles, node.title].join(\"###\");\n };\n\n #createApiDisambiguationKey = (parents: FernNavigation.V1.NavigationNode[]): string => {\n const unversionedParents = this.#findUnversionedParents(parents);\n const unversionedParentIds = unversionedParents\n .filter((parent) => parent.type === \"apiReference\")\n .map((parent) => parent.title.replaceAll(\" \", \"\"));\n const productPrefix = this.#currentProductSlug ?? \"\";\n return [productPrefix, ...unversionedParentIds].join(\":\");\n };\n\n #findUnversionedParents = (parents: FernNavigation.V1.NavigationNode[]): FernNavigation.V1.NavigationNode[] => {\n const versionIdx = parents.findIndex((parent) => parent.type === \"version\");\n const unversionedParents = versionIdx >= 0 ? parents.slice(versionIdx + 1) : parents;\n return unversionedParents;\n };\n}\n","export * from \"./buildPageIdToSlugMap\";\nexport * from \"./canonicalSlugKey\";\nexport * from \"./collectApiReferences\";\nexport * from \"./collectLinkRedirects\";\nexport * from \"./collectPageIds\";\nexport * from \"./createBreadcrumb\";\nexport * from \"./findNode\";\nexport * from \"./followRedirect\";\nexport * from \"./getApiReferenceId\";\nexport * from \"./getNoIndexFromFrontmatter\";\nexport * from \"./resolveCurrentTab\";\nexport * from \"./syntheticSectionPath\";\nexport * from \"./toApis\";\nexport * from \"./toPages\";\nexport * from \"./toRootNode\";\nexport * from \"./toUnversionedSlug\";\nexport * from \"./updatePointsTo\";\n","import { NodeCollector } from \"../NodeCollector\";\nimport type { NavigationNode } from \"../versions/latest\";\nimport { getPageId } from \"../versions/latest/getPageId\";\nimport { isPage } from \"../versions/latest/NavigationNodePage\";\nimport { hasMetadata } from \"../versions/latest/NavigationNodeWithMetadata\";\n\n/**\n * Builds a map from pageId to slug from a navigation root node.\n *\n * This mirrors how FDR's slug table stores page → URL mappings and should be\n * used by both the server (when populating the slug table on publish) and the\n * CLI (when building the local \"after\" state for the missing-redirects check).\n *\n * Changelog entries are special-cased: they map to their parent changelog\n * node's slug rather than their own individual entry slug, because individual\n * changelog entries are rendered on the parent changelog page.\n */\nexport function buildPageIdToSlugMap(root: NavigationNode): Map<string, string> {\n const collector = NodeCollector.collect(root);\n const pageIdToSlug = new Map<string, string>();\n for (const entry of collector.getSlugMapWithParents().values()) {\n const { node, parents } = entry;\n if (!isPage(node)) {\n continue;\n }\n const pageId = getPageId(node);\n if (pageId == null) {\n continue;\n }\n let slug = node.canonicalSlug ?? node.slug;\n if (node.type === \"changelogEntry\") {\n const changelogParent = parents.findLast((p) => p.type === \"changelog\");\n if (changelogParent != null && hasMetadata(changelogParent)) {\n slug = changelogParent.canonicalSlug ?? changelogParent.slug;\n }\n }\n pageIdToSlug.set(pageId, slug);\n }\n return pageIdToSlug;\n}\n","import { FernNavigation } from \"../..\";\n\nexport function collectApiReferences(nav: FernNavigation.NavigationNode): FernNavigation.ApiReferenceNode[] {\n const apiReferences: FernNavigation.ApiReferenceNode[] = [];\n FernNavigation.traverseDF(nav, (node) => {\n if (node.type === \"apiReference\") {\n apiReferences.push(node);\n return \"skip\";\n }\n return true;\n });\n return apiReferences;\n}\n","import { kebabCase } from \"es-toolkit/string\";\n\nimport { FernNavigation } from \"../..\";\nimport { canonicalSlugKey } from \"./canonicalSlugKey\";\n\n/**\n * Walks the navigation tree and returns a map from a synthetic\n * `<closest-parent-with-slug>/<kebab(link.title)>` slug to the link's `href`.\n *\n * `link:` entries in the YAML config don't get their own slug — only a `title`\n * + `url` (the configured href). Visiting the URL where the link \"would have\n * lived\" (constructed from the parent section's slug + the link title) would\n * otherwise 404. This map lets the docs server 307 redirect those URLs to the\n * link's configured href, so:\n * - external bookmarks survive after a section is renamed or hidden;\n * - inbound links to a previously sidebar-rendered link entry keep working;\n * - swapping a `page:` for a `link:` (e.g. moving content elsewhere) doesn't\n * break the original URL.\n *\n * On duplicate synthetic slugs (two link entries with identical titles under\n * the same section), first occurrence wins so behavior is deterministic.\n */\nexport function collectLinkRedirects(\n root: FernNavigation.NavigationNode | undefined\n): Map<FernNavigation.Slug, string> {\n const out = new Map<FernNavigation.Slug, string>();\n if (root == null) {\n return out;\n }\n FernNavigation.traverseDF(root, (node, parents) => {\n if (node.type !== \"link\") {\n return;\n }\n const closestParentWithSlug = [...parents]\n .reverse()\n .find((p): p is typeof p & { slug: FernNavigation.Slug } => FernNavigation.hasMetadata(p));\n if (closestParentWithSlug == null || !closestParentWithSlug.slug) {\n return;\n }\n const segment = kebabCase(node.title);\n if (!segment) {\n return;\n }\n const synthSlug = canonicalSlugKey(`${closestParentWithSlug.slug}/${segment}` as FernNavigation.Slug);\n if (!out.has(synthSlug)) {\n out.set(synthSlug, String(node.url));\n }\n });\n return out;\n}\n","import { FernNavigation } from \"../..\";\nimport { getPageId } from \"../versions/latest/getPageId\";\n\nexport function collectPageIds(nav: FernNavigation.NavigationNode): Set<FernNavigation.PageId> {\n const pageIds = new Set<FernNavigation.PageId>();\n FernNavigation.traverseDF(nav, (node) => {\n if (FernNavigation.isPage(node)) {\n const pageId = getPageId(node);\n if (pageId != null) {\n pageIds.add(pageId);\n }\n }\n });\n return pageIds;\n}\n","import visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\nimport { noop } from \"ts-essentials\";\n\nimport { FernNavigation } from \"../..\";\n\nexport function createBreadcrumb(nodes: readonly FernNavigation.NavigationNode[]): FernNavigation.BreadcrumbItem[] {\n const breadcrumb: FernNavigation.BreadcrumbItem[] = [];\n nodes.forEach((node) => {\n if (!FernNavigation.hasMetadata(node) || FernNavigation.isLeaf(node)) {\n return;\n }\n visitDiscriminatedUnion(node)._visit({\n root: noop,\n version: noop,\n variant: noop,\n tab: noop,\n product: noop,\n section: (section) => {\n breadcrumb.push({\n title: section.title,\n pointsTo: section.overviewPageId != null ? section.slug : section.pointsTo\n });\n },\n apiReference: (apiReference) => {\n if (!apiReference.hideTitle) {\n breadcrumb.push({\n title: apiReference.title,\n pointsTo: apiReference.overviewPageId != null ? apiReference.slug : apiReference.pointsTo\n });\n }\n },\n changelog: (changelog) => {\n breadcrumb.push({\n title: changelog.title,\n pointsTo: changelog.slug\n });\n },\n changelogYear: (changelogYear) => {\n breadcrumb.push({\n title: changelogYear.title,\n pointsTo: changelogYear.slug\n });\n },\n changelogMonth: (changelogMonth) => {\n breadcrumb.push({\n title: changelogMonth.title,\n pointsTo: changelogMonth.slug\n });\n },\n apiPackage: (apiPackage) => {\n breadcrumb.push({\n title: apiPackage.title,\n pointsTo: apiPackage.overviewPageId != null ? apiPackage.slug : apiPackage.pointsTo\n });\n }\n });\n });\n\n // Remove breadcrumbs with empty titles\n return breadcrumb.filter((item) => item.title.trim().length > 0);\n}\n","import { escapeRegExp } from \"es-toolkit/string\";\n\nimport { FernNavigation } from \"../..\";\nimport { NodeCollector } from \"../NodeCollector\";\nimport { isApiReferenceNode } from \"../versions/latest/isApiReferenceNode\";\nimport { isProductGroupNode } from \"../versions/latest/isProductGroupNode\";\nimport { isProductNode } from \"../versions/latest/isProductNode\";\nimport { isSidebarRootNode } from \"../versions/latest/isSidebarRootNode\";\nimport { isUnversionedNode } from \"../versions/latest/isUnversionedNode\";\nimport { isVariantNode } from \"../versions/latest/isVariantNode\";\nimport { isVersionNode } from \"../versions/latest/isVersionNode\";\nimport { canonicalSlugKey } from \"./canonicalSlugKey\";\nimport { createBreadcrumb } from \"./createBreadcrumb\";\nimport { getEnclosingTabbedNode, resolveCurrentTab } from \"./resolveCurrentTab\";\n\nexport type Node = Node.Found | Node.Redirect | Node.NotFound;\n\nexport declare namespace Node {\n interface Found {\n type: \"found\";\n node: FernNavigation.NavigationNodePage;\n parents: readonly FernNavigation.NavigationNodeParent[];\n breadcrumb: readonly FernNavigation.BreadcrumbItem[];\n root: FernNavigation.RootNode;\n products: readonly FernNavigation.ProductNode[];\n currentProduct: FernNavigation.ProductNode | undefined;\n /**\n * This is true if the current product is the default product node (without the product slug prefix)\n */\n isCurrentProductDefault: boolean;\n versions: readonly FernNavigation.VersionNode[];\n currentVersion: FernNavigation.VersionNode | undefined;\n /**\n * This is true if the current version is the default version node (without the version slug prefix)\n */\n isCurrentVersionDefault: boolean;\n variants: readonly FernNavigation.VariantNode[];\n currentVariant: FernNavigation.VariantNode | undefined;\n /**\n * This is true if the current variant is the default variant node (without the variant slug prefix)\n */\n isCurrentVariantDefault: boolean;\n currentTab: FernNavigation.TabNode | FernNavigation.ChangelogNode | undefined;\n tabs: readonly FernNavigation.TabChild[];\n sidebar: FernNavigation.SidebarRootNode | undefined;\n apiReference: FernNavigation.ApiReferenceNode | undefined;\n next: FernNavigation.NavigationNodeNeighbor | undefined;\n prev: FernNavigation.NavigationNodeNeighbor | undefined;\n collector: NodeCollector;\n landingPage: FernNavigation.LandingPageNode | undefined;\n\n /**\n * This is the part of the slug after the version (or basepath) prefix.\n *\n * For example, if the original slug is \"docs/v1.0.0/foo/bar\", the unversionedSlug is \"foo/bar\".\n */\n unversionedSlug: FernNavigation.Slug;\n }\n\n interface Redirect {\n type: \"redirect\";\n redirect: FernNavigation.Slug;\n authed: boolean | undefined;\n }\n\n interface NotFound {\n type: \"notFound\";\n redirect: FernNavigation.Slug | undefined;\n authed: boolean | undefined;\n }\n}\n\nexport function findNode(root: FernNavigation.RootNode, slug: FernNavigation.Slug): Node {\n const collector = NodeCollector.collect(root);\n const found = collector.getSlugMapWithParents().get(canonicalSlugKey(slug));\n\n // if the slug points to a node that doesn't exist, we should redirect to the first likely node\n if (found == null) {\n let maybeProductOrVersionNode:\n | FernNavigation.RootNode\n | FernNavigation.ProductNode\n | FernNavigation.VersionNode = root;\n let foundProductNode = false;\n\n // the 404 behavior should be product-aware\n for (const productNode of collector.getProductNodes()) {\n // External product links don't have slugs, so skip them\n if (productNode.type === \"product\" && slug.startsWith(productNode.slug)) {\n maybeProductOrVersionNode = productNode;\n foundProductNode = true;\n break;\n }\n }\n\n // if we didn't find a product node, try to find a version node\n if (!foundProductNode) {\n // the 404 behavior should be version-aware\n for (const versionNode of collector.getVersionNodes()) {\n if (slug.startsWith(versionNode.slug)) {\n maybeProductOrVersionNode = versionNode;\n break;\n }\n }\n }\n\n return {\n type: \"notFound\",\n // External product links don't have pointsTo, only internal products and versions do\n redirect:\n maybeProductOrVersionNode.type === \"root\" ||\n maybeProductOrVersionNode.type === \"product\" ||\n maybeProductOrVersionNode.type === \"version\"\n ? maybeProductOrVersionNode.pointsTo\n : undefined,\n authed: maybeProductOrVersionNode.authed\n };\n }\n\n let sidebar = found.parents.find(isSidebarRootNode);\n const currentProductGroup = found.parents.find(isProductGroupNode);\n const currentProduct = found.parents.find(isProductNode);\n\n const currentVersion = found.parents.find(isVersionNode);\n const unversionedNode = found.parents.find(isUnversionedNode);\n\n const currentVariant = found.parents.find(isVariantNode);\n\n if (!sidebar && currentVersion != null) {\n if (isSidebarRootNode(currentVersion.child)) {\n sidebar = currentVersion.child;\n }\n }\n\n const landingPage = (currentProductGroup ?? currentVersion ?? unversionedNode)?.landingPage;\n\n const tabbedNode = getEnclosingTabbedNode(found.parents);\n\n const apiReference =\n found.parents.find(isApiReferenceNode) ?? (found.node.type === \"apiReference\" ? found.node : undefined);\n\n // if the node is visible (because it's a page), return it as \"found\"\n if (FernNavigation.isPage(found.node)) {\n const products = collector.getProductNodes().map((node) => {\n if (node.default) {\n // if we're currently viewing the default product, we may be viewing the non-pruned product node\n if (node.id === currentProduct?.id) {\n return currentProduct;\n }\n // otherwise, we should always use the pruned product node\n return collector.defaultProductNode ?? node;\n }\n return node;\n });\n\n const versions = collector.getVersionNodes().map((node) => {\n if (node.default) {\n // if we're currently viewing the default version, we may be viewing the non-pruned version\n if (node.id === currentVersion?.id) {\n return currentVersion;\n }\n // otherwise, we should always use the pruned version node\n return collector.defaultVersionNode ?? node;\n }\n return node;\n });\n\n const variants = collector.getVariantNodes().map((node) => {\n if (node.default) {\n // if we're currently viewing the default variant, we may be viewing the non-pruned variant\n if (node.id === currentVariant?.id) {\n return currentVariant;\n }\n // otherwise, we should always use the pruned variant node\n return collector.defaultVariantNode ?? node;\n }\n return node;\n });\n\n const currentTab = resolveCurrentTab(found.node, found.parents);\n // External product links don't have slugs, so fall back to version or root slug\n const slugPrefix =\n currentVariant?.slug ??\n (currentProduct?.type === \"product\" ? currentProduct.slug : undefined) ??\n currentVersion?.slug ??\n root.slug;\n const unversionedSlug = FernNavigation.Slug(\n found.node.slug.replace(new RegExp(`^${escapeRegExp(slugPrefix)}/`), \"\")\n );\n return {\n type: \"found\",\n node: found.node,\n breadcrumb: createBreadcrumb(found.parents),\n parents: found.parents,\n root,\n versions, // this is used to render the version switcher\n tabs: tabbedNode?.children ?? [],\n products,\n currentProduct,\n currentVersion,\n isCurrentProductDefault: currentProduct?.default ? currentProduct === collector.defaultProductNode : false,\n isCurrentVersionDefault: currentVersion?.default ? currentVersion === collector.defaultVersionNode : false,\n variants, // this is used to render the variant switcher\n currentVariant,\n isCurrentVariantDefault: currentVariant?.default ? currentVariant === collector.defaultVariantNode : false,\n currentTab,\n sidebar,\n apiReference,\n landingPage,\n next: found.next,\n prev: found.prev,\n collector,\n unversionedSlug\n };\n }\n\n // if the slug points matches the root node, redirect to the root node's pointsTo\n if (root.type === \"root\" && root.slug === slug && root.pointsTo != null) {\n return { type: \"redirect\", redirect: root.pointsTo, authed: root.authed };\n }\n\n // if the node has a redirect, return it\n if (FernNavigation.hasRedirect(found.node) && found.node.pointsTo != null) {\n return { type: \"redirect\", redirect: found.node.pointsTo, authed: found.node.authed };\n }\n\n // Special handling for variant nodes without pointsTo - find the first page in their children\n if (found.node.type === \"variant\" && (found.node.pointsTo == null || found.node.pointsTo === undefined)) {\n const firstPage = findFirstPageInNode(found.node);\n if (firstPage != null) {\n return { type: \"redirect\", redirect: firstPage, authed: found.node.authed };\n }\n }\n\n // if the node does not have a redirect, return a 404\n return {\n type: \"notFound\",\n redirect: currentVersion?.pointsTo ?? root.pointsTo,\n authed: found.node.authed\n };\n}\n\n/**\n * Recursively searches for the first page node within a given node's children\n */\nfunction findFirstPageInNode(node: FernNavigation.NavigationNode): FernNavigation.Slug | undefined {\n if (FernNavigation.isPage(node)) {\n return (node as any).slug;\n }\n\n const children = FernNavigation.getChildren(node);\n if (children == null) {\n return undefined;\n }\n\n for (const child of children) {\n const firstPage = findFirstPageInNode(child);\n if (firstPage != null) {\n return firstPage;\n }\n }\n\n return undefined;\n}\n","import type { FernNavigation } from \"../..\";\nimport { isTabbedNode } from \"../versions/latest/isTabbedNode\";\nimport { isUnversionedNode } from \"../versions/latest/isUnversionedNode\";\nimport { isVersionNode } from \"../versions/latest/isVersionNode\";\n\n/** A tabbed node's child that is a real header tab — a `link` child owns no page. */\nconst isHeaderTab = (child: FernNavigation.TabChild): child is FernNavigation.TabNode | FernNavigation.ChangelogNode =>\n child.type === \"tab\" || child.type === \"changelog\";\n\n/**\n * Resolve the `tabbed` node that encloses a page, given its ancestor chain.\n *\n * Normally the tabbed node is an ancestor, but a version/product **landing\n * page** hangs off its version as a *sibling* of the tabbed node (via\n * `landingPage`, not `child`), so it isn't in the ancestor chain — fall back to\n * the version child in that case.\n */\nexport function getEnclosingTabbedNode(\n parents: readonly FernNavigation.NavigationNodeParent[]\n): FernNavigation.TabbedNode | undefined {\n const versionChild = (parents.find(isVersionNode) ?? parents.find(isUnversionedNode))?.child;\n return (\n parents.find(isTabbedNode) ?? (versionChild != null && isTabbedNode(versionChild) ? versionChild : undefined)\n );\n}\n\n/**\n * Resolve the header tab that should be highlighted for a page, given the page\n * node and its ancestor chain.\n *\n * This is the single source of truth shared by `findNode` (used by the Vercel\n * runtime) and the Astro static build's `buildSlugToTabId`, so both highlight\n * the same tab and can't drift apart. The resolution order:\n *\n * 1. The tabbed node's child on the path to this page — a `tab` (Guides, API\n * Reference) or a `changelog` (Changelog, Blog); both are valid header tabs.\n * 2. A tab whose `pointsTo` (or a changelog whose `slug`) targets this page\n * from another subtree.\n * 3. The first tab, when this page is a version/product landing page.\n */\nexport function resolveCurrentTab(\n node: FernNavigation.NavigationNodeWithMetadata,\n parents: readonly FernNavigation.NavigationNodeParent[]\n): FernNavigation.TabNode | FernNavigation.ChangelogNode | undefined {\n const tabbedNode = getEnclosingTabbedNode(parents);\n if (tabbedNode == null) {\n return undefined;\n }\n\n const parentsAndNode = [...parents, node];\n const tabbedNodeIndex = parentsAndNode.indexOf(tabbedNode);\n const currentTabNode = tabbedNodeIndex !== -1 ? parentsAndNode[tabbedNodeIndex + 1] : undefined;\n let currentTab: FernNavigation.TabNode | FernNavigation.ChangelogNode | undefined =\n currentTabNode?.type === \"tab\" || currentTabNode?.type === \"changelog\" ? currentTabNode : undefined;\n\n if (currentTab == null) {\n // A tab whose pointsTo (or changelog whose slug) targets this page.\n for (const tab of tabbedNode.children) {\n if (tab.type === \"tab\" && tab.pointsTo === node.slug) {\n currentTab = tab;\n break;\n }\n if (tab.type === \"changelog\" && tab.slug === node.slug) {\n currentTab = tab;\n break;\n }\n }\n\n // The first tab, for a version/product landing page.\n if (currentTab == null && node.type === \"landingPage\") {\n currentTab = tabbedNode.children.find(isHeaderTab);\n }\n }\n\n return currentTab;\n}\n","import { UnreachableCaseError } from \"ts-essentials\";\n\nimport { FernNavigation } from \"../..\";\n\nexport function followRedirect(\n nodeToFollow: FernNavigation.NavigationNode | undefined\n): FernNavigation.Slug | undefined {\n if (nodeToFollow == null) {\n return undefined;\n }\n\n // skip authed pages (but do not skip authed edge nodes, since we want to follow redirects to unauthed children)\n // TODO: the `authed: boolean` logic here is a bit convoluted and will cause confusion. We should revisit this.\n if (FernNavigation.isPage(nodeToFollow) && !nodeToFollow.authed) {\n return nodeToFollow.slug;\n }\n\n // skip other leaf nodes that were not returned above\n if (FernNavigation.isLeaf(nodeToFollow)) {\n return undefined;\n }\n\n switch (nodeToFollow.type) {\n /**\n * Versioned and ProductGroup nodes are special in that they have a default child.\n */\n case \"productgroup\":\n return (\n followRedirect(nodeToFollow.landingPage ?? undefined) ??\n followRedirects([...nodeToFollow.children].sort(defaultFirst))\n );\n case \"versioned\":\n return followRedirects([...nodeToFollow.children].sort(defaultFirst));\n case \"apiReference\":\n case \"apiPackage\":\n case \"changelogMonth\": // note: changelog month nodes don't exist yet as pages\n case \"changelogYear\": // note: changelog month nodes don't exist yet as pages\n case \"endpointPair\":\n case \"product\":\n case \"productLink\":\n case \"root\":\n case \"section\":\n case \"sidebarRoot\":\n case \"sidebarGroup\":\n case \"tab\":\n case \"tabbed\":\n case \"unversioned\":\n case \"version\":\n case \"changelog\":\n case \"varianted\":\n case \"variant\":\n return followRedirects(FernNavigation.getChildren(nodeToFollow));\n default:\n throw new UnreachableCaseError(nodeToFollow);\n }\n}\n\nexport function followRedirects(nodes: readonly FernNavigation.NavigationNode[]): FernNavigation.Slug | undefined {\n for (const node of nodes) {\n // skip hidden nodes\n if (FernNavigation.hasMetadata(node) && node.hidden) {\n continue;\n }\n\n const redirect = followRedirect(node);\n if (redirect != null) {\n return redirect;\n }\n }\n return;\n}\n\nfunction rank<T extends { default: boolean; hidden: boolean | undefined }>(node: T): number {\n return node.default && !node.hidden ? 1 : node.hidden ? -1 : 0;\n}\n\nfunction defaultFirst<T extends { default: boolean; hidden: boolean | undefined }>(a: T, b: T): number {\n return rank(b) - rank(a);\n}\n","import visitDiscriminatedUnion from \"@fern-api/ui-core-utils/visitDiscriminatedUnion\";\n\nimport type { FernNavigation } from \"../..\";\n\nconst RETURN_UNDEFINED = () => undefined;\nconst RETURN_API_DEFINITION_ID = (node: FernNavigation.WithApiDefinitionId) => node.apiDefinitionId;\n\nexport function getApiReferenceId(\n node: FernNavigation.NavigationNode | undefined\n): FernNavigation.ApiDefinitionId | undefined {\n if (node == null) {\n return undefined;\n }\n return visitDiscriminatedUnion(node)._visit({\n root: RETURN_UNDEFINED,\n versioned: RETURN_UNDEFINED,\n varianted: RETURN_UNDEFINED,\n tabbed: RETURN_UNDEFINED,\n sidebarRoot: RETURN_UNDEFINED,\n sidebarGroup: RETURN_UNDEFINED,\n version: RETURN_UNDEFINED,\n variant: RETURN_UNDEFINED,\n tab: RETURN_UNDEFINED,\n link: RETURN_UNDEFINED,\n page: RETURN_UNDEFINED,\n section: RETURN_UNDEFINED,\n changelog: RETURN_UNDEFINED,\n changelogYear: RETURN_UNDEFINED,\n changelogMonth: RETURN_UNDEFINED,\n changelogEntry: RETURN_UNDEFINED,\n product: RETURN_UNDEFINED,\n productLink: RETURN_UNDEFINED,\n productgroup: RETURN_UNDEFINED,\n\n // api nodes\n apiReference: RETURN_API_DEFINITION_ID,\n endpoint: RETURN_API_DEFINITION_ID,\n endpointPair: (node) => node.nonStream.apiDefinitionId,\n webSocket: RETURN_API_DEFINITION_ID,\n webhook: RETURN_API_DEFINITION_ID,\n grpc: RETURN_API_DEFINITION_ID,\n graphql: RETURN_API_DEFINITION_ID,\n graphqlType: RETURN_API_DEFINITION_ID,\n apiPackage: RETURN_API_DEFINITION_ID,\n unversioned: RETURN_UNDEFINED,\n landingPage: RETURN_UNDEFINED\n });\n}\n","/**\n * Synthetic section-path segments disambiguate skipUrlSlug nodes in the\n * flat ledger segment model. When a node shares its parent's slug\n * (skipUrlSlug), the publish transform assigns a section path like\n * `parent/~3` instead of `parent`. The read side (ledger-root-builder)\n * strips these synthetic components when computing URL slugs so they\n * never appear in rendered navigation.\n */\n\n/** Prefix for synthetic section-path segments. */\nexport const SKIP_URL_SLUG_PREFIX = \"~\";\n\n/** Pattern matching a synthetic segment: the prefix followed by one or more digits. */\nconst SYNTHETIC_SEGMENT_RE = /^~\\d+$/;\n\n/** Strip synthetic `~<n>` path components used for skipUrlSlug disambiguation. */\nexport function stripSyntheticSegments(section: string): string {\n return section\n .split(\"/\")\n .filter((part) => !SYNTHETIC_SEGMENT_RE.test(part))\n .join(\"/\");\n}\n","import { mapValues } from \"es-toolkit/object\";\n\nimport { ApiDefinition } from \"../..\";\nimport type { DocsV2Read } from \"../../client\";\n\nexport function toApis(docs: DocsV2Read.LoadDocsForUrlResponse) {\n return mapValues(docs.definition.apis, (api) =>\n ApiDefinition.ApiDefinitionV1ToLatest.from(\n api as Parameters<typeof ApiDefinition.ApiDefinitionV1ToLatest.from>[0]\n ).migrate()\n );\n}\n","import { mapValues } from \"es-toolkit/object\";\n\nimport type { DocsV2Read } from \"../../client\";\n\nexport function toPages(docs: DocsV2Read.LoadDocsForUrlResponse) {\n return mapValues(docs.definition.pages, (page) => page?.markdown);\n}\n","import { FernNavigation } from \"../..\";\nimport { NodeCollector } from \"../NodeCollector\";\nimport { followRedirect } from \"./followRedirect\";\n\n/**\n * Uses depth-first traversal to update the pointsTo property of all nodes in the tree.\n *\n * @param input will be mutated\n */\nexport function mutableUpdatePointsTo(input: FernNavigation.NavigationNode): void {\n const collector = NodeCollector.collect(input);\n const slugMap = collector.getSlugMapWithParents();\n\n const updateNode = (node: FernNavigation.NavigationNode) => {\n if (FernNavigation.hasPointsTo(node)) {\n // Preserve metadata-derived pointsTo when it still targets a node in\n // the current tree; otherwise recompute from visible children.\n if (node.pointsTo != null) {\n const targetNode = slugMap.get(node.pointsTo)?.node;\n if (node.type === \"tab\" || (node.type !== \"root\" && targetNode != null)) {\n return;\n }\n if (node.type === \"root\" && targetNode != null) {\n node.pointsTo =\n targetNode.canonicalSlug ?? (node.slug === targetNode.slug ? undefined : targetNode.slug);\n return;\n }\n }\n const pointsTo = followRedirect(node);\n if (pointsTo != null) {\n if (node.type === \"root\") {\n const targetNode = slugMap.get(pointsTo)?.node;\n // if the node we should redirect to has a canonical url, default to that\n if (targetNode != null) {\n node.pointsTo =\n targetNode.canonicalSlug ?? (node.slug === targetNode.slug ? undefined : targetNode.slug);\n }\n } else {\n node.pointsTo = node.slug === pointsTo ? undefined : pointsTo;\n }\n }\n // When followRedirect returns undefined (e.g. out-of-scope tabs\n // with empty sidebars in a scoped root), preserve any existing\n // pointsTo (e.g. metadata-derived value from the root builder).\n }\n };\n\n FernNavigation.traverseDF(input, updateNode);\n\n // The NodeCollector creates a deep copy of the default version node for\n // canonical (unversioned) slug resolution. That copy is made at the start of\n // this function — before the traversal above sets pointsTo on the original\n // tree. We must also update pointsTo on the copy so that findNode callers\n // (which may receive parents from the copy) see correct redirect targets.\n if (collector.defaultVersionNode != null) {\n FernNavigation.traverseDF(collector.defaultVersionNode, updateNode);\n }\n}\n","import { type DocsV2Read, FernNavigation } from \"../..\";\nimport { FernNavigationV1ToLatest } from \"../migrators/v1ToV2\";\nimport { mutableUpdatePointsTo } from \"./updatePointsTo\";\n\nexport function toRootNode(\n docs: DocsV2Read.LoadDocsForUrlResponse,\n disableEndpointPairs: boolean = false\n): FernNavigation.RootNode {\n const v1 = FernNavigation.V1.toRootNode(docs, disableEndpointPairs);\n const latest = FernNavigationV1ToLatest.create().root(v1);\n // update all `pointsTo`\n mutableUpdatePointsTo(latest);\n return latest;\n}\n","import { escapeRegExp } from \"es-toolkit/string\";\n\nimport { Slug } from \"..\";\n\n/**\n * This is the part of the slug after the version (or basepath) prefix.\n *\n * For example, if the original slug is \"docs/v1.0.0/foo/bar\", the unversionedSlug is \"foo/bar\".\n */\nexport function toUnversionedSlug(slug: Slug, versionSlug: Slug): Slug {\n return Slug(slug.replace(new RegExp(`^${escapeRegExp(versionSlug)}(/|$)`), \"\"));\n}\n","import { bfs } from \"./bfs\";\nimport type { DeleterAction } from \"./types\";\n\ninterface PruneTreeOptions<NODE, PARENT extends NODE = NODE, POINTER = NODE> {\n /**\n * @param node the node to check\n * @returns **false** if the node SHOULD be deleted\n */\n predicate: (node: NODE, parents: readonly PARENT[]) => boolean;\n getChildren: (node: PARENT) => readonly NODE[];\n\n /**\n * @param parent the parent node\n * @param child the child that should be deleted\n * @returns the pointer to the child node, or **null** if the child cannot be deleted\n */\n deleter: (parent: PARENT | undefined, child: NODE) => DeleterAction;\n\n /**\n * If there are circular references, we can use this function to get a unique identifier for the node.\n *\n * @param node\n * @returns the unique identifier for the node\n * @default node => node as unknown as POINTER (the reference itself is used as the identifier)\n */\n getPointer?: (node: NODE) => POINTER;\n}\n\nexport function prunetree<NODE, ROOT extends NODE = NODE, PARENT extends NODE = NODE, POINTER = NODE>(\n root: ROOT,\n opts: PruneTreeOptions<NODE, PARENT, POINTER>\n): [result: ROOT | undefined, deleted: ReadonlySet<POINTER>] {\n const { predicate, getChildren, deleter, getPointer = (node) => node as unknown as POINTER } = opts;\n\n const deleted = new Set<POINTER>();\n\n // nodes is a stack of nodes in reverse order (the root node is the last element, and the \"deepest\" leaf node is the first element)\n const nodes: [NODE, readonly PARENT[]][] = [];\n\n bfs(\n root,\n (node, parents) => {\n nodes.unshift([node, parents]);\n },\n getChildren\n );\n\n nodes.forEach(([node, parents]) => {\n const order = [...parents, node];\n const deletedIdx = order.findIndex((n) => deleted.has(getPointer(n)));\n if (deletedIdx !== -1) {\n order.slice(deletedIdx).forEach((n) => deleted.add(getPointer(n)));\n return;\n }\n\n // continue traversal if the node is not to be deleted\n if (predicate(node, parents)) {\n return;\n }\n const ancestors = [...parents];\n const parent = ancestors.pop();\n\n let action = deleter(parent, node);\n let toDelete = node;\n\n while (action === \"should-delete-parent\" && parent != null) {\n deleted.add(getPointer(toDelete));\n toDelete = parent;\n action = deleter(ancestors.pop(), parent);\n }\n\n if (action === \"deleted\") {\n deleted.add(getPointer(toDelete));\n }\n });\n\n if (deleted.has(getPointer(root))) {\n return [undefined, deleted];\n }\n\n return [root, deleted];\n}\n","import { assertNever } from \"@fern-api/ui-core-utils\";\nimport type { MarkOptional } from \"ts-essentials\";\n\nimport type { FernNavigation } from \"../..\";\nimport type { DeleterAction } from \"../../utils/traversers/types\";\nimport { getChildren, isLeaf, isPage, isSectionOverview } from \"../versions\";\n\n/**\n * @param parent delete node from this parent (mutable)\n * @param node node to delete\n * @returns the id of the deleted node or null if the node was not deletable from the parent\n */\nexport function mutableDeleteChild(\n parent: FernNavigation.NavigationNodeParent | undefined,\n node: FernNavigation.NavigationNode\n): DeleterAction {\n /**\n * The idea here is we should only delete leaf nodes (we're treating changelogs here like a leaf node)\n *\n * In the case that we have sections that have content, deleting it from its parent would delete all its children as well.\n * Instead, we'll just remove the overviewPageId, which will make the section a non-visitable node, yet still retain its children.\n */\n if (!isLeaf(node) && isPage(node) && getChildren(node).length > 0 && node.type !== \"changelog\") {\n // if the node to be deleted is a section, remove the overviewPageId\n if (isSectionOverview(node)) {\n (node as MarkOptional<typeof node, \"overviewPageId\">).overviewPageId = undefined;\n\n if (node.children.length === 0) {\n return \"deleted\";\n }\n\n return \"noop\";\n } else {\n return assertNever(node);\n }\n }\n\n // if the node is not a leaf node, don't delete it from the parent unless it has no children\n if (!isLeaf(node) && getChildren(node).length > 0) {\n return \"noop\";\n }\n\n if (parent == null) {\n return \"deleted\";\n }\n\n switch (parent.type) {\n case \"apiPackage\":\n parent.children = parent.children.filter((child) => child.id !== node.id);\n break;\n case \"apiReference\":\n parent.children = parent.children.filter((child) => child.id !== node.id);\n parent.changelog = parent.changelog?.id === node.id ? undefined : parent.changelog;\n break;\n case \"changelog\":\n parent.children = parent.children.filter((child) => child.id !== node.id);\n break;\n case \"changelogYear\":\n parent.children = parent.children.filter((child) => child.id !== node.id);\n break;\n case \"changelogMonth\":\n parent.children = parent.children.filter((child) => child.id !== node.id);\n break;\n case \"endpointPair\":\n return \"should-delete-parent\";\n case \"productgroup\":\n parent.children = parent.children.filter((child) => child.id !== node.id);\n parent.landingPage = parent.landingPage?.id === node.id ? undefined : parent.landingPage;\n parent.changelog = parent.changelog?.id === node.id ? undefined : parent.changelog;\n break;\n case \"product\":\n case \"productLink\":\n case \"root\":\n return \"should-delete-parent\";\n case \"unversioned\":\n if (node.id === parent.landingPage?.id) {\n parent.landingPage = undefined;\n }\n break;\n case \"section\":\n parent.children = parent.children.filter((child) => child.id !== node.id);\n break;\n case \"sidebarGroup\":\n parent.children = parent.children.filter((child) => child.id !== node.id);\n break;\n case \"tab\":\n return \"should-delete-parent\";\n case \"sidebarRoot\":\n parent.children = parent.children.filter((child) => child.id !== node.id);\n break;\n case \"tabbed\":\n parent.children = parent.children.filter((child) => child.id !== node.id);\n break;\n case \"version\":\n if (node.id === parent.landingPage?.id) {\n parent.landingPage = undefined;\n }\n break;\n case \"versioned\":\n parent.children = parent.children.filter((child) => child.id !== node.id);\n break;\n case \"varianted\":\n parent.children = parent.children.filter((child) => child.id !== node.id);\n break;\n case \"variant\":\n parent.children = parent.children.filter((child) => child.id !== node.id);\n break;\n default:\n return assertNever(parent);\n }\n\n if (isPage(parent)) {\n return \"noop\";\n } else if (getChildren(parent).length > 0) {\n return \"deleted\";\n } else {\n return \"should-delete-parent\";\n }\n}\n","import type { FernNavigation } from \"../..\";\nimport { prunetree } from \"../../utils/traversers/prunetree\";\nimport { getChildren, hasMetadata, isPage, traverseBF } from \"../versions\";\nimport { mutableDeleteChild } from \"./deleteChild\";\n\ntype Predicate<T extends FernNavigation.NavigationNode = FernNavigation.NavigationNode> = (\n node: T,\n parents: readonly FernNavigation.NavigationNodeParent[]\n) => boolean;\n\nexport class Pruner<ROOT extends FernNavigation.NavigationNode> {\n public static from<ROOT extends FernNavigation.NavigationNode>(tree: ROOT): Pruner<ROOT> {\n return new Pruner(structuredClone(tree));\n }\n\n /**\n * Skips the defensive clone `from` makes: the caller transfers ownership of\n * `tree` and must not read it afterwards. Use when the tree is already a\n * private copy (e.g. cloned one step earlier in the same pipeline) — cloning\n * a megabyte-scale nav tree twice per page dominates static-build GC.\n */\n public static fromOwned<ROOT extends FernNavigation.NavigationNode>(tree: ROOT): Pruner<ROOT> {\n return new Pruner(tree);\n }\n\n private tree: ROOT | undefined;\n private constructor(tree: ROOT) {\n this.tree = tree;\n }\n\n public keep(predicate: Predicate): this {\n if (this.tree == null) {\n return this;\n }\n const [result] = prunetree(this.tree, {\n predicate,\n getChildren: getChildren,\n getPointer: (node) => node.id,\n deleter: mutableDeleteChild\n });\n this.tree = result;\n return this;\n }\n\n public remove(predicate: Predicate): this {\n return this.keep((node, parents) => !predicate(node, parents));\n }\n\n public hide(predicate: Predicate<FernNavigation.NavigationNodeWithMetadata>): this {\n if (this.tree == null) {\n return this;\n }\n traverseBF(this.tree, (node, parents) => {\n if (hasMetadata(node)) {\n node.hidden = predicate(node, parents);\n }\n });\n return this;\n }\n\n public authed(predicate: Predicate): this {\n if (this.tree == null) {\n return this;\n }\n\n const unauthedParents = new Set<FernNavigation.NavigationNodeParent>();\n\n // step 1. mark nodes as authed if the match the predicate\n traverseBF(this.tree, (node, parents) => {\n if (hasMetadata(node)) {\n node.authed = predicate(node, parents) ? true : undefined;\n if (!node.authed) {\n for (const parent of parents) {\n unauthedParents.add(parent);\n }\n }\n }\n });\n\n // step 2. remove auth flag on edge nodes that contain children that are unauthed\n // this helps us improve the rendering of the navigation tree and avoid deleting nodes that contain\n // children that can be visited.\n // Note: sections with overview pages are skipped here because the pages need to be filtered out\n // by the mutableDeleteChild function, which relies on the authed flag in a separate pass.\n for (const parent of unauthedParents) {\n if (hasMetadata(parent) && !isPage(parent)) {\n parent.authed = undefined;\n }\n }\n\n return this;\n }\n\n /**\n * Returns the pruned tree without recomputing redirect pointers.\n * Callers with a complete tree should follow up with\n * `mutableUpdatePointsTo(tree)` to recompute redirects.\n * Callers with a sparse/ledger projection should skip that step\n * to preserve materialized `pointsTo` values from write time.\n */\n public getPrunedTree(): ROOT | undefined {\n return this.tree;\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C,MAAM;AACvC,QAAM,IAAI,YAAY,EAAE,QAAQ,OAAO,CAAC,GAAG,OAAO,IAAI,QAAQ,OAAO,MAAM,QAAQC,aAAW;AAC5F,UAAM,aAAa,EAAE,SAAS,UAAUA,SAAO;AAC/C,UAAM,cAAc,WAAW,CAAC;AAChC,QAAI,CAAC,aAAa;AAChB,aAAO;AAAA,IACT;AACA,QAAI,CAAC,QAAQ;AACX,YAAM,YAAY,QAAQ;AAC1B,UAAI,UAAU,IAAI,SAAS,KAAK,CAAC,YAAY;AAC3C,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO,QAAQ,SAAS,QAAQ,YAAY,IAAI;AAAA,EAClD,CAAC;AACD,QAAM,iBAAiB,QAAQ,WAAW,CAAC;AAC3C,QAAM,UAAU,CAAC,GAAG,UAAU,GAAG,cAAc;AAC/C,QAAM,gBAAgB,gBAAgB,OAAO;AAC7C,gBAAc,QAAQ,CAAC,CAAC,SAAS,CAAC,MAAM;AACtC,UAAM,IAAI,QAAQ,SAAS,CAAC;AAAA,EAC9B,CAAC;AACD,SAAO;AACT;;;ACrCO,IAAM,iBAAiB;;EAE1B;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAGA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAGA;;EACA;;EACA;;EACA;;EACA;;EACA;;;EAGA;EACA;EACA;EACA;;EAGA;;EACA;;EACA;;EACA;;EACA;;EACA;;;EAGA;;EACA;;EACA;;;EAGA;EACA;EACA;;;;ACrWE,SAAU,UAAU,MAAY;AAElC,SAAO,KAAK,QAAQ,mBAAmB,OAAO;AAI9C,SAAO,KAAK,QAAQ,y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AAI,OAAO,KAAK,MAAM,EAAE,SAAS,GAAG;AAChC,eAAS,KAAK;AAAA,IAClB;AAAA,EACJ;AAEA,SAAO;AAAA,IACH;AAAA,IACA,QAAQ,aAAa,QAAQ,UAAU,SAAS,IAAI,YAAY;AAAA,IAChE,QAAQ,aAAa,QAAQ,UAAU,SAAS,IAAI,YAAY;AAAA,IAChE;AAAA,IACA;AAAA,EACJ;AACJ;","names":["z","z","z","z","z","z","z","z","FileIdSchema","FileId","PageIdSchema","PageId","UrlSchema","Url","VersionIdSchema","VersionId","ApiDefinitionIdSchema","ApiDefinitionId","EndpointIdSchema","EndpointId","WebSocketIdSchema","WebSocketId","WebhookIdSchema","WebhookId","RoleIdSchema","RoleId","SubpackageIdSchema","SubpackageId","AvailabilitySchema","ApiNavigationConfigItemSchema","ApiNavigationConfigRootSchema","DocsConfigIdSchema","DocsConfigId","UrlSchema","FileIdSchema","ApiNavigationConfigItemSchema","ApiNavigationConfigRootSchema","ApiDefinitionIdSchema","PageIdSchema","VersionIdSchema","AvailabilitySchema","DocsConfigIdSchema","z","getDocsForUrl","Error","contract_exports","Bcp47LocaleSchema","FilePath","FilePathSchema","import_contract","z","z","z","OrgIdSchema","OrgId","HeightSchema","FileIdSchema","PageContentSchema","UrlSchema","NavigationNodeMetadataSchema","PageMetadataSchema","PageIdSchema","LinkMetadataSchema","ChangelogItemSchema","ChangelogSectionSchema","ChangelogSectionV3Schema","NavigationTabLinkSchema","ApiNavigationConfigItemSchema","SubpackageIdSchema","EndpointIdSchema","WebSocketIdSchema","WebhookIdSchema","ApiNavigationConfigRootSchema","ApiSectionSchema","ApiDefinitionIdSchema","ApiSectionV2Schema","DocsSectionSchema","NavigationItemSchema","NavigationTabGroupSchema","NavigationTabSchema","UnversionedTabbedNavigationConfigSchema","UnversionedUntabbedNavigationConfigSchema","UnversionedNavigationConfigSchema","VersionedNavigationConfigDataSchema","VersionIdSchema","AvailabilitySchema","VersionedNavigationConfigSchema","NavigationConfigSchema","ThemeConfigSchema","DarkAndLightModeConfigSchema","ColorsConfigV3Schema","DocsConfigSchema","DocsDefinitionSchema","NpmPackageSchema","MavenPackageSchema","PypiPackageSchema","PublishedSdkSchema","PublishedPostmanCollectionSchema","ApiArtifactsSchema","FilePathSchema","FilePath","Bcp47LocaleSchema","import_contract","z","LinkTargetSchema","import_contract","z","import_contract","z","z","z","identity","import_node_crypto","import_string","string","object","typeId","properties","toRet","union","api","api","api","api","import_object","import_array","import_ts_essentials","stringifiedValue","value","qs","import_array","import_ts_essentials","import_qs","qs","urljoin","value","import_array","shape","object","union","message","example","api","snippets","ApiDefinitionPruner","ApiTypeIdVisitor","v1_exports","isSubpackage","latest_exports","import_url_join","part","urljoin","getChildren","getChildren","api","isSubpackage","ApiTypeIdVisitor","ApiDefinitionPruner","api","ApiTypeIdVisitor","v1_exports","NodeId","ProductId","Slug","TabId","VariantId","getPageId","hasMarkdown","hasMetadata","hasRedirect","isApiLeaf","isLeaf","isMarkdownLeaf","isNeighbor","isPage","isSection","isSectionOverview","slugjoin","toDefaultSlug","traverseDF","NodeId","ProductId","Slug","TabId","VariantId","import_ts_essentials","ApiDefinitionId","ApiDefinitionIdSchema","ApiNavigationConfigItemSchema","ApiNavigationConfigRootSchema","ApiSectionSchema","AvailabilitySchema","BackgroundSchema","ColorsConfigV3Schema","DarkAndLightModeConfigSchema","DocsSectionSchema","EndpointId","EndpointIdSchema","FileId","FileIdSchema","NavigationConfigSchema","NavigationItemSchema","NavigationTabGroupSchema","NavigationTabSchema","NavigationTabV2Schema","PageId","PageIdSchema","RoleId","RoleIdSchema","SubpackageId","SubpackageIdSchema","ThemeConfigSchema","UnversionedNavigationConfigSchema","UnversionedTabbedNavigationConfigSchema","UnversionedUntabbedNavigationConfigSchema","Url","UrlSchema","VersionId","VersionIdSchema","VersionedNavigationConfigDataSchema","VersionedNavigationConfigSchema","WebSocketId","WebSocketIdSchema","WebhookId","WebhookIdSchema","z","z","BackgroundSchema","ThemeConfigSchema","FileIdSchema","DarkAndLightModeConfigSchema","ColorsConfigV3Schema","NavigationTabGroupSchema","NavigationItemSchema","NavigationTabSchema","NavigationTabV2Schema","ApiSectionSchema","ApiDefinitionIdSchema","ApiNavigationConfigRootSchema","DocsSectionSchema","PageIdSchema","UnversionedTabbedNavigationConfigSchema","UnversionedUntabbedNavigationConfigSchema","UnversionedNavigationConfigSchema","VersionedNavigationConfigDataSchema","VersionIdSchema","AvailabilitySchema","VersionedNavigationConfigSchema","NavigationConfigSchema","UrlSchema","FileIdSchema","ColorsConfigV3Schema","ApiDefinitionId","ApiDefinitionIdSchema","ApiNavigationConfigItemSchema","ApiNavigationConfigRootSchema","AvailabilitySchema","DocsConfigId","DocsConfigIdSchema","EndpointId","EndpointIdSchema","FileId","FileIdSchema","PageId","PageIdSchema","RoleId","RoleIdSchema","SubpackageId","SubpackageIdSchema","Url","UrlSchema","VersionId","VersionIdSchema","WebSocketId","WebSocketIdSchema","WebhookId","WebhookIdSchema","ApiArtifactsSchema","ApiDefinitionId","ApiDefinitionIdSchema","ApiNavigationConfigItemSchema","ApiNavigationConfigRootSchema","ApiSectionSchema","ApiSectionV2Schema","AvailabilitySchema","ChangelogItemSchema","ChangelogSectionSchema","ChangelogSectionV3Schema","ColorsConfigV3Schema","DarkAndLightModeConfigSchema","DocsConfigSchema","DocsDefinitionSchema","DocsSectionSchema","EndpointId","EndpointIdSchema","FileId","FileIdSchema","HeightSchema","LinkMetadataSchema","MavenPackageSchema","NavigationConfigSchema","NavigationItemSchema","NavigationNodeMetadataSchema","NavigationTabGroupSchema","NavigationTabLinkSchema","NavigationTabSchema","NpmPackageSchema","OrgId","OrgIdSchema","PageContentSchema","PageId","PageIdSchema","PageMetadataSchema","PublishedPostmanCollectionSchema","PublishedSdkSchema","PypiPackageSchema","RoleId","RoleIdSchema","SubpackageId","SubpackageIdSchema","ThemeConfigSchema","UnversionedNavigationConfigSchema","UnversionedTabbedNavigationConfigSchema","UnversionedUntabbedNavigationConfigSchema","Url","UrlSchema","VersionId","VersionIdSchema","VersionedNavigationConfigDataSchema","VersionedNavigationConfigSchema","WebSocketId","WebSocketIdSchema","WebhookId","WebhookIdSchema","TwitterCardSettingSchema","z","TwitterCardSettingSchema","ApiDefinitionId","ApiDefinitionIdSchema","AvailabilitySchema","EndpointId","EndpointIdSchema","FileId","FileIdSchema","OrgId","OrgIdSchema","PageId","PageIdSchema","RoleId","RoleIdSchema","SubpackageId","SubpackageIdSchema","Url","UrlSchema","VersionId","VersionIdSchema","WebSocketId","WebSocketIdSchema","WebhookId","WebhookIdSchema","docs","v1","v2","contract_exports","api","navigation","latest_exports","import_ts_essentials","import_url_join","import_url_join","urljoin","dayjs","utc","entries","api","urljoin","isSubpackage","subpackageId","items","subpackage","import_object","import_string","id","child","item","api","api","hasMetadata","node","hasMetadata","RETURN_PAGEID","RETURN_OVERVIEW_PAGEID","RETURN_UNDEFINED","getPageId","isApiLeaf","isMarkdownLeaf","isLeaf","isApiLeaf","isMarkdownLeaf","isSection","isSectionOverview","isSection","hasMarkdown","isMarkdownLeaf","isSectionOverview","isNeighbor","isApiLeaf","isSectionOverview","isPage","isApiLeaf","hasMarkdown","hasRedirect","import_url_join","slugjoin","urljoin","Slug","import_string","toDefaultSlug","Slug","import_ts_essentials","getChildren","isLeaf","traverseDF","getChildren","node","node","existing","import_ts_essentials","followRedirect","followRedirects","toRootNode","import_string","import_ts_essentials","import_string","import_ts_essentials","followRedirect","followRedirects","RETURN_UNDEFINED","node","import_object","docs","api","import_object","docs","followRedirect","toRootNode","docs","import_string","getChildren","v1_exports","detailHash"]}