pulse/interfaces/storage.interface.ts

29 lines
662 B
TypeScript

import type { FeedItem } from './feed.types.js';
export interface StorageError {
code: 'DB_ERROR' | 'CONSTRAINT_ERROR' | 'UNKNOWN';
message: string;
}
export interface IStorage {
/**
* Persist items to storage. Should handle duplicates gracefully (upsert).
*/
save(items: FeedItem[]): Promise<void>;
/**
* Get most recent items across all sources.
*/
getRecent(limit: number): Promise<FeedItem[]>;
/**
* Get recent items from a specific source feed.
*/
getBySource(source: string, limit: number): Promise<FeedItem[]>;
/**
* Search items by title/content keywords.
*/
search(query: string): Promise<FeedItem[]>;
}