@datadog/mobile-react-native 2.3.1 → 2.3.3
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.
- package/DatadogSDKReactNative.podspec +1 -0
- package/android/build.gradle +2 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkBridgeExt.kt +188 -20
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +30 -13
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdLogs.kt +3 -2
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt +28 -13
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdSdk.kt +3 -2
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdTrace.kt +4 -2
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdLogs.kt +1 -1
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +3 -2
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdTrace.kt +4 -2
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkBridgeExtTest.kt +382 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/MapExt.kt +9 -0
- package/ios/Sources/JSRefreshRateListener.swift +1 -0
- package/ios/Sources/SdkVersion.swift +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +7 -7
- package/lib/typescript/logs/types.d.ts +10 -10
- package/lib/typescript/nativeModulesTypes.d.ts +5 -5
- package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts +4 -4
- package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +4 -4
- package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts +4 -4
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +3 -3
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +1 -1
- package/lib/typescript/rum/types.d.ts +3 -3
- package/lib/typescript/sdk/AttributesSingleton/types.d.ts +1 -1
- package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +2 -2
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +1 -1
- package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +1 -1
- package/lib/typescript/types.d.ts +2 -2
- package/lib/typescript/utils/TimeProvider.d.ts +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +1 -1
- package/src/version.ts +1 -1
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
package com.datadog.reactnative
|
|
8
|
+
|
|
9
|
+
import com.datadog.tools.unit.keys
|
|
10
|
+
import com.datadog.tools.unit.toReadableArray
|
|
11
|
+
import com.datadog.tools.unit.toReadableMap
|
|
12
|
+
import com.facebook.react.bridge.JavaOnlyArray
|
|
13
|
+
import com.facebook.react.bridge.JavaOnlyMap
|
|
14
|
+
import com.facebook.react.bridge.WritableArray
|
|
15
|
+
import com.facebook.react.bridge.WritableMap
|
|
16
|
+
import org.assertj.core.api.Assertions.assertThat
|
|
17
|
+
import org.junit.jupiter.api.Test
|
|
18
|
+
|
|
19
|
+
internal class DdSdkBridgeExtTest {
|
|
20
|
+
// Default providers for toWritableArray and toWritableMap
|
|
21
|
+
private val createWritableMap = { JavaOnlyMap() }
|
|
22
|
+
private val createWritableArray = { JavaOnlyArray() }
|
|
23
|
+
|
|
24
|
+
@Test
|
|
25
|
+
fun `M do a proper conversion W toWritableArray { all types of supported values }`() {
|
|
26
|
+
// Given
|
|
27
|
+
val array = getTestArray()
|
|
28
|
+
val nestedTestMap = getTestMap()
|
|
29
|
+
val nestedTestArray = getTestArray()
|
|
30
|
+
|
|
31
|
+
array.add(nestedTestMap) // Nested map
|
|
32
|
+
array.add(nestedTestArray) // Nested array
|
|
33
|
+
|
|
34
|
+
// When
|
|
35
|
+
val writableArray = array.toWritableArray(createWritableMap, createWritableArray)
|
|
36
|
+
|
|
37
|
+
// Then
|
|
38
|
+
assertThat(writableArray.size()).isEqualTo(array.size)
|
|
39
|
+
testWritableArray(writableArray)
|
|
40
|
+
|
|
41
|
+
val nestedMap = writableArray.getMap(array.size - 2)
|
|
42
|
+
assertThat(nestedMap).isInstanceOf(WritableMap::class.java)
|
|
43
|
+
assertThat(nestedMap.keys()).hasSameSizeAs(nestedTestMap.keys)
|
|
44
|
+
testWritableMap(nestedMap as WritableMap)
|
|
45
|
+
|
|
46
|
+
val nestedArray = writableArray.getArray(array.size - 1)
|
|
47
|
+
assertThat(nestedArray).isInstanceOf(WritableArray::class.java)
|
|
48
|
+
assertThat(nestedArray.size()).isEqualTo(nestedTestArray.size)
|
|
49
|
+
testWritableArray(nestedArray as WritableArray)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Test
|
|
53
|
+
fun `M do a proper conversion W toWritableMap { raw and nested values }`() {
|
|
54
|
+
// Given
|
|
55
|
+
val map = getTestMap()
|
|
56
|
+
val nestedTestMap = getTestMap()
|
|
57
|
+
val nestedTestArray = getTestArray()
|
|
58
|
+
|
|
59
|
+
map["map"] = nestedTestMap
|
|
60
|
+
map["array"] = nestedTestArray
|
|
61
|
+
|
|
62
|
+
// When
|
|
63
|
+
val writableMap = map.toWritableMap(createWritableMap, createWritableArray)
|
|
64
|
+
|
|
65
|
+
// Then
|
|
66
|
+
testWritableMap(writableMap)
|
|
67
|
+
|
|
68
|
+
val nestedMap = writableMap.getMap("map")
|
|
69
|
+
assertThat(nestedMap).isNotNull()
|
|
70
|
+
assertThat(nestedMap).isInstanceOf(WritableMap::class.java)
|
|
71
|
+
assertThat(nestedMap!!.keys()).hasSameSizeAs(nestedTestMap.keys)
|
|
72
|
+
testWritableMap(nestedMap as WritableMap)
|
|
73
|
+
|
|
74
|
+
val nestedArray = writableMap.getArray("array")
|
|
75
|
+
assertThat(nestedArray).isNotNull()
|
|
76
|
+
assertThat(nestedArray).isInstanceOf(WritableArray::class.java)
|
|
77
|
+
assertThat(nestedArray!!.size()).isEqualTo(nestedTestArray.size)
|
|
78
|
+
testWritableArray(nestedArray as WritableArray)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@Test
|
|
82
|
+
fun `M do a proper conversion W toMap { 1-level JavaOnlyMap }`() {
|
|
83
|
+
// Given
|
|
84
|
+
val writableMap = getTestWritableMap()
|
|
85
|
+
|
|
86
|
+
// When
|
|
87
|
+
val map = writableMap.toMap()
|
|
88
|
+
|
|
89
|
+
// Then
|
|
90
|
+
testMap(map)
|
|
91
|
+
assertThat(map).isEqualTo(writableMap.toHashMap())
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@Test
|
|
95
|
+
fun `M do a proper conversion W toMap { nested JavaOnlyMap }`() {
|
|
96
|
+
// Given
|
|
97
|
+
val writableMap = getTestWritableMap()
|
|
98
|
+
val nestedTestMap = getTestWritableMap()
|
|
99
|
+
|
|
100
|
+
writableMap.putMap("map", nestedTestMap)
|
|
101
|
+
|
|
102
|
+
// When
|
|
103
|
+
val map = writableMap.toMap()
|
|
104
|
+
|
|
105
|
+
// Then
|
|
106
|
+
assertThat(map).isNotNull()
|
|
107
|
+
assertThat(map).hasSameSizeAs(writableMap.keys())
|
|
108
|
+
testMap(map)
|
|
109
|
+
|
|
110
|
+
val nestedMap = map["map"]
|
|
111
|
+
assertThat(nestedMap).isNotNull()
|
|
112
|
+
assertThat(nestedMap).isInstanceOf(Map::class.java)
|
|
113
|
+
assertThat((nestedMap as Map<*, *>)).hasSameSizeAs(nestedTestMap.keys())
|
|
114
|
+
testMap(nestedMap)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@Test
|
|
118
|
+
fun `M do a proper conversion W toMap { nested JavaOnlyArray }`() {
|
|
119
|
+
// Given
|
|
120
|
+
val writableMap = getTestWritableMap()
|
|
121
|
+
val nestedTestArray = getTestWritableArray()
|
|
122
|
+
|
|
123
|
+
writableMap.putArray("array", nestedTestArray)
|
|
124
|
+
|
|
125
|
+
// When
|
|
126
|
+
val map = writableMap.toMap()
|
|
127
|
+
|
|
128
|
+
// Then
|
|
129
|
+
assertThat(map).isNotNull()
|
|
130
|
+
assertThat(map).hasSameSizeAs(writableMap.keys())
|
|
131
|
+
testMap(map)
|
|
132
|
+
|
|
133
|
+
val nestedArray = map["array"]
|
|
134
|
+
assertThat(nestedArray).isNotNull()
|
|
135
|
+
assertThat(nestedArray).isInstanceOf(List::class.java)
|
|
136
|
+
assertThat(nestedArray as List<*>).hasSize(nestedTestArray.size())
|
|
137
|
+
testArray(nestedArray)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@Test
|
|
141
|
+
fun `M do a proper conversion W toMap { nested JavaOnlyMap and JavaOnlyArray }`() {
|
|
142
|
+
// Given
|
|
143
|
+
val writableMap = getTestWritableMap()
|
|
144
|
+
val nestedTestMap = getTestWritableMap()
|
|
145
|
+
val nestedTestArray = getTestWritableArray()
|
|
146
|
+
|
|
147
|
+
writableMap.putMap("map", nestedTestMap)
|
|
148
|
+
writableMap.putArray("array", nestedTestArray)
|
|
149
|
+
|
|
150
|
+
// When
|
|
151
|
+
val map = writableMap.toMap()
|
|
152
|
+
|
|
153
|
+
// Then
|
|
154
|
+
assertThat((map as Map<*, *>)).hasSameSizeAs(writableMap.keys())
|
|
155
|
+
testMap(map)
|
|
156
|
+
|
|
157
|
+
val nestedMap = map["map"]
|
|
158
|
+
assertThat((nestedMap as Map<*, *>)).hasSameSizeAs(nestedTestMap.keys())
|
|
159
|
+
assertThat(nestedMap).isNotNull()
|
|
160
|
+
assertThat(nestedMap).isInstanceOf(Map::class.java)
|
|
161
|
+
testMap(nestedMap)
|
|
162
|
+
|
|
163
|
+
val nestedArray = map["array"]
|
|
164
|
+
assertThat(nestedArray).isNotNull()
|
|
165
|
+
assertThat(nestedArray).isInstanceOf(List::class.java)
|
|
166
|
+
assertThat((nestedArray as List<*>)).hasSize(nestedTestArray.size())
|
|
167
|
+
testArray(nestedArray)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@Test
|
|
171
|
+
fun `M do a proper conversion W toList { with raw types only }`() {
|
|
172
|
+
// Given
|
|
173
|
+
val writableArray = getTestWritableArray()
|
|
174
|
+
|
|
175
|
+
// When
|
|
176
|
+
val array = writableArray.toList()
|
|
177
|
+
|
|
178
|
+
// Then
|
|
179
|
+
assertThat(array).isNotNull()
|
|
180
|
+
assertThat(array).hasSize(writableArray.size())
|
|
181
|
+
testArray(array)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
@Test
|
|
185
|
+
fun `M do a proper conversion W toList { with nested objects }`() {
|
|
186
|
+
// Given
|
|
187
|
+
val writableArray = getTestWritableArray()
|
|
188
|
+
val nestedTestMap = getTestWritableMap()
|
|
189
|
+
val nestedTestArray = getTestWritableArray()
|
|
190
|
+
|
|
191
|
+
writableArray.pushMap(nestedTestMap)
|
|
192
|
+
writableArray.pushArray(nestedTestArray)
|
|
193
|
+
|
|
194
|
+
// When
|
|
195
|
+
val array = writableArray.toList()
|
|
196
|
+
|
|
197
|
+
// Then
|
|
198
|
+
assertThat(array).isNotNull()
|
|
199
|
+
assertThat(array).hasSize(writableArray.size())
|
|
200
|
+
testArray(array)
|
|
201
|
+
|
|
202
|
+
val nestedMap = array[array.size - 2]
|
|
203
|
+
assertThat(nestedMap).isInstanceOf(Map::class.java)
|
|
204
|
+
assertThat((nestedMap as Map<*, *>)).hasSameSizeAs(nestedTestMap.keys())
|
|
205
|
+
testMap(nestedMap)
|
|
206
|
+
|
|
207
|
+
val nestedArray = array[array.size - 1]
|
|
208
|
+
assertThat(nestedArray).isInstanceOf(List::class.java)
|
|
209
|
+
assertThat((nestedArray as List<*>)).hasSize(nestedTestArray.size())
|
|
210
|
+
testArray(nestedArray)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@Test
|
|
214
|
+
fun `M do a proper conversion and not throw W toMap { malformed nested map }`() {
|
|
215
|
+
// Given
|
|
216
|
+
val readableMap =
|
|
217
|
+
mapOf(
|
|
218
|
+
"map" to mapOf("test" to "test") // NOT a ReadableMap
|
|
219
|
+
).toReadableMap()
|
|
220
|
+
|
|
221
|
+
// When
|
|
222
|
+
val map = readableMap.toMap()
|
|
223
|
+
|
|
224
|
+
// Then
|
|
225
|
+
assertThat(map).isEmpty()
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
@Test
|
|
229
|
+
fun `M do a proper conversion and not throw W toList { malformed nested array }`() {
|
|
230
|
+
// Given
|
|
231
|
+
val readableArray =
|
|
232
|
+
listOf(
|
|
233
|
+
mapOf("test" to "test"), // NOT a ReadableMap
|
|
234
|
+
listOf(null, true, 1.23, "test") // NOT a ReadableArray
|
|
235
|
+
).toReadableArray()
|
|
236
|
+
|
|
237
|
+
// When
|
|
238
|
+
val list = readableArray.toList()
|
|
239
|
+
|
|
240
|
+
// Then
|
|
241
|
+
assertThat(list).isEmpty()
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
private fun getTestMap(): MutableMap<String, Any?> = mutableMapOf(
|
|
245
|
+
"null" to null,
|
|
246
|
+
"int" to 1,
|
|
247
|
+
"long" to 2L,
|
|
248
|
+
"float" to 3.0f,
|
|
249
|
+
"double" to 4.0,
|
|
250
|
+
"string" to "test",
|
|
251
|
+
"boolean" to true
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
private fun getTestWritableMap(): JavaOnlyMap = JavaOnlyMap.of(
|
|
255
|
+
"null",
|
|
256
|
+
null,
|
|
257
|
+
"int",
|
|
258
|
+
1,
|
|
259
|
+
"long",
|
|
260
|
+
2L,
|
|
261
|
+
"float",
|
|
262
|
+
3.0f,
|
|
263
|
+
"double",
|
|
264
|
+
4.0,
|
|
265
|
+
"string",
|
|
266
|
+
"test",
|
|
267
|
+
"boolean",
|
|
268
|
+
true
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
// Long type is not handled in JavaOnlyArray getType() in RN 0.71.10
|
|
272
|
+
// https://github.com/facebook/react-native/pull/43158
|
|
273
|
+
private fun getTestArray(): MutableList<Any?> = mutableListOf(
|
|
274
|
+
null,
|
|
275
|
+
1,
|
|
276
|
+
2.0f,
|
|
277
|
+
3.0,
|
|
278
|
+
"test",
|
|
279
|
+
true
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
// Long type is not handled in JavaOnlyArray getType() in RN 0.71.10
|
|
283
|
+
// https://github.com/facebook/react-native/pull/43158
|
|
284
|
+
private fun getTestWritableArray(): WritableArray = JavaOnlyArray.from(
|
|
285
|
+
listOf(
|
|
286
|
+
null,
|
|
287
|
+
1,
|
|
288
|
+
2.0f,
|
|
289
|
+
3.0,
|
|
290
|
+
"test",
|
|
291
|
+
true
|
|
292
|
+
)
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
private fun testWritableArray(array: WritableArray) {
|
|
296
|
+
assertThat(array.getDynamic(0).isNull).isTrue()
|
|
297
|
+
|
|
298
|
+
assertThat(array.getInt(1)).isInstanceOf(java.lang.Integer::class.java)
|
|
299
|
+
assertThat(array.getInt(1)).isEqualTo(1)
|
|
300
|
+
|
|
301
|
+
assertThat(array.getDouble(2)).isInstanceOf(java.lang.Double::class.java)
|
|
302
|
+
assertThat(array.getDouble(2)).isEqualTo(2.0)
|
|
303
|
+
|
|
304
|
+
assertThat(array.getDouble(3)).isInstanceOf(java.lang.Double::class.java)
|
|
305
|
+
assertThat(array.getDouble(3)).isEqualTo(3.0)
|
|
306
|
+
|
|
307
|
+
assertThat(array.getString(4)).isInstanceOf(java.lang.String::class.java)
|
|
308
|
+
assertThat(array.getString(4)).isEqualTo("test")
|
|
309
|
+
|
|
310
|
+
assertThat(array.getBoolean(5)).isInstanceOf(java.lang.Boolean::class.java)
|
|
311
|
+
assertThat(array.getBoolean(5)).isTrue()
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
private fun testWritableMap(map: WritableMap) {
|
|
315
|
+
assertThat(map.getDynamic("null").isNull).isTrue()
|
|
316
|
+
|
|
317
|
+
assertThat(map.getInt("int")).isInstanceOf(java.lang.Integer::class.java)
|
|
318
|
+
assertThat(map.getInt("int")).isEqualTo(1)
|
|
319
|
+
|
|
320
|
+
assertThat(map.getDouble("long")).isInstanceOf(java.lang.Double::class.java)
|
|
321
|
+
assertThat(map.getDouble("long")).isEqualTo(2.0)
|
|
322
|
+
|
|
323
|
+
assertThat(map.getDouble("float")).isInstanceOf(java.lang.Double::class.java)
|
|
324
|
+
assertThat(map.getDouble("float")).isEqualTo(3.0)
|
|
325
|
+
|
|
326
|
+
assertThat(map.getDouble("double")).isInstanceOf(java.lang.Double::class.java)
|
|
327
|
+
assertThat(map.getDouble("double")).isEqualTo(4.0)
|
|
328
|
+
|
|
329
|
+
assertThat(map.getString("string")).isInstanceOf(java.lang.String::class.java)
|
|
330
|
+
assertThat(map.getString("string")).isEqualTo("test")
|
|
331
|
+
|
|
332
|
+
assertThat(map.getBoolean("boolean")).isInstanceOf(java.lang.Boolean::class.java)
|
|
333
|
+
assertThat(map.getBoolean("boolean")).isTrue()
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
private fun testArray(array: List<*>) {
|
|
337
|
+
val iterator = array.iterator()
|
|
338
|
+
assertThat(iterator.next()).isNull()
|
|
339
|
+
|
|
340
|
+
assertThat(iterator.next())
|
|
341
|
+
.isInstanceOf(java.lang.Double::class.java)
|
|
342
|
+
.isEqualTo(1.0)
|
|
343
|
+
|
|
344
|
+
assertThat(iterator.next())
|
|
345
|
+
.isInstanceOf(java.lang.Double::class.java)
|
|
346
|
+
.isEqualTo(2.0)
|
|
347
|
+
|
|
348
|
+
assertThat(iterator.next())
|
|
349
|
+
.isInstanceOf(java.lang.Double::class.java)
|
|
350
|
+
.isEqualTo(3.0)
|
|
351
|
+
|
|
352
|
+
assertThat(iterator.next())
|
|
353
|
+
.isInstanceOf(java.lang.String::class.java)
|
|
354
|
+
.isEqualTo("test")
|
|
355
|
+
|
|
356
|
+
assertThat(iterator.next())
|
|
357
|
+
.isInstanceOf(java.lang.Boolean::class.java)
|
|
358
|
+
.isEqualTo(true)
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
private fun testMap(map: Map<*, *>) {
|
|
362
|
+
assertThat(map["null"]).isNull()
|
|
363
|
+
|
|
364
|
+
assertThat(map["int"]).isInstanceOf(java.lang.Double::class.java)
|
|
365
|
+
assertThat(map["int"]).isEqualTo(1.0)
|
|
366
|
+
|
|
367
|
+
assertThat(map["long"]).isInstanceOf(java.lang.Double::class.java)
|
|
368
|
+
assertThat(map["long"]).isEqualTo(2.0)
|
|
369
|
+
|
|
370
|
+
assertThat(map["float"]).isInstanceOf(java.lang.Double::class.java)
|
|
371
|
+
assertThat(map["float"]).isEqualTo(3.0)
|
|
372
|
+
|
|
373
|
+
assertThat(map["double"]).isInstanceOf(java.lang.Double::class.java)
|
|
374
|
+
assertThat(map["double"]).isEqualTo(4.0)
|
|
375
|
+
|
|
376
|
+
assertThat(map["string"]).isInstanceOf(java.lang.String::class.java)
|
|
377
|
+
assertThat(map["string"]).isEqualTo("test")
|
|
378
|
+
|
|
379
|
+
assertThat(map["boolean"]).isInstanceOf(java.lang.Boolean::class.java)
|
|
380
|
+
assertThat(map["boolean"] as Boolean).isTrue()
|
|
381
|
+
}
|
|
382
|
+
}
|
|
@@ -51,3 +51,12 @@ fun Set<*>.toReadableArray(): ReadableArray {
|
|
|
51
51
|
// this FB implementation is not backed by Android-specific .so library, so ok for unit tests
|
|
52
52
|
return JavaOnlyArray.from(this.toList())
|
|
53
53
|
}
|
|
54
|
+
|
|
55
|
+
fun ReadableMap.keys(): List<String> {
|
|
56
|
+
val keys = mutableListOf<String>()
|
|
57
|
+
val iterator = this.keySetIterator()
|
|
58
|
+
while (iterator.hasNextKey()) {
|
|
59
|
+
keys.add(iterator.nextKey())
|
|
60
|
+
}
|
|
61
|
+
return keys
|
|
62
|
+
}
|
|
@@ -25,6 +25,7 @@ internal final class JSRefreshRateMonitor: RefreshRateMonitor {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
public func startMonitoring(jsQueue: DispatchQueueType, frameTimeCallback: @escaping frame_time_callback) {
|
|
28
|
+
self.refreshRateListener.stop()
|
|
28
29
|
self.refreshRateListener = JSRefreshRateListener(jsQueue: jsQueue, frameTimeCallback: frameTimeCallback)
|
|
29
30
|
self.refreshRateListener.start()
|
|
30
31
|
}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.3.
|
|
1
|
+
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.3.3';\n"]}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.3.
|
|
1
|
+
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.3.3';\n"]}
|
|
@@ -40,9 +40,9 @@ export declare enum BatchSize {
|
|
|
40
40
|
*/
|
|
41
41
|
SMALL = "SMALL"
|
|
42
42
|
}
|
|
43
|
-
export
|
|
44
|
-
export
|
|
45
|
-
export
|
|
43
|
+
export type FirstPartyHostsConfiguration = (FirstPartyHost | LegacyFirstPartyHost)[];
|
|
44
|
+
export type LegacyFirstPartyHost = string;
|
|
45
|
+
export type CustomEndpoints = {
|
|
46
46
|
rum?: string;
|
|
47
47
|
logs?: string;
|
|
48
48
|
trace?: string;
|
|
@@ -243,7 +243,7 @@ export declare class DdSdkReactNativeConfiguration {
|
|
|
243
243
|
* Auto Instrumentation configuration passed to DatadogProvider.
|
|
244
244
|
* Does not include default values.
|
|
245
245
|
*/
|
|
246
|
-
export
|
|
246
|
+
export type AutoInstrumentationConfiguration = {
|
|
247
247
|
readonly trackInteractions: boolean;
|
|
248
248
|
readonly trackResources: boolean;
|
|
249
249
|
readonly firstPartyHosts?: FirstPartyHostsConfiguration;
|
|
@@ -258,7 +258,7 @@ export declare type AutoInstrumentationConfiguration = {
|
|
|
258
258
|
/**
|
|
259
259
|
* Parameters needed to start auto instrumentation. Includes default values.
|
|
260
260
|
*/
|
|
261
|
-
export
|
|
261
|
+
export type AutoInstrumentationParameters = {
|
|
262
262
|
readonly trackInteractions: boolean;
|
|
263
263
|
readonly trackResources: boolean;
|
|
264
264
|
readonly firstPartyHosts: FirstPartyHostsConfiguration;
|
|
@@ -275,7 +275,7 @@ export declare type AutoInstrumentationParameters = {
|
|
|
275
275
|
* the older android jsc that can still be used.
|
|
276
276
|
*/
|
|
277
277
|
export declare const addDefaultValuesToAutoInstrumentationConfiguration: (features: AutoInstrumentationConfiguration) => AutoInstrumentationParameters;
|
|
278
|
-
export
|
|
278
|
+
export type PartialInitializationConfiguration = {
|
|
279
279
|
readonly clientToken: string;
|
|
280
280
|
readonly env: string;
|
|
281
281
|
readonly applicationId: string;
|
|
@@ -313,4 +313,4 @@ export declare enum InitializationMode {
|
|
|
313
313
|
SYNC = "SYNC",
|
|
314
314
|
ASYNC = "ASYNC"
|
|
315
315
|
}
|
|
316
|
-
export
|
|
316
|
+
export type InitializationModeForTelemetry = 'LEGACY' | 'SYNC' | 'ASYNC' | 'PARTIAL' | 'FILE';
|
|
@@ -2,7 +2,7 @@ import type { UserInfo } from '../sdk/UserInfoSingleton/types';
|
|
|
2
2
|
/**
|
|
3
3
|
* The entry point to use Datadog's Logs feature.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type DdLogsType = {
|
|
6
6
|
/**
|
|
7
7
|
* Send a log with debug level.
|
|
8
8
|
* @param message: The message to send.
|
|
@@ -31,12 +31,12 @@ export declare type DdLogsType = {
|
|
|
31
31
|
/**
|
|
32
32
|
* Log input from developers
|
|
33
33
|
*/
|
|
34
|
-
export
|
|
34
|
+
export type RawLog = {
|
|
35
35
|
message: string;
|
|
36
36
|
context: object;
|
|
37
37
|
status: LogStatus;
|
|
38
38
|
};
|
|
39
|
-
export
|
|
39
|
+
export type RawLogWithError = {
|
|
40
40
|
message: string;
|
|
41
41
|
errorKind: string;
|
|
42
42
|
errorMessage: string;
|
|
@@ -47,19 +47,19 @@ export declare type RawLogWithError = {
|
|
|
47
47
|
/**
|
|
48
48
|
* Log input for native SDKs
|
|
49
49
|
*/
|
|
50
|
-
export
|
|
50
|
+
export type NativeLog = {
|
|
51
51
|
message: string;
|
|
52
52
|
context: object;
|
|
53
53
|
};
|
|
54
|
-
export
|
|
54
|
+
export type NativeLogWithError = {
|
|
55
55
|
message: string;
|
|
56
56
|
errorKind: string;
|
|
57
57
|
errorMessage: string;
|
|
58
58
|
stacktrace: string;
|
|
59
59
|
context: object;
|
|
60
60
|
};
|
|
61
|
-
export
|
|
62
|
-
export
|
|
61
|
+
export type LogStatus = 'debug' | 'info' | 'warn' | 'error';
|
|
62
|
+
export type LogEvent = {
|
|
63
63
|
message: string;
|
|
64
64
|
context: object;
|
|
65
65
|
errorKind?: string;
|
|
@@ -69,9 +69,9 @@ export declare type LogEvent = {
|
|
|
69
69
|
readonly userInfo: UserInfo;
|
|
70
70
|
readonly attributes?: object;
|
|
71
71
|
};
|
|
72
|
-
export
|
|
73
|
-
export
|
|
74
|
-
export
|
|
72
|
+
export type LogEventMapper = (logEvent: LogEvent) => LogEvent | null;
|
|
73
|
+
export type LogArguments = [message: string, context?: object];
|
|
74
|
+
export type LogWithErrorArguments = [
|
|
75
75
|
message: string,
|
|
76
76
|
errorKind?: string,
|
|
77
77
|
errorMessage?: string,
|
|
@@ -9,11 +9,11 @@ import type { Spec as NativeDdTrace } from './specs/NativeDdTrace';
|
|
|
9
9
|
/**
|
|
10
10
|
* The entry point to use Datadog's Logs feature.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export type DdNativeLogsType = NativeDdLogs;
|
|
13
13
|
/**
|
|
14
14
|
* The entry point to use Datadog's Trace feature.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type DdNativeTraceType = NativeDdTrace;
|
|
17
17
|
/**
|
|
18
18
|
* A configuration object to initialize Datadog's features.
|
|
19
19
|
*/
|
|
@@ -38,9 +38,9 @@ export interface DdNativeSdkType extends NativeDdSdk {
|
|
|
38
38
|
*/
|
|
39
39
|
initialize(configuration: DdNativeSdkConfiguration): Promise<void>;
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
type ActionType = 'TAP' | 'SCROLL' | 'SWIPE' | 'BACK' | 'CUSTOM';
|
|
42
|
+
type ResourceKind = 'image' | 'xhr' | 'beacon' | 'css' | 'document' | 'fetch' | 'font' | 'js' | 'media' | 'other' | 'native';
|
|
43
|
+
type ErrorSource = 'NETWORK' | 'SOURCE' | 'CONSOLE' | 'WEBVIEW' | 'CUSTOM';
|
|
44
44
|
/**
|
|
45
45
|
* The entry point to use Datadog's RUM feature.
|
|
46
46
|
*/
|
|
@@ -2,20 +2,20 @@ import type { GestureResponderEvent } from 'react-native';
|
|
|
2
2
|
import type { AdditionalEventDataForMapper } from '../../sdk/EventMappers/EventMapper';
|
|
3
3
|
import { EventMapper } from '../../sdk/EventMappers/EventMapper';
|
|
4
4
|
import type { RumActionType } from '../types';
|
|
5
|
-
|
|
5
|
+
type RawAction = {
|
|
6
6
|
readonly type: RumActionType;
|
|
7
7
|
readonly name: string;
|
|
8
8
|
context: object;
|
|
9
9
|
readonly timestampMs: number;
|
|
10
10
|
actionContext?: GestureResponderEvent;
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
type ActionEvent = RawAction & AdditionalEventDataForMapper;
|
|
13
|
+
type NativeAction = {
|
|
14
14
|
type: RumActionType;
|
|
15
15
|
name: string;
|
|
16
16
|
context: object;
|
|
17
17
|
timestampMs: number;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type ActionEventMapper = (event: ActionEvent) => ActionEvent | null;
|
|
20
20
|
export declare const generateActionEventMapper: (eventMapper: ActionEventMapper | undefined) => EventMapper<RawAction, ActionEvent, NativeAction>;
|
|
21
21
|
export {};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import type { AdditionalEventDataForMapper } from '../../sdk/EventMappers/EventMapper';
|
|
2
2
|
import { EventMapper } from '../../sdk/EventMappers/EventMapper';
|
|
3
3
|
import type { ErrorSource } from '../types';
|
|
4
|
-
|
|
4
|
+
type RawError = {
|
|
5
5
|
message: string;
|
|
6
6
|
source: ErrorSource;
|
|
7
7
|
stacktrace: string;
|
|
8
8
|
context: object;
|
|
9
9
|
timestampMs: number;
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
type ErrorEvent = RawError & AdditionalEventDataForMapper;
|
|
12
|
+
type NativeError = {
|
|
13
13
|
message: string;
|
|
14
14
|
source: ErrorSource;
|
|
15
15
|
stacktrace: string;
|
|
16
16
|
context: object;
|
|
17
17
|
timestampMs: number;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type ErrorEventMapper = (event: ErrorEvent) => ErrorEvent | null;
|
|
20
20
|
export declare const generateErrorEventMapper: (eventMapper: ErrorEventMapper | undefined) => EventMapper<RawError, ErrorEvent, NativeError>;
|
|
21
21
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AdditionalEventDataForMapper } from '../../sdk/EventMappers/EventMapper';
|
|
2
2
|
import { EventMapper } from '../../sdk/EventMappers/EventMapper';
|
|
3
3
|
import type { ResourceKind } from '../types';
|
|
4
|
-
|
|
4
|
+
type RawResource = {
|
|
5
5
|
readonly key: string;
|
|
6
6
|
readonly statusCode: number;
|
|
7
7
|
readonly kind: ResourceKind;
|
|
@@ -10,8 +10,8 @@ declare type RawResource = {
|
|
|
10
10
|
readonly timestampMs: number;
|
|
11
11
|
resourceContext: XMLHttpRequest | undefined;
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
type ResourceEvent = RawResource & AdditionalEventDataForMapper;
|
|
14
|
+
type NativeResource = {
|
|
15
15
|
key: string;
|
|
16
16
|
statusCode: number;
|
|
17
17
|
kind: ResourceKind;
|
|
@@ -19,6 +19,6 @@ declare type NativeResource = {
|
|
|
19
19
|
context: object;
|
|
20
20
|
timestampMs: number;
|
|
21
21
|
};
|
|
22
|
-
export
|
|
22
|
+
export type ResourceEventMapper = (event: ResourceEvent) => ResourceEvent | null;
|
|
23
23
|
export declare const generateResourceEventMapper: (eventMapper: ResourceEventMapper | undefined) => EventMapper<RawResource, ResourceEvent, NativeResource>;
|
|
24
24
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PropagatorType } from '../../../types';
|
|
2
2
|
import type { RegexMap } from '../requestProxy/interfaces/RequestProxy';
|
|
3
3
|
import type { Hostname } from './firstPartyHosts';
|
|
4
|
-
export
|
|
4
|
+
export type DdRumResourceTracingAttributes = {
|
|
5
5
|
tracingStrategy: 'KEEP';
|
|
6
6
|
traceId: TraceId;
|
|
7
7
|
spanId: SpanId;
|
|
@@ -23,10 +23,10 @@ export declare const getTracingAttributes: ({ hostname, firstPartyHostsRegexMap,
|
|
|
23
23
|
* Using branded types will ensure we don't accidentally use
|
|
24
24
|
* traceId for spanId when generating headers.
|
|
25
25
|
*/
|
|
26
|
-
export
|
|
26
|
+
export type TraceId = TraceIdentifier & {
|
|
27
27
|
_brand: 'traceId';
|
|
28
28
|
};
|
|
29
|
-
export
|
|
29
|
+
export type SpanId = TraceIdentifier & {
|
|
30
30
|
_brand: 'spanId';
|
|
31
31
|
};
|
|
32
32
|
export declare class TraceIdentifier {
|