Skip to content

Commit 64fb21d

Browse files
docs: add missing code fences to JSDoc @example blocks (#1485)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7e80df6 commit 64fb21d

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

packages/client/src/client/auth.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,6 +1206,7 @@ export async function refreshAuthorization(
12061206
* @throws {Error} When provider doesn't implement prepareTokenRequest or token fetch fails
12071207
*
12081208
* @example
1209+
* ```typescript
12091210
* // Provider for client_credentials:
12101211
* class MyProvider implements OAuthClientProvider {
12111212
* prepareTokenRequest(scope) {
@@ -1217,6 +1218,7 @@ export async function refreshAuthorization(
12171218
* }
12181219
*
12191220
* const tokens = await fetchToken(provider, authServerUrl, { metadata });
1221+
* ```
12201222
*/
12211223
export async function fetchToken(
12221224
provider: OAuthClientProvider,

packages/client/src/client/authExtensions.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ import type { AddClientAuthentication, OAuthClientProvider } from './auth.js';
1313
/**
1414
* Helper to produce a private_key_jwt client authentication function.
1515
*
16-
* Usage:
17-
* const addClientAuth = createPrivateKeyJwtAuth({ issuer, subject, privateKey, alg, audience? });
18-
* // pass addClientAuth as provider.addClientAuthentication implementation
16+
* @example
17+
* ```typescript
18+
* const addClientAuth = createPrivateKeyJwtAuth({ issuer, subject, privateKey, alg, audience? });
19+
* // pass addClientAuth as provider.addClientAuthentication implementation
20+
* ```
1921
*/
2022
export function createPrivateKeyJwtAuth(options: {
2123
issuer: string;
@@ -114,6 +116,7 @@ export interface ClientCredentialsProviderOptions {
114116
* the client authenticates using a client_id and client_secret.
115117
*
116118
* @example
119+
* ```typescript
117120
* const provider = new ClientCredentialsProvider({
118121
* clientId: 'my-client',
119122
* clientSecret: 'my-secret'
@@ -122,6 +125,7 @@ export interface ClientCredentialsProviderOptions {
122125
* const transport = new StreamableHTTPClientTransport(serverUrl, {
123126
* authProvider: provider
124127
* });
128+
* ```
125129
*/
126130
export class ClientCredentialsProvider implements OAuthClientProvider {
127131
private _tokens?: OAuthTokens;
@@ -222,6 +226,7 @@ export interface PrivateKeyJwtProviderOptions {
222226
* the client authenticates using a signed JWT assertion (RFC 7523 Section 2.2).
223227
*
224228
* @example
229+
* ```typescript
225230
* const provider = new PrivateKeyJwtProvider({
226231
* clientId: 'my-client',
227232
* privateKey: pemEncodedPrivateKey,
@@ -231,6 +236,7 @@ export interface PrivateKeyJwtProviderOptions {
231236
* const transport = new StreamableHTTPClientTransport(serverUrl, {
232237
* authProvider: provider
233238
* });
239+
* ```
234240
*/
235241
export class PrivateKeyJwtProvider implements OAuthClientProvider {
236242
private _tokens?: OAuthTokens;

packages/server/src/server/middleware/hostHeaderValidation.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ export function localhostAllowedHostnames(): string[] {
4444
/**
4545
* Web-standard Request helper for DNS rebinding protection.
4646
* @example
47+
* ```typescript
4748
* const result = validateHostHeader(req.headers.get('host'), ['localhost'])
49+
* ```
4850
*/
4951
export function hostHeaderValidationResponse(req: Request, allowedHostnames: string[]): Response | undefined {
5052
const result = validateHostHeader(req.headers.get('host'), allowedHostnames);

0 commit comments

Comments
 (0)