A zero-dependency AT Protocol Personal Data Server written in JavaScript
atproto pds

chore: fix type errors and formatting

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Changed files
+32 -17
src
test
+23 -15
src/pds.js
··· 3731 3731 * Validate OAuth authorization request parameters. 3732 3732 * Shared between PAR and direct authorization flows. 3733 3733 * @param {Object} params - The authorization parameters 3734 - * @param {string} params.clientId - The client_id 3735 - * @param {string} params.redirectUri - The redirect_uri 3736 - * @param {string} params.responseType - The response_type 3737 - * @param {string} [params.responseMode] - The response_mode 3738 - * @param {string} [params.scope] - The scope 3739 - * @param {string} [params.state] - The state 3740 - * @param {string} params.codeChallenge - The code_challenge 3741 - * @param {string} params.codeChallengeMethod - The code_challenge_method 3742 - * @param {string} [params.loginHint] - The login_hint 3734 + * @param {string | undefined | null} params.clientId - The client_id 3735 + * @param {string | undefined | null} params.redirectUri - The redirect_uri 3736 + * @param {string | undefined | null} params.responseType - The response_type 3737 + * @param {string | undefined | null} params.codeChallenge - The code_challenge 3738 + * @param {string | undefined | null} params.codeChallengeMethod - The code_challenge_method 3743 3739 * @returns {Promise<{error: Response} | {clientMetadata: ClientMetadata}>} 3744 3740 */ 3745 3741 async validateAuthorizationParameters({ ··· 3750 3746 codeChallengeMethod, 3751 3747 }) { 3752 3748 if (!clientId) { 3753 - return { error: errorResponse('invalid_request', 'client_id required', 400) }; 3749 + return { 3750 + error: errorResponse('invalid_request', 'client_id required', 400), 3751 + }; 3754 3752 } 3755 3753 if (!redirectUri) { 3756 - return { error: errorResponse('invalid_request', 'redirect_uri required', 400) }; 3754 + return { 3755 + error: errorResponse('invalid_request', 'redirect_uri required', 400), 3756 + }; 3757 3757 } 3758 3758 if (responseType !== 'code') { 3759 3759 return { ··· 3765 3765 }; 3766 3766 } 3767 3767 if (!codeChallenge || codeChallengeMethod !== 'S256') { 3768 - return { error: errorResponse('invalid_request', 'PKCE with S256 required', 400) }; 3768 + return { 3769 + error: errorResponse('invalid_request', 'PKCE with S256 required', 400), 3770 + }; 3769 3771 } 3770 3772 3771 3773 let clientMetadata; ··· 3920 3922 return new Response('Missing client_id parameter', { status: 400 }); 3921 3923 } 3922 3924 3923 - const match = requestUri.match(/^urn:ietf:params:oauth:request_uri:(.+)$/); 3925 + const match = requestUri.match( 3926 + /^urn:ietf:params:oauth:request_uri:(.+)$/, 3927 + ); 3924 3928 if (!match) return new Response('Invalid request_uri', { status: 400 }); 3925 3929 3926 3930 const rows = this.sql ··· 3932 3936 .toArray(); 3933 3937 const authRequest = rows[0]; 3934 3938 3935 - if (!authRequest) return new Response('Request not found', { status: 400 }); 3939 + if (!authRequest) 3940 + return new Response('Request not found', { status: 400 }); 3936 3941 if (new Date(/** @type {string} */ (authRequest.expires_at)) < new Date()) 3937 3942 return new Response('Request expired', { status: 400 }); 3938 3943 if (authRequest.code) ··· 3952 3957 scope: parameters.scope || 'atproto', 3953 3958 requestUri: requestUri || '', 3954 3959 }), 3955 - { status: 200, headers: { 'Content-Type': 'text/html; charset=utf-8' } }, 3960 + { 3961 + status: 200, 3962 + headers: { 'Content-Type': 'text/html; charset=utf-8' }, 3963 + }, 3956 3964 ); 3957 3965 } 3958 3966
+9 -2
test/e2e.test.js
··· 1474 1474 authorizeUrl.searchParams.set('login_hint', DID); 1475 1475 1476 1476 const getRes = await fetch(authorizeUrl.toString()); 1477 - assert.strictEqual(getRes.status, 200, 'Direct authorize GET should succeed'); 1477 + assert.strictEqual( 1478 + getRes.status, 1479 + 200, 1480 + 'Direct authorize GET should succeed', 1481 + ); 1478 1482 1479 1483 const html = await getRes.text(); 1480 1484 assert.ok(html.includes('Authorize'), 'Should show consent page'); 1481 - assert.ok(html.includes('request_uri'), 'Should include request_uri in form'); 1485 + assert.ok( 1486 + html.includes('request_uri'), 1487 + 'Should include request_uri in form', 1488 + ); 1482 1489 }); 1483 1490 1484 1491 it('completes full direct authorization flow', async () => {