@symbiote-native/app-metrics 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +183 -2
- package/build/angular/app-metrics-root.d.ts +5 -0
- package/build/angular/app-metrics-root.js +62 -0
- package/build/angular/index.d.ts +3 -0
- package/build/angular/index.js +5 -0
- package/build/angular/inject-network-request-observer.d.ts +5 -0
- package/build/angular/inject-network-request-observer.js +7 -0
- package/build/core/app-metrics.d.ts +24 -0
- package/build/core/app-metrics.js +47 -0
- package/build/core/index.d.ts +5 -0
- package/build/core/index.js +6 -0
- package/build/core/install-error-handler.d.ts +2 -0
- package/build/core/install-error-handler.js +45 -0
- package/build/core/native-module.d.ts +19 -0
- package/build/core/native-module.js +3 -0
- package/build/core/network-request-observer-lifecycle.d.ts +8 -0
- package/build/core/network-request-observer-lifecycle.js +19 -0
- package/build/core/network-request-observer-subscription.d.ts +15 -0
- package/build/core/network-request-observer-subscription.js +22 -0
- package/build/core/network-request-observer.d.ts +7 -0
- package/build/core/network-request-observer.js +1 -0
- package/build/core/report-caught-error.d.ts +2 -0
- package/build/core/report-caught-error.js +20 -0
- package/build/core/session.d.ts +12 -0
- package/build/core/session.js +1 -0
- package/build/core/types.d.ts +168 -0
- package/build/core/types.js +3 -0
- package/build/react/app-metrics-error-boundary.d.ts +26 -0
- package/build/react/app-metrics-error-boundary.js +28 -0
- package/build/react/app-metrics-root.d.ts +12 -0
- package/build/react/app-metrics-root.js +24 -0
- package/build/react/index.d.ts +4 -0
- package/build/react/index.js +4 -0
- package/build/react/use-network-request-observer.d.ts +5 -0
- package/build/react/use-network-request-observer.js +23 -0
- package/build/solid/app-metrics-error-boundary.d.ts +15 -0
- package/build/solid/app-metrics-error-boundary.js +17 -0
- package/build/solid/app-metrics-root.d.ts +9 -0
- package/build/solid/app-metrics-root.js +18 -0
- package/build/solid/index.d.ts +4 -0
- package/build/solid/index.js +4 -0
- package/build/solid/use-network-request-observer.d.ts +5 -0
- package/build/solid/use-network-request-observer.js +6 -0
- package/build/svelte/AppMetricsErrorBoundary.svelte +17 -0
- package/build/svelte/AppMetricsErrorBoundary.svelte.d.ts +4 -0
- package/build/svelte/AppMetricsRoot.svelte +22 -0
- package/build/svelte/AppMetricsRoot.svelte.d.ts +4 -0
- package/build/svelte/app-metrics-error-boundary-props.d.ts +12 -0
- package/build/svelte/app-metrics-error-boundary-props.js +3 -0
- package/build/svelte/app-metrics-root-props.d.ts +9 -0
- package/build/svelte/app-metrics-root-props.js +1 -0
- package/build/svelte/index.d.ts +7 -0
- package/build/svelte/index.js +4 -0
- package/build/svelte/use-network-request-observer.svelte.d.ts +3 -0
- package/build/svelte/use-network-request-observer.svelte.js +14 -0
- package/build/vue/app-metrics-error-boundary.d.ts +14 -0
- package/build/vue/app-metrics-error-boundary.js +27 -0
- package/build/vue/app-metrics-root.d.ts +7 -0
- package/build/vue/app-metrics-root.js +15 -0
- package/build/vue/index.d.ts +4 -0
- package/build/vue/index.js +4 -0
- package/build/vue/use-network-request-observer.d.ts +5 -0
- package/build/vue/use-network-request-observer.js +6 -0
- package/build-ngc/angular/app-metrics-root.d.ts +8 -0
- package/build-ngc/angular/app-metrics-root.js +20 -0
- package/build-ngc/angular/app-metrics-root.js.map +1 -0
- package/build-ngc/angular/index.d.ts +3 -0
- package/build-ngc/angular/index.js +6 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/angular/inject-network-request-observer.d.ts +5 -0
- package/build-ngc/angular/inject-network-request-observer.js +8 -0
- package/build-ngc/angular/inject-network-request-observer.js.map +1 -0
- package/build-ngc/core/app-metrics.d.ts +24 -0
- package/build-ngc/core/app-metrics.js +48 -0
- package/build-ngc/core/app-metrics.js.map +1 -0
- package/build-ngc/core/index.d.ts +5 -0
- package/build-ngc/core/index.js +7 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/install-error-handler.d.ts +2 -0
- package/build-ngc/core/install-error-handler.js +46 -0
- package/build-ngc/core/install-error-handler.js.map +1 -0
- package/build-ngc/core/native-module.d.ts +19 -0
- package/build-ngc/core/native-module.js +4 -0
- package/build-ngc/core/native-module.js.map +1 -0
- package/build-ngc/core/network-request-observer-lifecycle.d.ts +8 -0
- package/build-ngc/core/network-request-observer-lifecycle.js +20 -0
- package/build-ngc/core/network-request-observer-lifecycle.js.map +1 -0
- package/build-ngc/core/network-request-observer-subscription.d.ts +15 -0
- package/build-ngc/core/network-request-observer-subscription.js +23 -0
- package/build-ngc/core/network-request-observer-subscription.js.map +1 -0
- package/build-ngc/core/network-request-observer.d.ts +7 -0
- package/build-ngc/core/network-request-observer.js +2 -0
- package/build-ngc/core/network-request-observer.js.map +1 -0
- package/build-ngc/core/report-caught-error.d.ts +2 -0
- package/build-ngc/core/report-caught-error.js +21 -0
- package/build-ngc/core/report-caught-error.js.map +1 -0
- package/build-ngc/core/session.d.ts +12 -0
- package/build-ngc/core/session.js +2 -0
- package/build-ngc/core/session.js.map +1 -0
- package/build-ngc/core/types.d.ts +168 -0
- package/build-ngc/core/types.js +4 -0
- package/build-ngc/core/types.js.map +1 -0
- package/native-link.json +12 -0
- package/package.json +147 -3
- package/src/angular/app-metrics-root.ts +14 -0
- package/src/angular/index.ts +8 -0
- package/src/angular/inject-network-request-observer.ts +18 -0
- package/src/core/app-metrics.ts +74 -0
- package/src/core/index.ts +52 -0
- package/src/core/install-error-handler.ts +55 -0
- package/src/core/native-module.ts +36 -0
- package/src/core/network-request-observer-lifecycle.ts +37 -0
- package/src/core/network-request-observer-subscription.ts +53 -0
- package/src/core/network-request-observer.ts +15 -0
- package/src/core/report-caught-error.ts +26 -0
- package/src/core/session.ts +17 -0
- package/src/core/types.ts +200 -0
- package/src/react/app-metrics-error-boundary.tsx +67 -0
- package/src/react/app-metrics-root.tsx +53 -0
- package/src/react/index.ts +11 -0
- package/src/react/use-network-request-observer.ts +41 -0
- package/src/solid/app-metrics-error-boundary.tsx +36 -0
- package/src/solid/app-metrics-root.tsx +29 -0
- package/src/solid/index.ts +12 -0
- package/src/solid/use-network-request-observer.ts +17 -0
- package/src/svelte/AppMetricsErrorBoundary.svelte +17 -0
- package/src/svelte/AppMetricsRoot.svelte +21 -0
- package/src/svelte/app-metrics-error-boundary-props.ts +17 -0
- package/src/svelte/app-metrics-root-props.ts +10 -0
- package/src/svelte/index.ts +10 -0
- package/src/svelte/svelte-compile.test-helper.ts +7 -0
- package/src/svelte/use-network-request-observer.svelte.ts +26 -0
- package/src/vue/app-metrics-error-boundary.ts +56 -0
- package/src/vue/app-metrics-root.ts +32 -0
- package/src/vue/index.ts +12 -0
- package/src/vue/use-network-request-observer.ts +17 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { markFirstRender } from '../core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/** Marks the first render, so time-to-first-render is measured without a manual call */
|
|
5
|
+
export class AppMetricsRoot {
|
|
6
|
+
ngOnInit() {
|
|
7
|
+
markFirstRender();
|
|
8
|
+
}
|
|
9
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AppMetricsRoot, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
10
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.8", type: AppMetricsRoot, isStandalone: true, selector: "app-metrics-root", ngImport: i0, template: '<ng-content />', isInline: true });
|
|
11
|
+
}
|
|
12
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: AppMetricsRoot, decorators: [{
|
|
13
|
+
type: Component,
|
|
14
|
+
args: [{
|
|
15
|
+
selector: 'app-metrics-root',
|
|
16
|
+
standalone: true,
|
|
17
|
+
template: '<ng-content />',
|
|
18
|
+
}]
|
|
19
|
+
}] });
|
|
20
|
+
//# sourceMappingURL=app-metrics-root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-metrics-root.js","sourceRoot":"","sources":["../../src/angular/app-metrics-root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;;AAE1C,wFAAwF;AAMxF,MAAM,OAAO,cAAc;IACzB,QAAQ;QACN,eAAe,EAAE,CAAC;IACpB,CAAC;uGAHU,cAAc;2FAAd,cAAc,4EAFf,gBAAgB;;2FAEf,cAAc;kBAL1B,SAAS;mBAAC;oBACT,QAAQ,EAAE,kBAAkB;oBAC5B,UAAU,EAAE,IAAI;oBAChB,QAAQ,EAAE,gBAAgB;iBAC3B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// No `AppMetricsErrorBoundary` here - blocked on `@angular/core` >=22.2
|
|
2
|
+
// (this package's README "Scope decision")
|
|
3
|
+
export * from '../core';
|
|
4
|
+
export { AppMetricsRoot } from './app-metrics-root';
|
|
5
|
+
export { injectNetworkRequestObserver, } from './inject-network-request-observer';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,2CAA2C;AAC3C,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,4BAA4B,GAE7B,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NetworkRequestObserver } from '../core';
|
|
2
|
+
import type { IUseNetworkRequestObserverOptions } from '../core/network-request-observer-lifecycle';
|
|
3
|
+
export type { IUseNetworkRequestObserverOptions } from '../core/network-request-observer-lifecycle';
|
|
4
|
+
/** Angular twin of `expo-app-metrics`'s `useNetworkRequestObserver` */
|
|
5
|
+
export declare function injectNetworkRequestObserver(getOptions?: () => IUseNetworkRequestObserverOptions): NetworkRequestObserver;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DestroyRef, effect, inject } from '@angular/core';
|
|
2
|
+
import { createNetworkRequestObserverLifecycle } from '../core/network-request-observer-lifecycle';
|
|
3
|
+
/** Angular twin of `expo-app-metrics`'s `useNetworkRequestObserver` */
|
|
4
|
+
export function injectNetworkRequestObserver(getOptions = () => ({})) {
|
|
5
|
+
const destroyRef = inject(DestroyRef);
|
|
6
|
+
return createNetworkRequestObserverLifecycle(getOptions, filterEffect => effect(filterEffect), cleanup => destroyRef.onDestroy(cleanup));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=inject-network-request-observer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inject-network-request-observer.js","sourceRoot":"","sources":["../../src/angular/inject-network-request-observer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,qCAAqC,EAAE,MAAM,4CAA4C,CAAC;AAMnG,uEAAuE;AACvE,MAAM,UAAU,4BAA4B,CAC1C,aAAsD,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IAEhE,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IACtC,OAAO,qCAAqC,CAC1C,UAAU,EACV,YAAY,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,EACpC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CACzC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ICrashReport, IDebugSession, ILogAttributeValue, ILogEventOptions, IMetricAttributes, IReportErrorInput } from './types';
|
|
2
|
+
/** Marks the moment the app is ready to measure time to first render */
|
|
3
|
+
export declare function markFirstRender(): void;
|
|
4
|
+
export declare function markInteractive(attributes?: IMetricAttributes): void;
|
|
5
|
+
/** Persisted locally, dispatched on the next flush as an OpenTelemetry log record */
|
|
6
|
+
export declare function logEvent(name: string, options?: ILogEventOptions): void;
|
|
7
|
+
/** Merged into every subsequent metric and log event, per-record keys win on collision */
|
|
8
|
+
export declare function setGlobalAttributes(attributes?: Record<string, ILogAttributeValue> | null): void;
|
|
9
|
+
export declare function clearStoredEntries(): Promise<void>;
|
|
10
|
+
/** Debug-only, ordered most-recent-first, each session eagerly includes metrics/logs/crash */
|
|
11
|
+
export declare function getInactiveSessions(): Promise<IDebugSession[]>;
|
|
12
|
+
/** Debug-only, includes orphan crashes with `sessionId: null`. @platform android */
|
|
13
|
+
export declare function getAllCrashReports(): Promise<ICrashReport[]>;
|
|
14
|
+
/** Called by `installErrorHandler`'s global handler and `AppMetricsErrorBoundary` */
|
|
15
|
+
export declare function reportError(error: IReportErrorInput): void;
|
|
16
|
+
/** The per-launch session, a static reference: repeated calls return the same object */
|
|
17
|
+
export declare function getMainSession(): import("./session").Session;
|
|
18
|
+
/** Created when the app becomes active, ended when backgrounded, `null` when none is active */
|
|
19
|
+
export declare function getForegroundSession(): Promise<import("./session").Session | null>;
|
|
20
|
+
export declare const NetworkRequestObserver: typeof import("./network-request-observer").NetworkRequestObserver;
|
|
21
|
+
export type NetworkRequestObserver = InstanceType<typeof NetworkRequestObserver>;
|
|
22
|
+
/** Not intended to be constructed from user code, see `getMainSession`/`getForegroundSession` */
|
|
23
|
+
export declare const Session: typeof import("./session").Session;
|
|
24
|
+
export type Session = InstanceType<typeof Session>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Platform, UnavailabilityError } from 'expo-modules-core';
|
|
2
|
+
import { expoAppMetrics } from './native-module';
|
|
3
|
+
const NATIVE_MODULE_NAME = 'expo-app-metrics';
|
|
4
|
+
/** Marks the moment the app is ready to measure time to first render */
|
|
5
|
+
export function markFirstRender() {
|
|
6
|
+
expoAppMetrics.markFirstRender();
|
|
7
|
+
}
|
|
8
|
+
export function markInteractive(attributes) {
|
|
9
|
+
expoAppMetrics.markInteractive(attributes);
|
|
10
|
+
}
|
|
11
|
+
/** Persisted locally, dispatched on the next flush as an OpenTelemetry log record */
|
|
12
|
+
export function logEvent(name, options) {
|
|
13
|
+
expoAppMetrics.logEvent(name, options);
|
|
14
|
+
}
|
|
15
|
+
/** Merged into every subsequent metric and log event, per-record keys win on collision */
|
|
16
|
+
export function setGlobalAttributes(attributes) {
|
|
17
|
+
expoAppMetrics.setGlobalAttributes(attributes);
|
|
18
|
+
}
|
|
19
|
+
export async function clearStoredEntries() {
|
|
20
|
+
return expoAppMetrics.clearStoredEntries();
|
|
21
|
+
}
|
|
22
|
+
/** Debug-only, ordered most-recent-first, each session eagerly includes metrics/logs/crash */
|
|
23
|
+
export async function getInactiveSessions() {
|
|
24
|
+
return expoAppMetrics.getInactiveSessions();
|
|
25
|
+
}
|
|
26
|
+
/** Debug-only, includes orphan crashes with `sessionId: null`. @platform android */
|
|
27
|
+
export async function getAllCrashReports() {
|
|
28
|
+
if (Platform.OS !== 'android' || !expoAppMetrics.getAllCrashReports) {
|
|
29
|
+
throw new UnavailabilityError(NATIVE_MODULE_NAME, 'getAllCrashReports');
|
|
30
|
+
}
|
|
31
|
+
return expoAppMetrics.getAllCrashReports();
|
|
32
|
+
}
|
|
33
|
+
/** Called by `installErrorHandler`'s global handler and `AppMetricsErrorBoundary` */
|
|
34
|
+
export function reportError(error) {
|
|
35
|
+
expoAppMetrics.reportError(error);
|
|
36
|
+
}
|
|
37
|
+
/** The per-launch session, a static reference: repeated calls return the same object */
|
|
38
|
+
export function getMainSession() {
|
|
39
|
+
return expoAppMetrics.getMainSession();
|
|
40
|
+
}
|
|
41
|
+
/** Created when the app becomes active, ended when backgrounded, `null` when none is active */
|
|
42
|
+
export async function getForegroundSession() {
|
|
43
|
+
return expoAppMetrics.getForegroundSession();
|
|
44
|
+
}
|
|
45
|
+
export const NetworkRequestObserver = expoAppMetrics.NetworkRequestObserver;
|
|
46
|
+
/** Not intended to be constructed from user code, see `getMainSession`/`getForegroundSession` */
|
|
47
|
+
export const Session = expoAppMetrics.Session;
|
|
48
|
+
//# sourceMappingURL=app-metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-metrics.js","sourceRoot":"","sources":["../../src/core/app-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAUjD,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAE9C,wEAAwE;AACxE,MAAM,UAAU,eAAe;IAC7B,cAAc,CAAC,eAAe,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAA8B;IAC5D,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;AAC7C,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,OAA0B;IAC/D,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,mBAAmB,CACjC,UAAsD;IAEtD,cAAc,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,OAAO,cAAc,CAAC,kBAAkB,EAAE,CAAC;AAC7C,CAAC;AAED,8FAA8F;AAC9F,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,OAAO,cAAc,CAAC,mBAAmB,EAAE,CAAC;AAC9C,CAAC;AAED,oFAAoF;AACpF,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;QACpE,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,cAAc,CAAC,kBAAkB,EAAE,CAAC;AAC7C,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,WAAW,CAAC,KAAwB;IAClD,cAAc,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,cAAc;IAC5B,OAAO,cAAc,CAAC,cAAc,EAAE,CAAC;AACzC,CAAC;AAED,+FAA+F;AAC/F,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,OAAO,cAAc,CAAC,oBAAoB,EAAE,CAAC;AAC/C,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,cAAc,CAAC,sBAAsB,CAAC;AAK5E,iGAAiG;AACjG,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { clearStoredEntries, getAllCrashReports, getForegroundSession, getInactiveSessions, getMainSession, logEvent, markFirstRender, markInteractive, NetworkRequestObserver, reportError, Session, setGlobalAttributes, } from './app-metrics';
|
|
2
|
+
export { filterKeyOf, subscribeNetworkRequestObserverEvents, } from './network-request-observer-subscription';
|
|
3
|
+
export type { INetworkRequestObserverCallbacks, ISubscribableNetworkRequestObserver, } from './network-request-observer-subscription';
|
|
4
|
+
export type { IAppStartupTimes, ICallStack, ICallStackFrame, ICallStackTree, ICrashReport, IDebugSession, IFrameRateMetrics, ILogAttributeValue, ILogEventOptions, ILogRecord, ILogSeverity, IMemoryUsageSnapshot, IMetric, IMetricAttributes, IMetricInput, INetworkRequestCompletedEvent, INetworkRequestFilter, INetworkRequestObserverEvents, INetworkRequestRedirect, INetworkRequestStartedEvent, IReportErrorInput, ISessionType, } from './types';
|
|
5
|
+
export { installErrorHandler } from './install-error-handler';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { installErrorHandler } from './install-error-handler';
|
|
2
|
+
export { clearStoredEntries, getAllCrashReports, getForegroundSession, getInactiveSessions, getMainSession, logEvent, markFirstRender, markInteractive, NetworkRequestObserver, reportError, Session, setGlobalAttributes, } from './app-metrics';
|
|
3
|
+
export { filterKeyOf, subscribeNetworkRequestObserverEvents, } from './network-request-observer-subscription';
|
|
4
|
+
export { installErrorHandler } from './install-error-handler';
|
|
5
|
+
// Live as early as the app pulls this module in, matching upstream's own side effect
|
|
6
|
+
installErrorHandler();
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,QAAQ,EACR,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,WAAW,EACX,OAAO,EACP,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,WAAW,EACX,qCAAqC,GACtC,MAAM,yCAAyC,CAAC;AA6BjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,qFAAqF;AACrF,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { reportError } from './app-metrics';
|
|
2
|
+
let installed = false;
|
|
3
|
+
// react-native ships its own ambient `ErrorUtils` global, so a package whose tsconfig pulls
|
|
4
|
+
// that in conflicts with a local `declare global` here (core/engine/src/report-error.ts hit
|
|
5
|
+
// this, TS2451) - reading it off `globalThis` through Reflect sidesteps the whole ambient type
|
|
6
|
+
function globalErrorUtils() {
|
|
7
|
+
const utils = Reflect.get(globalThis, 'ErrorUtils');
|
|
8
|
+
if (typeof utils !== 'object' || utils === null)
|
|
9
|
+
return null;
|
|
10
|
+
const getGlobalHandler = Reflect.get(utils, 'getGlobalHandler');
|
|
11
|
+
const setGlobalHandler = Reflect.get(utils, 'setGlobalHandler');
|
|
12
|
+
if (typeof getGlobalHandler !== 'function' ||
|
|
13
|
+
typeof setGlobalHandler !== 'function') {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
getGlobalHandler: () => Reflect.apply(getGlobalHandler, utils, []),
|
|
18
|
+
setGlobalHandler: handler => Reflect.apply(setGlobalHandler, utils, [handler]),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** Wraps React Native's global `ErrorUtils` handler, chaining to whatever ran before it */
|
|
22
|
+
export function installErrorHandler() {
|
|
23
|
+
if (installed)
|
|
24
|
+
return;
|
|
25
|
+
const errorUtils = globalErrorUtils();
|
|
26
|
+
if (!errorUtils)
|
|
27
|
+
return;
|
|
28
|
+
installed = true;
|
|
29
|
+
const previousHandler = errorUtils.getGlobalHandler();
|
|
30
|
+
errorUtils.setGlobalHandler((error, isFatal) => {
|
|
31
|
+
try {
|
|
32
|
+
const asError = error instanceof Error ? error : undefined;
|
|
33
|
+
reportError({
|
|
34
|
+
source: 'global',
|
|
35
|
+
type: asError?.name,
|
|
36
|
+
message: asError?.message ?? String(error),
|
|
37
|
+
stacktrace: asError?.stack,
|
|
38
|
+
isFatal: isFatal ?? false,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
previousHandler?.(error, isFatal);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=install-error-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-error-handler.js","sourceRoot":"","sources":["../../src/core/install-error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAS5C,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,4FAA4F;AAC5F,4FAA4F;AAC5F,+FAA+F;AAC/F,SAAS,gBAAgB;IACvB,MAAM,KAAK,GAAY,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC7D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC7D,MAAM,gBAAgB,GAAY,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;IACzE,MAAM,gBAAgB,GAAY,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;IACzE,IACE,OAAO,gBAAgB,KAAK,UAAU;QACtC,OAAO,gBAAgB,KAAK,UAAU,EACtC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO;QACL,gBAAgB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,EAAE,EAAE,CAAC;QAClE,gBAAgB,EAAE,OAAO,CAAC,EAAE,CAC1B,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC;KACpD,CAAC;AACJ,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,mBAAmB;IACjC,IAAI,SAAS;QAAE,OAAO;IACtB,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;IACtC,IAAI,CAAC,UAAU;QAAE,OAAO;IACxB,SAAS,GAAG,IAAI,CAAC;IAEjB,MAAM,eAAe,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAC;IACtD,UAAU,CAAC,gBAAgB,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7C,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;YAC3D,WAAW,CAAC;gBACV,MAAM,EAAE,QAAQ;gBAChB,IAAI,EAAE,OAAO,EAAE,IAAI;gBACnB,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC;gBAC1C,UAAU,EAAE,OAAO,EAAE,KAAK;gBAC1B,OAAO,EAAE,OAAO,IAAI,KAAK;aAC1B,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACpC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { NetworkRequestObserver } from './network-request-observer';
|
|
2
|
+
import type { Session } from './session';
|
|
3
|
+
import type { ICrashReport, IDebugSession, ILogAttributeValue, ILogEventOptions, IMetricAttributes, IReportErrorInput } from './types';
|
|
4
|
+
export type INativeAppMetricsModule = {
|
|
5
|
+
markFirstRender(): void;
|
|
6
|
+
markInteractive(attributes?: IMetricAttributes): void;
|
|
7
|
+
logEvent(name: string, options?: ILogEventOptions): void;
|
|
8
|
+
setGlobalAttributes(attributes?: Record<string, ILogAttributeValue> | null): void;
|
|
9
|
+
clearStoredEntries(): Promise<void>;
|
|
10
|
+
getInactiveSessions(): Promise<IDebugSession[]>;
|
|
11
|
+
/** Android's native module only, app-metrics.ts gates it on Platform.OS */
|
|
12
|
+
getAllCrashReports?(): Promise<ICrashReport[]>;
|
|
13
|
+
reportError(error: IReportErrorInput): void;
|
|
14
|
+
getMainSession(): Session;
|
|
15
|
+
getForegroundSession(): Promise<Session | null>;
|
|
16
|
+
NetworkRequestObserver: typeof NetworkRequestObserver;
|
|
17
|
+
Session: typeof Session;
|
|
18
|
+
};
|
|
19
|
+
export declare const expoAppMetrics: INativeAppMetricsModule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAYxD,MAAM,4BAA4B,GAAG,gBAAgB,CAAC;AAqBtD,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAC/C,4BAA4B,CAC7B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NetworkRequestObserver } from './app-metrics';
|
|
2
|
+
import type { INetworkRequestObserverCallbacks } from './network-request-observer-subscription';
|
|
3
|
+
import type { INetworkRequestFilter } from './types';
|
|
4
|
+
export type IUseNetworkRequestObserverOptions = INetworkRequestObserverCallbacks & {
|
|
5
|
+
/** Applied natively. Omit or pass `null` to observe every request */
|
|
6
|
+
filter?: INetworkRequestFilter | null;
|
|
7
|
+
};
|
|
8
|
+
export declare function createNetworkRequestObserverLifecycle(getOptions: () => IUseNetworkRequestObserverOptions, runFilterEffect: (effect: () => void) => void, registerCleanup: (cleanup: () => void) => void): NetworkRequestObserver;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NetworkRequestObserver } from './app-metrics';
|
|
2
|
+
import { filterKeyOf, subscribeNetworkRequestObserverEvents, } from './network-request-observer-subscription';
|
|
3
|
+
// Shared by adapters whose reactivity auto-tracks reads inside a plain effect (Vue's
|
|
4
|
+
// `watchEffect`, Solid's `createEffect`); React's render model doesn't, so it keeps its own wiring
|
|
5
|
+
export function createNetworkRequestObserverLifecycle(getOptions, runFilterEffect, registerCleanup) {
|
|
6
|
+
const initialFilter = getOptions().filter;
|
|
7
|
+
const observer = new NetworkRequestObserver(initialFilter);
|
|
8
|
+
let appliedFilterKey = filterKeyOf(initialFilter);
|
|
9
|
+
runFilterEffect(() => {
|
|
10
|
+
const nextKey = filterKeyOf(getOptions().filter);
|
|
11
|
+
if (appliedFilterKey === nextKey)
|
|
12
|
+
return;
|
|
13
|
+
appliedFilterKey = nextKey;
|
|
14
|
+
observer.setFilter(getOptions().filter ?? null);
|
|
15
|
+
});
|
|
16
|
+
registerCleanup(subscribeNetworkRequestObserverEvents(observer, getOptions));
|
|
17
|
+
registerCleanup(() => observer.release());
|
|
18
|
+
return observer;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=network-request-observer-lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-request-observer-lifecycle.js","sourceRoot":"","sources":["../../src/core/network-request-observer-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EACL,WAAW,EACX,qCAAqC,GACtC,MAAM,yCAAyC,CAAC;AAUjD,qFAAqF;AACrF,mGAAmG;AACnG,MAAM,UAAU,qCAAqC,CACnD,UAAmD,EACnD,eAA6C,EAC7C,eAA8C;IAE9C,MAAM,aAAa,GAAG,UAAU,EAAE,CAAC,MAAM,CAAC;IAC1C,MAAM,QAAQ,GAAG,IAAI,sBAAsB,CAAC,aAAa,CAAC,CAAC;IAE3D,IAAI,gBAAgB,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC;IAClD,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,OAAO,GAAG,WAAW,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,gBAAgB,KAAK,OAAO;YAAE,OAAO;QACzC,gBAAgB,GAAG,OAAO,CAAC;QAC3B,QAAQ,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,eAAe,CAAC,qCAAqC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAC7E,eAAe,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IAE1C,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { INetworkRequestCompletedEvent, INetworkRequestFilter, INetworkRequestStartedEvent } from './types';
|
|
2
|
+
export declare function filterKeyOf(filter: INetworkRequestFilter | null | undefined): string;
|
|
3
|
+
export type INetworkRequestObserverCallbacks = {
|
|
4
|
+
onStarted?: (event: INetworkRequestStartedEvent) => void;
|
|
5
|
+
onCompleted?: (event: INetworkRequestCompletedEvent) => void;
|
|
6
|
+
};
|
|
7
|
+
export type ISubscribableNetworkRequestObserver = {
|
|
8
|
+
addListener(event: 'requestStarted', listener: (event: INetworkRequestStartedEvent) => void): {
|
|
9
|
+
remove: () => void;
|
|
10
|
+
};
|
|
11
|
+
addListener(event: 'requestCompleted', listener: (event: INetworkRequestCompletedEvent) => void): {
|
|
12
|
+
remove: () => void;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare function subscribeNetworkRequestObserverEvents(observer: ISubscribableNetworkRequestObserver, getCallbacks: () => INetworkRequestObserverCallbacks): () => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Field-listed rather than a bare JSON.stringify(filter) so `{ hosts, methods }` and
|
|
2
|
+
// `{ methods, hosts }` (the same filter) don't produce different keys
|
|
3
|
+
export function filterKeyOf(filter) {
|
|
4
|
+
return JSON.stringify({
|
|
5
|
+
hosts: filter?.hosts ?? null,
|
|
6
|
+
methods: filter?.methods ?? null,
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
// `getCallbacks` is read fresh on every event, so a caller never needs to resubscribe just
|
|
10
|
+
// because its own callbacks changed identity between renders
|
|
11
|
+
export function subscribeNetworkRequestObserverEvents(observer, getCallbacks) {
|
|
12
|
+
const startedSubscription = observer.addListener('requestStarted', event => {
|
|
13
|
+
getCallbacks().onStarted?.(event);
|
|
14
|
+
});
|
|
15
|
+
const completedSubscription = observer.addListener('requestCompleted', event => {
|
|
16
|
+
getCallbacks().onCompleted?.(event);
|
|
17
|
+
});
|
|
18
|
+
return () => {
|
|
19
|
+
startedSubscription.remove();
|
|
20
|
+
completedSubscription.remove();
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=network-request-observer-subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-request-observer-subscription.js","sourceRoot":"","sources":["../../src/core/network-request-observer-subscription.ts"],"names":[],"mappings":"AAMA,qFAAqF;AACrF,sEAAsE;AACtE,MAAM,UAAU,WAAW,CACzB,MAAgD;IAEhD,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,IAAI;QAC5B,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,IAAI;KACjC,CAAC,CAAC;AACL,CAAC;AAkBD,2FAA2F;AAC3F,6DAA6D;AAC7D,MAAM,UAAU,qCAAqC,CACnD,QAA6C,EAC7C,YAAoD;IAEpD,MAAM,mBAAmB,GAAG,QAAQ,CAAC,WAAW,CAAC,gBAAgB,EAAE,KAAK,CAAC,EAAE;QACzE,YAAY,EAAE,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IACH,MAAM,qBAAqB,GAAG,QAAQ,CAAC,WAAW,CAChD,kBAAkB,EAClB,KAAK,CAAC,EAAE;QACN,YAAY,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC,CACF,CAAC;IACF,OAAO,GAAG,EAAE;QACV,mBAAmB,CAAC,MAAM,EAAE,CAAC;QAC7B,qBAAqB,CAAC,MAAM,EAAE,CAAC;IACjC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SharedObject } from 'expo-modules-core';
|
|
2
|
+
import type { INetworkRequestFilter, INetworkRequestObserverEvents } from './types';
|
|
3
|
+
export declare class NetworkRequestObserver extends SharedObject<INetworkRequestObserverEvents> {
|
|
4
|
+
constructor(filter?: INetworkRequestFilter | null);
|
|
5
|
+
/** Applies atomically, in-flight events are emitted under either the old or new filter */
|
|
6
|
+
setFilter(filter: INetworkRequestFilter | null): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-request-observer.js","sourceRoot":"","sources":["../../src/core/network-request-observer.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { reportError } from './app-metrics';
|
|
2
|
+
/** Shared by every adapter's error-boundary equivalent, builds and reports a caught render error */
|
|
3
|
+
export function reportCaughtError(error, componentStack) {
|
|
4
|
+
const caught = error instanceof Error ? error : undefined;
|
|
5
|
+
try {
|
|
6
|
+
reportError({
|
|
7
|
+
source: 'errorBoundary',
|
|
8
|
+
type: caught?.name,
|
|
9
|
+
message: caught?.message ?? String(error),
|
|
10
|
+
stacktrace: caught?.stack,
|
|
11
|
+
componentStack,
|
|
12
|
+
isFatal: false,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
catch (reportingError) {
|
|
16
|
+
if (__DEV__) {
|
|
17
|
+
console.warn('[app-metrics] Failed to report a caught error:', reportingError);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=report-caught-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-caught-error.js","sourceRoot":"","sources":["../../src/core/report-caught-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,oGAAoG;AACpG,MAAM,UAAU,iBAAiB,CAC/B,KAAc,EACd,cAAuB;IAEvB,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1D,IAAI,CAAC;QACH,WAAW,CAAC;YACV,MAAM,EAAE,eAAe;YACvB,IAAI,EAAE,MAAM,EAAE,IAAI;YAClB,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC;YACzC,UAAU,EAAE,MAAM,EAAE,KAAK;YACzB,cAAc;YACd,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,cAAc,EAAE,CAAC;QACxB,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,IAAI,CACV,gDAAgD,EAChD,cAAc,CACf,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SharedObject } from 'expo-modules-core';
|
|
2
|
+
import type { ILogRecord, IMetric, IMetricInput, ISessionType } from './types';
|
|
3
|
+
export declare class Session extends SharedObject {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly type: ISessionType;
|
|
6
|
+
readonly startDate: string;
|
|
7
|
+
isActive(): Promise<boolean>;
|
|
8
|
+
getEndDate(): Promise<string | null>;
|
|
9
|
+
getMetrics(): Promise<IMetric[]>;
|
|
10
|
+
getLogs(): Promise<ILogRecord[]>;
|
|
11
|
+
addMetric(metric: IMetricInput): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/core/session.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
export type IAppStartupTimes = {
|
|
2
|
+
/** @platform ios */
|
|
3
|
+
loadTime?: number;
|
|
4
|
+
coldLaunchTime?: number;
|
|
5
|
+
warmLaunchTime?: number;
|
|
6
|
+
bundleLoadTime?: number;
|
|
7
|
+
timeToFirstRender?: number;
|
|
8
|
+
timeToInteractive?: number;
|
|
9
|
+
};
|
|
10
|
+
export type IMemoryUsageSnapshot = {
|
|
11
|
+
/** @platform ios */
|
|
12
|
+
allocated?: number;
|
|
13
|
+
physical: number;
|
|
14
|
+
available: number;
|
|
15
|
+
/** @platform android */
|
|
16
|
+
javaHeap?: number;
|
|
17
|
+
};
|
|
18
|
+
export type IFrameRateMetrics = {
|
|
19
|
+
renderedFrames: number;
|
|
20
|
+
expectedFrames: number;
|
|
21
|
+
droppedFrames: number;
|
|
22
|
+
/** Takes at least 700ms to render */
|
|
23
|
+
frozenFrames: number;
|
|
24
|
+
/** Takes at least 17ms to render */
|
|
25
|
+
slowFrames: number;
|
|
26
|
+
freezeTime: number;
|
|
27
|
+
sessionDuration: number;
|
|
28
|
+
};
|
|
29
|
+
export type IMetric = {
|
|
30
|
+
timestamp: string;
|
|
31
|
+
category: string;
|
|
32
|
+
name: string;
|
|
33
|
+
value: number;
|
|
34
|
+
sessionId: string;
|
|
35
|
+
routeName?: string | null;
|
|
36
|
+
params?: Record<string, unknown>;
|
|
37
|
+
};
|
|
38
|
+
export type IMetricAttributes = {
|
|
39
|
+
routeName?: string | null;
|
|
40
|
+
params?: Record<string, unknown>;
|
|
41
|
+
};
|
|
42
|
+
/** Ordered from least to most severe */
|
|
43
|
+
export type ILogSeverity = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
44
|
+
export type ILogAttributeValue = string | number | boolean | ILogAttributeValue[] | {
|
|
45
|
+
[key: string]: ILogAttributeValue;
|
|
46
|
+
};
|
|
47
|
+
export type ILogRecord = {
|
|
48
|
+
timestamp: string;
|
|
49
|
+
name: string;
|
|
50
|
+
body?: string | null;
|
|
51
|
+
attributes?: Record<string, ILogAttributeValue> | null;
|
|
52
|
+
severity: ILogSeverity;
|
|
53
|
+
};
|
|
54
|
+
export type ILogEventOptions = {
|
|
55
|
+
displayName?: string | null;
|
|
56
|
+
body?: string | null;
|
|
57
|
+
attributes?: Record<string, ILogAttributeValue> | null;
|
|
58
|
+
/** @default 'info' */
|
|
59
|
+
severity?: ILogSeverity | null;
|
|
60
|
+
};
|
|
61
|
+
export type ISessionType = 'main' | 'foreground' | 'screen' | 'custom' | 'unknown';
|
|
62
|
+
/** Every `IMetric` field except `sessionId`, implied by the owning session */
|
|
63
|
+
export type IMetricInput = Omit<IMetric, 'sessionId'>;
|
|
64
|
+
export type ICallStackFrame = {
|
|
65
|
+
/** @platform ios */
|
|
66
|
+
binaryName?: string | null;
|
|
67
|
+
/** @platform ios */
|
|
68
|
+
binaryUUID?: string | null;
|
|
69
|
+
/** @platform ios */
|
|
70
|
+
address?: number | null;
|
|
71
|
+
/** @platform ios */
|
|
72
|
+
offsetIntoBinaryTextSegment?: number | null;
|
|
73
|
+
/** @platform ios */
|
|
74
|
+
sampleCount?: number | null;
|
|
75
|
+
subFrames?: ICallStackFrame[] | null;
|
|
76
|
+
/** ios: on-device `dladdr` symbolication. android: the JVM stack-trace frame string */
|
|
77
|
+
symbol?: string | null;
|
|
78
|
+
};
|
|
79
|
+
export type ICallStack = {
|
|
80
|
+
threadAttributed?: boolean | null;
|
|
81
|
+
callStackRootFrames?: ICallStackFrame[] | null;
|
|
82
|
+
};
|
|
83
|
+
export type ICallStackTree = {
|
|
84
|
+
callStacks?: ICallStack[] | null;
|
|
85
|
+
};
|
|
86
|
+
/** ios (MetricKit) reports the numeric fields; android reports `exceptionReason` as a string */
|
|
87
|
+
export type ICrashReport = {
|
|
88
|
+
/** @platform ios */
|
|
89
|
+
exceptionType?: number | null;
|
|
90
|
+
/** @platform ios */
|
|
91
|
+
exceptionCode?: number | null;
|
|
92
|
+
/** Unix signal number, e.g. SIGSEGV = 11 */
|
|
93
|
+
signal?: number | null;
|
|
94
|
+
terminationReason?: string | null;
|
|
95
|
+
/** @platform ios */
|
|
96
|
+
virtualMemoryRegionInfo?: string | null;
|
|
97
|
+
/** ios: a structured MetricKit reason object. android: a plain composed string */
|
|
98
|
+
exceptionReason?: {
|
|
99
|
+
composedMessage: string;
|
|
100
|
+
formatString: string;
|
|
101
|
+
arguments: string[];
|
|
102
|
+
exceptionType: string;
|
|
103
|
+
className: string;
|
|
104
|
+
exceptionName: string;
|
|
105
|
+
} | string | null;
|
|
106
|
+
callStackTree?: ICallStackTree | null;
|
|
107
|
+
/** `null` for an orphan crash with no attributable session. @platform android */
|
|
108
|
+
sessionId?: string | null;
|
|
109
|
+
appVersion: string;
|
|
110
|
+
timestampBegin: string;
|
|
111
|
+
/** @platform ios */
|
|
112
|
+
timestampEnd?: string;
|
|
113
|
+
ingestedAt: string;
|
|
114
|
+
};
|
|
115
|
+
export type INetworkRequestStartedEvent = {
|
|
116
|
+
id: string;
|
|
117
|
+
url: string;
|
|
118
|
+
method: string;
|
|
119
|
+
startedAt: string;
|
|
120
|
+
};
|
|
121
|
+
export type INetworkRequestRedirect = {
|
|
122
|
+
fromUrl: string;
|
|
123
|
+
toUrl: string;
|
|
124
|
+
statusCode: number;
|
|
125
|
+
};
|
|
126
|
+
export type INetworkRequestCompletedEvent = {
|
|
127
|
+
id: string;
|
|
128
|
+
url: string;
|
|
129
|
+
method: string;
|
|
130
|
+
statusCode: number | null;
|
|
131
|
+
networkProtocol: string | null;
|
|
132
|
+
requestBytesSent: number | null;
|
|
133
|
+
responseBytesReceived: number | null;
|
|
134
|
+
errorDescription: string | null;
|
|
135
|
+
startedAt: string | null;
|
|
136
|
+
completedAt: string | null;
|
|
137
|
+
totalDuration: number;
|
|
138
|
+
redirects: INetworkRequestRedirect[];
|
|
139
|
+
};
|
|
140
|
+
/** An unset field places no constraint; fields AND together, entries within one OR together */
|
|
141
|
+
export type INetworkRequestFilter = {
|
|
142
|
+
hosts?: string[] | null;
|
|
143
|
+
methods?: string[] | null;
|
|
144
|
+
};
|
|
145
|
+
export type INetworkRequestObserverEvents = {
|
|
146
|
+
requestStarted(event: INetworkRequestStartedEvent): void;
|
|
147
|
+
requestCompleted(event: INetworkRequestCompletedEvent): void;
|
|
148
|
+
};
|
|
149
|
+
/** Debug-only, from `getInactiveSessions()` as a plain eager record, not a shared object */
|
|
150
|
+
export type IDebugSession = {
|
|
151
|
+
id: string;
|
|
152
|
+
type: ISessionType;
|
|
153
|
+
startDate: string;
|
|
154
|
+
endDate?: string | null;
|
|
155
|
+
metrics: IMetric[];
|
|
156
|
+
logs: ILogRecord[];
|
|
157
|
+
crashReport?: ICrashReport | null;
|
|
158
|
+
};
|
|
159
|
+
/** Recorded natively as an OpenTelemetry-shaped `js.exception` log event */
|
|
160
|
+
export type IReportErrorInput = {
|
|
161
|
+
source: 'global' | 'errorBoundary' | 'reportedByUser';
|
|
162
|
+
type?: string;
|
|
163
|
+
message: string;
|
|
164
|
+
stacktrace?: string;
|
|
165
|
+
/** The React component stack, error-boundary captures only */
|
|
166
|
+
componentStack?: string;
|
|
167
|
+
isFatal: boolean;
|
|
168
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,wBAAwB"}
|