refactor(domain): split Icon/WebSub/Counters out of FeedRepository

FeedRepository no longer owns favicons, WebSub subscriber lists or the
monitoring counters singleton. Each concern gets its own repository
(IconRepository, WebSubSubscriptionRepository, CountersRepository),
sharing the key schema via feed-keys. KV key strings are unchanged;
counters increment policy stays in utils/stats.ts.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
Julien HerrandClaude Opus 4.7 committed 2026-05-24 00:27:33 +02:00
1 parent b347f2f625
commit a31ff42f59
13 files changed
+204 -119

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
import { describe, it, expect } from "vitest";
import { createMockEnv } from "../test/setup";
import { IconRepository } from "./icon-repository";
import type { Env } from "../types";
const mockEnv = () => createMockEnv() as unknown as Env;
describe("IconRepository", () => {
it("stores and reads favicons as text or json under the icon: key", async () => {
const repo = new IconRepository(mockEnv().EMAIL_STORAGE);
expect(await repo.getText("example.com")).toBeNull();
await repo.put("example.com", JSON.stringify({ data: null }), 60);
expect(await repo.getText("example.com")).toBe('{"data":null}');
expect(await repo.getJson<{ data: null }>("example.com")).toEqual({
data: null,
});
});
});