diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 74057ae..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "ios/rollbar-ios"] - path = ios/rollbar-ios - url = git@github.com:rollbar/rollbar-ios.git diff --git a/RollbarReactNative.podspec b/RollbarReactNative.podspec index b91820e..afb3969 100644 --- a/RollbarReactNative.podspec +++ b/RollbarReactNative.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'RollbarReactNative' - s.version = '0.9.3' + s.version = '1.0.0-beta.0' s.summary = 'RollbarReactNative' s.description = <<-DESC RollbarReactNative is a library for interacting with the Rollbar @@ -10,12 +10,13 @@ Pod::Spec.new do |s| s.license = 'MIT' s.author = { 'Rollbar' => 'support@rollbar.com' } s.platform = :ios, '7.0' - s.source = { :git => 'https://github.com/author/RollbarReactNative.git', :tag => 'v0.8.0' } + s.source = { :git => 'https://github.com/rollbar/rollbar-react-native.git', :tag => '1.0.0-beta.0' } s.requires_arc = true s.dependency 'React-Core' - s.dependency 'Rollbar', '~> 1.12.8' - + s.dependency 'RollbarNotifier', '3.0.3' s.source_files = 'ios/RollbarReactNative.{h,m}' s.public_header_files = 'ios/RollbarReactNative.h' + + s.compiler_flags = '-fmodules', '-fcxx-modules' end diff --git a/android/src/main/java/com/rollbar/RollbarReactNative.java b/android/src/main/java/com/rollbar/RollbarReactNative.java index a11e417..adac37e 100644 --- a/android/src/main/java/com/rollbar/RollbarReactNative.java +++ b/android/src/main/java/com/rollbar/RollbarReactNative.java @@ -30,7 +30,7 @@ public class RollbarReactNative extends ReactContextBaseJavaModule { private static final String REACT_NATIVE = "react-native"; private static final String NOTIFIER_NAME = "rollbar-react-native"; - private static final String NOTIFIER_VERSION = "0.9.3"; + private static final String NOTIFIER_VERSION = "1.0.0-beta.0"; private static final String MANIFEST_CODE_VERSION = "com.rollbar.android.CODE_VERSION"; private ReactContext reactContext; diff --git a/index.d.ts b/index.d.ts index beb84b9..9d25d0c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,5 +1,7 @@ export class Client { - constructor(config: Configuration | string); + constructor(config: ConfigurationOptions); + + public rollbar: Rollbar; public captureUncaughtExceptions(): void; public captureUnhandledRejections(): void; @@ -11,12 +13,12 @@ export class Client { public error(obj: LogArgument, extra?: Extra, callback?: Callback): LogResult; public critical(obj: LogArgument, extra?: Extra, callback?: Callback): LogResult; - public setPerson(id: string, name?: string, email?: string): void; + public setPerson(id: string | null, name?: string | null, email?: string | null): void; public clearPerson(): void; } export class Configuration { - constructor(accessToken: string, options?: ConfigurationOptions); + constructor(options?: ConfigurationOptions); public setPlatform(platform: string): void; public toJSON(): object; } @@ -29,20 +31,5 @@ export interface LogResult { export type MaybeError = Error | undefined | null; export type Callback = (err: MaybeError, response: object) => void; -export interface ConfigurationOptions { - environment?: string; - logLevel?: string; - reportLevel?: string; - endpoint?: string; - appVersion?: string; - codeBundleId?: string; - releaseStage?: string; - enabledReleaseStages?: string[]; - captureUncaught?: boolean; - captureUnhandledRejections?: boolean; - captureDeviceInfo?: boolean; - payload?: object; - enabled?: boolean; - verbose?: boolean; - transform?: (data: object) => void; -} +export type Rollbar = import("rollbar").Rollbar; +export type ConfigurationOptions = import("rollbar").Configuration; diff --git a/index.js b/index.js index 98cac58..a56443d 100644 --- a/index.js +++ b/index.js @@ -1,2 +1,2 @@ 'use strict' -module.exports = require('./lib/Rollbar'); +module.exports = require('./lib/Client'); diff --git a/ios/RollbarReactNative.h b/ios/RollbarReactNative.h index 159e6fc..f8e54db 100644 --- a/ios/RollbarReactNative.h +++ b/ios/RollbarReactNative.h @@ -3,78 +3,169 @@ #else #import "RCTBridgeModule.h" #endif -#if __has_include() -#import -#else -#import "Rollbar.h" -#endif @interface RollbarReactNative : NSObject -+ (void)initWithAccessToken:(NSString *)accessToken; -+ (void)initWithAccessToken:(NSString *)accessToken configuration:(RollbarConfiguration *)config; -+ (void)initWithAccessToken:(NSString *)accessToken configuration:(RollbarConfiguration*)configuration enableCrashReporter:(BOOL)enable; ++ (void)initWithConfiguration:(nonnull NSDictionary *)configuration; + ++ (void)log:(nonnull NSString*)level message:(nonnull NSString*)message; ++ (void)log:(nonnull NSString*)level exception:(nonnull NSException*)exception; ++ (void)log:(nonnull NSString*)level error:(nonnull NSError*)error; + ++ (void)log:(nonnull NSString*)level + message:(nonnull NSString*)message + data:(nullable NSDictionary *)data; + ++ (void)log:(nonnull NSString*)level + exception:(nonnull NSException*)exception + data:(nullable NSDictionary *)data; + ++ (void)log:(nonnull NSString*)level + error:(nonnull NSError*)error + data:(nullable NSDictionary *)data; + ++ (void)log:(nonnull NSString*)level + message:(nonnull NSString*)message + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; + ++ (void)log:(nonnull NSString*)level + exception:(nonnull NSException*)exception + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; + ++ (void)log:(nonnull NSString*)level + error:(nonnull NSError*)error + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; + ++ (void)debugMessage:(nonnull NSString*)message; ++ (void)debugException:(nonnull NSException*)exception; ++ (void)debugError:(nonnull NSError*)error; + ++ (void)debugMessage:(nonnull NSString*)message + data:(nullable NSDictionary *)data; + ++ (void)debugException:(nonnull NSException*)exception + data:(nullable NSDictionary *)data; + ++ (void)debugError:(nonnull NSError*)error + data:(nullable NSDictionary *)data; + ++ (void)debugMessage:(nonnull NSString*)message + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; + ++ (void)debugException:(nonnull NSException*)exception + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; + ++ (void)debugError:(nonnull NSError*)error + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; + ++ (void)infoMessage:(nonnull NSString*)message; ++ (void)infoException:(nonnull NSException*)exception; ++ (void)infoError:(nonnull NSError*)error; + ++ (void)infoMessage:(nonnull NSString*)message + data:(nullable NSDictionary *)data; + ++ (void)infoException:(nonnull NSException*)exception + data:(nullable NSDictionary *)data; + ++ (void)infoError:(nonnull NSError*)error + data:(nullable NSDictionary *)data; + ++ (void)infoMessage:(nonnull NSString*)message + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; + ++ (void)infoException:(nonnull NSException*)exception + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; + ++ (void)infoError:(nonnull NSError*)error + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; + ++ (void)warningMessage:(nonnull NSString*)message; ++ (void)warningException:(nonnull NSException*)exception; ++ (void)warningError:(nonnull NSError*)error; + ++ (void)warningMessage:(nonnull NSString*)message + data:(nullable NSDictionary *)data; + ++ (void)warningException:(nonnull NSException*)exception + data:(nullable NSDictionary *)data; + ++ (void)warningError:(nonnull NSError*)error + data:(nullable NSDictionary *)data; + ++ (void)warningMessage:(nonnull NSString*)message + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; + ++ (void)warningException:(nonnull NSException*)exception + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; + ++ (void)warningError:(nonnull NSError*)error + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; -// Old methods for backwards compatability ++ (void)errorMessage:(nonnull NSString*)message; ++ (void)errorException:(nonnull NSException*)exception; ++ (void)errorError:(nonnull NSError*)error; -+ (void)logWithLevel:(NSString*)level message:(NSString*)message; -+ (void)logWithLevel:(NSString*)level message:(NSString*)message data:(NSDictionary*)data; -+ (void)logWithLevel:(NSString*)level data:(NSDictionary*)data; ++ (void)errorMessage:(nonnull NSString*)message + data:(nullable NSDictionary *)data; -+ (void)debugWithMessage:(NSString*)message; -+ (void)debugWithMessage:(NSString*)message data:(NSDictionary*)data; -+ (void)debugWithData:(NSDictionary*)data; ++ (void)errorException:(nonnull NSException*)exception + data:(nullable NSDictionary *)data; -+ (void)infoWithMessage:(NSString*)message; -+ (void)infoWithMessage:(NSString*)message data:(NSDictionary*)data; -+ (void)infoWithData:(NSDictionary*)data; ++ (void)errorError:(nonnull NSError*)error + data:(nullable NSDictionary *)data; -+ (void)warningWithMessage:(NSString*)message; -+ (void)warningWithMessage:(NSString*)message data:(NSDictionary*)data; -+ (void)warningWithData:(NSDictionary*)data; ++ (void)errorMessage:(nonnull NSString*)message + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; -+ (void)errorWithMessage:(NSString*)message; -+ (void)errorWithMessage:(NSString*)message data:(NSDictionary*)data; -+ (void)errorWithData:(NSDictionary*)data; ++ (void)errorException:(nonnull NSException*)exception + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; -+ (void)criticalWithMessage:(NSString*)message; -+ (void)criticalWithMessage:(NSString*)message data:(NSDictionary*)data; -+ (void)criticalWithData:(NSDictionary*)data; ++ (void)errorError:(nonnull NSError*)error + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; -// New interface ++ (void)criticalMessage:(nonnull NSString*)message; ++ (void)criticalException:(nonnull NSException*)exception; ++ (void)criticalError:(nonnull NSError*)error; -+ (void)log:(RollbarLevel)level message:(NSString*)message; -+ (void)log:(RollbarLevel)level message:(NSString*)message exception:(NSException*)exception; -+ (void)log:(RollbarLevel)level message:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data; -+ (void)log:(RollbarLevel)level message:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data context:(NSString*)context; ++ (void)criticalMessage:(nonnull NSString*)message + data:(nullable NSDictionary *)data; -+ (void)debug:(NSString*)message; -+ (void)debug:(NSString*)message exception:(NSException*)exception; -+ (void)debug:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data; -+ (void)debug:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data context:(NSString*)context; ++ (void)criticalException:(nonnull NSException*)exception + data:(nullable NSDictionary *)data; -+ (void)info:(NSString*)message; -+ (void)info:(NSString*)message exception:(NSException*)exception; -+ (void)info:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data; -+ (void)info:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data context:(NSString*)context; ++ (void)criticalError:(nonnull NSError*)error + data:(nullable NSDictionary *)data; -+ (void)warning:(NSString*)message; -+ (void)warning:(NSString*)message exception:(NSException*)exception; -+ (void)warning:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data; -+ (void)warning:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data context:(NSString*)context; ++ (void)criticalMessage:(nonnull NSString*)message + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; -+ (void)error:(NSString*)message; -+ (void)error:(NSString*)message exception:(NSException*)exception; -+ (void)error:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data; -+ (void)error:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data context:(NSString*)context; ++ (void)criticalException:(nonnull NSException*)exception + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; -+ (void)critical:(NSString*)message; -+ (void)critical:(NSString*)message exception:(NSException*)exception; -+ (void)critical:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data; -+ (void)critical:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data context:(NSString*)context; ++ (void)criticalError:(nonnull NSError*)error + data:(nullable NSDictionary *)data + context:(nullable NSString *)context; -- (void)init:(NSDictionary *)options; -- (void)setPerson:(NSDictionary *)personInfo; +- (void)init:(nonnull NSDictionary *)options; +- (void)setPerson:(nonnull NSDictionary *)personInfo; - (void)clearPerson; @end diff --git a/ios/RollbarReactNative.m b/ios/RollbarReactNative.m index 68bad55..50547f2 100644 --- a/ios/RollbarReactNative.m +++ b/ios/RollbarReactNative.m @@ -6,208 +6,356 @@ #endif #include +#if __has_include() +#import +#else +#import "Rollbar.h" +#endif + @implementation RollbarReactNative static NSString *const NOTIFIER_NAME = @"rollbar-react-native"; -static NSString *const NOTIFIER_VERSION = @"0.9.3"; +static NSString *const NOTIFIER_VERSION = @"1.0.0-beta.0"; static NSString *const REACT_NATIVE = @"react-native"; -+ (void)initWithAccessToken:(NSString *)accessToken { - [RollbarReactNative initWithAccessToken:accessToken configuration:nil]; ++ (void)initWithConfiguration:(NSDictionary*)options { + RollbarMutableConfig *config = ((RollbarMutableConfig *)[Rollbar configuration]); + if (config) { + updateConfiguration(config, options); + return; + } + config = [RollbarConfig mutableConfigWithAccessToken:[RCTConvert NSString:options[@"accessToken"]]]; + updateConfiguration(config, options); + + [Rollbar initWithConfiguration:config]; +} + ++ (void)log:(nonnull NSString*)level message:(NSString*)message { + RollbarLevel rLevel = rollbarLevelFromString(level); + [Rollbar log:rLevel message:message]; +} + ++ (void)log:(nonnull NSString*)level exception:(NSException*)exception { + RollbarLevel rLevel = rollbarLevelFromString(level); + [Rollbar log:rLevel exception:exception]; +} + ++ (void)log:(nonnull NSString*)level error:(NSError*)error { + RollbarLevel rLevel = rollbarLevelFromString(level); + [Rollbar log:rLevel error:error]; +} + ++ (void)log:(nonnull NSString*)level + message:(NSString*)message + data:(nullable NSDictionary *)data { + RollbarLevel rLevel = rollbarLevelFromString(level); + [Rollbar log:rLevel message:message data:data]; +} + ++ (void)log:(nonnull NSString*)level + exception:(NSException*)exception + data:(nullable NSDictionary *)data { + RollbarLevel rLevel = rollbarLevelFromString(level); + [Rollbar log:rLevel exception:exception data:data]; } -+ (void)initWithAccessToken:(NSString *)accessToken configuration:(RollbarConfiguration *)config { - [RollbarReactNative initWithAccessToken:accessToken configuration:config enableCrashReporter:YES]; ++ (void)log:(nonnull NSString*)level + error:(NSError*)error + data:(nullable NSDictionary *)data { + RollbarLevel rLevel = rollbarLevelFromString(level); + [Rollbar log:rLevel error:error data:data]; } -+ (void)initWithAccessToken:(NSString *)accessToken configuration:(RollbarConfiguration*)configuration enableCrashReporter:(BOOL)enable { - [Rollbar initWithAccessToken:accessToken configuration:configuration enableCrashReporter:enable]; ++ (void)log:(nonnull NSString*)level + message:(NSString*)message + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + RollbarLevel rLevel = rollbarLevelFromString(level); + [Rollbar log:rLevel message:message data:data context:context]; } -+ (void)logWithLevel:(NSString*)level message:(NSString*)message { - [Rollbar logWithLevel:level message:message]; ++ (void)log:(nonnull NSString*)level + exception:(NSException*)exception + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + RollbarLevel rLevel = rollbarLevelFromString(level); + [Rollbar log:rLevel exception:exception data:data context:context]; } -+ (void)logWithLevel:(NSString*)level message:(NSString*)message data:(NSDictionary*)data { - [Rollbar logWithLevel:level message:message data:data]; ++ (void)log:(nonnull NSString*)level + error:(NSError*)error + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + RollbarLevel rLevel = rollbarLevelFromString(level); + [Rollbar log:rLevel error:error data:data context:context]; } -+ (void)logWithLevel:(NSString*)level data:(NSDictionary*)data { - [Rollbar logWithLevel:level data:data]; ++ (void)debugMessage:(NSString*)message { + [Rollbar debugMessage:message]; } -+ (void)debugWithMessage:(NSString*)message { - [Rollbar debugWithMessage:message]; ++ (void)debugException:(NSException*)exception { + [Rollbar debugException:exception]; } -+ (void)debugWithMessage:(NSString*)message data:(NSDictionary*)data { - [Rollbar debugWithMessage:message data:data]; ++ (void)debugError:(NSError*)error { + [Rollbar debugError:error]; } -+ (void)debugWithData:(NSDictionary*)data { - [Rollbar debugWithData:data]; ++ (void)debugMessage:(NSString*)message + data:(nullable NSDictionary *)data { + [Rollbar debugMessage:message data:data]; } -+ (void)infoWithMessage:(NSString*)message { - [Rollbar infoWithMessage:message]; ++ (void)debugException:(NSException*)exception + data:(nullable NSDictionary *)data { + [Rollbar debugException:exception data:data]; } -+ (void)infoWithMessage:(NSString*)message data:(NSDictionary*)data { - [Rollbar infoWithMessage:message data:data]; ++ (void)debugError:(NSError*)error + data:(nullable NSDictionary *)data { + [Rollbar debugError:error data:data]; } -+ (void)infoWithData:(NSDictionary*)data { - [Rollbar infoWithData:data]; ++ (void)debugMessage:(NSString*)message + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar debugMessage:message data:data context:context]; } -+ (void)warningWithMessage:(NSString*)message { - [Rollbar warningWithMessage:message]; ++ (void)debugException:(NSException*)exception + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar debugException:exception data:data context:context]; } -+ (void)warningWithMessage:(NSString*)message data:(NSDictionary*)data { - [Rollbar warningWithMessage:message data:data]; ++ (void)debugError:(NSError*)error + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar debugError:error data:data context:context]; } -+ (void)warningWithData:(NSDictionary*)data { - [Rollbar warningWithData:data]; ++ (void)infoMessage:(NSString*)message { + [Rollbar infoMessage:message]; } -+ (void)errorWithMessage:(NSString*)message { - [Rollbar errorWithMessage:message]; ++ (void)infoException:(NSException*)exception { + [Rollbar infoException:exception]; } -+ (void)errorWithMessage:(NSString*)message data:(NSDictionary*)data { - [Rollbar errorWithMessage:message data:data]; ++ (void)infoError:(NSError*)error { + [Rollbar infoError:error]; } -+ (void)errorWithData:(NSDictionary*)data { - [Rollbar errorWithData:data]; ++ (void)infoMessage:(NSString*)message + data:(nullable NSDictionary *)data { + [Rollbar infoMessage:message data:data]; } -+ (void)criticalWithMessage:(NSString*)message { - [Rollbar criticalWithMessage:message]; ++ (void)infoException:(NSException*)exception + data:(nullable NSDictionary *)data { + [Rollbar infoException:exception data:data]; } -+ (void)criticalWithMessage:(NSString*)message data:(NSDictionary*)data { - [Rollbar criticalWithMessage:(NSString*)message data:data]; ++ (void)infoError:(NSError*)error + data:(nullable NSDictionary *)data { + [Rollbar infoError:error data:data]; } -+ (void)criticalWithData:(NSDictionary*)data { - [Rollbar criticalWithData:data]; ++ (void)infoMessage:(NSString*)message + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar infoMessage:message data:data context:context]; } -// New interface ++ (void)infoException:(NSException*)exception + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar infoException:exception data:data context:context]; +} -+ (void)log:(RollbarLevel)level message:(NSString*)message { - [Rollbar log:level message:message]; ++ (void)infoError:(NSError*)error + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar infoError:error data:data context:context]; } -+ (void)log:(RollbarLevel)level message:(NSString*)message exception:(NSException*)exception { - [Rollbar log:level message:message exception:exception]; ++ (void)warningMessage:(NSString*)message { + [Rollbar warningMessage:message]; } -+ (void)log:(RollbarLevel)level message:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data { - [Rollbar log:level message:message exception:exception data:data]; ++ (void)warningException:(NSException*)exception { + [Rollbar warningException:exception]; } -+ (void)log:(RollbarLevel)level message:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data context:(NSString*)context { - [Rollbar log:level message:message exception:exception data:data context:context]; ++ (void)warningError:(NSError*)error { + [Rollbar warningError:error]; } -+ (void)debug:(NSString*)message { - [Rollbar debug:message]; ++ (void)warningMessage:(NSString*)message + data:(nullable NSDictionary *)data { + [Rollbar warningMessage:message data:data]; } -+ (void)debug:(NSString*)message exception:(NSException*)exception { - [Rollbar debug:message exception:exception]; ++ (void)warningException:(NSException*)exception + data:(nullable NSDictionary *)data { + [Rollbar warningException:exception data:data]; } -+ (void)debug:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data { - [Rollbar debug:message exception:exception data:data]; ++ (void)warningError:(NSError*)error + data:(nullable NSDictionary *)data { + [Rollbar warningError:error data:data]; } -+ (void)debug:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data context:(NSString*)context { - [Rollbar debug:message exception:exception data:data context:context]; ++ (void)warningMessage:(NSString*)message + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar warningMessage:message data:data context:context]; } -+ (void)info:(NSString*)message { - [Rollbar info:message]; ++ (void)warningException:(NSException*)exception + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar warningException:exception data:data context:context]; } -+ (void)info:(NSString*)message exception:(NSException*)exception { - [Rollbar info:message exception:exception]; ++ (void)warningError:(NSError*)error + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar warningError:error data:data context:context]; } -+ (void)info:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data { - [Rollbar info:message exception:exception data:data]; ++ (void)errorMessage:(NSString*)message { + [Rollbar errorMessage:message]; } -+ (void)info:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data context:(NSString*)context { - [Rollbar info:message exception:exception data:data context:context]; ++ (void)errorException:(NSException*)exception { + [Rollbar errorException:exception]; } -+ (void)warning:(NSString*)message { - [Rollbar warning:message]; ++ (void)errorError:(NSError*)error { + [Rollbar errorError:error]; } -+ (void)warning:(NSString*)message exception:(NSException*)exception { - [Rollbar warning:message exception:exception]; ++ (void)errorMessage:(NSString*)message + data:(nullable NSDictionary *)data { + [Rollbar errorMessage:message data:data]; } -+ (void)warning:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data { - [Rollbar warning:message exception:exception data:data]; ++ (void)errorException:(NSException*)exception + data:(nullable NSDictionary *)data { + [Rollbar errorException:exception data:data]; } -+ (void)warning:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data context:(NSString*)context { - [Rollbar warning:message exception:exception data:data context:context]; ++ (void)errorError:(NSError*)error + data:(nullable NSDictionary *)data { + [Rollbar errorError:error data:data]; } -+ (void)error:(NSString*)message { - [Rollbar error:message]; ++ (void)errorMessage:(NSString*)message + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar errorMessage:message data:data context:context]; } -+ (void)error:(NSString*)message exception:(NSException*)exception { - [Rollbar error:message exception:exception]; ++ (void)errorException:(NSException*)exception + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar errorException:exception data:data context:context]; } -+ (void)error:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data { - [Rollbar error:message exception:exception data:data]; ++ (void)errorError:(NSError*)error + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar errorError:error data:data context:context]; } -+ (void)error:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data context:(NSString*)context { - [Rollbar error:message exception:exception data:data context:context]; ++ (void)criticalMessage:(NSString*)message { + [Rollbar criticalMessage:message]; } -+ (void)critical:(NSString*)message { - [Rollbar critical:message]; ++ (void)criticalException:(NSException*)exception { + [Rollbar criticalException:exception]; } -+ (void)critical:(NSString*)message exception:(NSException*)exception { - [Rollbar critical:message exception:exception]; ++ (void)criticalError:(NSError*)error { + [Rollbar criticalError:error]; } -+ (void)critical:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data { - [Rollbar critical:message exception:exception data:data]; ++ (void)criticalMessage:(NSString*)message + data:(nullable NSDictionary *)data { + [Rollbar criticalMessage:message data:data]; } -+ (void)critical:(NSString*)message exception:(NSException*)exception data:(NSDictionary*)data context:(NSString*)context { - [Rollbar critical:message exception:exception data:data context:context]; ++ (void)criticalException:(NSException*)exception + data:(nullable NSDictionary *)data { + [Rollbar criticalException:exception data:data]; } -NSString* updateConfiguration(RollbarConfiguration *config, NSDictionary *options) { - NSString *accessToken = nil; ++ (void)criticalError:(NSError*)error + data:(nullable NSDictionary *)data { + [Rollbar criticalError:error data:data]; +} + ++ (void)criticalMessage:(NSString*)message + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar criticalMessage:message data:data context:context]; +} + ++ (void)criticalException:(NSException*)exception + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar criticalException:exception data:data context:context]; +} + ++ (void)criticalError:(NSError*)error + data:(nullable NSDictionary *)data + context:(nullable NSString *)context { + [Rollbar criticalError:error data:data context:context]; +} + +RollbarLevel rollbarLevelFromString(NSString *value) { + if (value == nil) { + return RollbarLevel_Info; + } else if ([value caseInsensitiveCompare:@"debug"] == NSOrderedSame) { + return RollbarLevel_Debug; + } else if ([value caseInsensitiveCompare:@"info"] == NSOrderedSame) { + return RollbarLevel_Info; + } else if ([value caseInsensitiveCompare:@"warning"] == NSOrderedSame) { + return RollbarLevel_Warning; + } else if ([value caseInsensitiveCompare:@"error"] == NSOrderedSame) { + return RollbarLevel_Error; + } else if ([value caseInsensitiveCompare:@"critical"] == NSOrderedSame) { + return RollbarLevel_Critical; + } else { + return RollbarLevel_Info; + } +} + +void updateConfiguration(RollbarMutableConfig *config, NSDictionary *options) { if (options[@"accessToken"]) { - config.accessToken = [RCTConvert NSString:options[@"accessToken"]]; - accessToken = config.accessToken; + config.destination.accessToken = [RCTConvert NSString:options[@"accessToken"]]; } if (options[@"environment"]) { - config.environment = [RCTConvert NSString:options[@"environment"]]; + config.destination.environment = [RCTConvert NSString:options[@"environment"]]; } if (options[@"endpoint"]) { - config.endpoint = [RCTConvert NSString:options[@"endpoint"]]; + config.destination.endpoint = [RCTConvert NSString:options[@"endpoint"]]; + } + if (options[@"enabled"]) { + id enabledJSON = [options objectForKey:@"enabled"]; + BOOL enabled = YES; + if (enabledJSON != nil) { + enabled = [RCTConvert BOOL:enabledJSON]; + } + config.developerOptions.enabled = enabled; + } + if (options[@"crashLevel"]) { + config.loggingOptions.crashLevel = rollbarLevelFromString([RCTConvert NSString:options[@"crashLevel"]]); } if (options[@"logLevel"]) { - config.crashLevel = [RCTConvert NSString:options[@"logLevel"]]; + config.loggingOptions.logLevel = rollbarLevelFromString([RCTConvert NSString:options[@"logLevel"]]); } if (options[@"notifier"]) { NSDictionary *notifierConfig = [RCTConvert NSDictionary:options[@"notifier"]]; @@ -219,40 +367,35 @@ + (void)critical:(NSString*)message exception:(NSException*)exception data:(NSDi if (options[@"framework"]) { framework = [RCTConvert NSString:options[@"framework"]]; } - [config setCodeFramework:framework]; - - return accessToken; + config.loggingOptions.framework = framework; } RCT_EXPORT_MODULE() RCT_EXPORT_METHOD(init:(NSDictionary *)options) { - RollbarConfiguration *config = [Rollbar currentConfiguration]; + RollbarMutableConfig *config = (RollbarMutableConfig *)[Rollbar configuration]; if (config) { updateConfiguration(config, options); return; } - config = [RollbarConfiguration configuration]; - NSString *accessToken = updateConfiguration(config, options); - - id enabledJSON = [options objectForKey:@"enabled"]; - BOOL enabled = YES; - if (enabledJSON != nil) { - enabled = [RCTConvert BOOL:enabledJSON]; - } + config = [RollbarConfig mutableConfigWithAccessToken:[RCTConvert NSString:options[@"accessToken"]]]; + updateConfiguration(config, options); - [Rollbar initWithAccessToken:accessToken configuration:config enableCrashReporter:enabled]; + [Rollbar initWithConfiguration:config]; } RCT_EXPORT_METHOD(setPerson:(NSDictionary *)personInfo) { - NSString *identifier = personInfo[@"id"] ? [RCTConvert NSString:personInfo[@"id"]] : nil; - NSString *name = personInfo[@"name"] ? [RCTConvert NSString:personInfo[@"name"]] : nil; - NSString *email = personInfo[@"email"] ? [RCTConvert NSString:personInfo[@"email"]] : nil; - [[Rollbar currentConfiguration] setPersonId:identifier username:name email:email]; + NSString *identifier = personInfo[@"id"] && ![personInfo[@"id"] isEqual:[NSNull null]] + ? [RCTConvert NSString:personInfo[@"id"]] : @""; + NSString *name = personInfo[@"name"] && ![personInfo[@"name"] isEqual:[NSNull null]] + ? [RCTConvert NSString:personInfo[@"name"]] : nil; + NSString *email = personInfo[@"email"] && ![personInfo[@"email"] isEqual:[NSNull null]] + ? [RCTConvert NSString:personInfo[@"email"]] : nil; + [((RollbarMutableConfig *)[Rollbar configuration]) setPersonId:identifier username:name email:email]; } RCT_EXPORT_METHOD(clearPerson) { - [[Rollbar currentConfiguration] setPersonId:nil username:nil email:nil]; + [((RollbarMutableConfig *)[Rollbar configuration]) setPersonId:@"" username:nil email:nil]; } // Defined as synchronous because the data must be returned in the diff --git a/ios/RollbarReactNative.xcodeproj/project.pbxproj b/ios/RollbarReactNative.xcodeproj/project.pbxproj index 4a5b0d3..dc952c8 100644 --- a/ios/RollbarReactNative.xcodeproj/project.pbxproj +++ b/ios/RollbarReactNative.xcodeproj/project.pbxproj @@ -9,7 +9,7 @@ /* Begin PBXBuildFile section */ 9E17A2C11F699D5800262D87 /* RollbarReactNative.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = B3E7B5881CC2AC0600A0062D /* RollbarReactNative.h */; }; 9E7303A120C9E58900D6900B /* libRollbar.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E0FADE220C9DE9A002298F4 /* libRollbar.a */; }; - B3E7B58A1CC2AC0600A0062D /* RollbarReactNative.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RollbarReactNative.m */; }; + B3E7B58A1CC2AC0600A0062D /* RollbarReactNative.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RollbarReactNative.m */; settings = {COMPILER_FLAGS = "-fmodules -fcxx-modules"; }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -144,6 +144,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = 58B511D21A9E6C8500147676; @@ -288,6 +289,7 @@ 58B511F01A9E6C8500147676 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_MODULES_AUTOLINK = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -305,6 +307,11 @@ "$(inherited)", "$(SRCROOT)", ); + "OTHER_CFLAGS[arch=*]" = ( + "-fmodules", + "-fcxx-modules", + ); + "OTHER_CPLUSPLUSFLAGS[arch=*]" = "$(OTHER_CFLAGS)"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = RollbarReactNative; SKIP_INSTALL = YES; @@ -314,6 +321,7 @@ 58B511F11A9E6C8500147676 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_MODULES_AUTOLINK = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -331,6 +339,11 @@ "$(inherited)", "$(SRCROOT)", ); + "OTHER_CFLAGS[arch=*]" = ( + "-fmodules", + "-fcxx-modules", + ); + "OTHER_CPLUSPLUSFLAGS[arch=*]" = "$(OTHER_CFLAGS)"; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = RollbarReactNative; SKIP_INSTALL = YES; diff --git a/ios/RollbarReactNative.xcworkspace/contents.xcworkspacedata b/ios/RollbarReactNative.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 6ae5a1f..0000000 --- a/ios/RollbarReactNative.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,9 +0,0 @@ -// !$*UTF8*$! - - - - - - \ No newline at end of file diff --git a/ios/rollbar-ios b/ios/rollbar-ios deleted file mode 160000 index 1c9da63..0000000 --- a/ios/rollbar-ios +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1c9da63c6407328e6ccb4229d6a581ca0f119c99 diff --git a/lib/Client.js b/lib/Client.js new file mode 100644 index 0000000..fd61b7c --- /dev/null +++ b/lib/Client.js @@ -0,0 +1,2 @@ +Object.defineProperty(exports,"__esModule",{value:true});exports.Client=void 0;var _reactNative=require("react-native");var _Rollbar=_interopRequireDefault(require("./Rollbar"));var _merge=require("./merge");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}var NativeClient=_reactNative.NativeModules.RollbarReactNative;var Client=function Client(config){var _this=this;_classCallCheck(this,Client);this.captureUncaughtExceptions=function(){if(_this.isNative&&typeof ErrorUtils!==undefined){var previousHandler=ErrorUtils.getGlobalHandler();ErrorUtils.setGlobalHandler(function(error,isFatal){if(_this.config.captureUncaught&&_this.config.shouldSend()){_this.error(error,undefined,function(queued){if(previousHandler){previousHandler(error,isFatal);}});}else if(previousHandler){previousHandler(error,isFatal);}});}};this.captureUnhandledRejections=function(){var tracking=require('promise/setimmediate/rejection-tracking');var client=_this;tracking.enable({allRejections:true,onUnhandled:function onUnhandled(id,error){client.error(error);},onHandled:function onHandled(){}});};this.log=function(obj,extra,callback){if(_this.isNative&&!_this.config.shouldSend()){if(callback){callback(false);}return;}_this.rollbar.log(obj,extra,callback);};this.debug=function(obj,extra,callback){return _this.rollbar.debug(obj,extra,callback);};this.info=function(obj,extra,callback){return _this.rollbar.info(obj,extra,callback);};this.warning=function(obj,extra,callback){return _this.rollbar.warning(obj,extra,callback);};this.error=function(obj,extra,callback){return _this.rollbar.error(obj,extra,callback);};this.critical=function(obj,extra,callback){return _this.rollbar.critical(obj,extra,callback);};this.setPerson=function(id,name,email){_this.rollbar.configure({},{person:{id:id,name:name,email:email}});if(NativeClient){NativeClient.setPerson({id:id,name:name,email:email});}};this.clearPerson=function(){_this.rollbar.configure({},{person:{}});if(NativeClient){NativeClient.clearPerson();}};this.isNative=_reactNative.Platform.OS!=='web';if(this.isNative){this.config=new Configuration(config);this.config.setPlatform(_reactNative.Platform.OS);if(NativeClient){NativeClient.init(this.config.toJSON());}this.rollbar=new _Rollbar.default(this.config.toJSON());this.captureUncaughtExceptions();if(this.config.captureUnhandledRejections){this.captureUnhandledRejections();}}else{this.rollbar=new _Rollbar.default(config);}};exports.Client=Client;var Configuration=function Configuration(options){var _this2=this;_classCallCheck(this,Configuration);this.shouldSend=function(){return!_this2.releaseStage||!_this2.enabledReleaseStages||_this2.enabledReleaseStages.includes(_this2.releaseStage);};this.setPlatform=function(platform){if(_this2.platform===undefined){_this2.platform=platform;}};this.payloadOptions=function(){if(!_this2.captureDeviceInfo){return{};}return{client:{os:_this2.deviceAttributes()}};};this.deviceAttributes=function(){if(NativeClient){return JSON.parse(NativeClient.deviceAttributes());}else{return{};}};this.toJSON=function(){return(0,_merge.merge)(_this2.options,{platform:_this2.platform});};var pkgData=require('../package.json');this.captureDeviceInfo=options.captureDeviceInfo===undefined?false:options.captureDeviceInfo;this.options=(0,_merge.merge)(options||{},{payload:(0,_merge.merge)(options.payload,this.payloadOptions()),notifier:{name:'rollbar-react-native',version:pkgData['version']}});}; +//# sourceMappingURL=Client.js.map \ No newline at end of file diff --git a/lib/Client.js.map b/lib/Client.js.map new file mode 100644 index 0000000..3cd39cb --- /dev/null +++ b/lib/Client.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/Client.js"],"names":["NativeClient","NativeModules","RollbarReactNative","Client","config","captureUncaughtExceptions","isNative","ErrorUtils","undefined","previousHandler","getGlobalHandler","setGlobalHandler","error","isFatal","captureUncaught","shouldSend","queued","captureUnhandledRejections","tracking","require","client","enable","allRejections","onUnhandled","id","onHandled","log","obj","extra","callback","rollbar","debug","info","warning","critical","setPerson","name","email","configure","person","clearPerson","Platform","OS","Configuration","setPlatform","init","toJSON","Rollbar","options","releaseStage","enabledReleaseStages","includes","platform","payloadOptions","captureDeviceInfo","os","deviceAttributes","JSON","parse","pkgData","payload","notifier","version"],"mappings":"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","sourcesContent":["import { Platform, NativeModules } from 'react-native';\nimport Rollbar from './Rollbar';\nimport { merge } from './merge';\n\nconst NativeClient = NativeModules.RollbarReactNative;\n\nexport class Client {\n constructor(config) {\n this.isNative = Platform.OS !== 'web';\n\n if (this.isNative) {\n this.config = new Configuration(config);\n this.config.setPlatform(Platform.OS);\n\n if (NativeClient) {\n NativeClient.init(this.config.toJSON());\n }\n\n this.rollbar = new Rollbar(this.config.toJSON());\n\n this.captureUncaughtExceptions();\n if (this.config.captureUnhandledRejections) {\n this.captureUnhandledRejections();\n }\n } else {\n this.rollbar = new Rollbar(config);\n }\n }\n\n captureUncaughtExceptions = () => {\n if (this.isNative && typeof ErrorUtils !== undefined) {\n const previousHandler = ErrorUtils.getGlobalHandler();\n\n ErrorUtils.setGlobalHandler((error, isFatal) => {\n if (this.config.captureUncaught && this.config.shouldSend()) {\n this.error(error, undefined, (queued) => {\n if (previousHandler) {\n previousHandler(error, isFatal);\n }\n });\n } else if (previousHandler) {\n previousHandler(error, isFatal);\n }\n });\n }\n }\n\n captureUnhandledRejections = () => {\n const tracking = require('promise/setimmediate/rejection-tracking');\n const client = this;\n tracking.enable({\n allRejections: true,\n onUnhandled: function(id, error) { client.error(error); },\n onHandled: function() {}\n });\n }\n\n log = (obj, extra, callback) => {\n if (this.isNative && !this.config.shouldSend()) {\n if (callback) {\n callback(false);\n }\n return;\n }\n\n this.rollbar.log(obj, extra, callback);\n }\n\n debug = (obj, extra, callback) => {\n return this.rollbar.debug(obj, extra, callback);\n }\n\n info = (obj, extra, callback) => {\n return this.rollbar.info(obj, extra, callback);\n }\n\n warning = (obj, extra, callback) => {\n return this.rollbar.warning(obj, extra, callback);\n }\n\n error = (obj, extra, callback) => {\n return this.rollbar.error(obj, extra, callback);\n }\n\n critical = (obj, extra, callback) => {\n return this.rollbar.critical(obj, extra, callback);\n }\n\n setPerson = (id, name, email) => {\n this.rollbar.configure({}, {person: {id, name, email}});\n if (NativeClient) {\n NativeClient.setPerson({id, name, email});\n }\n }\n\n clearPerson = () => {\n this.rollbar.configure({}, {person: {}});\n if (NativeClient) {\n NativeClient.clearPerson();\n }\n }\n}\n\nclass Configuration {\n constructor(options) {\n const pkgData = require('../package.json');\n\n // Ensure captureDeviceInfo is set before calling payloadOptions() below.\n this.captureDeviceInfo = options.captureDeviceInfo === undefined ? false : options.captureDeviceInfo;\n\n this.options = merge(options || {}, {\n payload: merge(options.payload, this.payloadOptions()),\n notifier: {\n name: 'rollbar-react-native',\n version: pkgData['version']\n }\n });\n }\n\n shouldSend = () => {\n return !this.releaseStage ||\n !this.enabledReleaseStages ||\n this.enabledReleaseStages.includes(this.releaseStage);\n }\n\n setPlatform = (platform) => {\n if (this.platform === undefined) {\n this.platform = platform;\n }\n }\n\n payloadOptions = () => {\n if (!this.captureDeviceInfo) {\n return {};\n }\n\n return {\n client: {\n os: this.deviceAttributes()\n }\n }\n }\n\n deviceAttributes = () => {\n if (NativeClient) {\n return JSON.parse(NativeClient.deviceAttributes());\n } else {\n return {};\n }\n }\n\n toJSON = () => {\n return merge(this.options, {\n platform: this.platform\n });\n }\n}\n"],"file":"Client.js"} \ No newline at end of file diff --git a/lib/Rollbar.js b/lib/Rollbar.js index d21f709..c02761b 100644 --- a/lib/Rollbar.js +++ b/lib/Rollbar.js @@ -1,3 +1,2 @@ -Object.defineProperty(exports,"__esModule",{value:true});exports.Configuration=exports.Client=void 0;var _reactNative=require("react-native");var _rollbar=_interopRequireDefault(require("rollbar/src/react-native/rollbar"));var _merge=require("../src/merge");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function _objectSpread(target){for(var i=1;i {\n\t\tif (ErrorUtils) {\n const previousHandler = ErrorUtils.getGlobalHandler();\n\n ErrorUtils.setGlobalHandler((error, isFatal) => {\n if (this.config.captureUncaught && this.config.shouldSend()) {\n this.error(error, undefined, (queued) => {\n if (previousHandler) {\n previousHandler(error, isFatal);\n }\n });\n } else if (previousHandler) {\n previousHandler(error, isFatal);\n }\n });\n }\n }\n\n captureUnhandledRejections = () => {\n\t\tconst tracking = require('promise/setimmediate/rejection-tracking');\n const client = this;\n tracking.enable({\n allRejections: true,\n onUnhandled: function(id, error) { client.error(error); },\n onHandled: function() {}\n });\n }\n\n log = (obj, extra, callback) => {\n\t\tif (!this.config.shouldSend()) {\n if (callback) {\n callback(false);\n }\n return;\n }\n\n this.rollbar.log(obj, extra, callback);\n }\n\n debug = (obj, extra, callback) => {\n return this.rollbar.debug(obj, extra, callback);\n }\n\n info = (obj, extra, callback) => {\n return this.rollbar.info(obj, extra, callback);\n }\n\n warning = (obj, extra, callback) => {\n return this.rollbar.warning(obj, extra, callback);\n }\n\n error = (obj, extra, callback) => {\n return this.rollbar.error(obj, extra, callback);\n }\n\n critical = (obj, extra, callback) => {\n return this.rollbar.critical(obj, extra, callback);\n }\n\n setPerson = (id, name, email) => {\n this.rollbar.setPerson({id, name, email});\n if (NativeClient) {\n NativeClient.setPerson({id, name, email});\n }\n }\n\n clearPerson = () => {\n this.rollbar.clearPerson();\n if (NativeClient) {\n NativeClient.clearPerson();\n }\n }\n}\n\nexport class Configuration {\n constructor(accessToken, options) {\n options = options || {};\n const pkgData = require('../package.json');\n this.version = pkgData['version'];\n this.accessToken = accessToken;\n this.environment = options.environment;\n this.logLevel = options.logLevel || 'debug';\n this.reportLevel = options.reportLevel || undefined;\n this.endpoint = options.endpoint || undefined;\n this.appVersion = options.appVersion || undefined;\n this.codeBundleId = options.codeBundleId || undefined;\n this.releaseStage = options.releaseStage || undefined;\n this.enabledReleaseStages = options.enabledReleaseStages || undefined;\n this.captureUncaught = options.captureUncaught !== undefined ? options.captureUncaught : true;\n this.captureUnhandledRejections = options.captureUnhandledRejections !== undefined ? options.captureUnhandledRejections : !__DEV__;\n\n // Ensure captureDeviceInfo is set before calling payloadOptions() below.\n this.captureDeviceInfo = options.captureDeviceInfo === undefined ? false : options.captureDeviceInfo;\n this.payload = merge(options.payload, this.payloadOptions());\n this.enabled = options.enabled === undefined ? true : options.enabled;\n this.verbose = options.verbose || false;\n this.transform = options.transform;\n this.rewriteFilenamePatterns = options.rewriteFilenamePatterns;\n this.scrubFields = options.scrubFields || undefined;\n this.overwriteScrubFields = options.overwriteScrubFields || undefined;\n this.onSendCallback = options.onSendCallback || undefined;\n this.checkIgnore = options.checkIgnore || undefined;\n this.ignoreDuplicateErrors = options.ignoreDuplicateErrors !== undefined ? options.ignoreDuplicateErrors : undefined;\n }\n\n shouldSend = () => {\n return !this.releaseStage ||\n !this.enabledReleaseStages ||\n this.enabledReleaseStages.includes(this.releaseStage);\n }\n\n setPlatform = (platform) => {\n if (this.platform === undefined) {\n if (platform === 'ios' || platform === 'android') {\n this.platform = platform;\n } else {\n this.platform = 'client';\n }\n }\n }\n\n payloadOptions = () => {\n if (!this.captureDeviceInfo) {\n return {};\n }\n\n return {\n client: {\n os: this.deviceAttributes()\n }\n }\n }\n\n deviceAttributes = () => {\n if (NativeClient) {\n return JSON.parse(NativeClient.deviceAttributes());\n } else {\n return {};\n }\n }\n\n toJSON = () => {\n var result = {\n accessToken: this.accessToken,\n endpoint: this.endpoint,\n platform: this.platform,\n logLevel: this.logLevel,\n reportLevel: this.reportLevel,\n enabled: this.enabled,\n verbose: this.verbose,\n captureDeviceInfo: this.captureDeviceInfo,\n transform: this.transform,\n rewriteFilenamePatterns: this.rewriteFilenamePatterns,\n scrubFields: this.scrubFields,\n overwriteScrubFields: this.overwriteScrubFields,\n onSendCallback: this.onSendCallback,\n checkIgnore: this.checkIgnore,\n ignoreDuplicateErrors: this.ignoreDuplicateErrors,\n payload: {\n codeBundleId: this.codeBundleId,\n releaseStage: this.releaseStage,\n enabledReleaseStages: this.enabledReleaseStages,\n appVersion: this.appVersion,\n ...this.payload\n },\n notifier: {\n name: 'rollbar-react-native',\n version: this.version\n }\n };\n if (this.environment) {\n result.environment = this.environment;\n }\n return result;\n }\n}\n"]} \ No newline at end of file +{"version":3,"sources":["../src/Rollbar.js"],"names":["Rollbar"],"mappings":"gFAAA,wD,gGAEeA,gB","sourcesContent":["import Rollbar from 'rollbar';\n\nexport default Rollbar;\n"],"file":"Rollbar.js"} \ No newline at end of file diff --git a/lib/Rollbar.native.js b/lib/Rollbar.native.js new file mode 100644 index 0000000..1a66c07 --- /dev/null +++ b/lib/Rollbar.native.js @@ -0,0 +1,2 @@ +Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _rollbar=_interopRequireDefault(require("rollbar/src/react-native/rollbar"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var _default=_rollbar.default;exports.default=_default; +//# sourceMappingURL=Rollbar.native.js.map \ No newline at end of file diff --git a/lib/Rollbar.native.js.map b/lib/Rollbar.native.js.map new file mode 100644 index 0000000..6989138 --- /dev/null +++ b/lib/Rollbar.native.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/Rollbar.native.js"],"names":["Rollbar"],"mappings":"gFAAA,iF,gGAEeA,gB","sourcesContent":["import Rollbar from 'rollbar/src/react-native/rollbar';\n\nexport default Rollbar;\n"],"file":"Rollbar.native.js"} \ No newline at end of file diff --git a/lib/merge.js b/lib/merge.js new file mode 100644 index 0000000..882a0b0 --- /dev/null +++ b/lib/merge.js @@ -0,0 +1,2 @@ +'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.merge=merge;var hasOwn=Object.prototype.hasOwnProperty;var toStr=Object.prototype.toString;var isPlainObject=function isPlainObject(obj){if(!obj||toStr.call(obj)!=='[object Object]'){return false;}var hasOwnConstructor=hasOwn.call(obj,'constructor');var hasIsPrototypeOf=obj.constructor&&obj.constructor.prototype&&hasOwn.call(obj.constructor.prototype,'isPrototypeOf');if(obj.constructor&&!hasOwnConstructor&&!hasIsPrototypeOf){return false;}var key;for(key in obj){}return typeof key==='undefined'||hasOwn.call(obj,key);};function merge(){var i,src,copy,clone,name,result={},current=null,length=arguments.length;for(i=0;i=0.50", - "promise": ">=7.1.1" + "promise": ">=7.1.1", + "rollbar": "^2.26.1" }, "dependencies": { "buffer": "^4.9.1 || ^5.0.7", - "rollbar": "^2.21.1", "url": "^0.11.0" }, "devDependencies": { diff --git a/src/Client.js b/src/Client.js new file mode 100644 index 0000000..4bef14d --- /dev/null +++ b/src/Client.js @@ -0,0 +1,157 @@ +import { Platform, NativeModules } from 'react-native'; +import Rollbar from './Rollbar'; +import { merge } from './merge'; + +const NativeClient = NativeModules.RollbarReactNative; + +export class Client { + constructor(config) { + this.isNative = Platform.OS !== 'web'; + + if (this.isNative) { + this.config = new Configuration(config); + this.config.setPlatform(Platform.OS); + + if (NativeClient) { + NativeClient.init(this.config.toJSON()); + } + + this.rollbar = new Rollbar(this.config.toJSON()); + + this.captureUncaughtExceptions(); + if (this.config.captureUnhandledRejections) { + this.captureUnhandledRejections(); + } + } else { + this.rollbar = new Rollbar(config); + } + } + + captureUncaughtExceptions = () => { + if (this.isNative && typeof ErrorUtils !== undefined) { + const previousHandler = ErrorUtils.getGlobalHandler(); + + ErrorUtils.setGlobalHandler((error, isFatal) => { + if (this.config.captureUncaught && this.config.shouldSend()) { + this.error(error, undefined, (queued) => { + if (previousHandler) { + previousHandler(error, isFatal); + } + }); + } else if (previousHandler) { + previousHandler(error, isFatal); + } + }); + } + } + + captureUnhandledRejections = () => { + const tracking = require('promise/setimmediate/rejection-tracking'); + const client = this; + tracking.enable({ + allRejections: true, + onUnhandled: function(id, error) { client.error(error); }, + onHandled: function() {} + }); + } + + log = (obj, extra, callback) => { + if (this.isNative && !this.config.shouldSend()) { + if (callback) { + callback(false); + } + return; + } + + this.rollbar.log(obj, extra, callback); + } + + debug = (obj, extra, callback) => { + return this.rollbar.debug(obj, extra, callback); + } + + info = (obj, extra, callback) => { + return this.rollbar.info(obj, extra, callback); + } + + warning = (obj, extra, callback) => { + return this.rollbar.warning(obj, extra, callback); + } + + error = (obj, extra, callback) => { + return this.rollbar.error(obj, extra, callback); + } + + critical = (obj, extra, callback) => { + return this.rollbar.critical(obj, extra, callback); + } + + setPerson = (id, name, email) => { + this.rollbar.configure({}, {person: {id, name, email}}); + if (NativeClient) { + NativeClient.setPerson({id, name, email}); + } + } + + clearPerson = () => { + this.rollbar.configure({}, {person: {}}); + if (NativeClient) { + NativeClient.clearPerson(); + } + } +} + +class Configuration { + constructor(options) { + const pkgData = require('../package.json'); + + // Ensure captureDeviceInfo is set before calling payloadOptions() below. + this.captureDeviceInfo = options.captureDeviceInfo === undefined ? false : options.captureDeviceInfo; + + this.options = merge(options || {}, { + payload: merge(options.payload, this.payloadOptions()), + notifier: { + name: 'rollbar-react-native', + version: pkgData['version'] + } + }); + } + + shouldSend = () => { + return !this.releaseStage || + !this.enabledReleaseStages || + this.enabledReleaseStages.includes(this.releaseStage); + } + + setPlatform = (platform) => { + if (this.platform === undefined) { + this.platform = platform; + } + } + + payloadOptions = () => { + if (!this.captureDeviceInfo) { + return {}; + } + + return { + client: { + os: this.deviceAttributes() + } + } + } + + deviceAttributes = () => { + if (NativeClient) { + return JSON.parse(NativeClient.deviceAttributes()); + } else { + return {}; + } + } + + toJSON = () => { + return merge(this.options, { + platform: this.platform + }); + } +} diff --git a/src/Rollbar.js b/src/Rollbar.js index 99853a0..d1d5e2a 100644 --- a/src/Rollbar.js +++ b/src/Rollbar.js @@ -1,205 +1,3 @@ -import { Platform, NativeModules } from 'react-native'; +import Rollbar from 'rollbar'; -import Rollbar from 'rollbar/src/react-native/rollbar'; - -import { merge } from '../src/merge'; - -const NativeClient = NativeModules.RollbarReactNative; - -export class Client { - constructor(config) { - if (config instanceof Configuration) { - this.config = config; - } else { - this.config = new Configuration(config); - } - this.config.setPlatform(Platform.OS); - - this.rollbar = new Rollbar(this.config.toJSON()); - - if (NativeClient) { - NativeClient.init(this.config.toJSON()); - } - - this.captureUncaughtExceptions(); - if (this.config.captureUnhandledRejections) { - this.captureUnhandledRejections(); - } - } - - captureUncaughtExceptions = () => { - if (ErrorUtils) { - const previousHandler = ErrorUtils.getGlobalHandler(); - - ErrorUtils.setGlobalHandler((error, isFatal) => { - if (this.config.captureUncaught && this.config.shouldSend()) { - this.error(error, undefined, (queued) => { - if (previousHandler) { - previousHandler(error, isFatal); - } - }); - } else if (previousHandler) { - previousHandler(error, isFatal); - } - }); - } - } - - captureUnhandledRejections = () => { - const tracking = require('promise/setimmediate/rejection-tracking'); - const client = this; - tracking.enable({ - allRejections: true, - onUnhandled: function(id, error) { client.error(error); }, - onHandled: function() {} - }); - } - - log = (obj, extra, callback) => { - if (!this.config.shouldSend()) { - if (callback) { - callback(false); - } - return; - } - - this.rollbar.log(obj, extra, callback); - } - - debug = (obj, extra, callback) => { - return this.rollbar.debug(obj, extra, callback); - } - - info = (obj, extra, callback) => { - return this.rollbar.info(obj, extra, callback); - } - - warning = (obj, extra, callback) => { - return this.rollbar.warning(obj, extra, callback); - } - - error = (obj, extra, callback) => { - return this.rollbar.error(obj, extra, callback); - } - - critical = (obj, extra, callback) => { - return this.rollbar.critical(obj, extra, callback); - } - - setPerson = (id, name, email) => { - this.rollbar.setPerson({id, name, email}); - if (NativeClient) { - NativeClient.setPerson({id, name, email}); - } - } - - clearPerson = () => { - this.rollbar.clearPerson(); - if (NativeClient) { - NativeClient.clearPerson(); - } - } -} - -export class Configuration { - constructor(accessToken, options) { - options = options || {}; - const pkgData = require('../package.json'); - this.version = pkgData['version']; - this.accessToken = accessToken; - this.environment = options.environment; - this.logLevel = options.logLevel || 'debug'; - this.reportLevel = options.reportLevel || undefined; - this.endpoint = options.endpoint || undefined; - this.appVersion = options.appVersion || undefined; - this.codeBundleId = options.codeBundleId || undefined; - this.releaseStage = options.releaseStage || undefined; - this.enabledReleaseStages = options.enabledReleaseStages || undefined; - this.captureUncaught = options.captureUncaught !== undefined ? options.captureUncaught : true; - this.captureUnhandledRejections = options.captureUnhandledRejections !== undefined ? options.captureUnhandledRejections : !__DEV__; - - // Ensure captureDeviceInfo is set before calling payloadOptions() below. - this.captureDeviceInfo = options.captureDeviceInfo === undefined ? false : options.captureDeviceInfo; - this.payload = merge(options.payload, this.payloadOptions()); - this.enabled = options.enabled === undefined ? true : options.enabled; - this.verbose = options.verbose || false; - this.transform = options.transform; - this.rewriteFilenamePatterns = options.rewriteFilenamePatterns; - this.scrubFields = options.scrubFields || undefined; - this.overwriteScrubFields = options.overwriteScrubFields || undefined; - this.onSendCallback = options.onSendCallback || undefined; - this.checkIgnore = options.checkIgnore || undefined; - this.ignoreDuplicateErrors = options.ignoreDuplicateErrors !== undefined ? options.ignoreDuplicateErrors : undefined; - } - - shouldSend = () => { - return !this.releaseStage || - !this.enabledReleaseStages || - this.enabledReleaseStages.includes(this.releaseStage); - } - - setPlatform = (platform) => { - if (this.platform === undefined) { - if (platform === 'ios' || platform === 'android') { - this.platform = platform; - } else { - this.platform = 'client'; - } - } - } - - payloadOptions = () => { - if (!this.captureDeviceInfo) { - return {}; - } - - return { - client: { - os: this.deviceAttributes() - } - } - } - - deviceAttributes = () => { - if (NativeClient) { - return JSON.parse(NativeClient.deviceAttributes()); - } else { - return {}; - } - } - - toJSON = () => { - var result = { - accessToken: this.accessToken, - endpoint: this.endpoint, - platform: this.platform, - logLevel: this.logLevel, - reportLevel: this.reportLevel, - enabled: this.enabled, - verbose: this.verbose, - captureDeviceInfo: this.captureDeviceInfo, - transform: this.transform, - rewriteFilenamePatterns: this.rewriteFilenamePatterns, - scrubFields: this.scrubFields, - overwriteScrubFields: this.overwriteScrubFields, - onSendCallback: this.onSendCallback, - checkIgnore: this.checkIgnore, - ignoreDuplicateErrors: this.ignoreDuplicateErrors, - payload: { - codeBundleId: this.codeBundleId, - releaseStage: this.releaseStage, - enabledReleaseStages: this.enabledReleaseStages, - appVersion: this.appVersion, - ...this.payload - }, - notifier: { - name: 'rollbar-react-native', - version: this.version - } - }; - if (this.environment) { - result.environment = this.environment; - } - return result; - } -} +export default Rollbar; diff --git a/src/Rollbar.native.js b/src/Rollbar.native.js new file mode 100644 index 0000000..06c8617 --- /dev/null +++ b/src/Rollbar.native.js @@ -0,0 +1,3 @@ +import Rollbar from 'rollbar/src/react-native/rollbar'; + +export default Rollbar; diff --git a/yarn.lock b/yarn.lock index f80eb42..0d9cde0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -598,10 +598,6 @@ async-each@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" -async@~1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/async/-/async-1.2.1.tgz#a4816a17cd5ff516dfa2c7698a453369b9790de0" - atob@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" @@ -779,10 +775,6 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -console-polyfill@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/console-polyfill/-/console-polyfill-0.3.0.tgz#84900902a18c47a5eba932be75fa44d23e8af861" - convert-source-map@^1.1.0, convert-source-map@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" @@ -815,12 +807,6 @@ debug@^4.1.0: dependencies: ms "^2.1.1" -decache@^3.0.5: - version "3.1.0" - resolved "https://registry.yarnpkg.com/decache/-/decache-3.1.0.tgz#4f5036fbd6581fcc97237ac3954a244b9536c2da" - dependencies: - find "^0.2.4" - decode-uri-component@^0.2.0: version "0.2.2" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" @@ -845,12 +831,6 @@ define-property@^2.0.2: is-descriptor "^1.0.2" isobject "^3.0.1" -error-stack-parser@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/error-stack-parser/-/error-stack-parser-2.0.4.tgz#a757397dc5d9de973ac9a5d7d4e8ade7cfae9101" - dependencies: - stackframe "^1.1.0" - escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -914,12 +894,6 @@ fill-range@^4.0.0: repeat-string "^1.6.1" to-regex-range "^2.1.0" -find@^0.2.4: - version "0.2.7" - resolved "https://registry.yarnpkg.com/find/-/find-0.2.7.tgz#7afbd00f8f08c5b622f97cda6f714173d547bb3f" - dependencies: - traverse-chain "~0.1.0" - for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" @@ -1123,10 +1097,6 @@ is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" -is_js@^0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/is_js/-/is_js-0.9.0.tgz#0ab94540502ba7afa24c856aa985561669e9c52d" - isarray@1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -1157,10 +1127,6 @@ jsesc@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" -json-stringify-safe@~5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - json5@^2.1.2: version "2.1.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.3.tgz#c9b0f7fa9233bfe5807fe66fcf3a5617ed597d43" @@ -1198,10 +1164,6 @@ loose-envify@^1.0.0: dependencies: js-tokens "^3.0.0" -lru-cache@~2.2.1: - version "2.2.4" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.2.4.tgz#6c658619becf14031d0d0b594b16042ce4dc063d" - make-dir@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" @@ -1443,12 +1405,6 @@ repeat-string@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" -request-ip@~2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/request-ip/-/request-ip-2.0.2.tgz#deeae6d4af21768497db8cd05fa37143f8f1257e" - dependencies: - is_js "^0.9.0" - resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" @@ -1463,22 +1419,6 @@ ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" -rollbar@^2.21.1: - version "2.21.1" - resolved "https://registry.yarnpkg.com/rollbar/-/rollbar-2.21.1.tgz#482c3b2ea0d65e774352da3e89eeaf4679ee9970" - integrity sha512-HROzV6rV0BYxzZpOlDKUSV/RdyHMuCm9gknIGk+FYPVAUwbXCrwZeiYwuc5n3MLnX+IPBVzatzJsiNOJzngNGg== - dependencies: - async "~1.2.1" - console-polyfill "0.3.0" - error-stack-parser "^2.0.4" - json-stringify-safe "~5.0.0" - lru-cache "~2.2.1" - request-ip "~2.0.1" - source-map "^0.5.7" - uuid "3.0.x" - optionalDependencies: - decache "^3.0.5" - safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" @@ -1547,7 +1487,7 @@ source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" -source-map@^0.5.0, source-map@^0.5.6, source-map@^0.5.7: +source-map@^0.5.0, source-map@^0.5.6: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" @@ -1557,10 +1497,6 @@ split-string@^3.0.1, split-string@^3.0.2: dependencies: extend-shallow "^3.0.0" -stackframe@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.1.0.tgz#e3fc2eb912259479c9822f7d1f1ff365bd5cbc83" - static-extend@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" @@ -1606,10 +1542,6 @@ to-regex@^3.0.1, to-regex@^3.0.2: regex-not "^1.0.2" safe-regex "^1.1.0" -traverse-chain@~0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/traverse-chain/-/traverse-chain-0.1.0.tgz#61dbc2d53b69ff6091a12a168fd7d433107e40f1" - trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" @@ -1672,10 +1604,6 @@ util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" -uuid@3.0.x: - version "3.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" - wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"