import type { Links } from './types.ts'; /** * Minimal surface of the AdonisJS router used for link generation. */ export type RouterContract = { find(routeIdentifier: string, domain?: string, method?: string): unknown; makeUrl(routeIdentifier: string, params?: Record): string; }; /** * Generates resource and relationship URLs for one request, from the named * routes registered with the `router.jsonApiResource()` helper. The * namespace of the CURRENT request's route name is reused, so the same * resources served under /api/v1 and /api/v2 groups produce version-correct * links — and links are only emitted for routes that actually exist. */ export declare class LinkBuilder { #private; constructor(enabled: boolean, router?: RouterContract, currentRouteName?: string); /** * Derives the route-name namespace from a route named by * `router.jsonApiResource()`: * * api.v1.articles.show → ['api', 'v1'] * api.v1.articles.relationships.replace → ['api', 'v1'] * * Returns null when the name does not follow the helper's convention. */ static namespaceOf(routeName: string): string[] | null; get enabled(): boolean; /** * The `self` URL of a resource, or undefined when its route does not * exist (or link generation is disabled). */ resourceSelf(type: string, id: string): string | undefined; resourceLinks(type: string, id: string): Links | undefined; /** * The `self` and `related` links of a relationship. Either link is * omitted when its route does not exist. The relation segment is * kebab-cased in URLs (receivedComments → received-comments); the * relationship endpoints map it back to the Lucid relation name. */ relationshipLinks(type: string, id: string, relation: string): Links | undefined; }