@mastra/core
Version:
37 lines • 2.23 kB
TypeScript
import { StorageDomain } from '../storage/domains/base.js';
import type { CreateNotificationInput, ListDueNotificationsInput, ListNotificationsInput, NotificationRecord, UpdateNotificationInput, UpdateNotificationsStatusInput } from './types.js';
export declare abstract class NotificationsStorage extends StorageDomain {
constructor();
abstract createNotification(input: CreateNotificationInput): Promise<NotificationRecord>;
abstract listNotifications(input: ListNotificationsInput): Promise<NotificationRecord[]>;
abstract listDueNotifications(input: ListDueNotificationsInput): Promise<NotificationRecord[]>;
abstract getNotification(input: {
threadId: string;
id: string;
}): Promise<NotificationRecord | null>;
abstract updateNotification(input: UpdateNotificationInput): Promise<NotificationRecord>;
/**
* Set the same status on many notifications of one thread.
* Returns each updated record once — duplicate ids are collapsed and ids that do not
* exist are skipped. Implementations must accept arbitrarily long id lists (batching
* internally where the backend limits bind parameters).
* Adapters should override this with a native bulk update — the default issues one
* `updateNotification` per id (omitting any that fail) so existing adapters keep working.
*/
updateNotificationsStatus(input: UpdateNotificationsStatusInput): Promise<NotificationRecord[]>;
}
export declare class InMemoryNotificationsStorage extends NotificationsStorage {
#private;
createNotification(input: CreateNotificationInput): Promise<NotificationRecord>;
listNotifications(input: ListNotificationsInput): Promise<NotificationRecord[]>;
listDueNotifications(input: ListDueNotificationsInput): Promise<NotificationRecord[]>;
getNotification(input: {
threadId: string;
id: string;
}): Promise<NotificationRecord | null>;
updateNotification(input: UpdateNotificationInput): Promise<NotificationRecord>;
updateNotificationsStatus(input: UpdateNotificationsStatusInput): Promise<NotificationRecord[]>;
dangerouslyClearAll(): Promise<void>;
private findCoalescable;
}
//# sourceMappingURL=storage.d.ts.map