@@ -22,12 +22,29 @@ export declare namespace ManagementClient {
2222 * @group Management API
2323 * @public
2424 */
25- export interface ManagementClientOptions extends Omit <
26- FernClient . Options ,
27- "token" | "environment" | "fetcher" | "baseUrl"
28- > {
25+ export interface ManagementClientOptions
26+ extends Omit < FernClient . Options , "token" | "environment" | "fetcher" | "baseUrl" > {
2927 /** Auth0 domain (e.g., 'your-tenant.auth0.com') */
3028 domain : string ;
29+ /**
30+ * Custom `fetch` implementation used for all HTTP requests.
31+ *
32+ * Provide your own transport when you need to control how requests are
33+ * made — for example to route through a proxy or corporate egress, add
34+ * retry middleware, attach OpenTelemetry instrumentation, or run on
35+ * platforms where the global `fetch` must be swapped (Cloudflare
36+ * Workers, Bun). Defaults to the platform's global `fetch`.
37+ *
38+ * @example
39+ * ```typescript
40+ * const client = new ManagementClient({
41+ * domain: 'your-tenant.auth0.com',
42+ * token: 'your-static-token',
43+ * fetch: myInstrumentedFetch,
44+ * });
45+ * ```
46+ */
47+ fetch ?: typeof fetch ;
3148 /**
3249 * API audience. Defaults to https://{domain}/api/v2/
3350 * @defaultValue `https://{domain}/api/v2/`
@@ -182,16 +199,16 @@ export declare namespace ManagementClient {
182199 * });
183200 * ```
184201 *
185- * @example Using custom fetcher with custom domain header (they work together)
202+ * @example Using a custom fetch with custom domain header (they work together)
186203 * ```typescript
187204 * const client = new ManagementClient({
188205 * domain: 'your-tenant.auth0.com',
189206 * clientId: 'your-client-id',
190207 * clientSecret: 'your-client-secret',
191208 * withCustomDomainHeader: 'auth.example.com', // Custom domain header logic
192- * fetcher: async (args ) => {
193- * console.log('Making request:', args.url ); // Custom logging
194- * return fetch(args.url, { ...args }); // Custom fetch implementation
209+ * fetch: (input, init ) => {
210+ * console.log('Making request:', input ); // Custom logging
211+ * return fetch(input, init); // Custom fetch implementation
195212 * }
196213 * });
197214 * ```
@@ -208,11 +225,10 @@ export class ManagementClient extends FernClient {
208225 const headers = createTelemetryHeaders ( _options ) ;
209226 const token = createTokenSupplier ( _options ) ;
210227
211- // The underlying fetcher type is internal to the generated Fern client
212- // and is intentionally kept off the public surface. `fetch`, however,
213- // is supported all the way down through `fetcherImpl` and is a
214- // legitimate customization hook for callers that need to control the
215- // HTTP transport (proxies, retries, instrumentation).
228+ // The underlying `fetcher` type is a Fern implementation detail and is
229+ // intentionally kept off the public surface, so strip it here. `fetch`,
230+ // by contrast, is supported all the way down through `fetcherImpl` and
231+ // is a legitimate transport-customization hook, so it is left in place.
216232 // https://github.com/auth0/node-auth0/issues/1330
217233 delete ( _options as any ) . fetcher ;
218234
0 commit comments