@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
58 lines • 3.07 kB
TypeScript
import { BaseCommand } from '@adonisjs/core/ace';
import type { CommandOptions } from '@adonisjs/core/types/ace';
import type { DashboardService } from '../dashboard/service.js';
/** Who the `media:*` commands act as, in log lines: `cli:<os user>`, or `cli`. */
export declare function cliActor(): string;
/** A refusal the command reports as is (exit code 1), without a stack. */
export declare class CommandRefusal extends Error {
}
/**
* Base of the `media:*` console commands. Each one runs the SAME `DashboardService` the media
* console's JSON API and its developer tools run (same disks, same `actions` switch, same tenant
* confinement), built from `config/media_dashboard.ts`. Nothing about storage is reimplemented here.
*
* - `--json` prints one JSON document (the console API's response shape) instead of a table.
* - `--tenant <id>` confines a command to one organization when tenancy is on; without it the
* command sees every organization (the operator running `node ace` is trusted like a console
* viewer granted `tenants: '*'`).
* - A failure prints the reason and exits with code 1.
*/
export declare abstract class MediaConsoleCommand extends BaseCommand {
static options: CommandOptions;
json: boolean;
tenant?: string;
/** The command's work, given the console's service. */
protected abstract handle(service: DashboardService): Promise<void>;
run(): Promise<void>;
/** Report `error` and exit with code 1. */
protected fail(error: unknown): void;
/** Print `value` as one JSON document. */
protected printJson(value: unknown): void;
/** Print rows as a table, or `empty` when there are none. */
protected printTable(head: string[], rows: string[][], empty?: string): void;
/** Print `key: value` lines, skipping undefined values. */
protected printFields(fields: Array<[string, unknown]>): void;
/** The default disk of the console (the manager default when browsable, else the first). */
protected defaultDisk(service: DashboardService): string;
/**
* Refuse a change up front when the console's `actions` switch is off (the service refuses it
* too; this only saves asking a question whose answer cannot be acted on).
*/
protected assertActions(service: DashboardService): void;
/**
* Ask before a destructive change unless `force`. Returns whether to go ahead; a "no" exits with
* code 1.
*/
protected confirmed(force: boolean, question: string): Promise<boolean>;
/** Log an action through the app logger, with the actor (`cli:<os user>`). */
protected audit(action: string): Promise<void>;
}
/** A size in bytes for humans (`1.2 MB`), or `-` when unknown. */
export declare function formatBytes(bytes: number | null | undefined): string;
/** A query-string-shaped request for the console's list readers (`list_api.ts`). */
export declare function listRequest(query: Record<string, unknown>): {
request: {
qs: () => Record<string, unknown>;
};
};
//# sourceMappingURL=console_command.d.ts.map