refactor(domain): make FeedId circulate through the domain and repository

FeedId is now the type of Feed.id and of every single-feed method on
FeedRepository; callers wrap raw strings via FeedId.fromTrusted at the
repository boundary. String-medium operations (URLs, logs, JSON,
list registry, email keys) stay string. Drop the redundant
generateFeedId wrapper in favour of FeedId.generate.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Julien Herr
2026-05-24 00:44:24 +02:00
parent 05388b45c8
commit ab1c15e69a
18 changed files with 162 additions and 124 deletions
+4 -2
View File
@@ -4,6 +4,7 @@ import { Env } from "../types";
import { processEmailContent } from "../utils/html-processor";
import { formatBytes } from "../utils/format";
import { FeedRepository } from "../domain/feed-repository";
import { FeedId } from "../domain/value-objects/feed-id";
import { isExpired } from "../domain/feed";
export async function handle(c: Context<{ Bindings: Env }>): Promise<Response> {
@@ -15,10 +16,11 @@ export async function handle(c: Context<{ Bindings: Env }>): Promise<Response> {
}
const repo = FeedRepository.from(c.env);
const id = FeedId.fromTrusted(feedId);
const [feedMetadata, feedConfig] = await Promise.all([
repo.getMetadata(feedId),
repo.getConfig(feedId),
repo.getMetadata(id),
repo.getConfig(id),
]);
if (!feedMetadata) {
return new Response("Feed not found", { status: 404 });