mezon-js 2.15.74 → 2.15.76

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.
@@ -0,0 +1,13 @@
1
+ type Fetcher = typeof fetch;
2
+ /**
3
+ * Set a custom fetch strategy for mezon-js API calls
4
+ * @param customFetcher - A fetch-compatible function
5
+ */
6
+ export declare const setFetchStrategy: (customFetcher: Fetcher) => void;
7
+ export declare const resetFetchStrategy: () => void;
8
+ /**
9
+ * Get the current fetch strategy
10
+ * @returns The current fetcher function
11
+ */
12
+ export declare const getFetcher: () => Fetcher;
13
+ export {};
@@ -0,0 +1,25 @@
1
+ export declare const CHECK_HEALTHY = "CHECK_HEALTHY";
2
+ export declare class MetricsLatencyApi {
3
+ private readonly maxAllowedFailures;
4
+ private readonly minAllowedFastRate;
5
+ private readonly maxAllowedLatencyMs;
6
+ private readonly metricsWindowMs;
7
+ private readonly minRequests;
8
+ private windowStartTime;
9
+ private totalRequests;
10
+ private failed;
11
+ private slowCount;
12
+ private readonly requests;
13
+ start(requestId: number): void;
14
+ end(requestId: number, isError?: boolean): void;
15
+ get shouldSwitch(): boolean;
16
+ get stats(): {
17
+ totalRequests: number;
18
+ failedCount: number;
19
+ slowCount: number;
20
+ slowRate: number;
21
+ fastRate: number;
22
+ isUnhealthy: boolean;
23
+ };
24
+ reset(): void;
25
+ }