@jrmc/adonis-attachment
Version:
Turn any field on your Lucid model to an attachment data type
68 lines • 2.08 kB
TypeScript
/**
* @jrmc/adonis-attachment
*
* @license MIT
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
*/
import type { RowWithAttachment } from '../../types/mixin.js';
import type { Attachment as AttachmentType } from '../../types/attachment.js';
import type { RecordWithAttachment as RecordWithAttachmentImplementation } from '../../types/service.js';
import type { RegenerateOptions } from '../../types/regenerate.js';
import type { TransactionOptions } from './attachment_transaction_service.js';
export default class AttachmentRecorderService implements RecordWithAttachmentImplementation {
#private;
constructor(row: RowWithAttachment);
/**
* During commit, we should cleanup the old detached files
*/
commit(): Promise<void>;
/**
* During rollback we should remove the attached files.
*/
rollback(): Promise<void>;
/**
* Persist attachments before saving the row to the database
*/
persist(): Promise<void>;
/**
* Handle transaction lifecycle
*/
transaction(options?: TransactionOptions): Promise<void>;
/**
* Pre-compute URLs for all attachments
*/
preComputeUrl(): Promise<void>;
/**
* Set key IDs for all attachments
*/
setKeyId(): Promise<void>;
/**
* Generate variants for all dirty attachment attributes
*/
generateVariants(): Promise<void>;
/**
* Regenerate variants with specific options
*/
regenerateVariants(options?: RegenerateOptions): Promise<void>;
/**
* Detach dirty attachments (mark for deletion)
*/
detach(): Promise<void>;
/**
* Detach all attachments (mark all for deletion)
*/
detachAll(): Promise<void>;
/**
* Get row instance
*/
get row(): RowWithAttachment;
/**
* Get attachments with specific options
*/
getAttachments(options: {
attributeName: string;
requiredOriginal?: boolean;
requiredDirty?: boolean;
}): Promise<AttachmentType[]>;
}
//# sourceMappingURL=attachment_recorder_service.d.ts.map