@@ -36,10 +36,10 @@ export interface IModuleCollector {
36
36
export interface IRequestInfoCollector {
37
37
getRequestInfo ( context : EventPluginContext ) : IRequestInfo ;
38
38
}
39
- export interface IStorage < T > {
40
- save ( path : string , value : T ) : boolean ;
41
- get ( path : string ) : T ;
42
- getList ( searchPattern ?: string , limit ?: number ) : IStorageItem < T > [ ] ;
39
+ export interface IStorage {
40
+ save ( path : string , value : any ) : boolean ;
41
+ get ( path : string ) : any ;
42
+ getList ( searchPattern ?: string , limit ?: number ) : IStorageItem [ ] ;
43
43
remove ( path : string ) : void ;
44
44
}
45
45
export interface ISubmissionAdapter {
@@ -62,7 +62,7 @@ export interface IConfigurationSettings {
62
62
submissionBatchSize ?: number ;
63
63
submissionClient ?: ISubmissionClient ;
64
64
submissionAdapter ?: ISubmissionAdapter ;
65
- storage ?: IStorage < any > ;
65
+ storage ?: IStorage ;
66
66
queue ?: IEventQueue ;
67
67
}
68
68
export declare class SettingsManager {
@@ -143,13 +143,13 @@ export declare class DefaultEventQueue implements IEventQueue {
143
143
private processSubmissionResponse ( response , events ) ;
144
144
private removeEvents ( events ) ;
145
145
}
146
- export declare class InMemoryStorage < T > implements IStorage < T > {
146
+ export declare class InMemoryStorage implements IStorage {
147
147
private _items ;
148
148
private _maxItems ;
149
149
constructor ( maxItems ?: number ) ;
150
- save ( path : string , value : T ) : boolean ;
151
- get ( path : string ) : T ;
152
- getList ( searchPattern ?: string , limit ?: number ) : IStorageItem < T > [ ] ;
150
+ save ( path : string , value : any ) : boolean ;
151
+ get ( path : string ) : any ;
152
+ getList ( searchPattern ?: string , limit ?: number ) : IStorageItem [ ] ;
153
153
remove ( path : string ) : void ;
154
154
}
155
155
export declare class DefaultSubmissionClient implements ISubmissionClient {
@@ -188,7 +188,7 @@ export declare class Configuration implements IConfigurationSettings {
188
188
submissionAdapter : ISubmissionAdapter ;
189
189
submissionClient : ISubmissionClient ;
190
190
settings : Object ;
191
- storage : IStorage < Object > ;
191
+ storage : IStorage ;
192
192
queue : IEventQueue ;
193
193
private _plugins ;
194
194
constructor ( configSettings ?: IConfigurationSettings ) ;
@@ -215,6 +215,7 @@ export declare class Configuration implements IConfigurationSettings {
215
215
userAgent : string ;
216
216
useSessions ( sendHeartbeats ?: boolean ) : void ;
217
217
useReferenceIds ( ) : void ;
218
+ useLocalStorage ( ) : void ;
218
219
useDebugLogger ( ) : void ;
219
220
static defaults : IConfigurationSettings ;
220
221
}
@@ -414,10 +415,10 @@ export declare class DuplicateCheckerPlugin implements IEventPlugin {
414
415
export interface IError extends IInnerError {
415
416
modules ?: IModule [ ] ;
416
417
}
417
- export interface IStorageItem < T > {
418
+ export interface IStorageItem {
418
419
created : number ;
419
420
path : string ;
420
- value : T ;
421
+ value : any ;
421
422
}
422
423
export interface SubmissionCallback {
423
424
( status : number , message : string , data ?: string , headers ?: Object ) : void ;
@@ -442,6 +443,34 @@ export interface IClientConfiguration {
442
443
settings : Object ;
443
444
version : number ;
444
445
}
446
+ export declare abstract class KeyValueStorageBase implements IStorage {
447
+ private maxItems ;
448
+ private timestamp ;
449
+ private index ;
450
+ constructor ( maxItems : any ) ;
451
+ save ( path : string , value : any ) : boolean ;
452
+ get ( path : string ) : any ;
453
+ getList ( searchPattern ?: string , limit ?: number ) : IStorageItem [ ] ;
454
+ remove ( path : string ) : void ;
455
+ protected abstract write ( key : string , value : string ) : void ;
456
+ protected abstract read ( key : string ) : string ;
457
+ protected abstract readDate ( key : string ) : number ;
458
+ protected abstract delete ( key : string ) : any ;
459
+ protected abstract getEntries ( ) : string [ ] ;
460
+ protected getKey ( entry : {
461
+ name : string ;
462
+ timestamp : number ;
463
+ } ) : string ;
464
+ protected getEntry ( encodedEntry : string ) : {
465
+ name : string ;
466
+ timestamp : number ;
467
+ } ;
468
+ private ensureIndex ( ) ;
469
+ private loadEntry ( entry ) ;
470
+ private findEntry ( path ) ;
471
+ private removeEntry ( entry ) ;
472
+ private createIndex ( ) ;
473
+ }
445
474
export declare class DefaultErrorParser implements IErrorParser {
446
475
parse ( context : EventPluginContext , exception : Error ) : IError ;
447
476
}
@@ -454,3 +483,14 @@ export declare class DefaultRequestInfoCollector implements IRequestInfoCollecto
454
483
export declare class DefaultSubmissionAdapter implements ISubmissionAdapter {
455
484
sendRequest ( request : SubmissionRequest , callback : SubmissionCallback , isAppExiting ?: boolean ) : void ;
456
485
}
486
+ export declare class BrowserStorage extends KeyValueStorageBase {
487
+ private prefix ;
488
+ static isAvailable ( ) : boolean ;
489
+ constructor ( prefix ?: string , maxItems ?: number , fs ?: any ) ;
490
+ write ( key : string , value : string ) : void ;
491
+ read ( key : string ) : any ;
492
+ readDate ( key : string ) : number ;
493
+ delete ( key : string ) : void ;
494
+ getEntries ( ) : string [ ] ;
495
+ getKey ( entry : any ) : string ;
496
+ }
0 commit comments