@@ -22,7 +22,7 @@ export interface ILog {
22
22
}
23
23
export interface IEventQueue {
24
24
enqueue ( event : IEvent ) : void ;
25
- process ( ) : void ;
25
+ process ( isAppExiting ?: boolean ) : void ;
26
26
suspendProcessing ( durationInMinutes ?: number , discardFutureQueuedItems ?: boolean , clearQueue ?: boolean ) : void ;
27
27
}
28
28
export interface IEnvironmentInfoCollector {
@@ -43,8 +43,11 @@ export interface IStorage<T> {
43
43
getList ( searchPattern ?: string , limit ?: number ) : IStorageItem < T > [ ] ;
44
44
remove ( path : string ) : void ;
45
45
}
46
+ export interface ISubmissionAdapter {
47
+ sendRequest ( request : SubmissionRequest , callback : SubmissionCallback , isAppExiting ?: boolean ) : void ;
48
+ }
46
49
export interface ISubmissionClient {
47
- postEvents ( events : IEvent [ ] , config : Configuration , callback : ( response : SubmissionResponse ) => void ) : void ;
50
+ postEvents ( events : IEvent [ ] , config : Configuration , callback : ( response : SubmissionResponse ) => void , isAppExiting ?: boolean ) : void ;
48
51
postUserDescription ( referenceId : string , description : IUserDescription , config : Configuration , callback : ( response : SubmissionResponse ) => void ) : void ;
49
52
getSettings ( config : Configuration , callback : ( response : SettingsResponse ) => void ) : void ;
50
53
}
@@ -59,6 +62,7 @@ export interface IConfigurationSettings {
59
62
requestInfoCollector ?: IRequestInfoCollector ;
60
63
submissionBatchSize ?: number ;
61
64
submissionClient ?: ISubmissionClient ;
65
+ submissionAdapter ?: ISubmissionAdapter ;
62
66
storage ?: IStorage < any > ;
63
67
queue ?: IEventQueue ;
64
68
}
@@ -124,7 +128,7 @@ export declare class DefaultEventQueue implements IEventQueue {
124
128
private _queueTimer ;
125
129
constructor ( config : Configuration ) ;
126
130
enqueue ( event : IEvent ) : void ;
127
- process ( ) : void ;
131
+ process ( isAppExiting ?: boolean ) : void ;
128
132
private processSubmissionResponse ( response , events ) ;
129
133
private ensureQueueTimer ( ) ;
130
134
private onProcessQueue ( ) ;
@@ -142,6 +146,14 @@ export declare class InMemoryStorage<T> implements IStorage<T> {
142
146
getList ( searchPattern ?: string , limit ?: number ) : IStorageItem < T > [ ] ;
143
147
remove ( path : string ) : void ;
144
148
}
149
+ export declare class DefaultSubmissionClient implements ISubmissionClient {
150
+ configurationVersionHeader : string ;
151
+ postEvents ( events : IEvent [ ] , config : Configuration , callback : ( response : SubmissionResponse ) => void , isAppExiting ?: boolean ) : void ;
152
+ postUserDescription ( referenceId : string , description : IUserDescription , config : Configuration , callback : ( response : SubmissionResponse ) => void ) : void ;
153
+ getSettings ( config : Configuration , callback : ( response : SettingsResponse ) => void ) : void ;
154
+ private createRequest ( config , method , path , data ?) ;
155
+ private createSubmissionCallback ( config , callback ) ;
156
+ }
145
157
export declare class Utils {
146
158
static addRange < T > ( target : T [ ] , ...values : T [ ] ) : T [ ] ;
147
159
static getHashCode ( source : string ) : string ;
@@ -164,6 +176,7 @@ export declare class Configuration implements IConfigurationSettings {
164
176
moduleCollector : IModuleCollector ;
165
177
requestInfoCollector : IRequestInfoCollector ;
166
178
submissionBatchSize : number ;
179
+ submissionAdapter : ISubmissionAdapter ;
167
180
submissionClient : ISubmissionClient ;
168
181
settings : Object ;
169
182
storage : IStorage < Object > ;
@@ -382,6 +395,17 @@ export interface IStorageItem<T> {
382
395
path : string ;
383
396
value : T ;
384
397
}
398
+ export interface SubmissionCallback {
399
+ ( status : number , message : string , data ?: string , headers ?: Object ) : void ;
400
+ }
401
+ export interface SubmissionRequest {
402
+ serverUrl : string ;
403
+ apiKey : string ;
404
+ userAgent : string ;
405
+ method : string ;
406
+ path : string ;
407
+ data : string ;
408
+ }
385
409
export declare class SettingsResponse {
386
410
success : boolean ;
387
411
settings : any ;
@@ -403,10 +427,6 @@ export declare class DefaultModuleCollector implements IModuleCollector {
403
427
export declare class DefaultRequestInfoCollector implements IRequestInfoCollector {
404
428
getRequestInfo ( context : EventPluginContext ) : IRequestInfo ;
405
429
}
406
- export declare class DefaultSubmissionClient implements ISubmissionClient {
407
- configurationVersionHeader : string ;
408
- postEvents ( events : IEvent [ ] , config : Configuration , callback : ( response : SubmissionResponse ) => void ) : void ;
409
- postUserDescription ( referenceId : string , description : IUserDescription , config : Configuration , callback : ( response : SubmissionResponse ) => void ) : void ;
410
- getSettings ( config : Configuration , callback : ( response : SettingsResponse ) => void ) : void ;
411
- sendRequest ( config : Configuration , method : string , path : string , data : string , callback : ( status : number , message : string , data ?: string , headers ?: Object ) => void ) : void ;
430
+ export declare class DefaultSubmissionAdapter implements ISubmissionAdapter {
431
+ sendRequest ( request : SubmissionRequest , callback : SubmissionCallback , isAppExiting ?: boolean ) : void ;
412
432
}
0 commit comments