@datadog/mobile-react-native 1.2.1 → 1.3.1

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 (259) hide show
  1. package/DatadogSDKReactNative.podspec +2 -2
  2. package/android/build.gradle +58 -64
  3. package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +31 -1
  4. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +242 -14
  5. package/android/src/test/kotlin/com/datadog/tools/unit/GenericAssert.kt +6 -0
  6. package/android/src/test/kotlin/com/datadog/tools/unit/forge/ActionEventForgeryFactory.kt +106 -0
  7. package/android/src/test/kotlin/com/datadog/tools/unit/forge/BaseConfigurator.kt +2 -0
  8. package/android/src/test/kotlin/com/datadog/tools/unit/forge/ResourceEventForgeryFactory.kt +116 -0
  9. package/ios/Sources/Attributes.swift +14 -0
  10. package/ios/Sources/DdSdk.swift +18 -0
  11. package/lib/commonjs/DdSdkReactNative.js +40 -8
  12. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  13. package/lib/commonjs/DdSdkReactNativeConfiguration.js +42 -2
  14. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  15. package/lib/commonjs/foundation.js +2 -139
  16. package/lib/commonjs/foundation.js.map +1 -1
  17. package/lib/commonjs/index.js +18 -14
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/commonjs/logs/DdLogs.js +71 -0
  20. package/lib/commonjs/logs/DdLogs.js.map +1 -0
  21. package/lib/commonjs/logs/eventMapper.js +39 -0
  22. package/lib/commonjs/logs/eventMapper.js.map +1 -0
  23. package/lib/commonjs/logs/types.js +2 -0
  24. package/lib/commonjs/{rum/instrumentation/EventsInterceptor.js.map → logs/types.js.map} +0 -0
  25. package/lib/commonjs/nativeModulesTypes.js.map +1 -1
  26. package/lib/commonjs/rum/DdRum.js +234 -0
  27. package/lib/commonjs/rum/DdRum.js.map +1 -0
  28. package/lib/commonjs/rum/eventMappers/actionEventMapper.js +36 -0
  29. package/lib/commonjs/rum/eventMappers/actionEventMapper.js.map +1 -0
  30. package/lib/commonjs/rum/eventMappers/errorEventMapper.js +32 -0
  31. package/lib/commonjs/rum/eventMappers/errorEventMapper.js.map +1 -0
  32. package/lib/commonjs/rum/eventMappers/resourceEventMapper.js +38 -0
  33. package/lib/commonjs/rum/eventMappers/resourceEventMapper.js.map +1 -0
  34. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +4 -4
  35. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  36. package/lib/commonjs/rum/instrumentation/{DdEventsInterceptor.js → interactionTracking/DdEventsInterceptor.js} +6 -6
  37. package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -0
  38. package/lib/commonjs/rum/instrumentation/{DdRumUserInteractionTracking.js → interactionTracking/DdRumUserInteractionTracking.js} +13 -4
  39. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -0
  40. package/lib/commonjs/rum/instrumentation/{EventsInterceptor.js → interactionTracking/EventsInterceptor.js} +0 -0
  41. package/lib/{module/rum/instrumentation → commonjs/rum/instrumentation/interactionTracking}/EventsInterceptor.js.map +0 -0
  42. package/lib/commonjs/rum/instrumentation/{NoOpEventsInterceptor.js → interactionTracking/NoOpEventsInterceptor.js} +0 -0
  43. package/lib/commonjs/rum/instrumentation/{NoOpEventsInterceptor.js.map → interactionTracking/NoOpEventsInterceptor.js.map} +0 -0
  44. package/lib/commonjs/rum/instrumentation/{ShallowObjectEqualityChecker.js → interactionTracking/ShallowObjectEqualityChecker.js} +0 -0
  45. package/lib/commonjs/rum/instrumentation/{ShallowObjectEqualityChecker.js.map → interactionTracking/ShallowObjectEqualityChecker.js.map} +0 -0
  46. package/lib/commonjs/rum/instrumentation/{getJsxRuntime.js → interactionTracking/getJsxRuntime.js} +0 -0
  47. package/lib/commonjs/rum/instrumentation/{getJsxRuntime.js.map → interactionTracking/getJsxRuntime.js.map} +0 -0
  48. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +3 -3
  49. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
  50. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js +2 -1
  51. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +1 -1
  52. package/lib/commonjs/rum/types.js +42 -0
  53. package/lib/commonjs/rum/types.js.map +1 -0
  54. package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js +45 -0
  55. package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -0
  56. package/lib/commonjs/sdk/AttributesSingleton/types.js +2 -0
  57. package/lib/commonjs/sdk/AttributesSingleton/types.js.map +1 -0
  58. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.js +4 -4
  59. package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -0
  60. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js +0 -0
  61. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js.map +0 -0
  62. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js +0 -0
  63. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js.map +0 -0
  64. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js +0 -0
  65. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js.map +0 -0
  66. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js +0 -0
  67. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js.map +0 -0
  68. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.js +4 -4
  69. package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -0
  70. package/lib/commonjs/sdk/EventMappers/EventMapper.js +85 -0
  71. package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -0
  72. package/lib/commonjs/sdk/EventMappers/utils/deepClone.js +98 -0
  73. package/lib/commonjs/sdk/EventMappers/utils/deepClone.js.map +1 -0
  74. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +43 -0
  75. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -0
  76. package/lib/commonjs/sdk/UserInfoSingleton/types.js +2 -0
  77. package/lib/commonjs/sdk/UserInfoSingleton/types.js.map +1 -0
  78. package/lib/commonjs/types.js +1 -26
  79. package/lib/commonjs/types.js.map +1 -1
  80. package/lib/commonjs/version.js +1 -1
  81. package/lib/commonjs/version.js.map +1 -1
  82. package/lib/module/DdSdkReactNative.js +33 -7
  83. package/lib/module/DdSdkReactNative.js.map +1 -1
  84. package/lib/module/DdSdkReactNativeConfiguration.js +42 -2
  85. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  86. package/lib/module/foundation.js +2 -124
  87. package/lib/module/foundation.js.map +1 -1
  88. package/lib/module/index.js +5 -3
  89. package/lib/module/index.js.map +1 -1
  90. package/lib/module/logs/DdLogs.js +64 -0
  91. package/lib/module/logs/DdLogs.js.map +1 -0
  92. package/lib/module/logs/eventMapper.js +20 -0
  93. package/lib/module/logs/eventMapper.js.map +1 -0
  94. package/lib/module/logs/types.js +2 -0
  95. package/lib/module/logs/types.js.map +1 -0
  96. package/lib/module/nativeModulesTypes.js.map +1 -1
  97. package/lib/module/rum/DdRum.js +212 -0
  98. package/lib/module/rum/DdRum.js.map +1 -0
  99. package/lib/module/rum/eventMappers/actionEventMapper.js +26 -0
  100. package/lib/module/rum/eventMappers/actionEventMapper.js.map +1 -0
  101. package/lib/module/rum/eventMappers/errorEventMapper.js +22 -0
  102. package/lib/module/rum/eventMappers/errorEventMapper.js.map +1 -0
  103. package/lib/module/rum/eventMappers/resourceEventMapper.js +28 -0
  104. package/lib/module/rum/eventMappers/resourceEventMapper.js.map +1 -0
  105. package/lib/module/rum/instrumentation/DdRumErrorTracking.js +2 -2
  106. package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  107. package/lib/module/rum/instrumentation/{DdEventsInterceptor.js → interactionTracking/DdEventsInterceptor.js} +6 -6
  108. package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -0
  109. package/lib/module/rum/instrumentation/{DdRumUserInteractionTracking.js → interactionTracking/DdRumUserInteractionTracking.js} +13 -4
  110. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -0
  111. package/lib/module/rum/instrumentation/{EventsInterceptor.js → interactionTracking/EventsInterceptor.js} +0 -0
  112. package/lib/module/rum/instrumentation/interactionTracking/EventsInterceptor.js.map +1 -0
  113. package/lib/module/rum/instrumentation/{NoOpEventsInterceptor.js → interactionTracking/NoOpEventsInterceptor.js} +0 -0
  114. package/lib/module/rum/instrumentation/{NoOpEventsInterceptor.js.map → interactionTracking/NoOpEventsInterceptor.js.map} +0 -0
  115. package/lib/module/rum/instrumentation/{ShallowObjectEqualityChecker.js → interactionTracking/ShallowObjectEqualityChecker.js} +0 -0
  116. package/lib/module/rum/instrumentation/{ShallowObjectEqualityChecker.js.map → interactionTracking/ShallowObjectEqualityChecker.js.map} +0 -0
  117. package/lib/module/rum/instrumentation/{getJsxRuntime.js → interactionTracking/getJsxRuntime.js} +0 -0
  118. package/lib/module/rum/instrumentation/{getJsxRuntime.js.map → interactionTracking/getJsxRuntime.js.map} +0 -0
  119. package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +2 -2
  120. package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
  121. package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js +2 -1
  122. package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +1 -1
  123. package/lib/module/rum/types.js +33 -0
  124. package/lib/module/rum/types.js.map +1 -0
  125. package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js +36 -0
  126. package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -0
  127. package/lib/module/sdk/AttributesSingleton/types.js +2 -0
  128. package/lib/module/sdk/AttributesSingleton/types.js.map +1 -0
  129. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.js +4 -4
  130. package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -0
  131. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js +0 -0
  132. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js.map +0 -0
  133. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js +0 -0
  134. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js.map +0 -0
  135. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js +0 -0
  136. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js.map +0 -0
  137. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js +0 -0
  138. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js.map +0 -0
  139. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.js +4 -4
  140. package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -0
  141. package/lib/module/sdk/EventMappers/EventMapper.js +72 -0
  142. package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -0
  143. package/lib/module/sdk/EventMappers/utils/deepClone.js +89 -0
  144. package/lib/module/sdk/EventMappers/utils/deepClone.js.map +1 -0
  145. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +34 -0
  146. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -0
  147. package/lib/module/sdk/UserInfoSingleton/types.js +2 -0
  148. package/lib/module/sdk/UserInfoSingleton/types.js.map +1 -0
  149. package/lib/module/types.js +0 -23
  150. package/lib/module/types.js.map +1 -1
  151. package/lib/module/version.js +1 -1
  152. package/lib/module/version.js.map +1 -1
  153. package/lib/typescript/DdSdkReactNative.d.ts +7 -3
  154. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +22 -0
  155. package/lib/typescript/foundation.d.ts +2 -4
  156. package/lib/typescript/index.d.ts +5 -3
  157. package/lib/typescript/logs/DdLogs.d.ts +14 -0
  158. package/lib/typescript/logs/eventMapper.d.ts +11 -0
  159. package/lib/typescript/logs/types.d.ts +54 -0
  160. package/lib/typescript/nativeModulesTypes.d.ts +1 -1
  161. package/lib/typescript/rum/DdRum.d.ts +36 -0
  162. package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts +21 -0
  163. package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +21 -0
  164. package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts +24 -0
  165. package/lib/typescript/rum/instrumentation/{DdEventsInterceptor.d.ts → interactionTracking/DdEventsInterceptor.d.ts} +0 -0
  166. package/lib/typescript/rum/instrumentation/{DdRumUserInteractionTracking.d.ts → interactionTracking/DdRumUserInteractionTracking.d.ts} +1 -0
  167. package/lib/typescript/rum/instrumentation/{EventsInterceptor.d.ts → interactionTracking/EventsInterceptor.d.ts} +0 -0
  168. package/lib/typescript/rum/instrumentation/{NoOpEventsInterceptor.d.ts → interactionTracking/NoOpEventsInterceptor.d.ts} +0 -0
  169. package/lib/typescript/rum/instrumentation/{ShallowObjectEqualityChecker.d.ts → interactionTracking/ShallowObjectEqualityChecker.d.ts} +0 -0
  170. package/lib/typescript/rum/instrumentation/{getJsxRuntime.d.ts → interactionTracking/getJsxRuntime.d.ts} +0 -0
  171. package/lib/typescript/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.d.ts +2 -1
  172. package/lib/typescript/rum/instrumentation/resourceTracking/implementation/XHRProxy.d.ts +0 -1
  173. package/lib/typescript/rum/instrumentation/resourceTracking/implementation/responseSize.d.ts +0 -1
  174. package/lib/typescript/rum/types.d.ts +110 -0
  175. package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts +12 -0
  176. package/lib/typescript/sdk/AttributesSingleton/types.d.ts +3 -0
  177. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.d.ts +0 -0
  178. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.d.ts +0 -0
  179. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.d.ts +0 -0
  180. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.d.ts +0 -0
  181. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.d.ts +0 -0
  182. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.d.ts +2 -2
  183. package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +24 -0
  184. package/lib/typescript/sdk/EventMappers/utils/deepClone.d.ts +10 -0
  185. package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +12 -0
  186. package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +6 -0
  187. package/lib/typescript/types.d.ts +0 -139
  188. package/lib/typescript/version.d.ts +1 -1
  189. package/package.json +2 -2
  190. package/scripts/replace-react-require.js +3 -2
  191. package/src/DdSdkReactNative.tsx +41 -7
  192. package/src/DdSdkReactNativeConfiguration.tsx +83 -3
  193. package/src/__tests__/DdSdkReactNative.test.tsx +244 -13
  194. package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +29 -7
  195. package/src/__tests__/{longTasksUtils.ts → longTasksUtils.test.ts} +0 -0
  196. package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +4 -3
  197. package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +3 -2
  198. package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +135 -117
  199. package/src/__tests__/rum/instrumentation/ShallowObjectEqualityChecker.test.ts +1 -1
  200. package/src/foundation.tsx +4 -114
  201. package/src/index.tsx +5 -3
  202. package/src/logs/DdLogs.ts +67 -0
  203. package/src/logs/__tests__/DdLogs.test.ts +51 -0
  204. package/src/logs/__tests__/eventMapper.test.ts +53 -0
  205. package/src/logs/eventMapper.ts +43 -0
  206. package/src/logs/types.ts +70 -0
  207. package/src/nativeModulesTypes.ts +1 -1
  208. package/src/rum/DdRum.ts +387 -0
  209. package/src/rum/__tests__/DdRum.test.ts +386 -0
  210. package/src/rum/eventMappers/actionEventMapper.ts +66 -0
  211. package/src/rum/eventMappers/errorEventMapper.ts +57 -0
  212. package/src/rum/eventMappers/resourceEventMapper.ts +74 -0
  213. package/src/rum/instrumentation/DdRumErrorTracking.tsx +2 -2
  214. package/src/rum/instrumentation/{DdEventsInterceptor.tsx → interactionTracking/DdEventsInterceptor.tsx} +14 -6
  215. package/src/rum/instrumentation/{DdRumUserInteractionTracking.tsx → interactionTracking/DdRumUserInteractionTracking.tsx} +12 -4
  216. package/src/rum/instrumentation/{EventsInterceptor.tsx → interactionTracking/EventsInterceptor.tsx} +0 -0
  217. package/src/rum/instrumentation/{NoOpEventsInterceptor.tsx → interactionTracking/NoOpEventsInterceptor.tsx} +0 -0
  218. package/src/rum/instrumentation/{ShallowObjectEqualityChecker.ts → interactionTracking/ShallowObjectEqualityChecker.ts} +0 -0
  219. package/src/rum/instrumentation/{getJsxRuntime.ts → interactionTracking/getJsxRuntime.ts} +0 -0
  220. package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +3 -2
  221. package/src/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.ts +2 -1
  222. package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.ts +3 -2
  223. package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/__tests__/ResourceReporter.test.ts +3 -2
  224. package/src/rum/instrumentation/resourceTracking/implementation/XHRProxy.ts +2 -1
  225. package/src/rum/instrumentation/resourceTracking/implementation/__tests__/XHRProxy.test.ts +89 -40
  226. package/src/rum/types.ts +182 -0
  227. package/src/sdk/AttributesSingleton/AttributesSingleton.ts +34 -0
  228. package/src/sdk/AttributesSingleton/__tests__/AttributesSingleton.test.ts +44 -0
  229. package/src/sdk/AttributesSingleton/types.ts +9 -0
  230. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.ts +4 -4
  231. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.ts +0 -0
  232. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.ts +0 -0
  233. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.ts +0 -0
  234. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/__tests__/BoundedBuffer.test.ts +2 -2
  235. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/__tests__/BufferSingleton.test.ts +2 -1
  236. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.ts +0 -0
  237. package/src/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.tsx +5 -5
  238. package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/__utils__/renderWithProvider.tsx +2 -2
  239. package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/initialization.test.tsx +13 -10
  240. package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/initializationModes.test.tsx +10 -6
  241. package/src/sdk/EventMappers/EventMapper.ts +94 -0
  242. package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +50 -0
  243. package/src/sdk/EventMappers/utils/__tests__/deepClone.test.ts +79 -0
  244. package/src/sdk/EventMappers/utils/deepClone.ts +86 -0
  245. package/src/sdk/UserInfoSingleton/UserInfoSingleton.ts +31 -0
  246. package/src/sdk/UserInfoSingleton/__tests__/UserInfoSingleton.test.ts +29 -0
  247. package/src/sdk/UserInfoSingleton/types.ts +12 -0
  248. package/src/types.tsx +0 -210
  249. package/src/version.ts +1 -1
  250. package/lib/commonjs/DatadogProvider/Buffer/BoundedBuffer.js.map +0 -1
  251. package/lib/commonjs/DatadogProvider/DatadogProvider.js.map +0 -1
  252. package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js.map +0 -1
  253. package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js.map +0 -1
  254. package/lib/module/DatadogProvider/Buffer/BoundedBuffer.js.map +0 -1
  255. package/lib/module/DatadogProvider/DatadogProvider.js.map +0 -1
  256. package/lib/module/rum/instrumentation/DdEventsInterceptor.js.map +0 -1
  257. package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js.map +0 -1
  258. package/src/__tests__/DdRumWrapper.test.tsx +0 -74
  259. package/src/__tests__/foundation.test.ts +0 -88
@@ -1 +1 @@
1
- {"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["VitalsUpdateFrequency","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","TrackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","firstPartyHosts","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;;;;;;AAQA;;;;IAEYA,qB;;;WAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAA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D;;AAcO,MAAME,0CAA0C,GAAG,CACtDP,QADsD,EAEtDI,aAFsD,KAGtB;AAChC,QAAM;AACFZ,IAAAA,WADE;AAEFC,IAAAA,GAFE;AAGFC,IAAAA,aAHE;AAIF,OAAGc;AAJD,MAKFJ,aALJ;AAMA,QAAMK,gBAAgB,GAAG,IAAInB,6BAAJ,CACrBE,WADqB,EAErBC,GAFqB,EAGrBC,aAHqB,EAIrBM,QAAQ,CAACL,iBAJY,EAKrBK,QAAQ,CAACJ,cALY,EAMrBI,QAAQ,CAACH,WANY,EAOrBO,aAAa,CAACpB,eAPO,CAAzB;AAUC0B,EAAAA,MAAM,CAACC,IAAP,CACGH,sBADH,CAAD,CAE8CI,OAF9C,CAEsDN,IAAI,IAAI;AAC1DJ,IAAAA,yBAAyB,CACrB;AAAEG,MAAAA,KAAK,EAAEG,sBAAsB,CAACF,IAAD,CAA/B;AAAuCA,MAAAA;AAAvC,KADqB,EAErBG,gBAFqB,CAAzB;AAIH,GAPD;AASAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,6BADV;AAEID,IAAAA,KAAK,EAAEL,QAAQ,CAACvB;AAFpB,GADqB,EAKrBgC,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AAAEI,IAAAA,IAAI,EAAE,iBAAR;AAA2BD,IAAAA,KAAK,EAAEL,QAAQ,CAACC;AAA3C,GADqB,EAErBQ,gBAFqB,CAAzB;AAKA,SAAOA,gBAAP;AACH,CA1CM;;;;AA4CA,MAAMI,4BAAN,SAA2CvB,6BAA3C,CAAyE;AAAA;AAAA;;AAAA,gDAC5BwB,kBAAkB,CAACC,IADS;AAAA;;AAAA;;;IAIpED,kB;;;WAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,kCAAAA,kB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native plaforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: string[] = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: string[];\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: string[];\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate ||\n DEFAULTS.resourceTracingSamplingRate\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL';\n"]}
1
+ {"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["VitalsUpdateFrequency","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","nativeInteractionTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","TrackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","logEventMapper","errorEventMapper","resourceEventMapper","actionEventMapper","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","firstPartyHosts","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;;;;;;AAQA;;;;IAMYA,qB;;;WAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;GAAAA,qB,qCAAAA,qB;;AAOZ,MAAMC,QAAQ,GAAG;AACbC,EAAAA,wBAAwB,EAAE,KADb;AAEbC,EAAAA,mBAAmB,EAAE,KAFR;AAGbC,EAAAA,2BAA2B,EAAE,IAHhB;AAIbC,EAAAA,IAAI,EAAE,KAJO;AAKbC,EAAAA,mBAAmB,EAAE,CALR;AAMbC,EAAAA,yBAAyB,EAAE,GANd;AAObC,EAAAA,kBAAkB,EAAE,KAPP;AAQbC,EAAAA,yBAAyB,EAAE,KARd;AASbC,EAAAA,kBAAkB,EAAE,MAAM,EATb;AAUbC,EAAAA,mBAAmB,EAAE,OAAO,EAAP,CAVR;AAWbC,EAAAA,eAAe,EAAEC,iCAAgBC,OAXpB;AAYbC,EAAAA,mBAAmB,EAAE,IAZR;AAabC,EAAAA,qBAAqB,EAAEhB,qBAAqB,CAACiB,OAbhC;AAcbC,EAAAA,cAAc,EAAE,IAdH;AAebC,EAAAA,gBAAgB,EAAE,IAfL;AAgBbC,EAAAA,mBAAmB,EAAE,IAhBR;AAiBbC,EAAAA,iBAAiB,EAAE;AAjBN,CAAjB;AAoBA;AACA;AACA;AACA;;AACO,MAAMC,6BAAN,CAAoC;AACvC;AACJ;AACA;;AAGI;AACJ;AACA;;AAEI;AACJ;AACA;;AAEI;AACJ;AACA;;AAII;AACJ;AACA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CAACb;AAFpB,GADqB,EAKrBsB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,qBADV;AAEID,IAAAA,KAAK,EAAEL,QAAQ,CAACZ;AAFpB,GADqB,EAKrBqB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,mBADV;AAEID,IAAAA,KAAK,EAAEL,QAAQ,CAACX;AAFpB,GADqB,EAKrBoB,gBALqB,CAAzB;AAQA,SAAOA,gBAAP;AACH,CAtEM;;;;AAwEA,MAAMI,4BAAN,SAA2CvB,6BAA3C,CAAyE;AAAA;AAAA;;AAAA,gDAC5BwB,kBAAkB,CAACC,IADS;AAAA;;AAAA;;;IAIpED,kB;;;WAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,kCAAAA,kB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport type { LogEventMapper } from './logs/types';\nimport type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n nativeInteractionTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE,\n logEventMapper: null,\n errorEventMapper: null,\n resourceEventMapper: null,\n actionEventMapper: null\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native plaforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n /**\n * Enables native interaction tracking.\n * Set to `true` if you want to track interactions on native screens.\n */\n public nativeInteractionTracking: boolean =\n DEFAULTS.nativeInteractionTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: string[] = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n public logEventMapper: LogEventMapper | null = DEFAULTS.logEventMapper;\n\n public errorEventMapper: ErrorEventMapper | null =\n DEFAULTS.errorEventMapper;\n\n public resourceEventMapper: ResourceEventMapper | null =\n DEFAULTS.resourceEventMapper;\n\n public actionEventMapper: ActionEventMapper | null =\n DEFAULTS.actionEventMapper;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: string[];\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n readonly logEventMapper?: LogEventMapper | null;\n readonly errorEventMapper?: ErrorEventMapper | null;\n readonly resourceEventMapper?: ResourceEventMapper | null;\n readonly actionEventMapper?: ActionEventMapper | null;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: string[];\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n readonly logEventMapper: LogEventMapper | null;\n readonly errorEventMapper: ErrorEventMapper | null;\n readonly resourceEventMapper: ResourceEventMapper | null;\n readonly actionEventMapper: ActionEventMapper | null;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate === undefined\n ? DEFAULTS.resourceTracingSamplingRate\n : features.resourceTracingSamplingRate,\n logEventMapper:\n features.logEventMapper === undefined\n ? DEFAULTS.logEventMapper\n : features.logEventMapper,\n errorEventMapper:\n features.errorEventMapper === undefined\n ? DEFAULTS.errorEventMapper\n : features.errorEventMapper,\n resourceEventMapper:\n features.resourceEventMapper === undefined\n ? DEFAULTS.resourceEventMapper\n : features.resourceEventMapper,\n actionEventMapper:\n features.actionEventMapper === undefined\n ? DEFAULTS.actionEventMapper\n : features.actionEventMapper\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly nativeInteractionTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'logEventMapper',\n value: features.logEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'errorEventMapper',\n value: features.errorEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'resourceEventMapper',\n value: features.resourceEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionEventMapper',\n value: features.actionEventMapper\n },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL';\n"]}
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "DdSdkConfiguration", {
9
9
  return _types.DdSdkConfiguration;
10
10
  }
11
11
  });
12
- exports.DdRum = exports.DdTrace = exports.DdLogs = exports.DdSdk = void 0;
12
+ exports.DdTrace = exports.DdSdk = void 0;
13
13
 
14
14
  var _reactNative = require("react-native");
15
15
 
@@ -21,43 +21,12 @@ var _SdkVerbosity = require("./SdkVerbosity");
21
21
 
22
22
  var _TimeProvider = require("./TimeProvider");
23
23
 
24
- var _bufferNativeCall = require("./DatadogProvider/Buffer/bufferNativeCall");
24
+ var _bufferNativeCall = require("./sdk/DatadogProvider/Buffer/bufferNativeCall");
25
25
 
26
26
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
27
 
28
28
  const timeProvider = new _TimeProvider.TimeProvider();
29
29
 
30
- class DdLogsWrapper {
31
- constructor() {
32
- _defineProperty(this, "nativeLogs", _reactNative.NativeModules.DdLogs);
33
- }
34
-
35
- debug(message, context = {}) {
36
- _InternalLog.InternalLog.log("Tracking debug log “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
37
-
38
- return this.nativeLogs.debug(message, context);
39
- }
40
-
41
- info(message, context = {}) {
42
- _InternalLog.InternalLog.log("Tracking info log “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
43
-
44
- return this.nativeLogs.info(message, context);
45
- }
46
-
47
- warn(message, context = {}) {
48
- _InternalLog.InternalLog.log("Tracking warn log “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
49
-
50
- return this.nativeLogs.warn(message, context);
51
- }
52
-
53
- error(message, context = {}) {
54
- _InternalLog.InternalLog.log("Tracking error log “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
55
-
56
- return this.nativeLogs.error(message, context);
57
- }
58
-
59
- }
60
-
61
30
  class DdTraceWrapper {
62
31
  constructor() {
63
32
  _defineProperty(this, "nativeTrace", _reactNative.NativeModules.DdTrace);
@@ -79,114 +48,8 @@ class DdTraceWrapper {
79
48
 
80
49
  }
81
50
 
82
- const isNewStopActionAPI = args => {
83
- return typeof args[0] === 'string';
84
- };
85
-
86
- const isOldStopActionAPI = args => {
87
- return typeof args[0] === 'object' || typeof args[0] === 'undefined';
88
- };
89
-
90
- class DdRumWrapper {
91
- constructor() {
92
- _defineProperty(this, "nativeRum", _reactNative.NativeModules.DdRum);
93
-
94
- _defineProperty(this, "lastActionData", void 0);
95
-
96
- _defineProperty(this, "getStopActionNativeCall", args => {
97
- if (isNewStopActionAPI(args)) {
98
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.stopAction(args[0], args[1], args[2] || {}, args[3] || timeProvider.now()));
99
- }
100
-
101
- if (isOldStopActionAPI(args)) {
102
- if (this.lastActionData) {
103
- DdSdk.telemetryDebug('DDdRum.stopAction called with the old signature');
104
- const {
105
- type,
106
- name
107
- } = this.lastActionData;
108
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.stopAction(type, name, args[0] || {}, args[1] || timeProvider.now()));
109
- }
110
-
111
- _InternalLog.InternalLog.log("DdRum.startAction needs to be called before DdRum.stopAction", _SdkVerbosity.SdkVerbosity.WARN);
112
- } else {
113
- _InternalLog.InternalLog.log("DdRum.stopAction was called with wrong arguments", _SdkVerbosity.SdkVerbosity.WARN);
114
- }
115
-
116
- return new Promise(resolve => resolve());
117
- });
118
- }
119
-
120
- startView(key, name, context = {}, timestampMs = timeProvider.now()) {
121
- _InternalLog.InternalLog.log("Starting RUM View “" + name + "” #" + key, _SdkVerbosity.SdkVerbosity.DEBUG);
122
-
123
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.startView(key, name, context, timestampMs));
124
- }
125
-
126
- stopView(key, context = {}, timestampMs = timeProvider.now()) {
127
- _InternalLog.InternalLog.log("Stopping RUM View #" + key, _SdkVerbosity.SdkVerbosity.DEBUG);
128
-
129
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.stopView(key, context, timestampMs));
130
- }
131
-
132
- startAction(type, name, context = {}, timestampMs = timeProvider.now()) {
133
- _InternalLog.InternalLog.log("Starting RUM Action “" + name + "” (" + type + ")", _SdkVerbosity.SdkVerbosity.DEBUG);
134
-
135
- this.lastActionData = {
136
- type,
137
- name
138
- };
139
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.startAction(type, name, context, timestampMs));
140
- }
141
-
142
- stopAction(...args) {
143
- _InternalLog.InternalLog.log("Stopping current RUM Action", _SdkVerbosity.SdkVerbosity.DEBUG);
144
-
145
- let returnPromise = this.getStopActionNativeCall(args);
146
- this.lastActionData = undefined;
147
- return returnPromise;
148
- }
149
-
150
- addAction(type, name, context = {}, timestampMs = timeProvider.now()) {
151
- _InternalLog.InternalLog.log("Adding RUM Action “" + name + "” (" + type + ")", _SdkVerbosity.SdkVerbosity.DEBUG);
152
-
153
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.addAction(type, name, context, timestampMs));
154
- }
155
-
156
- startResource(key, method, url, context = {}, timestampMs = timeProvider.now()) {
157
- _InternalLog.InternalLog.log("Starting RUM Resource #" + key + " " + method + ": " + url, _SdkVerbosity.SdkVerbosity.DEBUG);
158
-
159
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.startResource(key, method, url, context, timestampMs));
160
- }
161
-
162
- stopResource(key, statusCode, kind, size = -1, context = {}, timestampMs = timeProvider.now()) {
163
- _InternalLog.InternalLog.log("Stopping RUM Resource #" + key + " status:" + statusCode, _SdkVerbosity.SdkVerbosity.DEBUG);
164
-
165
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.stopResource(key, statusCode, kind, size, context, timestampMs));
166
- }
167
-
168
- addError(message, source, stacktrace, context = {}, timestampMs = timeProvider.now()) {
169
- _InternalLog.InternalLog.log("Adding RUM Error “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
170
-
171
- let updatedContext = context;
172
- updatedContext["_dd.error.source_type"] = "react-native";
173
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.addError(message, source, stacktrace, updatedContext, timestampMs));
174
- }
175
-
176
- addTiming(name) {
177
- _InternalLog.InternalLog.log("Adding timing “" + name + "” to RUM View", _SdkVerbosity.SdkVerbosity.DEBUG);
178
-
179
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.addTiming(name));
180
- }
181
-
182
- }
183
-
184
51
  const DdSdk = _reactNative.NativeModules.DdSdk;
185
52
  exports.DdSdk = DdSdk;
186
- const DdLogs = new DdLogsWrapper();
187
- exports.DdLogs = DdLogs;
188
53
  const DdTrace = new DdTraceWrapper();
189
54
  exports.DdTrace = DdTrace;
190
- const DdRum = new DdRumWrapper();
191
- exports.DdRum = DdRum;
192
55
  //# sourceMappingURL=foundation.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["foundation.tsx"],"names":["timeProvider","TimeProvider","DdLogsWrapper","NativeModules","DdLogs","debug","message","context","InternalLog","log","SdkVerbosity","DEBUG","nativeLogs","info","warn","error","DdTraceWrapper","DdTrace","startSpan","operation","timestampMs","now","spanId","nativeTrace","finishSpan","id","isNewStopActionAPI","args","isOldStopActionAPI","DdRumWrapper","DdRum","nativeRum","stopAction","lastActionData","DdSdk","telemetryDebug","type","name","WARN","Promise","resolve","startView","key","stopView","startAction","returnPromise","getStopActionNativeCall","undefined","addAction","startResource","method","url","stopResource","statusCode","kind","size","addError","source","stacktrace","updatedContext","addTiming"],"mappings":";;;;;;;;;;;;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;AAEA,MAAMA,YAAY,GAAG,IAAIC,0BAAJ,EAArB;;AAEA,MAAMC,aAAN,CAA0C;AAAA;AAAA,wCAECC,2BAAcC,MAFf;AAAA;;AAItCC,EAAAA,KAAK,CAACC,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACxDC,6BAAYC,GAAZ,CAAgB,yBAA0BH,OAA1B,GAAoC,GAApD,EAAyDI,2BAAaC,KAAtE;;AACA,WAAO,KAAKC,UAAL,CAAgBP,KAAhB,CAAsBC,OAAtB,EAA+BC,OAA/B,CAAP;AACH;;AAEDM,EAAAA,IAAI,CAACP,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACvDC,6BAAYC,GAAZ,CAAgB,wBAAyBH,OAAzB,GAAmC,GAAnD,EAAwDI,2BAAaC,KAArE;;AACA,WAAO,KAAKC,UAAL,CAAgBC,IAAhB,CAAqBP,OAArB,EAA8BC,OAA9B,CAAP;AACH;;AAEDO,EAAAA,IAAI,CAACR,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACvDC,6BAAYC,GAAZ,CAAgB,wBAAyBH,OAAzB,GAAmC,GAAnD,EAAwDI,2BAAaC,KAArE;;AACA,WAAO,KAAKC,UAAL,CAAgBE,IAAhB,CAAqBR,OAArB,EAA8BC,OAA9B,CAAP;AACH;;AAEDQ,EAAAA,KAAK,CAACT,OAAD,EAAkBC,OAAe,GAAG,E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AA7C,EAAmDC,IAAnD,EAAyDhD,OAAzD,EAAkEa,WAAlE,CAA3B,CAAP;AACH;;AAEDoC,EAAAA,QAAQ,CAAClD,OAAD,EAAkBmD,MAAlB,EAAuCC,UAAvC,EAA2DnD,OAAe,GAAG,EAA7E,EAAiFa,WAAmB,GAAGpB,YAAY,CAACqB,GAAb,EAAvG,EAA0I;AAC9Ib,6BAAYC,GAAZ,CAAgB,uBAAuBH,OAAvB,GAAiC,GAAjD,EAAsDI,2BAAaC,KAAnE;;AACA,QAAIgD,cAAmB,GAAGpD,OAA1B;AACAoD,IAAAA,cAAc,CAAC,uBAAD,CAAd,GAA0C,cAA1C;AACA,WAAO,4CAAqB,MAAM,KAAK5B,SAAL,CAAeyB,QAAf,CAAwBlD,OAAxB,EAAiCmD,MAAjC,EAAyCC,UAAzC,EAAqDC,cAArD,EAAqEvC,WAArE,CAA3B,CAAP;AACH;;AAEDwC,EAAAA,SAAS,CAACvB,IAAD,EAA8B;AACnC7B,6BAAYC,GAAZ,CAAgB,oBAAoB4B,IAApB,GAA2B,eAA3C,EAA4D3B,2BAAaC,KAAzE;;AACA,WAAO,4CAAqB,MAAM,KAAKoB,SAAL,CAAe6B,SAAf,CAAyBvB,IAAzB,CAA3B,CAAP;AACH;;AAvEmC;;AA0ExC,MAAMH,KAAsB,GAAG/B,2BAAc+B,KAA7C;;AACA,MAAM9B,MAAkB,GAAG,IAAIF,aAAJ,EAA3B;;AACA,MAAMe,OAAoB,GAAG,IAAID,cAAJ,EAA7B;;AACA,MAAMc,KAAgB,GAAG,IAAID,YAAJ,EAAzB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { NativeModules } from 'react-native';\nimport { DdSdkConfiguration, DdLogsType, DdTraceType, DdRumType, RumActionType, ResourceKind, ErrorSource } from './types';\nimport {InternalLog} from \"./InternalLog\"\nimport {SdkVerbosity} from \"./SdkVerbosity\";\nimport {TimeProvider} from \"./TimeProvider\";\nimport type { DdNativeLogsType, DdNativeRumType, DdNativeSdkType, DdNativeTraceType } from './nativeModulesTypes';\nimport { bufferNativeCallReturningId, bufferNativeCallWithId, bufferVoidNativeCall } from './DatadogProvider/Buffer/bufferNativeCall';\n\nconst timeProvider = new TimeProvider();\n\nclass DdLogsWrapper implements DdLogsType {\n\n private nativeLogs: DdNativeLogsType = NativeModules.DdLogs;\n\n debug(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking debug log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.debug(message, context);\n }\n\n info(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking info log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.info(message, context);\n }\n\n warn(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking warn log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.warn(message, context);\n }\n\n error(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking error log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.error(message, context);\n }\n\n}\n\nclass DdTraceWrapper implements DdTraceType {\n\n private nativeTrace: DdNativeTraceType = NativeModules.DdTrace;\n\n startSpan(operation: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<string> {\n let spanId = bufferNativeCallReturningId(() =>this.nativeTrace.startSpan(operation, context, timestampMs));\n InternalLog.log(\"Starting span “\" + operation + \"” #\" + spanId, SdkVerbosity.DEBUG);\n return spanId\n }\n\n finishSpan(spanId: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Finishing span #\" + spanId, SdkVerbosity.DEBUG);\n return bufferNativeCallWithId((id) => this.nativeTrace.finishSpan(id, context, timestampMs), spanId);\n }\n}\n\nconst isNewStopActionAPI = (args: [type: RumActionType, name: string, context?: object, timestampMs?: number] | [context?: object, timestampMs?: number]): args is [type: RumActionType, name: string, context?: object, timestampMs?: number] => {\n return typeof args[0] === 'string'\n}\n\nconst isOldStopActionAPI = (args: [type: RumActionType, name: string, context?: object, timestampMs?: number] | [context?: object, timestampMs?: number]): args is [context?: object, timestampMs?: number] => {\n return typeof args[0] === 'object' || typeof args[0] === 'undefined' \n}\n\nclass DdRumWrapper implements DdRumType {\n\n private nativeRum: DdNativeRumType = NativeModules.DdRum;\n private lastActionData?: {type: RumActionType, name: string}\n\n startView(key: string, name: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Starting RUM View “\" + name + \"” #\" + key, SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() => this.nativeRum.startView(key, name, context, timestampMs));\n }\n\n stopView(key: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Stopping RUM View #\" + key, SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() => this.nativeRum.stopView(key, context, timestampMs));\n }\n\n startAction(type: RumActionType, name: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Starting RUM Action “\" + name + \"” (\" + type + \")\", SdkVerbosity.DEBUG);\n this.lastActionData={type, name}\n return bufferVoidNativeCall(() => this.nativeRum.startAction(type, name, context, timestampMs));\n }\n\n stopAction(...args: [type: RumActionType, name: string, context?: object, timestampMs?: number] | [context?: object, timestampMs?: number]): Promise<void> {\n InternalLog.log(\"Stopping current RUM Action\", SdkVerbosity.DEBUG);\n let returnPromise = this.getStopActionNativeCall(args)\n this.lastActionData = undefined\n return returnPromise\n }\n\n private getStopActionNativeCall = (args: [type: RumActionType, name: string, context?: object, timestampMs?: number] | [context?: object, timestampMs?: number]): Promise<void> => {\n if (isNewStopActionAPI(args)) {\n return bufferVoidNativeCall(() => this.nativeRum.stopAction(args[0], args[1], args[2] || {}, args[3] || timeProvider.now()))\n }\n if (isOldStopActionAPI(args)) {\n if (this.lastActionData) {\n DdSdk.telemetryDebug('DDdRum.stopAction called with the old signature')\n const {type, name} = this.lastActionData;\n return bufferVoidNativeCall(() => this.nativeRum.stopAction(type, name, args[0] || {}, args[1] || timeProvider.now()));\n } \n InternalLog.log(\"DdRum.startAction needs to be called before DdRum.stopAction\", SdkVerbosity.WARN);\n } else {\n InternalLog.log(\"DdRum.stopAction was called with wrong arguments\", SdkVerbosity.WARN);\n }\n\n return new Promise<void>(resolve => resolve())\n }\n\n addAction(type: RumActionType, name: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Adding RUM Action “\" + name + \"” (\" + type + \")\", SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() => this.nativeRum.addAction(type, name, context, timestampMs));\n }\n\n startResource(key: string, method: string, url: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Starting RUM Resource #\" + key + \" \" + method + \": \" + url, SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() => this.nativeRum.startResource(key, method, url, context, timestampMs));\n }\n\n stopResource(key: string, statusCode: number, kind: ResourceKind, size: number = -1, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Stopping RUM Resource #\" + key + \" status:\" + statusCode, SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() => this.nativeRum.stopResource(key, statusCode, kind, size, context, timestampMs));\n }\n\n addError(message: string, source: ErrorSource, stacktrace: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Adding RUM Error “\" + message + \"”\", SdkVerbosity.DEBUG);\n let updatedContext: any = context;\n updatedContext[\"_dd.error.source_type\"] = \"react-native\";\n return bufferVoidNativeCall(() => this.nativeRum.addError(message, source, stacktrace, updatedContext, timestampMs));\n }\n\n addTiming(name: string): Promise<void> {\n InternalLog.log(\"Adding timing “\" + name + \"” to RUM View\", SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() => this.nativeRum.addTiming(name));\n }\n}\n\nconst DdSdk: DdNativeSdkType = NativeModules.DdSdk;\nconst DdLogs: DdLogsType = new DdLogsWrapper();\nconst DdTrace: DdTraceType = new DdTraceWrapper();\nconst DdRum: DdRumType = new DdRumWrapper();\n\nexport { DdSdkConfiguration, DdSdk, DdLogs, DdTrace, DdRum };\n"]}
1
+ {"version":3,"sources":["foundation.tsx"],"names":["timeProvider","TimeProvider","DdTraceWrapper","NativeModules","DdTrace","startSpan","operation","context","timestampMs","now","spanId","nativeTrace","InternalLog","log","SdkVerbosity","DEBUG","finishSpan","id","DdSdk"],"mappings":";;;;;;;;;;;;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;AAEA,MAAMA,YAAY,GAAG,IAAIC,0BAAJ,EAArB;;AAEA,MAAMC,cAAN,CAA4C;AAAA;AAAA,yCAECC,2BAAcC,OAFf;AAAA;;AAIxCC,EAAAA,SAAS,CAACC,SAAD,EAAoBC,OAAe,GAAG,EAAtC,EAA0CC,WAAmB,GAAGR,YAAY,CAACS,GAAb,EAAhE,EAAqG;AAC1G,QAAIC,MAAM,GAAG,mDAA4B,MAAK,KAAKC,WAAL,CAAiBN,SAAjB,CAA2BC,SAA3B,EAAsCC,OAAtC,EAA+CC,WAA/C,CAAjC,CAAb;;AACAI,6BAAYC,GAAZ,CAAgB,oBAAqBP,SAArB,GAAiC,KAAjC,GAAyCI,MAAzD,EAAiEI,2BAAaC,KAA9E;;AACA,WAAOL,MAAP;AACH;;AAEDM,EAAAA,UAAU,CAACN,MAAD,EAAiBH,OAAe,GAAG,EAAnC,EAAuCC,WAAmB,GAAGR,YAAY,CAACS,GAAb,EAA7D,EAAgG;AACtGG,6BAAYC,GAAZ,CAAgB,qBAAsBH,MAAtC,EAA8CI,2BAAaC,KAA3D;;AACA,WAAO,8CAAwBE,EAAD,IAAS,KAAKN,WAAL,CAAiBK,UAAjB,CAA4BC,EAA5B,EAAgCV,OAAhC,EAAyCC,WAAzC,CAAhC,EAAuFE,MAAvF,CAAP;AACH;;AAbuC;;AAgB5C,MAAMQ,KAAsB,GAAGf,2BAAce,KAA7C;;AACA,MAAMd,OAAoB,GAAG,IAAIF,cAAJ,EAA7B","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { NativeModules } from 'react-native';\nimport { DdSdkConfiguration, DdTraceType } from './types';\nimport {InternalLog} from \"./InternalLog\"\nimport {SdkVerbosity} from \"./SdkVerbosity\";\nimport {TimeProvider} from \"./TimeProvider\";\nimport type { DdNativeSdkType, DdNativeTraceType } from './nativeModulesTypes';\nimport { bufferNativeCallReturningId, bufferNativeCallWithId } from './sdk/DatadogProvider/Buffer/bufferNativeCall';\n\nconst timeProvider = new TimeProvider();\n\nclass DdTraceWrapper implements DdTraceType {\n\n private nativeTrace: DdNativeTraceType = NativeModules.DdTrace;\n\n startSpan(operation: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<string> {\n let spanId = bufferNativeCallReturningId(() =>this.nativeTrace.startSpan(operation, context, timestampMs));\n InternalLog.log(\"Starting span “\" + operation + \"” #\" + spanId, SdkVerbosity.DEBUG);\n return spanId\n }\n\n finishSpan(spanId: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Finishing span #\" + spanId, SdkVerbosity.DEBUG);\n return bufferNativeCallWithId((id) => this.nativeTrace.finishSpan(id, context, timestampMs), spanId);\n }\n}\n\nconst DdSdk: DdNativeSdkType = NativeModules.DdSdk;\nconst DdTrace: DdTraceType = new DdTraceWrapper();\n\nexport { DdSdkConfiguration, DdSdk, DdTrace };\n"]}
@@ -3,12 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "DatadogProvider", {
7
- enumerable: true,
8
- get: function () {
9
- return _DatadogProvider.DatadogProvider;
10
- }
11
- });
12
6
  Object.defineProperty(exports, "DatadogProviderConfiguration", {
13
7
  enumerable: true,
14
8
  get: function () {
@@ -63,22 +57,22 @@ Object.defineProperty(exports, "TrackingConsent", {
63
57
  return _TrackingConsent.TrackingConsent;
64
58
  }
65
59
  });
66
- Object.defineProperty(exports, "DdLogs", {
60
+ Object.defineProperty(exports, "DdTrace", {
67
61
  enumerable: true,
68
62
  get: function () {
69
- return _foundation.DdLogs;
63
+ return _foundation.DdTrace;
70
64
  }
71
65
  });
72
- Object.defineProperty(exports, "DdTrace", {
66
+ Object.defineProperty(exports, "DdLogs", {
73
67
  enumerable: true,
74
68
  get: function () {
75
- return _foundation.DdTrace;
69
+ return _DdLogs.DdLogs;
76
70
  }
77
71
  });
78
72
  Object.defineProperty(exports, "DdRum", {
79
73
  enumerable: true,
80
74
  get: function () {
81
- return _foundation.DdRum;
75
+ return _DdRum.DdRum;
82
76
  }
83
77
  });
84
78
  Object.defineProperty(exports, "RumActionType", {
@@ -93,8 +87,12 @@ Object.defineProperty(exports, "ErrorSource", {
93
87
  return _types.ErrorSource;
94
88
  }
95
89
  });
96
-
97
- var _DatadogProvider = require("./DatadogProvider/DatadogProvider");
90
+ Object.defineProperty(exports, "DatadogProvider", {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _DatadogProvider.DatadogProvider;
94
+ }
95
+ });
98
96
 
99
97
  var _DdSdkReactNativeConfiguration = require("./DdSdkReactNativeConfiguration");
100
98
 
@@ -110,5 +108,11 @@ var _TrackingConsent = require("./TrackingConsent");
110
108
 
111
109
  var _foundation = require("./foundation");
112
110
 
113
- var _types = require("./types");
111
+ var _DdLogs = require("./logs/DdLogs");
112
+
113
+ var _DdRum = require("./rum/DdRum");
114
+
115
+ var _types = require("./rum/types");
116
+
117
+ var _DatadogProvider = require("./sdk/DatadogProvider/DatadogProvider");
114
118
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { DatadogProvider } from './DatadogProvider/DatadogProvider';\nimport {\n DatadogProviderConfiguration,\n DdSdkReactNativeConfiguration,\n InitializationMode\n} from './DdSdkReactNativeConfiguration';\nimport { DdSdkReactNative } from './DdSdkReactNative';\nimport { InternalLog } from './InternalLog';\nimport { ProxyConfiguration, ProxyType } from './ProxyConfiguration';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport { DdLogs, DdTrace, DdRum } from './foundation';\nimport { RumActionType, ErrorSource } from './types';\n\nexport {\n DatadogProvider,\n DatadogProviderConfiguration,\n InitializationMode,\n DdLogs,\n DdTrace,\n DdRum,\n RumActionType,\n ErrorSource,\n DdSdkReactNativeConfiguration,\n DdSdkReactNative,\n InternalLog,\n ProxyConfiguration,\n ProxyType,\n TrackingConsent,\n SdkVerbosity\n};\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport {\n DatadogProviderConfiguration,\n DdSdkReactNativeConfiguration,\n InitializationMode\n} from './DdSdkReactNativeConfiguration';\nimport { DdSdkReactNative } from './DdSdkReactNative';\nimport { InternalLog } from './InternalLog';\nimport { ProxyConfiguration, ProxyType } from './ProxyConfiguration';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport { DdTrace } from './foundation';\nimport { DdLogs } from './logs/DdLogs';\nimport { DdRum } from './rum/DdRum';\nimport { RumActionType, ErrorSource } from './rum/types';\nimport { DatadogProvider } from './sdk/DatadogProvider/DatadogProvider';\n\nexport {\n DatadogProvider,\n DatadogProviderConfiguration,\n InitializationMode,\n DdLogs,\n DdTrace,\n DdRum,\n RumActionType,\n ErrorSource,\n DdSdkReactNativeConfiguration,\n DdSdkReactNative,\n InternalLog,\n ProxyConfiguration,\n ProxyType,\n TrackingConsent,\n SdkVerbosity\n};\n"]}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DdLogs = void 0;
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ var _InternalLog = require("../InternalLog");
11
+
12
+ var _SdkVerbosity = require("../SdkVerbosity");
13
+
14
+ var _eventMapper = require("./eventMapper");
15
+
16
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
+
18
+ const generateEmptyPromise = () => new Promise(resolve => resolve());
19
+
20
+ class DdLogsWrapper {
21
+ constructor() {
22
+ _defineProperty(this, "nativeLogs", _reactNative.NativeModules.DdLogs);
23
+
24
+ _defineProperty(this, "logEventMapper", (0, _eventMapper.generateEventMapper)(undefined));
25
+
26
+ _defineProperty(this, "log", (message, context, status) => {
27
+ _InternalLog.InternalLog.log(`Tracking ${status} log “${message}”`, _SdkVerbosity.SdkVerbosity.DEBUG);
28
+
29
+ const event = this.logEventMapper.applyEventMapper({
30
+ message,
31
+ context,
32
+ status
33
+ });
34
+
35
+ if (!event) {
36
+ return generateEmptyPromise();
37
+ }
38
+
39
+ return this.nativeLogs[status](event.message, event.context);
40
+ });
41
+ }
42
+
43
+ debug(message, context = {}) {
44
+ return this.log(message, context, 'debug');
45
+ }
46
+
47
+ info(message, context = {}) {
48
+ return this.log(message, context, 'info');
49
+ }
50
+
51
+ warn(message, context = {}) {
52
+ return this.log(message, context, 'warn');
53
+ }
54
+
55
+ error(message, context = {}) {
56
+ return this.log(message, context, 'error');
57
+ }
58
+
59
+ registerLogEventMapper(logEventMapper) {
60
+ this.logEventMapper = (0, _eventMapper.generateEventMapper)(logEventMapper);
61
+ }
62
+
63
+ unregisterLogEventMapper() {
64
+ this.logEventMapper = (0, _eventMapper.generateEventMapper)(undefined);
65
+ }
66
+
67
+ }
68
+
69
+ const DdLogs = new DdLogsWrapper();
70
+ exports.DdLogs = DdLogs;
71
+ //# sourceMappingURL=DdLogs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["DdLogs.ts"],"names":["generateEmptyPromise","Promise","resolve","DdLogsWrapper","NativeModules","DdLogs","undefined","message","context","status","InternalLog","log","SdkVerbosity","DEBUG","event","logEventMapper","applyEventMapper","nativeLogs","debug","info","warn","error","registerLogEventMapper","unregisterLogEventMapper"],"mappings":";;;;;;;AAMA;;AAEA;;AACA;;AAGA;;;;AAGA,MAAMA,oBAAoB,GAAG,MAAM,IAAIC,OAAJ,CAAkBC,OAAO,IAAIA,OAAO,EAApC,CAAnC;;AAEA,MAAMC,aAAN,CAA0C;AAAA;AAAA,wCACCC,2BAAcC,MADf;;AAAA,4CAEb,sCAAoBC,SAApB,CAFa;;AAAA,iCAoBxB,CACVC,OADU,EAEVC,OAFU,EAGVC,MAHU,KAIM;AAChBC,+BAAYC,GAAZ,CACK,YAAWF,MAAO,SAAQF,OAAQ,GADvC,EAEIK,2BAAaC,KAFjB;;AAIA,YAAMC,KAAK,GAAG,KAAKC,cAAL,CAAoBC,gBAApB,CAAqC;AAC/CT,QAAAA,OAD+C;AAE/CC,QAAAA,OAF+C;AAG/CC,QAAAA;AAH+C,OAArC,CAAd;;AAKA,UAAI,CAACK,KAAL,EAAY;AACR,eAAOd,oBAAoB,EAA3B;AACH;;AACD,aAAO,KAAKiB,UAAL,CAAgBR,MAAhB,EAAwBK,KAAK,CAACP,OAA9B,EAAuCO,KAAK,CAACN,OAA7C,CAAP;AACH,KAtCqC;AAAA;;AAItCU,EAAAA,KAAK,CAACX,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACxD,WAAO,KAAKG,GAAL,CAASJ,OAAT,EAAkBC,OAAlB,EAA2B,OAA3B,CAAP;AACH;;AAEDW,EAAAA,IAAI,CAACZ,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACvD,WAAO,KAAKG,GAAL,CAASJ,OAAT,EAAkBC,OAAlB,EAA2B,MAA3B,CAAP;AACH;;AAEDY,EAAAA,IAAI,CAACb,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACvD,WAAO,KAAKG,GAAL,CAASJ,OAAT,EAAkBC,OAAlB,EAA2B,MAA3B,CAAP;AACH;;AAEDa,EAAAA,KAAK,CAACd,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACxD,WAAO,KAAKG,GAAL,CAASJ,OAAT,EAAkBC,OAAlB,EAA2B,OAA3B,CAAP;AACH;;AAsBDc,EAAAA,sBAAsB,CAACP,cAAD,EAAiC;AACnD,SAAKA,cAAL,GAAsB,sCAAoBA,cAApB,CAAtB;AACH;;AAEDQ,EAAAA,wBAAwB,GAAG;AACvB,SAAKR,cAAL,GAAsB,sCAAoBT,SAApB,CAAtB;AACH;;AA9CqC;;AAiDnC,MAAMD,MAAM,GAAG,IAAIF,aAAJ,EAAf","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { NativeModules } from 'react-native';\n\nimport { InternalLog } from '../InternalLog';\nimport { SdkVerbosity } from '../SdkVerbosity';\nimport type { DdNativeLogsType } from '../nativeModulesTypes';\n\nimport { generateEventMapper } from './eventMapper';\nimport type { DdLogsType, LogEventMapper } from './types';\n\nconst generateEmptyPromise = () => new Promise<void>(resolve => resolve());\n\nclass DdLogsWrapper implements DdLogsType {\n private nativeLogs: DdNativeLogsType = NativeModules.DdLogs;\n private logEventMapper = generateEventMapper(undefined);\n\n debug(message: string, context: object = {}): Promise<void> {\n return this.log(message, context, 'debug');\n }\n\n info(message: string, context: object = {}): Promise<void> {\n return this.log(message, context, 'info');\n }\n\n warn(message: string, context: object = {}): Promise<void> {\n return this.log(message, context, 'warn');\n }\n\n error(message: string, context: object = {}): Promise<void> {\n return this.log(message, context, 'error');\n }\n\n private log = (\n message: string,\n context: object,\n status: keyof DdNativeLogsType\n ): Promise<void> => {\n InternalLog.log(\n `Tracking ${status} log “${message}”`,\n SdkVerbosity.DEBUG\n );\n const event = this.logEventMapper.applyEventMapper({\n message,\n context,\n status\n });\n if (!event) {\n return generateEmptyPromise();\n }\n return this.nativeLogs[status](event.message, event.context);\n };\n\n registerLogEventMapper(logEventMapper: LogEventMapper) {\n this.logEventMapper = generateEventMapper(logEventMapper);\n }\n\n unregisterLogEventMapper() {\n this.logEventMapper = generateEventMapper(undefined);\n }\n}\n\nexport const DdLogs = new DdLogsWrapper();\n"]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.generateEventMapper = exports.formatRawLogToLogEvent = exports.formatRawLogToNativeEvent = exports.formatLogEventToNativeLog = void 0;
7
+
8
+ var _EventMapper = require("../sdk/EventMappers/EventMapper");
9
+
10
+ /*
11
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
12
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
13
+ * Copyright 2016-Present Datadog, Inc.
14
+ */
15
+ const formatLogEventToNativeLog = logEvent => {
16
+ return logEvent;
17
+ };
18
+
19
+ exports.formatLogEventToNativeLog = formatLogEventToNativeLog;
20
+
21
+ const formatRawLogToNativeEvent = rawLog => {
22
+ return rawLog;
23
+ };
24
+
25
+ exports.formatRawLogToNativeEvent = formatRawLogToNativeEvent;
26
+
27
+ const formatRawLogToLogEvent = (rawLog, additionalInformation) => {
28
+ return { ...rawLog,
29
+ userInfo: additionalInformation.userInfo,
30
+ attributes: additionalInformation.attributes
31
+ };
32
+ };
33
+
34
+ exports.formatRawLogToLogEvent = formatRawLogToLogEvent;
35
+
36
+ const generateEventMapper = logEventMapper => new _EventMapper.EventMapper(logEventMapper, formatRawLogToLogEvent, formatLogEventToNativeLog, formatRawLogToNativeEvent);
37
+
38
+ exports.generateEventMapper = generateEventMapper;
39
+ //# sourceMappingURL=eventMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["eventMapper.ts"],"names":["formatLogEventToNativeLog","logEvent","formatRawLogToNativeEvent","rawLog","formatRawLogToLogEvent","additionalInformation","userInfo","attributes","generateEventMapper","logEventMapper","EventMapper"],"mappings":";;;;;;;AAOA;;AAPA;AACA;AACA;AACA;AACA;AAQO,MAAMA,yBAAyB,GAAIC,QAAD,IAAmC;AACxE,SAAOA,QAAP;AACH,CAFM;;;;AAIA,MAAMC,yBAAyB,GAAIC,MAAD,IAA+B;AACpE,SAAOA,MAAP;AACH,CAFM;;;;AAIA,MAAMC,sBAAsB,GAAG,CAClCD,MADkC,EAElCE,qBAFkC,KAMvB;AACX,SAAO,EACH,GAAGF,MADA;AAEHG,IAAAA,QAAQ,EAAED,qBAAqB,CAACC,QAF7B;AAGHC,IAAAA,UAAU,EAAEF,qBAAqB,CAACE;AAH/B,GAAP;AAKH,CAZM;;;;AAcA,MAAMC,mBAAmB,GAC5BC,cAD+B,IAG/B,IAAIC,wBAAJ,CACID,cADJ,EAEIL,sBAFJ,EAGIJ,yBAHJ,EAIIE,yBAJJ,CAHG","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { Attributes } from '../sdk/AttributesSingleton/types';\nimport { EventMapper } from '../sdk/EventMappers/EventMapper';\nimport type { UserInfo } from '../sdk/UserInfoSingleton/types';\n\nimport type { LogEvent, LogEventMapper, NativeLog, RawLog } from './types';\n\nexport const formatLogEventToNativeLog = (logEvent: LogEvent): NativeLog => {\n return logEvent;\n};\n\nexport const formatRawLogToNativeEvent = (rawLog: RawLog): NativeLog => {\n return rawLog;\n};\n\nexport const formatRawLogToLogEvent = (\n rawLog: RawLog,\n additionalInformation: {\n userInfo: UserInfo;\n attributes: Attributes;\n }\n): LogEvent => {\n return {\n ...rawLog,\n userInfo: additionalInformation.userInfo,\n attributes: additionalInformation.attributes\n };\n};\n\nexport const generateEventMapper = (\n logEventMapper: LogEventMapper | undefined\n) =>\n new EventMapper(\n logEventMapper,\n formatRawLogToLogEvent,\n formatLogEventToNativeLog,\n formatRawLogToNativeEvent\n );\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["nativeModulesTypes.ts"],"names":["DdNativeSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","sampleRate","site","trackingConsent","additionalConfig"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,wBAAN,CAA+B;AAClCC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,UALF,EAMEC,IANF,EAOEC,eAPF,EAQEC,gBARF,EAST;AAAA,SARWP,WAQX,GARWA,WAQX;AAAA,SAPWC,GAOX,GAPWA,GAOX;AAAA,SANWC,aAMX,GANWA,aAMX;AAAA,SALWC,wBAKX,GALWA,wBAKX;AAAA,SAJWC,UAIX,GAJWA,UAIX;AAAA,SAHWC,IAGX,GAHWA,IAGX;AAAA,SAFWC,eAEX,GAFWA,eAEX;AAAA,SADWC,gBACX,GADWA,gBACX;AAAE;;AAV8B;AAatC;AACA;AACA","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/**\n * A configuration object to initialize Datadog's features.\n */\nexport class DdNativeSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfig: object\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdNativeSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdNativeSdkConfiguration): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: object): Promise<void>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n\n /**\n * Sends internal telemetry debug message\n * @param message debug message\n */\n telemetryDebug(message: string): Promise<void>;\n\n /**\n * Sends internal telemetry error\n * @param message error message\n * @param stack error stack\n * @param kind error kind\n */\n telemetryError(message: string, stack: string, kind: string): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Logs feature.\n */\nexport type DdNativeLogsType = {\n /**\n * Send a log with level debug.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n debug(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level info.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n info(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level warn.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n warn(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level error.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n error(message: string, context?: object): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdNativeTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's RUM feature.\n */\nexport type DdNativeRumType = {\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(\n key: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: ActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: ActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: ActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size?: number,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.\n * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.\n */\n addTiming(name: string): Promise<void>;\n};\n\ntype ActionType = 'TAP' | 'SCROLL' | 'SWIPE' | 'BACK' | 'CUSTOM';\n\ntype ResourceKind =\n | 'image'\n | 'xhr'\n | 'beacon'\n | 'css'\n | 'document'\n | 'fetch'\n | 'font'\n | 'js'\n | 'media'\n | 'other'\n | 'native';\n\ntype ErrorSource = 'NETWORK' | 'SOURCE' | 'CONSOLE' | 'WEBVIEW' | 'CUSTOM';\n"]}
1
+ {"version":3,"sources":["nativeModulesTypes.ts"],"names":["DdNativeSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","sampleRate","site","trackingConsent","additionalConfig"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,wBAAN,CAA+B;AAClCC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,UALF,EAMEC,IANF,EAOEC,eAPF,EAQEC,gBARF,EAST;AAAA,SARWP,WAQX,GARWA,WAQX;AAAA,SAPWC,GAOX,GAPWA,GAOX;AAAA,SANWC,aAMX,GANWA,aAMX;AAAA,SALWC,wBAKX,GALWA,wBAKX;AAAA,SAJWC,UAIX,GAJWA,UAIX;AAAA,SAHWC,IAGX,GAHWA,IAGX;AAAA,SAFWC,eAEX,GAFWA,eAEX;AAAA,SADWC,gBACX,GADWA,gBACX;AAAE;;AAV8B;AAatC;AACA;AACA","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/**\n * A configuration object to initialize Datadog's features.\n */\nexport class DdNativeSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfig: object\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdNativeSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdNativeSdkConfiguration): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: object): Promise<object>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n\n /**\n * Sends internal telemetry debug message\n * @param message debug message\n */\n telemetryDebug(message: string): Promise<void>;\n\n /**\n * Sends internal telemetry error\n * @param message error message\n * @param stack error stack\n * @param kind error kind\n */\n telemetryError(message: string, stack: string, kind: string): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Logs feature.\n */\nexport type DdNativeLogsType = {\n /**\n * Send a log with level debug.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n debug(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level info.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n info(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level warn.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n warn(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level error.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n error(message: string, context?: object): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdNativeTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's RUM feature.\n */\nexport type DdNativeRumType = {\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(\n key: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: ActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: ActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: ActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size?: number,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.\n * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.\n */\n addTiming(name: string): Promise<void>;\n};\n\ntype ActionType = 'TAP' | 'SCROLL' | 'SWIPE' | 'BACK' | 'CUSTOM';\n\ntype ResourceKind =\n | 'image'\n | 'xhr'\n | 'beacon'\n | 'css'\n | 'document'\n | 'fetch'\n | 'font'\n | 'js'\n | 'media'\n | 'other'\n | 'native';\n\ntype ErrorSource = 'NETWORK' | 'SOURCE' | 'CONSOLE' | 'WEBVIEW' | 'CUSTOM';\n"]}