@datadog/mobile-react-native-openfeature 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +117 -0
  3. package/lib/commonjs/index.js +13 -0
  4. package/lib/commonjs/index.js.map +1 -0
  5. package/lib/commonjs/provider.js +106 -0
  6. package/lib/commonjs/provider.js.map +1 -0
  7. package/lib/module/index.js +9 -0
  8. package/lib/module/index.js.map +1 -0
  9. package/lib/module/provider.js +99 -0
  10. package/lib/module/provider.js.map +1 -0
  11. package/lib/typescript/core/src/DdAttributes.d.ts +20 -0
  12. package/lib/typescript/core/src/DdAttributes.d.ts.map +1 -0
  13. package/lib/typescript/core/src/DdSdkReactNative.d.ts +122 -0
  14. package/lib/typescript/core/src/DdSdkReactNative.d.ts.map +1 -0
  15. package/lib/typescript/core/src/InternalLog.d.ts +13 -0
  16. package/lib/typescript/core/src/InternalLog.d.ts.map +1 -0
  17. package/lib/typescript/core/src/config/DatadogProviderConfiguration.d.ts +12 -0
  18. package/lib/typescript/core/src/config/DatadogProviderConfiguration.d.ts.map +1 -0
  19. package/lib/typescript/core/src/config/FileBasedConfiguration.d.ts +17 -0
  20. package/lib/typescript/core/src/config/FileBasedConfiguration.d.ts.map +1 -0
  21. package/lib/typescript/core/src/config/FileBasedConfiguration.type.d.ts +52 -0
  22. package/lib/typescript/core/src/config/FileBasedConfiguration.type.d.ts.map +1 -0
  23. package/lib/typescript/core/src/config/async/AutoInstrumentationConfiguration.d.ts +60 -0
  24. package/lib/typescript/core/src/config/async/AutoInstrumentationConfiguration.d.ts.map +1 -0
  25. package/lib/typescript/core/src/config/async/PartialInitializationConfiguration.d.ts +47 -0
  26. package/lib/typescript/core/src/config/async/PartialInitializationConfiguration.d.ts.map +1 -0
  27. package/lib/typescript/core/src/config/async/asyncInitializationHelper.d.ts +5 -0
  28. package/lib/typescript/core/src/config/async/asyncInitializationHelper.d.ts.map +1 -0
  29. package/lib/typescript/core/src/config/features/CoreConfiguration.d.ts +52 -0
  30. package/lib/typescript/core/src/config/features/CoreConfiguration.d.ts.map +1 -0
  31. package/lib/typescript/core/src/config/features/CoreConfiguration.type.d.ts +90 -0
  32. package/lib/typescript/core/src/config/features/CoreConfiguration.type.d.ts.map +1 -0
  33. package/lib/typescript/core/src/config/features/CoreConfigurationNative.d.ts +54 -0
  34. package/lib/typescript/core/src/config/features/CoreConfigurationNative.d.ts.map +1 -0
  35. package/lib/typescript/core/src/config/features/LogsConfiguration.d.ts +17 -0
  36. package/lib/typescript/core/src/config/features/LogsConfiguration.d.ts.map +1 -0
  37. package/lib/typescript/core/src/config/features/LogsConfiguration.type.d.ts +24 -0
  38. package/lib/typescript/core/src/config/features/LogsConfiguration.type.d.ts.map +1 -0
  39. package/lib/typescript/core/src/config/features/LogsConfigurationNative.d.ts +6 -0
  40. package/lib/typescript/core/src/config/features/LogsConfigurationNative.d.ts.map +1 -0
  41. package/lib/typescript/core/src/config/features/RumConfiguration.d.ts +66 -0
  42. package/lib/typescript/core/src/config/features/RumConfiguration.d.ts.map +1 -0
  43. package/lib/typescript/core/src/config/features/RumConfiguration.type.d.ts +131 -0
  44. package/lib/typescript/core/src/config/features/RumConfiguration.type.d.ts.map +1 -0
  45. package/lib/typescript/core/src/config/features/RumConfigurationNative.d.ts +25 -0
  46. package/lib/typescript/core/src/config/features/RumConfigurationNative.d.ts.map +1 -0
  47. package/lib/typescript/core/src/config/features/TraceConfiguration.d.ts +10 -0
  48. package/lib/typescript/core/src/config/features/TraceConfiguration.d.ts.map +1 -0
  49. package/lib/typescript/core/src/config/features/TraceConfiguration.type.d.ts +11 -0
  50. package/lib/typescript/core/src/config/features/TraceConfiguration.type.d.ts.map +1 -0
  51. package/lib/typescript/core/src/config/features/TraceConfigurationNative.d.ts +4 -0
  52. package/lib/typescript/core/src/config/features/TraceConfigurationNative.d.ts.map +1 -0
  53. package/lib/typescript/core/src/config/types/BatchProcessingLevel.d.ts +18 -0
  54. package/lib/typescript/core/src/config/types/BatchProcessingLevel.d.ts.map +1 -0
  55. package/lib/typescript/core/src/config/types/BatchSize.d.ts +19 -0
  56. package/lib/typescript/core/src/config/types/BatchSize.d.ts.map +1 -0
  57. package/lib/typescript/core/src/config/types/InitializationMode.d.ts +5 -0
  58. package/lib/typescript/core/src/config/types/InitializationMode.d.ts.map +1 -0
  59. package/lib/typescript/core/src/config/types/InitializationModeForTelemetry.d.ts +2 -0
  60. package/lib/typescript/core/src/config/types/InitializationModeForTelemetry.d.ts.map +1 -0
  61. package/lib/typescript/core/src/config/types/ProxyConfiguration.d.ts +49 -0
  62. package/lib/typescript/core/src/config/types/ProxyConfiguration.d.ts.map +1 -0
  63. package/lib/typescript/core/src/config/types/SdkVerbosity.d.ts +10 -0
  64. package/lib/typescript/core/src/config/types/SdkVerbosity.d.ts.map +1 -0
  65. package/lib/typescript/core/src/config/types/TrackingConsent.d.ts +9 -0
  66. package/lib/typescript/core/src/config/types/TrackingConsent.d.ts.map +1 -0
  67. package/lib/typescript/core/src/config/types/UploadFrequency.d.ts +18 -0
  68. package/lib/typescript/core/src/config/types/UploadFrequency.d.ts.map +1 -0
  69. package/lib/typescript/core/src/config/types/VitalsUpdateFrequency.d.ts +7 -0
  70. package/lib/typescript/core/src/config/types/VitalsUpdateFrequency.d.ts.map +1 -0
  71. package/lib/typescript/core/src/config/types/index.d.ts +10 -0
  72. package/lib/typescript/core/src/config/types/index.d.ts.map +1 -0
  73. package/lib/typescript/core/src/flags/DdFlags.d.ts +3 -0
  74. package/lib/typescript/core/src/flags/DdFlags.d.ts.map +1 -0
  75. package/lib/typescript/core/src/flags/FlagsClient.d.ts +114 -0
  76. package/lib/typescript/core/src/flags/FlagsClient.d.ts.map +1 -0
  77. package/lib/typescript/core/src/flags/internal.d.ts +14 -0
  78. package/lib/typescript/core/src/flags/internal.d.ts.map +1 -0
  79. package/lib/typescript/core/src/flags/types.d.ts +202 -0
  80. package/lib/typescript/core/src/flags/types.d.ts.map +1 -0
  81. package/lib/typescript/core/src/index.d.ts +41 -0
  82. package/lib/typescript/core/src/index.d.ts.map +1 -0
  83. package/lib/typescript/core/src/logs/DdLogs.d.ts +24 -0
  84. package/lib/typescript/core/src/logs/DdLogs.d.ts.map +1 -0
  85. package/lib/typescript/core/src/logs/eventMapper.d.ts +13 -0
  86. package/lib/typescript/core/src/logs/eventMapper.d.ts.map +1 -0
  87. package/lib/typescript/core/src/logs/types.d.ts +74 -0
  88. package/lib/typescript/core/src/logs/types.d.ts.map +1 -0
  89. package/lib/typescript/core/src/metro/debugIdResolver.d.ts +3 -0
  90. package/lib/typescript/core/src/metro/debugIdResolver.d.ts.map +1 -0
  91. package/lib/typescript/core/src/nativeModulesTypes.d.ts +86 -0
  92. package/lib/typescript/core/src/nativeModulesTypes.d.ts.map +1 -0
  93. package/lib/typescript/core/src/rum/DdRum.d.ts +59 -0
  94. package/lib/typescript/core/src/rum/DdRum.d.ts.map +1 -0
  95. package/lib/typescript/core/src/rum/constants.d.ts +2 -0
  96. package/lib/typescript/core/src/rum/constants.d.ts.map +1 -0
  97. package/lib/typescript/core/src/rum/eventMappers/actionEventMapper.d.ts +22 -0
  98. package/lib/typescript/core/src/rum/eventMappers/actionEventMapper.d.ts.map +1 -0
  99. package/lib/typescript/core/src/rum/eventMappers/errorEventMapper.d.ts +24 -0
  100. package/lib/typescript/core/src/rum/eventMappers/errorEventMapper.d.ts.map +1 -0
  101. package/lib/typescript/core/src/rum/eventMappers/resourceEventMapper.d.ts +25 -0
  102. package/lib/typescript/core/src/rum/eventMappers/resourceEventMapper.d.ts.map +1 -0
  103. package/lib/typescript/core/src/rum/helper.d.ts +10 -0
  104. package/lib/typescript/core/src/rum/helper.d.ts.map +1 -0
  105. package/lib/typescript/core/src/rum/instrumentation/DdRumErrorTracking.d.ts +17 -0
  106. package/lib/typescript/core/src/rum/instrumentation/DdRumErrorTracking.d.ts.map +1 -0
  107. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts +38 -0
  108. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts.map +1 -0
  109. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts +25 -0
  110. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts.map +1 -0
  111. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +29 -0
  112. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts.map +1 -0
  113. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/EventsInterceptor.d.ts +4 -0
  114. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/EventsInterceptor.d.ts.map +1 -0
  115. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.d.ts +5 -0
  116. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.d.ts.map +1 -0
  117. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.d.ts +8 -0
  118. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.d.ts.map +1 -0
  119. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/ddBabelUtils.d.ts +9 -0
  120. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/ddBabelUtils.d.ts.map +1 -0
  121. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/getJsxRuntime.d.ts +2 -0
  122. package/lib/typescript/core/src/rum/instrumentation/interactionTracking/getJsxRuntime.d.ts.map +1 -0
  123. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +23 -0
  124. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -0
  125. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.d.ts +46 -0
  126. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.d.ts.map +1 -0
  127. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingIdentifier.d.ts +24 -0
  128. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingIdentifier.d.ts.map +1 -0
  129. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts +121 -0
  130. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts.map +1 -0
  131. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +14 -0
  132. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts.map +1 -0
  133. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.d.ts +20 -0
  134. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.d.ts.map +1 -0
  135. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +11 -0
  136. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts.map +1 -0
  137. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.d.ts +12 -0
  138. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.d.ts.map +1 -0
  139. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +9 -0
  140. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts.map +1 -0
  141. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/headers.d.ts +24 -0
  142. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/headers.d.ts.map +1 -0
  143. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.d.ts +4 -0
  144. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.d.ts.map +1 -0
  145. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/headers.d.ts +4 -0
  146. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/headers.d.ts.map +1 -0
  147. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.d.ts +9 -0
  148. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.d.ts.map +1 -0
  149. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.d.ts +7 -0
  150. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.d.ts.map +1 -0
  151. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.d.ts +18 -0
  152. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.d.ts.map +1 -0
  153. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.d.ts +7 -0
  154. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.d.ts.map +1 -0
  155. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +22 -0
  156. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -0
  157. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.d.ts +6 -0
  158. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.d.ts.map +1 -0
  159. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.d.ts +3 -0
  160. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.d.ts.map +1 -0
  161. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts +14 -0
  162. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts.map +1 -0
  163. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +28 -0
  164. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts.map +1 -0
  165. package/lib/typescript/core/src/rum/types.d.ts +218 -0
  166. package/lib/typescript/core/src/rum/types.d.ts.map +1 -0
  167. package/lib/typescript/core/src/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts +15 -0
  168. package/lib/typescript/core/src/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts.map +1 -0
  169. package/lib/typescript/core/src/sdk/AccountInfoSingleton/types.d.ts +6 -0
  170. package/lib/typescript/core/src/sdk/AccountInfoSingleton/types.d.ts.map +1 -0
  171. package/lib/typescript/core/src/sdk/AttributesEncoding/attributesEncoding.d.ts +13 -0
  172. package/lib/typescript/core/src/sdk/AttributesEncoding/attributesEncoding.d.ts.map +1 -0
  173. package/lib/typescript/core/src/sdk/AttributesEncoding/defaultEncoders.d.ts +33 -0
  174. package/lib/typescript/core/src/sdk/AttributesEncoding/defaultEncoders.d.ts.map +1 -0
  175. package/lib/typescript/core/src/sdk/AttributesEncoding/errorUtils.d.ts +15 -0
  176. package/lib/typescript/core/src/sdk/AttributesEncoding/errorUtils.d.ts.map +1 -0
  177. package/lib/typescript/core/src/sdk/AttributesEncoding/helpers.d.ts +17 -0
  178. package/lib/typescript/core/src/sdk/AttributesEncoding/helpers.d.ts.map +1 -0
  179. package/lib/typescript/core/src/sdk/AttributesEncoding/types.d.ts +21 -0
  180. package/lib/typescript/core/src/sdk/AttributesEncoding/types.d.ts.map +1 -0
  181. package/lib/typescript/core/src/sdk/AttributesEncoding/utils.d.ts +7 -0
  182. package/lib/typescript/core/src/sdk/AttributesEncoding/utils.d.ts.map +1 -0
  183. package/lib/typescript/core/src/sdk/AttributesSingleton/AttributesSingleton.d.ts +17 -0
  184. package/lib/typescript/core/src/sdk/AttributesSingleton/AttributesSingleton.d.ts.map +1 -0
  185. package/lib/typescript/core/src/sdk/AttributesSingleton/types.d.ts +4 -0
  186. package/lib/typescript/core/src/sdk/AttributesSingleton/types.d.ts.map +1 -0
  187. package/lib/typescript/core/src/sdk/DatadogEventEmitter/DatadogBatchedBridgeEventEmitter.d.ts +11 -0
  188. package/lib/typescript/core/src/sdk/DatadogEventEmitter/DatadogBatchedBridgeEventEmitter.d.ts.map +1 -0
  189. package/lib/typescript/core/src/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.d.ts +10 -0
  190. package/lib/typescript/core/src/sdk/DatadogEventEmitter/DatadogDefaultEventEmitter.d.ts.map +1 -0
  191. package/lib/typescript/core/src/sdk/DatadogEventEmitter/DatadogEventEmitter.d.ts +7 -0
  192. package/lib/typescript/core/src/sdk/DatadogEventEmitter/DatadogEventEmitter.d.ts.map +1 -0
  193. package/lib/typescript/core/src/sdk/DatadogEventEmitter/DatadogNativeEventEmitter.d.ts +12 -0
  194. package/lib/typescript/core/src/sdk/DatadogEventEmitter/DatadogNativeEventEmitter.d.ts.map +1 -0
  195. package/lib/typescript/core/src/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.d.ts +14 -0
  196. package/lib/typescript/core/src/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.d.ts.map +1 -0
  197. package/lib/typescript/core/src/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.d.ts +6 -0
  198. package/lib/typescript/core/src/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.d.ts.map +1 -0
  199. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/BoundedBuffer.d.ts +18 -0
  200. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/BoundedBuffer.d.ts.map +1 -0
  201. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/BufferSingleton.d.ts +8 -0
  202. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/BufferSingleton.d.ts.map +1 -0
  203. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/DatadogBuffer.d.ts +21 -0
  204. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/DatadogBuffer.d.ts.map +1 -0
  205. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/PassThroughBuffer.d.ts +8 -0
  206. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/PassThroughBuffer.d.ts.map +1 -0
  207. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/bufferNativeCall.d.ts +4 -0
  208. package/lib/typescript/core/src/sdk/DatadogProvider/Buffer/bufferNativeCall.d.ts.map +1 -0
  209. package/lib/typescript/core/src/sdk/DatadogProvider/DatadogProvider.d.ts +29 -0
  210. package/lib/typescript/core/src/sdk/DatadogProvider/DatadogProvider.d.ts.map +1 -0
  211. package/lib/typescript/core/src/sdk/DatadogProvider/DatadogProviderState.d.ts +9 -0
  212. package/lib/typescript/core/src/sdk/DatadogProvider/DatadogProviderState.d.ts.map +1 -0
  213. package/lib/typescript/core/src/sdk/DdSdk.d.ts +3 -0
  214. package/lib/typescript/core/src/sdk/DdSdk.d.ts.map +1 -0
  215. package/lib/typescript/core/src/sdk/DdSdkInternal.d.ts +39 -0
  216. package/lib/typescript/core/src/sdk/DdSdkInternal.d.ts.map +1 -0
  217. package/lib/typescript/core/src/sdk/EventMappers/EventMapper.d.ts +27 -0
  218. package/lib/typescript/core/src/sdk/EventMappers/EventMapper.d.ts.map +1 -0
  219. package/lib/typescript/core/src/sdk/EventMappers/utils/deepClone.d.ts +11 -0
  220. package/lib/typescript/core/src/sdk/EventMappers/utils/deepClone.d.ts.map +1 -0
  221. package/lib/typescript/core/src/sdk/GlobalState/GlobalState.d.ts +13 -0
  222. package/lib/typescript/core/src/sdk/GlobalState/GlobalState.d.ts.map +1 -0
  223. package/lib/typescript/core/src/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +14 -0
  224. package/lib/typescript/core/src/sdk/UserInfoSingleton/UserInfoSingleton.d.ts.map +1 -0
  225. package/lib/typescript/core/src/sdk/UserInfoSingleton/types.d.ts +7 -0
  226. package/lib/typescript/core/src/sdk/UserInfoSingleton/types.d.ts.map +1 -0
  227. package/lib/typescript/core/src/specs/NativeDdFlags.d.ts +15 -0
  228. package/lib/typescript/core/src/specs/NativeDdFlags.d.ts.map +1 -0
  229. package/lib/typescript/core/src/specs/NativeDdLogs.d.ts +70 -0
  230. package/lib/typescript/core/src/specs/NativeDdLogs.d.ts.map +1 -0
  231. package/lib/typescript/core/src/specs/NativeDdRum.d.ts +149 -0
  232. package/lib/typescript/core/src/specs/NativeDdRum.d.ts.map +1 -0
  233. package/lib/typescript/core/src/specs/NativeDdSdk.d.ts +105 -0
  234. package/lib/typescript/core/src/specs/NativeDdSdk.d.ts.map +1 -0
  235. package/lib/typescript/core/src/specs/NativeDdTrace.d.ts +24 -0
  236. package/lib/typescript/core/src/specs/NativeDdTrace.d.ts.map +1 -0
  237. package/lib/typescript/core/src/trace/DdTrace.d.ts +3 -0
  238. package/lib/typescript/core/src/trace/DdTrace.d.ts.map +1 -0
  239. package/lib/typescript/core/src/types.d.ts +130 -0
  240. package/lib/typescript/core/src/types.d.ts.map +1 -0
  241. package/lib/typescript/core/src/utils/Timer.d.ts +22 -0
  242. package/lib/typescript/core/src/utils/Timer.d.ts.map +1 -0
  243. package/lib/typescript/core/src/utils/jsUtils.d.ts +2 -0
  244. package/lib/typescript/core/src/utils/jsUtils.d.ts.map +1 -0
  245. package/lib/typescript/core/src/utils/longTasksUtils.d.ts +7 -0
  246. package/lib/typescript/core/src/utils/longTasksUtils.d.ts.map +1 -0
  247. package/lib/typescript/core/src/utils/singletonUtils.d.ts +2 -0
  248. package/lib/typescript/core/src/utils/singletonUtils.d.ts.map +1 -0
  249. package/lib/typescript/core/src/utils/time-provider/DefaultTimeProvider.d.ts +8 -0
  250. package/lib/typescript/core/src/utils/time-provider/DefaultTimeProvider.d.ts.map +1 -0
  251. package/lib/typescript/core/src/utils/time-provider/TimeProvider.d.ts +19 -0
  252. package/lib/typescript/core/src/utils/time-provider/TimeProvider.d.ts.map +1 -0
  253. package/lib/typescript/core/src/version.d.ts +2 -0
  254. package/lib/typescript/core/src/version.d.ts.map +1 -0
  255. package/lib/typescript/react-native-openfeature/src/index.d.ts +5 -0
  256. package/lib/typescript/react-native-openfeature/src/index.d.ts.map +1 -0
  257. package/lib/typescript/react-native-openfeature/src/provider.d.ts +27 -0
  258. package/lib/typescript/react-native-openfeature/src/provider.d.ts.map +1 -0
  259. package/package.json +87 -0
  260. package/src/index.ts +11 -0
  261. package/src/provider.ts +180 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2017 Datadog, Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # Datadog OpenFeature Provider for React Native
2
+
3
+ Use [OpenFeature][1] with [Datadog Feature Flags][2] to evaluate feature flags and send evaluation data to Datadog for analysis and experimentation.
4
+
5
+ OpenFeature is a vendor-neutral, community-driven specification and SDK for feature flagging. It provides a unified API for feature flag evaluation that works across different providers. This enables you to switch vendors or integrate multiple feature flag systems.
6
+
7
+ This package provides an OpenFeature-compatible provider that wraps Datadog's Feature Flags SDK.
8
+
9
+ ## Setup
10
+
11
+ **Note**: This package is an integration for the [OpenFeature React SDK][1]. Install and set up the core [`@datadog/mobile-react-native`][3] SDK to start using Datadog Feature Flags.
12
+
13
+ To install with NPM, run:
14
+
15
+ ```sh
16
+ npm install @datadog/mobile-react-native @datadog/mobile-react-native-openfeature @openfeature/react-sdk
17
+ ```
18
+
19
+ To install with Yarn, run:
20
+
21
+ ```sh
22
+ yarn add @datadog/mobile-react-native @datadog/mobile-react-native-openfeature @openfeature/react-sdk
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ### Initialize the Datadog SDK and OpenFeature
28
+
29
+ Use the following example code snippet to initialize the Datadog SDK, enable the Feature Flags feature, and set up the OpenFeature provider.
30
+
31
+ ```tsx
32
+ import { CoreConfiguration, DatadogProvider, DdFlags } from '@datadog/mobile-react-native';
33
+ import { DatadogOpenFeatureProvider } from '@datadog/mobile-react-native-openfeature';
34
+ import { OpenFeature } from '@openfeature/react-sdk';
35
+
36
+ (async () => {
37
+ // Follow the core Datadog SDK initialization guide.
38
+ const config = new CoreConfiguration(
39
+ // ...
40
+ );
41
+ await DdSdkReactNative.initialize(config);
42
+
43
+ // Enable Datadog Flags feature after the core SDK has been initialized.
44
+ await DdFlags.enable();
45
+
46
+ // Set the Datadog provider with OpenFeature.
47
+ const provider = new DatadogOpenFeatureProvider();
48
+ OpenFeature.setProvider(provider);
49
+ })();
50
+
51
+ // Alternatively, if using `<DatadogProvider />` for core SDK initialization.
52
+
53
+ <DatadogProvider
54
+ configuration={coreConfiguration}
55
+ onInitialized={async () => {
56
+ await DdFlags.enable();
57
+
58
+ const provider = new DatadogOpenFeatureProvider();
59
+ OpenFeature.setProvider(provider);
60
+ }}
61
+ >
62
+ {/* ... */}
63
+ </DatadogProvider>
64
+ ```
65
+
66
+ After completing this setup, your app is ready for flag evaluation with OpenFeature.
67
+
68
+ > **Note**: Sending flag evaluation data to Datadog is automatically enabled when using the Feature Flags SDK. Provide `rumIntegrationEnabled` and `trackExposures` parameters to the `DdFlags.enable()` call to configure.
69
+
70
+ ### Using the OpenFeature React SDK
71
+
72
+ For complete details on using the OpenFeature React SDK, including flag evaluation, evaluation context management, and advanced setup options, see the OpenFeature React SDK [documentation][1].
73
+
74
+ Short-form OpenFeature SDK usage example:
75
+
76
+ ```tsx
77
+ import { OpenFeature, OpenFeatureProvider, useFlag } from '@openfeature/react-sdk';
78
+
79
+ function AppWithProviders() {
80
+ // For advanced feature flag targeting based on current user or device.
81
+ useEffect(() => {
82
+ const user = { ... }; // Obtained from your authentication logic.
83
+
84
+ OpenFeature.setContext({
85
+ // User or anonymous ID for consistent feature flag evaluations.
86
+ targetingKey: user.id,
87
+ // Properties for more granular targeting.
88
+ region: user.country
89
+ });
90
+ }, [])
91
+
92
+ // Wrap your app with OpenFeatureProvider to allow flag evaluations throughout the app.
93
+ return (
94
+ <OpenFeatureProvider>
95
+ <App />
96
+ </OpenFeatureProvider>
97
+ );
98
+ }
99
+
100
+ function App() {
101
+ const { value: isNewFeatureEnabled } = useFlag('new-feature-enabled', false);
102
+
103
+ return (
104
+ <View>
105
+ {isNewFeatureEnabled && <NewFeatureComponent />}
106
+
107
+ {/* ... */}
108
+ </View>
109
+ )
110
+ }
111
+
112
+ export default AppWithProviders;
113
+ ```
114
+
115
+ [1]: https://openfeature.dev/docs/reference/sdks/client/web/react/
116
+ [2]: https://docs.datadoghq.com/getting_started/feature_flags/
117
+ [3]: https://github.com/DataDog/dd-sdk-reactnative/tree/develop/packages/core
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "DatadogOpenFeatureProvider", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _provider.DatadogOpenFeatureProvider;
10
+ }
11
+ });
12
+ var _provider = require("./provider");
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_provider","require"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;AAMA,IAAAA,SAAA,GAAAC,OAAA","ignoreList":[]}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DatadogOpenFeatureProvider = void 0;
7
+ var _mobileReactNative = require("@datadog/mobile-react-native");
8
+ var _webSdk = require("@openfeature/web-sdk");
9
+ /*
10
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
11
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
12
+ * Copyright 2016-Present Datadog, Inc.
13
+ */
14
+
15
+ class DatadogOpenFeatureProvider {
16
+ runsOn = 'client';
17
+ metadata = {
18
+ name: 'datadog-react-native'
19
+ };
20
+ events = new _webSdk.OpenFeatureEventEmitter();
21
+ contextChangePromise = Promise.resolve();
22
+ constructor(options = {}) {
23
+ if (!options.clientName) {
24
+ options.clientName = 'default';
25
+ }
26
+ this.options = options;
27
+ this.flagsClient = _mobileReactNative.DdFlags.getClient(this.options.clientName);
28
+ }
29
+ async initialize(context = {}) {
30
+ const ddContext = toDdContext(context);
31
+ this.contextChangePromise = this.flagsClient.setEvaluationContext(ddContext);
32
+ await this.contextChangePromise;
33
+ }
34
+ async onContextChange(_oldContext, newContext) {
35
+ const newDdContext = toDdContext(newContext);
36
+
37
+ // Promise chain in case `onContextChange` is called multiple times.
38
+ this.contextChangePromise = this.contextChangePromise.then(() => {
39
+ return this.flagsClient.setEvaluationContext(newDdContext);
40
+ });
41
+
42
+ // Wait for the current context change to complete.
43
+ await this.contextChangePromise;
44
+ }
45
+ resolveBooleanEvaluation(flagKey, defaultValue, _context, _logger) {
46
+ const details = this.flagsClient.getBooleanDetails(flagKey, defaultValue);
47
+ return toFlagResolution(details);
48
+ }
49
+ resolveStringEvaluation(flagKey, defaultValue, _context, _logger) {
50
+ const details = this.flagsClient.getStringDetails(flagKey, defaultValue);
51
+ return toFlagResolution(details);
52
+ }
53
+ resolveNumberEvaluation(flagKey, defaultValue, _context, _logger) {
54
+ const details = this.flagsClient.getNumberDetails(flagKey, defaultValue);
55
+ return toFlagResolution(details);
56
+ }
57
+ resolveObjectEvaluation(flagKey, defaultValue, _context, _logger) {
58
+ // The OpenFeature spec states that the return value can be any valid JSON value.
59
+ // However, the Datadog Flags feature only supports JSON objects for the JSON feature flag type.
60
+ // Thus, the user should always expect the returned value to be an object instead of any arbitrary JSON value.
61
+ // Also, the user is responsible for providing a proper `defaultValue` that's an object.
62
+
63
+ const details = this.flagsClient.getObjectDetails(flagKey, defaultValue);
64
+ return toFlagResolution(details);
65
+ }
66
+ }
67
+ exports.DatadogOpenFeatureProvider = DatadogOpenFeatureProvider;
68
+ const toDdContext = context => {
69
+ const {
70
+ targetingKey,
71
+ ...attributes
72
+ } = context;
73
+
74
+ // Important ⚠️
75
+ // The Flags SDK doesn't support nested non-primitive values in the evaluation context as per OF.3 FFE SDK requirement.
76
+ // However, we let the SDK handle this inside of FlagsClient since it does this processing anyways.
77
+ const ddContextAttributes = attributes;
78
+ return {
79
+ // Allow flag evaluations without a provided targeting key.
80
+ targetingKey: targetingKey ?? '',
81
+ attributes: ddContextAttributes
82
+ };
83
+ };
84
+ const toFlagResolution = details => {
85
+ const {
86
+ value,
87
+ reason,
88
+ variant,
89
+ allocationKey,
90
+ errorCode,
91
+ errorMessage
92
+ } = details;
93
+ const parsedErrorCode = errorCode && (_webSdk.ErrorCode[errorCode] || _webSdk.ErrorCode.GENERAL);
94
+ const result = {
95
+ value,
96
+ reason,
97
+ variant,
98
+ flagMetadata: allocationKey ? {
99
+ allocationKey
100
+ } : undefined,
101
+ errorCode: parsedErrorCode,
102
+ errorMessage
103
+ };
104
+ return result;
105
+ };
106
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_mobileReactNative","require","_webSdk","DatadogOpenFeatureProvider","runsOn","metadata","name","events","OpenFeatureEventEmitter","contextChangePromise","Promise","resolve","constructor","options","clientName","flagsClient","DdFlags","getClient","initialize","context","ddContext","toDdContext","setEvaluationContext","onContextChange","_oldContext","newContext","newDdContext","then","resolveBooleanEvaluation","flagKey","defaultValue","_context","_logger","details","getBooleanDetails","toFlagResolution","resolveStringEvaluation","getStringDetails","resolveNumberEvaluation","getNumberDetails","resolveObjectEvaluation","getObjectDetails","exports","targetingKey","attributes","ddContextAttributes","value","reason","variant","allocationKey","errorCode","errorMessage","parsedErrorCode","ErrorCode","GENERAL","result","flagMetadata","undefined"],"sourceRoot":"../../src","sources":["provider.ts"],"mappings":";;;;;;AAMA,IAAAA,kBAAA,GAAAC,OAAA;AAMA,IAAAC,OAAA,GAAAD,OAAA;AAZA;AACA;AACA;AACA;AACA;;AAiCO,MAAME,0BAA0B,CAAqB;EAC/CC,MAAM,GAAa,QAAQ;EAC3BC,QAAQ,GAAqB;IAClCC,IAAI,EAAE;EACV,CAAC;EAKQC,MAAM,GAAyC,IAAIC,+BAAuB,CAAC,CAAC;EAC7EC,oBAAoB,GAAGC,OAAO,CAACC,OAAO,CAAC,CAAC;EAEhDC,WAAWA,CAACC,OAA0C,GAAG,CAAC,CAAC,EAAE;IACzD,IAAI,CAACA,OAAO,CAACC,UAAU,EAAE;MACrBD,OAAO,CAACC,UAAU,GAAG,SAAS;IAClC;IAEA,IAAI,CAACD,OAAO,GAAGA,OAAO;IAEtB,IAAI,CAACE,WAAW,GAAGC,0BAAO,CAACC,SAAS,CAAC,IAAI,CAACJ,OAAO,CAACC,UAAU,CAAC;EACjE;EAEA,MAAMI,UAAUA,CAACC,OAA4B,GAAG,CAAC,CAAC,EAAiB;IAC/D,MAAMC,SAAS,GAAGC,WAAW,CAACF,OAAO,CAAC;IACtC,IAAI,CAACV,oBAAoB,GAAG,IAAI,CAACM,WAAW,CAACO,oBAAoB,CAC7DF,SACJ,CAAC;IAED,MAAM,IAAI,CAACX,oBAAoB;EACnC;EAEA,MAAMc,eAAeA,CACjBC,WAAgC,EAChCC,UAA+B,EAClB;IACb,MAAMC,YAAY,GAAGL,WAAW,CAACI,UAAU,CAAC;;IAE5C;IACA,IAAI,CAAChB,oBAAoB,GAAG,IAAI,CAACA,oBAAoB,CAACkB,IAAI,CAAC,MAAM;MAC7D,OAAO,IAAI,CAACZ,WAAW,CAACO,oBAAoB,CAACI,YAAY,CAAC;IAC9D,CAAC,CAAC;;IAEF;IACA,MAAM,IAAI,CAACjB,oBAAoB;EACnC;EAEAmB,wBAAwBA,CACpBC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ACLC,MAAM;IACNC,OAAO;IACPC,aAAa;IACbC,SAAS;IACTC;EACJ,CAAC,GAAGlB,OAAO;EAEX,MAAMmB,eAAe,GACjBF,SAAS,KAAKG,iBAAS,CAACH,SAAS,CAAc,IAAIG,iBAAS,CAACC,OAAO,CAAC;EAEzE,MAAMC,MAA4B,GAAG;IACjCT,KAAK;IACLC,MAAM;IACNC,OAAO;IACPQ,YAAY,EAAEP,aAAa,GAAG;MAAEA;IAAc,CAAC,GAAGQ,SAAS;IAC3DP,SAAS,EAAEE,eAAe;IAC1BD;EACJ,CAAC;EAED,OAAOI,MAAM;AACjB,CAAC","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ * Copyright 2016-Present Datadog, Inc.
5
+ */
6
+
7
+ import { DatadogOpenFeatureProvider } from './provider';
8
+ export { DatadogOpenFeatureProvider };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DatadogOpenFeatureProvider"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,0BAA0B,QAAQ,YAAY;AAGvD,SAASA,0BAA0B","ignoreList":[]}
@@ -0,0 +1,99 @@
1
+ /*
2
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ * Copyright 2016-Present Datadog, Inc.
5
+ */
6
+
7
+ import { DdFlags } from '@datadog/mobile-react-native';
8
+ import { OpenFeatureEventEmitter, ErrorCode } from '@openfeature/web-sdk';
9
+ export class DatadogOpenFeatureProvider {
10
+ runsOn = 'client';
11
+ metadata = {
12
+ name: 'datadog-react-native'
13
+ };
14
+ events = new OpenFeatureEventEmitter();
15
+ contextChangePromise = Promise.resolve();
16
+ constructor(options = {}) {
17
+ if (!options.clientName) {
18
+ options.clientName = 'default';
19
+ }
20
+ this.options = options;
21
+ this.flagsClient = DdFlags.getClient(this.options.clientName);
22
+ }
23
+ async initialize(context = {}) {
24
+ const ddContext = toDdContext(context);
25
+ this.contextChangePromise = this.flagsClient.setEvaluationContext(ddContext);
26
+ await this.contextChangePromise;
27
+ }
28
+ async onContextChange(_oldContext, newContext) {
29
+ const newDdContext = toDdContext(newContext);
30
+
31
+ // Promise chain in case `onContextChange` is called multiple times.
32
+ this.contextChangePromise = this.contextChangePromise.then(() => {
33
+ return this.flagsClient.setEvaluationContext(newDdContext);
34
+ });
35
+
36
+ // Wait for the current context change to complete.
37
+ await this.contextChangePromise;
38
+ }
39
+ resolveBooleanEvaluation(flagKey, defaultValue, _context, _logger) {
40
+ const details = this.flagsClient.getBooleanDetails(flagKey, defaultValue);
41
+ return toFlagResolution(details);
42
+ }
43
+ resolveStringEvaluation(flagKey, defaultValue, _context, _logger) {
44
+ const details = this.flagsClient.getStringDetails(flagKey, defaultValue);
45
+ return toFlagResolution(details);
46
+ }
47
+ resolveNumberEvaluation(flagKey, defaultValue, _context, _logger) {
48
+ const details = this.flagsClient.getNumberDetails(flagKey, defaultValue);
49
+ return toFlagResolution(details);
50
+ }
51
+ resolveObjectEvaluation(flagKey, defaultValue, _context, _logger) {
52
+ // The OpenFeature spec states that the return value can be any valid JSON value.
53
+ // However, the Datadog Flags feature only supports JSON objects for the JSON feature flag type.
54
+ // Thus, the user should always expect the returned value to be an object instead of any arbitrary JSON value.
55
+ // Also, the user is responsible for providing a proper `defaultValue` that's an object.
56
+
57
+ const details = this.flagsClient.getObjectDetails(flagKey, defaultValue);
58
+ return toFlagResolution(details);
59
+ }
60
+ }
61
+ const toDdContext = context => {
62
+ const {
63
+ targetingKey,
64
+ ...attributes
65
+ } = context;
66
+
67
+ // Important ⚠️
68
+ // The Flags SDK doesn't support nested non-primitive values in the evaluation context as per OF.3 FFE SDK requirement.
69
+ // However, we let the SDK handle this inside of FlagsClient since it does this processing anyways.
70
+ const ddContextAttributes = attributes;
71
+ return {
72
+ // Allow flag evaluations without a provided targeting key.
73
+ targetingKey: targetingKey ?? '',
74
+ attributes: ddContextAttributes
75
+ };
76
+ };
77
+ const toFlagResolution = details => {
78
+ const {
79
+ value,
80
+ reason,
81
+ variant,
82
+ allocationKey,
83
+ errorCode,
84
+ errorMessage
85
+ } = details;
86
+ const parsedErrorCode = errorCode && (ErrorCode[errorCode] || ErrorCode.GENERAL);
87
+ const result = {
88
+ value,
89
+ reason,
90
+ variant,
91
+ flagMetadata: allocationKey ? {
92
+ allocationKey
93
+ } : undefined,
94
+ errorCode: parsedErrorCode,
95
+ errorMessage
96
+ };
97
+ return result;
98
+ };
99
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DdFlags","OpenFeatureEventEmitter","ErrorCode","DatadogOpenFeatureProvider","runsOn","metadata","name","events","contextChangePromise","Promise","resolve","constructor","options","clientName","flagsClient","getClient","initialize","context","ddContext","toDdContext","setEvaluationContext","onContextChange","_oldContext","newContext","newDdContext","then","resolveBooleanEvaluation","flagKey","defaultValue","_context","_logger","details","getBooleanDetails","toFlagResolution","resolveStringEvaluation","getStringDetails","resolveNumberEvaluation","getNumberDetails","resolveObjectEvaluation","getObjectDetails","targetingKey","attributes","ddContextAttributes","value","reason","variant","allocationKey","errorCode","errorMessage","parsedErrorCode","GENERAL","result","flagMetadata","undefined"],"sourceRoot":"../../src","sources":["provider.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,8BAA8B;AAMtD,SAASC,uBAAuB,EAAEC,SAAS,QAAQ,sBAAsB;AAyBzE,OAAO,MAAMC,0BAA0B,CAAqB;EAC/CC,MAAM,GAAa,QAAQ;EAC3BC,QAAQ,GAAqB;IAClCC,IAAI,EAAE;EACV,CAAC;EAKQC,MAAM,GAAyC,IAAIN,uBAAuB,CAAC,CAAC;EAC7EO,oBAAoB,GAAGC,OAAO,CAACC,OA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0 +1,20 @@
1
+ export declare const DdAttributes: {
2
+ /**
3
+ * Custom "source type" of the error. Used in RUM errors. It names the
4
+ * language or platform of the RUM error stack trace, so the SCI backend
5
+ * knows how to symbolize it. Expects {@link String} value.
6
+ */
7
+ errorSourceType: string;
8
+ /**
9
+ * Custom fingerprint to an error.
10
+ * Expects {@link String} value.
11
+ */
12
+ errorFingerprint: string;
13
+ /**
14
+ * Debug ID attached to a log or a RUM event.
15
+ * The Debug ID establishes a unique connection between a bundle and its corresponding sourcemap.
16
+ * Expects {@link String} value.
17
+ */
18
+ debugId: string;
19
+ };
20
+ //# sourceMappingURL=DdAttributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DdAttributes.d.ts","sourceRoot":"","sources":["../../../../../core/src/DdAttributes.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY;IACrB;;;;OAIG;;IAGH;;;OAGG;;IAGH;;;;OAIG;;CAEN,CAAC"}