@openreplay/tracker 10.0.0 → 10.0.2
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/CHANGELOG.md +10 -2
- package/cjs/app/index.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/modules/Network/fetchProxy.js +3 -0
- package/cjs/modules/Network/networkMessage.js +6 -3
- package/cjs/modules/network.js +2 -2
- package/coverage/clover.xml +436 -432
- package/coverage/coverage-final.json +13 -13
- package/coverage/lcov-report/index.html +38 -38
- package/coverage/lcov-report/main/app/guards.ts.html +1 -1
- package/coverage/lcov-report/main/app/index.html +13 -13
- package/coverage/lcov-report/main/app/index.ts.html +18 -3
- package/coverage/lcov-report/main/app/logger.ts.html +2 -2
- package/coverage/lcov-report/main/app/messages.gen.ts.html +144 -144
- package/coverage/lcov-report/main/app/nodes.ts.html +1 -1
- package/coverage/lcov-report/main/app/observer/iframe_observer.ts.html +1 -1
- package/coverage/lcov-report/main/app/observer/iframe_offsets.ts.html +1 -1
- package/coverage/lcov-report/main/app/observer/index.html +1 -1
- package/coverage/lcov-report/main/app/observer/shadow_root_observer.ts.html +1 -1
- package/coverage/lcov-report/main/app/observer/top_observer.ts.html +1 -1
- package/coverage/lcov-report/main/app/sanitizer.ts.html +12 -3
- package/coverage/lcov-report/main/app/session.ts.html +13 -4
- package/coverage/lcov-report/main/app/ticker.ts.html +1 -1
- package/coverage/lcov-report/main/index.html +19 -19
- package/coverage/lcov-report/main/index.ts.html +1 -1
- package/coverage/lcov-report/main/modules/Network/beaconProxy.ts.html +19 -19
- package/coverage/lcov-report/main/modules/Network/fetchProxy.ts.html +102 -96
- package/coverage/lcov-report/main/modules/Network/index.html +65 -65
- package/coverage/lcov-report/main/modules/Network/index.ts.html +33 -33
- package/coverage/lcov-report/main/modules/Network/networkMessage.ts.html +71 -71
- package/coverage/lcov-report/main/modules/Network/utils.ts.html +34 -34
- package/coverage/lcov-report/main/modules/Network/xhrProxy.ts.html +13 -13
- package/coverage/lcov-report/main/modules/attributeSender.ts.html +13 -4
- package/coverage/lcov-report/main/modules/axiosSpy.ts.html +1 -1
- package/coverage/lcov-report/main/modules/connection.ts.html +1 -1
- package/coverage/lcov-report/main/modules/console.ts.html +1 -1
- package/coverage/lcov-report/main/modules/constructedStyleSheets.ts.html +1 -1
- package/coverage/lcov-report/main/modules/cssrules.ts.html +1 -1
- package/coverage/lcov-report/main/modules/exception.ts.html +1 -1
- package/coverage/lcov-report/main/modules/featureFlags.ts.html +1 -1
- package/coverage/lcov-report/main/modules/focus.ts.html +1 -1
- package/coverage/lcov-report/main/modules/fonts.ts.html +1 -1
- package/coverage/lcov-report/main/modules/img.ts.html +1 -1
- package/coverage/lcov-report/main/modules/index.html +8 -8
- package/coverage/lcov-report/main/modules/input.ts.html +1 -1
- package/coverage/lcov-report/main/modules/mouse.ts.html +1 -1
- package/coverage/lcov-report/main/modules/network.ts.html +2 -2
- package/coverage/lcov-report/main/modules/performance.ts.html +1 -1
- package/coverage/lcov-report/main/modules/scroll.ts.html +1 -1
- package/coverage/lcov-report/main/modules/selection.ts.html +1 -1
- package/coverage/lcov-report/main/modules/tabs.ts.html +1 -1
- package/coverage/lcov-report/main/modules/timing.ts.html +19 -7
- package/coverage/lcov-report/main/modules/viewport.ts.html +1 -1
- package/coverage/lcov-report/main/utils.ts.html +54 -63
- package/coverage/lcov-report/webworker/BatchWriter.ts.html +1 -1
- package/coverage/lcov-report/webworker/MessageEncoder.gen.ts.html +1 -1
- package/coverage/lcov-report/webworker/PrimitiveEncoder.ts.html +1 -1
- package/coverage/lcov-report/webworker/QueueSender.ts.html +1 -1
- package/coverage/lcov-report/webworker/index.html +1 -1
- package/coverage/lcov-report/webworker/index.ts.html +1 -1
- package/coverage/lcov.info +704 -692
- package/lib/app/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/modules/Network/fetchProxy.js +3 -0
- package/lib/modules/Network/networkMessage.js +6 -3
- package/lib/modules/network.js +2 -2
- package/package.json +1 -1
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">78.57% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>11/14</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">61.53% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>8/13</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">100% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>2/2</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">78.57% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>11/14</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</div>
|
|
62
62
|
</template>
|
|
63
63
|
</div>
|
|
64
|
-
<div class='status-line
|
|
64
|
+
<div class='status-line medium'></div>
|
|
65
65
|
<pre><table class="coverage">
|
|
66
66
|
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
67
67
|
<a name='L2'></a><a href='#L2'>2</a>
|
|
@@ -116,17 +116,17 @@
|
|
|
116
116
|
<a name='L51'></a><a href='#L51'>51</a>
|
|
117
117
|
<a name='L52'></a><a href='#L52'>52</a>
|
|
118
118
|
<a name='L53'></a><a href='#L53'>53</a>
|
|
119
|
-
<a name='L54'></a><a href='#L54'>54</a></td><td class="line-coverage quiet"><span class="cline-any cline-
|
|
120
|
-
<span class="cline-any cline-
|
|
121
|
-
<span class="cline-any cline-
|
|
119
|
+
<a name='L54'></a><a href='#L54'>54</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
|
120
|
+
<span class="cline-any cline-yes">1x</span>
|
|
121
|
+
<span class="cline-any cline-yes">1x</span>
|
|
122
122
|
<span class="cline-any cline-neutral"> </span>
|
|
123
123
|
<span class="cline-any cline-neutral"> </span>
|
|
124
124
|
<span class="cline-any cline-neutral"> </span>
|
|
125
|
-
<span class="cline-any cline-
|
|
126
|
-
<span class="cline-any cline-
|
|
125
|
+
<span class="cline-any cline-yes">1x</span>
|
|
126
|
+
<span class="cline-any cline-yes">1x</span>
|
|
127
127
|
<span class="cline-any cline-neutral"> </span>
|
|
128
128
|
<span class="cline-any cline-neutral"> </span>
|
|
129
|
-
<span class="cline-any cline-
|
|
129
|
+
<span class="cline-any cline-yes">1x</span>
|
|
130
130
|
<span class="cline-any cline-neutral"> </span>
|
|
131
131
|
<span class="cline-any cline-neutral"> </span>
|
|
132
132
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
<span class="cline-any cline-neutral"> </span>
|
|
136
136
|
<span class="cline-any cline-neutral"> </span>
|
|
137
137
|
<span class="cline-any cline-neutral"> </span>
|
|
138
|
-
<span class="cline-any cline-
|
|
138
|
+
<span class="cline-any cline-yes">1x</span>
|
|
139
139
|
<span class="cline-any cline-no"> </span>
|
|
140
140
|
<span class="cline-any cline-neutral"> </span>
|
|
141
141
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -145,10 +145,10 @@
|
|
|
145
145
|
<span class="cline-any cline-neutral"> </span>
|
|
146
146
|
<span class="cline-any cline-neutral"> </span>
|
|
147
147
|
<span class="cline-any cline-neutral"> </span>
|
|
148
|
-
<span class="cline-any cline-
|
|
148
|
+
<span class="cline-any cline-yes">1x</span>
|
|
149
149
|
<span class="cline-any cline-neutral"> </span>
|
|
150
|
-
<span class="cline-any cline-
|
|
151
|
-
<span class="cline-any cline-
|
|
150
|
+
<span class="cline-any cline-yes">1x</span>
|
|
151
|
+
<span class="cline-any cline-yes">1x</span>
|
|
152
152
|
<span class="cline-any cline-neutral"> </span>
|
|
153
153
|
<span class="cline-any cline-neutral"> </span>
|
|
154
154
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
<span class="cline-any cline-neutral"> </span>
|
|
160
160
|
<span class="cline-any cline-no"> </span>
|
|
161
161
|
<span class="cline-any cline-neutral"> </span>
|
|
162
|
-
<span class="cline-any cline-
|
|
162
|
+
<span class="cline-any cline-yes">1x</span>
|
|
163
163
|
<span class="cline-any cline-no"> </span>
|
|
164
164
|
<span class="cline-any cline-neutral"> </span>
|
|
165
165
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -169,17 +169,17 @@
|
|
|
169
169
|
<span class="cline-any cline-neutral"> </span>
|
|
170
170
|
<span class="cline-any cline-neutral"> </span>
|
|
171
171
|
<span class="cline-any cline-neutral"> </span>
|
|
172
|
-
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js"
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import FetchProxy from './fetchProxy.js'
|
|
173
|
+
import XHRProxy from './xhrProxy.js'
|
|
174
|
+
import BeaconProxy from './beaconProxy.js'
|
|
175
175
|
import { RequestResponseData } from './types.js'
|
|
176
176
|
import { NetworkRequest } from '../../../common/messages.gen.js'
|
|
177
177
|
|
|
178
|
-
const getWarning =
|
|
179
|
-
|
|
178
|
+
const getWarning = (api: string) =>
|
|
179
|
+
console.warn(`Openreplay: Can't find ${api} in global context.
|
|
180
180
|
If you're using serverside rendering in your app, make sure that tracker is loaded dynamically, otherwise ${api} won't be tracked.`)
|
|
181
181
|
|
|
182
|
-
|
|
182
|
+
export default function setProxy(
|
|
183
183
|
context: typeof globalThis,
|
|
184
184
|
ignoredHeaders: boolean | string[],
|
|
185
185
|
setSessionTokenHeader: (cb: (name: string, value: string) => void) => void,
|
|
@@ -188,7 +188,7 @@ If you're using serverside rendering in your app, make sure that tracker is load
|
|
|
188
188
|
isServiceUrl: (url: string) => boolean,
|
|
189
189
|
tokenUrlMatcher?: (url: string) => boolean,
|
|
190
190
|
) {
|
|
191
|
-
<span class="
|
|
191
|
+
<span class="missing-if-branch" title="if path not taken" >I</span>if (context.XMLHttpRequest) {
|
|
192
192
|
<span class="cstat-no" title="statement not covered" > context.XMLHttpRequest = XHRProxy.create(</span>
|
|
193
193
|
ignoredHeaders,
|
|
194
194
|
setSessionTokenHeader,
|
|
@@ -198,10 +198,10 @@ If you're using serverside rendering in your app, make sure that tracker is load
|
|
|
198
198
|
tokenUrlMatcher,
|
|
199
199
|
)
|
|
200
200
|
} else {
|
|
201
|
-
|
|
201
|
+
getWarning('XMLHttpRequest')
|
|
202
202
|
}
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
if (context.fetch) {
|
|
204
|
+
context.fetch = FetchProxy.create(
|
|
205
205
|
ignoredHeaders,
|
|
206
206
|
setSessionTokenHeader,
|
|
207
207
|
sanitize,
|
|
@@ -209,10 +209,10 @@ If you're using serverside rendering in your app, make sure that tracker is load
|
|
|
209
209
|
isServiceUrl,
|
|
210
210
|
tokenUrlMatcher,
|
|
211
211
|
)
|
|
212
|
-
} else {
|
|
212
|
+
} else <span class="missing-if-branch" title="else path not taken" >E</span>{
|
|
213
213
|
<span class="cstat-no" title="statement not covered" > getWarning('fetch')</span>
|
|
214
214
|
}
|
|
215
|
-
<span class="
|
|
215
|
+
<span class="missing-if-branch" title="if path not taken" >I</span>if (context<span class="branch-0 cbranch-no" title="branch not covered" >?.n</span>avigator<span class="branch-1 cbranch-no" title="branch not covered" >?.sendBeacon)</span> {
|
|
216
216
|
<span class="cstat-no" title="statement not covered" > context.navigator.sendBeacon = BeaconProxy.create(</span>
|
|
217
217
|
ignoredHeaders,
|
|
218
218
|
setSessionTokenHeader,
|
|
@@ -229,7 +229,7 @@ If you're using serverside rendering in your app, make sure that tracker is load
|
|
|
229
229
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
230
230
|
Code coverage generated by
|
|
231
231
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
232
|
-
at 2023-
|
|
232
|
+
at 2023-11-03T09:39:08.430Z
|
|
233
233
|
</div>
|
|
234
234
|
<script src="../../../prettify.js"></script>
|
|
235
235
|
<script>
|
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">58.82% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>30/51</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">25% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>2/8</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">25% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>2/8</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">62.5% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>30/48</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</div>
|
|
62
62
|
</template>
|
|
63
63
|
</div>
|
|
64
|
-
<div class='status-line
|
|
64
|
+
<div class='status-line medium'></div>
|
|
65
65
|
<pre><table class="coverage">
|
|
66
66
|
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
67
67
|
<a name='L2'></a><a href='#L2'>2</a>
|
|
@@ -163,20 +163,20 @@
|
|
|
163
163
|
<a name='L98'></a><a href='#L98'>98</a>
|
|
164
164
|
<a name='L99'></a><a href='#L99'>99</a>
|
|
165
165
|
<a name='L100'></a><a href='#L100'>100</a>
|
|
166
|
-
<a name='L101'></a><a href='#L101'>101</a></td><td class="line-coverage quiet"><span class="cline-any cline-
|
|
166
|
+
<a name='L101'></a><a href='#L101'>101</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">3x</span>
|
|
167
167
|
<span class="cline-any cline-neutral"> </span>
|
|
168
|
-
<span class="cline-any cline-
|
|
168
|
+
<span class="cline-any cline-yes">3x</span>
|
|
169
169
|
<span class="cline-any cline-neutral"> </span>
|
|
170
170
|
<span class="cline-any cline-neutral"> </span>
|
|
171
171
|
<span class="cline-any cline-neutral"> </span>
|
|
172
172
|
<span class="cline-any cline-neutral"> </span>
|
|
173
173
|
<span class="cline-any cline-neutral"> </span>
|
|
174
|
-
<span class="cline-any cline-
|
|
175
|
-
<span class="cline-any cline-
|
|
176
|
-
<span class="cline-any cline-
|
|
177
|
-
<span class="cline-any cline-
|
|
178
|
-
<span class="cline-any cline-
|
|
179
|
-
<span class="cline-any cline-
|
|
174
|
+
<span class="cline-any cline-yes">3x</span>
|
|
175
|
+
<span class="cline-any cline-yes">3x</span>
|
|
176
|
+
<span class="cline-any cline-yes">3x</span>
|
|
177
|
+
<span class="cline-any cline-yes">3x</span>
|
|
178
|
+
<span class="cline-any cline-yes">3x</span>
|
|
179
|
+
<span class="cline-any cline-yes">3x</span>
|
|
180
180
|
<span class="cline-any cline-neutral"> </span>
|
|
181
181
|
<span class="cline-any cline-neutral"> </span>
|
|
182
182
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -184,32 +184,32 @@
|
|
|
184
184
|
<span class="cline-any cline-neutral"> </span>
|
|
185
185
|
<span class="cline-any cline-neutral"> </span>
|
|
186
186
|
<span class="cline-any cline-neutral"> </span>
|
|
187
|
-
<span class="cline-any cline-
|
|
188
|
-
<span class="cline-any cline-
|
|
189
|
-
<span class="cline-any cline-
|
|
190
|
-
<span class="cline-any cline-
|
|
191
|
-
<span class="cline-any cline-
|
|
192
|
-
<span class="cline-any cline-
|
|
193
|
-
<span class="cline-any cline-
|
|
194
|
-
<span class="cline-any cline-
|
|
195
|
-
<span class="cline-any cline-
|
|
196
|
-
<span class="cline-any cline-
|
|
197
|
-
<span class="cline-any cline-
|
|
187
|
+
<span class="cline-any cline-yes">3x</span>
|
|
188
|
+
<span class="cline-any cline-yes">1x</span>
|
|
189
|
+
<span class="cline-any cline-yes">1x</span>
|
|
190
|
+
<span class="cline-any cline-yes">1x</span>
|
|
191
|
+
<span class="cline-any cline-yes">1x</span>
|
|
192
|
+
<span class="cline-any cline-yes">1x</span>
|
|
193
|
+
<span class="cline-any cline-yes">1x</span>
|
|
194
|
+
<span class="cline-any cline-yes">1x</span>
|
|
195
|
+
<span class="cline-any cline-yes">1x</span>
|
|
196
|
+
<span class="cline-any cline-yes">1x</span>
|
|
197
|
+
<span class="cline-any cline-yes">1x</span>
|
|
198
198
|
<span class="cline-any cline-neutral"> </span>
|
|
199
|
-
<span class="cline-any cline-
|
|
199
|
+
<span class="cline-any cline-yes">1x</span>
|
|
200
200
|
<span class="cline-any cline-neutral"> </span>
|
|
201
|
-
<span class="cline-any cline-
|
|
202
|
-
<span class="cline-any cline-
|
|
203
|
-
<span class="cline-any cline-
|
|
204
|
-
<span class="cline-any cline-
|
|
205
|
-
<span class="cline-any cline-
|
|
206
|
-
<span class="cline-any cline-
|
|
207
|
-
<span class="cline-any cline-
|
|
201
|
+
<span class="cline-any cline-yes">1x</span>
|
|
202
|
+
<span class="cline-any cline-yes">1x</span>
|
|
203
|
+
<span class="cline-any cline-yes">1x</span>
|
|
204
|
+
<span class="cline-any cline-yes">1x</span>
|
|
205
|
+
<span class="cline-any cline-yes">1x</span>
|
|
206
|
+
<span class="cline-any cline-yes">1x</span>
|
|
207
|
+
<span class="cline-any cline-yes">1x</span>
|
|
208
208
|
<span class="cline-any cline-neutral"> </span>
|
|
209
209
|
<span class="cline-any cline-neutral"> </span>
|
|
210
|
-
<span class="cline-any cline-
|
|
211
|
-
<span class="cline-any cline-
|
|
212
|
-
<span class="cline-any cline-
|
|
210
|
+
<span class="cline-any cline-yes">1x</span>
|
|
211
|
+
<span class="cline-any cline-yes">1x</span>
|
|
212
|
+
<span class="cline-any cline-yes">1x</span>
|
|
213
213
|
<span class="cline-any cline-neutral"> </span>
|
|
214
214
|
<span class="cline-any cline-neutral"> </span>
|
|
215
215
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -263,20 +263,20 @@
|
|
|
263
263
|
<span class="cline-any cline-no"> </span>
|
|
264
264
|
<span class="cline-any cline-neutral"> </span>
|
|
265
265
|
<span class="cline-any cline-neutral"> </span>
|
|
266
|
-
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js"
|
|
266
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { NetworkRequest } from '../../app/messages.gen.js'
|
|
267
267
|
import { RequestResponseData } from './types.js'
|
|
268
|
-
|
|
268
|
+
import { getTimeOrigin } from '../../utils.js'
|
|
269
269
|
|
|
270
270
|
export type httpMethod =
|
|
271
271
|
// '' is a rare case of error
|
|
272
272
|
'' | 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'
|
|
273
273
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
274
|
+
export enum RequestState {
|
|
275
|
+
UNSENT = 0,
|
|
276
|
+
OPENED = 1,
|
|
277
|
+
HEADERS_RECEIVED = 2,
|
|
278
|
+
LOADING = 3,
|
|
279
|
+
DONE = 4,
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
/**
|
|
@@ -284,32 +284,32 @@ export type httpMethod =
|
|
|
284
284
|
* but it can be useful in the future if we will decide to display more stuff in our ui
|
|
285
285
|
* */
|
|
286
286
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
287
|
+
export default class NetworkMessage {
|
|
288
|
+
id = ''
|
|
289
|
+
name?: string = ''
|
|
290
|
+
method: httpMethod = ''
|
|
291
|
+
url = ''
|
|
292
|
+
status = 0
|
|
293
|
+
statusText?: string = ''
|
|
294
|
+
cancelState?: 0 | 1 | 2 | 3 = 0
|
|
295
|
+
readyState?: RequestState = 0
|
|
296
|
+
header: { [key: string]: string } = {}
|
|
297
|
+
responseType: XMLHttpRequest['responseType'] = ''
|
|
298
298
|
requestType: 'xhr' | 'fetch' | 'ping' | 'custom' | 'beacon'
|
|
299
|
-
|
|
299
|
+
requestHeader: HeadersInit = {}
|
|
300
300
|
response: any
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
301
|
+
responseSize = 0 // bytes
|
|
302
|
+
responseSizeText = ''
|
|
303
|
+
startTime = 0
|
|
304
|
+
endTime = 0
|
|
305
|
+
duration = 0
|
|
306
|
+
getData: { [key: string]: string } = {}
|
|
307
|
+
requestData: string | null = null
|
|
308
308
|
|
|
309
|
-
|
|
310
|
-
private readonly
|
|
311
|
-
private readonly
|
|
312
|
-
private readonly
|
|
309
|
+
constructor(
|
|
310
|
+
private readonly ignoredHeaders: boolean | string[] = <span class="branch-0 cbranch-no" title="branch not covered" >[],</span>
|
|
311
|
+
private readonly setSessionTokenHeader: (cb: (name: string, value: string) => void) => void,
|
|
312
|
+
private readonly sanitize: (data: RequestResponseData) => RequestResponseData,
|
|
313
313
|
) {}
|
|
314
314
|
|
|
315
315
|
<span class="fstat-no" title="function not covered" > getMessage(</span>) {
|
|
@@ -370,7 +370,7 @@ export type httpMethod =
|
|
|
370
370
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
371
371
|
Code coverage generated by
|
|
372
372
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
373
|
-
at 2023-
|
|
373
|
+
at 2023-11-03T09:39:08.430Z
|
|
374
374
|
</div>
|
|
375
375
|
<script src="../../../prettify.js"></script>
|
|
376
376
|
<script>
|
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">16.07% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>18/112</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">1.2% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>1/83</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">11.11% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>1/9</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">11.32% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>12/106</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -268,7 +268,7 @@
|
|
|
268
268
|
<a name='L203'></a><a href='#L203'>203</a>
|
|
269
269
|
<a name='L204'></a><a href='#L204'>204</a>
|
|
270
270
|
<a name='L205'></a><a href='#L205'>205</a>
|
|
271
|
-
<a name='L206'></a><a href='#L206'>206</a></td><td class="line-coverage quiet"><span class="cline-any cline-
|
|
271
|
+
<a name='L206'></a><a href='#L206'>206</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">3x</span>
|
|
272
272
|
<span class="cline-any cline-neutral"> </span>
|
|
273
273
|
<span class="cline-any cline-neutral"> </span>
|
|
274
274
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
<span class="cline-any cline-no"> </span>
|
|
304
304
|
<span class="cline-any cline-neutral"> </span>
|
|
305
305
|
<span class="cline-any cline-neutral"> </span>
|
|
306
|
-
<span class="cline-any cline-
|
|
306
|
+
<span class="cline-any cline-yes">3x</span>
|
|
307
307
|
<span class="cline-any cline-neutral"> </span>
|
|
308
308
|
<span class="cline-any cline-neutral"> </span>
|
|
309
309
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -332,7 +332,7 @@
|
|
|
332
332
|
<span class="cline-any cline-no"> </span>
|
|
333
333
|
<span class="cline-any cline-neutral"> </span>
|
|
334
334
|
<span class="cline-any cline-neutral"> </span>
|
|
335
|
-
<span class="cline-any cline-
|
|
335
|
+
<span class="cline-any cline-yes">3x</span>
|
|
336
336
|
<span class="cline-any cline-no"> </span>
|
|
337
337
|
<span class="cline-any cline-no"> </span>
|
|
338
338
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -373,7 +373,7 @@
|
|
|
373
373
|
<span class="cline-any cline-no"> </span>
|
|
374
374
|
<span class="cline-any cline-neutral"> </span>
|
|
375
375
|
<span class="cline-any cline-neutral"> </span>
|
|
376
|
-
<span class="cline-any cline-
|
|
376
|
+
<span class="cline-any cline-yes">3x</span>
|
|
377
377
|
<span class="cline-any cline-no"> </span>
|
|
378
378
|
<span class="cline-any cline-no"> </span>
|
|
379
379
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -396,7 +396,7 @@
|
|
|
396
396
|
<span class="cline-any cline-no"> </span>
|
|
397
397
|
<span class="cline-any cline-neutral"> </span>
|
|
398
398
|
<span class="cline-any cline-neutral"> </span>
|
|
399
|
-
<span class="cline-any cline-
|
|
399
|
+
<span class="cline-any cline-yes">3x</span>
|
|
400
400
|
<span class="cline-any cline-no"> </span>
|
|
401
401
|
<span class="cline-any cline-no"> </span>
|
|
402
402
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -437,18 +437,18 @@
|
|
|
437
437
|
<span class="cline-any cline-no"> </span>
|
|
438
438
|
<span class="cline-any cline-neutral"> </span>
|
|
439
439
|
<span class="cline-any cline-neutral"> </span>
|
|
440
|
-
<span class="cline-any cline-
|
|
440
|
+
<span class="cline-any cline-yes">3x</span>
|
|
441
441
|
<span class="cline-any cline-no"> </span>
|
|
442
442
|
<span class="cline-any cline-neutral"> </span>
|
|
443
443
|
<span class="cline-any cline-neutral"> </span>
|
|
444
|
-
<span class="cline-any cline-
|
|
444
|
+
<span class="cline-any cline-yes">3x</span>
|
|
445
445
|
<span class="cline-any cline-no"> </span>
|
|
446
446
|
<span class="cline-any cline-no"> </span>
|
|
447
447
|
<span class="cline-any cline-neutral"> </span>
|
|
448
448
|
<span class="cline-any cline-no"> </span>
|
|
449
449
|
<span class="cline-any cline-neutral"> </span>
|
|
450
450
|
<span class="cline-any cline-neutral"> </span>
|
|
451
|
-
<span class="cline-any cline-
|
|
451
|
+
<span class="cline-any cline-yes">3x</span>
|
|
452
452
|
<span class="cline-any cline-no"> </span>
|
|
453
453
|
<span class="cline-any cline-neutral"> </span>
|
|
454
454
|
<span class="cline-any cline-no"> </span>
|
|
@@ -462,18 +462,18 @@
|
|
|
462
462
|
<span class="cline-any cline-no"> </span>
|
|
463
463
|
<span class="cline-any cline-neutral"> </span>
|
|
464
464
|
<span class="cline-any cline-neutral"> </span>
|
|
465
|
-
<span class="cline-any cline-
|
|
466
|
-
<span class="cline-any cline-
|
|
465
|
+
<span class="cline-any cline-yes">3x</span>
|
|
466
|
+
<span class="cline-any cline-yes">1x</span>
|
|
467
467
|
<span class="cline-any cline-no"> </span>
|
|
468
468
|
<span class="cline-any cline-no"> </span>
|
|
469
469
|
<span class="cline-any cline-neutral"> </span>
|
|
470
|
-
<span class="cline-any cline-
|
|
471
|
-
<span class="cline-any cline-
|
|
470
|
+
<span class="cline-any cline-yes">1x</span>
|
|
471
|
+
<span class="cline-any cline-yes">1x</span>
|
|
472
472
|
<span class="cline-any cline-neutral"> </span>
|
|
473
473
|
<span class="cline-any cline-no"> </span>
|
|
474
474
|
<span class="cline-any cline-neutral"> </span>
|
|
475
475
|
<span class="cline-any cline-neutral"> </span>
|
|
476
|
-
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">export const
|
|
476
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">export const genResponseByType = <span class="fstat-no" title="function not covered" >(</span>
|
|
477
477
|
responseType: XMLHttpRequest['responseType'],
|
|
478
478
|
response: any,
|
|
479
479
|
): string | Record<string, any> => {
|
|
@@ -508,7 +508,7 @@
|
|
|
508
508
|
<span class="cstat-no" title="statement not covered" > return result</span>
|
|
509
509
|
}
|
|
510
510
|
|
|
511
|
-
export const
|
|
511
|
+
export const getStringResponseByType = <span class="fstat-no" title="function not covered" >(</span>
|
|
512
512
|
responseType: XMLHttpRequest['responseType'],
|
|
513
513
|
response: any,
|
|
514
514
|
) => {
|
|
@@ -537,7 +537,7 @@ export const <span class="cstat-no" title="statement not covered" >getStringResp
|
|
|
537
537
|
<span class="cstat-no" title="statement not covered" > return result</span>
|
|
538
538
|
}
|
|
539
539
|
|
|
540
|
-
export const
|
|
540
|
+
export const genStringBody = <span class="fstat-no" title="function not covered" >(b</span>ody?: BodyInit) => {
|
|
541
541
|
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (!body) {</span>
|
|
542
542
|
<span class="cstat-no" title="statement not covered" > return null</span>
|
|
543
543
|
}
|
|
@@ -578,7 +578,7 @@ export const <span class="cstat-no" title="statement not covered" >genStringBody
|
|
|
578
578
|
<span class="cstat-no" title="statement not covered" > return result</span>
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
-
export const
|
|
581
|
+
export const genGetDataByUrl = <span class="fstat-no" title="function not covered" >(u</span>rl: string, getData: Record<string, any> = <span class="branch-0 cbranch-no" title="branch not covered" >{})</span> => {
|
|
582
582
|
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (!isPureObject(getData)) {</span>
|
|
583
583
|
<span class="cstat-no" title="statement not covered" > getData = {}</span>
|
|
584
584
|
}
|
|
@@ -601,7 +601,7 @@ export const <span class="cstat-no" title="statement not covered" >genGetDataByU
|
|
|
601
601
|
<span class="cstat-no" title="statement not covered" > return getData</span>
|
|
602
602
|
}
|
|
603
603
|
|
|
604
|
-
export const
|
|
604
|
+
export const genFormattedBody = <span class="fstat-no" title="function not covered" >(b</span>ody?: BodyInit) => {
|
|
605
605
|
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (!body) {</span>
|
|
606
606
|
<span class="cstat-no" title="statement not covered" > return null</span>
|
|
607
607
|
}
|
|
@@ -642,18 +642,18 @@ export const <span class="cstat-no" title="statement not covered" >genFormattedB
|
|
|
642
642
|
<span class="cstat-no" title="statement not covered" > return result</span>
|
|
643
643
|
}
|
|
644
644
|
|
|
645
|
-
|
|
645
|
+
export function <span class="fstat-no" title="function not covered" >isPureObject(</span>input: any): input is Record<any, any> {
|
|
646
646
|
<span class="cstat-no" title="statement not covered" > return null !== input && typeof input === 'object'</span>
|
|
647
647
|
}
|
|
648
648
|
|
|
649
|
-
|
|
649
|
+
export function <span class="fstat-no" title="function not covered" >isIterable(</span>value: any) {
|
|
650
650
|
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (value === null || value === undefined) {</span>
|
|
651
651
|
<span class="cstat-no" title="statement not covered" > return false</span>
|
|
652
652
|
}
|
|
653
653
|
<span class="cstat-no" title="statement not covered" > return typeof Symbol !== 'undefined' && typeof value[Symbol.iterator] === 'function'</span>
|
|
654
654
|
}
|
|
655
655
|
|
|
656
|
-
|
|
656
|
+
export function <span class="fstat-no" title="function not covered" >formatByteSize(</span>bytes: number) {
|
|
657
657
|
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (bytes <= 0) {</span>
|
|
658
658
|
// shouldn't happen?
|
|
659
659
|
<span class="cstat-no" title="statement not covered" > return ''</span>
|
|
@@ -667,14 +667,14 @@ export const <span class="cstat-no" title="statement not covered" >genFormattedB
|
|
|
667
667
|
<span class="cstat-no" title="statement not covered" > return `${bytes}B`</span>
|
|
668
668
|
}
|
|
669
669
|
|
|
670
|
-
export const
|
|
671
|
-
|
|
670
|
+
export const getURL = (urlString: string) => {
|
|
671
|
+
<span class="missing-if-branch" title="if path not taken" >I</span>if (urlString.startsWith('//')) {
|
|
672
672
|
const baseUrl = <span class="cstat-no" title="statement not covered" >new URL(window.location.href)</span>
|
|
673
673
|
<span class="cstat-no" title="statement not covered" > urlString = `${baseUrl.protocol}${urlString}`</span>
|
|
674
674
|
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
} else {
|
|
675
|
+
if (urlString.startsWith('http')) {
|
|
676
|
+
return new URL(urlString)
|
|
677
|
+
} else <span class="missing-if-branch" title="else path not taken" >E</span>{
|
|
678
678
|
<span class="cstat-no" title="statement not covered" > return new URL(urlString, window.location.href)</span>
|
|
679
679
|
}
|
|
680
680
|
}
|
|
@@ -685,7 +685,7 @@ export const <span class="cstat-no" title="statement not covered" >getURL = <spa
|
|
|
685
685
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
686
686
|
Code coverage generated by
|
|
687
687
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
688
|
-
at 2023-
|
|
688
|
+
at 2023-11-03T09:39:08.430Z
|
|
689
689
|
</div>
|
|
690
690
|
<script src="../../../prettify.js"></script>
|
|
691
691
|
<script>
|