UNPKG

@adonis-agora/media

Version:

Media-library for AdonisJS — owner collections (MIME whitelist, single-file replace, ordering), image conversions (eager/lazy), pluggable content transformers (HLS video via mediabunny, metadata probe, image blur-up placeholder), and column attachments, a

65 lines • 3.32 kB
import type { MediaDashboardConfig } from './define_config.js'; import type { ObjectUrlStrategy } from './object_urls.js'; import { DashboardService, type MediaManagerLike } from './service.js'; /** The slice of the app's config the console's service is built from. */ export interface ConsoleServiceConfig { /** `config/media_dashboard.ts`. */ console: MediaDashboardConfig; /** `config/media.ts` (only `disk`, `disks` and `delivery.mode` are read). */ media: { disk?: string; disks?: Record<string, unknown>; delivery?: { mode?: string; }; }; /** `config/drive.ts` (only `default` is read). */ drive: { default?: string; }; /** * Whether this app stores media anywhere: a `config/drive.ts`, or a `disk`/`disks` in * `config/media.ts`. * Without either (an app that only hosts the federated console), the console says so instead of * browsing disks that do not exist. Default: `true`. */ storage?: boolean; } /** Read {@link ConsoleServiceConfig} from an app's config. */ export declare function readConsoleServiceConfig(config: { get<T>(key: string, defaultValue?: unknown): T; }): ConsoleServiceConfig; /** The disks the console browses: the configured list, else the media default plus `disks` keys. */ export declare function consoleDiskNames(config: ConsoleServiceConfig): string[]; /** * Which `url` the console reports for an object's bytes. An explicit `objectUrls` always wins; * when unset, the console follows the core media config: a host already streaming every read * through the app (`delivery.mode: 'proxy'`) has declared its store unreachable from a browser, * so a signed URL minted for the internal endpoint would be a link the console cannot open. * Anything else keeps the historical `'auto'`. */ export declare function consoleObjectUrlStrategy(config: ConsoleServiceConfig): ObjectUrlStrategy; /** Where the console's JSON API is mounted. */ export declare function consoleApiBase(config: MediaDashboardConfig): string; /** * The console's {@link DashboardService} over `manager`: its disks, its `actions` switch, its * object-URL strategy and its insight providers. With tenancy on it is confined to `ids` (`undefined`: * every tenant). The console's JSON API, its developer tools and the `media:*` commands all use it. */ export declare function buildConsoleService(manager: MediaManagerLike & { readonly tenancy?: { readonly enabled: boolean; } | undefined; }, config: ConsoleServiceConfig, ids?: Array<string | null> | undefined): DashboardService; /** * The console's {@link DashboardService} over one tenant app of this media control plane * (`apps: { <partition>: { mode: 'control-plane' } }`): that app's records only, and the disks * confined to its files (`<partition>/`). The data lives here and this server runs the actions; a * record is deleted with its files and conversions, as the tenant's own `delete` does. */ export declare function buildPartitionConsoleService(manager: MediaManagerLike & { controlPlaneLibrary(partition?: string): { delete(id: string): Promise<void>; }; }, config: ConsoleServiceConfig, partition: string, actions: boolean): DashboardService; //# sourceMappingURL=console_service.d.ts.map