[upstream #17033] 17033: Keep Mongoose types out of the eraseUserData dependency contract #329
Description
Raised by Codex on LibreChat-AI#17033: LibreChat-AI#17033 (comment)
UserErasureDeps in packages/api/src/user/erasure.ts is built from Pick<AllMethods, ...> and IMongoFile[], so the exported erasure service carries Mongoose Document, filter and ObjectId shapes, and eraseUserData converts the user id with mongoose.Types.ObjectId itself. AGENTS.md asks that packages/api exports take plain typed objects and leave ObjectId conversion inside packages/data-schemas.
These are the same method contracts the controller cascade already called from /api before LibreChat-AI#17033; the PR moved the call sequence, not the method shapes. A fix needs string-id variants of deleteBalances, deleteAllAgentApiKeys and deleteAllAgentQueuedTurnsForUser, a plain file shape for getFiles/deleteStoredFiles, and narrow dependency signatures in place of Pick<AllMethods>.
Activity