@openreplay/tracker 10.0.2 → 10.0.3
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 +4 -0
- package/cjs/app/index.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/utils.js +16 -2
- package/coverage/clover.xml +508 -435
- package/coverage/coverage-final.json +12 -11
- package/coverage/lcov-report/index.html +40 -40
- package/coverage/lcov-report/main/app/canvas.ts.html +475 -0
- package/coverage/lcov-report/main/app/guards.ts.html +46 -43
- package/coverage/lcov-report/main/app/index.html +40 -25
- package/coverage/lcov-report/main/app/index.ts.html +58 -7
- package/coverage/lcov-report/main/app/logger.ts.html +1 -1
- package/coverage/lcov-report/main/app/messages.gen.ts.html +179 -146
- 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 +1 -1
- package/coverage/lcov-report/main/app/session.ts.html +1 -1
- package/coverage/lcov-report/main/app/ticker.ts.html +1 -1
- package/coverage/lcov-report/main/index.html +15 -15
- 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 +97 -97
- 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 +82 -73
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/coverage/lcov-report/main/modules/viewport.ts.html +1 -1
- package/coverage/lcov-report/main/utils.ts.html +57 -57
- package/coverage/lcov-report/webworker/BatchWriter.ts.html +1 -1
- package/coverage/lcov-report/webworker/MessageEncoder.gen.ts.html +17 -5
- 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 +7 -7
- package/coverage/lcov-report/webworker/index.ts.html +1 -1
- package/coverage/lcov.info +819 -676
- package/lib/app/index.js +1 -1
- package/lib/common/tsconfig.tsbuildinfo +1 -1
- package/lib/index.js +1 -1
- package/lib/utils.js +16 -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">0% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>0/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">0% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>0/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">0% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>0/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">0% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>0/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 low'></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-no"> </span>
|
|
120
|
+
<span class="cline-any cline-no"> </span>
|
|
121
|
+
<span class="cline-any cline-no"> </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-no"> </span>
|
|
126
|
+
<span class="cline-any cline-no"> </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-no"> </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-no"> </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-no"> </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-no"> </span>
|
|
151
|
+
<span class="cline-any cline-no"> </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-no"> </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">import FetchProxy from './fetchProxy.js'
|
|
173
|
-
import XHRProxy from './xhrProxy.js'
|
|
174
|
-
import BeaconProxy from './beaconProxy.js'
|
|
172
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js"><span class="cstat-no" title="statement not covered" >import FetchProxy from './fetchProxy.js'</span>
|
|
173
|
+
<span class="cstat-no" title="statement not covered" >import XHRProxy from './xhrProxy.js'</span>
|
|
174
|
+
<span class="cstat-no" title="statement not covered" >import BeaconProxy from './beaconProxy.js'</span>
|
|
175
175
|
import { RequestResponseData } from './types.js'
|
|
176
176
|
import { NetworkRequest } from '../../../common/messages.gen.js'
|
|
177
177
|
|
|
178
|
-
const getWarning = (
|
|
179
|
-
console.warn(`Openreplay: Can't find ${api} in global context.
|
|
178
|
+
const getWarning = <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >(a</span>pi: string) =></span>
|
|
179
|
+
<span class="cstat-no" title="statement not covered" > console.warn(`Openreplay: Can't find ${api} in global context. </span>
|
|
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
|
-
export default function
|
|
182
|
+
<span class="cstat-no" title="statement not covered" >export default function <span class="fstat-no" title="function not covered" >s</span>etProxy(</span>
|
|
183
183
|
context: typeof globalThis,
|
|
184
184
|
ignoredHeaders: boolean | string[],
|
|
185
185
|
setSessionTokenHeader: (cb: (name: string, value: string) => void) => void,
|
|
@@ -188,7 +188,7 @@ export default function setProxy(
|
|
|
188
188
|
isServiceUrl: (url: string) => boolean,
|
|
189
189
|
tokenUrlMatcher?: (url: string) => boolean,
|
|
190
190
|
) {
|
|
191
|
-
|
|
191
|
+
<span class="cstat-no" title="statement not covered" > if (context.XMLHttpRequest) {</span>
|
|
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 @@ export default function setProxy(
|
|
|
198
198
|
tokenUrlMatcher,
|
|
199
199
|
)
|
|
200
200
|
} else {
|
|
201
|
-
getWarning('XMLHttpRequest')
|
|
201
|
+
<span class="cstat-no" title="statement not covered" > getWarning('XMLHttpRequest')</span>
|
|
202
202
|
}
|
|
203
|
-
if (context.fetch) {
|
|
204
|
-
context.fetch = FetchProxy.create(
|
|
203
|
+
<span class="cstat-no" title="statement not covered" > if (context.fetch) {</span>
|
|
204
|
+
<span class="cstat-no" title="statement not covered" > context.fetch = FetchProxy.create(</span>
|
|
205
205
|
ignoredHeaders,
|
|
206
206
|
setSessionTokenHeader,
|
|
207
207
|
sanitize,
|
|
@@ -209,10 +209,10 @@ export default function setProxy(
|
|
|
209
209
|
isServiceUrl,
|
|
210
210
|
tokenUrlMatcher,
|
|
211
211
|
)
|
|
212
|
-
} else
|
|
212
|
+
} else {
|
|
213
213
|
<span class="cstat-no" title="statement not covered" > getWarning('fetch')</span>
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
<span class="cstat-no" title="statement not covered" > <span class="missing-if-branch" title="if path not taken" >I</span>if (context?.navigator?.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 @@ export default function setProxy(
|
|
|
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-11-
|
|
232
|
+
at 2023-11-21T10:02:27.844Z
|
|
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">0% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>0/52</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">0% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>0/9</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">0% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>0/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">0% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>0/49</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 low'></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,23 @@
|
|
|
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
|
|
166
|
+
<a name='L101'></a><a href='#L101'>101</a>
|
|
167
|
+
<a name='L102'></a><a href='#L102'>102</a>
|
|
168
|
+
<a name='L103'></a><a href='#L103'>103</a>
|
|
169
|
+
<a name='L104'></a><a href='#L104'>104</a></td><td class="line-coverage quiet"><span class="cline-any cline-no"> </span>
|
|
167
170
|
<span class="cline-any cline-neutral"> </span>
|
|
168
|
-
<span class="cline-any cline-
|
|
171
|
+
<span class="cline-any cline-no"> </span>
|
|
169
172
|
<span class="cline-any cline-neutral"> </span>
|
|
170
173
|
<span class="cline-any cline-neutral"> </span>
|
|
171
174
|
<span class="cline-any cline-neutral"> </span>
|
|
172
175
|
<span class="cline-any cline-neutral"> </span>
|
|
173
176
|
<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-
|
|
177
|
+
<span class="cline-any cline-no"> </span>
|
|
178
|
+
<span class="cline-any cline-no"> </span>
|
|
179
|
+
<span class="cline-any cline-no"> </span>
|
|
180
|
+
<span class="cline-any cline-no"> </span>
|
|
181
|
+
<span class="cline-any cline-no"> </span>
|
|
182
|
+
<span class="cline-any cline-no"> </span>
|
|
180
183
|
<span class="cline-any cline-neutral"> </span>
|
|
181
184
|
<span class="cline-any cline-neutral"> </span>
|
|
182
185
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -184,32 +187,32 @@
|
|
|
184
187
|
<span class="cline-any cline-neutral"> </span>
|
|
185
188
|
<span class="cline-any cline-neutral"> </span>
|
|
186
189
|
<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-
|
|
190
|
+
<span class="cline-any cline-no"> </span>
|
|
191
|
+
<span class="cline-any cline-no"> </span>
|
|
192
|
+
<span class="cline-any cline-no"> </span>
|
|
193
|
+
<span class="cline-any cline-no"> </span>
|
|
194
|
+
<span class="cline-any cline-no"> </span>
|
|
195
|
+
<span class="cline-any cline-no"> </span>
|
|
196
|
+
<span class="cline-any cline-no"> </span>
|
|
197
|
+
<span class="cline-any cline-no"> </span>
|
|
198
|
+
<span class="cline-any cline-no"> </span>
|
|
199
|
+
<span class="cline-any cline-no"> </span>
|
|
200
|
+
<span class="cline-any cline-no"> </span>
|
|
198
201
|
<span class="cline-any cline-neutral"> </span>
|
|
199
|
-
<span class="cline-any cline-
|
|
202
|
+
<span class="cline-any cline-no"> </span>
|
|
200
203
|
<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-
|
|
204
|
+
<span class="cline-any cline-no"> </span>
|
|
205
|
+
<span class="cline-any cline-no"> </span>
|
|
206
|
+
<span class="cline-any cline-no"> </span>
|
|
207
|
+
<span class="cline-any cline-no"> </span>
|
|
208
|
+
<span class="cline-any cline-no"> </span>
|
|
209
|
+
<span class="cline-any cline-no"> </span>
|
|
210
|
+
<span class="cline-any cline-no"> </span>
|
|
208
211
|
<span class="cline-any cline-neutral"> </span>
|
|
209
212
|
<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-
|
|
213
|
+
<span class="cline-any cline-no"> </span>
|
|
214
|
+
<span class="cline-any cline-no"> </span>
|
|
215
|
+
<span class="cline-any cline-no"> </span>
|
|
213
216
|
<span class="cline-any cline-neutral"> </span>
|
|
214
217
|
<span class="cline-any cline-neutral"> </span>
|
|
215
218
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -262,21 +265,24 @@
|
|
|
262
265
|
<span class="cline-any cline-no"> </span>
|
|
263
266
|
<span class="cline-any cline-no"> </span>
|
|
264
267
|
<span class="cline-any cline-neutral"> </span>
|
|
268
|
+
<span class="cline-any cline-no"> </span>
|
|
269
|
+
<span class="cline-any cline-neutral"> </span>
|
|
265
270
|
<span class="cline-any cline-neutral"> </span>
|
|
266
|
-
<span class="cline-any cline-neutral"> </span
|
|
271
|
+
<span class="cline-any cline-neutral"> </span>
|
|
272
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js"><span class="cstat-no" title="statement not covered" >import { NetworkRequest } from '../../app/messages.gen.js'</span>
|
|
267
273
|
import { RequestResponseData } from './types.js'
|
|
268
|
-
import { getTimeOrigin } from '../../utils.js'
|
|
274
|
+
<span class="cstat-no" title="statement not covered" >import { getTimeOrigin } from '../../utils.js'</span>
|
|
269
275
|
|
|
270
276
|
export type httpMethod =
|
|
271
277
|
// '' is a rare case of error
|
|
272
278
|
'' | 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'
|
|
273
279
|
|
|
274
|
-
export enum
|
|
275
|
-
UNSENT = 0
|
|
276
|
-
OPENED = 1
|
|
277
|
-
HEADERS_RECEIVED = 2
|
|
278
|
-
LOADING = 3
|
|
279
|
-
DONE = 4
|
|
280
|
+
<span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >export enum R</span>equestState {</span>
|
|
281
|
+
<span class="cstat-no" title="statement not covered" > UNSENT = 0,</span>
|
|
282
|
+
<span class="cstat-no" title="statement not covered" > OPENED = 1,</span>
|
|
283
|
+
<span class="cstat-no" title="statement not covered" > HEADERS_RECEIVED = 2,</span>
|
|
284
|
+
<span class="cstat-no" title="statement not covered" > LOADING = 3,</span>
|
|
285
|
+
<span class="cstat-no" title="statement not covered" > DONE = 4,</span>
|
|
280
286
|
}
|
|
281
287
|
|
|
282
288
|
/**
|
|
@@ -284,32 +290,32 @@ export enum RequestState {
|
|
|
284
290
|
* but it can be useful in the future if we will decide to display more stuff in our ui
|
|
285
291
|
* */
|
|
286
292
|
|
|
287
|
-
export default class
|
|
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'] = ''
|
|
293
|
+
<span class="cstat-no" title="statement not covered" >export default class N</span>etworkMessage {
|
|
294
|
+
<span class="cstat-no" title="statement not covered" > id = ''</span>
|
|
295
|
+
<span class="cstat-no" title="statement not covered" > name?: string = ''</span>
|
|
296
|
+
<span class="cstat-no" title="statement not covered" > method: httpMethod = ''</span>
|
|
297
|
+
<span class="cstat-no" title="statement not covered" > url = ''</span>
|
|
298
|
+
<span class="cstat-no" title="statement not covered" > status = 0</span>
|
|
299
|
+
<span class="cstat-no" title="statement not covered" > statusText?: string = ''</span>
|
|
300
|
+
<span class="cstat-no" title="statement not covered" > cancelState?: 0 | 1 | 2 | 3 = 0</span>
|
|
301
|
+
<span class="cstat-no" title="statement not covered" > readyState?: RequestState = 0</span>
|
|
302
|
+
<span class="cstat-no" title="statement not covered" > header: { [key: string]: string } = {}</span>
|
|
303
|
+
<span class="cstat-no" title="statement not covered" > responseType: XMLHttpRequest['responseType'] = ''</span>
|
|
298
304
|
requestType: 'xhr' | 'fetch' | 'ping' | 'custom' | 'beacon'
|
|
299
|
-
requestHeader: HeadersInit = {}
|
|
305
|
+
<span class="cstat-no" title="statement not covered" > requestHeader: HeadersInit = {}</span>
|
|
300
306
|
response: any
|
|
301
|
-
responseSize = 0
|
|
302
|
-
responseSizeText = ''
|
|
303
|
-
startTime = 0
|
|
304
|
-
endTime = 0
|
|
305
|
-
duration = 0
|
|
306
|
-
getData: { [key: string]: string } = {}
|
|
307
|
-
requestData: string | null = null
|
|
307
|
+
<span class="cstat-no" title="statement not covered" > responseSize = 0 /</span>/ bytes
|
|
308
|
+
<span class="cstat-no" title="statement not covered" > responseSizeText = ''</span>
|
|
309
|
+
<span class="cstat-no" title="statement not covered" > startTime = 0</span>
|
|
310
|
+
<span class="cstat-no" title="statement not covered" > endTime = 0</span>
|
|
311
|
+
<span class="cstat-no" title="statement not covered" > duration = 0</span>
|
|
312
|
+
<span class="cstat-no" title="statement not covered" > getData: { [key: string]: string } = {}</span>
|
|
313
|
+
<span class="cstat-no" title="statement not covered" > requestData: string | null = null</span>
|
|
308
314
|
|
|
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
|
|
315
|
+
<span class="fstat-no" title="function not covered" > constructor(</span>
|
|
316
|
+
private readonly <span class="cstat-no" title="statement not covered" >ignoredHeaders: boolean | string[] = <span class="branch-0 cbranch-no" title="branch not covered" >[</span>],</span>
|
|
317
|
+
private readonly <span class="cstat-no" title="statement not covered" >setSessionTokenHeader: (cb: (name: string, value: string) => void) => void,</span>
|
|
318
|
+
private readonly <span class="cstat-no" title="statement not covered" >sanitize: (data: RequestResponseData) => RequestResponseData,</span>
|
|
313
319
|
) {}
|
|
314
320
|
|
|
315
321
|
<span class="fstat-no" title="function not covered" > getMessage(</span>) {
|
|
@@ -359,8 +365,11 @@ export default class NetworkMessage {
|
|
|
359
365
|
}
|
|
360
366
|
|
|
361
367
|
<span class="fstat-no" title="function not covered" > isHeaderIgnored(</span>key: string) {
|
|
362
|
-
<span class="cstat-no" title="statement not covered" >
|
|
363
|
-
<span class="cstat-no" title="statement not covered" >
|
|
368
|
+
<span class="cstat-no" title="statement not covered" > if (Array.isArray(this.ignoredHeaders)) {</span>
|
|
369
|
+
<span class="cstat-no" title="statement not covered" > return this.ignoredHeaders.map(<span class="fstat-no" title="function not covered" >(k</span>) => <span class="cstat-no" title="statement not covered" >k.toLowerCase())</span>.includes(key.toLowerCase())</span>
|
|
370
|
+
} else {
|
|
371
|
+
<span class="cstat-no" title="statement not covered" > return this.ignoredHeaders</span>
|
|
372
|
+
}
|
|
364
373
|
}
|
|
365
374
|
}
|
|
366
375
|
</pre></td></tr></table></pre>
|
|
@@ -370,7 +379,7 @@ export default class NetworkMessage {
|
|
|
370
379
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
371
380
|
Code coverage generated by
|
|
372
381
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
373
|
-
at 2023-11-
|
|
382
|
+
at 2023-11-21T10:02:27.844Z
|
|
374
383
|
</div>
|
|
375
384
|
<script src="../../../prettify.js"></script>
|
|
376
385
|
<script>
|