(id: number)
| 533 | } |
| 534 | |
| 535 | async function handleAuthLoad(id: number): Promise<void> { |
| 536 | if (!authHook?.loader) { |
| 537 | sendError(id, -32601, "No auth.loader handler"); |
| 538 | return; |
| 539 | } |
| 540 | |
| 541 | try { |
| 542 | const loaded = await authHook.loader(); |
| 543 | const hasCustomFetch = typeof loaded.fetch === "function"; |
| 544 | if (hasCustomFetch) { |
| 545 | customFetch = loaded.fetch!; |
| 546 | } |
| 547 | |
| 548 | sendResult(id, { |
| 549 | apiKey: loaded.apiKey, |
| 550 | hasCustomFetch, |
| 551 | }); |
| 552 | } catch (err: unknown) { |
| 553 | const msg = err instanceof Error ? err.message : String(err); |
| 554 | sendError(id, -32603, `auth.load failed: ${msg}`); |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | async function handleAuthFetch( |
| 559 | id: number, |
no test coverage detected