mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-21 06:13:48 +00:00
refactor: move KV repositories to infrastructure (Track P — points 2, 6c)
Make the domain stop depending on infrastructure ("imports point inward").
- Point 2: relocate the four KV adapters (FeedRepository, IconRepository,
WebSubSubscriptionRepository, CountersRepository) from domain/ to
infrastructure/, where the logger import is legitimate. The domain now keeps
only the pure key schema (feed-keys.ts), the Feed aggregate and value objects;
it imports nothing outward. Deliberately no hand-rolled 24-method port
interface (YAGNI without DI) — relocation alone fixes the direction.
- Point 6c: EmailParser.extractFeedId now returns a validated FeedId value
object instead of a raw string, so the most untrusted input (an inbound
recipient address) is guarded at the parse boundary and no longer round-trips
through FeedId.fromTrusted in the ingest path.
All import paths updated; CLAUDE.md source layout/KV-schema notes updated.
351 tests pass; tsc --noEmit clean.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -8,7 +8,7 @@ import { ADMIN_COOKIE_MAX_AGE } from "../config/constants";
|
||||
import { logger } from "../infrastructure/logger";
|
||||
import { timingSafeEqual, checkProxyAuth } from "../infrastructure/auth";
|
||||
import { Layout, clampText } from "./admin/ui";
|
||||
import { FeedRepository } from "../domain/feed-repository";
|
||||
import { FeedRepository } from "../infrastructure/feed-repository";
|
||||
import { renameFeed } from "../application/feed-service";
|
||||
import {
|
||||
feedRssUrl,
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
deleteAttachmentsForEmails,
|
||||
deleteKeysWithConcurrency,
|
||||
} from "./helpers";
|
||||
import { FeedRepository } from "../../domain/feed-repository";
|
||||
import { FeedRepository } from "../../infrastructure/feed-repository";
|
||||
import { FeedId } from "../../domain/value-objects/feed-id";
|
||||
import {
|
||||
feedRssUrl,
|
||||
|
||||
@@ -9,7 +9,7 @@ import { sendUnsubscribes } from "../../infrastructure/unsubscribe";
|
||||
import { getAttachmentBucket } from "../../infrastructure/attachments";
|
||||
import { Layout } from "./ui";
|
||||
import { purgeFeedKeysStep, collectUnsubscribeUrls } from "./helpers";
|
||||
import { FeedRepository } from "../../domain/feed-repository";
|
||||
import { FeedRepository } from "../../infrastructure/feed-repository";
|
||||
import { FeedId } from "../../domain/value-objects/feed-id";
|
||||
import {
|
||||
createFeedRecord,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EmailData, EmailMetadata, Env } from "../../types";
|
||||
import { logger } from "../../infrastructure/logger";
|
||||
import { getAttachmentBucket } from "../../infrastructure/attachments";
|
||||
import { FeedRepository } from "../../domain/feed-repository";
|
||||
import { FeedRepository } from "../../infrastructure/feed-repository";
|
||||
import { FeedId } from "../../domain/value-objects/feed-id";
|
||||
|
||||
// Delete the R2 attachments belonging to the given email keys. Call before the
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
deleteFeedRecord,
|
||||
} from "../../application/feed-service";
|
||||
import { deleteAttachmentsForEmails } from "../admin/helpers";
|
||||
import { FeedRepository } from "../../domain/feed-repository";
|
||||
import { FeedRepository } from "../../infrastructure/feed-repository";
|
||||
import { FeedId } from "../../domain/value-objects/feed-id";
|
||||
import { getStats } from "../../application/stats";
|
||||
import {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { html, raw } from "hono/html";
|
||||
import { Env } from "../types";
|
||||
import { processEmailContent } from "../infrastructure/html-processor";
|
||||
import { formatBytes } from "../domain/format";
|
||||
import { FeedRepository } from "../domain/feed-repository";
|
||||
import { FeedRepository } from "../infrastructure/feed-repository";
|
||||
import { FeedId } from "../domain/value-objects/feed-id";
|
||||
import { isExpired } from "../domain/feed";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Context } from "hono";
|
||||
import { Env } from "../types";
|
||||
import { FeedRepository } from "../domain/feed-repository";
|
||||
import { FeedRepository } from "../infrastructure/feed-repository";
|
||||
import { FeedId } from "../domain/value-objects/feed-id";
|
||||
import {
|
||||
cacheFaviconForDomain,
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import {
|
||||
import { waitUntilSafe } from "../infrastructure/worker";
|
||||
import { DEFAULT_LEASE_SECONDS, MAX_LEASE_SECONDS } from "../config/constants";
|
||||
import { feedTopicPattern } from "../infrastructure/urls";
|
||||
import { FeedRepository } from "../domain/feed-repository";
|
||||
import { FeedRepository } from "../infrastructure/feed-repository";
|
||||
import { FeedId } from "../domain/value-objects/feed-id";
|
||||
|
||||
type AppEnv = { Bindings: Env };
|
||||
|
||||
Reference in New Issue
Block a user