|
| 1 | +// Type definitions for react-native-sentry |
| 2 | +// Project: https://sentry.io |
| 3 | +// Definitions by: Daniel Griesser <https://github.com/hazat> |
| 4 | +// Definitions: https://github.com/getsentry/react-native-sentry |
| 5 | +// TypeScript Version: 2.3 |
| 6 | + |
| 7 | +type SentryBreadcrumbType = "navigation" | "http"; |
| 8 | + |
| 9 | +interface SentryBreadcrumb { |
| 10 | + message?: string; |
| 11 | + category?: string; |
| 12 | + level?: SentrySeverity; |
| 13 | + data?: object; |
| 14 | + type?: SentryBreadcrumbType; |
| 15 | +} |
| 16 | + |
| 17 | +export enum SentrySeverity { |
| 18 | + Fatal = "fatal", |
| 19 | + Error = "error", |
| 20 | + Warning = "warning", |
| 21 | + Info = "info", |
| 22 | + Debug = "debug", |
| 23 | + Critical = "critical" |
| 24 | +} |
| 25 | + |
| 26 | +export enum SentryLog { |
| 27 | + None = 0, |
| 28 | + Error = 1, |
| 29 | + Debug = 2, |
| 30 | + Verbose = 3 |
| 31 | +} |
| 32 | + |
| 33 | +interface SentryOptions { |
| 34 | + logLevel?: SentryLog; |
| 35 | + instrument?: boolean; |
| 36 | + disableNativeIntegration?: boolean; |
| 37 | + ignoreModulesExclude?: [string]; |
| 38 | + ignoreModulesInclude?: [string]; |
| 39 | +} |
| 40 | + |
| 41 | +export default Sentry; |
| 42 | + |
| 43 | +export class Sentry { |
| 44 | + install(): void; |
| 45 | + |
| 46 | + static config(dsn: string, options?: SentryOptions): Sentry; |
| 47 | + |
| 48 | + static isNativeClientAvailable(): boolean; |
| 49 | + |
| 50 | + static crash(): void; |
| 51 | + |
| 52 | + static nativeCrash(): void; |
| 53 | + |
| 54 | + static setEventSentSuccessfully(callback: Function): void; |
| 55 | + |
| 56 | + static setDataCallback(callback: Function): void; |
| 57 | + |
| 58 | + static setUserContext(user: { |
| 59 | + id?: string; |
| 60 | + username?: string; |
| 61 | + email?: string; |
| 62 | + extra?: object; |
| 63 | + }): void; |
| 64 | + |
| 65 | + static setTagsContext(tags: Object): void; |
| 66 | + |
| 67 | + static setExtraContext(extra: Object): void; |
| 68 | + |
| 69 | + static captureMessage(message: string, options?: object): void; |
| 70 | + |
| 71 | + static captureException(ex: Error, options?: object): void; |
| 72 | + |
| 73 | + static captureBreadcrumb(breadcrumb: SentryBreadcrumb): void; |
| 74 | + |
| 75 | + static clearContext(): Promise<void>; |
| 76 | + |
| 77 | + static context(func: Function, ...args: any[]): void; |
| 78 | + static context(options: object, func: Function, ...args: any[]): void; |
| 79 | + |
| 80 | + static wrap(func: Function): Function; |
| 81 | + static wrap(options: object, func: Function): Function; |
| 82 | + static wrap<T extends Function>(func: T): T; |
| 83 | + static wrap<T extends Function>(options: object, func: T): T; |
| 84 | + |
| 85 | + static lastException(): object; |
| 86 | + static lastException(): null; |
| 87 | + |
| 88 | + static lastEventId(): object; |
| 89 | + static lastEventId(): null; |
| 90 | + |
| 91 | + static setRelease(release: string): void; |
| 92 | + |
| 93 | + static setDist(dist: string): void; |
| 94 | + |
| 95 | + static setVersion(version: string): void; |
| 96 | +} |
0 commit comments