manner.js 1.0.45 → 1.1.0
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/client/class/ClientFetch.js +1 -0
- package/client/index.js +1 -0
- package/client/lib/clearCookie.js +1 -0
- package/client/lib/filterNamespace.js +1 -0
- package/client/lib/readCookie.js +1 -0
- package/client/lib/setCookie.js +1 -0
- package/coverage/clover.xml +78 -87
- package/coverage/coverage-final.json +4 -6
- package/coverage/lcov-report/class/Blocks.js.html +1 -1
- package/coverage/lcov-report/class/ByteArray.js.html +286 -0
- package/coverage/lcov-report/class/MultiFetch.js.html +38 -11
- package/coverage/lcov-report/class/Prevents.js.html +18 -18
- package/coverage/lcov-report/class/Tackles.js.html +1 -1
- package/coverage/lcov-report/class/index.html +38 -23
- package/coverage/lcov-report/index.html +29 -29
- package/coverage/lcov-report/lib/byteArray.js.html +1 -1
- package/coverage/lcov-report/lib/errorHandle.js.html +1 -1
- package/coverage/lcov-report/lib/formatHttpDate.js.html +1 -1
- package/coverage/lcov-report/lib/formatHttpKey.js.html +1 -1
- package/coverage/lcov-report/lib/getDateString.js.html +1 -1
- package/coverage/lcov-report/lib/getOwnIpAddresses.js.html +1 -1
- package/coverage/lcov-report/lib/index.html +9 -54
- package/coverage/lcov-report/lib/isIntranetIpv4Address.js.html +1 -1
- package/coverage/lcov-report/lib/isIpv6Address.js.html +4 -4
- package/coverage/lcov-report/lib/nonZeroByteArray.js.html +1 -1
- package/coverage/lcov-report/lib/parseHttpDate.js.html +1 -1
- package/coverage/lcov-report/lib/wrapIpv6.js.html +1 -1
- package/coverage/lcov.info +167 -181
- package/package.json +3 -3
- package/server/class/Blocks.js +1 -0
- package/server/class/ByteArray.js +1 -0
- package/server/class/MultiFetch.js +1 -0
- package/server/class/Prevents.js +1 -0
- package/server/class/Tackles.js +1 -0
- package/server/index.js +1 -0
- package/server/lib/addToLog.js +1 -0
- package/server/lib/appendToLog.js +1 -0
- package/server/lib/byteArray.js +1 -0
- package/server/lib/checkLogPath.js +1 -0
- package/server/lib/discHndl.js +1 -0
- package/server/lib/errorHandle.js +1 -0
- package/server/lib/formatHttpDate.js +1 -0
- package/server/lib/formatHttpKey.js +1 -0
- package/server/lib/getDateString.js +1 -0
- package/server/lib/getGTMNowString.js +1 -0
- package/server/lib/getOwnIpAddresses.js +1 -0
- package/server/lib/isIntranetIpv4Address.js +1 -0
- package/server/lib/isIpv6Address.js +1 -0
- package/server/lib/logOutOfMemory.js +1 -0
- package/server/lib/nonZeroByteArray.js +1 -0
- package/server/lib/parseHttpDate.js +1 -0
- package/server/lib/readCookie.js +1 -0
- package/server/lib/wrapIpv6.js +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;class ClientFetch{constructor(t){this.options=Object.assign({timeout:9e3},t),this.dealOptions(),this.filters={},this.hasTimeout=!0,this.idx=0,this.abortControllers=[]}dealOptions(){var{timeout:t}=this.options;if(!Number.isInteger(t))throw new Error("[Error] The option timeout should be of integer type.");if(!(0<t))throw new Error("[Error] The option timeout should be a positive integer.")}setHasTimeout(t){if("boolean"!=typeof t)throw new Error("[Error] The parameter has a timeout and needs to be a boolean type.");this.hasTimeout=t}addFilter(t,e){if(!(Number.isInteger(t)&&0<=t))throw new Error("[Error] The parameter status code should be a positive integer type.");if("function"!=typeof e)throw new Error("[Error] The parameter callback should be of function type.");var r=this.filters;if(void 0!==r[t])throw new Error("[Error] The current status code has been bound.");r[t]=e}renew(){var t=this.abortControllers;t.forEach(t=>{void 0!==t&&t.abort()}),this.idx=0,this.abortControllers=[]}async fetch(t,e){var r,o=new AbortController,i=this.idx,a=(this.abortControllers[i]=o,this.idx+=1,this).hasTimeout;let s;if(!0===a)try{s=void 0!==e?(l=e.ownSignals,Array.isArray(l)?({timeout:h}=this.options,await fetch(t,{signal:AbortSignal.any([AbortSignal.timeout(h),o.signal,...l]),...e})):({timeout:u}=this.options,await fetch(t,{signal:AbortSignal.any([AbortSignal.timeout(u),o.signal]),...e}))):({timeout:r}=this.options,await fetch(t,{signal:AbortSignal.any([AbortSignal.timeout(r),o.signal])}))}catch(t){a=t.name;switch(a){case"AbortError":case"TimeoutError":var n=this.filters;await n[512](s);break;default:throw new Error("[Error] Unexpected exception occurred.")}}else s=void 0!==e&&"object"==typeof e?await fetch(t,{...e,headers:{"Has-Timeout":"false"}}):await fetch(t,{headers:{"Has-Timeout":"false"}});if(void 0!==s){if(s.ok)return this.abortControllers[i]=void 0,s;var h=s.status,l=this.filters,u=l[h];if("function"!=typeof u)throw new Error("[Error] Receive an exception from the server.");await u(s)}}}var _default=exports.default=ClientFetch;
|
package/client/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ClientFetch",{enumerable:!0,get:function(){return _ClientFetch.default}}),Object.defineProperty(exports,"clearCookie",{enumerable:!0,get:function(){return _clearCookie.default}}),Object.defineProperty(exports,"filterNamespace",{enumerable:!0,get:function(){return _filterNamespace.default}}),Object.defineProperty(exports,"readCookie",{enumerable:!0,get:function(){return _readCookie.default}}),Object.defineProperty(exports,"setCookie",{enumerable:!0,get:function(){return _setCookie.default}});var _ClientFetch=_interopRequireDefault(require("./class/ClientFetch")),_clearCookie=_interopRequireDefault(require("./lib/clearCookie")),_setCookie=_interopRequireDefault(require("./lib/setCookie")),_readCookie=_interopRequireDefault(require("./lib/readCookie")),_filterNamespace=_interopRequireDefault(require("./lib/filterNamespace"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function clearCookie(e){return Object.keys(e).forEach(o=>{void 0!==o.expires&&(Object.keys(o).forEach(e=>{"user"===o&&(document.cookie[o+"_"+e]=""),window.localStorage.removeItem(o+"_"+e)}),delete e[o])}),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=clearCookie;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function filterNamespace(t){let r={};return Object.keys(t).forEach(e=>{"expires"!==e&&(r[e]=t[e])}),r}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=filterNamespace;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=readCookie;var _clearCookie=_interopRequireDefault(require("./clearCookie"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function readCookie(){let r={},l=(document.cookie.split(";").forEach(e=>{var[e,o]=e.split("=");r[e.trim()]=o}),{});Object.keys(r).forEach(e=>{var o,t=e.split("_");2===t.length&&([t,o]=t,void 0===l[t]&&(l[t]={}),l[t][o]=r[e])});for(let e=0;e<window.localStorage.length;e+=1){var o,t=window.localStorage.key(e),i=t.split("_");2===i.length&&([i,o]=i,void 0===l[i]&&(l[i]={}),l[i][o]=window.localStorage.getItem(t))}return(0,_clearCookie.default)(l)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function setCookie(e){e=e.headers.get("cookie");null!==e&&(""===e?document.cookie.split(";").forEach(e=>{var[e,o]=e.split("="),[t]=e.split("_");"user"===t&&(document.cookie=e+"="+o),window.localStorage.set(e,o)}):e.split(";").forEach(e=>{document.cookie=e}))}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=setCookie;
|
package/coverage/clover.xml
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="
|
|
3
|
-
<project timestamp="
|
|
4
|
-
<metrics statements="
|
|
2
|
+
<coverage generated="1781860254033" clover="3.2.0">
|
|
3
|
+
<project timestamp="1781860254033" name="All files">
|
|
4
|
+
<metrics statements="271" coveredstatements="190" conditionals="156" coveredconditionals="87" methods="31" coveredmethods="29" elements="458" coveredelements="306" complexity="0" loc="271" ncloc="271" packages="2" files="13" classes="13"/>
|
|
5
5
|
<package name="class">
|
|
6
|
-
<metrics statements="
|
|
6
|
+
<metrics statements="164" coveredstatements="111" conditionals="96" coveredconditionals="46" methods="21" coveredmethods="19"/>
|
|
7
7
|
<file name="Blocks.js" path="/Users/eric/Manner.js/manner.js/src/server/class/Blocks.js">
|
|
8
8
|
<metrics statements="34" coveredstatements="27" conditionals="18" coveredconditionals="11" methods="5" coveredmethods="5"/>
|
|
9
9
|
<line num="7" count="2" type="stmt"/>
|
|
@@ -41,51 +41,87 @@
|
|
|
41
41
|
<line num="57" count="7" type="stmt"/>
|
|
42
42
|
<line num="59" count="0" type="stmt"/>
|
|
43
43
|
</file>
|
|
44
|
+
<file name="ByteArray.js" path="/Users/eric/Manner.js/manner.js/src/server/class/ByteArray.js">
|
|
45
|
+
<metrics statements="27" coveredstatements="23" conditionals="11" coveredconditionals="5" methods="4" coveredmethods="4"/>
|
|
46
|
+
<line num="3" count="2" type="stmt"/>
|
|
47
|
+
<line num="7" count="2" type="stmt"/>
|
|
48
|
+
<line num="8" count="2" type="stmt"/>
|
|
49
|
+
<line num="17" count="2" type="stmt"/>
|
|
50
|
+
<line num="18" count="2" type="cond" truecount="1" falsecount="1"/>
|
|
51
|
+
<line num="19" count="0" type="stmt"/>
|
|
52
|
+
<line num="21" count="2" type="cond" truecount="1" falsecount="1"/>
|
|
53
|
+
<line num="22" count="0" type="stmt"/>
|
|
54
|
+
<line num="24" count="2" type="cond" truecount="1" falsecount="1"/>
|
|
55
|
+
<line num="25" count="0" type="stmt"/>
|
|
56
|
+
<line num="27" count="2" type="cond" truecount="1" falsecount="1"/>
|
|
57
|
+
<line num="28" count="0" type="stmt"/>
|
|
58
|
+
<line num="38" count="2" type="stmt"/>
|
|
59
|
+
<line num="39" count="2" type="stmt"/>
|
|
60
|
+
<line num="40" count="2" type="stmt"/>
|
|
61
|
+
<line num="41" count="2" type="cond" truecount="1" falsecount="1"/>
|
|
62
|
+
<line num="42" count="2" type="stmt"/>
|
|
63
|
+
<line num="43" count="6" type="stmt"/>
|
|
64
|
+
<line num="44" count="6" type="stmt"/>
|
|
65
|
+
<line num="45" count="6" type="stmt"/>
|
|
66
|
+
<line num="48" count="2" type="stmt"/>
|
|
67
|
+
<line num="49" count="2" type="stmt"/>
|
|
68
|
+
<line num="58" count="2" type="stmt"/>
|
|
69
|
+
<line num="59" count="2" type="stmt"/>
|
|
70
|
+
<line num="60" count="2" type="stmt"/>
|
|
71
|
+
<line num="61" count="8" type="stmt"/>
|
|
72
|
+
<line num="63" count="2" type="stmt"/>
|
|
73
|
+
</file>
|
|
44
74
|
<file name="MultiFetch.js" path="/Users/eric/Manner.js/manner.js/src/server/class/MultiFetch.js">
|
|
45
|
-
<metrics statements="
|
|
75
|
+
<metrics statements="36" coveredstatements="21" conditionals="25" coveredconditionals="10" methods="4" coveredmethods="4"/>
|
|
46
76
|
<line num="9" count="1" type="stmt"/>
|
|
47
77
|
<line num="10" count="1" type="stmt"/>
|
|
48
|
-
<line num="11" count="1" type="
|
|
49
|
-
<line num="12" count="
|
|
50
|
-
<line num="
|
|
51
|
-
<line num="
|
|
52
|
-
<line num="
|
|
53
|
-
<line num="
|
|
54
|
-
<line num="
|
|
55
|
-
<line num="
|
|
56
|
-
<line num="
|
|
57
|
-
<line num="
|
|
58
|
-
<line num="
|
|
59
|
-
<line num="
|
|
60
|
-
<line num="
|
|
61
|
-
<line num="
|
|
62
|
-
<line num="
|
|
63
|
-
<line num="
|
|
64
|
-
<line num="
|
|
65
|
-
<line num="
|
|
66
|
-
<line num="
|
|
67
|
-
<line num="
|
|
68
|
-
<line num="
|
|
69
|
-
<line num="
|
|
70
|
-
<line num="
|
|
71
|
-
<line num="
|
|
72
|
-
<line num="
|
|
73
|
-
<line num="
|
|
74
|
-
<line num="
|
|
75
|
-
<line num="
|
|
76
|
-
<line num="
|
|
77
|
-
<line num="
|
|
78
|
-
<line num="
|
|
79
|
-
<line num="
|
|
78
|
+
<line num="11" count="1" type="cond" truecount="1" falsecount="1"/>
|
|
79
|
+
<line num="12" count="0" type="stmt"/>
|
|
80
|
+
<line num="14" count="1" type="stmt"/>
|
|
81
|
+
<line num="22" count="1" type="stmt"/>
|
|
82
|
+
<line num="23" count="1" type="stmt"/>
|
|
83
|
+
<line num="27" count="1" type="cond" truecount="1" falsecount="1"/>
|
|
84
|
+
<line num="28" count="0" type="stmt"/>
|
|
85
|
+
<line num="29" count="0" type="stmt"/>
|
|
86
|
+
<line num="30" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
87
|
+
<line num="31" count="0" type="stmt"/>
|
|
88
|
+
<line num="34" count="1" type="cond" truecount="1" falsecount="1"/>
|
|
89
|
+
<line num="35" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
90
|
+
<line num="36" count="0" type="stmt"/>
|
|
91
|
+
<line num="38" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
92
|
+
<line num="39" count="0" type="stmt"/>
|
|
93
|
+
<line num="45" count="20" type="cond" truecount="1" falsecount="1"/>
|
|
94
|
+
<line num="46" count="0" type="stmt"/>
|
|
95
|
+
<line num="48" count="20" type="cond" truecount="1" falsecount="1"/>
|
|
96
|
+
<line num="49" count="0" type="stmt"/>
|
|
97
|
+
<line num="51" count="20" type="stmt"/>
|
|
98
|
+
<line num="52" count="20" type="cond" truecount="1" falsecount="1"/>
|
|
99
|
+
<line num="53" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
100
|
+
<line num="54" count="0" type="stmt"/>
|
|
101
|
+
<line num="57" count="20" type="stmt"/>
|
|
102
|
+
<line num="58" count="20" type="cond" truecount="2" falsecount="0"/>
|
|
103
|
+
<line num="59" count="15" type="stmt"/>
|
|
104
|
+
<line num="61" count="5" type="stmt"/>
|
|
105
|
+
<line num="63" count="20" type="stmt"/>
|
|
106
|
+
<line num="64" count="20" type="stmt"/>
|
|
107
|
+
<line num="65" count="20" type="cond" truecount="1" falsecount="1"/>
|
|
108
|
+
<line num="66" count="0" type="stmt"/>
|
|
109
|
+
<line num="67" count="0" type="stmt"/>
|
|
110
|
+
<line num="69" count="20" type="stmt"/>
|
|
111
|
+
<line num="70" count="20" type="stmt"/>
|
|
80
112
|
</file>
|
|
81
113
|
<file name="Prevents.js" path="/Users/eric/Manner.js/manner.js/src/server/class/Prevents.js">
|
|
82
|
-
<metrics statements="
|
|
114
|
+
<metrics statements="50" coveredstatements="32" conditionals="32" coveredconditionals="16" methods="5" coveredmethods="4"/>
|
|
83
115
|
<line num="9" count="1" type="stmt"/>
|
|
84
116
|
<line num="10" count="1" type="stmt"/>
|
|
85
117
|
<line num="11" count="1" type="stmt"/>
|
|
86
118
|
<line num="12" count="1" type="stmt"/>
|
|
119
|
+
<line num="16" count="1" type="cond" truecount="1" falsecount="1"/>
|
|
120
|
+
<line num="17" count="0" type="stmt"/>
|
|
87
121
|
<line num="19" count="1" type="cond" truecount="1" falsecount="1"/>
|
|
88
122
|
<line num="20" count="0" type="stmt"/>
|
|
123
|
+
<line num="22" count="1" type="cond" truecount="1" falsecount="1"/>
|
|
124
|
+
<line num="23" count="0" type="stmt"/>
|
|
89
125
|
<line num="25" count="1" type="cond" truecount="1" falsecount="1"/>
|
|
90
126
|
<line num="26" count="0" type="stmt"/>
|
|
91
127
|
<line num="31" count="3" type="cond" truecount="1" falsecount="1"/>
|
|
@@ -149,34 +185,7 @@
|
|
|
149
185
|
</file>
|
|
150
186
|
</package>
|
|
151
187
|
<package name="lib">
|
|
152
|
-
<metrics statements="
|
|
153
|
-
<file name="byteArray.js" path="/Users/eric/Manner.js/manner.js/src/server/lib/byteArray.js">
|
|
154
|
-
<metrics statements="14" coveredstatements="14" conditionals="2" coveredconditionals="1" methods="2" coveredmethods="2"/>
|
|
155
|
-
<line num="1" count="1" type="stmt"/>
|
|
156
|
-
<line num="4" count="1" type="stmt"/>
|
|
157
|
-
<line num="5" count="1" type="stmt"/>
|
|
158
|
-
<line num="6" count="1" type="cond" truecount="1" falsecount="1"/>
|
|
159
|
-
<line num="7" count="1" type="stmt"/>
|
|
160
|
-
<line num="8" count="3" type="stmt"/>
|
|
161
|
-
<line num="9" count="3" type="stmt"/>
|
|
162
|
-
<line num="10" count="3" type="stmt"/>
|
|
163
|
-
<line num="13" count="1" type="stmt"/>
|
|
164
|
-
<line num="14" count="1" type="stmt"/>
|
|
165
|
-
<line num="18" count="1" type="stmt"/>
|
|
166
|
-
<line num="19" count="1" type="stmt"/>
|
|
167
|
-
<line num="20" count="4" type="stmt"/>
|
|
168
|
-
<line num="22" count="1" type="stmt"/>
|
|
169
|
-
</file>
|
|
170
|
-
<file name="errorHandle.js" path="/Users/eric/Manner.js/manner.js/src/server/lib/errorHandle.js">
|
|
171
|
-
<metrics statements="7" coveredstatements="6" conditionals="2" coveredconditionals="1" methods="2" coveredmethods="2"/>
|
|
172
|
-
<line num="2" count="2" type="cond" truecount="1" falsecount="1"/>
|
|
173
|
-
<line num="3" count="0" type="stmt"/>
|
|
174
|
-
<line num="5" count="2" type="stmt"/>
|
|
175
|
-
<line num="6" count="2" type="stmt"/>
|
|
176
|
-
<line num="7" count="2" type="stmt"/>
|
|
177
|
-
<line num="9" count="1" type="stmt"/>
|
|
178
|
-
<line num="10" count="1" type="stmt"/>
|
|
179
|
-
</file>
|
|
188
|
+
<metrics statements="107" coveredstatements="79" conditionals="60" coveredconditionals="41" methods="10" coveredmethods="10"/>
|
|
180
189
|
<file name="formatHttpDate.js" path="/Users/eric/Manner.js/manner.js/src/server/lib/formatHttpDate.js">
|
|
181
190
|
<metrics statements="4" coveredstatements="4" conditionals="0" coveredconditionals="0" methods="1" coveredmethods="1"/>
|
|
182
191
|
<line num="2" count="1" type="stmt"/>
|
|
@@ -255,34 +264,16 @@
|
|
|
255
264
|
<line num="2" count="3" type="stmt"/>
|
|
256
265
|
<line num="3" count="3" type="stmt"/>
|
|
257
266
|
<line num="4" count="3" type="stmt"/>
|
|
258
|
-
<line num="5" count="
|
|
259
|
-
<line num="6" count="
|
|
267
|
+
<line num="5" count="99" type="stmt"/>
|
|
268
|
+
<line num="6" count="99" type="cond" truecount="3" falsecount="0"/>
|
|
260
269
|
<line num="9" count="22" type="stmt"/>
|
|
261
270
|
<line num="10" count="22" type="stmt"/>
|
|
262
|
-
<line num="12" count="
|
|
271
|
+
<line num="12" count="77" type="cond" truecount="5" falsecount="1"/>
|
|
263
272
|
<line num="13" count="0" type="stmt"/>
|
|
264
273
|
<line num="17" count="3" type="cond" truecount="2" falsecount="0"/>
|
|
265
274
|
<line num="18" count="1" type="stmt"/>
|
|
266
275
|
<line num="20" count="3" type="stmt"/>
|
|
267
276
|
</file>
|
|
268
|
-
<file name="nonZeroByteArray.js" path="/Users/eric/Manner.js/manner.js/src/server/lib/nonZeroByteArray.js">
|
|
269
|
-
<metrics statements="15" coveredstatements="15" conditionals="2" coveredconditionals="1" methods="2" coveredmethods="2"/>
|
|
270
|
-
<line num="1" count="1" type="stmt"/>
|
|
271
|
-
<line num="4" count="1" type="stmt"/>
|
|
272
|
-
<line num="5" count="1" type="stmt"/>
|
|
273
|
-
<line num="6" count="1" type="cond" truecount="1" falsecount="1"/>
|
|
274
|
-
<line num="7" count="1" type="stmt"/>
|
|
275
|
-
<line num="8" count="3" type="stmt"/>
|
|
276
|
-
<line num="9" count="3" type="stmt"/>
|
|
277
|
-
<line num="10" count="3" type="stmt"/>
|
|
278
|
-
<line num="13" count="1" type="stmt"/>
|
|
279
|
-
<line num="14" count="1" type="stmt"/>
|
|
280
|
-
<line num="18" count="1" type="stmt"/>
|
|
281
|
-
<line num="19" count="1" type="stmt"/>
|
|
282
|
-
<line num="20" count="1" type="stmt"/>
|
|
283
|
-
<line num="21" count="4" type="stmt"/>
|
|
284
|
-
<line num="23" count="1" type="stmt"/>
|
|
285
|
-
</file>
|
|
286
277
|
<file name="parseHttpDate.js" path="/Users/eric/Manner.js/manner.js/src/server/lib/parseHttpDate.js">
|
|
287
278
|
<metrics statements="36" coveredstatements="14" conditionals="12" coveredconditionals="1" methods="1" coveredmethods="1"/>
|
|
288
279
|
<line num="2" count="1" type="stmt"/>
|