@pydantic/logfire-session-replay 0.4.0 → 0.6.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.
@@ -1,170 +0,0 @@
1
- //#region src/types.d.ts
2
- interface RrwebEvent {
3
- type: number;
4
- data: unknown;
5
- timestamp: number;
6
- }
7
- declare const EventType: {
8
- readonly DomContentLoaded: 0;
9
- readonly Load: 1;
10
- readonly FullSnapshot: 2;
11
- readonly IncrementalSnapshot: 3;
12
- readonly Meta: 4;
13
- readonly Custom: 5;
14
- readonly Plugin: 6;
15
- };
16
- declare const IncrementalSource: {
17
- readonly Mutation: 0;
18
- readonly MouseMove: 1;
19
- readonly MouseInteraction: 2;
20
- readonly Scroll: 3;
21
- readonly ViewportResize: 4;
22
- readonly Input: 5;
23
- readonly TouchMove: 6;
24
- readonly MediaInteraction: 7;
25
- readonly Drag: 12;
26
- readonly Selection: 14;
27
- };
28
- declare const MouseInteractions: {
29
- readonly MouseUp: 0;
30
- readonly MouseDown: 1;
31
- readonly Click: 2;
32
- readonly ContextMenu: 3;
33
- readonly DblClick: 4;
34
- };
35
- declare const CustomTag: {
36
- readonly Error: "logfire.error";
37
- readonly Console: "logfire.console";
38
- readonly Network: "logfire.network";
39
- readonly Navigation: "logfire.navigation";
40
- };
41
- declare const CHUNK_ENVELOPE_VERSION: 1;
42
- type MaybePromise<T> = T | Promise<T>;
43
- type ConsoleLevel = "log" | "info" | "warn" | "error" | "debug";
44
- type SamplingMode = "full" | "buffer" | "off";
45
- type SessionAttributeValue = string | number | boolean;
46
- type SessionAttributesInput = Record<string, SessionAttributeValue | undefined>;
47
- type SessionAttributes = Record<string, SessionAttributeValue>;
48
- interface ConsolePayload {
49
- level: ConsoleLevel;
50
- args: string[];
51
- source?: string;
52
- }
53
- interface NetworkPayload {
54
- method: string;
55
- url: string;
56
- status: number;
57
- durationMs: number;
58
- failed?: boolean;
59
- reqBytes?: number;
60
- resBytes?: number;
61
- }
62
- interface NavigationPayload {
63
- url: string;
64
- kind: "push" | "replace" | "pop";
65
- }
66
- /** User identity reported by the application. Name and email are optional personal data. */
67
- interface ReplayUser {
68
- id: string;
69
- name?: string;
70
- email?: string;
71
- }
72
- interface ChunkMeta {
73
- seq: number;
74
- firstTimestamp: number;
75
- lastTimestamp: number;
76
- eventCount: number;
77
- clickCount: number;
78
- keypressCount: number;
79
- errorCount: number;
80
- hasFullSnapshot: boolean;
81
- urls: string[];
82
- distinctId?: string;
83
- user?: ReplayUser;
84
- sessionAttributes?: SessionAttributes;
85
- }
86
- interface ChunkEnvelope {
87
- version: typeof CHUNK_ENVELOPE_VERSION;
88
- meta: ChunkMeta;
89
- events: RrwebEvent[];
90
- }
91
- /**
92
- * Early Access session replay recorder configuration. Keep browser replay
93
- * rollout behind an application flag.
94
- */
95
- interface SessionReplayConfig {
96
- /**
97
- * Browser-safe replay upload endpoint, either direct Logfire ingest with a
98
- * restricted frontend application token or an application-owned proxy. The
99
- * SDK posts to `${replayUrl}/${sessionId}?seq=${seq}`.
100
- */
101
- replayUrl: string;
102
- /**
103
- * Headers added to each replay upload. Direct Logfire ingest uses the same
104
- * restricted frontend application headers as traces and metrics.
105
- */
106
- headers?: () => MaybePromise<Record<string, string>>;
107
- /**
108
- * Convenience token source. A non-empty value removes any case-insensitive
109
- * Authorization entry returned by `headers`, then sets
110
- * `Authorization: Bearer ${token}`. Only restricted frontend application
111
- * tokens are safe in browsers.
112
- */
113
- token?: string | (() => MaybePromise<string>);
114
- /**
115
- * Optional external session id source. The browser SDK integration should
116
- * pass its RUM session id here.
117
- */
118
- getSessionId?: () => string | undefined;
119
- /**
120
- * Returns low-cardinality, non-PII dimensions to snapshot once per replay
121
- * session. Invalid or oversized entries are omitted.
122
- */
123
- getSessionAttributes?: () => SessionAttributesInput;
124
- /** Probability of recording each new browser session in full. */
125
- sessionSampleRate?: number;
126
- /** Probability of buffering each otherwise-unsampled session for uncaught error promotion. */
127
- onErrorSampleRate?: number;
128
- /** Mask all rendered DOM text. Defaults to true. */
129
- maskAllText?: boolean;
130
- maskAllInputs?: boolean;
131
- maskTextSelector?: string;
132
- blockSelector?: string;
133
- /** Batching interval while the user is active. Defaults to 5 seconds. */
134
- flushIntervalMs?: number;
135
- maxBufferBytes?: number;
136
- /** Minimum recording duration before a replay is uploaded. Defaults to 10 seconds. */
137
- minSessionDurationMs?: number;
138
- sessionIdleTimeoutMs?: number;
139
- maxSessionDurationMs?: number;
140
- distinctId?: string;
141
- getDistinctId?: () => string | undefined;
142
- /**
143
- * Returns the current user, snapshotted for every chunk as `meta.user`. Only
144
- * a non-empty `id`, `name` and `email` are kept; name and email are optional
145
- * personal data. Without `getDistinctId`, the same snapshot's `id` becomes
146
- * `meta.distinctId`.
147
- */
148
- getUser?: () => ReplayUser | undefined;
149
- captureConsole?: boolean;
150
- captureNetwork?: boolean;
151
- captureNavigation?: boolean;
152
- ignoreUrlPatterns?: RegExp[];
153
- redactUrlPatterns?: RegExp[];
154
- onError?: (error: unknown) => void;
155
- fetchImpl?: typeof fetch;
156
- now?: () => number;
157
- random?: () => number;
158
- }
159
- //#endregion
160
- //#region src/index.d.ts
161
- interface SessionReplay {
162
- readonly recording: boolean;
163
- readonly mode: "full" | "buffer" | "off";
164
- getSessionId(): string;
165
- flush(): Promise<void>;
166
- stop(): Promise<void>;
167
- }
168
- declare function startSessionReplay(config: SessionReplayConfig): SessionReplay;
169
- //#endregion
170
- export { SessionAttributes as _, ChunkMeta as a, EventType as c, NavigationPayload as d, NetworkPayload as f, SessionAttributeValue as g, SamplingMode as h, ChunkEnvelope as i, IncrementalSource as l, RrwebEvent as m, startSessionReplay as n, ConsolePayload as o, ReplayUser as p, CHUNK_ENVELOPE_VERSION as r, CustomTag as s, SessionReplay as t, MouseInteractions as u, SessionAttributesInput as v, SessionReplayConfig as y };
@@ -1,170 +0,0 @@
1
- //#region src/types.d.ts
2
- interface RrwebEvent {
3
- type: number;
4
- data: unknown;
5
- timestamp: number;
6
- }
7
- declare const EventType: {
8
- readonly DomContentLoaded: 0;
9
- readonly Load: 1;
10
- readonly FullSnapshot: 2;
11
- readonly IncrementalSnapshot: 3;
12
- readonly Meta: 4;
13
- readonly Custom: 5;
14
- readonly Plugin: 6;
15
- };
16
- declare const IncrementalSource: {
17
- readonly Mutation: 0;
18
- readonly MouseMove: 1;
19
- readonly MouseInteraction: 2;
20
- readonly Scroll: 3;
21
- readonly ViewportResize: 4;
22
- readonly Input: 5;
23
- readonly TouchMove: 6;
24
- readonly MediaInteraction: 7;
25
- readonly Drag: 12;
26
- readonly Selection: 14;
27
- };
28
- declare const MouseInteractions: {
29
- readonly MouseUp: 0;
30
- readonly MouseDown: 1;
31
- readonly Click: 2;
32
- readonly ContextMenu: 3;
33
- readonly DblClick: 4;
34
- };
35
- declare const CustomTag: {
36
- readonly Error: "logfire.error";
37
- readonly Console: "logfire.console";
38
- readonly Network: "logfire.network";
39
- readonly Navigation: "logfire.navigation";
40
- };
41
- declare const CHUNK_ENVELOPE_VERSION: 1;
42
- type MaybePromise<T> = T | Promise<T>;
43
- type ConsoleLevel = "log" | "info" | "warn" | "error" | "debug";
44
- type SamplingMode = "full" | "buffer" | "off";
45
- type SessionAttributeValue = string | number | boolean;
46
- type SessionAttributesInput = Record<string, SessionAttributeValue | undefined>;
47
- type SessionAttributes = Record<string, SessionAttributeValue>;
48
- interface ConsolePayload {
49
- level: ConsoleLevel;
50
- args: string[];
51
- source?: string;
52
- }
53
- interface NetworkPayload {
54
- method: string;
55
- url: string;
56
- status: number;
57
- durationMs: number;
58
- failed?: boolean;
59
- reqBytes?: number;
60
- resBytes?: number;
61
- }
62
- interface NavigationPayload {
63
- url: string;
64
- kind: "push" | "replace" | "pop";
65
- }
66
- /** User identity reported by the application. Name and email are optional personal data. */
67
- interface ReplayUser {
68
- id: string;
69
- name?: string;
70
- email?: string;
71
- }
72
- interface ChunkMeta {
73
- seq: number;
74
- firstTimestamp: number;
75
- lastTimestamp: number;
76
- eventCount: number;
77
- clickCount: number;
78
- keypressCount: number;
79
- errorCount: number;
80
- hasFullSnapshot: boolean;
81
- urls: string[];
82
- distinctId?: string;
83
- user?: ReplayUser;
84
- sessionAttributes?: SessionAttributes;
85
- }
86
- interface ChunkEnvelope {
87
- version: typeof CHUNK_ENVELOPE_VERSION;
88
- meta: ChunkMeta;
89
- events: RrwebEvent[];
90
- }
91
- /**
92
- * Early Access session replay recorder configuration. Keep browser replay
93
- * rollout behind an application flag.
94
- */
95
- interface SessionReplayConfig {
96
- /**
97
- * Browser-safe replay upload endpoint, either direct Logfire ingest with a
98
- * restricted frontend application token or an application-owned proxy. The
99
- * SDK posts to `${replayUrl}/${sessionId}?seq=${seq}`.
100
- */
101
- replayUrl: string;
102
- /**
103
- * Headers added to each replay upload. Direct Logfire ingest uses the same
104
- * restricted frontend application headers as traces and metrics.
105
- */
106
- headers?: () => MaybePromise<Record<string, string>>;
107
- /**
108
- * Convenience token source. A non-empty value removes any case-insensitive
109
- * Authorization entry returned by `headers`, then sets
110
- * `Authorization: Bearer ${token}`. Only restricted frontend application
111
- * tokens are safe in browsers.
112
- */
113
- token?: string | (() => MaybePromise<string>);
114
- /**
115
- * Optional external session id source. The browser SDK integration should
116
- * pass its RUM session id here.
117
- */
118
- getSessionId?: () => string | undefined;
119
- /**
120
- * Returns low-cardinality, non-PII dimensions to snapshot once per replay
121
- * session. Invalid or oversized entries are omitted.
122
- */
123
- getSessionAttributes?: () => SessionAttributesInput;
124
- /** Probability of recording each new browser session in full. */
125
- sessionSampleRate?: number;
126
- /** Probability of buffering each otherwise-unsampled session for uncaught error promotion. */
127
- onErrorSampleRate?: number;
128
- /** Mask all rendered DOM text. Defaults to true. */
129
- maskAllText?: boolean;
130
- maskAllInputs?: boolean;
131
- maskTextSelector?: string;
132
- blockSelector?: string;
133
- /** Batching interval while the user is active. Defaults to 5 seconds. */
134
- flushIntervalMs?: number;
135
- maxBufferBytes?: number;
136
- /** Minimum recording duration before a replay is uploaded. Defaults to 10 seconds. */
137
- minSessionDurationMs?: number;
138
- sessionIdleTimeoutMs?: number;
139
- maxSessionDurationMs?: number;
140
- distinctId?: string;
141
- getDistinctId?: () => string | undefined;
142
- /**
143
- * Returns the current user, snapshotted for every chunk as `meta.user`. Only
144
- * a non-empty `id`, `name` and `email` are kept; name and email are optional
145
- * personal data. Without `getDistinctId`, the same snapshot's `id` becomes
146
- * `meta.distinctId`.
147
- */
148
- getUser?: () => ReplayUser | undefined;
149
- captureConsole?: boolean;
150
- captureNetwork?: boolean;
151
- captureNavigation?: boolean;
152
- ignoreUrlPatterns?: RegExp[];
153
- redactUrlPatterns?: RegExp[];
154
- onError?: (error: unknown) => void;
155
- fetchImpl?: typeof fetch;
156
- now?: () => number;
157
- random?: () => number;
158
- }
159
- //#endregion
160
- //#region src/index.d.ts
161
- interface SessionReplay {
162
- readonly recording: boolean;
163
- readonly mode: "full" | "buffer" | "off";
164
- getSessionId(): string;
165
- flush(): Promise<void>;
166
- stop(): Promise<void>;
167
- }
168
- declare function startSessionReplay(config: SessionReplayConfig): SessionReplay;
169
- //#endregion
170
- export { SessionAttributes as _, ChunkMeta as a, EventType as c, NavigationPayload as d, NetworkPayload as f, SessionAttributeValue as g, SamplingMode as h, ChunkEnvelope as i, IncrementalSource as l, RrwebEvent as m, startSessionReplay as n, ConsolePayload as o, ReplayUser as p, CHUNK_ENVELOPE_VERSION as r, CustomTag as s, SessionReplay as t, MouseInteractions as u, SessionAttributesInput as v, SessionReplayConfig as y };