1 | /**
|
2 | * -------------------------------------------------------------------------------------------
|
3 | * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
|
4 | * See License in the project root for license information.
|
5 | * -------------------------------------------------------------------------------------------
|
6 | */
|
7 | /**
|
8 | * @module RetryHandlerOptions
|
9 | */
|
10 | import { FetchOptions } from "../../IFetchOptions";
|
11 | import { MiddlewareOptions } from "./IMiddlewareOptions";
|
12 | /**
|
13 | * @type
|
14 | * A type declaration for shouldRetry callback
|
15 | */
|
16 | export type ShouldRetry = (delay: number, attempt: number, request: RequestInfo, options: FetchOptions | undefined, response: Response) => boolean;
|
17 | /**
|
18 | * @class
|
19 | * @implements MiddlewareOptions
|
20 | * Class for RetryHandlerOptions
|
21 | */
|
22 | export declare class RetryHandlerOptions implements MiddlewareOptions {
|
23 | /**
|
24 | * @private
|
25 | * @static
|
26 | * A member holding default delay value in seconds
|
27 | */
|
28 | private static DEFAULT_DELAY;
|
29 | /**
|
30 | * @private
|
31 | * @static
|
32 | * A member holding default maxRetries value
|
33 | */
|
34 | private static DEFAULT_MAX_RETRIES;
|
35 | /**
|
36 | * @private
|
37 | * @static
|
38 | * A member holding maximum delay value in seconds
|
39 | */
|
40 | private static MAX_DELAY;
|
41 | /**
|
42 | * @private
|
43 | * @static
|
44 | * A member holding maximum maxRetries value
|
45 | */
|
46 | private static MAX_MAX_RETRIES;
|
47 | /**
|
48 | * @public
|
49 | * A member holding delay value in seconds
|
50 | */
|
51 | delay: number;
|
52 | /**
|
53 | * @public
|
54 | * A member holding maxRetries value
|
55 | */
|
56 | maxRetries: number;
|
57 | /**
|
58 | * @public
|
59 | * A member holding shouldRetry callback
|
60 | */
|
61 | shouldRetry: ShouldRetry;
|
62 | /**
|
63 | * @private
|
64 | * A member holding default shouldRetry callback
|
65 | */
|
66 | private static defaultShouldRetry;
|
67 | /**
|
68 | * @public
|
69 | * @constructor
|
70 | * To create an instance of RetryHandlerOptions
|
71 | * @param {number} [delay = RetryHandlerOptions.DEFAULT_DELAY] - The delay value in seconds
|
72 | * @param {number} [maxRetries = RetryHandlerOptions.DEFAULT_MAX_RETRIES] - The maxRetries value
|
73 | * @param {ShouldRetry} [shouldRetry = RetryHandlerOptions.DEFAULT_SHOULD_RETRY] - The shouldRetry callback function
|
74 | * @returns An instance of RetryHandlerOptions
|
75 | */
|
76 | constructor(delay?: number, maxRetries?: number, shouldRetry?: ShouldRetry);
|
77 | /**
|
78 | * @public
|
79 | * To get the maximum delay
|
80 | * @returns A maximum delay
|
81 | */
|
82 | getMaxDelay(): number;
|
83 | }
|