@tivio/sdk-react 2.1.0 → 2.1.1-alpha1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +3 -0
- package/coverage/clover.xml +113 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +79 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +126 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +170 -0
- package/coverage/lcov-report/src/components/TivioProvider.tsx.html +227 -0
- package/coverage/lcov-report/src/components/TivioWidget.tsx.html +203 -0
- package/coverage/lcov-report/src/components/TivioWidgetError.tsx.html +122 -0
- package/coverage/lcov-report/src/components/TivioWidgetLoader.tsx.html +116 -0
- package/coverage/lcov-report/src/components/index.html +156 -0
- package/coverage/lcov-report/src/conf.ts.html +239 -0
- package/coverage/lcov-report/src/index.html +111 -0
- package/coverage/lcov-report/src/services/bundleLoader.ts.html +698 -0
- package/coverage/lcov-report/src/services/dependencyResolver.ts.html +212 -0
- package/coverage/lcov-report/src/services/index.html +141 -0
- package/coverage/lcov-report/src/services/logger.ts.html +365 -0
- package/coverage/lcov-report/src/services/packageLoader.ts.html +194 -0
- package/coverage/lcov-report/src/services/pubSub.ts.html +242 -0
- package/coverage/lcov-report/src/services/settings.ts.html +218 -0
- package/coverage/lcov-report/src/setupTests.ts.html +158 -0
- package/coverage/lcov.info +175 -0
- package/dist/index.js +1 -1
- package/package.json +5 -4
- package/scripts/prepublish.ts +16 -0
@@ -0,0 +1,365 @@
|
|
1
|
+
|
2
|
+
<!doctype html>
|
3
|
+
<html lang="en">
|
4
|
+
|
5
|
+
<head>
|
6
|
+
<title>Code coverage report for src/services/logger.ts</title>
|
7
|
+
<meta charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../../prettify.css" />
|
9
|
+
<link rel="stylesheet" href="../../base.css" />
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
12
|
+
<style type='text/css'>
|
13
|
+
.coverage-summary .sorter {
|
14
|
+
background-image: url(../../sort-arrow-sprite.png);
|
15
|
+
}
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<div class='wrapper'>
|
21
|
+
<div class='pad1'>
|
22
|
+
<h1><a href="../../index.html">All files</a> / <a href="index.html">src/services</a> logger.ts</h1>
|
23
|
+
<div class='clearfix'>
|
24
|
+
|
25
|
+
<div class='fl pad1y space-right2'>
|
26
|
+
<span class="strong">18.18% </span>
|
27
|
+
<span class="quiet">Statements</span>
|
28
|
+
<span class='fraction'>4/22</span>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
|
32
|
+
<div class='fl pad1y space-right2'>
|
33
|
+
<span class="strong">0% </span>
|
34
|
+
<span class="quiet">Branches</span>
|
35
|
+
<span class='fraction'>0/12</span>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
|
39
|
+
<div class='fl pad1y space-right2'>
|
40
|
+
<span class="strong">0% </span>
|
41
|
+
<span class="quiet">Functions</span>
|
42
|
+
<span class='fraction'>0/7</span>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
|
46
|
+
<div class='fl pad1y space-right2'>
|
47
|
+
<span class="strong">14.29% </span>
|
48
|
+
<span class="quiet">Lines</span>
|
49
|
+
<span class='fraction'>3/21</span>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<p class="quiet">
|
55
|
+
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
56
|
+
</p>
|
57
|
+
</div>
|
58
|
+
<div class='status-line low'></div>
|
59
|
+
<pre><table class="coverage">
|
60
|
+
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
61
|
+
<a name='L2'></a><a href='#L2'>2</a>
|
62
|
+
<a name='L3'></a><a href='#L3'>3</a>
|
63
|
+
<a name='L4'></a><a href='#L4'>4</a>
|
64
|
+
<a name='L5'></a><a href='#L5'>5</a>
|
65
|
+
<a name='L6'></a><a href='#L6'>6</a>
|
66
|
+
<a name='L7'></a><a href='#L7'>7</a>
|
67
|
+
<a name='L8'></a><a href='#L8'>8</a>
|
68
|
+
<a name='L9'></a><a href='#L9'>9</a>
|
69
|
+
<a name='L10'></a><a href='#L10'>10</a>
|
70
|
+
<a name='L11'></a><a href='#L11'>11</a>
|
71
|
+
<a name='L12'></a><a href='#L12'>12</a>
|
72
|
+
<a name='L13'></a><a href='#L13'>13</a>
|
73
|
+
<a name='L14'></a><a href='#L14'>14</a>
|
74
|
+
<a name='L15'></a><a href='#L15'>15</a>
|
75
|
+
<a name='L16'></a><a href='#L16'>16</a>
|
76
|
+
<a name='L17'></a><a href='#L17'>17</a>
|
77
|
+
<a name='L18'></a><a href='#L18'>18</a>
|
78
|
+
<a name='L19'></a><a href='#L19'>19</a>
|
79
|
+
<a name='L20'></a><a href='#L20'>20</a>
|
80
|
+
<a name='L21'></a><a href='#L21'>21</a>
|
81
|
+
<a name='L22'></a><a href='#L22'>22</a>
|
82
|
+
<a name='L23'></a><a href='#L23'>23</a>
|
83
|
+
<a name='L24'></a><a href='#L24'>24</a>
|
84
|
+
<a name='L25'></a><a href='#L25'>25</a>
|
85
|
+
<a name='L26'></a><a href='#L26'>26</a>
|
86
|
+
<a name='L27'></a><a href='#L27'>27</a>
|
87
|
+
<a name='L28'></a><a href='#L28'>28</a>
|
88
|
+
<a name='L29'></a><a href='#L29'>29</a>
|
89
|
+
<a name='L30'></a><a href='#L30'>30</a>
|
90
|
+
<a name='L31'></a><a href='#L31'>31</a>
|
91
|
+
<a name='L32'></a><a href='#L32'>32</a>
|
92
|
+
<a name='L33'></a><a href='#L33'>33</a>
|
93
|
+
<a name='L34'></a><a href='#L34'>34</a>
|
94
|
+
<a name='L35'></a><a href='#L35'>35</a>
|
95
|
+
<a name='L36'></a><a href='#L36'>36</a>
|
96
|
+
<a name='L37'></a><a href='#L37'>37</a>
|
97
|
+
<a name='L38'></a><a href='#L38'>38</a>
|
98
|
+
<a name='L39'></a><a href='#L39'>39</a>
|
99
|
+
<a name='L40'></a><a href='#L40'>40</a>
|
100
|
+
<a name='L41'></a><a href='#L41'>41</a>
|
101
|
+
<a name='L42'></a><a href='#L42'>42</a>
|
102
|
+
<a name='L43'></a><a href='#L43'>43</a>
|
103
|
+
<a name='L44'></a><a href='#L44'>44</a>
|
104
|
+
<a name='L45'></a><a href='#L45'>45</a>
|
105
|
+
<a name='L46'></a><a href='#L46'>46</a>
|
106
|
+
<a name='L47'></a><a href='#L47'>47</a>
|
107
|
+
<a name='L48'></a><a href='#L48'>48</a>
|
108
|
+
<a name='L49'></a><a href='#L49'>49</a>
|
109
|
+
<a name='L50'></a><a href='#L50'>50</a>
|
110
|
+
<a name='L51'></a><a href='#L51'>51</a>
|
111
|
+
<a name='L52'></a><a href='#L52'>52</a>
|
112
|
+
<a name='L53'></a><a href='#L53'>53</a>
|
113
|
+
<a name='L54'></a><a href='#L54'>54</a>
|
114
|
+
<a name='L55'></a><a href='#L55'>55</a>
|
115
|
+
<a name='L56'></a><a href='#L56'>56</a>
|
116
|
+
<a name='L57'></a><a href='#L57'>57</a>
|
117
|
+
<a name='L58'></a><a href='#L58'>58</a>
|
118
|
+
<a name='L59'></a><a href='#L59'>59</a>
|
119
|
+
<a name='L60'></a><a href='#L60'>60</a>
|
120
|
+
<a name='L61'></a><a href='#L61'>61</a>
|
121
|
+
<a name='L62'></a><a href='#L62'>62</a>
|
122
|
+
<a name='L63'></a><a href='#L63'>63</a>
|
123
|
+
<a name='L64'></a><a href='#L64'>64</a>
|
124
|
+
<a name='L65'></a><a href='#L65'>65</a>
|
125
|
+
<a name='L66'></a><a href='#L66'>66</a>
|
126
|
+
<a name='L67'></a><a href='#L67'>67</a>
|
127
|
+
<a name='L68'></a><a href='#L68'>68</a>
|
128
|
+
<a name='L69'></a><a href='#L69'>69</a>
|
129
|
+
<a name='L70'></a><a href='#L70'>70</a>
|
130
|
+
<a name='L71'></a><a href='#L71'>71</a>
|
131
|
+
<a name='L72'></a><a href='#L72'>72</a>
|
132
|
+
<a name='L73'></a><a href='#L73'>73</a>
|
133
|
+
<a name='L74'></a><a href='#L74'>74</a>
|
134
|
+
<a name='L75'></a><a href='#L75'>75</a>
|
135
|
+
<a name='L76'></a><a href='#L76'>76</a>
|
136
|
+
<a name='L77'></a><a href='#L77'>77</a>
|
137
|
+
<a name='L78'></a><a href='#L78'>78</a>
|
138
|
+
<a name='L79'></a><a href='#L79'>79</a>
|
139
|
+
<a name='L80'></a><a href='#L80'>80</a>
|
140
|
+
<a name='L81'></a><a href='#L81'>81</a>
|
141
|
+
<a name='L82'></a><a href='#L82'>82</a>
|
142
|
+
<a name='L83'></a><a href='#L83'>83</a>
|
143
|
+
<a name='L84'></a><a href='#L84'>84</a>
|
144
|
+
<a name='L85'></a><a href='#L85'>85</a>
|
145
|
+
<a name='L86'></a><a href='#L86'>86</a>
|
146
|
+
<a name='L87'></a><a href='#L87'>87</a>
|
147
|
+
<a name='L88'></a><a href='#L88'>88</a>
|
148
|
+
<a name='L89'></a><a href='#L89'>89</a>
|
149
|
+
<a name='L90'></a><a href='#L90'>90</a>
|
150
|
+
<a name='L91'></a><a href='#L91'>91</a>
|
151
|
+
<a name='L92'></a><a href='#L92'>92</a>
|
152
|
+
<a name='L93'></a><a href='#L93'>93</a>
|
153
|
+
<a name='L94'></a><a href='#L94'>94</a>
|
154
|
+
<a name='L95'></a><a href='#L95'>95</a>
|
155
|
+
<a name='L96'></a><a href='#L96'>96</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
156
|
+
<span class="cline-any cline-neutral"> </span>
|
157
|
+
<span class="cline-any cline-neutral"> </span>
|
158
|
+
<span class="cline-any cline-neutral"> </span>
|
159
|
+
<span class="cline-any cline-neutral"> </span>
|
160
|
+
<span class="cline-any cline-neutral"> </span>
|
161
|
+
<span class="cline-any cline-neutral"> </span>
|
162
|
+
<span class="cline-any cline-neutral"> </span>
|
163
|
+
<span class="cline-any cline-neutral"> </span>
|
164
|
+
<span class="cline-any cline-neutral"> </span>
|
165
|
+
<span class="cline-any cline-neutral"> </span>
|
166
|
+
<span class="cline-any cline-neutral"> </span>
|
167
|
+
<span class="cline-any cline-neutral"> </span>
|
168
|
+
<span class="cline-any cline-yes">1x</span>
|
169
|
+
<span class="cline-any cline-neutral"> </span>
|
170
|
+
<span class="cline-any cline-neutral"> </span>
|
171
|
+
<span class="cline-any cline-neutral"> </span>
|
172
|
+
<span class="cline-any cline-neutral"> </span>
|
173
|
+
<span class="cline-any cline-neutral"> </span>
|
174
|
+
<span class="cline-any cline-neutral"> </span>
|
175
|
+
<span class="cline-any cline-neutral"> </span>
|
176
|
+
<span class="cline-any cline-neutral"> </span>
|
177
|
+
<span class="cline-any cline-neutral"> </span>
|
178
|
+
<span class="cline-any cline-neutral"> </span>
|
179
|
+
<span class="cline-any cline-neutral"> </span>
|
180
|
+
<span class="cline-any cline-neutral"> </span>
|
181
|
+
<span class="cline-any cline-neutral"> </span>
|
182
|
+
<span class="cline-any cline-neutral"> </span>
|
183
|
+
<span class="cline-any cline-neutral"> </span>
|
184
|
+
<span class="cline-any cline-neutral"> </span>
|
185
|
+
<span class="cline-any cline-neutral"> </span>
|
186
|
+
<span class="cline-any cline-neutral"> </span>
|
187
|
+
<span class="cline-any cline-neutral"> </span>
|
188
|
+
<span class="cline-any cline-neutral"> </span>
|
189
|
+
<span class="cline-any cline-neutral"> </span>
|
190
|
+
<span class="cline-any cline-neutral"> </span>
|
191
|
+
<span class="cline-any cline-neutral"> </span>
|
192
|
+
<span class="cline-any cline-neutral"> </span>
|
193
|
+
<span class="cline-any cline-yes">1x</span>
|
194
|
+
<span class="cline-any cline-neutral"> </span>
|
195
|
+
<span class="cline-any cline-neutral"> </span>
|
196
|
+
<span class="cline-any cline-neutral"> </span>
|
197
|
+
<span class="cline-any cline-neutral"> </span>
|
198
|
+
<span class="cline-any cline-yes">1x</span>
|
199
|
+
<span class="cline-any cline-no"> </span>
|
200
|
+
<span class="cline-any cline-neutral"> </span>
|
201
|
+
<span class="cline-any cline-no"> </span>
|
202
|
+
<span class="cline-any cline-no"> </span>
|
203
|
+
<span class="cline-any cline-neutral"> </span>
|
204
|
+
<span class="cline-any cline-neutral"> </span>
|
205
|
+
<span class="cline-any cline-neutral"> </span>
|
206
|
+
<span class="cline-any cline-neutral"> </span>
|
207
|
+
<span class="cline-any cline-neutral"> </span>
|
208
|
+
<span class="cline-any cline-neutral"> </span>
|
209
|
+
<span class="cline-any cline-neutral"> </span>
|
210
|
+
<span class="cline-any cline-neutral"> </span>
|
211
|
+
<span class="cline-any cline-neutral"> </span>
|
212
|
+
<span class="cline-any cline-neutral"> </span>
|
213
|
+
<span class="cline-any cline-neutral"> </span>
|
214
|
+
<span class="cline-any cline-no"> </span>
|
215
|
+
<span class="cline-any cline-no"> </span>
|
216
|
+
<span class="cline-any cline-no"> </span>
|
217
|
+
<span class="cline-any cline-neutral"> </span>
|
218
|
+
<span class="cline-any cline-neutral"> </span>
|
219
|
+
<span class="cline-any cline-no"> </span>
|
220
|
+
<span class="cline-any cline-no"> </span>
|
221
|
+
<span class="cline-any cline-neutral"> </span>
|
222
|
+
<span class="cline-any cline-neutral"> </span>
|
223
|
+
<span class="cline-any cline-neutral"> </span>
|
224
|
+
<span class="cline-any cline-no"> </span>
|
225
|
+
<span class="cline-any cline-no"> </span>
|
226
|
+
<span class="cline-any cline-no"> </span>
|
227
|
+
<span class="cline-any cline-neutral"> </span>
|
228
|
+
<span class="cline-any cline-neutral"> </span>
|
229
|
+
<span class="cline-any cline-no"> </span>
|
230
|
+
<span class="cline-any cline-no"> </span>
|
231
|
+
<span class="cline-any cline-neutral"> </span>
|
232
|
+
<span class="cline-any cline-neutral"> </span>
|
233
|
+
<span class="cline-any cline-neutral"> </span>
|
234
|
+
<span class="cline-any cline-no"> </span>
|
235
|
+
<span class="cline-any cline-neutral"> </span>
|
236
|
+
<span class="cline-any cline-no"> </span>
|
237
|
+
<span class="cline-any cline-neutral"> </span>
|
238
|
+
<span class="cline-any cline-neutral"> </span>
|
239
|
+
<span class="cline-any cline-no"> </span>
|
240
|
+
<span class="cline-any cline-neutral"> </span>
|
241
|
+
<span class="cline-any cline-neutral"> </span>
|
242
|
+
<span class="cline-any cline-no"> </span>
|
243
|
+
<span class="cline-any cline-neutral"> </span>
|
244
|
+
<span class="cline-any cline-neutral"> </span>
|
245
|
+
<span class="cline-any cline-no"> </span>
|
246
|
+
<span class="cline-any cline-neutral"> </span>
|
247
|
+
<span class="cline-any cline-neutral"> </span>
|
248
|
+
<span class="cline-any cline-neutral"> </span>
|
249
|
+
<span class="cline-any cline-neutral"> </span>
|
250
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
251
|
+
* Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
|
252
|
+
* nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
253
|
+
*/
|
254
|
+
|
255
|
+
/**
|
256
|
+
* Logger with Sentry support
|
257
|
+
*
|
258
|
+
* @remarks
|
259
|
+
* The purpose of this package is not to be a general logger.
|
260
|
+
* The purpose is tracking of important events with Sentry service.
|
261
|
+
*/
|
262
|
+
|
263
|
+
import * as Sentry from '@sentry/browser'
|
264
|
+
|
265
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
266
|
+
export type LoggerArgs = any[]
|
267
|
+
|
268
|
+
export interface Logger {
|
269
|
+
/** important messages */
|
270
|
+
warn(...data: LoggerArgs): void;
|
271
|
+
/** errors */
|
272
|
+
error(...data: LoggerArgs): void;
|
273
|
+
/** critical errors */
|
274
|
+
exception(...data: LoggerArgs): void;
|
275
|
+
/** metrics */
|
276
|
+
info(...data: LoggerArgs): void;
|
277
|
+
/** non-production messages */
|
278
|
+
debug(...data: LoggerArgs): void;
|
279
|
+
}
|
280
|
+
|
281
|
+
export type LoggerConf = {
|
282
|
+
isConsoleEnabled: boolean
|
283
|
+
isSentryEnabled: boolean
|
284
|
+
}
|
285
|
+
|
286
|
+
export type Severity = 'warn' | 'error' | 'exception' | 'info' | 'debug'
|
287
|
+
|
288
|
+
const SENTRY_DNS = process.env.SENTRY_DNS
|
289
|
+
|
290
|
+
/**
|
291
|
+
* Factory
|
292
|
+
**/
|
293
|
+
export const createLogger = <span class="fstat-no" title="function not covered" >(c</span>onf: LoggerConf): Logger => {
|
294
|
+
const isSentryAvailable = <span class="cstat-no" title="statement not covered" >conf.isSentryEnabled && !!SENTRY_DNS</span>
|
295
|
+
|
296
|
+
<span class="cstat-no" title="statement not covered" > if (isSentryAvailable) {</span>
|
297
|
+
<span class="cstat-no" title="statement not covered" > Sentry.init({</span>
|
298
|
+
dsn: SENTRY_DNS,
|
299
|
+
release: `@tivio/sdk-react@${process.env.VERSION}`,
|
300
|
+
|
301
|
+
// Set tracesSampleRate to 1.0 to capture 100%
|
302
|
+
// of transactions for performance monitoring.
|
303
|
+
// We recommend adjusting this value in production
|
304
|
+
tracesSampleRate: 1.0,
|
305
|
+
|
306
|
+
})
|
307
|
+
}
|
308
|
+
|
309
|
+
const log = <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >(s</span>everity: Severity, messages: LoggerArgs) => {</span>
|
310
|
+
<span class="cstat-no" title="statement not covered" > if (conf.isConsoleEnabled) {</span>
|
311
|
+
<span class="cstat-no" title="statement not covered" > console[severity]('Tivio SDK ', ...messages)</span>
|
312
|
+
}
|
313
|
+
|
314
|
+
<span class="cstat-no" title="statement not covered" > if (isSentryAvailable) {</span>
|
315
|
+
<span class="cstat-no" title="statement not covered" > Sentry.captureMessage(`${messages}`, Sentry.Severity.fromString(severity))</span>
|
316
|
+
}
|
317
|
+
}
|
318
|
+
|
319
|
+
const exception = <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >(e</span>rror: Error) => {</span>
|
320
|
+
<span class="cstat-no" title="statement not covered" > if (conf.isConsoleEnabled) {</span>
|
321
|
+
<span class="cstat-no" title="statement not covered" > console.error(error)</span>
|
322
|
+
}
|
323
|
+
|
324
|
+
<span class="cstat-no" title="statement not covered" > if (isSentryAvailable) {</span>
|
325
|
+
<span class="cstat-no" title="statement not covered" > Sentry.captureException(error)</span>
|
326
|
+
}
|
327
|
+
}
|
328
|
+
|
329
|
+
<span class="cstat-no" title="statement not covered" > return {</span>
|
330
|
+
error: <span class="fstat-no" title="function not covered" >(.</span>..args: LoggerArgs) => {
|
331
|
+
<span class="cstat-no" title="statement not covered" > log('error', args)</span>
|
332
|
+
},
|
333
|
+
info: <span class="fstat-no" title="function not covered" >(.</span>..args: LoggerArgs) => {
|
334
|
+
<span class="cstat-no" title="statement not covered" > log('info', args)</span>
|
335
|
+
},
|
336
|
+
warn: <span class="fstat-no" title="function not covered" >(.</span>..args: LoggerArgs) => {
|
337
|
+
<span class="cstat-no" title="statement not covered" > log('warn', args)</span>
|
338
|
+
},
|
339
|
+
debug: <span class="fstat-no" title="function not covered" >(.</span>..args: LoggerArgs) => {
|
340
|
+
<span class="cstat-no" title="statement not covered" > log('debug', args)</span>
|
341
|
+
},
|
342
|
+
exception,
|
343
|
+
}
|
344
|
+
}
|
345
|
+
</pre></td></tr></table></pre>
|
346
|
+
|
347
|
+
<div class='push'></div><!-- for sticky footer -->
|
348
|
+
</div><!-- /wrapper -->
|
349
|
+
<div class='footer quiet pad2 space-top1 center small'>
|
350
|
+
Code coverage generated by
|
351
|
+
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
352
|
+
at Fri Apr 30 2021 12:16:39 GMT+0200 (Central European Summer Time)
|
353
|
+
</div>
|
354
|
+
</div>
|
355
|
+
<script src="../../prettify.js"></script>
|
356
|
+
<script>
|
357
|
+
window.onload = function () {
|
358
|
+
prettyPrint();
|
359
|
+
};
|
360
|
+
</script>
|
361
|
+
<script src="../../sorter.js"></script>
|
362
|
+
<script src="../../block-navigation.js"></script>
|
363
|
+
</body>
|
364
|
+
</html>
|
365
|
+
|
@@ -0,0 +1,194 @@
|
|
1
|
+
|
2
|
+
<!doctype html>
|
3
|
+
<html lang="en">
|
4
|
+
|
5
|
+
<head>
|
6
|
+
<title>Code coverage report for src/services/packageLoader.ts</title>
|
7
|
+
<meta charset="utf-8" />
|
8
|
+
<link rel="stylesheet" href="../../prettify.css" />
|
9
|
+
<link rel="stylesheet" href="../../base.css" />
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
12
|
+
<style type='text/css'>
|
13
|
+
.coverage-summary .sorter {
|
14
|
+
background-image: url(../../sort-arrow-sprite.png);
|
15
|
+
}
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<div class='wrapper'>
|
21
|
+
<div class='pad1'>
|
22
|
+
<h1><a href="../../index.html">All files</a> / <a href="index.html">src/services</a> packageLoader.ts</h1>
|
23
|
+
<div class='clearfix'>
|
24
|
+
|
25
|
+
<div class='fl pad1y space-right2'>
|
26
|
+
<span class="strong">38.46% </span>
|
27
|
+
<span class="quiet">Statements</span>
|
28
|
+
<span class='fraction'>5/13</span>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
|
32
|
+
<div class='fl pad1y space-right2'>
|
33
|
+
<span class="strong">0% </span>
|
34
|
+
<span class="quiet">Branches</span>
|
35
|
+
<span class='fraction'>0/7</span>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
|
39
|
+
<div class='fl pad1y space-right2'>
|
40
|
+
<span class="strong">0% </span>
|
41
|
+
<span class="quiet">Functions</span>
|
42
|
+
<span class='fraction'>0/3</span>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
|
46
|
+
<div class='fl pad1y space-right2'>
|
47
|
+
<span class="strong">36.36% </span>
|
48
|
+
<span class="quiet">Lines</span>
|
49
|
+
<span class='fraction'>4/11</span>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<p class="quiet">
|
55
|
+
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
56
|
+
</p>
|
57
|
+
</div>
|
58
|
+
<div class='status-line low'></div>
|
59
|
+
<pre><table class="coverage">
|
60
|
+
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
61
|
+
<a name='L2'></a><a href='#L2'>2</a>
|
62
|
+
<a name='L3'></a><a href='#L3'>3</a>
|
63
|
+
<a name='L4'></a><a href='#L4'>4</a>
|
64
|
+
<a name='L5'></a><a href='#L5'>5</a>
|
65
|
+
<a name='L6'></a><a href='#L6'>6</a>
|
66
|
+
<a name='L7'></a><a href='#L7'>7</a>
|
67
|
+
<a name='L8'></a><a href='#L8'>8</a>
|
68
|
+
<a name='L9'></a><a href='#L9'>9</a>
|
69
|
+
<a name='L10'></a><a href='#L10'>10</a>
|
70
|
+
<a name='L11'></a><a href='#L11'>11</a>
|
71
|
+
<a name='L12'></a><a href='#L12'>12</a>
|
72
|
+
<a name='L13'></a><a href='#L13'>13</a>
|
73
|
+
<a name='L14'></a><a href='#L14'>14</a>
|
74
|
+
<a name='L15'></a><a href='#L15'>15</a>
|
75
|
+
<a name='L16'></a><a href='#L16'>16</a>
|
76
|
+
<a name='L17'></a><a href='#L17'>17</a>
|
77
|
+
<a name='L18'></a><a href='#L18'>18</a>
|
78
|
+
<a name='L19'></a><a href='#L19'>19</a>
|
79
|
+
<a name='L20'></a><a href='#L20'>20</a>
|
80
|
+
<a name='L21'></a><a href='#L21'>21</a>
|
81
|
+
<a name='L22'></a><a href='#L22'>22</a>
|
82
|
+
<a name='L23'></a><a href='#L23'>23</a>
|
83
|
+
<a name='L24'></a><a href='#L24'>24</a>
|
84
|
+
<a name='L25'></a><a href='#L25'>25</a>
|
85
|
+
<a name='L26'></a><a href='#L26'>26</a>
|
86
|
+
<a name='L27'></a><a href='#L27'>27</a>
|
87
|
+
<a name='L28'></a><a href='#L28'>28</a>
|
88
|
+
<a name='L29'></a><a href='#L29'>29</a>
|
89
|
+
<a name='L30'></a><a href='#L30'>30</a>
|
90
|
+
<a name='L31'></a><a href='#L31'>31</a>
|
91
|
+
<a name='L32'></a><a href='#L32'>32</a>
|
92
|
+
<a name='L33'></a><a href='#L33'>33</a>
|
93
|
+
<a name='L34'></a><a href='#L34'>34</a>
|
94
|
+
<a name='L35'></a><a href='#L35'>35</a>
|
95
|
+
<a name='L36'></a><a href='#L36'>36</a>
|
96
|
+
<a name='L37'></a><a href='#L37'>37</a>
|
97
|
+
<a name='L38'></a><a href='#L38'>38</a>
|
98
|
+
<a name='L39'></a><a href='#L39'>39</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
99
|
+
<span class="cline-any cline-neutral"> </span>
|
100
|
+
<span class="cline-any cline-neutral"> </span>
|
101
|
+
<span class="cline-any cline-neutral"> </span>
|
102
|
+
<span class="cline-any cline-neutral"> </span>
|
103
|
+
<span class="cline-any cline-neutral"> </span>
|
104
|
+
<span class="cline-any cline-neutral"> </span>
|
105
|
+
<span class="cline-any cline-neutral"> </span>
|
106
|
+
<span class="cline-any cline-neutral"> </span>
|
107
|
+
<span class="cline-any cline-neutral"> </span>
|
108
|
+
<span class="cline-any cline-neutral"> </span>
|
109
|
+
<span class="cline-any cline-yes">1x</span>
|
110
|
+
<span class="cline-any cline-neutral"> </span>
|
111
|
+
<span class="cline-any cline-neutral"> </span>
|
112
|
+
<span class="cline-any cline-neutral"> </span>
|
113
|
+
<span class="cline-any cline-yes">1x</span>
|
114
|
+
<span class="cline-any cline-no"> </span>
|
115
|
+
<span class="cline-any cline-neutral"> </span>
|
116
|
+
<span class="cline-any cline-no"> </span>
|
117
|
+
<span class="cline-any cline-no"> </span>
|
118
|
+
<span class="cline-any cline-neutral"> </span>
|
119
|
+
<span class="cline-any cline-neutral"> </span>
|
120
|
+
<span class="cline-any cline-no"> </span>
|
121
|
+
<span class="cline-any cline-neutral"> </span>
|
122
|
+
<span class="cline-any cline-neutral"> </span>
|
123
|
+
<span class="cline-any cline-no"> </span>
|
124
|
+
<span class="cline-any cline-neutral"> </span>
|
125
|
+
<span class="cline-any cline-neutral"> </span>
|
126
|
+
<span class="cline-any cline-no"> </span>
|
127
|
+
<span class="cline-any cline-neutral"> </span>
|
128
|
+
<span class="cline-any cline-neutral"> </span>
|
129
|
+
<span class="cline-any cline-yes">1x</span>
|
130
|
+
<span class="cline-any cline-no"> </span>
|
131
|
+
<span class="cline-any cline-neutral"> </span>
|
132
|
+
<span class="cline-any cline-neutral"> </span>
|
133
|
+
<span class="cline-any cline-yes">1x</span>
|
134
|
+
<span class="cline-any cline-neutral"> </span>
|
135
|
+
<span class="cline-any cline-neutral"> </span>
|
136
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
137
|
+
* Copyright (c) 2021, nangu.TV, a.s. All rights reserved.
|
138
|
+
* nangu.TV, a.s PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
139
|
+
*/
|
140
|
+
|
141
|
+
/**
|
142
|
+
* Source code downloader service.
|
143
|
+
* This package has technical responsibility only for the network infrastructure.
|
144
|
+
*/
|
145
|
+
|
146
|
+
// do not cache Tivio Bundle
|
147
|
+
const FETCH_OPT = { cache: 'no-store' as const }
|
148
|
+
|
149
|
+
export type FetchPackage = (url: string) => Promise<string>
|
150
|
+
|
151
|
+
const packageResponseHandler = <span class="fstat-no" title="function not covered" >(r</span>esponse: Response): Promise<string> => {
|
152
|
+
const contentType = <span class="cstat-no" title="statement not covered" >response.headers.get('content-type')</span>
|
153
|
+
|
154
|
+
<span class="cstat-no" title="statement not covered" > if (response.status !== 200) {</span>
|
155
|
+
<span class="cstat-no" title="statement not covered" > return Promise.reject(`Incorrect status "${response.status}" was obtained while fetching the module.`)</span>
|
156
|
+
}
|
157
|
+
|
158
|
+
<span class="cstat-no" title="statement not covered" > if (!contentType ||</span>
|
159
|
+
(!contentType.includes('application/javascript') && !contentType.includes('text/javascript'))
|
160
|
+
) {
|
161
|
+
<span class="cstat-no" title="statement not covered" > return Promise.reject(`Incorrect content "${contentType}" was obtained while fetching the module.`)</span>
|
162
|
+
}
|
163
|
+
|
164
|
+
<span class="cstat-no" title="statement not covered" > return response.text()</span>
|
165
|
+
}
|
166
|
+
|
167
|
+
const packageResponseErrorHandler = <span class="fstat-no" title="function not covered" >(e</span>rror: Error): Promise<never> => {
|
168
|
+
<span class="cstat-no" title="statement not covered" > return Promise.reject(`Network failure: ${error}`)</span>
|
169
|
+
}
|
170
|
+
|
171
|
+
export const fetchPackage: FetchPackage = <span class="fstat-no" title="function not covered" >async </span>(url: string): Promise<string> => <span class="cstat-no" title="statement not covered" >fetch(url, FETCH_OPT)</span>
|
172
|
+
.then(packageResponseHandler)
|
173
|
+
.catch(packageResponseErrorHandler)
|
174
|
+
</pre></td></tr></table></pre>
|
175
|
+
|
176
|
+
<div class='push'></div><!-- for sticky footer -->
|
177
|
+
</div><!-- /wrapper -->
|
178
|
+
<div class='footer quiet pad2 space-top1 center small'>
|
179
|
+
Code coverage generated by
|
180
|
+
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
181
|
+
at Fri Apr 30 2021 12:16:39 GMT+0200 (Central European Summer Time)
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
<script src="../../prettify.js"></script>
|
185
|
+
<script>
|
186
|
+
window.onload = function () {
|
187
|
+
prettyPrint();
|
188
|
+
};
|
189
|
+
</script>
|
190
|
+
<script src="../../sorter.js"></script>
|
191
|
+
<script src="../../block-navigation.js"></script>
|
192
|
+
</body>
|
193
|
+
</html>
|
194
|
+
|