mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-10-16 01:05:42 -04:00
fix(public-api): paginate Trakt sign-in import and keep it under the response limit
Follow Trakt's pagination headers, slim items to the fields Sofa reads, keep the most recent plays when the payload would exceed Vercel's 4.5 MB response limit, surface failed/truncated lists as warnings, and return a readable fetch_error instead of an oversized response for every provider. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
7 files changed
+505
-27
No files matched your search
@@ -24,6 +24,15 @@ function createLetterboxdZip(files: Record<string, string>): Blob {
|
||||
// ─── parseTraktPayload ───────────────────────────────────────────────
|
||||
|
||||
describe("parseTraktPayload", () => {
|
||||
test("passes through warnings from the OAuth proxy", () => {
|
||||
const result = parseTraktPayload({
|
||||
history: { movies: [] },
|
||||
warnings: ["Only some history fit", 42],
|
||||
} as never);
|
||||
expect(result.warnings).toContain("Only some history fit");
|
||||
expect(result.warnings.every((w) => typeof w === "string")).toBe(true);
|
||||
});
|
||||
|
||||
test("parses valid data with movies, episodes, watchlist, and ratings", () => {
|
||||
const result = parseTraktPayload({
|
||||
history: {
|
||||
|
||||
Reference in new issue
Block a user