UNPKG

@avonjs/avonjs

Version:

A fluent Node.js API generator.

63 lines (62 loc) 2.38 kB
import type { Action } from '../Actions'; import type { AbstractMixable, ActionEventRepository, BulkActionResult, Model, Payload, PrimaryKey, Transaction } from '../Contracts'; import { type Repository } from '../Repositories'; declare const _default: <T extends AbstractMixable = AbstractMixable>(Parent: T) => (abstract new (...args: import("../Contracts").Args) => { /** * Indicates related resource model. */ resource: Model; /** * Indicates activating record events for the resource. */ recordEvents: boolean; /** * Create an action event for the resource creation. */ recordCreationEvent(payload?: Payload, transaction?: Transaction, userId?: PrimaryKey): Promise<void>; /** * Create an action event for the resource updates. */ recordUpdateEvent(previous: Model, payload?: Payload, transaction?: Transaction, userId?: PrimaryKey): Promise<void>; /** * Create an action event for the resource delete. */ recordDeletionEvent(transaction?: Transaction, userId?: PrimaryKey): Promise<void>; /** * Create an action event for the resource delete. */ recordRestoreEvent(transaction?: Transaction, userId?: PrimaryKey): Promise<void>; /** * Create an action event for the resource delete. */ recordStandaloneActionEvent(action: Action, payload?: Payload, userId?: PrimaryKey): Promise<void>; /** * Create an action event for the resource delete. */ recordBulkActionEvent(action: Action, changes?: BulkActionResult, payload?: Payload, userId?: PrimaryKey): Promise<void>; /** * Forget action event rows. */ flushActionEvents(transaction?: Transaction): Promise<void>; /** * Make action events repository with given transaction; */ makeActionRepository(transaction?: Transaction): Repository<Model> & ActionEventRepository<Model>; /** * Get action event repository for resource. */ actionRepository(): Repository & ActionEventRepository<Model>; /** * Determine could record the action. */ isRecordable(): boolean; /** * Removes unsafe values from the record to ensure data integrity. */ sanitizePayload(payload: Payload): Payload; /** * Get the resource name fo events. */ resourceName(): string; }) & T; export default _default;