Skip to content

Commit 0b6a029

Browse files
committed
Refactoring: DefaultSubmissionClient / ISubmissionAdapter
1 parent e4f4a94 commit 0b6a029

25 files changed

+516
-651
lines changed

dist/exceptionless.d.ts

+26-16
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ export interface IEnvironmentInfoCollector {
3131
export interface IErrorParser {
3232
parse(context: EventPluginContext, exception: Error): IError;
3333
}
34-
export interface IExitController {
35-
isApplicationExiting: boolean;
36-
processExit(config: Configuration): void;
37-
}
3834
export interface IModuleCollector {
3935
getModules(context: EventPluginContext): IModule[];
4036
}
@@ -47,6 +43,9 @@ export interface IStorage<T> {
4743
getList(searchPattern?: string, limit?: number): IStorageItem<T>[];
4844
remove(path: string): void;
4945
}
46+
export interface ISubmissionAdapter {
47+
sendRequest(request: SubmissionRequest, callback: SubmissionCallback): void;
48+
}
5049
export interface ISubmissionClient {
5150
postEvents(events: IEvent[], config: Configuration, callback: (response: SubmissionResponse) => void): void;
5251
postUserDescription(referenceId: string, description: IUserDescription, config: Configuration, callback: (response: SubmissionResponse) => void): void;
@@ -63,9 +62,9 @@ export interface IConfigurationSettings {
6362
requestInfoCollector?: IRequestInfoCollector;
6463
submissionBatchSize?: number;
6564
submissionClient?: ISubmissionClient;
65+
submissionAdapter?: ISubmissionAdapter;
6666
storage?: IStorage<any>;
6767
queue?: IEventQueue;
68-
exitController?: IExitController;
6968
}
7069
export declare class SettingsManager {
7170
private static _configPath;
@@ -138,10 +137,6 @@ export declare class DefaultEventQueue implements IEventQueue {
138137
private isQueueProcessingSuspended();
139138
private areQueuedItemsDiscarded();
140139
}
141-
export declare class DefaultExitController implements IExitController {
142-
isApplicationExiting: boolean;
143-
processExit(config: Configuration): void;
144-
}
145140
export declare class InMemoryStorage<T> implements IStorage<T> {
146141
private _items;
147142
private _maxItems;
@@ -151,6 +146,14 @@ export declare class InMemoryStorage<T> implements IStorage<T> {
151146
getList(searchPattern?: string, limit?: number): IStorageItem<T>[];
152147
remove(path: string): void;
153148
}
149+
export declare class DefaultSubmissionClient implements ISubmissionClient {
150+
configurationVersionHeader: string;
151+
postEvents(events: IEvent[], config: Configuration, callback: (response: SubmissionResponse) => void): 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+
}
154157
export declare class Utils {
155158
static addRange<T>(target: T[], ...values: T[]): T[];
156159
static getHashCode(source: string): string;
@@ -173,11 +176,11 @@ export declare class Configuration implements IConfigurationSettings {
173176
moduleCollector: IModuleCollector;
174177
requestInfoCollector: IRequestInfoCollector;
175178
submissionBatchSize: number;
179+
submissionAdapter: ISubmissionAdapter;
176180
submissionClient: ISubmissionClient;
177181
settings: Object;
178182
storage: IStorage<Object>;
179183
queue: IEventQueue;
180-
exitController: IExitController;
181184
constructor(configSettings?: IConfigurationSettings);
182185
private _apiKey;
183186
apiKey: string;
@@ -392,6 +395,17 @@ export interface IStorageItem<T> {
392395
path: string;
393396
value: T;
394397
}
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+
}
395409
export declare class SettingsResponse {
396410
success: boolean;
397411
settings: any;
@@ -413,10 +427,6 @@ export declare class DefaultModuleCollector implements IModuleCollector {
413427
export declare class DefaultRequestInfoCollector implements IRequestInfoCollector {
414428
getRequestInfo(context: EventPluginContext): IRequestInfo;
415429
}
416-
export declare class DefaultSubmissionClient implements ISubmissionClient {
417-
configurationVersionHeader: string;
418-
postEvents(events: IEvent[], config: Configuration, callback: (response: SubmissionResponse) => void): void;
419-
postUserDescription(referenceId: string, description: IUserDescription, config: Configuration, callback: (response: SubmissionResponse) => void): void;
420-
getSettings(config: Configuration, callback: (response: SettingsResponse) => void): void;
421-
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): void;
422432
}

dist/exceptionless.js

+77-69
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)