@goliapkg/sentori-react-native 4.0.0 → 5.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/MIGRATION.md +131 -0
- package/README.md +40 -30
- package/android/build.gradle +21 -0
- package/android/src/main/java/com/sentori/SentoriCrashHandler.kt +29 -0
- package/android/src/main/java/com/sentori/SentoriModule.kt +8 -0
- package/android/src/main/java/com/sentori/SentoriScreenshotCapture.kt +36 -4
- package/android/src/test/java/com/sentori/SentoriCrashHandlerTest.kt +7 -2
- package/android/src/test/resources/robolectric.properties +10 -0
- package/ios/SentoriCrashHandler.swift +48 -4
- package/ios/SentoriModule.swift +12 -0
- package/ios/SentoriScreenshotCapture.swift +34 -3
- package/lib/config.d.ts +17 -47
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +3 -0
- package/lib/config.js.map +1 -1
- package/lib/device.d.ts +5 -0
- package/lib/device.d.ts.map +1 -0
- package/lib/device.js +29 -0
- package/lib/device.js.map +1 -0
- package/lib/emit-hooks.d.ts +7 -0
- package/lib/emit-hooks.d.ts.map +1 -0
- package/lib/emit-hooks.js +24 -0
- package/lib/emit-hooks.js.map +1 -0
- package/lib/error-boundary.d.ts.map +1 -1
- package/lib/error-boundary.js +1 -1
- package/lib/error-boundary.js.map +1 -1
- package/lib/feature-flags.d.ts.map +1 -1
- package/lib/handlers/dev-symbolicate.d.ts +1 -1
- package/lib/handlers/dev-symbolicate.d.ts.map +1 -1
- package/lib/handlers/dev-symbolicate.js +2 -0
- package/lib/handlers/dev-symbolicate.js.map +1 -1
- package/lib/handlers/global.js +1 -1
- package/lib/handlers/global.js.map +1 -1
- package/lib/handlers/lifecycle.js +3 -3
- package/lib/handlers/lifecycle.js.map +1 -1
- package/lib/handlers/network.d.ts +2 -2
- package/lib/handlers/network.d.ts.map +1 -1
- package/lib/handlers/network.js +69 -187
- package/lib/handlers/network.js.map +1 -1
- package/lib/handlers/promise.js +1 -1
- package/lib/handlers/promise.js.map +1 -1
- package/lib/handlers/screenshot.d.ts.map +1 -1
- package/lib/handlers/screenshot.js +3 -12
- package/lib/handlers/screenshot.js.map +1 -1
- package/lib/index.d.ts +32 -109
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +54 -103
- package/lib/index.js.map +1 -1
- package/lib/init.d.ts +3 -150
- package/lib/init.d.ts.map +1 -1
- package/lib/init.js +100 -261
- package/lib/init.js.map +1 -1
- package/lib/long-task-monitor.d.ts +1 -7
- package/lib/long-task-monitor.d.ts.map +1 -1
- package/lib/long-task-monitor.js +37 -58
- package/lib/long-task-monitor.js.map +1 -1
- package/lib/mask.d.ts +5 -13
- package/lib/mask.d.ts.map +1 -1
- package/lib/mask.js +29 -30
- package/lib/mask.js.map +1 -1
- package/lib/mobile-vitals.d.ts +3 -31
- package/lib/mobile-vitals.d.ts.map +1 -1
- package/lib/mobile-vitals.js +22 -61
- package/lib/mobile-vitals.js.map +1 -1
- package/lib/native-pending.d.ts +3 -0
- package/lib/native-pending.d.ts.map +1 -0
- package/lib/native-pending.js +64 -0
- package/lib/native-pending.js.map +1 -0
- package/lib/native.d.ts +4 -11
- package/lib/native.d.ts.map +1 -1
- package/lib/native.js +23 -0
- package/lib/native.js.map +1 -1
- package/lib/navigation.d.ts +3 -17
- package/lib/navigation.d.ts.map +1 -1
- package/lib/navigation.js +32 -133
- package/lib/navigation.js.map +1 -1
- package/lib/netinfo.d.ts +1 -1
- package/lib/netinfo.d.ts.map +1 -1
- package/lib/netinfo.js +2 -2
- package/lib/netinfo.js.map +1 -1
- package/lib/push.d.ts.map +1 -1
- package/lib/push.js +2 -4
- package/lib/push.js.map +1 -1
- package/lib/rage-tap.d.ts.map +1 -1
- package/lib/rage-tap.js +56 -23
- package/lib/rage-tap.js.map +1 -1
- package/lib/replay-screens.d.ts +15 -0
- package/lib/replay-screens.d.ts.map +1 -0
- package/lib/replay-screens.js +87 -0
- package/lib/replay-screens.js.map +1 -0
- package/lib/replay.d.ts.map +1 -1
- package/lib/replay.js +3 -24
- package/lib/replay.js.map +1 -1
- package/lib/responsiveness-detector.d.ts +18 -0
- package/lib/responsiveness-detector.d.ts.map +1 -0
- package/lib/responsiveness-detector.js +55 -0
- package/lib/responsiveness-detector.js.map +1 -0
- package/lib/scope.d.ts +7 -0
- package/lib/scope.d.ts.map +1 -0
- package/lib/scope.js +41 -0
- package/lib/scope.js.map +1 -0
- package/lib/transport.d.ts +19 -92
- package/lib/transport.d.ts.map +1 -1
- package/lib/transport.js +75 -288
- package/lib/transport.js.map +1 -1
- package/lib/verbs.d.ts +16 -0
- package/lib/verbs.d.ts.map +1 -0
- package/lib/verbs.js +153 -0
- package/lib/verbs.js.map +1 -0
- package/package.json +4 -3
- package/src/__tests__/iron-rule.test.ts +128 -0
- package/src/__tests__/replay-screens.test.ts +63 -0
- package/src/__tests__/responsiveness-detector.test.ts +74 -0
- package/src/__tests__/screenshot.test.ts +0 -2
- package/src/__tests__/transport.test.ts +66 -213
- package/src/__tests__/verbs.test.ts +91 -0
- package/src/config.ts +20 -47
- package/src/device.ts +36 -0
- package/src/emit-hooks.ts +30 -0
- package/src/error-boundary.tsx +1 -1
- package/src/handlers/dev-symbolicate.ts +2 -1
- package/src/handlers/global.ts +1 -1
- package/src/handlers/lifecycle.ts +3 -3
- package/src/handlers/network.ts +95 -211
- package/src/handlers/promise.ts +1 -1
- package/src/handlers/screenshot.ts +3 -11
- package/src/index.ts +84 -215
- package/src/init.ts +115 -449
- package/src/long-task-monitor.ts +42 -64
- package/src/mask.ts +29 -31
- package/src/mobile-vitals.ts +22 -82
- package/src/native-pending.ts +92 -0
- package/src/native.ts +33 -0
- package/src/navigation.ts +34 -142
- package/src/netinfo.ts +3 -3
- package/src/push.ts +2 -5
- package/src/rage-tap.tsx +72 -25
- package/src/replay-screens.ts +95 -0
- package/src/replay.ts +3 -20
- package/src/responsiveness-detector.ts +66 -0
- package/src/scope.ts +50 -0
- package/src/transport.ts +84 -371
- package/src/verbs.ts +198 -0
- package/lib/breadcrumbs.d.ts +0 -18
- package/lib/breadcrumbs.d.ts.map +0 -1
- package/lib/breadcrumbs.js +0 -42
- package/lib/breadcrumbs.js.map +0 -1
- package/lib/bundle-info.d.ts +0 -12
- package/lib/bundle-info.d.ts.map +0 -1
- package/lib/bundle-info.js +0 -73
- package/lib/bundle-info.js.map +0 -1
- package/lib/capture.d.ts +0 -140
- package/lib/capture.d.ts.map +0 -1
- package/lib/capture.js +0 -511
- package/lib/capture.js.map +0 -1
- package/lib/compat/sentry.d.ts +0 -126
- package/lib/compat/sentry.d.ts.map +0 -1
- package/lib/compat/sentry.js +0 -332
- package/lib/compat/sentry.js.map +0 -1
- package/lib/control-channel.d.ts +0 -6
- package/lib/control-channel.d.ts.map +0 -1
- package/lib/control-channel.js +0 -96
- package/lib/control-channel.js.map +0 -1
- package/lib/expo-compat.d.ts +0 -270
- package/lib/expo-compat.d.ts.map +0 -1
- package/lib/expo-compat.js +0 -500
- package/lib/expo-compat.js.map +0 -1
- package/lib/feedback-widget.d.ts +0 -35
- package/lib/feedback-widget.d.ts.map +0 -1
- package/lib/feedback-widget.js +0 -193
- package/lib/feedback-widget.js.map +0 -1
- package/lib/feedback.d.ts +0 -2
- package/lib/feedback.d.ts.map +0 -1
- package/lib/feedback.js +0 -17
- package/lib/feedback.js.map +0 -1
- package/lib/heartbeat.d.ts +0 -9
- package/lib/heartbeat.d.ts.map +0 -1
- package/lib/heartbeat.js +0 -138
- package/lib/heartbeat.js.map +0 -1
- package/lib/index.js.bak +0 -64
- package/lib/install-id.d.ts +0 -17
- package/lib/install-id.d.ts.map +0 -1
- package/lib/install-id.js +0 -125
- package/lib/install-id.js.map +0 -1
- package/lib/lifecycle.d.ts +0 -28
- package/lib/lifecycle.d.ts.map +0 -1
- package/lib/lifecycle.js +0 -73
- package/lib/lifecycle.js.map +0 -1
- package/lib/measure.d.ts +0 -4
- package/lib/measure.d.ts.map +0 -1
- package/lib/measure.js +0 -25
- package/lib/measure.js.map +0 -1
- package/lib/metrics.d.ts +0 -24
- package/lib/metrics.d.ts.map +0 -1
- package/lib/metrics.js +0 -81
- package/lib/metrics.js.map +0 -1
- package/lib/pre-crash-sentinel.d.ts +0 -12
- package/lib/pre-crash-sentinel.d.ts.map +0 -1
- package/lib/pre-crash-sentinel.js +0 -116
- package/lib/pre-crash-sentinel.js.map +0 -1
- package/lib/report-security.d.ts +0 -40
- package/lib/report-security.d.ts.map +0 -1
- package/lib/report-security.js +0 -159
- package/lib/report-security.js.map +0 -1
- package/lib/runtime-metrics-fps.d.ts +0 -19
- package/lib/runtime-metrics-fps.d.ts.map +0 -1
- package/lib/runtime-metrics-fps.js +0 -128
- package/lib/runtime-metrics-fps.js.map +0 -1
- package/lib/runtime-metrics-heap.d.ts +0 -13
- package/lib/runtime-metrics-heap.d.ts.map +0 -1
- package/lib/runtime-metrics-heap.js +0 -67
- package/lib/runtime-metrics-heap.js.map +0 -1
- package/lib/runtime-metrics-network.d.ts +0 -23
- package/lib/runtime-metrics-network.d.ts.map +0 -1
- package/lib/runtime-metrics-network.js +0 -99
- package/lib/runtime-metrics-network.js.map +0 -1
- package/lib/runtime-metrics.d.ts +0 -43
- package/lib/runtime-metrics.d.ts.map +0 -1
- package/lib/runtime-metrics.js +0 -115
- package/lib/runtime-metrics.js.map +0 -1
- package/lib/sample-profiler.d.ts +0 -21
- package/lib/sample-profiler.d.ts.map +0 -1
- package/lib/sample-profiler.js +0 -152
- package/lib/sample-profiler.js.map +0 -1
- package/lib/sentinel-context.d.ts +0 -4
- package/lib/sentinel-context.d.ts.map +0 -1
- package/lib/sentinel-context.js +0 -52
- package/lib/sentinel-context.js.map +0 -1
- package/lib/session-tracker.d.ts +0 -6
- package/lib/session-tracker.d.ts.map +0 -1
- package/lib/session-tracker.js +0 -50
- package/lib/session-tracker.js.map +0 -1
- package/lib/stack.d.ts +0 -3
- package/lib/stack.d.ts.map +0 -1
- package/lib/stack.js +0 -7
- package/lib/stack.js.map +0 -1
- package/lib/state-snapshots.d.ts +0 -33
- package/lib/state-snapshots.d.ts.map +0 -1
- package/lib/state-snapshots.js +0 -109
- package/lib/state-snapshots.js.map +0 -1
- package/lib/track.d.ts +0 -34
- package/lib/track.d.ts.map +0 -1
- package/lib/track.js +0 -107
- package/lib/track.js.map +0 -1
- package/lib/trail.d.ts +0 -12
- package/lib/trail.d.ts.map +0 -1
- package/lib/trail.js +0 -28
- package/lib/trail.js.map +0 -1
- package/lib/trust-score.d.ts +0 -20
- package/lib/trust-score.d.ts.map +0 -1
- package/lib/trust-score.js +0 -151
- package/lib/trust-score.js.map +0 -1
- package/lib/types.d.ts +0 -2
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js +0 -4
- package/lib/types.js.map +0 -1
- package/lib/uuid.d.ts +0 -2
- package/lib/uuid.d.ts.map +0 -1
- package/lib/uuid.js +0 -3
- package/lib/uuid.js.map +0 -1
- package/src/__tests__/before-send.test.ts +0 -72
- package/src/__tests__/breadcrumbs.test.ts +0 -44
- package/src/__tests__/capture-replay.test.ts +0 -150
- package/src/__tests__/compat-sentry.test.ts +0 -121
- package/src/__tests__/control-channel.test.ts +0 -111
- package/src/__tests__/install-id.test.ts +0 -60
- package/src/__tests__/long-task-monitor.test.ts +0 -59
- package/src/__tests__/measure.test.ts +0 -45
- package/src/__tests__/navigation.test.ts +0 -175
- package/src/__tests__/push.test.ts +0 -238
- package/src/__tests__/report-security.test.ts +0 -106
- package/src/__tests__/runtime-metrics-instruments.test.ts +0 -109
- package/src/__tests__/runtime-metrics-network.test.ts +0 -78
- package/src/__tests__/sample-profiler.test.ts +0 -59
- package/src/__tests__/stack.test.ts +0 -45
- package/src/__tests__/state-snapshots.test.ts +0 -119
- package/src/__tests__/tracing.test.ts +0 -201
- package/src/__tests__/track.test.ts +0 -91
- package/src/__tests__/uuid.test.ts +0 -41
- package/src/breadcrumbs.ts +0 -57
- package/src/bundle-info.ts +0 -95
- package/src/capture.ts +0 -660
- package/src/compat/sentry.ts +0 -490
- package/src/control-channel.ts +0 -98
- package/src/expo-compat.ts +0 -698
- package/src/feedback-widget.tsx +0 -316
- package/src/feedback.ts +0 -21
- package/src/heartbeat.ts +0 -157
- package/src/install-id.ts +0 -146
- package/src/lifecycle.ts +0 -76
- package/src/measure.ts +0 -28
- package/src/metrics.ts +0 -94
- package/src/pre-crash-sentinel.ts +0 -140
- package/src/report-security.ts +0 -165
- package/src/runtime-metrics-fps.ts +0 -137
- package/src/runtime-metrics-heap.ts +0 -78
- package/src/runtime-metrics-network.ts +0 -103
- package/src/runtime-metrics.ts +0 -122
- package/src/sample-profiler.ts +0 -169
- package/src/sentinel-context.ts +0 -60
- package/src/session-tracker.ts +0 -53
- package/src/stack.ts +0 -10
- package/src/state-snapshots.ts +0 -133
- package/src/track.ts +0 -123
- package/src/trail.ts +0 -32
- package/src/trust-score.ts +0 -176
- package/src/types.ts +0 -21
- package/src/uuid.ts +0 -2
package/src/verbs.ts
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
// The five event verbs (design.md §4). Everything here is
|
|
2
|
+
// synchronous, never throws, and returns the client-minted event id
|
|
3
|
+
// — the zero-cost iron rule made code.
|
|
4
|
+
//
|
|
5
|
+
// sentori.error(err) 出了什么事?
|
|
6
|
+
// sentori.warn(name) 用户哪里不舒服?
|
|
7
|
+
// sentori.trace(name) 这里发生了什么?
|
|
8
|
+
// sentori.assert(n, ok) 这里应该成立吗?
|
|
9
|
+
// sentori.probe(ref) 那个 bug 回来了吗?
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
coerceError,
|
|
13
|
+
parseStack,
|
|
14
|
+
pushSignal,
|
|
15
|
+
safeFn,
|
|
16
|
+
snapshotSignals,
|
|
17
|
+
uuidV7,
|
|
18
|
+
} from '@goliapkg/sentori-core';
|
|
19
|
+
import type {
|
|
20
|
+
EventData,
|
|
21
|
+
EventKind,
|
|
22
|
+
SentoriError,
|
|
23
|
+
Surface,
|
|
24
|
+
TraceOptions,
|
|
25
|
+
WireEvent,
|
|
26
|
+
WirePayload,
|
|
27
|
+
} from '@goliapkg/sentori-core';
|
|
28
|
+
|
|
29
|
+
import { getConfig } from './config';
|
|
30
|
+
import { collectDevice } from './device';
|
|
31
|
+
import { onEventEmitted } from './emit-hooks';
|
|
32
|
+
import { currentContext, currentUserKey } from './scope';
|
|
33
|
+
import { countAssert, enqueue } from './transport';
|
|
34
|
+
|
|
35
|
+
/** Serialize any Error instances found in the data argument — the
|
|
36
|
+
* error-in-data convention (design.md §4): a caught-but-noteworthy
|
|
37
|
+
* exception needs no special API. One level deep is enough; nested
|
|
38
|
+
* containers of errors are an anti-pattern we don't reward. */
|
|
39
|
+
const serializeData = (data?: EventData): Record<string, unknown> | undefined => {
|
|
40
|
+
if (!data) return undefined;
|
|
41
|
+
const out: Record<string, unknown> = {};
|
|
42
|
+
for (const [k, v] of Object.entries(data)) {
|
|
43
|
+
out[k] = v instanceof Error ? toSentoriError(v) : v;
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const toSentoriError = (e: Error): SentoriError => ({
|
|
49
|
+
type: e.name || 'Error',
|
|
50
|
+
message: e.message,
|
|
51
|
+
stack: parseStack(e.stack),
|
|
52
|
+
cause:
|
|
53
|
+
e.cause instanceof Error
|
|
54
|
+
? toSentoriError(e.cause)
|
|
55
|
+
: null,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const platformOf = (): 'android' | 'ios' | 'javascript' => {
|
|
59
|
+
try {
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
61
|
+
const RN = require('react-native') as { Platform?: { OS?: string } };
|
|
62
|
+
const os = RN.Platform?.OS;
|
|
63
|
+
if (os === 'ios') return 'ios';
|
|
64
|
+
if (os === 'android') return 'android';
|
|
65
|
+
} catch {
|
|
66
|
+
// headless / test environment
|
|
67
|
+
}
|
|
68
|
+
return 'javascript';
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
type EmitOptions = {
|
|
72
|
+
name?: string;
|
|
73
|
+
surface?: Surface;
|
|
74
|
+
error?: SentoriError;
|
|
75
|
+
data?: EventData;
|
|
76
|
+
/** Attach the signal-ring snapshot (error/warn: yes; the light
|
|
77
|
+
* kinds ship without it). */
|
|
78
|
+
withSignals?: boolean;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/** Assemble + enqueue one event. The single funnel every verb uses. */
|
|
82
|
+
const emit = (kind: EventKind, opts: EmitOptions): string => {
|
|
83
|
+
const id = uuidV7();
|
|
84
|
+
const config = getConfig();
|
|
85
|
+
if (!config || !config.enabled) return id; // no-op before init — iron rule
|
|
86
|
+
|
|
87
|
+
const payload: WirePayload = {};
|
|
88
|
+
if (opts.error) payload.error = opts.error;
|
|
89
|
+
const data = serializeData(opts.data);
|
|
90
|
+
if (data) payload.data = data;
|
|
91
|
+
const ctx = currentContext();
|
|
92
|
+
if (ctx) payload.context = ctx;
|
|
93
|
+
if (opts.withSignals) {
|
|
94
|
+
const signals = snapshotSignals();
|
|
95
|
+
if (signals.length > 0) payload.signals = signals;
|
|
96
|
+
}
|
|
97
|
+
const device = collectDevice();
|
|
98
|
+
if (device) payload.device = device;
|
|
99
|
+
|
|
100
|
+
let event: WireEvent = {
|
|
101
|
+
id,
|
|
102
|
+
kind,
|
|
103
|
+
occurredAt: new Date().toISOString(),
|
|
104
|
+
platform: platformOf(),
|
|
105
|
+
release: config.release,
|
|
106
|
+
environment: config.environment,
|
|
107
|
+
name: opts.name,
|
|
108
|
+
surface: opts.surface,
|
|
109
|
+
userKey: currentUserKey(),
|
|
110
|
+
payload,
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
if (config.beforeSend) {
|
|
114
|
+
try {
|
|
115
|
+
const out = config.beforeSend(event);
|
|
116
|
+
if (out === null) return id; // deliberate drop
|
|
117
|
+
if (out && typeof out === 'object') event = out;
|
|
118
|
+
} catch {
|
|
119
|
+
// Hook broke: the un-mutated event ships. The host's bug must
|
|
120
|
+
// not cost them the crash report.
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
enqueue(event);
|
|
125
|
+
onEventEmitted(event);
|
|
126
|
+
return id;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// ── the verbs ──────────────────────────────────────────────────────
|
|
130
|
+
|
|
131
|
+
export const error = safeFn('error', (err: unknown, data?: EventData): string => {
|
|
132
|
+
const coerced = coerceError(err);
|
|
133
|
+
return emit('error', {
|
|
134
|
+
error: toSentoriError(coerced),
|
|
135
|
+
data,
|
|
136
|
+
withSignals: true,
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
export const warn = safeFn(
|
|
141
|
+
'warn',
|
|
142
|
+
(name: string, data?: EventData): string => {
|
|
143
|
+
// A hand-written warn's surface can ride in data.surface; the
|
|
144
|
+
// detected scenarios pass it explicitly via warnDetected.
|
|
145
|
+
const surface =
|
|
146
|
+
data && typeof data.surface === 'object'
|
|
147
|
+
? (data.surface as Surface)
|
|
148
|
+
: undefined;
|
|
149
|
+
return emit('warn', { name, surface, data, withSignals: true });
|
|
150
|
+
},
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
/** SDK-internal: a detected warn scenario with an explicit surface. */
|
|
154
|
+
export const warnDetected = (
|
|
155
|
+
scenario: string,
|
|
156
|
+
surface: Surface,
|
|
157
|
+
data?: EventData,
|
|
158
|
+
): string =>
|
|
159
|
+
emit('warn', { name: scenario, surface, data, withSignals: true });
|
|
160
|
+
|
|
161
|
+
export const trace = safeFn(
|
|
162
|
+
'trace',
|
|
163
|
+
(name: string, data?: EventData, opts?: TraceOptions): string => {
|
|
164
|
+
// Every trace is context: it lands in the ring regardless.
|
|
165
|
+
pushSignal('trace', { name, ...(data ?? {}) });
|
|
166
|
+
if (opts?.quiet) return uuidV7();
|
|
167
|
+
return emit('trace', { name, data });
|
|
168
|
+
},
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
export const assert = safeFn(
|
|
172
|
+
'assert',
|
|
173
|
+
(name: string, ok: boolean, data?: EventData): string => {
|
|
174
|
+
const config = getConfig();
|
|
175
|
+
if (config) countAssert(name, ok, config.release);
|
|
176
|
+
if (ok) return uuidV7(); // passes aggregate; they are never events
|
|
177
|
+
return emit('assert', { name, data, withSignals: true });
|
|
178
|
+
},
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
export const probe = safeFn('probe', (ref: string, data?: EventData): string => {
|
|
182
|
+
// A tripwire: reaching this call IS the signal. Never throws,
|
|
183
|
+
// never changes control flow (design.md §4).
|
|
184
|
+
return emit('probe', { name: ref, data });
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
// safeFn returns `R | undefined`; the public surface promises a
|
|
188
|
+
// string. An internal failure mints an id that simply never ships —
|
|
189
|
+
// honest enough, and the host never sees a throw.
|
|
190
|
+
export const verbs = {
|
|
191
|
+
error: (err: unknown, data?: EventData): string => error(err, data) ?? uuidV7(),
|
|
192
|
+
warn: (name: string, data?: EventData): string => warn(name, data) ?? uuidV7(),
|
|
193
|
+
trace: (name: string, data?: EventData, opts?: TraceOptions): string =>
|
|
194
|
+
trace(name, data, opts) ?? uuidV7(),
|
|
195
|
+
assert: (name: string, ok: boolean, data?: EventData): string =>
|
|
196
|
+
assert(name, ok, data) ?? uuidV7(),
|
|
197
|
+
probe: (ref: string, data?: EventData): string => probe(ref, data) ?? uuidV7(),
|
|
198
|
+
};
|
package/lib/breadcrumbs.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Breadcrumb, BreadcrumbType } from './types';
|
|
2
|
-
export type AddBreadcrumbInput = {
|
|
3
|
-
data: Record<string, unknown>;
|
|
4
|
-
timestamp?: string;
|
|
5
|
-
type: BreadcrumbType;
|
|
6
|
-
};
|
|
7
|
-
export declare const addBreadcrumb: (input: AddBreadcrumbInput) => void;
|
|
8
|
-
export declare const getBreadcrumbs: () => Breadcrumb[];
|
|
9
|
-
export declare const clearBreadcrumbs: () => void;
|
|
10
|
-
export declare const __resetForTests: () => void;
|
|
11
|
-
/** v0.9.8 — `__DEV__`-gated peek used by `captureException` to log
|
|
12
|
-
* diagnostic counts to Metro. Production builds never see this. */
|
|
13
|
-
export declare const __peekBreadcrumbCount: () => number;
|
|
14
|
-
/** Surface-area helper that the SDK uses internally to drop diagnostic
|
|
15
|
-
* breadcrumbs without leaking the object-form API. Same target buffer
|
|
16
|
-
* as the public `addBreadcrumb`. */
|
|
17
|
-
export declare const addInternalBreadcrumb: (type: BreadcrumbType, data: Record<string, unknown>) => void;
|
|
18
|
-
//# sourceMappingURL=breadcrumbs.d.ts.map
|
package/lib/breadcrumbs.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["../src/breadcrumbs.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAIzD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,cAAc,CAAA;CACrB,CAAA;AAID,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,KAAG,IAQzD,CAAA;AAED,eAAO,MAAM,cAAc,QAAO,UAAU,EAAuB,CAAA;AAEnE,eAAO,MAAM,gBAAgB,QAAO,IAEnC,CAAA;AAED,eAAO,MAAM,eAAe,QAAO,IAA0B,CAAA;AAE7D;oEACoE;AACpE,eAAO,MAAM,qBAAqB,QAAO,MAAkC,CAAA;AAE3E;;qCAEqC;AACrC,eAAO,MAAM,qBAAqB,GAAI,MAAM,cAAc,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,IAG3F,CAAA"}
|
package/lib/breadcrumbs.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// v0.9.8 — RN SDK now owns its own BreadcrumbBuffer instance.
|
|
2
|
-
//
|
|
3
|
-
// Previous behaviour delegated to sentori-core's module-scoped
|
|
4
|
-
// `_global` buffer. That was fine on Node / bun (single module
|
|
5
|
-
// instance), but Metro's CJS/ESM interop on react-native can
|
|
6
|
-
// instantiate `@goliapkg/sentori-core` twice when the host app and
|
|
7
|
-
// the SDK both resolve it — the handler writes to one `_global` and
|
|
8
|
-
// `capture.ts` reads from the other, leaving every event with
|
|
9
|
-
// `breadcrumbs: []` (Insight 2026-05-16 report).
|
|
10
|
-
//
|
|
11
|
-
// Keeping the buffer local to the RN SDK is the smallest fix that
|
|
12
|
-
// guarantees a single instance regardless of how the bundler
|
|
13
|
-
// resolves sentori-core. addBreadcrumb / getBreadcrumbs / clearBreadcrumbs
|
|
14
|
-
// are now self-contained.
|
|
15
|
-
import { BreadcrumbBuffer, logger } from '@goliapkg/sentori-core';
|
|
16
|
-
const _local = new BreadcrumbBuffer();
|
|
17
|
-
export const addBreadcrumb = (input) => {
|
|
18
|
-
_local.push(input.type, input.data);
|
|
19
|
-
if (input.timestamp) {
|
|
20
|
-
// Override the auto-stamped `now()` with the caller's value. Rare
|
|
21
|
-
// path; most callers omit timestamp.
|
|
22
|
-
const last = _local.snapshot().at(-1);
|
|
23
|
-
if (last)
|
|
24
|
-
last.timestamp = input.timestamp;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
export const getBreadcrumbs = () => _local.snapshot();
|
|
28
|
-
export const clearBreadcrumbs = () => {
|
|
29
|
-
_local.clear();
|
|
30
|
-
};
|
|
31
|
-
export const __resetForTests = () => clearBreadcrumbs();
|
|
32
|
-
/** v0.9.8 — `__DEV__`-gated peek used by `captureException` to log
|
|
33
|
-
* diagnostic counts to Metro. Production builds never see this. */
|
|
34
|
-
export const __peekBreadcrumbCount = () => _local.snapshot().length;
|
|
35
|
-
/** Surface-area helper that the SDK uses internally to drop diagnostic
|
|
36
|
-
* breadcrumbs without leaking the object-form API. Same target buffer
|
|
37
|
-
* as the public `addBreadcrumb`. */
|
|
38
|
-
export const addInternalBreadcrumb = (type, data) => {
|
|
39
|
-
_local.push(type, data);
|
|
40
|
-
logger.debug('breadcrumb', type, data);
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=breadcrumbs.js.map
|
package/lib/breadcrumbs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.js","sourceRoot":"","sources":["../src/breadcrumbs.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,+DAA+D;AAC/D,+DAA+D;AAC/D,6DAA6D;AAC7D,mEAAmE;AACnE,oEAAoE;AACpE,8DAA8D;AAC9D,iDAAiD;AACjD,EAAE;AACF,kEAAkE;AAClE,6DAA6D;AAC7D,2EAA2E;AAC3E,0BAA0B;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAYjE,MAAM,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAA;AAErC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAQ,EAAE;IAC/D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;IACnC,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QACpB,kEAAkE;QAClE,qCAAqC;QACrC,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;QACrC,IAAI,IAAI;YAAE,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAA;IAC5C,CAAC;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,GAAiB,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAA;AAEnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAS,EAAE;IACzC,MAAM,CAAC,KAAK,EAAE,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,GAAS,EAAE,CAAC,gBAAgB,EAAE,CAAA;AAE7D;oEACoE;AACpE,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAW,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAA;AAE3E;;qCAEqC;AACrC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAoB,EAAE,IAA6B,EAAQ,EAAE;IACjG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACvB,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACxC,CAAC,CAAA"}
|
package/lib/bundle-info.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type BundleInfo = {
|
|
2
|
-
/** Stable identifier — Expo `updateId` or CodePush `label`. */
|
|
3
|
-
id: string;
|
|
4
|
-
/** When the bundle was published. RFC 3339. */
|
|
5
|
-
deployedAt?: string;
|
|
6
|
-
/** Which OTA system reported it. */
|
|
7
|
-
source: 'codepush' | 'expo';
|
|
8
|
-
};
|
|
9
|
-
export declare function getBundleInfo(): BundleInfo | null;
|
|
10
|
-
/** Test-only — reset cache. */
|
|
11
|
-
export declare function __resetBundleInfoForTests(): void;
|
|
12
|
-
//# sourceMappingURL=bundle-info.d.ts.map
|
package/lib/bundle-info.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-info.d.ts","sourceRoot":"","sources":["../src/bundle-info.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,UAAU,GAAG;IACvB,+DAA+D;IAC/D,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC;CAC7B,CAAC;AAIF,wBAAgB,aAAa,IAAI,UAAU,GAAG,IAAI,CAIjD;AAgED,+BAA+B;AAC/B,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD"}
|
package/lib/bundle-info.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// v0.9.0 #10 — EAS Update / CodePush awareness.
|
|
2
|
-
//
|
|
3
|
-
// At capture time we want to know which JS bundle the user is running:
|
|
4
|
-
// it's almost always an OTA update rather than the binary `release`,
|
|
5
|
-
// and crash spikes correlate to a specific bundle id rather than the
|
|
6
|
-
// app version. We try `expo-updates` first (EAS), then `react-native-
|
|
7
|
-
// code-push`, then nothing. All access is `require()`-shielded so the
|
|
8
|
-
// SDK still works when neither is installed.
|
|
9
|
-
//
|
|
10
|
-
// Cached at module load — bundle id doesn't change mid-session in
|
|
11
|
-
// either Expo or CodePush.
|
|
12
|
-
let _cached;
|
|
13
|
-
export function getBundleInfo() {
|
|
14
|
-
if (_cached !== undefined)
|
|
15
|
-
return _cached;
|
|
16
|
-
_cached = detect();
|
|
17
|
-
return _cached;
|
|
18
|
-
}
|
|
19
|
-
function detect() {
|
|
20
|
-
// Expo Updates first — most modern RN deployments are on EAS Update.
|
|
21
|
-
try {
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
23
|
-
const Updates = require('expo-updates');
|
|
24
|
-
const id = Updates.updateId ?? Updates.manifest?.id;
|
|
25
|
-
if (typeof id === 'string' && id.length > 0) {
|
|
26
|
-
const deployedAt = pickDeployedAt(Updates);
|
|
27
|
-
return { deployedAt, id, source: 'expo' };
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
// expo-updates not installed
|
|
32
|
-
}
|
|
33
|
-
// CodePush fallback.
|
|
34
|
-
try {
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
36
|
-
const cp = require('react-native-code-push');
|
|
37
|
-
// `getCurrentPackage` is async; we don't block init. Schedule a
|
|
38
|
-
// background fetch + populate the cache. First-event-after-init
|
|
39
|
-
// may miss the bundle id; subsequent events will have it.
|
|
40
|
-
if (typeof cp.getCurrentPackage === 'function') {
|
|
41
|
-
void cp
|
|
42
|
-
.getCurrentPackage()
|
|
43
|
-
.then((pkg) => {
|
|
44
|
-
if (pkg && (pkg.label || pkg.packageHash)) {
|
|
45
|
-
_cached = {
|
|
46
|
-
id: pkg.label ?? pkg.packageHash,
|
|
47
|
-
source: 'codepush',
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
.catch(() => {
|
|
52
|
-
// ignore
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
// not installed
|
|
58
|
-
}
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
function pickDeployedAt(u) {
|
|
62
|
-
if (u.commitTime instanceof Date)
|
|
63
|
-
return u.commitTime.toISOString();
|
|
64
|
-
const ts = u.manifest?.createdAt;
|
|
65
|
-
if (typeof ts === 'string')
|
|
66
|
-
return ts;
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
/** Test-only — reset cache. */
|
|
70
|
-
export function __resetBundleInfoForTests() {
|
|
71
|
-
_cached = undefined;
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=bundle-info.js.map
|
package/lib/bundle-info.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-info.js","sourceRoot":"","sources":["../src/bundle-info.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,uEAAuE;AACvE,qEAAqE;AACrE,qEAAqE;AACrE,sEAAsE;AACtE,sEAAsE;AACtE,6CAA6C;AAC7C,EAAE;AACF,kEAAkE;AAClE,2BAA2B;AAW3B,IAAI,OAAsC,CAAC;AAE3C,MAAM,UAAU,aAAa;IAC3B,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IAC1C,OAAO,GAAG,MAAM,EAAE,CAAC;IACnB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,MAAM;IACb,qEAAqE;IACrE,IAAI,CAAC;QACH,iEAAiE;QACjE,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,CAKrC,CAAC;QACF,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;QACpD,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5C,MAAM,UAAU,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;YAC3C,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAC5C,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,6BAA6B;IAC/B,CAAC;IACD,qBAAqB;IACrB,IAAI,CAAC;QACH,iEAAiE;QACjE,MAAM,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAM1C,CAAC;QACF,gEAAgE;QAChE,gEAAgE;QAChE,0DAA0D;QAC1D,IAAI,OAAO,EAAE,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;YAC/C,KAAK,EAAE;iBACJ,iBAAiB,EAAE;iBACnB,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;gBACZ,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;oBAC1C,OAAO,GAAG;wBACR,EAAE,EAAE,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,WAAY;wBACjC,MAAM,EAAE,UAAU;qBACnB,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC;iBACD,KAAK,CAAC,GAAG,EAAE;gBACV,SAAS;YACX,CAAC,CAAC,CAAC;QACP,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,gBAAgB;IAClB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,cAAc,CAAC,CAGvB;IACC,IAAI,CAAC,CAAC,UAAU,YAAY,IAAI;QAAE,OAAO,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;IACpE,MAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,IAAI,OAAO,EAAE,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IACtC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,+BAA+B;AAC/B,MAAM,UAAU,yBAAyB;IACvC,OAAO,GAAG,SAAS,CAAC;AACtB,CAAC"}
|
package/lib/capture.d.ts
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { type BeforeSendHook, type CaptureMessageOptions, type LinkBy } from '@goliapkg/sentori-core';
|
|
2
|
-
import type { Event, Tags, User } from './types';
|
|
3
|
-
export { captureStep, __resetTrailForTests } from './trail';
|
|
4
|
-
/**
|
|
5
|
-
* v2.0 — set a single scope tag merged onto every subsequent
|
|
6
|
-
* capture. Per-call `extras.tags` / `opts.tags` win over scope tags.
|
|
7
|
-
*
|
|
8
|
-
* sentori.setTag('rollout', 'dark-mode-v2');
|
|
9
|
-
* sentori.captureException(err); // event.tags carries rollout
|
|
10
|
-
*/
|
|
11
|
-
export declare const setTag: (key: string, value: string) => void;
|
|
12
|
-
/**
|
|
13
|
-
* v2.0 — bulk variant of setTag. Existing tags are merged with
|
|
14
|
-
* the input record (`Object.assign` style).
|
|
15
|
-
*/
|
|
16
|
-
export declare const setTags: (record: Record<string, string>) => void;
|
|
17
|
-
export declare const __resetScopeForTests: () => void;
|
|
18
|
-
export declare const __resetScreenshotBudgetForTests: () => void;
|
|
19
|
-
/**
|
|
20
|
-
* Attach a stable user identifier to events captured after this call.
|
|
21
|
-
*
|
|
22
|
-
* PII policy (Phase 16 sub-D): the User shape is intentionally limited
|
|
23
|
-
* to `{ id?, anonymous? }` — no email, name, IP, or other identifying
|
|
24
|
-
* fields. Use a hashed / pseudonymous id (e.g. uuid v4 stored in
|
|
25
|
-
* AsyncStorage on first launch). The server schema enforces the same
|
|
26
|
-
* shape, so any extra fields you tack on at the JS layer would be
|
|
27
|
-
* rejected with `validationFailed` and never persisted.
|
|
28
|
-
*
|
|
29
|
-
* Pass `null` to clear (e.g. on sign-out).
|
|
30
|
-
*/
|
|
31
|
-
/**
|
|
32
|
-
* Public user identity API.
|
|
33
|
-
*
|
|
34
|
-
* sentori.setUser({ id: 'usr_123', name: 'Lihao', linkBy: {
|
|
35
|
-
* email: 'lihao@example.com',
|
|
36
|
-
* googleSub: '108293…',
|
|
37
|
-
* } })
|
|
38
|
-
*
|
|
39
|
-
* The `linkBy` map is for **cross-project lookup** (see v2.3 design,
|
|
40
|
-
* §5 in docs/design/sdk-v2.3-redesign.md). Each value gets hashed
|
|
41
|
-
* client-side via `crypto.subtle.digest('SHA-256', …)` BEFORE
|
|
42
|
-
* leaving the device. Raw email / phone / sub **never** reach
|
|
43
|
-
* Sentori; the server can't recover them.
|
|
44
|
-
*
|
|
45
|
-
* Hashing is async (WebCrypto is async). `setUser` itself returns
|
|
46
|
-
* void synchronously so host code stays one-line; the hash work
|
|
47
|
-
* runs in the background and is committed to scope when ready. If
|
|
48
|
-
* a `captureException` fires BEFORE the hash settles, the event
|
|
49
|
-
* carries `id` + `name` only (no linkHashes that cycle) — the next
|
|
50
|
-
* event picks them up. This is fine in practice because the host
|
|
51
|
-
* sets the user once near startup, well before any captures.
|
|
52
|
-
*
|
|
53
|
-
* If `crypto.subtle` is unavailable in the runtime, the hash
|
|
54
|
-
* promise rejects and `linkBy` is silently dropped (NEVER rule —
|
|
55
|
-
* SDK failure must not propagate to host code).
|
|
56
|
-
*/
|
|
57
|
-
type SetUserInput = (User & {
|
|
58
|
-
linkBy?: LinkBy;
|
|
59
|
-
}) | null;
|
|
60
|
-
export declare const setUser: (input: SetUserInput) => void;
|
|
61
|
-
export declare const getUser: () => User | null;
|
|
62
|
-
/** v1.1 +S7 升级 — read just the current user id for the control
|
|
63
|
-
* channel poll. Returns `undefined` until `setUser({ id })` runs. */
|
|
64
|
-
export declare const getCurrentUserId: () => string | undefined;
|
|
65
|
-
export type CaptureExtras = {
|
|
66
|
-
tags?: Tags;
|
|
67
|
-
user?: User;
|
|
68
|
-
fingerprint?: string[];
|
|
69
|
-
/** Phase 42 sub-D.07: per-call screenshot override. `false` skips
|
|
70
|
-
* screenshot capture even when `init({ capture: { screenshot:
|
|
71
|
-
* true } })` is on — handy for sensitive screens. Defaults to
|
|
72
|
-
* whatever `config.screenshotsEnabled` says. */
|
|
73
|
-
screenshot?: boolean;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* v0.8.2 — submit an end-user-supplied bug report. Use this when the
|
|
77
|
-
* host app surfaces a "Report a problem" form. Pass `eventId` if the
|
|
78
|
-
* user is reporting a specific crash they just saw — the server links
|
|
79
|
-
* the report to that event's issue automatically.
|
|
80
|
-
*
|
|
81
|
-
* Returns `{ id, issueId }` on success or `null` on any failure
|
|
82
|
-
* (network down, ingest token revoked, validation rejected). Doesn't
|
|
83
|
-
* throw.
|
|
84
|
-
*/
|
|
85
|
-
export declare const sendUserFeedback: (input: {
|
|
86
|
-
body: string;
|
|
87
|
-
email?: string;
|
|
88
|
-
eventId?: string;
|
|
89
|
-
name?: string;
|
|
90
|
-
title: string;
|
|
91
|
-
}) => Promise<null | {
|
|
92
|
-
id: string;
|
|
93
|
-
issueId: null | string;
|
|
94
|
-
}>;
|
|
95
|
-
export declare const captureError: (error: Error, extras?: CaptureExtras) => void;
|
|
96
|
-
declare function applyBeforeSend(event: Event, hook: BeforeSendHook | undefined): Event | null;
|
|
97
|
-
/** v0.9.6 #2 — upload the wireframe replay ring as a `replay`
|
|
98
|
-
* attachment. Plain NDJSON (one snapshot per line) — server may
|
|
99
|
-
* gzip on storage; the network upload is base64.
|
|
100
|
-
*
|
|
101
|
-
* rc.4: route through `base64Utf8` so non-Latin-1 text inside any
|
|
102
|
-
* walked TextView (Japanese / Chinese / em-dash etc.) doesn't blow
|
|
103
|
-
* up the Hermes-spec `btoa`. The pre-rc.4 inline `btoa(ndjson)` path
|
|
104
|
-
* threw `InvalidCharacterError` on those code points, the
|
|
105
|
-
* surrounding catch swallowed it silently, and the replay
|
|
106
|
-
* attachment never landed. Insight 2026-05-18 verify caught it
|
|
107
|
-
* after rc.3's walker fix surfaced deep TextView content. Dev
|
|
108
|
-
* logs replace the silent catch so the next failure shape is
|
|
109
|
-
* visible. */
|
|
110
|
-
declare function captureAndAttachReplay(event: Event, ndjson: string): Promise<void>;
|
|
111
|
-
export declare const captureException: (error: Error, extras?: CaptureExtras) => void;
|
|
112
|
-
/**
|
|
113
|
-
* Manually report an issue without an Error instance.
|
|
114
|
-
*
|
|
115
|
-
* Routes to the dashboard Issues module — distinct from `track`
|
|
116
|
-
* (analytics) and `recordMetric` (numeric). Use for "operator should
|
|
117
|
-
* look at this" signals: a fallback that fired, an unexpected state,
|
|
118
|
-
* a feature flag rollout that crossed a threshold.
|
|
119
|
-
*
|
|
120
|
-
* sentori.captureMessage('Payment provider returned 500, used fallback')
|
|
121
|
-
* sentori.captureMessage('Detected impossible state in session reducer', {
|
|
122
|
-
* level: 'error',
|
|
123
|
-
* tags: { reducer: 'session' },
|
|
124
|
-
* })
|
|
125
|
-
*
|
|
126
|
-
* Wrapped in `safeFn` per the NEVER rule — any internal failure is
|
|
127
|
-
* swallowed and (optionally) self-reported; the host app never sees
|
|
128
|
-
* a thrown error.
|
|
129
|
-
*/
|
|
130
|
-
export declare const captureMessage: (message: string, opts?: CaptureMessageOptions | undefined) => void | undefined;
|
|
131
|
-
/** rc.4 — test hook. The real replay attach path is internal so we
|
|
132
|
-
* don't bloat the public surface, but the encoding bug Insight hit
|
|
133
|
-
* on 2026-05-18 needs a behaviour-level test that exercises the
|
|
134
|
-
* same code path captureException runs in production. */
|
|
135
|
-
export declare const __captureAndAttachReplayForTests: typeof captureAndAttachReplay;
|
|
136
|
-
/** v2.3 — test hook for the beforeSend dispatcher. The dispatcher
|
|
137
|
-
* is internal so the unit test reaches it directly without
|
|
138
|
-
* needing to stub the whole transport pipeline. */
|
|
139
|
-
export declare const __applyBeforeSendForTests: typeof applyBeforeSend;
|
|
140
|
-
//# sourceMappingURL=capture.d.ts.map
|
package/lib/capture.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../src/capture.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAE1B,KAAK,MAAM,EAMZ,MAAM,wBAAwB,CAAC;AAuBhC,OAAO,KAAK,EAA+B,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE5F,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAW5D;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,IAEnD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO,GAAI,QAAQ,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAG,IAExD,CAAC;AAQF,eAAO,MAAM,oBAAoB,QAAO,IAGvC,CAAC;AAYF,eAAO,MAAM,+BAA+B,QAAO,IAElD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,KAAK,YAAY,GAAG,CAAC,IAAI,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,IAAI,CAAC;AAExD,eAAO,MAAM,OAAO,GAAI,OAAO,YAAY,KAAG,IA2B7C,CAAC;AAEF,eAAO,MAAM,OAAO,QAAO,IAAI,GAAG,IAAa,CAAC;AAEhD;sEACsE;AACtE,eAAO,MAAM,gBAAgB,QAAO,MAAM,GAAG,SAAmC,CAAC;AAEjF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;qDAGiD;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAAU,OAAO;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,KAAG,OAAO,CAAC,IAAI,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,CAKxD,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,KAAK,EAAE,SAAS,aAAa,KAAG,IA2GnE,CAAC;AAUF,iBAAS,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,GAAG,SAAS,GAAG,KAAK,GAAG,IAAI,CAwBrF;AAED;;;;;;;;;;;;eAYe;AACf,iBAAe,sBAAsB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBjF;AAwDD,eAAO,MAAM,gBAAgB,UA7OO,KAAK,WAAW,aAAa,KAAG,IA6OxB,CAAC;AAI7C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc,iFAuC1B,CAAC;AAEF;;;0DAG0D;AAC1D,eAAO,MAAM,gCAAgC,+BAAyB,CAAC;AAEvE;;oDAEoD;AACpD,eAAO,MAAM,yBAAyB,wBAAkB,CAAC"}
|