@ansight/react-native 1.3.0-preview.1 → 1.3.0-preview.11
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/README.md +65 -3
- package/android/build.gradle +2 -2
- package/android/src/main/kotlin/ai/ansight/reactnative/AnsightReactNativeModule.kt +97 -8
- package/index.d.ts +127 -2
- package/index.js +375 -34
- package/ios/AnsightReactNative.swift +104 -7
- package/ios/AnsightReactNativeModule.m +8 -0
- package/network.js +764 -0
- package/package.json +5 -2
- package/session-properties.js +151 -0
package/README.md
CHANGED
|
@@ -77,8 +77,8 @@ bundle; its API requires the native Ansight module.
|
|
|
77
77
|
|
|
78
78
|
This package version expects matching native SDK packages:
|
|
79
79
|
|
|
80
|
-
- CocoaPods: `Ansight`, `AnsightObjC` version `1.3.0-preview.
|
|
81
|
-
- Maven: `ai.ansight:ansight-android:1.3.0-preview.
|
|
80
|
+
- CocoaPods: `Ansight`, `AnsightObjC` version `1.3.0-preview.11`
|
|
81
|
+
- Maven: `ai.ansight:ansight-android:1.3.0-preview.11`
|
|
82
82
|
|
|
83
83
|
## Quickstart
|
|
84
84
|
|
|
@@ -136,10 +136,12 @@ The TypeScript `AnsightOptions` surface mirrors Android `AnsightOptions`, iOS
|
|
|
136
136
|
| `retentionPeriodSeconds` | Local metric/event retention window. |
|
|
137
137
|
| `enableFramesPerSecond` | Enables native FPS sampling. |
|
|
138
138
|
| `enableBatteryLevel` | Enables battery sampling where available. |
|
|
139
|
+
| `enableOpenFileHandleTracking` | Enables native process open-file-handle sampling. Disabled by default. |
|
|
140
|
+
| `enableJniReferenceCountTracking` | Enables JNI reference-count tracking where the runtime can supply it. Disabled by default. |
|
|
139
141
|
| `defaultMemoryChannels` | Selects built-in memory channels. Prefer `managedHeap`, `nativeHeap`, `residentSetSize`, and `physicalFootprint`; `javaHeap` and `rss` are accepted as Android/RN compatibility aliases. |
|
|
140
142
|
| `reactNativeMemory` | Controls native React Native runtime memory channels. Enabled by default; set to `false` to disable, or use `{ jsHeapUsed, jsHeapTotal }`. |
|
|
141
143
|
| `additionalChannels` | Registers custom metric channels. |
|
|
142
|
-
| `sessionJpegCapture` | Object to enable/configure capture, or `false` to disable. Supports `captureGpuBackedSurfaces`; on iOS it defaults to `true` so Metal, SceneKit, and similar GPU-backed views are included. |
|
|
144
|
+
| `sessionJpegCapture` | Object to enable/configure capture, or `false` to disable. `mode` accepts `screenshotOnly`, `screenshotAndVisualTree`, or `screenshotWithVisualTreeOnTouch`. Supports `captureGpuBackedSurfaces`; on iOS it defaults to `true` so Metal, SceneKit, and similar GPU-backed views are included. |
|
|
143
145
|
| `touchCapture` | Object to enable/configure capture, or `false` to disable. |
|
|
144
146
|
| `lifecycleCapture` | Native lifecycle and screen-view capture options. |
|
|
145
147
|
| `toolGuard` | `"disabled"`, `"readOnly"`, `"readWrite"`, or `"fullAccess"`. |
|
|
@@ -149,6 +151,12 @@ The TypeScript `AnsightOptions` surface mirrors Android `AnsightOptions`, iOS
|
|
|
149
151
|
| `secureStorage` | Compatibility alias for native secure-storage allow-list settings. |
|
|
150
152
|
| `remoteTools` | Native visual tree, file, database, preferences, reflection, and secure-storage tool options. |
|
|
151
153
|
| `lifecycle` | JS AppState tracking toggle. Defaults to true. |
|
|
154
|
+
| `networkCapture` | Opt-in `fetch` and `XMLHttpRequest` metadata capture. Accepts `true` or sanitization/capture options. |
|
|
155
|
+
|
|
156
|
+
Use `withOpenFileHandleTracking()` and `withJniReferenceCountTracking()` to
|
|
157
|
+
opt in through the builder. Matching `without...` methods disable the channels
|
|
158
|
+
again. Open handles are sampled by the native Android/iOS runtime. JNI counts
|
|
159
|
+
are available on Android only when the host integration can supply them.
|
|
152
160
|
|
|
153
161
|
Cellular host connections are disabled by default. The restriction applies to
|
|
154
162
|
enrollment and reconnect requests. Opt in only for a trusted development host
|
|
@@ -175,6 +183,7 @@ await Ansight.initializeAndActivate({
|
|
|
175
183
|
quality: 60,
|
|
176
184
|
maxWidth: 480,
|
|
177
185
|
captureGpuBackedSurfaces: true,
|
|
186
|
+
mode: "screenshotWithVisualTreeOnTouch",
|
|
178
187
|
},
|
|
179
188
|
touchCapture: {
|
|
180
189
|
captureMoveEvents: true,
|
|
@@ -192,10 +201,50 @@ await Ansight.initializeAndActivate({
|
|
|
192
201
|
});
|
|
193
202
|
```
|
|
194
203
|
|
|
204
|
+
The touch mode captures native visual trees only on touch down and touch up.
|
|
205
|
+
Move and cancel events do not trigger capture. Rapid boundaries are coalesced
|
|
206
|
+
and rate-limited to protect screenshot cadence. Native touch capture and
|
|
207
|
+
visual-tree tools/providers must remain enabled.
|
|
208
|
+
|
|
195
209
|
On iOS, `captureGpuBackedSurfaces` defaults to `true` so Metal, SceneKit, and
|
|
196
210
|
similar GPU-backed views are included. Set it to `false` to use a lower-overhead
|
|
197
211
|
capture path when those surfaces are not needed.
|
|
198
212
|
|
|
213
|
+
## Network capture
|
|
214
|
+
|
|
215
|
+
Network capture is explicitly enabled by the React Native layer, which
|
|
216
|
+
instruments `fetch` and `XMLHttpRequest`, then sends a typed metadata record
|
|
217
|
+
through the native bridge. It is opt-in:
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
await Ansight.initializeAndActivate(
|
|
221
|
+
Ansight.createOptionsBuilder()
|
|
222
|
+
.withAnsightDefaults()
|
|
223
|
+
.withNetworkCapture({
|
|
224
|
+
maximumBodyBytes: 64 * 1024,
|
|
225
|
+
additionalSensitiveHeaderNames: ["x-tenant-secret"],
|
|
226
|
+
additionalSensitiveQueryParameterNames: ["session"],
|
|
227
|
+
requestSanitizer: request =>
|
|
228
|
+
request.url.includes("/health") ? null : request,
|
|
229
|
+
})
|
|
230
|
+
.withoutNetworkRequestBodies() // optional, independent opt-out
|
|
231
|
+
.build(),
|
|
232
|
+
);
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Text request and response bodies are included by default after network capture
|
|
236
|
+
is explicitly enabled, with a 64 KiB default per-body limit. Set a larger
|
|
237
|
+
`maximumBodyBytes` when needed; use the request/response body builder methods to
|
|
238
|
+
opt either side out or back in, and `captureBinaryBodies` to explicitly allow
|
|
239
|
+
Base64 binary content. Standard credentials, cloud signed-URL fields, cookies,
|
|
240
|
+
URL user information, and sensitive text-body assignments are redacted before
|
|
241
|
+
the bridge. Capture hooks detach whenever the native host is disconnected.
|
|
242
|
+
|
|
243
|
+
Use `installNetworkCapture(...)` and `uninstallNetworkCapture()` when capture
|
|
244
|
+
must be controlled independently of initialization. `recordNetworkRequest(...)`
|
|
245
|
+
supports custom HTTP stacks, and `sanitizeNetworkRequest(...)` exposes the same
|
|
246
|
+
app-side policy for inspection or testing.
|
|
247
|
+
|
|
199
248
|
## Native Tool Options
|
|
200
249
|
|
|
201
250
|
`remoteTools` configures the native tool suites registered by the bridge. `useNativeAllInOneDefaults: true` enables visual tree tools by default so Studio can pair `ui.get_visual_tree` data with `ui.get_screenshot` frames. Apps that do not use all-in-one defaults can opt in explicitly:
|
|
@@ -377,6 +426,19 @@ await Ansight.clearSessionProperties();
|
|
|
377
426
|
When connected, property mutations are sent immediately. When disconnected, the
|
|
378
427
|
latest values are included in the next `session.open`.
|
|
379
428
|
|
|
429
|
+
The bridge automatically adds these property groups:
|
|
430
|
+
|
|
431
|
+
| Group | Properties |
|
|
432
|
+
| --- | --- |
|
|
433
|
+
| `reactNative` | Ansight SDK, React Native and React versions; platform and runtime language; JavaScript engine and available Hermes version/bytecode details; legacy/new architecture; bridgeless state; development mode. |
|
|
434
|
+
| `localization` | Canonical locale, language, optional region, IANA time zone when exposed by `Intl`, and UTC offset in minutes. |
|
|
435
|
+
|
|
436
|
+
App-provided values override an automatic value with the same group and key.
|
|
437
|
+
Clearing all properties, or removing one automatic property, restores the
|
|
438
|
+
current bridge-owned value. `localization` reflects the JavaScript runtime
|
|
439
|
+
locale; if the app selects a different language through an i18n library, set
|
|
440
|
+
`localization.locale`, `language`, and `region` explicitly.
|
|
441
|
+
|
|
380
442
|
## Tool Guards
|
|
381
443
|
|
|
382
444
|
| Value | Allowed scopes |
|
package/android/build.gradle
CHANGED
|
@@ -67,6 +67,6 @@ repositories {
|
|
|
67
67
|
dependencies {
|
|
68
68
|
implementation("com.facebook.react:react-android")
|
|
69
69
|
def ansightAndroidVersion =
|
|
70
|
-
findProperty("ansightAndroidVersion") ?: "1.3.0-preview.
|
|
71
|
-
implementation("ai.ansight:ansight-android:1.3.0-preview.
|
|
70
|
+
findProperty("ansightAndroidVersion") ?: "1.3.0-preview.11"
|
|
71
|
+
implementation("ai.ansight:ansight-android:1.3.0-preview.11")
|
|
72
72
|
}
|
|
@@ -6,11 +6,13 @@ import ai.ansight.runtime.AndroidToolExecutionContext
|
|
|
6
6
|
import ai.ansight.runtime.AndroidToolResult
|
|
7
7
|
import ai.ansight.runtime.AnsightChannel
|
|
8
8
|
import ai.ansight.runtime.AnsightChannels
|
|
9
|
+
import ai.ansight.runtime.AnsightCrashCaptureOptions
|
|
9
10
|
import ai.ansight.runtime.AnsightHostAutoProbeOptions
|
|
10
11
|
import ai.ansight.runtime.AnsightHostConnectionOptions
|
|
11
12
|
import ai.ansight.runtime.AnsightLogCallback
|
|
12
13
|
import ai.ansight.runtime.AnsightLogLevel
|
|
13
14
|
import ai.ansight.runtime.AnsightLogger
|
|
15
|
+
import ai.ansight.runtime.AnsightNetworkRequest
|
|
14
16
|
import ai.ansight.runtime.AnsightOptions
|
|
15
17
|
import ai.ansight.runtime.AnsightOptionsBuilder
|
|
16
18
|
import ai.ansight.runtime.AnsightRuntime
|
|
@@ -27,6 +29,7 @@ import ai.ansight.runtime.HostConnectionRequestKind
|
|
|
27
29
|
import ai.ansight.runtime.HostConnectionCapabilities
|
|
28
30
|
import ai.ansight.runtime.HostConnectionResult
|
|
29
31
|
import ai.ansight.runtime.HostConnectionStatus
|
|
32
|
+
import ai.ansight.runtime.HostConnectionStatusSubscription
|
|
30
33
|
import ai.ansight.runtime.OperationResult
|
|
31
34
|
import ai.ansight.runtime.OpenSessionResult
|
|
32
35
|
import ai.ansight.runtime.PairingOpenOptions
|
|
@@ -103,16 +106,21 @@ class AnsightReactNativeModule(
|
|
|
103
106
|
private val logCallback = AnsightLogCallback { level, message, throwable ->
|
|
104
107
|
emitLogEvent(level, message, throwable)
|
|
105
108
|
}
|
|
109
|
+
private val hostConnectionStatusSubscription: HostConnectionStatusSubscription
|
|
106
110
|
|
|
107
111
|
init {
|
|
108
112
|
reactContext.addLifecycleEventListener(this)
|
|
109
113
|
AnsightLogger.registerCallback(logCallback)
|
|
114
|
+
hostConnectionStatusSubscription = AnsightRuntime.addHostConnectionStatusListener(
|
|
115
|
+
listener = { status, _ -> emitHostConnectionStatusEvent(status) },
|
|
116
|
+
)
|
|
110
117
|
}
|
|
111
118
|
|
|
112
119
|
override fun getName(): String = "AnsightReactNative"
|
|
113
120
|
|
|
114
121
|
override fun invalidate() {
|
|
115
122
|
AnsightLogger.removeCallback(logCallback)
|
|
123
|
+
hostConnectionStatusSubscription.remove()
|
|
116
124
|
reactContext.removeLifecycleEventListener(this)
|
|
117
125
|
super.invalidate()
|
|
118
126
|
}
|
|
@@ -225,6 +233,32 @@ class AnsightReactNativeModule(
|
|
|
225
233
|
}.resolve(promise)
|
|
226
234
|
}
|
|
227
235
|
|
|
236
|
+
@ReactMethod
|
|
237
|
+
fun recordNetworkRequest(input: ReadableMap, promise: Promise) {
|
|
238
|
+
runCatching {
|
|
239
|
+
val request = AnsightNetworkRequest.fromJson(JSONObject(input.toHashMap()))
|
|
240
|
+
?: return@runCatching operationResultMap(
|
|
241
|
+
OperationResult.failure("Network request must use the ansight.network-request.v1 schema."),
|
|
242
|
+
)
|
|
243
|
+
operationResultMap(AnsightRuntime.recordNetworkRequest(request))
|
|
244
|
+
}.resolve(promise)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
@ReactMethod
|
|
248
|
+
fun recordCrashCandidate(input: ReadableMap, promise: Promise) {
|
|
249
|
+
runCatching {
|
|
250
|
+
val candidateId = AnsightRuntime.recordCrashCandidate(
|
|
251
|
+
runtime = input.stringValue("runtime") ?: "react-native-javascript",
|
|
252
|
+
kind = input.stringValue("kind") ?: "unhandled_javascript_error",
|
|
253
|
+
message = input.stringValue("message"),
|
|
254
|
+
stack = input.stringValue("stack"),
|
|
255
|
+
fatal = input.booleanValue("fatal", false),
|
|
256
|
+
metadataJson = input.stringValue("metadata"),
|
|
257
|
+
)
|
|
258
|
+
Arguments.createMap().apply { putString("candidateId", candidateId) }
|
|
259
|
+
}.resolve(promise)
|
|
260
|
+
}
|
|
261
|
+
|
|
228
262
|
@ReactMethod
|
|
229
263
|
fun screenViewed(name: String, details: ReadableMap?, promise: Promise) {
|
|
230
264
|
runCatching {
|
|
@@ -661,6 +695,16 @@ class AnsightReactNativeModule(
|
|
|
661
695
|
}
|
|
662
696
|
}
|
|
663
697
|
|
|
698
|
+
private fun emitHostConnectionStatusEvent(status: HostConnectionStatus) {
|
|
699
|
+
if (listenerCount.get() <= 0) return
|
|
700
|
+
val event = hostConnectionStatusMap(status)
|
|
701
|
+
UiThreadUtil.runOnUiThread {
|
|
702
|
+
reactContext
|
|
703
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
704
|
+
.emit("AnsightHostConnectionStatus", event)
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
|
|
664
708
|
private fun configureReactNativeMemoryProfiling(map: ReadableMap?) {
|
|
665
709
|
val options = reactNativeMemoryProfilingOptions(map)
|
|
666
710
|
currentReactNativeMemoryOptions = options
|
|
@@ -693,6 +737,22 @@ class AnsightReactNativeModule(
|
|
|
693
737
|
if (map.hasBoolean("enableBatteryLevel")) {
|
|
694
738
|
options = options.copy(enableBatteryLevel = map.booleanValue("enableBatteryLevel", options.enableBatteryLevel))
|
|
695
739
|
}
|
|
740
|
+
if (map.hasBoolean("enableOpenFileHandleTracking")) {
|
|
741
|
+
options = options.copy(
|
|
742
|
+
enableOpenFileHandleTracking = map.booleanValue(
|
|
743
|
+
"enableOpenFileHandleTracking",
|
|
744
|
+
options.enableOpenFileHandleTracking,
|
|
745
|
+
),
|
|
746
|
+
)
|
|
747
|
+
}
|
|
748
|
+
if (map.hasBoolean("enableJniReferenceCountTracking")) {
|
|
749
|
+
options = options.copy(
|
|
750
|
+
enableJniReferenceCountTracking = map.booleanValue(
|
|
751
|
+
"enableJniReferenceCountTracking",
|
|
752
|
+
options.enableJniReferenceCountTracking,
|
|
753
|
+
),
|
|
754
|
+
)
|
|
755
|
+
}
|
|
696
756
|
if (map.hasMap("defaultMemoryChannels")) {
|
|
697
757
|
val memory = map.getMapOrNull("defaultMemoryChannels")
|
|
698
758
|
val managedHeap = if (memory.hasBoolean("managedHeap")) {
|
|
@@ -751,6 +811,10 @@ class AnsightReactNativeModule(
|
|
|
751
811
|
AnsightSessionJpegCaptureOptions.DefaultCaptureGpuBackedSurfaces,
|
|
752
812
|
),
|
|
753
813
|
mode = sessionJpegCaptureMode(jpeg.stringValue("mode")),
|
|
814
|
+
captureKeyboardPresence = jpeg.booleanValue(
|
|
815
|
+
"captureKeyboardPresence",
|
|
816
|
+
AnsightSessionJpegCaptureOptions.DefaultCaptureKeyboardPresence,
|
|
817
|
+
),
|
|
754
818
|
)
|
|
755
819
|
},
|
|
756
820
|
)
|
|
@@ -768,6 +832,24 @@ class AnsightReactNativeModule(
|
|
|
768
832
|
},
|
|
769
833
|
)
|
|
770
834
|
}
|
|
835
|
+
if (map.hasKey("crashCapture")) {
|
|
836
|
+
options = options.copy(
|
|
837
|
+
crashCapture = if (map.isFalse("crashCapture")) {
|
|
838
|
+
options.crashCapture.copy(enabled = false)
|
|
839
|
+
} else {
|
|
840
|
+
val crash = map.getMapOrNull("crashCapture")
|
|
841
|
+
AnsightCrashCaptureOptions(
|
|
842
|
+
enabled = crash.booleanValue("enabled", true),
|
|
843
|
+
studioHandoffEnabled = crash.booleanValue("studioHandoffEnabled", true),
|
|
844
|
+
offlineCaptureAttachmentEnabled = crash.booleanValue("offlineCaptureAttachmentEnabled", true),
|
|
845
|
+
maximumPendingReports = crash.intValue("maximumPendingReports", 8),
|
|
846
|
+
retentionDays = crash.intValue("retentionDays", 7),
|
|
847
|
+
maximumBreadcrumbs = crash.intValue("maximumBreadcrumbs", 64),
|
|
848
|
+
maximumTraceBytes = crash.intValue("maximumTraceBytes", 1_048_576),
|
|
849
|
+
)
|
|
850
|
+
},
|
|
851
|
+
)
|
|
852
|
+
}
|
|
771
853
|
if (map.hasString("toolGuard")) {
|
|
772
854
|
options = options.copy(toolGuard = toolGuard(map.stringValue("toolGuard")))
|
|
773
855
|
}
|
|
@@ -931,14 +1013,18 @@ class AnsightReactNativeModule(
|
|
|
931
1013
|
AnsightSessionJpegCaptureOptions.DefaultCaptureGpuBackedSurfaces,
|
|
932
1014
|
),
|
|
933
1015
|
mode = sessionJpegCaptureMode(map.stringValue("mode")),
|
|
1016
|
+
captureKeyboardPresence = map.booleanValue(
|
|
1017
|
+
"captureKeyboardPresence",
|
|
1018
|
+
AnsightSessionJpegCaptureOptions.DefaultCaptureKeyboardPresence,
|
|
1019
|
+
),
|
|
934
1020
|
)
|
|
935
1021
|
}
|
|
936
1022
|
|
|
937
1023
|
private fun sessionJpegCaptureMode(value: String?): AnsightSessionJpegCaptureMode =
|
|
938
|
-
|
|
939
|
-
AnsightSessionJpegCaptureMode.ScreenshotAndVisualTree
|
|
940
|
-
|
|
941
|
-
AnsightSessionJpegCaptureMode.ScreenshotOnly
|
|
1024
|
+
when (value) {
|
|
1025
|
+
"screenshotAndVisualTree" -> AnsightSessionJpegCaptureMode.ScreenshotAndVisualTree
|
|
1026
|
+
"screenshotWithVisualTreeOnTouch" -> AnsightSessionJpegCaptureMode.ScreenshotWithVisualTreeOnTouch
|
|
1027
|
+
else -> AnsightSessionJpegCaptureMode.ScreenshotOnly
|
|
942
1028
|
}
|
|
943
1029
|
|
|
944
1030
|
private fun toolDefinition(map: ReadableMap): ToolDefinition =
|
|
@@ -1111,6 +1197,8 @@ class AnsightReactNativeModule(
|
|
|
1111
1197
|
putInt("retentionPeriodSeconds", options.retentionPeriodSeconds)
|
|
1112
1198
|
putBoolean("enableFramesPerSecond", options.enableFramesPerSecond)
|
|
1113
1199
|
putBoolean("enableBatteryLevel", options.enableBatteryLevel)
|
|
1200
|
+
putBoolean("enableOpenFileHandleTracking", options.enableOpenFileHandleTracking)
|
|
1201
|
+
putBoolean("enableJniReferenceCountTracking", options.enableJniReferenceCountTracking)
|
|
1114
1202
|
putMap("defaultMemoryChannels", mapOf(
|
|
1115
1203
|
"managedHeap" to options.defaultMemoryChannels.javaHeap,
|
|
1116
1204
|
"javaHeap" to options.defaultMemoryChannels.javaHeap,
|
|
@@ -1127,10 +1215,11 @@ class AnsightReactNativeModule(
|
|
|
1127
1215
|
"quality" to capture.quality,
|
|
1128
1216
|
"maxWidth" to capture.maxWidth,
|
|
1129
1217
|
"captureGpuBackedSurfaces" to capture.captureGpuBackedSurfaces,
|
|
1130
|
-
"
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
"
|
|
1218
|
+
"captureKeyboardPresence" to capture.captureKeyboardPresence,
|
|
1219
|
+
"mode" to when (capture.mode) {
|
|
1220
|
+
AnsightSessionJpegCaptureMode.ScreenshotAndVisualTree -> "screenshotAndVisualTree"
|
|
1221
|
+
AnsightSessionJpegCaptureMode.ScreenshotWithVisualTreeOnTouch -> "screenshotWithVisualTreeOnTouch"
|
|
1222
|
+
else -> "screenshotOnly"
|
|
1134
1223
|
},
|
|
1135
1224
|
).toWritableMap())
|
|
1136
1225
|
} ?: putNull("sessionJpegCapture")
|
package/index.d.ts
CHANGED
|
@@ -37,7 +37,8 @@ export interface AnsightSessionJpegCaptureOptions {
|
|
|
37
37
|
quality?: number;
|
|
38
38
|
maxWidth?: number;
|
|
39
39
|
captureGpuBackedSurfaces?: boolean;
|
|
40
|
-
|
|
40
|
+
captureKeyboardPresence?: boolean;
|
|
41
|
+
mode?: "screenshotOnly" | "screenshotAndVisualTree" | "screenshotWithVisualTreeOnTouch";
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
export interface AnsightTouchCaptureOptions {
|
|
@@ -47,6 +48,75 @@ export interface AnsightTouchCaptureOptions {
|
|
|
47
48
|
moveCaptureFramesPerSecond?: number;
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
export interface AnsightNetworkHeader {
|
|
52
|
+
name: string;
|
|
53
|
+
value: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface AnsightNetworkBody {
|
|
57
|
+
contentType?: string;
|
|
58
|
+
encoding: "utf8" | "base64";
|
|
59
|
+
data: string;
|
|
60
|
+
capturedBytes: number;
|
|
61
|
+
totalBytes?: number;
|
|
62
|
+
truncated: boolean;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** V1 network metadata with optional, bounded bodies. */
|
|
66
|
+
export interface AnsightNetworkRequest {
|
|
67
|
+
schema: "ansight.network-request.v1";
|
|
68
|
+
id: string;
|
|
69
|
+
source: string;
|
|
70
|
+
startedAtUtc: string;
|
|
71
|
+
completedAtUtc: string;
|
|
72
|
+
durationMilliseconds: number;
|
|
73
|
+
method: string;
|
|
74
|
+
url: string;
|
|
75
|
+
protocol?: string;
|
|
76
|
+
requestHeaders: AnsightNetworkHeader[];
|
|
77
|
+
requestBodySizeBytes?: number;
|
|
78
|
+
requestBody?: AnsightNetworkBody;
|
|
79
|
+
statusCode?: number;
|
|
80
|
+
reasonPhrase?: string;
|
|
81
|
+
responseHeaders: AnsightNetworkHeader[];
|
|
82
|
+
responseBodySizeBytes?: number;
|
|
83
|
+
responseBody?: AnsightNetworkBody;
|
|
84
|
+
errorType?: string;
|
|
85
|
+
errorMessage?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type AnsightNetworkRequestInput = Partial<AnsightNetworkRequest> & {
|
|
89
|
+
method: string;
|
|
90
|
+
url: string;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export interface AnsightNetworkSanitizationOptions {
|
|
94
|
+
includeRequestHeaders?: boolean;
|
|
95
|
+
includeResponseHeaders?: boolean;
|
|
96
|
+
includeQueryString?: boolean;
|
|
97
|
+
includeBodySizes?: boolean;
|
|
98
|
+
/** Defaults to true. */
|
|
99
|
+
captureRequestBody?: boolean;
|
|
100
|
+
/** Defaults to true. */
|
|
101
|
+
captureResponseBody?: boolean;
|
|
102
|
+
/** Decoded bytes retained per body. Defaults to 64 KiB; larger explicit limits are honored. */
|
|
103
|
+
maximumBodyBytes?: number;
|
|
104
|
+
captureBinaryBodies?: boolean;
|
|
105
|
+
additionalSensitiveHeaderNames?: string[];
|
|
106
|
+
additionalSensitiveQueryParameterNames?: string[];
|
|
107
|
+
urlSanitizer?: (url: string) => string;
|
|
108
|
+
/** Return a replacement request, or null to suppress capture. */
|
|
109
|
+
requestSanitizer?: (
|
|
110
|
+
request: AnsightNetworkRequest,
|
|
111
|
+
) => AnsightNetworkRequest | null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface AnsightNetworkCaptureOptions
|
|
115
|
+
extends AnsightNetworkSanitizationOptions {
|
|
116
|
+
captureFetch?: boolean;
|
|
117
|
+
captureXmlHttpRequest?: boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
50
120
|
export interface AnsightNativeToolRoot {
|
|
51
121
|
alias: string;
|
|
52
122
|
path: string;
|
|
@@ -110,6 +180,8 @@ export interface AnsightOptions {
|
|
|
110
180
|
retentionPeriodSeconds?: number;
|
|
111
181
|
enableFramesPerSecond?: boolean;
|
|
112
182
|
enableBatteryLevel?: boolean;
|
|
183
|
+
enableOpenFileHandleTracking?: boolean;
|
|
184
|
+
enableJniReferenceCountTracking?: boolean;
|
|
113
185
|
defaultMemoryChannels?: {
|
|
114
186
|
managedHeap?: boolean;
|
|
115
187
|
physicalFootprint?: boolean;
|
|
@@ -121,6 +193,7 @@ export interface AnsightOptions {
|
|
|
121
193
|
reactNativeMemory?: false | AnsightReactNativeMemoryOptions;
|
|
122
194
|
sessionJpegCapture?: false | AnsightSessionJpegCaptureOptions;
|
|
123
195
|
touchCapture?: false | AnsightTouchCaptureOptions;
|
|
196
|
+
crashCapture?: false | AnsightCrashCaptureOptions;
|
|
124
197
|
lifecycleCapture?: {
|
|
125
198
|
enabled?: boolean;
|
|
126
199
|
captureAppLifecycle?: boolean;
|
|
@@ -151,6 +224,27 @@ export interface AnsightOptions {
|
|
|
151
224
|
remoteTools?: AnsightRemoteToolsOptions;
|
|
152
225
|
additionalChannels?: AnsightChannel[];
|
|
153
226
|
lifecycle?: boolean;
|
|
227
|
+
/** Explicitly opt in to fetch/XMLHttpRequest instrumentation. */
|
|
228
|
+
networkCapture?: boolean | AnsightNetworkCaptureOptions;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface AnsightCrashCaptureOptions {
|
|
232
|
+
enabled?: boolean;
|
|
233
|
+
studioHandoffEnabled?: boolean;
|
|
234
|
+
offlineCaptureAttachmentEnabled?: boolean;
|
|
235
|
+
maximumPendingReports?: number;
|
|
236
|
+
retentionDays?: number;
|
|
237
|
+
maximumBreadcrumbs?: number;
|
|
238
|
+
maximumTraceBytes?: number;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface AnsightCrashCandidate {
|
|
242
|
+
runtime?: string;
|
|
243
|
+
kind?: string;
|
|
244
|
+
message?: string;
|
|
245
|
+
stack?: string;
|
|
246
|
+
fatal?: boolean;
|
|
247
|
+
metadata?: string | Record<string, string>;
|
|
154
248
|
}
|
|
155
249
|
|
|
156
250
|
export interface AnsightOperationResult {
|
|
@@ -251,6 +345,10 @@ export class AnsightOptionsBuilder {
|
|
|
251
345
|
withoutFramesPerSecond(): this;
|
|
252
346
|
withBatteryLevel(): this;
|
|
253
347
|
withoutBatteryLevel(): this;
|
|
348
|
+
withOpenFileHandleTracking(): this;
|
|
349
|
+
withoutOpenFileHandleTracking(): this;
|
|
350
|
+
withJniReferenceCountTracking(): this;
|
|
351
|
+
withoutJniReferenceCountTracking(): this;
|
|
254
352
|
withRetentionPeriodSeconds(retentionPeriodSeconds: number): this;
|
|
255
353
|
withAdditionalChannels(additionalChannels: AnsightChannel[]): this;
|
|
256
354
|
addAdditionalChannel(additionalChannel: AnsightChannel): this;
|
|
@@ -264,12 +362,21 @@ export class AnsightOptionsBuilder {
|
|
|
264
362
|
quality?: number,
|
|
265
363
|
maxWidth?: number | null,
|
|
266
364
|
captureGpuBackedSurfaces?: boolean,
|
|
267
|
-
mode?: "screenshotOnly" | "screenshotAndVisualTree"
|
|
365
|
+
mode?: "screenshotOnly" | "screenshotAndVisualTree" | "screenshotWithVisualTreeOnTouch",
|
|
366
|
+
captureKeyboardPresence?: boolean
|
|
268
367
|
): this;
|
|
269
368
|
withoutSessionJpegCapture(): this;
|
|
270
369
|
withTouchCapture(touchCapture?: AnsightTouchCaptureOptions): this;
|
|
271
370
|
withoutTouchCapture(): this;
|
|
371
|
+
withCrashCapture(crashCapture?: AnsightCrashCaptureOptions): this;
|
|
372
|
+
withoutCrashCapture(): this;
|
|
272
373
|
withLifecycleCapture(lifecycleCapture?: NonNullable<AnsightOptions["lifecycleCapture"]>): this;
|
|
374
|
+
withNetworkCapture(networkCapture?: AnsightNetworkCaptureOptions): this;
|
|
375
|
+
withNetworkRequestBodies(maximumBodyBytes?: number): this;
|
|
376
|
+
withoutNetworkRequestBodies(): this;
|
|
377
|
+
withNetworkResponseBodies(maximumBodyBytes?: number): this;
|
|
378
|
+
withoutNetworkResponseBodies(): this;
|
|
379
|
+
withoutNetworkCapture(): this;
|
|
273
380
|
withToolGuard(toolGuard: NonNullable<AnsightOptions["toolGuard"]>): this;
|
|
274
381
|
withToolsDisabled(): this;
|
|
275
382
|
withReadOnlyToolAccess(): this;
|
|
@@ -512,6 +619,19 @@ export function metric(value: number, channel?: number): Promise<AnsightDebugSna
|
|
|
512
619
|
export function recordMetric(value: number, channel?: number): Promise<AnsightDebugSnapshot>;
|
|
513
620
|
export function event(input: string | { label: string; type?: string; details?: string; channel?: number }): Promise<AnsightDebugSnapshot>;
|
|
514
621
|
export function recordEvent(input: string | { label: string; type?: string; details?: string; channel?: number }): Promise<AnsightDebugSnapshot>;
|
|
622
|
+
export function recordCrashCandidate(input?: AnsightCrashCandidate): Promise<{ candidateId?: string }>;
|
|
623
|
+
export function recordNetworkRequest(
|
|
624
|
+
input: AnsightNetworkRequestInput,
|
|
625
|
+
sanitizationOptions?: AnsightNetworkSanitizationOptions,
|
|
626
|
+
): Promise<AnsightOperationResult>;
|
|
627
|
+
export function sanitizeNetworkRequest(
|
|
628
|
+
input: AnsightNetworkRequestInput,
|
|
629
|
+
sanitizationOptions?: AnsightNetworkSanitizationOptions,
|
|
630
|
+
): AnsightNetworkRequest | null;
|
|
631
|
+
export function installNetworkCapture(
|
|
632
|
+
options?: AnsightNetworkCaptureOptions,
|
|
633
|
+
): AnsightSubscription;
|
|
634
|
+
export function uninstallNetworkCapture(): void;
|
|
515
635
|
export function screenViewed(name: string, details?: Record<string, string>): Promise<AnsightDebugSnapshot>;
|
|
516
636
|
export function trackRoute(name: string, details?: Record<string, string>): Promise<AnsightDebugSnapshot>;
|
|
517
637
|
export function setAppLifecycleState(state: AnsightLifecycleState): Promise<AnsightDebugSnapshot>;
|
|
@@ -585,6 +705,8 @@ declare const Ansight: {
|
|
|
585
705
|
recordMetric: typeof recordMetric;
|
|
586
706
|
event: typeof event;
|
|
587
707
|
recordEvent: typeof recordEvent;
|
|
708
|
+
recordCrashCandidate: typeof recordCrashCandidate;
|
|
709
|
+
recordNetworkRequest: typeof recordNetworkRequest;
|
|
588
710
|
screenViewed: typeof screenViewed;
|
|
589
711
|
trackRoute: typeof trackRoute;
|
|
590
712
|
setAppLifecycleState: typeof setAppLifecycleState;
|
|
@@ -639,6 +761,9 @@ declare const Ansight: {
|
|
|
639
761
|
installReactTools: typeof installReactTools;
|
|
640
762
|
uninstallReactTools: typeof uninstallReactTools;
|
|
641
763
|
installErrorHandlers: typeof installErrorHandlers;
|
|
764
|
+
installNetworkCapture: typeof installNetworkCapture;
|
|
765
|
+
uninstallNetworkCapture: typeof uninstallNetworkCapture;
|
|
766
|
+
sanitizeNetworkRequest: typeof sanitizeNetworkRequest;
|
|
642
767
|
createReactNavigationTracker: typeof createReactNavigationTracker;
|
|
643
768
|
platform: "ios" | "android" | string;
|
|
644
769
|
};
|