1 | import * as fatcher from 'fatcher';
|
2 | import { Context } from 'fatcher';
|
3 |
|
4 | declare type RoadSign = {
|
5 | abort: () => void;
|
6 | signal: AbortSignal;
|
7 | };
|
8 | declare type RoadMap = Record<string, RoadSign[]>;
|
9 | interface AborterMiddlewareContext extends Readonly<Context> {
|
10 | |
11 |
|
12 |
|
13 |
|
14 |
|
15 | abort: () => void;
|
16 | signal: AbortSignal;
|
17 | }
|
18 | interface AborterOptions {
|
19 | |
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | timeout?: number;
|
27 | |
28 |
|
29 |
|
30 |
|
31 |
|
32 | onAbort?: (() => void) | null;
|
33 | /**
|
34 | * Request concurrency restrictions
|
35 | *
|
36 | * @default false
|
37 | */
|
38 | concurrency?: boolean;
|
39 | /**
|
40 | * Concurrency key.
|
41 | */
|
42 | groupBy?: (context: Readonly<Context>) => string;
|
43 | }
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 | declare function aborter(options?: AborterOptions): fatcher.Middleware[];
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | declare function isAbortError(error: unknown): error is DOMException;
|
58 |
|
59 | export { AborterMiddlewareContext, AborterOptions, RoadMap, RoadSign, aborter, isAbortError };
|