@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
59 lines • 2.92 kB
TypeScript
import type { Database } from '@adonisjs/lucid/database';
import type { UploadSession, UploadSessionListFilter, UploadSessionStore } from '../resumable_upload.js';
import { type MediaSchemaInspection } from '../stores/lucid-schema.js';
import type { MultipartPart } from '../types.js';
export interface LucidUploadSessionStoreOptions {
/** Lucid connection name. Defaults to the `Database` default connection. */
connectionName?: string;
/** Sessions table name. Default `media_upload_sessions`. */
table?: string;
/** Parts side-index table name. Default `media_upload_parts`. */
partsTable?: string;
/**
* Database schema both tables live in (a Postgres schema, a MySQL database). Every query names
* it. Not supported on SQLite (the constructor throws). Default: the connection's current schema.
*/
schema?: string;
/**
* Read and write the sessions' `tenant_id` column (media's `tenancy` is on). Off by default: the
* column is then never touched.
*/
tenantColumn?: boolean;
}
export declare class LucidUploadSessionStore implements UploadSessionStore {
#private;
private readonly db;
private readonly table;
private readonly partsTable;
/** The configured database schema, or `undefined` for the connection's current one. */
readonly schema: string | undefined;
/** The unqualified sessions and parts table names. */
private readonly tableNames;
private readonly connectionName;
private readonly tenantColumn;
constructor(db: Database, options?: LucidUploadSessionStoreOptions);
/**
* Where the configured {@link schema} stands, for `agora:doctor`: whether it exists, whether both
* tables are in it, and whether this connection may write there. `null` without a schema.
*/
inspectSchema(): Promise<MediaSchemaInspection | null>;
/** The connection's dialect name, when it can be read without a query. */
private dialect;
private client;
/**
* Whether the sessions table has its `updated_at` column (a zero-row probe). Tables created before
* the column existed keep working without it: the store then neither writes nor reads
* `updatedAt`. Add it with `node ace media:publish-migration timestamps`. A found column is
* remembered; a missing one (or table) is probed again at most once a minute, so a migration run
* under a live process is picked up.
*/
hasUpdatedAtColumn(): Promise<boolean>;
create(session: UploadSession): Promise<UploadSession>;
get(id: string): Promise<UploadSession | null>;
update(session: UploadSession): Promise<UploadSession>;
delete(id: string): Promise<void>;
addPart(id: string, part: MultipartPart): Promise<void>;
listParts(id: string): Promise<MultipartPart[]>;
list(filter?: UploadSessionListFilter): Promise<UploadSession[]>;
}
//# sourceMappingURL=lucid.d.ts.map