@ahoo-wang/fetcher 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -6,7 +6,7 @@ function b(r, e) {
6
6
  }
7
7
  class g {
8
8
  /**
9
- * Creates a UrlBuilder instance
9
+ * Initializes a new UrlBuilder instance.
10
10
  *
11
11
  * @param baseURL - Base URL that all constructed URLs will be based on
12
12
  *
@@ -19,7 +19,7 @@ class g {
19
19
  this.baseURL = e;
20
20
  }
21
21
  /**
22
- * Builds a complete URL, including path parameter replacement and query parameter addition
22
+ * Builds a complete URL, including path parameter replacement and query parameter addition.
23
23
  *
24
24
  * @param url - URL path to build (e.g., '/users/{id}/posts')
25
25
  * @param params - URL parameters including path and query parameters
@@ -46,9 +46,9 @@ class g {
46
46
  return o;
47
47
  }
48
48
  /**
49
- * Resolves a complete URL from a FetchRequest
49
+ * Resolves a complete URL from a FetchRequest.
50
50
  *
51
- * This method is used internally by the Fetcher to build the final URL for a request
51
+ * Used internally by the Fetcher to build the final URL for a request
52
52
  * by combining the request URL with its URL parameters using this UrlBuilder.
53
53
  *
54
54
  * @param request - The FetchRequest containing URL and URL parameters
@@ -58,7 +58,7 @@ class g {
58
58
  return this.build(e.url, e.urlParams);
59
59
  }
60
60
  /**
61
- * Replaces placeholders in the URL with path parameters
61
+ * Replaces placeholders in the URL with path parameters.
62
62
  *
63
63
  * @param url - Path string containing placeholders, e.g., "http://localhost/users/{id}/posts/{postId}"
64
64
  * @param path - Path parameter object used to replace placeholders in the URL
@@ -98,7 +98,7 @@ function w(r, e) {
98
98
  }
99
99
  class p extends Error {
100
100
  /**
101
- * Creates a new FetchTimeoutError instance
101
+ * Creates a new FetchTimeoutError instance.
102
102
  *
103
103
  * @param request - The request options that timed out
104
104
  */
@@ -140,7 +140,7 @@ class R {
140
140
  this.name = "RequestBodyInterceptor", this.order = Number.MIN_SAFE_INTEGER + 200;
141
141
  }
142
142
  /**
143
- * Attempts to convert request body to a valid fetch API body type
143
+ * Attempts to convert request body to a valid fetch API body type.
144
144
  *
145
145
  * According to the Fetch API specification, body can be multiple types, but for
146
146
  * plain objects, they need to be converted to JSON strings.
@@ -162,18 +162,19 @@ class R {
162
162
  * converted to JSON strings.
163
163
  *
164
164
  * @param exchange - The exchange object containing the request to process
165
- * @returns The processed exchange object with potentially modified request body
166
165
  *
167
166
  * @example
168
167
  * // Plain object body will be converted to JSON
169
- * const exchange = {
170
- * request: {
168
+ * const fetcher = new Fetcher();
169
+ * const exchange = new FetchExchange(
170
+ * fetcher,
171
+ * {
171
172
  * body: { name: 'John', age: 30 }
172
173
  * }
173
- * };
174
- * const result = interceptor.intercept(exchange);
175
- * // result.request.body will be '{"name":"John","age":30}'
176
- * // result.request.headers will include 'Content-Type: application/json'
174
+ * );
175
+ * interceptor.intercept(exchange);
176
+ * // exchange.request.body will be '{"name":"John","age":30}'
177
+ * // exchange.request.headers will include 'Content-Type: application/json'
177
178
  */
178
179
  intercept(e) {
179
180
  const t = e.request;
@@ -191,7 +192,7 @@ class F {
191
192
  this.name = "FetchInterceptor", this.order = Number.MAX_SAFE_INTEGER - 100;
192
193
  }
193
194
  /**
194
- * Intercept and process HTTP requests
195
+ * Intercept and process HTTP requests.
195
196
  *
196
197
  * Executes the actual HTTP request and applies timeout control. This is the final
197
198
  * step in the request processing chain, responsible for calling the timeoutFetch
@@ -203,15 +204,17 @@ class F {
203
204
  *
204
205
  * @example
205
206
  * // Usually called internally by Fetcher
206
- * const exchange = {
207
- * url: 'https://api.example.com/users',
208
- * request: {
207
+ * const fetcher = new Fetcher();
208
+ * const exchange = new FetchExchange(
209
+ * fetcher,
210
+ * {
211
+ * url: 'https://api.example.com/users',
209
212
  * method: 'GET',
210
213
  * timeout: 5000
211
214
  * }
212
- * };
213
- * const result = await fetchInterceptor.intercept(exchange);
214
- * console.log(result.response); // HTTP response object
215
+ * );
216
+ * await fetchInterceptor.intercept(exchange);
217
+ * console.log(exchange.response); // HTTP response object
215
218
  */
216
219
  async intercept(e) {
217
220
  e.response = await P(e.request);
@@ -222,10 +225,9 @@ class A {
222
225
  this.name = "UrlResolveInterceptor", this.order = Number.MIN_SAFE_INTEGER + 100;
223
226
  }
224
227
  /**
225
- * Resolves the final URL by combining the base URL, path parameters, and query parameters
228
+ * Resolves the final URL by combining the base URL, path parameters, and query parameters.
226
229
  *
227
230
  * @param exchange - The fetch exchange containing the request information
228
- * @returns The modified exchange with the resolved URL
229
231
  */
230
232
  intercept(e) {
231
233
  const t = e.request;
@@ -234,7 +236,7 @@ class A {
234
236
  }
235
237
  class h {
236
238
  /**
237
- * Creates a new InterceptorManager instance
239
+ * Initializes a new InterceptorManager instance.
238
240
  *
239
241
  * @param interceptors - Initial array of interceptors to manage
240
242
  *
@@ -246,7 +248,7 @@ class h {
246
248
  this.sortedInterceptors = [], this.sortedInterceptors = a(e);
247
249
  }
248
250
  /**
249
- * Gets the name of this interceptor manager
251
+ * Gets the name of this interceptor manager.
250
252
  *
251
253
  * @returns The constructor name of this class
252
254
  */
@@ -254,7 +256,7 @@ class h {
254
256
  return this.constructor.name;
255
257
  }
256
258
  /**
257
- * Gets the order of this interceptor manager
259
+ * Gets the order of this interceptor manager.
258
260
  *
259
261
  * @returns Number.MIN_SAFE_INTEGER, indicating this manager should execute early
260
262
  */
@@ -262,7 +264,7 @@ class h {
262
264
  return Number.MIN_SAFE_INTEGER;
263
265
  }
264
266
  /**
265
- * Adds an interceptor to this manager
267
+ * Adds an interceptor to this manager.
266
268
  *
267
269
  * @param interceptor - The interceptor to add
268
270
  * @returns True if the interceptor was added, false if an interceptor with the
@@ -281,7 +283,7 @@ class h {
281
283
  ]), !0);
282
284
  }
283
285
  /**
284
- * Removes an interceptor by name
286
+ * Removes an interceptor by name.
285
287
  *
286
288
  * @param name - The name of the interceptor to remove
287
289
  * @returns True if an interceptor was removed, false if no interceptor with the
@@ -295,16 +297,16 @@ class h {
295
297
  ), t.length !== this.sortedInterceptors.length;
296
298
  }
297
299
  /**
298
- * Removes all interceptors from this manager
300
+ * Removes all interceptors from this manager.
299
301
  */
300
302
  clear() {
301
303
  this.sortedInterceptors = [];
302
304
  }
303
305
  /**
304
- * Executes all managed interceptors on the given exchange object
306
+ * Executes all managed interceptors on the given exchange object.
305
307
  *
306
308
  * @param exchange - The exchange object to process
307
- * @returns A promise that resolves to the processed exchange object
309
+ * @returns A promise that resolves when all interceptors have been executed
308
310
  *
309
311
  * @remarks
310
312
  * Interceptors are executed in order, with each interceptor receiving the result
@@ -333,7 +335,7 @@ class S {
333
335
  this.attributes = {}, this.fetcher = e, this.request = t, this.response = s, this.error = n;
334
336
  }
335
337
  /**
336
- * Checks if the exchange has an error
338
+ * Checks if the exchange has an error.
337
339
  *
338
340
  * @returns true if an error is present, false otherwise
339
341
  */
@@ -341,7 +343,7 @@ class S {
341
343
  return !!this.error;
342
344
  }
343
345
  /**
344
- * Checks if the exchange has a response
346
+ * Checks if the exchange has a response.
345
347
  *
346
348
  * @returns true if a response is present, false otherwise
347
349
  */
@@ -361,19 +363,26 @@ const l = {
361
363
  };
362
364
  class q {
363
365
  /**
364
- * Create a Fetcher instance
366
+ * Initializes a new Fetcher instance with optional configuration.
365
367
  *
366
- * @param options - Fetcher configuration options
368
+ * Creates a Fetcher with default settings that can be overridden through the options parameter.
369
+ * If no interceptors are provided, a default set of interceptors will be used.
370
+ *
371
+ * @param options - Configuration options for the Fetcher instance
367
372
  */
368
373
  constructor(e = T) {
369
374
  this.headers = l, this.urlBuilder = new g(e.baseURL), this.headers = e.headers ?? l, this.timeout = e.timeout, this.interceptors = e.interceptors ?? new N();
370
375
  }
371
376
  /**
372
- * Make an HTTP request
377
+ * Executes an HTTP request with the specified URL and options.
378
+ *
379
+ * This is the primary method for making HTTP requests. It processes the request
380
+ * through the interceptor chain and returns the resulting Response.
373
381
  *
374
- * @param url - Request URL path
375
- * @param request - Request options, including path parameters, query parameters, etc.
376
- * @returns Promise<Response> HTTP response
382
+ * @param url - The URL path for the request (relative to baseURL if set)
383
+ * @param request - Request configuration including headers, body, parameters, etc.
384
+ * @returns Promise that resolves to the HTTP response
385
+ * @throws Error if the request fails and no response is generated
377
386
  */
378
387
  async fetch(e, t = {}) {
379
388
  const s = t;
@@ -384,12 +393,15 @@ class q {
384
393
  return n.response;
385
394
  }
386
395
  /**
387
- * Send an HTTP request
396
+ * Processes an HTTP request through the Fetcher's internal workflow.
388
397
  *
389
- * @param request - Request configuration object, including url, method, headers, body, etc.
390
- * @returns Promise that resolves to a FetchExchange object containing request and response information
398
+ * This method prepares the request by merging headers and timeout settings,
399
+ * creates a FetchExchange object, and passes it through the exchange method
400
+ * for interceptor processing.
391
401
  *
392
- * @throws Throws an exception when an error occurs during the request and is not handled by error interceptors
402
+ * @param request - Complete request configuration object
403
+ * @returns Promise that resolves to a FetchExchange containing request/response data
404
+ * @throws Error if an unhandled error occurs during request processing
393
405
  */
394
406
  async request(e) {
395
407
  const t = d(e.headers, this.headers), s = {
@@ -400,20 +412,20 @@ class q {
400
412
  return this.exchange(n);
401
413
  }
402
414
  /**
403
- * Process a fetch exchange through the interceptor chain
415
+ * Processes a FetchExchange through the interceptor chain.
404
416
  *
405
- * This method orchestrates the complete request lifecycle by applying interceptors
406
- * in the following order:
407
- * 1. Request interceptors - to modify the outgoing request
408
- * 2. Response interceptors - to process the incoming response
417
+ * Orchestrates the complete request lifecycle by applying interceptors in sequence:
418
+ * 1. Request interceptors - Modify the outgoing request
419
+ * 2. Response interceptors - Process the incoming response
409
420
  *
410
- * If any error occurs during the process, error interceptors are applied to handle it.
411
- * If an error interceptor produces a response, that response is returned. Otherwise,
412
- * the original error is re-thrown.
421
+ * Error handling follows this flow:
422
+ * - If an error occurs, error interceptors are invoked
423
+ * - If an error interceptor produces a response, it's returned
424
+ * - Otherwise, the original error is re-thrown
413
425
  *
414
- * @param fetchExchange - The exchange object containing request, response, and metadata
415
- * @returns Promise<FetchExchange> The processed exchange with final response or error
416
- * @throws Error if an error occurs and is not handled by error interceptors
426
+ * @param fetchExchange - The exchange object containing request and response data
427
+ * @returns Promise resolving to the processed exchange
428
+ * @throws Error if an unhandled error occurs during processing
417
429
  */
418
430
  async exchange(e) {
419
431
  try {
@@ -425,12 +437,15 @@ class q {
425
437
  }
426
438
  }
427
439
  /**
428
- * Make an HTTP request with the specified method
440
+ * Internal helper method for making HTTP requests with a specific method.
441
+ *
442
+ * This private method is used by the public HTTP method methods (get, post, etc.)
443
+ * to execute requests with the appropriate HTTP verb.
429
444
  *
430
- * @param method - HTTP method to use
431
- * @param url - Request URL path
432
- * @param request - Request options
433
- * @returns Promise<Response> HTTP response
445
+ * @param method - The HTTP method to use for the request
446
+ * @param url - The URL path for the request
447
+ * @param request - Additional request options
448
+ * @returns Promise that resolves to the HTTP response
434
449
  */
435
450
  async methodFetch(e, t, s = {}) {
436
451
  return this.fetch(t, {
@@ -439,71 +454,88 @@ class q {
439
454
  });
440
455
  }
441
456
  /**
442
- * Make a GET request
457
+ * Makes a GET HTTP request.
443
458
  *
444
- * @param url - Request URL path
445
- * @param request - Request options, including path parameters, query parameters, etc.
446
- * @returns Promise<Response> HTTP response
459
+ * Convenience method for making GET requests. The request body is omitted
460
+ * as GET requests should not contain a body according to HTTP specification.
461
+ *
462
+ * @param url - The URL path for the request
463
+ * @param request - Request options excluding method and body
464
+ * @returns Promise that resolves to the HTTP response
447
465
  */
448
466
  async get(e, t = {}) {
449
467
  return this.methodFetch(c.GET, e, t);
450
468
  }
451
469
  /**
452
- * Make a POST request
470
+ * Makes a POST HTTP request.
471
+ *
472
+ * Convenience method for making POST requests, commonly used for creating resources.
453
473
  *
454
- * @param url - Request URL path
455
- * @param request - Request options, including path parameters, query parameters, request body, etc.
456
- * @returns Promise<Response> HTTP response
474
+ * @param url - The URL path for the request
475
+ * @param request - Request options including body and other parameters
476
+ * @returns Promise that resolves to the HTTP response
457
477
  */
458
478
  async post(e, t = {}) {
459
479
  return this.methodFetch(c.POST, e, t);
460
480
  }
461
481
  /**
462
- * Make a PUT request
482
+ * Makes a PUT HTTP request.
463
483
  *
464
- * @param url - Request URL path
465
- * @param request - Request options, including path parameters, query parameters, request body, etc.
466
- * @returns Promise<Response> HTTP response
484
+ * Convenience method for making PUT requests, commonly used for updating resources.
485
+ *
486
+ * @param url - The URL path for the request
487
+ * @param request - Request options including body and other parameters
488
+ * @returns Promise that resolves to the HTTP response
467
489
  */
468
490
  async put(e, t = {}) {
469
491
  return this.methodFetch(c.PUT, e, t);
470
492
  }
471
493
  /**
472
- * Make a DELETE request
494
+ * Makes a DELETE HTTP request.
495
+ *
496
+ * Convenience method for making DELETE requests, commonly used for deleting resources.
473
497
  *
474
- * @param url - Request URL path
475
- * @param request - Request options, including path parameters, query parameters, etc.
476
- * @returns Promise<Response> HTTP response
498
+ * @param url - The URL path for the request
499
+ * @param request - Request options excluding method and body
500
+ * @returns Promise that resolves to the HTTP response
477
501
  */
478
502
  async delete(e, t = {}) {
479
503
  return this.methodFetch(c.DELETE, e, t);
480
504
  }
481
505
  /**
482
- * Make a PATCH request
506
+ * Makes a PATCH HTTP request.
507
+ *
508
+ * Convenience method for making PATCH requests, commonly used for partial updates.
483
509
  *
484
- * @param url - Request URL path
485
- * @param request - Request options, including path parameters, query parameters, request body, etc.
486
- * @returns Promise<Response> HTTP response
510
+ * @param url - The URL path for the request
511
+ * @param request - Request options including body and other parameters
512
+ * @returns Promise that resolves to the HTTP response
487
513
  */
488
514
  async patch(e, t = {}) {
489
515
  return this.methodFetch(c.PATCH, e, t);
490
516
  }
491
517
  /**
492
- * Make a HEAD request
518
+ * Makes a HEAD HTTP request.
493
519
  *
494
- * @param url - Request URL path
495
- * @param request - Request options, including path parameters, query parameters, etc.
496
- * @returns Promise<Response> HTTP response
520
+ * Convenience method for making HEAD requests, which retrieve headers only.
521
+ * The request body is omitted as HEAD requests should not contain a body.
522
+ *
523
+ * @param url - The URL path for the request
524
+ * @param request - Request options excluding method and body
525
+ * @returns Promise that resolves to the HTTP response
497
526
  */
498
527
  async head(e, t = {}) {
499
528
  return this.methodFetch(c.HEAD, e, t);
500
529
  }
501
530
  /**
502
- * Make an OPTIONS request
531
+ * Makes an OPTIONS HTTP request.
532
+ *
533
+ * Convenience method for making OPTIONS requests, commonly used for CORS preflight.
534
+ * The request body is omitted as OPTIONS requests typically don't contain a body.
503
535
  *
504
- * @param url - Request URL path
505
- * @param request - Request options, including path parameters, query parameters, etc.
506
- * @returns Promise<Response> HTTP response
536
+ * @param url - The URL path for the request
537
+ * @param request - Request options excluding method and body
538
+ * @returns Promise that resolves to the HTTP response
507
539
  */
508
540
  async options(e, t = {}) {
509
541
  return this.methodFetch(c.OPTIONS, e, t);
@@ -2,14 +2,11 @@ import { NamedCapable } from './types';
2
2
  import { OrderedCapable } from './orderedCapable';
3
3
  import { FetchExchange } from './fetchExchange';
4
4
  /**
5
- * Interceptor Interface
5
+ * Interface for HTTP interceptors in the fetcher pipeline.
6
6
  *
7
- * Defines the basic structure of an interceptor. Interceptors are used to process
8
- * requests, responses, or errors at different stages of the HTTP request lifecycle.
9
- *
10
- * @remarks
11
- * Interceptors follow the Chain of Responsibility pattern, where each interceptor
12
- * can modify the exchange object and pass it to the next interceptor in the chain.
7
+ * Interceptors are middleware components that can modify requests, responses, or handle errors
8
+ * at different stages of the HTTP request lifecycle. They follow the Chain of Responsibility
9
+ * pattern, where each interceptor can process the exchange object and pass it to the next.
13
10
  *
14
11
  * @example
15
12
  * // Example of a custom request interceptor
@@ -27,21 +24,19 @@ import { FetchExchange } from './fetchExchange';
27
24
  */
28
25
  export interface Interceptor extends NamedCapable, OrderedCapable {
29
26
  /**
30
- * Interceptor name, used to identify the interceptor and must be unique
27
+ * Unique identifier for the interceptor.
31
28
  *
32
- * @remarks
33
- * The name is used by the InterceptorManager to manage interceptors,
34
- * including adding, removing, and preventing duplicates.
29
+ * Used by InterceptorManager to manage interceptors, including adding, removing,
30
+ * and preventing duplicates. Each interceptor must have a unique name.
35
31
  */
36
32
  name: string;
37
33
  /**
38
- * Intercept and process data
34
+ * Process the exchange object in the interceptor pipeline.
39
35
  *
40
- * This method is called by the InterceptorManager to process the exchange object.
41
- * The interceptor can modify the request, response, or error properties of the
42
- * exchange object directly.
36
+ * This method is called by InterceptorManager to process the exchange object.
37
+ * Interceptors can modify request, response, or error properties directly.
43
38
  *
44
- * @param exchange - The data to be processed, containing request, response, and error information
39
+ * @param exchange - The exchange object containing request, response, and error information
45
40
  *
46
41
  * @remarks
47
42
  * Interceptors should modify the exchange object directly rather than returning it.
@@ -50,11 +45,10 @@ export interface Interceptor extends NamedCapable, OrderedCapable {
50
45
  intercept(exchange: FetchExchange): void | Promise<void>;
51
46
  }
52
47
  /**
53
- * InterceptorManager Class
48
+ * Manager for a collection of interceptors of the same type.
54
49
  *
55
- * Manages multiple interceptors of the same type. Responsible for adding, removing,
56
- * and executing interceptors in the correct order. Each InterceptorManager instance
57
- * handles one type of interceptor (request, response, or error).
50
+ * Handles adding, removing, and executing interceptors in the correct order.
51
+ * Each InterceptorManager instance manages one type of interceptor (request, response, or error).
58
52
  *
59
53
  * @remarks
60
54
  * Interceptors are executed in ascending order of their `order` property.
@@ -75,23 +69,23 @@ export interface Interceptor extends NamedCapable, OrderedCapable {
75
69
  */
76
70
  export declare class InterceptorManager implements Interceptor {
77
71
  /**
78
- * Gets the name of this interceptor manager
72
+ * Gets the name of this interceptor manager.
79
73
  *
80
74
  * @returns The constructor name of this class
81
75
  */
82
76
  get name(): string;
83
77
  /**
84
- * Gets the order of this interceptor manager
78
+ * Gets the order of this interceptor manager.
85
79
  *
86
80
  * @returns Number.MIN_SAFE_INTEGER, indicating this manager should execute early
87
81
  */
88
82
  get order(): number;
89
83
  /**
90
- * Array of interceptors managed by this manager, sorted by their order property
84
+ * Array of interceptors managed by this manager, sorted by their order property.
91
85
  */
92
86
  private sortedInterceptors;
93
87
  /**
94
- * Creates a new InterceptorManager instance
88
+ * Initializes a new InterceptorManager instance.
95
89
  *
96
90
  * @param interceptors - Initial array of interceptors to manage
97
91
  *
@@ -101,7 +95,7 @@ export declare class InterceptorManager implements Interceptor {
101
95
  */
102
96
  constructor(interceptors?: Interceptor[]);
103
97
  /**
104
- * Adds an interceptor to this manager
98
+ * Adds an interceptor to this manager.
105
99
  *
106
100
  * @param interceptor - The interceptor to add
107
101
  * @returns True if the interceptor was added, false if an interceptor with the
@@ -115,7 +109,7 @@ export declare class InterceptorManager implements Interceptor {
115
109
  */
116
110
  use(interceptor: Interceptor): boolean;
117
111
  /**
118
- * Removes an interceptor by name
112
+ * Removes an interceptor by name.
119
113
  *
120
114
  * @param name - The name of the interceptor to remove
121
115
  * @returns True if an interceptor was removed, false if no interceptor with the
@@ -123,14 +117,14 @@ export declare class InterceptorManager implements Interceptor {
123
117
  */
124
118
  eject(name: string): boolean;
125
119
  /**
126
- * Removes all interceptors from this manager
120
+ * Removes all interceptors from this manager.
127
121
  */
128
122
  clear(): void;
129
123
  /**
130
- * Executes all managed interceptors on the given exchange object
124
+ * Executes all managed interceptors on the given exchange object.
131
125
  *
132
126
  * @param exchange - The exchange object to process
133
- * @returns A promise that resolves to the processed exchange object
127
+ * @returns A promise that resolves when all interceptors have been executed
134
128
  *
135
129
  * @remarks
136
130
  * Interceptors are executed in order, with each interceptor receiving the result
@@ -143,14 +137,15 @@ export declare class InterceptorManager implements Interceptor {
143
137
  intercept(exchange: FetchExchange): Promise<void>;
144
138
  }
145
139
  /**
146
- * FetcherInterceptors Class
140
+ * Collection of interceptor managers for the Fetcher client.
147
141
  *
148
- * The interceptor collection management class for Fetcher, responsible for managing three types of interceptors:
142
+ * Manages three types of interceptors:
149
143
  * 1. Request interceptors - Process requests before sending HTTP requests
150
144
  * 2. Response interceptors - Process responses after receiving HTTP responses
151
145
  * 3. Error interceptors - Handle errors when they occur during the request process
152
146
  *
153
- * Each type of interceptor is managed by an InterceptorManager instance, supporting adding, removing, and executing interceptors.
147
+ * Each type of interceptor is managed by an InterceptorManager instance, supporting
148
+ * adding, removing, and executing interceptors.
154
149
  *
155
150
  * @example
156
151
  * // Create a custom interceptor
@@ -172,44 +167,47 @@ export declare class InterceptorManager implements Interceptor {
172
167
  * fetcher.interceptors.request.use(customRequestInterceptor);
173
168
  *
174
169
  * @remarks
175
- * By default, the request interceptor manager has two built-in interceptors registered:
176
- * 1. RequestBodyInterceptor - Automatically converts object-type request bodies to JSON strings
177
- * 2. FetchInterceptor - Executes actual HTTP requests and handles timeouts
170
+ * By default, the request interceptor manager has three built-in interceptors registered:
171
+ * 1. UrlResolveInterceptor - Resolves the final URL with parameters
172
+ * 2. RequestBodyInterceptor - Automatically converts object-type request bodies to JSON strings
173
+ * 3. FetchInterceptor - Executes actual HTTP requests and handles timeouts
178
174
  */
179
175
  export declare class FetcherInterceptors {
180
176
  /**
181
- * Request Interceptor Manager
177
+ * Manager for request-phase interceptors.
182
178
  *
183
- * Responsible for managing all request-phase interceptors, executed before HTTP requests are sent.
184
- * Contains three built-in interceptors by default: UrlResolveInterceptor, RequestBodyInterceptor, and FetchInterceptor.
179
+ * Executed before HTTP requests are sent. Contains three built-in interceptors by default:
180
+ * UrlResolveInterceptor, RequestBodyInterceptor, and FetchInterceptor.
185
181
  *
186
182
  * @remarks
187
- * Request interceptors are executed in ascending order of their order values, with smaller values having higher priority.
188
- * The default interceptors are:
183
+ * Request interceptors are executed in ascending order of their order values, with smaller
184
+ * values having higher priority. The default interceptors are:
189
185
  * 1. UrlResolveInterceptor (order: Number.MIN_SAFE_INTEGER) - Resolves the final URL
190
186
  * 2. RequestBodyInterceptor (order: 0) - Converts object bodies to JSON
191
187
  * 3. FetchInterceptor (order: Number.MAX_SAFE_INTEGER) - Executes the actual HTTP request
192
188
  */
193
189
  request: InterceptorManager;
194
190
  /**
195
- * Response Interceptor Manager
191
+ * Manager for response-phase interceptors.
196
192
  *
197
- * Responsible for managing all response-phase interceptors, executed after HTTP responses are received.
198
- * Empty by default, custom response processing logic can be added as needed.
193
+ * Executed after HTTP responses are received. Empty by default, custom response processing
194
+ * logic can be added as needed.
199
195
  *
200
196
  * @remarks
201
- * Response interceptors are executed in ascending order of their order values, with smaller values having higher priority.
197
+ * Response interceptors are executed in ascending order of their order values, with smaller
198
+ * values having higher priority.
202
199
  */
203
200
  response: InterceptorManager;
204
201
  /**
205
- * Error Interceptor Manager
202
+ * Manager for error-handling phase interceptors.
206
203
  *
207
- * Responsible for managing all error-handling phase interceptors, executed when errors occur during HTTP requests.
208
- * Empty by default, custom error handling logic can be added as needed.
204
+ * Executed when errors occur during HTTP requests. Empty by default, custom error handling
205
+ * logic can be added as needed.
209
206
  *
210
207
  * @remarks
211
- * Error interceptors are executed in ascending order of their order values, with smaller values having higher priority.
212
- * Error interceptors can transform errors into normal responses, avoiding thrown exceptions.
208
+ * Error interceptors are executed in ascending order of their order values, with smaller
209
+ * values having higher priority. Error interceptors can transform errors into normal responses,
210
+ * avoiding thrown exceptions.
213
211
  */
214
212
  error: InterceptorManager;
215
213
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interceptor.d.ts","sourceRoot":"","sources":["../src/interceptor.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,cAAc,EAAY,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,WAAY,SAAQ,YAAY,EAAE,cAAc;IAC/D;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,kBAAmB,YAAW,WAAW;IACpD;;;;OAIG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;OAIG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;OAEG;IACH,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