Add FeedOrchestrator that coordinates fetch→parse→dedup→store pipeline: - FeedSource type for managing RSS/Atom feed configurations - Feed source CRUD operations in IStorage interface - Database schema migration for feed_sources table - Exponential backoff retry with configurable delays - Per-feed poll intervals with health tracking - Concurrency-limited parallel feed processing - ProcessResult and FeedHealth interfaces for status monitoring Files added: - orchestrator/orchestrator.ts - main orchestrator class - orchestrator/scheduler.ts - backoff calculation utilities - orchestrator/index.ts - module exports - orchestrator/orchestrator.test.ts - comprehensive test suite Files modified: - interfaces/feed.types.ts - add FeedSource type - interfaces/storage.interface.ts - extend with feed source methods - infrastructure/db/database.ts - add FeedSourceTable interface - infrastructure/db/schema.ts - add feed_sources table migration - modules/storage/storage.ts - implement feed source CRUD - modules/storage/storage.test.ts - add feed source tests
28 lines
687 B
TypeScript
28 lines
687 B
TypeScript
import type { FeedItem } from '../../interfaces/feed.types.js';
|
|
|
|
interface JsonFeedItem {
|
|
id: string;
|
|
source: string;
|
|
title: string;
|
|
url: string;
|
|
publishedAt: string;
|
|
content?: string;
|
|
summary?: string;
|
|
}
|
|
|
|
export class JsonFormatter {
|
|
format(items: FeedItem[]): string {
|
|
const jsonItems: JsonFeedItem[] = items.map(item => ({
|
|
id: item.id,
|
|
source: item.source,
|
|
title: item.title,
|
|
url: item.url,
|
|
publishedAt: item.publishedAt.toISOString(),
|
|
...(item.content !== undefined && { content: item.content }),
|
|
...(item.summary !== undefined && { summary: item.summary })
|
|
}));
|
|
|
|
return JSON.stringify(jsonItems, null, 2);
|
|
}
|
|
}
|