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

49 lines • 2.49 kB
import { type TenantScope } from '../agora/tenancy.js'; import { type MediaManagerLike } from './service.js'; /** * Which tenants (organizations) the console shows a viewer, once tenancy is on: * * - `authorized`: what `authorize` granted — `'*'` (every tenant, and files with no tenant), a * list, or the viewer's own active tenant (`own`), or nothing (`'none'`: a viewer with no tenant). * - `selected`: the tenant the viewer picked (`?tenant=`), already intersected with `authorized`. * - `ids`: what the console's reads are confined to (`undefined` = no confinement; `null` = files * with no tenant). */ export interface ConsoleTenantScope { authorized: '*' | string[] | 'none'; /** The viewer's own active tenant, when the scope came from it. */ own?: { id: string; kind?: string | undefined; slug?: string | undefined; } | undefined; selected: string | undefined; ids: Array<string | null> | undefined; /** The viewer asked for a tenant outside `authorized` (answered with nothing, and audited). */ forged: boolean; } /** Resolve the console scope from the `authorize` grant, the viewer's tenant and their pick. */ export declare function resolveConsoleTenantScope(input: { granted: '*' | string[] | undefined; own: { id: string; kind?: string | undefined; slug?: string | undefined; } | undefined; selected: string | undefined; }): ConsoleTenantScope; /** The ids of a console scope as a {@link TenantScope} (`undefined`: unconfined). */ export declare function tenantScopeOf(ids: Array<string | null> | undefined): TenantScope | undefined; /** * The storage prefixes a confined viewer may browse on the disks: `t/<tenantId>/` per tenant in * scope (where tenancy stores new files). `undefined` when the viewer is not confined. */ export declare function consoleKeyPrefixes(ids: Array<string | null> | undefined): string[] | undefined; /** * The console's view of the media manager with tenancy on, confined to `ids` (`undefined`: every * tenant): the store only sees those tenants' records (another tenant's reads as missing), and the * upload list only their sessions. Upload-session reads run across tenants first (the console's * own scope replaces the request's tenant), then keep the scope's. */ export declare function scopedManager(manager: MediaManagerLike, ids: Array<string | null> | undefined): MediaManagerLike; //# sourceMappingURL=tenant_scope.d.ts.map