Skip to content

Commit fc91169

Browse files
committed
Fixed a bug where settings were not being loaded from local storage.
1 parent e5a48c1 commit fc91169

12 files changed

+436
-18
lines changed

dist/exceptionless.d.ts

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ export interface IModuleCollector {
3636
export interface IRequestInfoCollector {
3737
getRequestInfo(context: EventPluginContext): IRequestInfo;
3838
}
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[];
4343
remove(path: string): void;
4444
}
4545
export interface ISubmissionAdapter {
@@ -62,7 +62,7 @@ export interface IConfigurationSettings {
6262
submissionBatchSize?: number;
6363
submissionClient?: ISubmissionClient;
6464
submissionAdapter?: ISubmissionAdapter;
65-
storage?: IStorage<any>;
65+
storage?: IStorage;
6666
queue?: IEventQueue;
6767
}
6868
export declare class SettingsManager {
@@ -143,13 +143,13 @@ export declare class DefaultEventQueue implements IEventQueue {
143143
private processSubmissionResponse(response, events);
144144
private removeEvents(events);
145145
}
146-
export declare class InMemoryStorage<T> implements IStorage<T> {
146+
export declare class InMemoryStorage implements IStorage {
147147
private _items;
148148
private _maxItems;
149149
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[];
153153
remove(path: string): void;
154154
}
155155
export declare class DefaultSubmissionClient implements ISubmissionClient {
@@ -188,7 +188,7 @@ export declare class Configuration implements IConfigurationSettings {
188188
submissionAdapter: ISubmissionAdapter;
189189
submissionClient: ISubmissionClient;
190190
settings: Object;
191-
storage: IStorage<Object>;
191+
storage: IStorage;
192192
queue: IEventQueue;
193193
private _plugins;
194194
constructor(configSettings?: IConfigurationSettings);
@@ -215,6 +215,7 @@ export declare class Configuration implements IConfigurationSettings {
215215
userAgent: string;
216216
useSessions(sendHeartbeats?: boolean): void;
217217
useReferenceIds(): void;
218+
useLocalStorage(): void;
218219
useDebugLogger(): void;
219220
static defaults: IConfigurationSettings;
220221
}
@@ -414,10 +415,10 @@ export declare class DuplicateCheckerPlugin implements IEventPlugin {
414415
export interface IError extends IInnerError {
415416
modules?: IModule[];
416417
}
417-
export interface IStorageItem<T> {
418+
export interface IStorageItem {
418419
created: number;
419420
path: string;
420-
value: T;
421+
value: any;
421422
}
422423
export interface SubmissionCallback {
423424
(status: number, message: string, data?: string, headers?: Object): void;
@@ -442,6 +443,34 @@ export interface IClientConfiguration {
442443
settings: Object;
443444
version: number;
444445
}
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+
}
445474
export declare class DefaultErrorParser implements IErrorParser {
446475
parse(context: EventPluginContext, exception: Error): IError;
447476
}
@@ -454,3 +483,14 @@ export declare class DefaultRequestInfoCollector implements IRequestInfoCollecto
454483
export declare class DefaultSubmissionAdapter implements ISubmissionAdapter {
455484
sendRequest(request: SubmissionRequest, callback: SubmissionCallback, isAppExiting?: boolean): void;
456485
}
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+
}

dist/exceptionless.js

Lines changed: 187 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)