Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NATIVE_SDK_VERSIONS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
| React Native | iOS Bridge / iOS SDK | Android Bridge / Android SDK |
|-------------|---------------------|-----------------------------|
| 3.0.1 | 3.4.0 | 3.4.0 |
| 3.0.0 | 3.4.0 | 3.4.0 |
| 2.14.1 | 2.30.2 | 2.26.2 |
| 2.14.0 | 2.30.2 | 2.26.2 |
Expand Down
12 changes: 6 additions & 6 deletions benchmarks/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PODS:
- DatadogInternal (= 3.4.0)
- DatadogRUM (3.4.0):
- DatadogInternal (= 3.4.0)
- DatadogSDKReactNative (3.0.0):
- DatadogSDKReactNative (3.0.1):
- DatadogCore (= 3.4.0)
- DatadogCrashReporting (= 3.4.0)
- DatadogLogs (= 3.4.0)
Expand All @@ -37,7 +37,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- DatadogSDKReactNativeSessionReplay (3.0.0):
- DatadogSDKReactNativeSessionReplay (3.0.1):
- DatadogSDKReactNative
- DatadogSessionReplay (= 3.4.0)
- DoubleConversion
Expand All @@ -60,7 +60,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- DatadogSDKReactNativeWebView (3.0.0):
- DatadogSDKReactNativeWebView (3.0.1):
- DatadogInternal (= 3.4.0)
- DatadogSDKReactNative
- DatadogWebViewTracking (= 3.4.0)
Expand Down Expand Up @@ -2075,9 +2075,9 @@ SPEC CHECKSUMS:
DatadogInternal: b0372935ad8dde5ad06960fe8d88c39b2cc92bcc
DatadogLogs: 484bb1bfe0c9a7cb2a7d9733f61614e8ea7b2f3a
DatadogRUM: 00069b27918e0ce4a9223b87b4bfa7929d6a0a1f
DatadogSDKReactNative: 7e6f0c40720299e8463ca27a4c13583572818c6d
DatadogSDKReactNativeSessionReplay: b50d5d7cf696f9c709911d322ce228110030881e
DatadogSDKReactNativeWebView: c4ccb711e5da1ba1d08ae472ff967e0bc17167e6
DatadogSDKReactNative: 677a3922ea017a2368f334084d5c46d1ee659ca5
DatadogSDKReactNativeSessionReplay: 2533da0c4d079247a187c7a91b575b10e7d75e5a
DatadogSDKReactNativeWebView: 2bd9fb2f499aefc1795c73f899caa625a2ea513c
DatadogSessionReplay: 462a3a2e39e9e2193528cf572c8d1acfd6cdace1
DatadogTrace: 852cb80f9370eb1321eb30a73c82c8e3d9e4e980
DatadogWebViewTracking: 32dfeaf7aad47a605a689ed12e0d21ee8eb56141
Expand Down
6 changes: 3 additions & 3 deletions example-new-architecture/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PODS:
- DatadogInternal (= 3.5.0)
- DatadogRUM (3.5.0):
- DatadogInternal (= 3.5.0)
- DatadogSDKReactNative (3.0.0):
- DatadogSDKReactNative (3.0.1):
- DatadogCore (= 3.5.0)
- DatadogCrashReporting (= 3.5.0)
- DatadogFlags (= 3.5.0)
Expand Down Expand Up @@ -41,7 +41,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- DatadogSDKReactNative/Tests (3.0.0):
- DatadogSDKReactNative/Tests (3.0.1):
- DatadogCore (= 3.5.0)
- DatadogCrashReporting (= 3.5.0)
- DatadogFlags (= 3.5.0)
Expand Down Expand Up @@ -1872,7 +1872,7 @@ SPEC CHECKSUMS:
DatadogInternal: 63308b529cd87fb2f99c5961d9ff13afb300a3aa
DatadogLogs: be538def1d5204e011f7952915ad0261014a0dd5
DatadogRUM: cffc65659ce29546fcc2639a74003135259548fc
DatadogSDKReactNative: ab55448d4e1fd641f08091f0329d2f1cfe0e5c78
DatadogSDKReactNative: 450c24bdfee5253725c655bd41b29f5a49dfafc6
DatadogTrace: 085e35f9e4889f82f8a747922c58ea4b19728720
DatadogWebViewTracking: 61b8344da898cbaccffc75bc1a17c86175e8573a
DoubleConversion: f16ae600a246532c4020132d54af21d0ddb2a385
Expand Down
18 changes: 9 additions & 9 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PODS:
- DatadogInternal (= 3.5.0)
- DatadogRUM (3.5.0):
- DatadogInternal (= 3.5.0)
- DatadogSDKReactNative (3.0.0):
- DatadogSDKReactNative (3.0.1):
- DatadogCore (= 3.5.0)
- DatadogCrashReporting (= 3.5.0)
- DatadogFlags (= 3.5.0)
Expand All @@ -22,7 +22,7 @@ PODS:
- DatadogTrace (= 3.5.0)
- DatadogWebViewTracking (= 3.5.0)
- React-Core
- DatadogSDKReactNative/Tests (3.0.0):
- DatadogSDKReactNative/Tests (3.0.1):
- DatadogCore (= 3.5.0)
- DatadogCrashReporting (= 3.5.0)
- DatadogFlags (= 3.5.0)
Expand All @@ -31,7 +31,7 @@ PODS:
- DatadogTrace (= 3.5.0)
- DatadogWebViewTracking (= 3.5.0)
- React-Core
- DatadogSDKReactNativeSessionReplay (3.0.0):
- DatadogSDKReactNativeSessionReplay (3.0.1):
- DatadogSDKReactNative
- DatadogSessionReplay (= 3.5.0)
- DoubleConversion
Expand All @@ -54,7 +54,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- DatadogSDKReactNativeSessionReplay/Tests (3.0.0):
- DatadogSDKReactNativeSessionReplay/Tests (3.0.1):
- DatadogSDKReactNative
- DatadogSessionReplay (= 3.5.0)
- DoubleConversion
Expand All @@ -78,12 +78,12 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- DatadogSDKReactNativeWebView (3.0.0):
- DatadogSDKReactNativeWebView (3.0.1):
- DatadogInternal (= 3.5.0)
- DatadogSDKReactNative
- DatadogWebViewTracking (= 3.5.0)
- React-Core
- DatadogSDKReactNativeWebView/Tests (3.0.0):
- DatadogSDKReactNativeWebView/Tests (3.0.1):
- DatadogInternal (= 3.5.0)
- DatadogSDKReactNative
- DatadogWebViewTracking (= 3.5.0)
Expand Down Expand Up @@ -2010,9 +2010,9 @@ SPEC CHECKSUMS:
DatadogInternal: 63308b529cd87fb2f99c5961d9ff13afb300a3aa
DatadogLogs: be538def1d5204e011f7952915ad0261014a0dd5
DatadogRUM: cffc65659ce29546fcc2639a74003135259548fc
DatadogSDKReactNative: bf3df9195b39491ba37cea90c3924d807ae60036
DatadogSDKReactNativeSessionReplay: 701ca8bfed785f9046b6defd779e0e23e43ce944
DatadogSDKReactNativeWebView: 61b027a096421adc7288f286d479a2344246f4bd
DatadogSDKReactNative: 9a2b0ddb2c2f3c5a255f64d100efaec0c82b8f6c
DatadogSDKReactNativeSessionReplay: 86ca130e20fa552a104ea77b324d007ece3a0939
DatadogSDKReactNativeWebView: 898d016bd2921280cbb89983863220250afaa45f
DatadogSessionReplay: eea291df0135ec792177be1ffc4951750a66a011
DatadogTrace: 085e35f9e4889f82f8a747922c58ea4b19728720
DatadogWebViewTracking: 61b8344da898cbaccffc75bc1a17c86175e8573a
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"npmClient": "yarn",
"version": "3.0.0",
"version": "3.0.1",
"packages": [
"packages/*"
],
Expand Down
6 changes: 3 additions & 3 deletions packages/codepush/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@datadog/mobile-react-native-code-push",
"version": "3.0.0",
"version": "3.0.1",
"description": "A client-side React Native module to interact with Appcenter Codepush and Datadog",
"keywords": [
"datadog",
Expand Down Expand Up @@ -38,13 +38,13 @@
"prepare": "rm -rf lib && yarn bob build"
},
"devDependencies": {
"@datadog/mobile-react-native": "workspace:3.0.0",
"@datadog/mobile-react-native": "workspace:3.0.1",
"@testing-library/react-native": "7.0.2",
"react-native-builder-bob": "0.26.0",
"react-native-code-push": "7.1.0"
},
"peerDependencies": {
"@datadog/mobile-react-native": "^2.0.1",
"@datadog/mobile-react-native": "^3.0.0",
"react": ">=16.13.1",
"react-native": ">=0.63.4 <1.0",
"react-native-code-push": ">=2.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
package com.datadog.reactnative

// This is automatically updated by the update-version.sh script
internal const val SDK_VERSION = "3.0.0"
internal const val SDK_VERSION = "3.0.1"
2 changes: 1 addition & 1 deletion packages/core/ios/Sources/SdkVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
import Foundation

// This is automatically updated by the update-version.sh script
let SdkVersion = "3.0.0"
let SdkVersion = "3.0.1"
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@datadog/mobile-react-native",
"version": "3.0.0",
"version": "3.0.1",
"description": "A client-side React Native module to interact with Datadog",
"keywords": [
"datadog",
Expand Down
61 changes: 24 additions & 37 deletions packages/core/src/flags/FlagsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ export class FlagsClient {
});
};

private getDetails = <T>(key: string, defaultValue: T): FlagDetails<T> => {
private getDetails = <T>(
key: string,
defaultValue: T,
type: 'boolean' | 'string' | 'number' | 'object'
): FlagDetails<T> => {
if (!this.evaluationContext) {
return {
key,
Expand All @@ -120,6 +124,18 @@ export class FlagsClient {
};
}

// Validate the expected type against the actual flag value type.
const actualType = typeof flag.value;
if (actualType !== type) {
return {
key,
value: defaultValue,
reason: 'ERROR',
errorCode: 'TYPE_MISMATCH',
errorMessage: `Flag "${key}" returned a value of type "${typeof flag.value}". Use the corresponding method instead of the one expecting "${type}".`
};
}

this.track(flag, this.evaluationContext);

const details: FlagDetails<T> = {
Expand All @@ -143,17 +159,7 @@ export class FlagsClient {
key: string,
defaultValue: boolean
): FlagDetails<boolean> => {
if (typeof defaultValue !== 'boolean') {
return {
key,
value: defaultValue,
reason: 'ERROR',
errorCode: 'TYPE_MISMATCH',
errorMessage: 'Provided `defaultValue` is not a boolean.'
};
}

return this.getDetails(key, defaultValue);
return this.getDetails(key, defaultValue, 'boolean');
};

/**
Expand All @@ -166,17 +172,7 @@ export class FlagsClient {
key: string,
defaultValue: string
): FlagDetails<string> => {
if (typeof defaultValue !== 'string') {
return {
key,
value: defaultValue,
reason: 'ERROR',
errorCode: 'TYPE_MISMATCH',
errorMessage: 'Provided `defaultValue` is not a string.'
};
}

return this.getDetails(key, defaultValue);
return this.getDetails(key, defaultValue, 'string');
};

/**
Expand All @@ -189,32 +185,23 @@ export class FlagsClient {
key: string,
defaultValue: number
): FlagDetails<number> => {
if (typeof defaultValue !== 'number') {
return {
key,
value: defaultValue,
reason: 'ERROR',
errorCode: 'TYPE_MISMATCH',
errorMessage: 'Provided `defaultValue` is not a number.'
};
}

return this.getDetails(key, defaultValue);
return this.getDetails(key, defaultValue, 'number');
};

/**
* Evaluate a JSON feature flag with detailed evaluation information.
*
* Even though the `defaultValue` is typed as `JsonValue`, the flag value should be a valid JSON object.
* Please use other typed methods to evaluate flags with primitive values.
*
* @param key The key of the flag to evaluate.
* @param defaultValue Fallback value for when flag evaluation fails, flag is not found, or the client does not have an evaluation context set.
*/
getObjectDetails = <T extends JsonValue>(
key: string,
defaultValue: T
): FlagDetails<T> => {
// OpenFeature provider spec assumes `defaultValue` can be any JSON value (including primitves) so no validation here.

return this.getDetails(key, defaultValue);
return this.getDetails(key, defaultValue, 'object');
};

/**
Expand Down
Loading