/** * Module augmentations that surface the relation-cache public methods on Lucid's * own contracts, so `Model.query().preloadCached(...)` and * `instance.load(name, { forceLoad })` typecheck for consumers. * * The methods are installed at runtime by `withResourceful`'s `static query()` * and instance `load()` overrides; these declarations describe their shapes * without changing Lucid's runtime behavior. * * @module @nhtio/lucid-resourceful/private/lucid_augmentations */ import type { RelationCacheCallOptions } from "./utils/caching_preloader"; declare module '@adonisjs/lucid/types/model' { interface ModelQueryBuilderContract> { /** * Preloads a 1:1 relation with explicit cache controls (e.g. `forceLoad`) * and optional per-call cache entry overrides, then delegates to the native * `preload`. Present on cache-enabled resourceful models. * * @param name - The relation name to preload. * @param options - Cache call options (`forceLoad` + entry overrides). * @param callback - Optional Lucid preload callback. */ preloadCached(name: string, options?: RelationCacheCallOptions, callback?: (query: ModelQueryBuilderContract) => void): this; } interface LucidRowPreload { /** * Lazily loads a relation with relation-cache options (`{ forceLoad }` + * entry overrides) as the second argument instead of a callback. Present on * cache-enabled resourceful models. * * @param relationName - The relation name. * @param options - Relation-cache options. */ (relationName: string, options: RelationCacheCallOptions): Promise; /** * Lazily loads a relation with a Lucid callback plus relation-cache options. * * @param relationName - The relation name. * @param callback - The Lucid preload callback. * @param options - Relation-cache options. */ (relationName: string, callback: (builder: unknown) => void, options: RelationCacheCallOptions): Promise; } }