@@ -15,6 +15,8 @@ import {
15
15
import { useQuery } from "react-query" ;
16
16
import { type ProxyLatencyReport , useProxyLatency } from "./useProxyLatency" ;
17
17
18
+ export type Proxies = readonly Region [ ] | readonly WorkspaceProxy [ ] ;
19
+ export type ProxyLatencies = Record < string , ProxyLatencyReport > ;
18
20
export interface ProxyContextValue {
19
21
// proxy is **always** the workspace proxy that should be used.
20
22
// The 'proxy.selectedProxy' field is the proxy being used and comes from either:
@@ -43,15 +45,15 @@ export interface ProxyContextValue {
43
45
// WorkspaceProxy[] is returned if the user is an admin. WorkspaceProxy extends Region with
44
46
// more information about the proxy and the status. More information includes the error message if
45
47
// the proxy is unhealthy.
46
- proxies ?: readonly Region [ ] | readonly WorkspaceProxy [ ] ;
48
+ proxies ?: Proxies ;
47
49
// isFetched is true when the 'proxies' api call is complete.
48
50
isFetched : boolean ;
49
51
isLoading : boolean ;
50
52
error ?: unknown ;
51
53
// proxyLatencies is a map of proxy id to latency report. If the proxyLatencies[proxy.id] is undefined
52
54
// then the latency has not been fetched yet. Calculations happen async for each proxy in the list.
53
55
// Refer to the returned report for a given proxy for more information.
54
- proxyLatencies : Record < string , ProxyLatencyReport > ;
56
+ proxyLatencies : ProxyLatencies ;
55
57
// refetchProxyLatencies will trigger refreshing of the proxy latencies. By default the latencies
56
58
// are loaded once.
57
59
refetchProxyLatencies : ( ) => Date ;
0 commit comments