( body: unknown, )
| 334 | // --------------------------------------------------------------------------- |
| 335 | |
| 336 | export function validateCodeNavRequest( |
| 337 | body: unknown, |
| 338 | ): string | null { |
| 339 | if (!body || typeof body !== "object") return "Invalid request body"; |
| 340 | const b = body as Record<string, unknown>; |
| 341 | |
| 342 | if (typeof b.symbol !== "string" || !b.symbol.trim()) { |
| 343 | return "Missing or empty symbol"; |
| 344 | } |
| 345 | if (typeof b.filePath !== "string" || !b.filePath.trim()) { |
| 346 | return "Missing filePath"; |
| 347 | } |
| 348 | try { |
| 349 | validateFilePath(b.filePath as string); |
| 350 | } catch { |
| 351 | return "Invalid filePath"; |
| 352 | } |
| 353 | if (b.side !== "old" && b.side !== "new") { |
| 354 | return "side must be 'old' or 'new'"; |
| 355 | } |
| 356 | |
| 357 | return null; |
| 358 | } |
| 359 | |
| 360 | // --------------------------------------------------------------------------- |
| 361 | // Main entry point |
no test coverage detected