@@ -45,6 +45,7 @@ interface DefaultOptions<TLogOptions = LoggingOptions> {
4545 contextPath : string ;
4646 contextUrl : string ;
4747 docsPath : string ;
48+ xhrFetch : XhrFetchOptions ;
4849 http : HttpOptions ;
4950 isHttp : boolean ;
5051 logging : TLogOptions ;
@@ -153,13 +154,19 @@ interface LoggingSession extends LoggingOptions {
153154 readonly channelName : string ;
154155}
155156
157+ /**
158+ * Base stats options.
159+ */
156160type StatsOptions = {
157161 reportIntervalMs : {
158162 health : number ;
159163 transport : number ;
160164 }
161165} ;
162166
167+ /**
168+ * Stats channel names.
169+ */
163170type StatsChannels = {
164171 readonly health : string ;
165172 readonly session : string ;
@@ -179,6 +186,17 @@ interface StatsSession extends StatsOptions {
179186 channels : StatsChannels
180187}
181188
189+ /**
190+ * XHR and Fetch options.
191+ *
192+ * @interface XhrFetchOptions
193+ *
194+ * @property timeoutMs Timeout for XHR and Fetch requests (ms).
195+ */
196+ interface XhrFetchOptions {
197+ timeoutMs : number ;
198+ }
199+
182200/**
183201 * Base logging options.
184202 */
@@ -205,7 +223,7 @@ const HTTP_OPTIONS: HttpOptions = {
205223 */
206224const PLUGIN_HOST_OPTIONS : PluginHostOptions = {
207225 loadTimeoutMs : 5000 ,
208- invokeTimeoutMs : 10000 ,
226+ invokeTimeoutMs : 10_000 ,
209227 gracePeriodMs : 2000
210228} ;
211229
@@ -250,7 +268,7 @@ const TOOL_MEMO_OPTIONS = {
250268} ;
251269
252270/**
253- * Stats options.
271+ * Default stats options.
254272 */
255273const STATS_OPTIONS : StatsOptions = {
256274 reportIntervalMs : {
@@ -259,6 +277,13 @@ const STATS_OPTIONS: StatsOptions = {
259277 }
260278} ;
261279
280+ /**
281+ * Default XHR and Fetch options.
282+ */
283+ const XHR_FETCH_OPTIONS : XhrFetchOptions = {
284+ timeoutMs : 15_000
285+ } ;
286+
262287/**
263288 * Base logging channel name. Fixed to avoid user override.
264289 */
@@ -387,7 +412,8 @@ const DEFAULT_OPTIONS: DefaultOptions = {
387412 toolModules : [ ] ,
388413 separator : DEFAULT_SEPARATOR ,
389414 urlRegex : URL_REGEX ,
390- version : ( process . env . NODE_ENV === 'local' && '0.0.0' ) || packageJson . version
415+ version : ( process . env . NODE_ENV === 'local' && '0.0.0' ) || packageJson . version ,
416+ xhrFetch : XHR_FETCH_OPTIONS
391417} ;
392418
393419export {
0 commit comments