-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathexceptionless.d.ts
452 lines (452 loc) · 16.3 KB
/
exceptionless.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
export interface IEvent {
type?: string;
source?: string;
date?: Date;
tags?: string[];
message?: string;
geo?: string;
value?: number;
data?: any;
reference_id?: string;
}
export interface ILastReferenceIdManager {
getLast(): string;
clearLast(): void;
setLast(eventId: string): void;
}
export interface ILog {
info(message: string): void;
warn(message: string): void;
error(message: string): void;
}
export interface IEventQueue {
enqueue(event: IEvent): void;
process(isAppExiting?: boolean): void;
suspendProcessing(durationInMinutes?: number, discardFutureQueuedItems?: boolean, clearQueue?: boolean): void;
}
export interface IEnvironmentInfoCollector {
getEnvironmentInfo(context: EventPluginContext): IEnvironmentInfo;
}
export interface IErrorParser {
parse(context: EventPluginContext, exception: Error): IError;
}
export interface IModuleCollector {
getModules(context: EventPluginContext): IModule[];
}
export interface IRequestInfoCollector {
getRequestInfo(context: EventPluginContext): IRequestInfo;
}
export interface IStorage<T> {
save(path: string, value: T): boolean;
get(path: string): T;
getList(searchPattern?: string, limit?: number): IStorageItem<T>[];
remove(path: string): void;
}
export interface ISubmissionAdapter {
sendRequest(request: SubmissionRequest, callback: SubmissionCallback, isAppExiting?: boolean): void;
}
export interface ISubmissionClient {
postEvents(events: IEvent[], config: Configuration, callback: (response: SubmissionResponse) => void, isAppExiting?: boolean): void;
postUserDescription(referenceId: string, description: IUserDescription, config: Configuration, callback: (response: SubmissionResponse) => void): void;
getSettings(config: Configuration, callback: (response: SettingsResponse) => void): void;
}
export interface IConfigurationSettings {
apiKey?: string;
serverUrl?: string;
enableSessions?: boolean;
environmentInfoCollector?: IEnvironmentInfoCollector;
errorParser?: IErrorParser;
lastReferenceIdManager?: ILastReferenceIdManager;
log?: ILog;
moduleCollector?: IModuleCollector;
requestInfoCollector?: IRequestInfoCollector;
submissionBatchSize?: number;
submissionClient?: ISubmissionClient;
submissionAdapter?: ISubmissionAdapter;
storage?: IStorage<any>;
queue?: IEventQueue;
}
export declare class SettingsManager {
private static _configPath;
private static _handlers;
static onChanged(handler: (config: Configuration) => void): void;
static applySavedServerSettings(config: Configuration): void;
static checkVersion(version: number, config: Configuration): void;
static updateSettings(config: Configuration): void;
private static changed(config);
private static getSavedServerSettings(config);
}
export declare class DefaultLastReferenceIdManager implements ILastReferenceIdManager {
private _lastReferenceId;
getLast(): string;
clearLast(): void;
setLast(eventId: string): void;
}
export declare class ConsoleLog implements ILog {
info(message: string): void;
warn(message: string): void;
error(message: string): void;
private log(level, message);
}
export declare class NullLog implements ILog {
info(message: string): void;
warn(message: string): void;
error(message: string): void;
}
export interface IUserInfo {
identity?: string;
name?: string;
data?: any;
}
export interface IEventPlugin {
priority?: number;
name?: string;
run(context: EventPluginContext, next?: () => void): void;
}
export declare class EventPluginContext {
cancelled: boolean;
client: ExceptionlessClient;
event: IEvent;
contextData: ContextData;
constructor(client: ExceptionlessClient, event: IEvent, contextData?: ContextData);
log: ILog;
}
export declare class EventPluginManager {
static run(context: EventPluginContext, callback: (context?: EventPluginContext) => void): void;
static addDefaultPlugins(config: Configuration): void;
}
export declare class HeartbeatPlugin implements IEventPlugin {
priority: number;
name: string;
private _heartbeatIntervalId;
private _lastUser;
run(context: EventPluginContext, next?: () => void): void;
}
export declare class ReferenceIdPlugin implements IEventPlugin {
priority: number;
name: string;
run(context: EventPluginContext, next?: () => void): void;
}
export declare class DefaultEventQueue implements IEventQueue {
private _config;
private _suspendProcessingUntil;
private _discardQueuedItemsUntil;
private _processingQueue;
private _queueTimer;
constructor(config: Configuration);
enqueue(event: IEvent): void;
process(isAppExiting?: boolean): void;
suspendProcessing(durationInMinutes?: number, discardFutureQueuedItems?: boolean, clearQueue?: boolean): void;
private areQueuedItemsDiscarded();
private ensureQueueTimer();
private isQueueProcessingSuspended();
private onProcessQueue();
private processSubmissionResponse(response, events);
private removeEvents(events);
}
export declare class InMemoryStorage<T> implements IStorage<T> {
private _items;
private _maxItems;
constructor(maxItems?: number);
save(path: string, value: T): boolean;
get(path: string): T;
getList(searchPattern?: string, limit?: number): IStorageItem<T>[];
remove(path: string): void;
}
export declare class DefaultSubmissionClient implements ISubmissionClient {
configurationVersionHeader: string;
postEvents(events: IEvent[], config: Configuration, callback: (response: SubmissionResponse) => void, isAppExiting?: boolean): void;
postUserDescription(referenceId: string, description: IUserDescription, config: Configuration, callback: (response: SubmissionResponse) => void): void;
getSettings(config: Configuration, callback: (response: SettingsResponse) => void): void;
private createRequest(config, method, path, data?);
private createSubmissionCallback(config, callback);
}
export declare class Utils {
static addRange<T>(target: T[], ...values: T[]): T[];
static getHashCode(source: string): number;
static getCookies(cookies: string, exclusions?: string[]): Object;
static guid(): string;
static merge(defaultValues: Object, values: Object): Object;
static parseVersion(source: string): string;
static parseQueryString(query: string, exclusions?: string[]): Object;
static randomNumber(): number;
static isMatch(input: string, patterns: string[]): boolean;
static isEmpty(input: Object): boolean;
static stringify(data: any, exclusions?: string[], maxDepth?: number): string;
}
export declare class Configuration implements IConfigurationSettings {
private static _defaultSettings;
defaultTags: string[];
defaultData: Object;
enabled: boolean;
environmentInfoCollector: IEnvironmentInfoCollector;
errorParser: IErrorParser;
lastReferenceIdManager: ILastReferenceIdManager;
log: ILog;
moduleCollector: IModuleCollector;
requestInfoCollector: IRequestInfoCollector;
submissionBatchSize: number;
submissionAdapter: ISubmissionAdapter;
submissionClient: ISubmissionClient;
settings: Object;
storage: IStorage<Object>;
queue: IEventQueue;
private _plugins;
constructor(configSettings?: IConfigurationSettings);
private _apiKey;
apiKey: string;
isValid: boolean;
private _serverUrl;
serverUrl: string;
private _dataExclusions;
dataExclusions: string[];
addDataExclusions(...exclusions: string[]): void;
plugins: IEventPlugin[];
addPlugin(plugin: IEventPlugin): void;
addPlugin(name: string, priority: number, pluginAction: (context: EventPluginContext, next?: () => void) => void): void;
removePlugin(plugin: IEventPlugin): void;
removePlugin(name: string): void;
setVersion(version: string): void;
setUserIdentity(userInfo: IUserInfo): void;
setUserIdentity(identity: string): void;
setUserIdentity(identity: string, name: string): void;
userAgent: string;
useSessions(sendHeartbeats?: boolean): void;
useReferenceIds(): void;
useDebugLogger(): void;
static defaults: IConfigurationSettings;
}
export declare class EventBuilder {
target: IEvent;
client: ExceptionlessClient;
pluginContextData: ContextData;
private _validIdentifierErrorMessage;
constructor(event: IEvent, client: ExceptionlessClient, pluginContextData?: ContextData);
setType(type: string): EventBuilder;
setSource(source: string): EventBuilder;
setReferenceId(referenceId: string): EventBuilder;
setEventReference(name: string, id: string): EventBuilder;
setMessage(message: string): EventBuilder;
setGeo(latitude: number, longitude: number): EventBuilder;
setUserIdentity(userInfo: IUserInfo): EventBuilder;
setUserIdentity(identity: string): EventBuilder;
setUserIdentity(identity: string, name: string): EventBuilder;
setValue(value: number): EventBuilder;
addTags(...tags: string[]): EventBuilder;
setProperty(name: string, value: any, maxDepth?: number, excludedPropertyNames?: string[]): EventBuilder;
markAsCritical(critical: boolean): EventBuilder;
addRequestInfo(request: Object): EventBuilder;
submit(callback?: (context: EventPluginContext) => void): void;
private isValidIdentifier(value);
}
export interface IUserDescription {
email_address?: string;
description?: string;
data?: any;
}
export declare class ContextData {
setException(exception: Error): void;
hasException: boolean;
getException(): Error;
markAsUnhandledError(): void;
isUnhandledError: boolean;
setSubmissionMethod(method: string): void;
getSubmissionMethod(): string;
}
export declare class SubmissionResponse {
success: boolean;
badRequest: boolean;
serviceUnavailable: boolean;
paymentRequired: boolean;
unableToAuthenticate: boolean;
notFound: boolean;
requestEntityTooLarge: boolean;
statusCode: number;
message: string;
constructor(statusCode: number, message?: string);
}
export declare class ExceptionlessClient {
private static _instance;
config: Configuration;
constructor();
constructor(settings: IConfigurationSettings);
constructor(apiKey: string, serverUrl?: string);
createException(exception: Error): EventBuilder;
submitException(exception: Error, callback?: (context: EventPluginContext) => void): void;
createUnhandledException(exception: Error, submissionMethod?: string): EventBuilder;
submitUnhandledException(exception: Error, submissionMethod?: string, callback?: (context: EventPluginContext) => void): void;
createFeatureUsage(feature: string): EventBuilder;
submitFeatureUsage(feature: string, callback?: (context: EventPluginContext) => void): void;
createLog(message: string): EventBuilder;
createLog(source: string, message: string): EventBuilder;
createLog(source: string, message: string, level: string): EventBuilder;
submitLog(message: string): void;
submitLog(source: string, message: string): void;
submitLog(source: string, message: string, level: string, callback?: (context: EventPluginContext) => void): void;
createNotFound(resource: string): EventBuilder;
submitNotFound(resource: string, callback?: (context: EventPluginContext) => void): void;
createSessionStart(): EventBuilder;
submitSessionStart(callback?: (context: EventPluginContext) => void): void;
createSessionEnd(): EventBuilder;
submitSessionEnd(callback?: (context: EventPluginContext) => void): void;
createSessionHeartbeat(): EventBuilder;
submitSessionHeartbeat(callback?: (context: EventPluginContext) => void): void;
createEvent(pluginContextData?: ContextData): EventBuilder;
submitEvent(event: IEvent, pluginContextData?: ContextData, callback?: (context: EventPluginContext) => void): void;
updateUserEmailAndDescription(referenceId: string, email: string, description: string, callback?: (response: SubmissionResponse) => void): void;
getLastReferenceId(): string;
static default: ExceptionlessClient;
}
export interface IModule {
data?: any;
module_id?: number;
name?: string;
version?: string;
is_entry?: boolean;
created_date?: Date;
modified_date?: Date;
}
export interface IRequestInfo {
user_agent?: string;
http_method?: string;
is_secure?: boolean;
host?: string;
port?: number;
path?: string;
referrer?: string;
client_ip_address?: string;
cookies?: any;
post_data?: any;
query_string?: any;
data?: any;
}
export interface IEnvironmentInfo {
processor_count?: number;
total_physical_memory?: number;
available_physical_memory?: number;
command_line?: string;
process_name?: string;
process_id?: string;
process_memory_size?: number;
thread_id?: string;
architecture?: string;
o_s_name?: string;
o_s_version?: string;
ip_address?: string;
machine_name?: string;
install_id?: string;
runtime_version?: string;
data?: any;
}
export interface IParameter {
data?: any;
generic_arguments?: string[];
name?: string;
type?: string;
type_namespace?: string;
}
export interface IMethod {
data?: any;
generic_arguments?: string[];
parameters?: IParameter[];
is_signature_target?: boolean;
declaring_namespace?: string;
declaring_type?: string;
name?: string;
module_id?: number;
}
export interface IStackFrame extends IMethod {
file_name?: string;
line_number?: number;
column?: number;
}
export interface IInnerError {
message?: string;
type?: string;
code?: string;
data?: any;
inner?: IInnerError;
stack_trace?: IStackFrame[];
target_method?: IMethod;
}
export declare class ConfigurationDefaultsPlugin implements IEventPlugin {
priority: number;
name: string;
run(context: EventPluginContext, next?: () => void): void;
}
export declare class ErrorPlugin implements IEventPlugin {
priority: number;
name: string;
run(context: EventPluginContext, next?: () => void): void;
}
export declare class ModuleInfoPlugin implements IEventPlugin {
priority: number;
name: string;
run(context: EventPluginContext, next?: () => void): void;
}
export declare class RequestInfoPlugin implements IEventPlugin {
priority: number;
name: string;
run(context: EventPluginContext, next?: () => void): void;
}
export declare class EnvironmentInfoPlugin implements IEventPlugin {
priority: number;
name: string;
run(context: EventPluginContext, next?: () => void): void;
}
export declare class SubmissionMethodPlugin implements IEventPlugin {
priority: number;
name: string;
run(context: EventPluginContext, next?: () => void): void;
}
export declare class DuplicateCheckerPlugin implements IEventPlugin {
priority: number;
name: string;
private recentlyProcessedErrors;
run(context: EventPluginContext, next?: () => void): void;
private getNow();
private checkDuplicate(error, log);
}
export interface IError extends IInnerError {
modules?: IModule[];
}
export interface IStorageItem<T> {
created: number;
path: string;
value: T;
}
export interface SubmissionCallback {
(status: number, message: string, data?: string, headers?: Object): void;
}
export interface SubmissionRequest {
serverUrl: string;
apiKey: string;
userAgent: string;
method: string;
path: string;
data: string;
}
export declare class SettingsResponse {
success: boolean;
settings: any;
settingsVersion: number;
message: string;
exception: any;
constructor(success: boolean, settings: any, settingsVersion?: number, exception?: any, message?: string);
}
export interface IClientConfiguration {
settings: Object;
version: number;
}
export declare class DefaultErrorParser implements IErrorParser {
parse(context: EventPluginContext, exception: Error): IError;
}
export declare class DefaultModuleCollector implements IModuleCollector {
getModules(context: EventPluginContext): IModule[];
}
export declare class DefaultRequestInfoCollector implements IRequestInfoCollector {
getRequestInfo(context: EventPluginContext): IRequestInfo;
}
export declare class DefaultSubmissionAdapter implements ISubmissionAdapter {
sendRequest(request: SubmissionRequest, callback: SubmissionCallback, isAppExiting?: boolean): void;
}