fix: remove @sofa/core and @sofa/api deps from public-api to fix Vercel runtime compatibility

- Drop `@sofa/core` and `@sofa/api` from `apps/public-api` — importing workspace packages with DB/Node dependencies broke the Vercel edge runtime
- `fetchUserData` on Trakt and Simkl importers now returns raw `unknown` API responses; parsing is deferred to the self-hosted server
- Add `source` + `rawPayload` fields to `ParsePayloadInput`; `parsePayload` procedure now dispatches to `parseTraktPayload`/`parseSimklPayload` and returns full warnings + diagnostics
- Export `ProviderEnum` from `apps/public-api/src/importers/index.ts` instead of defining it inline in `app.ts`
This commit is contained in:
2026-03-23 12:48:04 -04:00
parent 9df1075040
commit cc8909d64e
19 changed files with 250 additions and 396 deletions
@@ -1,5 +1,5 @@
---
title: Preview normalized import data
title: Parse raw OAuth import data
full: true
_openapi:
method: POST
@@ -8,13 +8,12 @@ _openapi:
headings: []
contents:
- content: >-
Accept pre-normalized import data from the OAuth proxy and return a
preview with item counts. No parsing is needed — data is already in
NormalizedImport format.
Accept raw API responses from the OAuth proxy, parse them into
normalized import format, and return a preview with item counts.
---
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Accept pre-normalized import data from the OAuth proxy and return a preview with item counts. No parsing is needed — data is already in NormalizedImport format.
Accept raw API responses from the OAuth proxy, parse them into normalized import format, and return a preview with item counts.
<APIPage document={"./public/openapi.json"} operations={[{"path":"/imports/parse-payload","method":"post"}]} />
+10
View File
@@ -22,6 +22,16 @@ const config = {
destination: "https://github.com/jakejarvis/sofa/discussions",
permanent: false,
},
{
source: "/ios",
destination: "https://apps.apple.com/us/app/sofa-tv-movie-tracker/id6760432427",
permanent: false,
},
{
source: "/testflight",
destination: "https://testflight.apple.com/join/tjSddcaZ",
permanent: false,
}
];
},
async rewrites() {
+13 -203
View File
@@ -6570,8 +6570,8 @@
"/imports/parse-payload": {
"post": {
"operationId": "imports.parsePayload",
"summary": "Preview normalized import data",
"description": "Accept pre-normalized import data from the OAuth proxy and return a preview with item counts. No parsing is needed — data is already in NormalizedImport format.",
"summary": "Parse raw OAuth import data",
"description": "Accept raw API responses from the OAuth proxy, parse them into normalized import format, and return a preview with item counts.",
"tags": [
"Imports"
],
@@ -6582,210 +6582,20 @@
"schema": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"source": {
"enum": [
"trakt",
"simkl",
"letterboxd",
"sofa"
],
"type": "string",
"description": "Service to import from"
},
"movies": {
"type": "array",
"maxItems": 50000,
"items": {
"type": "object",
"properties": {
"tmdbId": {
"type": "number"
},
"imdbId": {
"type": "string"
},
"title": {
"type": "string"
},
"year": {
"type": "number"
},
"watchedAt": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp"
},
"watchedOn": {
"type": "string",
"format": "date",
"description": "YYYY-MM-DD date-only"
}
},
"required": [
"title"
]
}
},
"episodes": {
"type": "array",
"maxItems": 50000,
"items": {
"type": "object",
"properties": {
"showTmdbId": {
"type": "number"
},
"imdbId": {
"type": "string"
},
"tvdbId": {
"type": "number"
},
"showTitle": {
"type": "string"
},
"year": {
"type": "number"
},
"seasonNumber": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"episodeNumber": {
"type": "integer",
"minimum": 1,
"maximum": 9007199254740991
},
"watchedAt": {
"type": "string",
"format": "date-time"
},
"watchedOn": {
"type": "string",
"format": "date"
}
},
"required": [
"seasonNumber",
"episodeNumber"
]
}
},
"watchlist": {
"type": "array",
"maxItems": 50000,
"items": {
"type": "object",
"properties": {
"tmdbId": {
"type": "number"
},
"imdbId": {
"type": "string"
},
"tvdbId": {
"type": "number"
},
"title": {
"type": "string"
},
"year": {
"type": "number"
},
"type": {
"enum": [
"movie",
"tv"
],
"type": "string"
},
"status": {
"enum": [
"watchlist",
"in_progress",
"completed"
],
"type": "string",
"description": "Library status (default: watchlist)"
},
"addedAt": {
"type": "string",
"format": "date-time",
"description": "When the item was added to library"
}
},
"required": [
"title",
"type"
]
}
},
"ratings": {
"type": "array",
"maxItems": 50000,
"items": {
"type": "object",
"properties": {
"tmdbId": {
"type": "number"
},
"imdbId": {
"type": "string"
},
"tvdbId": {
"type": "number"
},
"title": {
"type": "string"
},
"year": {
"type": "number"
},
"type": {
"enum": [
"movie",
"tv"
],
"type": "string"
},
"rating": {
"type": "integer",
"minimum": 1,
"maximum": 5,
"description": "Sofa 1-5 star rating"
},
"ratedAt": {
"type": "string",
"format": "date-time"
},
"ratedOn": {
"type": "string",
"format": "date"
}
},
"required": [
"title",
"type",
"rating"
]
}
}
},
"required": [
"source",
"movies",
"episodes",
"watchlist",
"ratings"
]
"source": {
"enum": [
"trakt",
"simkl"
],
"type": "string",
"description": "OAuth import provider"
},
"rawPayload": {
"description": "Raw aggregated API response from the OAuth proxy"
}
},
"required": [
"data"
"source"
]
}
}