File tree 3 files changed +23
-9
lines changed
3 files changed +23
-9
lines changed Original file line number Diff line number Diff line change
1
+ import { BacktraceCoreApi , BacktraceCoreApiOptions } from '@backtrace/sdk-core' ;
2
+ import {
3
+ BacktraceBrowserRequestHandler ,
4
+ BacktraceBrowserRequestHandlerOptions ,
5
+ } from './BacktraceBrowserRequestHandler.js' ;
6
+
7
+ export interface BacktraceApiOptions extends BacktraceCoreApiOptions {
8
+ readonly requestHandlerOptions ?: BacktraceBrowserRequestHandlerOptions ;
9
+ }
10
+
11
+ export class BacktraceApi extends BacktraceCoreApi {
12
+ constructor ( options : BacktraceApiOptions ) {
13
+ super ( options , options . requestHandler ?? new BacktraceBrowserRequestHandler ( options . requestHandlerOptions ) ) ;
14
+ }
15
+ }
Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ import {
7
7
DEFAULT_TIMEOUT ,
8
8
} from '@backtrace/sdk-core' ;
9
9
10
+ export interface BacktraceBrowserRequestHandlerOptions {
11
+ readonly timeout ?: number ;
12
+ }
13
+
10
14
export class BacktraceBrowserRequestHandler implements BacktraceRequestHandler {
11
15
private readonly UPLOAD_FILE_NAME = 'upload_file' ;
12
16
private readonly _timeout : number ;
@@ -18,14 +22,8 @@ export class BacktraceBrowserRequestHandler implements BacktraceRequestHandler {
18
22
private readonly MULTIPART_HEADERS = {
19
23
'Transfer-Encoding' : 'chunked' ,
20
24
} ;
21
- constructor (
22
- private readonly _options : {
23
- url : string ;
24
- token ?: string ;
25
- timeout ?: number ;
26
- } ,
27
- ) {
28
- this . _timeout = this . _options . timeout ?? DEFAULT_TIMEOUT ;
25
+ constructor ( private readonly _options ?: BacktraceBrowserRequestHandlerOptions ) {
26
+ this . _timeout = this . _options ?. timeout ?? DEFAULT_TIMEOUT ;
29
27
}
30
28
public async postError < T > (
31
29
submissionUrl : string ,
Original file line number Diff line number Diff line change @@ -10,15 +10,16 @@ export {
10
10
BacktraceStringAttachment ,
11
11
BacktraceUint8ArrayAttachment ,
12
12
BreadcrumbLogLevel ,
13
- BreadcrumbType ,
14
13
BreadcrumbsEventSubscriber ,
15
14
BreadcrumbsManager ,
15
+ BreadcrumbType ,
16
16
JavaScriptEngine ,
17
17
RawBreadcrumb ,
18
18
SingleSessionProvider ,
19
19
V8StackTraceConverter ,
20
20
} from '@backtrace/sdk-core' ;
21
21
export * from './agentDefinition.js' ;
22
+ export * from './BacktraceApi.js' ;
22
23
export * from './BacktraceBrowserRequestHandler.js' ;
23
24
export * from './BacktraceClient.js' ;
24
25
export * from './BacktraceConfiguration.js' ;
You can’t perform that action at this time.
0 commit comments