---
title: "adonia-media-library API"
image: "https://adonia.pages.dev/og.png"
version: "next"
---

> Documentation Index
> Fetch the complete documentation index at: https://adonia.pages.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# adonia-media-library API

<!-- Generated by docs/site/scripts/generate_api.ts. Do not edit. -->

Canonical inventory of every public subpath and TypeScript export in `adonia-media-library`.

## `adonia-media-library`

| Export | Kind | Source | Summary |
| --- | --- | --- | --- |
| `cleanupMediaAsset` | function | `packages/media-library/src/storage.ts:196` | Removes the original and every trusted generated variant from one disk. |
| `createMediaLibraryResource` | function | `packages/media-library/src/resource.ts:63` | Builds a tenant-scoped media resource. Creation remains endpoint-only so every row is backed by verified Drive bytes; edits only expose alt text. |
| `createMediaLibraryRouteHandlers` | function | `packages/media-library/src/routes.ts:241` | Builds the handlers installed by `mediaLibraryPlugin().routes`. |
| `createMediaUploadSizeVerifier` | function | `packages/media-library/src/routes.ts:199` | Streaming verifier matching core's field upload byte ceiling. |
| `defineMediaCollection` | function | `packages/media-library/src/collections.ts:103` | Validates and freezes one collection declaration. |
| `defineMediaCollections` | function | `packages/media-library/src/collections.ts:170` | Validates an entire collection set once at plugin construction. |
| `deleteMediaAsset` | function | `packages/media-library/src/storage.ts:207` | Cleans Drive first, then removes the Lucid row when storage is consistent. |
| `F` | constant | `packages/media-library/src/field.ts:78` | Core's field namespace extended additively with `media`. |
| `GeneratedMediaVariant` | type-only interface | `packages/media-library/src/variants.ts:21` | Metadata persisted for one successfully generated variant. |
| `generateMediaVariants` | function | `packages/media-library/src/variants.ts:119` | Generates every declared variant from one read of the stored original. Missing Sharp is an explicit, non-failing result; conversion errors clean up all variants written during this attempt and still reject the upload. |
| `loadOptionalSharp` | constant | `packages/media-library/src/variants.ts:70` | Lazily resolves the optional `sharp` peer without making it part of the base server chunk. |
| `media` | function | `packages/media-library/src/field.ts:73` | Standalone field factory for callers that keep core's `F` import. |
| `MEDIA_LIBRARY_MIGRATION` | constant | `packages/media-library/src/doctor.ts:8` | Published migration that creates the media asset table. |
| `MEDIA_LIBRARY_MIGRATIONS` | constant | `packages/media-library/src/index.ts:32` | Absolute directory containing the package's publishable Lucid migration. |
| `MEDIA_LIBRARY_ROUTE_PREFIX` | constant | `packages/media-library/src/urls.ts:5` | Guarded manifest route prefix used by server descriptors and the client picker. |
| `MEDIA_LIBRARY_VERSION` | constant | `packages/media-library/src/version.ts:2` | Package version generated from package.json; do not edit directly. |
| `MediaAsset` | class | `packages/media-library/src/media_asset.ts:24` | A verified original plus any server-generated conversion metadata. |
| `MediaAssetDescriptor` | type-only interface | `packages/media-library/src/routes.ts:71` | Browser-safe asset shape; storage keys, disks, tenant ids, and metadata stay server-side. |
| `MediaAuthorizationError` | class | `packages/media-library/src/errors.ts:15` | Request attempted an operation the configured media authorizer denied. |
| `MediaBrowseResponse` | type-only interface | `packages/media-library/src/routes.ts:87` | Paginated response returned by the media browse endpoint. |
| `MediaCollection` | type-only interface | `packages/media-library/src/collections.ts:26` | Fully normalized collection used by upload and picker endpoints. |
| `MediaCollectionDefinition` | type-only interface | `packages/media-library/src/collections.ts:17` | Rules attached to one stable collection name. |
| `MediaCollectionError` | class | `packages/media-library/src/errors.ts:31` | Collection declaration or submitted collection is invalid. |
| `MediaCollections` | class | `packages/media-library/src/collections.ts:127` | Immutable lookup for a plugin instance's named collections. |
| `MediaConversionResult` | type-only interface | `packages/media-library/src/variants.ts:33` | Conversion status and generated variants produced for an asset. |
| `MediaConversionStatus` | type-only type | `packages/media-library/src/variants.ts:30` | Outcome categories for an attempted media conversion. |
| `MediaField` | class | `packages/media-library/src/field.ts:15` | Numeric asset id rendered by the lazy media picker rather than a number input. |
| `MediaFieldOptions` | type-only interface | `packages/media-library/src/field.ts:8` | Configures the collection and endpoint used by a media field. |
| `MediaLibraryAbility` | type-only type | `packages/media-library/src/resource.ts:26` | Abilities enforced by media library resources and capability routes. |
| `MediaLibraryAuthorization` | type-only type | `packages/media-library/src/resource.ts:29` | Explicit gate shared by the panel resource and manifest capability routes. |
| `mediaLibraryDoctorCheck` | constant | `packages/media-library/src/doctor.ts:13` | Verifies applied migration state and the host Drive configuration. |
| `MediaLibraryError` | class | `packages/media-library/src/errors.ts:2` | Base package error carrying the shape AdonisJS exception handlers understand. |
| `mediaLibraryManifest` | constant | `packages/media-library/src/index.ts:37` | Installer-facing package manifest shared by every configured instance. |
| `mediaLibraryPlugin` | function | `packages/media-library/src/index.ts:86` | Configures one panel's resource and guarded picker capabilities. Every endpoint inherits the panel prefix, domain, session, tenant, and access middleware from the manifest router. |
| `MediaLibraryPluginOptions` | type-only interface | `packages/media-library/src/index.ts:48` | Configures the media library plugin's resource, collections, and routes. |
| `MediaLibraryResourceOptions` | type-only interface | `packages/media-library/src/resource.ts:36` | Configures the authorization, collections, and presentation of a media resource. |
| `MediaLibraryRouteHandlers` | type-only interface | `packages/media-library/src/routes.ts:56` | HTTP handlers exposed by the media library route factory. |
| `MediaLibraryRouteOptions` | type-only interface | `packages/media-library/src/routes.ts:45` | Configures guarded media library route handlers. |
| `MediaNotFoundError` | class | `packages/media-library/src/errors.ts:23` | Requested asset or collection does not exist in the active tenant. |
| `MediaStorageCleanupError` | class | `packages/media-library/src/errors.ts:39` | One or more Drive objects could not be removed. |
| `MediaUploaderResolver` | type-only type | `packages/media-library/src/routes.ts:40` | Resolves the uploader identity persisted with a media asset. |
| `MediaVariantFit` | type-only type | `packages/media-library/src/variants.ts:5` | Supported Sharp resize fitting strategies for media variants. |
| `MediaVariantFormat` | type-only type | `packages/media-library/src/variants.ts:7` | Supported output formats for generated media variants. |
| `mediaVariantKeys` | function | `packages/media-library/src/storage.ts:191` | Only accepts server-generated variant keys located beside the original. |
| `MediaVariantSpec` | type-only interface | `packages/media-library/src/variants.ts:10` | One named resize generated beside the verified original. |
| `registerMediaLibraryResource` | function | `packages/media-library/src/index.ts:63` | Registers the configured browsable resource through the manifest registry. |
| `SharpFactory` | type-only type | `packages/media-library/src/variants.ts:63` | Structural Sharp entrypoint, exported so hosts/tests may provide their own lazy loader. |
| `SharpLoader` | type-only type | `packages/media-library/src/variants.ts:65` | Lazily resolves an optional Sharp-compatible image factory. |
| `StoredMediaAsset` | type-only interface | `packages/media-library/src/storage.ts:44` | Result of persisting an authorized media upload and its conversions. |
| `storeMediaAsset` | function | `packages/media-library/src/storage.ts:97` | Stores, re-reads, verifies, promotes, converts, then inserts the asset row. Every failure after the first Drive write removes the live original and generated variants before it leaves this boundary. |
| `StoreMediaAssetOptions` | type-only interface | `packages/media-library/src/storage.ts:28` | Inputs already resolved and authorized by the HTTP or programmatic caller. |

## `adonia-media-library/client`

| Export | Kind | Source | Summary |
| --- | --- | --- | --- |
| `MediaLibraryCell` | function | `packages/media-library/src/client.tsx:75` | Lazy derived table cell for resources that put `F.media()` in a table. |
| `MediaLibraryEntry` | function | `packages/media-library/src/client.tsx:59` | Lazy detail projection for media foreign keys. |
| `MediaLibraryField` | function | `packages/media-library/src/client.tsx:50` | Lazy custom field registered for `F.media()`. |
| `MediaLibraryTextFilter` | function | `packages/media-library/src/client.tsx:91` | Exact uploader-id filter used by the media resource. |
| `mediaLibraryUiPlugin` | constant | `packages/media-library/src/client.tsx:109` | Version-matched protocol-v1 client half installed through the component registry. |

Source: https://adonia.pages.dev/reference/api/media-library/index.mdx
