@sentry/replay 0.6.14-2 → 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/README.md +1 -1
- package/dist/index.es.js +46 -43
- package/dist/index.js +46 -43
- package/dist/index.js.map +1 -1
- package/dist/types/src/index.d.ts +17 -23
- 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 -288
- 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/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Note: Session Replay is currently in beta.
|
|
|
4
4
|
|
|
5
5
|
## Pre-requisites
|
|
6
6
|
|
|
7
|
-
For the sentry-replay integration to work, you must have the [Sentry browser SDK package](https://www.npmjs.com/package/@sentry/browser)
|
|
7
|
+
For the sentry-replay integration to work, you must have the [Sentry browser SDK package](https://www.npmjs.com/package/@sentry/browser), or an equivalent framework SDK (e.g. [@sentry/react](https://www.npmjs.com/package/@sentry/react)) installed. The minimum version required for the SDK is `7.x`.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
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]
|
|
@@ -1149,7 +1151,6 @@ var Replay = /** @class */ (function () {
|
|
|
1149
1151
|
* Handler for Sentry Core SDK events.
|
|
1150
1152
|
*
|
|
1151
1153
|
* These specific events will create span-like objects in the recording.
|
|
1152
|
-
*
|
|
1153
1154
|
*/
|
|
1154
1155
|
this.handleCoreSpanListener = function (type) { return function (handlerData) {
|
|
1155
1156
|
if (!_this.isEnabled) {
|
|
@@ -1163,7 +1164,6 @@ var Replay = /** @class */ (function () {
|
|
|
1163
1164
|
if (type === 'history') {
|
|
1164
1165
|
// Need to collect visited URLs
|
|
1165
1166
|
_this.context.urls.push(result.name);
|
|
1166
|
-
_this.updateUserActivity();
|
|
1167
1167
|
_this.triggerUserActivity();
|
|
1168
1168
|
}
|
|
1169
1169
|
_this.addUpdate(function () {
|
|
@@ -1319,13 +1319,14 @@ var Replay = /** @class */ (function () {
|
|
|
1319
1319
|
_initialized = true;
|
|
1320
1320
|
}
|
|
1321
1321
|
/**
|
|
1322
|
-
*
|
|
1323
|
-
* transaction before some native SDK integrations have run
|
|
1324
|
-
* own global event processor. An example is:
|
|
1322
|
+
* We previously used to create a transaction in `setupOnce` and it would
|
|
1323
|
+
* potentially create a transaction before some native SDK integrations have run
|
|
1324
|
+
* and applied their own global event processor. An example is:
|
|
1325
1325
|
* https://github.com/getsentry/sentry-javascript/blob/b47ceafbdac7f8b99093ce6023726ad4687edc48/packages/browser/src/integrations/useragent.ts
|
|
1326
1326
|
*
|
|
1327
|
-
* So we call `this.setup` in next event loop as a workaround to wait for
|
|
1328
|
-
*
|
|
1327
|
+
* So we call `this.setup` in next event loop as a workaround to wait for other
|
|
1328
|
+
* global event processors to finish. This is no longer needed, but keeping it
|
|
1329
|
+
* here to avoid any future issues.
|
|
1329
1330
|
*/
|
|
1330
1331
|
Replay.prototype.setupOnce = function () {
|
|
1331
1332
|
var _this = this;
|
|
@@ -1338,7 +1339,8 @@ var Replay = /** @class */ (function () {
|
|
|
1338
1339
|
/**
|
|
1339
1340
|
* Initializes the plugin.
|
|
1340
1341
|
*
|
|
1341
|
-
* Creates or loads a session, attaches listeners to varying events (DOM,
|
|
1342
|
+
* Creates or loads a session, attaches listeners to varying events (DOM,
|
|
1343
|
+
* PerformanceObserver, Recording, Sentry SDK, etc)
|
|
1342
1344
|
*/
|
|
1343
1345
|
Replay.prototype.start = function () {
|
|
1344
1346
|
if (!isBrowser) {
|
|
@@ -1383,7 +1385,8 @@ var Replay = /** @class */ (function () {
|
|
|
1383
1385
|
this.stopRecording = record(__assign(__assign({}, this.recordingOptions), { emit: this.handleRecordingEmit }));
|
|
1384
1386
|
};
|
|
1385
1387
|
/**
|
|
1386
|
-
* Currently, this needs to be manually called (e.g. for tests). Sentry SDK
|
|
1388
|
+
* Currently, this needs to be manually called (e.g. for tests). Sentry SDK
|
|
1389
|
+
* does not support a teardown
|
|
1387
1390
|
*/
|
|
1388
1391
|
Replay.prototype.stop = function () {
|
|
1389
1392
|
var _a, _b;
|
|
@@ -1457,10 +1460,8 @@ var Replay = /** @class */ (function () {
|
|
|
1457
1460
|
this.performanceEvents = [];
|
|
1458
1461
|
// Reset context as well
|
|
1459
1462
|
this.clearContext();
|
|
1460
|
-
this.
|
|
1461
|
-
|
|
1462
|
-
url: url,
|
|
1463
|
-
};
|
|
1463
|
+
this.context.initialUrl = url;
|
|
1464
|
+
this.context.initialTimestamp = new Date().getTime();
|
|
1464
1465
|
this.context.urls.push(url);
|
|
1465
1466
|
};
|
|
1466
1467
|
/**
|
|
@@ -1647,8 +1648,9 @@ var Replay = /** @class */ (function () {
|
|
|
1647
1648
|
}
|
|
1648
1649
|
};
|
|
1649
1650
|
/**
|
|
1650
|
-
* Updates the user activity timestamp and resumes recording. This should be
|
|
1651
|
-
*
|
|
1651
|
+
* Updates the user activity timestamp and resumes recording. This should be
|
|
1652
|
+
* called in an event handler for a user action that we consider as the user
|
|
1653
|
+
* being "active" (e.g. a mouse click).
|
|
1652
1654
|
*/
|
|
1653
1655
|
Replay.prototype.triggerUserActivity = function () {
|
|
1654
1656
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1657,7 +1659,8 @@ var Replay = /** @class */ (function () {
|
|
|
1657
1659
|
// This case means that recording was once stopped due to inactivity.
|
|
1658
1660
|
// Ensure that recording is resumed.
|
|
1659
1661
|
if (!this.stopRecording) {
|
|
1660
|
-
// Create a new session, otherwise when the user action is flushed, it
|
|
1662
|
+
// Create a new session, otherwise when the user action is flushed, it
|
|
1663
|
+
// will get rejected due to an expired session.
|
|
1661
1664
|
this.loadSession({ expiry: SESSION_IDLE_DURATION });
|
|
1662
1665
|
// Note: This will cause a new DOM checkout
|
|
1663
1666
|
this.resume();
|
|
@@ -1762,11 +1765,7 @@ var Replay = /** @class */ (function () {
|
|
|
1762
1765
|
if (!expired) {
|
|
1763
1766
|
return true;
|
|
1764
1767
|
}
|
|
1765
|
-
//
|
|
1766
|
-
// and produce a checkout based on a previous checkout + updates, and then
|
|
1767
|
-
// replay the event on top. Or maybe replay the event on top of a refresh
|
|
1768
|
-
// snapshot.
|
|
1769
|
-
// For now create a new snapshot
|
|
1768
|
+
// Session is expired, trigger a full snapshot (which will create a new session)
|
|
1770
1769
|
this.triggerFullSnapshot();
|
|
1771
1770
|
return false;
|
|
1772
1771
|
};
|
|
@@ -1783,6 +1782,7 @@ var Replay = /** @class */ (function () {
|
|
|
1783
1782
|
* Clear context
|
|
1784
1783
|
*/
|
|
1785
1784
|
Replay.prototype.clearContext = function () {
|
|
1785
|
+
// XXX: `initialTimestamp` and `initialUrl` do not get cleared
|
|
1786
1786
|
this.context.errorIds.clear();
|
|
1787
1787
|
this.context.traceIds.clear();
|
|
1788
1788
|
this.context.urls = [];
|
|
@@ -1792,14 +1792,13 @@ var Replay = /** @class */ (function () {
|
|
|
1792
1792
|
* Return and clear context
|
|
1793
1793
|
*/
|
|
1794
1794
|
Replay.prototype.popEventContext = function () {
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
this.context.earliestEvent
|
|
1798
|
-
this.context.earliestEvent < this.initialState.timestamp) {
|
|
1799
|
-
initialState.timestamp = this.context.earliestEvent;
|
|
1795
|
+
if (this.context.earliestEvent &&
|
|
1796
|
+
this.context.earliestEvent < this.context.initialTimestamp) {
|
|
1797
|
+
this.context.initialTimestamp = this.context.earliestEvent;
|
|
1800
1798
|
}
|
|
1801
1799
|
var context = {
|
|
1802
|
-
|
|
1800
|
+
initialTimestamp: this.context.initialTimestamp,
|
|
1801
|
+
initialUrl: this.context.initialUrl,
|
|
1803
1802
|
errorIds: Array.from(this.context.errorIds).filter(Boolean),
|
|
1804
1803
|
traceIds: Array.from(this.context.traceIds).filter(Boolean),
|
|
1805
1804
|
urls: this.context.urls,
|
|
@@ -1818,7 +1817,7 @@ var Replay = /** @class */ (function () {
|
|
|
1818
1817
|
Replay.prototype.runFlush = function () {
|
|
1819
1818
|
var _a;
|
|
1820
1819
|
return __awaiter(this, void 0, void 0, function () {
|
|
1821
|
-
var replayId,
|
|
1820
|
+
var recordingData, replayId, eventContext, segmentId, err_2;
|
|
1822
1821
|
return __generator(this, function (_b) {
|
|
1823
1822
|
switch (_b.label) {
|
|
1824
1823
|
case 0:
|
|
@@ -1837,19 +1836,21 @@ var Replay = /** @class */ (function () {
|
|
|
1837
1836
|
case 2:
|
|
1838
1837
|
// Only attach memory event if eventBuffer is not empty
|
|
1839
1838
|
_b.sent();
|
|
1840
|
-
replayId = this.session.id;
|
|
1841
|
-
segmentId = this.session.segmentId++;
|
|
1842
1839
|
_b.label = 3;
|
|
1843
1840
|
case 3:
|
|
1844
1841
|
_b.trys.push([3, 6, , 7]);
|
|
1845
1842
|
return [4 /*yield*/, this.eventBuffer.finish()];
|
|
1846
1843
|
case 4:
|
|
1847
1844
|
recordingData = _b.sent();
|
|
1845
|
+
replayId = this.session.id;
|
|
1846
|
+
eventContext = this.popEventContext();
|
|
1847
|
+
segmentId = this.session.segmentId++;
|
|
1848
1848
|
return [4 /*yield*/, this.sendReplay({
|
|
1849
1849
|
replayId: replayId,
|
|
1850
1850
|
events: recordingData,
|
|
1851
1851
|
segmentId: segmentId,
|
|
1852
1852
|
includeReplayStartTimestamp: segmentId === 0,
|
|
1853
|
+
eventContext: eventContext,
|
|
1853
1854
|
})];
|
|
1854
1855
|
case 5:
|
|
1855
1856
|
_b.sent();
|
|
@@ -1880,12 +1881,12 @@ var Replay = /** @class */ (function () {
|
|
|
1880
1881
|
*/
|
|
1881
1882
|
Replay.prototype.sendReplayRequest = function (_a) {
|
|
1882
1883
|
var _b;
|
|
1883
|
-
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;
|
|
1884
1885
|
return __awaiter(this, void 0, void 0, function () {
|
|
1885
|
-
var payloadWithSequence,
|
|
1886
|
+
var payloadWithSequence, urls, errorIds, traceIds, initialTimestamp, currentTimestamp, sdkInfo, replayEvent, envelope, client;
|
|
1886
1887
|
var _this = this;
|
|
1887
|
-
return __generator(this, function (
|
|
1888
|
-
switch (
|
|
1888
|
+
return __generator(this, function (_c) {
|
|
1889
|
+
switch (_c.label) {
|
|
1889
1890
|
case 0:
|
|
1890
1891
|
payloadWithSequence = createPayload({
|
|
1891
1892
|
events: events,
|
|
@@ -1893,11 +1894,11 @@ var Replay = /** @class */ (function () {
|
|
|
1893
1894
|
segment_id: segment_id,
|
|
1894
1895
|
},
|
|
1895
1896
|
});
|
|
1896
|
-
|
|
1897
|
-
|
|
1897
|
+
urls = eventContext.urls, errorIds = eventContext.errorIds, traceIds = eventContext.traceIds, initialTimestamp = eventContext.initialTimestamp;
|
|
1898
|
+
currentTimestamp = new Date().getTime();
|
|
1898
1899
|
sdkInfo = {
|
|
1899
1900
|
name: 'sentry.javascript.integration.replay',
|
|
1900
|
-
version: "0.6.14-
|
|
1901
|
+
version: "0.6.14-4",
|
|
1901
1902
|
};
|
|
1902
1903
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
1903
1904
|
var _a;
|
|
@@ -1907,8 +1908,8 @@ var Replay = /** @class */ (function () {
|
|
|
1907
1908
|
return __generator(this, function (_b) {
|
|
1908
1909
|
switch (_b.label) {
|
|
1909
1910
|
case 0: return [4 /*yield*/, client._prepareEvent(__assign(__assign({ type: REPLAY_EVENT_NAME }, (includeReplayStartTimestamp
|
|
1910
|
-
? { replay_start_timestamp:
|
|
1911
|
-
: {})), { 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)];
|
|
1912
1913
|
case 1:
|
|
1913
1914
|
preparedEvent = _b.sent();
|
|
1914
1915
|
session = scope && scope.getSession();
|
|
@@ -1924,7 +1925,7 @@ var Replay = /** @class */ (function () {
|
|
|
1924
1925
|
}); });
|
|
1925
1926
|
})];
|
|
1926
1927
|
case 1:
|
|
1927
|
-
replayEvent =
|
|
1928
|
+
replayEvent = _c.sent();
|
|
1928
1929
|
envelope = createEnvelope({
|
|
1929
1930
|
event_id: event_id,
|
|
1930
1931
|
sent_at: new Date().toISOString(),
|
|
@@ -1946,7 +1947,7 @@ var Replay = /** @class */ (function () {
|
|
|
1946
1947
|
try {
|
|
1947
1948
|
return [2 /*return*/, (_b = client === null || client === void 0 ? void 0 : client.getTransport()) === null || _b === void 0 ? void 0 : _b.send(envelope)];
|
|
1948
1949
|
}
|
|
1949
|
-
catch (
|
|
1950
|
+
catch (_d) {
|
|
1950
1951
|
throw new Error(UNABLE_TO_SEND_REPLAY);
|
|
1951
1952
|
}
|
|
1952
1953
|
return [2 /*return*/];
|
|
@@ -1962,14 +1963,14 @@ var Replay = /** @class */ (function () {
|
|
|
1962
1963
|
* Finalize and send the current replay event to Sentry
|
|
1963
1964
|
*/
|
|
1964
1965
|
Replay.prototype.sendReplay = function (_a) {
|
|
1965
|
-
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;
|
|
1966
1967
|
return __awaiter(this, void 0, void 0, function () {
|
|
1967
1968
|
var ex_1;
|
|
1968
1969
|
var _this = this;
|
|
1969
1970
|
return __generator(this, function (_b) {
|
|
1970
1971
|
switch (_b.label) {
|
|
1971
1972
|
case 0:
|
|
1972
|
-
// 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)
|
|
1973
1974
|
if (!events.length) {
|
|
1974
1975
|
return [2 /*return*/];
|
|
1975
1976
|
}
|
|
@@ -1981,6 +1982,7 @@ var Replay = /** @class */ (function () {
|
|
|
1981
1982
|
replayId: replayId,
|
|
1982
1983
|
segmentId: segmentId,
|
|
1983
1984
|
includeReplayStartTimestamp: includeReplayStartTimestamp,
|
|
1985
|
+
eventContext: eventContext,
|
|
1984
1986
|
})];
|
|
1985
1987
|
case 2:
|
|
1986
1988
|
_b.sent();
|
|
@@ -2014,6 +2016,7 @@ var Replay = /** @class */ (function () {
|
|
|
2014
2016
|
events: events,
|
|
2015
2017
|
segmentId: segmentId,
|
|
2016
2018
|
includeReplayStartTimestamp: includeReplayStartTimestamp,
|
|
2019
|
+
eventContext: eventContext,
|
|
2017
2020
|
})];
|
|
2018
2021
|
case 1:
|
|
2019
2022
|
_a.sent();
|