@sentry/replay 0.6.14-3 → 0.6.14-4
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 +28 -24
- package/dist/index.js +28 -24
- package/dist/index.js.map +1 -1
- package/dist/types/src/index.d.ts +4 -13
- package/dist/types/src/types.d.ts +25 -11
- package/package.json +3 -3
- 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]
|
|
@@ -1458,10 +1460,8 @@ var Replay = /** @class */ (function () {
|
|
|
1458
1460
|
this.performanceEvents = [];
|
|
1459
1461
|
// Reset context as well
|
|
1460
1462
|
this.clearContext();
|
|
1461
|
-
this.
|
|
1462
|
-
|
|
1463
|
-
url: url,
|
|
1464
|
-
};
|
|
1463
|
+
this.context.initialUrl = url;
|
|
1464
|
+
this.context.initialTimestamp = new Date().getTime();
|
|
1465
1465
|
this.context.urls.push(url);
|
|
1466
1466
|
};
|
|
1467
1467
|
/**
|
|
@@ -1782,6 +1782,7 @@ var Replay = /** @class */ (function () {
|
|
|
1782
1782
|
* Clear context
|
|
1783
1783
|
*/
|
|
1784
1784
|
Replay.prototype.clearContext = function () {
|
|
1785
|
+
// XXX: `initialTimestamp` and `initialUrl` do not get cleared
|
|
1785
1786
|
this.context.errorIds.clear();
|
|
1786
1787
|
this.context.traceIds.clear();
|
|
1787
1788
|
this.context.urls = [];
|
|
@@ -1791,14 +1792,13 @@ var Replay = /** @class */ (function () {
|
|
|
1791
1792
|
* Return and clear context
|
|
1792
1793
|
*/
|
|
1793
1794
|
Replay.prototype.popEventContext = function () {
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
this.context.earliestEvent
|
|
1797
|
-
this.context.earliestEvent < this.initialState.timestamp) {
|
|
1798
|
-
initialState.timestamp = this.context.earliestEvent;
|
|
1795
|
+
if (this.context.earliestEvent &&
|
|
1796
|
+
this.context.earliestEvent < this.context.initialTimestamp) {
|
|
1797
|
+
this.context.initialTimestamp = this.context.earliestEvent;
|
|
1799
1798
|
}
|
|
1800
1799
|
var context = {
|
|
1801
|
-
|
|
1800
|
+
initialTimestamp: this.context.initialTimestamp,
|
|
1801
|
+
initialUrl: this.context.initialUrl,
|
|
1802
1802
|
errorIds: Array.from(this.context.errorIds).filter(Boolean),
|
|
1803
1803
|
traceIds: Array.from(this.context.traceIds).filter(Boolean),
|
|
1804
1804
|
urls: this.context.urls,
|
|
@@ -1817,7 +1817,7 @@ var Replay = /** @class */ (function () {
|
|
|
1817
1817
|
Replay.prototype.runFlush = function () {
|
|
1818
1818
|
var _a;
|
|
1819
1819
|
return __awaiter(this, void 0, void 0, function () {
|
|
1820
|
-
var recordingData, replayId, segmentId, err_2;
|
|
1820
|
+
var recordingData, replayId, eventContext, segmentId, err_2;
|
|
1821
1821
|
return __generator(this, function (_b) {
|
|
1822
1822
|
switch (_b.label) {
|
|
1823
1823
|
case 0:
|
|
@@ -1843,12 +1843,14 @@ var Replay = /** @class */ (function () {
|
|
|
1843
1843
|
case 4:
|
|
1844
1844
|
recordingData = _b.sent();
|
|
1845
1845
|
replayId = this.session.id;
|
|
1846
|
+
eventContext = this.popEventContext();
|
|
1846
1847
|
segmentId = this.session.segmentId++;
|
|
1847
1848
|
return [4 /*yield*/, this.sendReplay({
|
|
1848
1849
|
replayId: replayId,
|
|
1849
1850
|
events: recordingData,
|
|
1850
1851
|
segmentId: segmentId,
|
|
1851
1852
|
includeReplayStartTimestamp: segmentId === 0,
|
|
1853
|
+
eventContext: eventContext,
|
|
1852
1854
|
})];
|
|
1853
1855
|
case 5:
|
|
1854
1856
|
_b.sent();
|
|
@@ -1879,12 +1881,12 @@ var Replay = /** @class */ (function () {
|
|
|
1879
1881
|
*/
|
|
1880
1882
|
Replay.prototype.sendReplayRequest = function (_a) {
|
|
1881
1883
|
var _b;
|
|
1882
|
-
var events = _a.events, event_id = _a.replayId, segment_id = _a.segmentId, includeReplayStartTimestamp = _a.includeReplayStartTimestamp;
|
|
1884
|
+
var events = _a.events, event_id = _a.replayId, segment_id = _a.segmentId, includeReplayStartTimestamp = _a.includeReplayStartTimestamp, eventContext = _a.eventContext;
|
|
1883
1885
|
return __awaiter(this, void 0, void 0, function () {
|
|
1884
|
-
var payloadWithSequence,
|
|
1886
|
+
var payloadWithSequence, urls, errorIds, traceIds, initialTimestamp, currentTimestamp, sdkInfo, replayEvent, envelope, client;
|
|
1885
1887
|
var _this = this;
|
|
1886
|
-
return __generator(this, function (
|
|
1887
|
-
switch (
|
|
1888
|
+
return __generator(this, function (_c) {
|
|
1889
|
+
switch (_c.label) {
|
|
1888
1890
|
case 0:
|
|
1889
1891
|
payloadWithSequence = createPayload({
|
|
1890
1892
|
events: events,
|
|
@@ -1892,11 +1894,11 @@ var Replay = /** @class */ (function () {
|
|
|
1892
1894
|
segment_id: segment_id,
|
|
1893
1895
|
},
|
|
1894
1896
|
});
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
+
urls = eventContext.urls, errorIds = eventContext.errorIds, traceIds = eventContext.traceIds, initialTimestamp = eventContext.initialTimestamp;
|
|
1898
|
+
currentTimestamp = new Date().getTime();
|
|
1897
1899
|
sdkInfo = {
|
|
1898
1900
|
name: 'sentry.javascript.integration.replay',
|
|
1899
|
-
version: "0.6.14-
|
|
1901
|
+
version: "0.6.14-4",
|
|
1900
1902
|
};
|
|
1901
1903
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
1902
1904
|
var _a;
|
|
@@ -1906,8 +1908,8 @@ var Replay = /** @class */ (function () {
|
|
|
1906
1908
|
return __generator(this, function (_b) {
|
|
1907
1909
|
switch (_b.label) {
|
|
1908
1910
|
case 0: return [4 /*yield*/, client._prepareEvent(__assign(__assign({ type: REPLAY_EVENT_NAME }, (includeReplayStartTimestamp
|
|
1909
|
-
? { replay_start_timestamp:
|
|
1910
|
-
: {})), { timestamp:
|
|
1911
|
+
? { replay_start_timestamp: initialTimestamp / 1000 }
|
|
1912
|
+
: {})), { 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
1913
|
case 1:
|
|
1912
1914
|
preparedEvent = _b.sent();
|
|
1913
1915
|
session = scope && scope.getSession();
|
|
@@ -1923,7 +1925,7 @@ var Replay = /** @class */ (function () {
|
|
|
1923
1925
|
}); });
|
|
1924
1926
|
})];
|
|
1925
1927
|
case 1:
|
|
1926
|
-
replayEvent =
|
|
1928
|
+
replayEvent = _c.sent();
|
|
1927
1929
|
envelope = createEnvelope({
|
|
1928
1930
|
event_id: event_id,
|
|
1929
1931
|
sent_at: new Date().toISOString(),
|
|
@@ -1945,7 +1947,7 @@ var Replay = /** @class */ (function () {
|
|
|
1945
1947
|
try {
|
|
1946
1948
|
return [2 /*return*/, (_b = client === null || client === void 0 ? void 0 : client.getTransport()) === null || _b === void 0 ? void 0 : _b.send(envelope)];
|
|
1947
1949
|
}
|
|
1948
|
-
catch (
|
|
1950
|
+
catch (_d) {
|
|
1949
1951
|
throw new Error(UNABLE_TO_SEND_REPLAY);
|
|
1950
1952
|
}
|
|
1951
1953
|
return [2 /*return*/];
|
|
@@ -1961,14 +1963,14 @@ var Replay = /** @class */ (function () {
|
|
|
1961
1963
|
* Finalize and send the current replay event to Sentry
|
|
1962
1964
|
*/
|
|
1963
1965
|
Replay.prototype.sendReplay = function (_a) {
|
|
1964
|
-
var replayId = _a.replayId, events = _a.events, segmentId = _a.segmentId, includeReplayStartTimestamp = _a.includeReplayStartTimestamp;
|
|
1966
|
+
var replayId = _a.replayId, events = _a.events, segmentId = _a.segmentId, includeReplayStartTimestamp = _a.includeReplayStartTimestamp, eventContext = _a.eventContext;
|
|
1965
1967
|
return __awaiter(this, void 0, void 0, function () {
|
|
1966
1968
|
var ex_1;
|
|
1967
1969
|
var _this = this;
|
|
1968
1970
|
return __generator(this, function (_b) {
|
|
1969
1971
|
switch (_b.label) {
|
|
1970
1972
|
case 0:
|
|
1971
|
-
// short circuit if there's no events to upload
|
|
1973
|
+
// short circuit if there's no events to upload (this shouldn't happen as runFlush makes this check)
|
|
1972
1974
|
if (!events.length) {
|
|
1973
1975
|
return [2 /*return*/];
|
|
1974
1976
|
}
|
|
@@ -1980,6 +1982,7 @@ var Replay = /** @class */ (function () {
|
|
|
1980
1982
|
replayId: replayId,
|
|
1981
1983
|
segmentId: segmentId,
|
|
1982
1984
|
includeReplayStartTimestamp: includeReplayStartTimestamp,
|
|
1985
|
+
eventContext: eventContext,
|
|
1983
1986
|
})];
|
|
1984
1987
|
case 2:
|
|
1985
1988
|
_b.sent();
|
|
@@ -2013,6 +2016,7 @@ var Replay = /** @class */ (function () {
|
|
|
2013
2016
|
events: events,
|
|
2014
2017
|
segmentId: segmentId,
|
|
2015
2018
|
includeReplayStartTimestamp: includeReplayStartTimestamp,
|
|
2019
|
+
eventContext: eventContext,
|
|
2016
2020
|
})];
|
|
2017
2021
|
case 1:
|
|
2018
2022
|
_a.sent();
|
package/dist/index.js
CHANGED
|
@@ -988,6 +988,8 @@ var Replay = /** @class */ (function () {
|
|
|
988
988
|
traceIds: new Set(),
|
|
989
989
|
urls: [],
|
|
990
990
|
earliestEvent: null,
|
|
991
|
+
initialTimestamp: new Date().getTime(),
|
|
992
|
+
initialUrl: '',
|
|
991
993
|
};
|
|
992
994
|
/**
|
|
993
995
|
* Core Sentry SDK global event handler. Attaches `replayId` to all [non-replay]
|
|
@@ -1466,10 +1468,8 @@ var Replay = /** @class */ (function () {
|
|
|
1466
1468
|
this.performanceEvents = [];
|
|
1467
1469
|
// Reset context as well
|
|
1468
1470
|
this.clearContext();
|
|
1469
|
-
this.
|
|
1470
|
-
|
|
1471
|
-
url: url,
|
|
1472
|
-
};
|
|
1471
|
+
this.context.initialUrl = url;
|
|
1472
|
+
this.context.initialTimestamp = new Date().getTime();
|
|
1473
1473
|
this.context.urls.push(url);
|
|
1474
1474
|
};
|
|
1475
1475
|
/**
|
|
@@ -1790,6 +1790,7 @@ var Replay = /** @class */ (function () {
|
|
|
1790
1790
|
* Clear context
|
|
1791
1791
|
*/
|
|
1792
1792
|
Replay.prototype.clearContext = function () {
|
|
1793
|
+
// XXX: `initialTimestamp` and `initialUrl` do not get cleared
|
|
1793
1794
|
this.context.errorIds.clear();
|
|
1794
1795
|
this.context.traceIds.clear();
|
|
1795
1796
|
this.context.urls = [];
|
|
@@ -1799,14 +1800,13 @@ var Replay = /** @class */ (function () {
|
|
|
1799
1800
|
* Return and clear context
|
|
1800
1801
|
*/
|
|
1801
1802
|
Replay.prototype.popEventContext = function () {
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
this.context.earliestEvent
|
|
1805
|
-
this.context.earliestEvent < this.initialState.timestamp) {
|
|
1806
|
-
initialState.timestamp = this.context.earliestEvent;
|
|
1803
|
+
if (this.context.earliestEvent &&
|
|
1804
|
+
this.context.earliestEvent < this.context.initialTimestamp) {
|
|
1805
|
+
this.context.initialTimestamp = this.context.earliestEvent;
|
|
1807
1806
|
}
|
|
1808
1807
|
var context = {
|
|
1809
|
-
|
|
1808
|
+
initialTimestamp: this.context.initialTimestamp,
|
|
1809
|
+
initialUrl: this.context.initialUrl,
|
|
1810
1810
|
errorIds: Array.from(this.context.errorIds).filter(Boolean),
|
|
1811
1811
|
traceIds: Array.from(this.context.traceIds).filter(Boolean),
|
|
1812
1812
|
urls: this.context.urls,
|
|
@@ -1825,7 +1825,7 @@ var Replay = /** @class */ (function () {
|
|
|
1825
1825
|
Replay.prototype.runFlush = function () {
|
|
1826
1826
|
var _a;
|
|
1827
1827
|
return __awaiter(this, void 0, void 0, function () {
|
|
1828
|
-
var recordingData, replayId, segmentId, err_2;
|
|
1828
|
+
var recordingData, replayId, eventContext, segmentId, err_2;
|
|
1829
1829
|
return __generator(this, function (_b) {
|
|
1830
1830
|
switch (_b.label) {
|
|
1831
1831
|
case 0:
|
|
@@ -1851,12 +1851,14 @@ var Replay = /** @class */ (function () {
|
|
|
1851
1851
|
case 4:
|
|
1852
1852
|
recordingData = _b.sent();
|
|
1853
1853
|
replayId = this.session.id;
|
|
1854
|
+
eventContext = this.popEventContext();
|
|
1854
1855
|
segmentId = this.session.segmentId++;
|
|
1855
1856
|
return [4 /*yield*/, this.sendReplay({
|
|
1856
1857
|
replayId: replayId,
|
|
1857
1858
|
events: recordingData,
|
|
1858
1859
|
segmentId: segmentId,
|
|
1859
1860
|
includeReplayStartTimestamp: segmentId === 0,
|
|
1861
|
+
eventContext: eventContext,
|
|
1860
1862
|
})];
|
|
1861
1863
|
case 5:
|
|
1862
1864
|
_b.sent();
|
|
@@ -1887,12 +1889,12 @@ var Replay = /** @class */ (function () {
|
|
|
1887
1889
|
*/
|
|
1888
1890
|
Replay.prototype.sendReplayRequest = function (_a) {
|
|
1889
1891
|
var _b;
|
|
1890
|
-
var events = _a.events, event_id = _a.replayId, segment_id = _a.segmentId, includeReplayStartTimestamp = _a.includeReplayStartTimestamp;
|
|
1892
|
+
var events = _a.events, event_id = _a.replayId, segment_id = _a.segmentId, includeReplayStartTimestamp = _a.includeReplayStartTimestamp, eventContext = _a.eventContext;
|
|
1891
1893
|
return __awaiter(this, void 0, void 0, function () {
|
|
1892
|
-
var payloadWithSequence,
|
|
1894
|
+
var payloadWithSequence, urls, errorIds, traceIds, initialTimestamp, currentTimestamp, sdkInfo, replayEvent, envelope, client;
|
|
1893
1895
|
var _this = this;
|
|
1894
|
-
return __generator(this, function (
|
|
1895
|
-
switch (
|
|
1896
|
+
return __generator(this, function (_c) {
|
|
1897
|
+
switch (_c.label) {
|
|
1896
1898
|
case 0:
|
|
1897
1899
|
payloadWithSequence = createPayload({
|
|
1898
1900
|
events: events,
|
|
@@ -1900,11 +1902,11 @@ var Replay = /** @class */ (function () {
|
|
|
1900
1902
|
segment_id: segment_id,
|
|
1901
1903
|
},
|
|
1902
1904
|
});
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
+
urls = eventContext.urls, errorIds = eventContext.errorIds, traceIds = eventContext.traceIds, initialTimestamp = eventContext.initialTimestamp;
|
|
1906
|
+
currentTimestamp = new Date().getTime();
|
|
1905
1907
|
sdkInfo = {
|
|
1906
1908
|
name: 'sentry.javascript.integration.replay',
|
|
1907
|
-
version: "0.6.14-
|
|
1909
|
+
version: "0.6.14-4",
|
|
1908
1910
|
};
|
|
1909
1911
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
1910
1912
|
var _a;
|
|
@@ -1914,8 +1916,8 @@ var Replay = /** @class */ (function () {
|
|
|
1914
1916
|
return __generator(this, function (_b) {
|
|
1915
1917
|
switch (_b.label) {
|
|
1916
1918
|
case 0: return [4 /*yield*/, client._prepareEvent(__assign(__assign({ type: REPLAY_EVENT_NAME }, (includeReplayStartTimestamp
|
|
1917
|
-
? { replay_start_timestamp:
|
|
1918
|
-
: {})), { timestamp:
|
|
1919
|
+
? { replay_start_timestamp: initialTimestamp / 1000 }
|
|
1920
|
+
: {})), { timestamp: currentTimestamp / 1000, error_ids: errorIds, trace_ids: traceIds, urls: urls, replay_id: event_id, segment_id: segment_id }), { event_id: event_id }, scope)];
|
|
1919
1921
|
case 1:
|
|
1920
1922
|
preparedEvent = _b.sent();
|
|
1921
1923
|
session = scope && scope.getSession();
|
|
@@ -1931,7 +1933,7 @@ var Replay = /** @class */ (function () {
|
|
|
1931
1933
|
}); });
|
|
1932
1934
|
})];
|
|
1933
1935
|
case 1:
|
|
1934
|
-
replayEvent =
|
|
1936
|
+
replayEvent = _c.sent();
|
|
1935
1937
|
envelope = utils.createEnvelope({
|
|
1936
1938
|
event_id: event_id,
|
|
1937
1939
|
sent_at: new Date().toISOString(),
|
|
@@ -1953,7 +1955,7 @@ var Replay = /** @class */ (function () {
|
|
|
1953
1955
|
try {
|
|
1954
1956
|
return [2 /*return*/, (_b = client === null || client === void 0 ? void 0 : client.getTransport()) === null || _b === void 0 ? void 0 : _b.send(envelope)];
|
|
1955
1957
|
}
|
|
1956
|
-
catch (
|
|
1958
|
+
catch (_d) {
|
|
1957
1959
|
throw new Error(UNABLE_TO_SEND_REPLAY);
|
|
1958
1960
|
}
|
|
1959
1961
|
return [2 /*return*/];
|
|
@@ -1969,14 +1971,14 @@ var Replay = /** @class */ (function () {
|
|
|
1969
1971
|
* Finalize and send the current replay event to Sentry
|
|
1970
1972
|
*/
|
|
1971
1973
|
Replay.prototype.sendReplay = function (_a) {
|
|
1972
|
-
var replayId = _a.replayId, events = _a.events, segmentId = _a.segmentId, includeReplayStartTimestamp = _a.includeReplayStartTimestamp;
|
|
1974
|
+
var replayId = _a.replayId, events = _a.events, segmentId = _a.segmentId, includeReplayStartTimestamp = _a.includeReplayStartTimestamp, eventContext = _a.eventContext;
|
|
1973
1975
|
return __awaiter(this, void 0, void 0, function () {
|
|
1974
1976
|
var ex_1;
|
|
1975
1977
|
var _this = this;
|
|
1976
1978
|
return __generator(this, function (_b) {
|
|
1977
1979
|
switch (_b.label) {
|
|
1978
1980
|
case 0:
|
|
1979
|
-
// short circuit if there's no events to upload
|
|
1981
|
+
// short circuit if there's no events to upload (this shouldn't happen as runFlush makes this check)
|
|
1980
1982
|
if (!events.length) {
|
|
1981
1983
|
return [2 /*return*/];
|
|
1982
1984
|
}
|
|
@@ -1988,6 +1990,7 @@ var Replay = /** @class */ (function () {
|
|
|
1988
1990
|
replayId: replayId,
|
|
1989
1991
|
segmentId: segmentId,
|
|
1990
1992
|
includeReplayStartTimestamp: includeReplayStartTimestamp,
|
|
1993
|
+
eventContext: eventContext,
|
|
1991
1994
|
})];
|
|
1992
1995
|
case 2:
|
|
1993
1996
|
_b.sent();
|
|
@@ -2021,6 +2024,7 @@ var Replay = /** @class */ (function () {
|
|
|
2021
2024
|
events: events,
|
|
2022
2025
|
segmentId: segmentId,
|
|
2023
2026
|
includeReplayStartTimestamp: includeReplayStartTimestamp,
|
|
2027
|
+
eventContext: eventContext,
|
|
2024
2028
|
})];
|
|
2025
2029
|
case 1:
|
|
2026
2030
|
_a.sent();
|