@sentry/replay 0.6.14-3 → 0.6.14-5
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 +11 -198
- package/dist/index.es.js +100 -59
- package/dist/index.js +100 -59
- package/dist/index.js.map +1 -1
- package/dist/types/src/index.d.ts +6 -14
- package/dist/types/src/types.d.ts +25 -11
- package/package.json +4 -10
- package/dist/config/types/jest.config.d.ts +0 -3
- package/dist/config/types/jest.setup.d.ts +0 -32
- package/dist/config/types/src/blockAllMedia.test.d.ts +0 -1
- package/dist/config/types/src/coreHandlers/getBreadcrumbHandler.d.ts +0 -3
- package/dist/config/types/src/coreHandlers/getSpanHandler.d.ts +0 -5
- package/dist/config/types/src/coreHandlers/handleDom.d.ts +0 -1
- package/dist/config/types/src/coreHandlers/handleFetch.d.ts +0 -19
- package/dist/config/types/src/coreHandlers/handleFetch.test.d.ts +0 -1
- package/dist/config/types/src/coreHandlers/handleHistory.d.ts +0 -7
- package/dist/config/types/src/coreHandlers/handleScope-unit.test.d.ts +0 -1
- package/dist/config/types/src/coreHandlers/handleScope.d.ts +0 -2
- package/dist/config/types/src/coreHandlers/handleScope.test.d.ts +0 -1
- package/dist/config/types/src/coreHandlers/handleXhr.d.ts +0 -21
- package/dist/config/types/src/createPerformanceEntry.d.ts +0 -43
- package/dist/config/types/src/createPerformanceEntry.test.d.ts +0 -1
- package/dist/config/types/src/eventBuffer.d.ts +0 -45
- package/dist/config/types/src/eventBuffer.test.d.ts +0 -1
- package/dist/config/types/src/flags.d.ts +0 -2
- package/dist/config/types/src/flush.test.d.ts +0 -1
- package/dist/config/types/src/index-errorSampleRate.test.d.ts +0 -1
- package/dist/config/types/src/index-noSticky.test.d.ts +0 -1
- package/dist/config/types/src/index-sampling.test.d.ts +0 -1
- package/dist/config/types/src/index.d.ts +0 -291
- package/dist/config/types/src/index.test.d.ts +0 -1
- package/dist/config/types/src/multiple-instances.test.d.ts +0 -1
- package/dist/config/types/src/session/Session.d.ts +0 -63
- package/dist/config/types/src/session/Session.test.d.ts +0 -1
- package/dist/config/types/src/session/constants.d.ts +0 -11
- package/dist/config/types/src/session/createSession.d.ts +0 -8
- package/dist/config/types/src/session/createSession.test.d.ts +0 -1
- package/dist/config/types/src/session/deleteSession.d.ts +0 -4
- package/dist/config/types/src/session/deleteSession.test.d.ts +0 -1
- package/dist/config/types/src/session/fetchSession.d.ts +0 -6
- package/dist/config/types/src/session/fetchSession.test.d.ts +0 -1
- package/dist/config/types/src/session/getSession.d.ts +0 -20
- package/dist/config/types/src/session/getSession.test.d.ts +0 -1
- package/dist/config/types/src/session/index.d.ts +0 -1
- package/dist/config/types/src/session/saveSession.d.ts +0 -2
- package/dist/config/types/src/session/saveSession.test.d.ts +0 -1
- package/dist/config/types/src/stop.test.d.ts +0 -1
- package/dist/config/types/src/types.d.ts +0 -130
- package/dist/config/types/src/util/addInternalBreadcrumb.d.ts +0 -5
- package/dist/config/types/src/util/captureInternalException.d.ts +0 -4
- package/dist/config/types/src/util/createBreadcrumb.d.ts +0 -4
- package/dist/config/types/src/util/createPayload.d.ts +0 -5
- package/dist/config/types/src/util/dedupePerformanceEntries.d.ts +0 -10
- package/dist/config/types/src/util/dedupePerformanceEntries.test.d.ts +0 -1
- package/dist/config/types/src/util/isExpired.d.ts +0 -5
- package/dist/config/types/src/util/isExpired.test.d.ts +0 -1
- package/dist/config/types/src/util/isIngestHost.d.ts +0 -4
- package/dist/config/types/src/util/isInternal.d.ts +0 -5
- package/dist/config/types/src/util/isSampled.d.ts +0 -7
- package/dist/config/types/src/util/isSampled.test.d.ts +0 -1
- package/dist/config/types/src/util/isSessionExpired.d.ts +0 -5
- package/dist/config/types/src/util/isSessionExpired.test.d.ts +0 -1
- package/dist/config/types/src/util/logger.d.ts +0 -12
- package/dist/config/types/test/fixtures/performanceEntry/lcp.d.ts +0 -1
- package/dist/config/types/test/fixtures/performanceEntry/navigation.d.ts +0 -1
- package/dist/config/types/test/fixtures/performanceEntry/resource.d.ts +0 -1
- package/dist/config/types/test/index.d.ts +0 -3
- package/dist/config/types/test/mocks/mockRrweb.d.ts +0 -15
- package/dist/config/types/test/mocks/mockSdk.d.ts +0 -10
package/LICENSE
CHANGED
|
@@ -1,201 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
1
|
+
Copyright (c) 2022 Sentry (https://sentry.io) and individual contributors. All rights reserved.
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
4
|
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
5
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
6
|
+
persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
9
|
+
Software.
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright [yyyy] [name of copyright owner]
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
12
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
13
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
14
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/dist/index.es.js
CHANGED
|
@@ -980,6 +980,8 @@ var Replay = /** @class */ (function () {
|
|
|
980
980
|
traceIds: new Set(),
|
|
981
981
|
urls: [],
|
|
982
982
|
earliestEvent: null,
|
|
983
|
+
initialTimestamp: new Date().getTime(),
|
|
984
|
+
initialUrl: '',
|
|
983
985
|
};
|
|
984
986
|
/**
|
|
985
987
|
* Core Sentry SDK global event handler. Attaches `replayId` to all [non-replay]
|
|
@@ -1380,7 +1382,13 @@ var Replay = /** @class */ (function () {
|
|
|
1380
1382
|
* Note that this will cause a new DOM checkout
|
|
1381
1383
|
*/
|
|
1382
1384
|
Replay.prototype.startRecording = function () {
|
|
1383
|
-
|
|
1385
|
+
try {
|
|
1386
|
+
this.stopRecording = record(__assign(__assign({}, this.recordingOptions), { emit: this.handleRecordingEmit }));
|
|
1387
|
+
}
|
|
1388
|
+
catch (err) {
|
|
1389
|
+
logger.error(err);
|
|
1390
|
+
captureInternalException(err);
|
|
1391
|
+
}
|
|
1384
1392
|
};
|
|
1385
1393
|
/**
|
|
1386
1394
|
* Currently, this needs to be manually called (e.g. for tests). Sentry SDK
|
|
@@ -1391,22 +1399,35 @@ var Replay = /** @class */ (function () {
|
|
|
1391
1399
|
if (!isBrowser) {
|
|
1392
1400
|
return;
|
|
1393
1401
|
}
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1402
|
+
try {
|
|
1403
|
+
logger.log('Stopping Replays');
|
|
1404
|
+
this.isEnabled = false;
|
|
1405
|
+
this.removeListeners();
|
|
1406
|
+
(_a = this.stopRecording) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
1407
|
+
(_b = this.eventBuffer) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
1408
|
+
this.eventBuffer = null;
|
|
1409
|
+
}
|
|
1410
|
+
catch (err) {
|
|
1411
|
+
logger.error(err);
|
|
1412
|
+
captureInternalException(err);
|
|
1413
|
+
}
|
|
1400
1414
|
};
|
|
1401
1415
|
/**
|
|
1402
1416
|
* Pause some replay functionality. See comments for `isPaused`.
|
|
1403
1417
|
* This differs from stop as this only stops DOM recording, it is
|
|
1404
|
-
* not as thorough of a shutdown as `stop()`.
|
|
1418
|
+
* not as thorough of a shutdown as `stop()`.
|
|
1419
|
+
*/
|
|
1405
1420
|
Replay.prototype.pause = function () {
|
|
1406
1421
|
this.isPaused = true;
|
|
1407
|
-
|
|
1408
|
-
this.stopRecording
|
|
1409
|
-
|
|
1422
|
+
try {
|
|
1423
|
+
if (this.stopRecording) {
|
|
1424
|
+
this.stopRecording();
|
|
1425
|
+
this.stopRecording = undefined;
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
catch (err) {
|
|
1429
|
+
logger.error(err);
|
|
1430
|
+
captureInternalException(err);
|
|
1410
1431
|
}
|
|
1411
1432
|
};
|
|
1412
1433
|
/**
|
|
@@ -1420,8 +1441,14 @@ var Replay = /** @class */ (function () {
|
|
|
1420
1441
|
this.startRecording();
|
|
1421
1442
|
};
|
|
1422
1443
|
Replay.prototype.clearSession = function () {
|
|
1423
|
-
|
|
1424
|
-
|
|
1444
|
+
try {
|
|
1445
|
+
deleteSession();
|
|
1446
|
+
this.session = undefined;
|
|
1447
|
+
}
|
|
1448
|
+
catch (err) {
|
|
1449
|
+
logger.error(err);
|
|
1450
|
+
captureInternalException(err);
|
|
1451
|
+
}
|
|
1425
1452
|
};
|
|
1426
1453
|
/**
|
|
1427
1454
|
* Loads a session from storage, or creates a new one if it does not exist or
|
|
@@ -1458,10 +1485,8 @@ var Replay = /** @class */ (function () {
|
|
|
1458
1485
|
this.performanceEvents = [];
|
|
1459
1486
|
// Reset context as well
|
|
1460
1487
|
this.clearContext();
|
|
1461
|
-
this.
|
|
1462
|
-
|
|
1463
|
-
url: url,
|
|
1464
|
-
};
|
|
1488
|
+
this.context.initialUrl = url;
|
|
1489
|
+
this.context.initialTimestamp = new Date().getTime();
|
|
1465
1490
|
this.context.urls.push(url);
|
|
1466
1491
|
};
|
|
1467
1492
|
/**
|
|
@@ -1469,22 +1494,28 @@ var Replay = /** @class */ (function () {
|
|
|
1469
1494
|
*/
|
|
1470
1495
|
Replay.prototype.addListeners = function () {
|
|
1471
1496
|
var _this = this;
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1497
|
+
try {
|
|
1498
|
+
document.addEventListener('visibilitychange', this.handleVisibilityChange);
|
|
1499
|
+
window.addEventListener('blur', this.handleWindowBlur);
|
|
1500
|
+
window.addEventListener('focus', this.handleWindowFocus);
|
|
1501
|
+
// There is no way to remove these listeners, so ensure they are only added once
|
|
1502
|
+
if (!this.hasInitializedCoreListeners) {
|
|
1503
|
+
// Listeners from core SDK //
|
|
1504
|
+
var scope = getCurrentHub().getScope();
|
|
1505
|
+
scope === null || scope === void 0 ? void 0 : scope.addScopeListener(this.handleCoreBreadcrumbListener('scope'));
|
|
1506
|
+
addInstrumentationHandler('dom', this.handleCoreBreadcrumbListener('dom'));
|
|
1507
|
+
addInstrumentationHandler('fetch', this.handleCoreSpanListener('fetch'));
|
|
1508
|
+
addInstrumentationHandler('xhr', this.handleCoreSpanListener('xhr'));
|
|
1509
|
+
addInstrumentationHandler('history', this.handleCoreSpanListener('history'));
|
|
1510
|
+
// Tag all (non replay) events that get sent to Sentry with the current
|
|
1511
|
+
// replay ID so that we can reference them later in the UI
|
|
1512
|
+
addGlobalEventProcessor(this.handleGlobalEvent);
|
|
1513
|
+
this.hasInitializedCoreListeners = true;
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
catch (err) {
|
|
1517
|
+
logger.error(err);
|
|
1518
|
+
captureInternalException(err);
|
|
1488
1519
|
}
|
|
1489
1520
|
// PerformanceObserver //
|
|
1490
1521
|
if (!('PerformanceObserver' in window)) {
|
|
@@ -1520,12 +1551,18 @@ var Replay = /** @class */ (function () {
|
|
|
1520
1551
|
* Cleans up listeners that were created in `addListeners`
|
|
1521
1552
|
*/
|
|
1522
1553
|
Replay.prototype.removeListeners = function () {
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
this.performanceObserver
|
|
1528
|
-
|
|
1554
|
+
try {
|
|
1555
|
+
document.removeEventListener('visibilitychange', this.handleVisibilityChange);
|
|
1556
|
+
window.removeEventListener('blur', this.handleWindowBlur);
|
|
1557
|
+
window.removeEventListener('focus', this.handleWindowFocus);
|
|
1558
|
+
if (this.performanceObserver) {
|
|
1559
|
+
this.performanceObserver.disconnect();
|
|
1560
|
+
this.performanceObserver = null;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
catch (err) {
|
|
1564
|
+
logger.error(err);
|
|
1565
|
+
captureInternalException(err);
|
|
1529
1566
|
}
|
|
1530
1567
|
};
|
|
1531
1568
|
/**
|
|
@@ -1782,6 +1819,7 @@ var Replay = /** @class */ (function () {
|
|
|
1782
1819
|
* Clear context
|
|
1783
1820
|
*/
|
|
1784
1821
|
Replay.prototype.clearContext = function () {
|
|
1822
|
+
// XXX: `initialTimestamp` and `initialUrl` do not get cleared
|
|
1785
1823
|
this.context.errorIds.clear();
|
|
1786
1824
|
this.context.traceIds.clear();
|
|
1787
1825
|
this.context.urls = [];
|
|
@@ -1791,14 +1829,13 @@ var Replay = /** @class */ (function () {
|
|
|
1791
1829
|
* Return and clear context
|
|
1792
1830
|
*/
|
|
1793
1831
|
Replay.prototype.popEventContext = function () {
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
this.context.earliestEvent
|
|
1797
|
-
this.context.earliestEvent < this.initialState.timestamp) {
|
|
1798
|
-
initialState.timestamp = this.context.earliestEvent;
|
|
1832
|
+
if (this.context.earliestEvent &&
|
|
1833
|
+
this.context.earliestEvent < this.context.initialTimestamp) {
|
|
1834
|
+
this.context.initialTimestamp = this.context.earliestEvent;
|
|
1799
1835
|
}
|
|
1800
1836
|
var context = {
|
|
1801
|
-
|
|
1837
|
+
initialTimestamp: this.context.initialTimestamp,
|
|
1838
|
+
initialUrl: this.context.initialUrl,
|
|
1802
1839
|
errorIds: Array.from(this.context.errorIds).filter(Boolean),
|
|
1803
1840
|
traceIds: Array.from(this.context.traceIds).filter(Boolean),
|
|
1804
1841
|
urls: this.context.urls,
|
|
@@ -1817,7 +1854,7 @@ var Replay = /** @class */ (function () {
|
|
|
1817
1854
|
Replay.prototype.runFlush = function () {
|
|
1818
1855
|
var _a;
|
|
1819
1856
|
return __awaiter(this, void 0, void 0, function () {
|
|
1820
|
-
var recordingData, replayId, segmentId, err_2;
|
|
1857
|
+
var recordingData, replayId, eventContext, segmentId, err_2;
|
|
1821
1858
|
return __generator(this, function (_b) {
|
|
1822
1859
|
switch (_b.label) {
|
|
1823
1860
|
case 0:
|
|
@@ -1843,12 +1880,14 @@ var Replay = /** @class */ (function () {
|
|
|
1843
1880
|
case 4:
|
|
1844
1881
|
recordingData = _b.sent();
|
|
1845
1882
|
replayId = this.session.id;
|
|
1883
|
+
eventContext = this.popEventContext();
|
|
1846
1884
|
segmentId = this.session.segmentId++;
|
|
1847
1885
|
return [4 /*yield*/, this.sendReplay({
|
|
1848
1886
|
replayId: replayId,
|
|
1849
1887
|
events: recordingData,
|
|
1850
1888
|
segmentId: segmentId,
|
|
1851
1889
|
includeReplayStartTimestamp: segmentId === 0,
|
|
1890
|
+
eventContext: eventContext,
|
|
1852
1891
|
})];
|
|
1853
1892
|
case 5:
|
|
1854
1893
|
_b.sent();
|
|
@@ -1879,12 +1918,12 @@ var Replay = /** @class */ (function () {
|
|
|
1879
1918
|
*/
|
|
1880
1919
|
Replay.prototype.sendReplayRequest = function (_a) {
|
|
1881
1920
|
var _b;
|
|
1882
|
-
var events = _a.events, event_id = _a.replayId, segment_id = _a.segmentId, includeReplayStartTimestamp = _a.includeReplayStartTimestamp;
|
|
1921
|
+
var events = _a.events, event_id = _a.replayId, segment_id = _a.segmentId, includeReplayStartTimestamp = _a.includeReplayStartTimestamp, eventContext = _a.eventContext;
|
|
1883
1922
|
return __awaiter(this, void 0, void 0, function () {
|
|
1884
|
-
var payloadWithSequence,
|
|
1923
|
+
var payloadWithSequence, urls, errorIds, traceIds, initialTimestamp, currentTimestamp, sdkInfo, replayEvent, envelope, client;
|
|
1885
1924
|
var _this = this;
|
|
1886
|
-
return __generator(this, function (
|
|
1887
|
-
switch (
|
|
1925
|
+
return __generator(this, function (_c) {
|
|
1926
|
+
switch (_c.label) {
|
|
1888
1927
|
case 0:
|
|
1889
1928
|
payloadWithSequence = createPayload({
|
|
1890
1929
|
events: events,
|
|
@@ -1892,11 +1931,11 @@ var Replay = /** @class */ (function () {
|
|
|
1892
1931
|
segment_id: segment_id,
|
|
1893
1932
|
},
|
|
1894
1933
|
});
|
|
1895
|
-
|
|
1896
|
-
|
|
1934
|
+
urls = eventContext.urls, errorIds = eventContext.errorIds, traceIds = eventContext.traceIds, initialTimestamp = eventContext.initialTimestamp;
|
|
1935
|
+
currentTimestamp = new Date().getTime();
|
|
1897
1936
|
sdkInfo = {
|
|
1898
1937
|
name: 'sentry.javascript.integration.replay',
|
|
1899
|
-
version: "0.6.14-
|
|
1938
|
+
version: "0.6.14-5",
|
|
1900
1939
|
};
|
|
1901
1940
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
1902
1941
|
var _a;
|
|
@@ -1906,8 +1945,8 @@ var Replay = /** @class */ (function () {
|
|
|
1906
1945
|
return __generator(this, function (_b) {
|
|
1907
1946
|
switch (_b.label) {
|
|
1908
1947
|
case 0: return [4 /*yield*/, client._prepareEvent(__assign(__assign({ type: REPLAY_EVENT_NAME }, (includeReplayStartTimestamp
|
|
1909
|
-
? { replay_start_timestamp:
|
|
1910
|
-
: {})), { timestamp:
|
|
1948
|
+
? { replay_start_timestamp: initialTimestamp / 1000 }
|
|
1949
|
+
: {})), { timestamp: currentTimestamp / 1000, error_ids: errorIds, trace_ids: traceIds, urls: urls, replay_id: event_id, segment_id: segment_id }), { event_id: event_id }, scope)];
|
|
1911
1950
|
case 1:
|
|
1912
1951
|
preparedEvent = _b.sent();
|
|
1913
1952
|
session = scope && scope.getSession();
|
|
@@ -1923,7 +1962,7 @@ var Replay = /** @class */ (function () {
|
|
|
1923
1962
|
}); });
|
|
1924
1963
|
})];
|
|
1925
1964
|
case 1:
|
|
1926
|
-
replayEvent =
|
|
1965
|
+
replayEvent = _c.sent();
|
|
1927
1966
|
envelope = createEnvelope({
|
|
1928
1967
|
event_id: event_id,
|
|
1929
1968
|
sent_at: new Date().toISOString(),
|
|
@@ -1945,7 +1984,7 @@ var Replay = /** @class */ (function () {
|
|
|
1945
1984
|
try {
|
|
1946
1985
|
return [2 /*return*/, (_b = client === null || client === void 0 ? void 0 : client.getTransport()) === null || _b === void 0 ? void 0 : _b.send(envelope)];
|
|
1947
1986
|
}
|
|
1948
|
-
catch (
|
|
1987
|
+
catch (_d) {
|
|
1949
1988
|
throw new Error(UNABLE_TO_SEND_REPLAY);
|
|
1950
1989
|
}
|
|
1951
1990
|
return [2 /*return*/];
|
|
@@ -1961,14 +2000,14 @@ var Replay = /** @class */ (function () {
|
|
|
1961
2000
|
* Finalize and send the current replay event to Sentry
|
|
1962
2001
|
*/
|
|
1963
2002
|
Replay.prototype.sendReplay = function (_a) {
|
|
1964
|
-
var replayId = _a.replayId, events = _a.events, segmentId = _a.segmentId, includeReplayStartTimestamp = _a.includeReplayStartTimestamp;
|
|
2003
|
+
var replayId = _a.replayId, events = _a.events, segmentId = _a.segmentId, includeReplayStartTimestamp = _a.includeReplayStartTimestamp, eventContext = _a.eventContext;
|
|
1965
2004
|
return __awaiter(this, void 0, void 0, function () {
|
|
1966
2005
|
var ex_1;
|
|
1967
2006
|
var _this = this;
|
|
1968
2007
|
return __generator(this, function (_b) {
|
|
1969
2008
|
switch (_b.label) {
|
|
1970
2009
|
case 0:
|
|
1971
|
-
// short circuit if there's no events to upload
|
|
2010
|
+
// short circuit if there's no events to upload (this shouldn't happen as runFlush makes this check)
|
|
1972
2011
|
if (!events.length) {
|
|
1973
2012
|
return [2 /*return*/];
|
|
1974
2013
|
}
|
|
@@ -1980,6 +2019,7 @@ var Replay = /** @class */ (function () {
|
|
|
1980
2019
|
replayId: replayId,
|
|
1981
2020
|
segmentId: segmentId,
|
|
1982
2021
|
includeReplayStartTimestamp: includeReplayStartTimestamp,
|
|
2022
|
+
eventContext: eventContext,
|
|
1983
2023
|
})];
|
|
1984
2024
|
case 2:
|
|
1985
2025
|
_b.sent();
|
|
@@ -2013,6 +2053,7 @@ var Replay = /** @class */ (function () {
|
|
|
2013
2053
|
events: events,
|
|
2014
2054
|
segmentId: segmentId,
|
|
2015
2055
|
includeReplayStartTimestamp: includeReplayStartTimestamp,
|
|
2056
|
+
eventContext: eventContext,
|
|
2016
2057
|
})];
|
|
2017
2058
|
case 1:
|
|
2018
2059
|
_a.sent();
|