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

95 lines • 5.37 kB
import type { ApplicationService } from '@adonisjs/core/types'; import { type MediaConfig } from '../define_config.js'; import { type ConsoleSiblings } from '../federation/console_auth.js'; import { resolveMediaTenant } from '../topology/authkit_tenant.js'; import type { AgoraDoctorCheck, AgoraDoctorResult } from './agora_doctor.js'; type AnyConfig = Record<string, unknown>; /** Drive's disks as boot resolves them: the default name and the service names. */ export interface DriveDisks { default?: string; services: string[]; } /** * Resolve `config/drive.ts` the way the media provider does at boot: Drive's `defineConfig()` * returns a config provider, a hand-rolled config is a plain `{ default, services }`. `null` when * there is no Drive config, `'unknown'` when it cannot be resolved. */ export declare function resolveDriveDisks(app: ApplicationService): Promise<DriveDisks | null | 'unknown'>; /** `media.disks`: every disk media writes to exists in `config/media.ts` `disks` or in Drive. */ export declare function checkDisks(media: MediaConfig | undefined, drive: DriveDisks | null | 'unknown'): AgoraDoctorResult; /** `media.console-gate`: the media console has an `authorize`. */ export declare function checkConsoleGate(config: AnyConfig | undefined, inProduction: boolean): AgoraDoctorResult; /** `media.account-console`: every collection the "My files" page lists exists and has rules. */ export declare function checkAccountConsole(media: MediaConfig | undefined): AgoraDoctorResult; /** `media.tenancy-schema` (deep): with tenancy on, the Lucid store has its `tenant_id` column. */ export declare function checkTenancySchema(app: ApplicationService): Promise<AgoraDoctorResult>; /** * `media.timestamps-schema` (deep): every Lucid upload-sessions store (resumable and direct) has its * `updated_at` column. Without it the store still works, but sessions show no "Updated" time. */ export declare function checkTimestampsSchema(app: ApplicationService): Promise<AgoraDoctorResult>; /** A store `media.db-schema` can inspect (the Lucid media and upload-session stores). */ interface SchemaInspectable { inspectSchema(): Promise<{ schema: string; exists: boolean; missingTables: string[]; writeError: string | null; } | null>; } /** One store's schema state as doctor results (`[]` when the store has no schema). */ export declare function checkStoreSchema(label: string, store: SchemaInspectable): Promise<AgoraDoctorResult[]>; /** * `media.db-schema` (deep): every Lucid store configured with a `schema` (media, resumable and * direct upload sessions) finds its schema and tables and can write there. Builds fresh store * instances from the config; they query only when inspected. */ export declare function checkDbSchema(app: ApplicationService): Promise<AgoraDoctorResult[]>; /** Whether any Lucid store in `config/media.ts` is configured with a `schema`. */ export declare function hasConfiguredSchema(media: MediaConfig | undefined): boolean; /** * The `media.db-schema` check. Registered at boot only when a store has a `schema` (so an app * without one sees no new line). */ export declare const dbSchemaDoctorCheck: AgoraDoctorCheck; /** Every media check, in report order. Ids are frozen for 1.x. */ type DoctorContainer = Parameters<typeof resolveMediaTenant>[1]; /** * `media.topology`: the topology in config/media.ts is one that can work. On a tenant, says where * `url`/`token`/`partition` come from: `explicit`, or `authkit-client (auto)`. */ export declare function checkTopology(configured: MediaConfig | undefined, container?: DoctorContainer): Promise<AgoraDoctorResult>; /** * `media.control-plane`: a tenant reaches its control plane, which accepts its token for its * partition with `media:read` and `media:write`. */ export declare function checkControlPlane(configured: MediaConfig | undefined, options?: { fetch?: typeof fetch; container?: DoctorContainer; }): Promise<AgoraDoctorResult>; type DoctorApp = Pick<ApplicationService, 'config'> & { container: unknown; }; /** * `media.console-commands`: how each side of the federated console authenticates, exactly as boot * resolves it. The owning app (`consoleCommands`): the modes it accepts, an error when none (it * fails to boot). The console (`media_dashboard.apps`): how it signs to each app; one it cannot * authenticate to is an error when the entry may run actions (the default, a boot error) and a * warning when it is browse-only (`actions: false`). */ export declare function checkConsoleCommands(app: DoctorApp, options?: { siblings?: ConsoleSiblings; }): Promise<AgoraDoctorResult[]>; /** * `media.console-commands-key` (deep), each side. The owning app (`consoleCommands`), in crypto * mode: the key exists and this process can use it (a probe; a crypto tenant is checked the way its * decrypt-only grant allows). The console (`media_dashboard.apps`), in automatic crypto mode: for * each app, the key in that app's partition exists (created here when crypto is embedded) and this * console can encrypt with it. */ export declare function checkConsoleCommandsKey(app: DoctorApp, options?: { siblings?: ConsoleSiblings; }): Promise<AgoraDoctorResult[]>; export declare const mediaDoctorChecks: AgoraDoctorCheck[]; export {}; //# sourceMappingURL=checks.d.ts.map