@sentry/replay 0.2.0-8 → 0.4.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.
Files changed (82) hide show
  1. package/README.md +2 -3
  2. package/dist/{jest.config.d.ts → config/dist/jest.config.d.ts} +0 -0
  3. package/dist/config/dist/jest.setup.d.ts +10 -0
  4. package/dist/config/dist/src/api/captureReplay.d.ts +2 -0
  5. package/dist/config/dist/src/api/captureReplayUpdate.d.ts +2 -0
  6. package/dist/config/dist/src/coreHandlers/handleDom.d.ts +1 -0
  7. package/dist/config/dist/src/coreHandlers/handleFetch.d.ts +2 -0
  8. package/dist/{src/session/createSession.test.d.ts → config/dist/src/coreHandlers/handleFetch.test.d.ts} +0 -0
  9. package/dist/{src/session/fetchSession.test.d.ts → config/dist/src/coreHandlers/handleScope-unit.test.d.ts} +0 -0
  10. package/dist/config/dist/src/coreHandlers/handleScope.d.ts +2 -0
  11. package/dist/{src/session/getSession.test.d.ts → config/dist/src/coreHandlers/handleScope.test.d.ts} +0 -0
  12. package/dist/config/dist/src/coreHandlers/handleXhr.d.ts +2 -0
  13. package/dist/config/dist/src/coreHandlers/index.d.ts +4 -0
  14. package/dist/{src → config/dist/src}/createPerformanceEntry.d.ts +20 -1
  15. package/dist/{src/session/saveSession.test.d.ts → config/dist/src/createPerformanceEntry.test.d.ts} +0 -0
  16. package/dist/config/dist/src/eventBuffer.d.ts +31 -0
  17. package/dist/{src/session/updateSessionActivity.test.d.ts → config/dist/src/eventBuffer.test.d.ts} +0 -0
  18. package/dist/{src → config/dist/src}/flags.d.ts +0 -0
  19. package/dist/{src/util/isExpired.test.d.ts → config/dist/src/index-captureOnlyOnError.test.d.ts} +0 -0
  20. package/dist/{src/util/isSessionExpired.test.d.ts → config/dist/src/index-noSticky.test.d.ts} +0 -0
  21. package/dist/config/dist/src/index.d.ts +151 -0
  22. package/dist/{tests/index.spec.d.ts → config/dist/src/index.test.d.ts} +0 -0
  23. package/dist/config/dist/src/session/Session.d.ts +46 -0
  24. package/dist/config/dist/src/session/Session.test.d.ts +1 -0
  25. package/dist/config/dist/src/session/constants.d.ts +5 -0
  26. package/dist/{src → config/dist/src}/session/createSession.d.ts +2 -2
  27. package/dist/config/dist/src/session/createSession.test.d.ts +1 -0
  28. package/dist/config/dist/src/session/fetchSession.d.ts +5 -0
  29. package/dist/config/dist/src/session/fetchSession.test.d.ts +1 -0
  30. package/dist/{src → config/dist/src}/session/getSession.d.ts +9 -1
  31. package/dist/config/dist/src/session/getSession.test.d.ts +1 -0
  32. package/dist/{src → config/dist/src}/session/index.d.ts +0 -1
  33. package/dist/config/dist/src/session/saveSession.d.ts +2 -0
  34. package/dist/config/dist/src/session/saveSession.test.d.ts +1 -0
  35. package/dist/config/dist/src/types.d.ts +57 -0
  36. package/dist/config/dist/src/util/createBreadcrumb.d.ts +4 -0
  37. package/dist/config/dist/src/util/createPayload.d.ts +5 -0
  38. package/dist/{src → config/dist/src}/util/isExpired.d.ts +0 -0
  39. package/dist/config/dist/src/util/isExpired.test.d.ts +1 -0
  40. package/dist/config/dist/src/util/isIngestHost.d.ts +4 -0
  41. package/dist/config/dist/src/util/isSessionExpired.d.ts +5 -0
  42. package/dist/config/dist/src/util/isSessionExpired.test.d.ts +1 -0
  43. package/dist/config/dist/src/util/logger.d.ts +12 -0
  44. package/dist/config/dist/test/index.d.ts +3 -0
  45. package/dist/config/dist/test/mocks/mockRrweb.d.ts +15 -0
  46. package/dist/config/dist/test/mocks/mockSdk.d.ts +11 -0
  47. package/dist/dist/api/captureReplay.d.ts +2 -0
  48. package/dist/dist/coreHandlers/handleDom.d.ts +1 -0
  49. package/dist/dist/coreHandlers/handleFetch.d.ts +2 -0
  50. package/dist/dist/coreHandlers/handleScope.d.ts +2 -0
  51. package/dist/dist/coreHandlers/handleXhr.d.ts +2 -0
  52. package/dist/dist/coreHandlers/index.d.ts +4 -0
  53. package/dist/dist/createPerformanceEntry.d.ts +42 -0
  54. package/dist/dist/eventBuffer.d.ts +31 -0
  55. package/dist/dist/flags.d.ts +2 -0
  56. package/dist/dist/index.d.ts +151 -0
  57. package/dist/dist/session/Session.d.ts +46 -0
  58. package/dist/dist/session/constants.d.ts +5 -0
  59. package/dist/dist/session/createSession.d.ts +14 -0
  60. package/dist/dist/session/fetchSession.d.ts +5 -0
  61. package/dist/dist/session/getSession.d.ts +23 -0
  62. package/dist/dist/session/index.d.ts +1 -0
  63. package/dist/dist/session/saveSession.d.ts +2 -0
  64. package/dist/dist/types.d.ts +57 -0
  65. package/dist/dist/util/createBreadcrumb.d.ts +4 -0
  66. package/dist/dist/util/isExpired.d.ts +5 -0
  67. package/dist/dist/util/isIngestHost.d.ts +4 -0
  68. package/dist/dist/util/isSessionExpired.d.ts +5 -0
  69. package/dist/dist/util/logger.d.ts +12 -0
  70. package/dist/index.es.js +651 -217
  71. package/dist/index.js +650 -236
  72. package/dist/index.js.map +1 -1
  73. package/package.json +25 -20
  74. package/dist/rollup.config.d.ts +0 -3
  75. package/dist/src/index.d.ts +0 -120
  76. package/dist/src/session/constants.d.ts +0 -1
  77. package/dist/src/session/fetchSession.d.ts +0 -2
  78. package/dist/src/session/saveSession.d.ts +0 -2
  79. package/dist/src/session/types.d.ts +0 -7
  80. package/dist/src/session/updateSessionActivity.d.ts +0 -3
  81. package/dist/src/util/isSessionExpired.d.ts +0 -5
  82. package/dist/src/util/logger.d.ts +0 -6
@@ -1,120 +0,0 @@
1
- import { Transaction } from '@sentry/types';
2
- import { record } from 'rrweb';
3
- import type { eventWithTime } from 'rrweb/typings/types';
4
- import { ReplayPerformanceEntry } from './createPerformanceEntry';
5
- declare type RRWebEvent = eventWithTime;
6
- declare type RRWebOptions = Parameters<typeof record>[0];
7
- interface PluginOptions {
8
- /**
9
- * The amount of time to wait before sending a replay
10
- */
11
- uploadMinDelay?: number;
12
- /**
13
- * The max amount of time to wait before sending a replay
14
- */
15
- uploadMaxDelay?: number;
16
- /**
17
- * If false, will create a new session per pageload
18
- */
19
- stickySession?: boolean;
20
- }
21
- interface SentryReplayConfiguration extends PluginOptions {
22
- /**
23
- * Options for `rrweb.record`
24
- */
25
- rrwebConfig?: RRWebOptions;
26
- }
27
- export declare class SentryReplay {
28
- /**
29
- * @inheritDoc
30
- */
31
- static id: string;
32
- /**
33
- * @inheritDoc
34
- */
35
- name: string;
36
- /**
37
- * Buffer of rrweb events that will be serialized as JSON and saved as an attachment to a Sentry event
38
- */
39
- events: RRWebEvent[];
40
- performanceEvents: PerformanceEntry[];
41
- /**
42
- * A Sentry Transaction that should capture every incremental rrweb update,
43
- * but *not* the attachments themselves. This is currently used to capture
44
- * breadcrumbs and maybe other spans (e.g. network requests)
45
- */
46
- private replayEvent;
47
- /**
48
- * Options to pass to `rrweb.record()`
49
- */
50
- private readonly rrwebRecordOptions;
51
- private readonly options;
52
- /**
53
- * setTimeout id used for debouncing sending rrweb attachments
54
- */
55
- private timeout;
56
- /**
57
- * The timestamp of the first event since the last flush.
58
- * This is used to determine if the maximum allowed time has passed before we should flush events again.
59
- */
60
- private initialEventTimestampSinceFlush;
61
- private performanceObserver;
62
- private session;
63
- private static attachmentUrlFromDsn;
64
- /**
65
- * Get integration's instance on the current hub
66
- */
67
- private get instance();
68
- constructor({ uploadMinDelay, uploadMaxDelay, stickySession, // TBD: Making this opt-in for now
69
- rrwebConfig: { maskAllInputs, ...rrwebRecordOptions }, }?: SentryReplayConfiguration);
70
- setupOnce(): void;
71
- /**
72
- * Loads a session from storage, or creates a new one
73
- */
74
- loadSession({ expiry }: {
75
- expiry: number;
76
- }): void;
77
- addListeners(): void;
78
- /**
79
- * Keep a list of performance entries that will be sent with a replay
80
- */
81
- handlePerformanceObserver: (list: PerformanceObserverEntryList) => void;
82
- /**
83
- * Handle when visibility of the page changes. (e.g. new tab is opened)
84
- */
85
- handleVisibilityChange: () => void;
86
- /**
87
- * Trigger rrweb to take a full snapshot which will cause this plugin to
88
- * create a new Replay event.
89
- */
90
- triggerFullSnapshot(): void;
91
- /**
92
- * This is our pseudo replay event disguised as a transaction. It will be
93
- * used to store performance entries and breadcrumbs for every incremental
94
- * replay event.
95
- **/
96
- createReplayEvent(): Transaction;
97
- /**
98
- * Create a span for each performance entry. The parent transaction is `this.replayEvent`.
99
- */
100
- createPerformanceSpans(entries: ReplayPerformanceEntry[]): void;
101
- /**
102
- * Observed performance events are added to `this.performanceEvents`. These
103
- * are included in the replay event before it is finished and sent to Sentry.
104
- */
105
- addPerformanceEntries(): void;
106
- finishReplayEvent(): void;
107
- /**
108
- * Determine if there is browser support for `navigator.sendBeacon`
109
- */
110
- hasSendBeacon(): boolean;
111
- /**
112
- * Send replay attachment using either `sendBeacon()` or `fetch()`
113
- */
114
- sendReplayRequest(endpoint: string, events: RRWebEvent[]): Promise<void>;
115
- /**
116
- * Finalize and send the current replay event to Sentry
117
- */
118
- sendReplay(eventId: string): Promise<boolean>;
119
- }
120
- export {};
@@ -1 +0,0 @@
1
- export declare const REPLAY_SESSION_KEY = "sentryReplaySession";
@@ -1,2 +0,0 @@
1
- import { ReplaySession } from './types';
2
- export declare function fetchSession(): ReplaySession | null;
@@ -1,2 +0,0 @@
1
- import { ReplaySession } from './types';
2
- export declare function saveSession(session: ReplaySession): void;
@@ -1,7 +0,0 @@
1
- export interface ReplaySession {
2
- id: string;
3
- traceId: string;
4
- spanId: string;
5
- started: number;
6
- lastActivity: number;
7
- }
@@ -1,3 +0,0 @@
1
- export declare function updateSessionActivity({ stickySession, }: {
2
- stickySession: boolean;
3
- }): import("./types").ReplaySession;
@@ -1,5 +0,0 @@
1
- import { ReplaySession } from '@/session';
2
- /**
3
- * Checks to see if session is expired
4
- */
5
- export declare function isSessionExpired(session: ReplaySession, expiry: number, targetTime?: number): boolean;
@@ -1,6 +0,0 @@
1
- declare const logger: {
2
- error: (...args: any[]) => any;
3
- warn: (...args: any[]) => any;
4
- log: (...args: any[]) => any;
5
- };
6
- export { logger };