@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
32 lines • 1.52 kB
TypeScript
import type { Transformer, TransformerContext, TransformResult } from '../transformer.js';
export interface FakeTransformerOptions<Name extends string = string> {
/** Conversion name this fake produces. */
name: Name;
eager?: boolean;
/** Artifacts to write through `context.write`, keyed by prefix-relative path. */
artifacts?: Record<string, string>;
/**
* Entry declared in the result. Defaults to the first artifact key; pass `null` for a
* metadata-only result (with no artifacts).
*/
entry?: string | null;
/** Metadata declared in the result. */
meta?: Record<string, unknown>;
/** Full behavior override — everything above but `name`/`eager` is ignored when set. */
behavior?: (context: TransformerContext) => Promise<TransformResult>;
}
/**
* Deterministic {@link Transformer} for tests — the transformer counterpart of
* `FakeImageProcessor`. It records every context it is called with and writes/declares exactly
* what it was configured to, so eager/deferred behaviour, artifact bookkeeping and rollback can be
* asserted without a media engine.
*/
export declare class FakeTransformer<Name extends string = string> implements Transformer {
readonly name: Name;
readonly eager: boolean;
readonly calls: TransformerContext[];
private readonly options;
constructor(options: FakeTransformerOptions<Name>);
transform(context: TransformerContext): Promise<TransformResult>;
}
//# sourceMappingURL=fake_transformer.d.ts.map