manner.js 1.0.13 → 1.0.15

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.
Files changed (32) hide show
  1. package/client/class/ClientFetch.js +1 -0
  2. package/client/index.js +1 -1
  3. package/coverage/clover.xml +92 -103
  4. package/coverage/coverage-final.json +3 -4
  5. package/coverage/lcov-report/byteArray.js.html +1 -1
  6. package/coverage/lcov-report/class/Blockable.js.html +86 -35
  7. package/coverage/lcov-report/class/Blocks.js.html +220 -28
  8. package/coverage/lcov-report/class/MultiFetch.js.html +31 -97
  9. package/coverage/lcov-report/class/index.html +28 -43
  10. package/coverage/lcov-report/formatHttpDate.js.html +1 -1
  11. package/coverage/lcov-report/formatHttpKey.js.html +1 -1
  12. package/coverage/lcov-report/getOwnIpAddresses.js.html +1 -1
  13. package/coverage/lcov-report/index.html +19 -19
  14. package/coverage/lcov-report/isIntranetIpv4Address.js.html +1 -1
  15. package/coverage/lcov-report/isIpv6Address.js.html +4 -4
  16. package/coverage/lcov-report/lib/byteArray.js.html +1 -1
  17. package/coverage/lcov-report/lib/formatHttpDate.js.html +1 -1
  18. package/coverage/lcov-report/lib/formatHttpKey.js.html +1 -1
  19. package/coverage/lcov-report/lib/getOwnIpAddresses.js.html +1 -1
  20. package/coverage/lcov-report/lib/index.html +1 -1
  21. package/coverage/lcov-report/lib/isIntranetIpv4Address.js.html +1 -1
  22. package/coverage/lcov-report/lib/isIpv6Address.js.html +4 -4
  23. package/coverage/lcov-report/lib/nonZeroByteArray.js.html +1 -1
  24. package/coverage/lcov-report/lib/parseHttpDate.js.html +1 -1
  25. package/coverage/lcov-report/lib/wrapIpv6.js.html +1 -1
  26. package/coverage/lcov-report/nonZeroByteArray.js.html +1 -1
  27. package/coverage/lcov-report/parseHttpDate.js.html +1 -1
  28. package/coverage/lcov-report/wrapIpv6.js.html +1 -1
  29. package/coverage/lcov.info +171 -196
  30. package/package.json +2 -2
  31. package/server/class/Blocks.js +1 -1
  32. package/server/class/MultiFetch.js +1 -1
@@ -142,7 +142,7 @@ export function toInt(buf) {
142
142
  <div class='footer quiet pad2 space-top1 center small'>
143
143
  Code coverage generated by
144
144
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
145
- at 2025-06-27T09:39:17.492Z
145
+ at 2025-06-29T06:46:56.519Z
146
146
  </div>
147
147
  <script src="prettify.js"></script>
148
148
  <script>
@@ -223,7 +223,7 @@
223
223
  <div class='footer quiet pad2 space-top1 center small'>
224
224
  Code coverage generated by
225
225
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
226
- at 2025-06-27T09:39:17.492Z
226
+ at 2025-06-29T06:46:56.519Z
227
227
  </div>
228
228
  <script src="prettify.js"></script>
229
229
  <script>
@@ -79,7 +79,7 @@
79
79
  <div class='footer quiet pad2 space-top1 center small'>
80
80
  Code coverage generated by
81
81
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
82
- at 2025-06-27T09:39:17.492Z
82
+ at 2025-06-29T06:46:56.519Z
83
83
  </div>
84
84
  <script src="prettify.js"></script>
85
85
  <script>
@@ -1,203 +1,178 @@
1
1
  TN:
2
- SF:src/server/class/Blockable.js
3
- FN:3,getIntervalFromTime
4
- FN:9,(anonymous_1)
5
- FN:19,(anonymous_2)
6
- FN:37,(anonymous_3)
7
- FN:44,(anonymous_4)
8
- FN:49,(anonymous_5)
9
- FNF:6
10
- FNH:5
11
- FNDA:34,getIntervalFromTime
12
- FNDA:0,(anonymous_1)
13
- FNDA:34,(anonymous_2)
14
- FNDA:35,(anonymous_3)
15
- FNDA:5,(anonymous_4)
16
- FNDA:29,(anonymous_5)
17
- DA:4,34
18
- DA:5,34
19
- DA:10,0
20
- DA:11,0
21
- DA:13,0
22
- DA:14,0
23
- DA:16,0
24
- DA:21,34
25
- DA:22,29
26
- DA:23,5
27
- DA:24,5
28
- DA:26,0
29
- DA:28,34
30
- DA:29,34
31
- DA:30,5
32
- DA:31,5
33
- DA:32,4
34
- DA:38,35
35
- DA:39,35
36
- DA:40,35
37
- DA:41,6
38
- DA:42,6
39
- DA:43,6
40
- DA:44,6
41
- DA:46,29
42
- DA:47,29
43
- DA:48,29
44
- DA:49,29
45
- DA:50,29
46
- DA:52,0
47
- DA:55,35
48
- LF:31
49
- LH:24
50
- BRDA:10,0,0,0
51
- BRDA:10,0,1,0
52
- BRDA:13,1,0,0
53
- BRDA:13,1,1,0
54
- BRDA:21,2,0,29
55
- BRDA:21,2,1,5
56
- BRDA:23,3,0,5
57
- BRDA:23,3,1,0
58
- BRDA:29,4,0,5
59
- BRDA:29,4,1,29
60
- BRDA:31,5,0,4
61
- BRDA:31,5,1,1
62
- BRDA:40,6,0,6
63
- BRDA:40,6,1,29
64
- BRDA:47,7,0,29
65
- BRDA:47,7,1,0
66
- BRF:16
67
- BRH:10
68
- end_of_record
69
- TN:
70
2
  SF:src/server/class/Blocks.js
71
- FN:6,(anonymous_0)
72
- FN:14,(anonymous_1)
73
- FN:23,(anonymous_2)
74
- FNF:3
75
- FNH:3
76
- FNDA:2,(anonymous_0)
3
+ FN:4,getIntervalFromTime
4
+ FN:10,(anonymous_1)
5
+ FN:18,(anonymous_2)
6
+ FN:27,(anonymous_3)
7
+ FN:31,(anonymous_4)
8
+ FN:41,(anonymous_5)
9
+ FN:61,(anonymous_6)
10
+ FN:69,(anonymous_7)
11
+ FN:87,(anonymous_8)
12
+ FNF:9
13
+ FNH:7
14
+ FNDA:13,getIntervalFromTime
77
15
  FNDA:2,(anonymous_1)
78
- FNDA:12,(anonymous_2)
79
- DA:7,2
80
- DA:8,2
81
- DA:9,2
82
- DA:10,2
16
+ FNDA:2,(anonymous_2)
17
+ FNDA:0,(anonymous_3)
18
+ FNDA:0,(anonymous_4)
19
+ FNDA:3,(anonymous_5)
20
+ FNDA:14,(anonymous_6)
21
+ FNDA:3,(anonymous_7)
22
+ FNDA:14,(anonymous_8)
23
+ DA:5,13
24
+ DA:6,13
83
25
  DA:11,2
26
+ DA:12,2
27
+ DA:13,2
28
+ DA:14,2
84
29
  DA:15,2
85
- DA:16,0
86
- DA:18,2
87
- DA:19,0
88
- DA:24,12
89
- DA:25,12
90
- DA:26,12
91
- DA:27,6
92
- DA:28,6
93
- DA:29,6
94
- DA:30,6
95
- DA:31,6
30
+ DA:19,2
31
+ DA:20,0
32
+ DA:22,2
33
+ DA:23,0
34
+ DA:28,0
35
+ DA:32,0
96
36
  DA:33,0
97
- LF:18
98
- LH:15
99
- BRDA:15,0,0,0
100
- BRDA:15,0,1,2
101
- BRDA:18,1,0,0
102
- BRDA:18,1,1,2
103
- BRDA:24,2,0,12
104
- BRDA:24,2,1,0
105
- BRDA:26,3,0,6
106
- BRDA:26,3,1,6
107
- BRDA:29,4,0,6
108
- BRDA:29,4,1,0
109
- BRF:10
110
- BRH:6
37
+ DA:35,0
38
+ DA:36,0
39
+ DA:38,0
40
+ DA:43,3
41
+ DA:44,2
42
+ DA:45,1
43
+ DA:46,1
44
+ DA:48,0
45
+ DA:50,3
46
+ DA:51,3
47
+ DA:52,3
48
+ DA:53,3
49
+ DA:54,3
50
+ DA:55,3
51
+ DA:56,3
52
+ DA:62,14
53
+ DA:63,14
54
+ DA:64,14
55
+ DA:65,4
56
+ DA:66,4
57
+ DA:67,4
58
+ DA:68,4
59
+ DA:69,4
60
+ DA:71,10
61
+ DA:72,10
62
+ DA:73,10
63
+ DA:74,10
64
+ DA:75,10
65
+ DA:76,10
66
+ DA:77,10
67
+ DA:78,10
68
+ DA:80,0
69
+ DA:81,0
70
+ DA:84,14
71
+ DA:88,14
72
+ DA:89,14
73
+ DA:90,14
74
+ DA:91,7
75
+ DA:92,7
76
+ DA:93,7
77
+ DA:94,7
78
+ DA:95,7
79
+ DA:97,0
80
+ LF:57
81
+ LH:45
82
+ BRDA:19,0,0,0
83
+ BRDA:19,0,1,2
84
+ BRDA:22,1,0,0
85
+ BRDA:22,1,1,2
86
+ BRDA:32,2,0,0
87
+ BRDA:32,2,1,0
88
+ BRDA:35,3,0,0
89
+ BRDA:35,3,1,0
90
+ BRDA:43,4,0,2
91
+ BRDA:43,4,1,1
92
+ BRDA:45,5,0,1
93
+ BRDA:45,5,1,0
94
+ BRDA:51,6,0,3
95
+ BRDA:51,6,1,0
96
+ BRDA:54,7,0,3
97
+ BRDA:54,7,1,0
98
+ BRDA:64,8,0,4
99
+ BRDA:64,8,1,10
100
+ BRDA:73,9,0,10
101
+ BRDA:73,9,1,0
102
+ BRDA:88,10,0,14
103
+ BRDA:88,10,1,0
104
+ BRDA:90,11,0,7
105
+ BRDA:90,11,1,7
106
+ BRDA:93,12,0,7
107
+ BRDA:93,12,1,0
108
+ BRF:26
109
+ BRH:14
111
110
  end_of_record
112
111
  TN:
113
112
  SF:src/server/class/MultiFetch.js
114
- FN:8,(anonymous_0)
115
- FN:21,(anonymous_1)
116
- FN:39,(anonymous_2)
113
+ FN:7,(anonymous_0)
114
+ FN:16,(anonymous_1)
115
+ FN:34,(anonymous_2)
117
116
  FNF:3
118
117
  FNH:3
119
- FNDA:2,(anonymous_0)
120
- FNDA:2,(anonymous_1)
121
- FNDA:43,(anonymous_2)
122
- DA:9,2
123
- DA:10,2
124
- DA:11,2
125
- DA:12,2
126
- DA:13,2
127
- DA:14,1
128
- DA:16,2
129
- DA:17,2
130
- DA:18,2
131
- DA:22,2
132
- DA:23,0
133
- DA:24,0
118
+ FNDA:1,(anonymous_0)
119
+ FNDA:1,(anonymous_1)
120
+ FNDA:20,(anonymous_2)
121
+ DA:8,1
122
+ DA:9,1
123
+ DA:10,1
124
+ DA:11,1
125
+ DA:12,0
126
+ DA:17,1
127
+ DA:18,0
128
+ DA:19,0
129
+ DA:20,0
130
+ DA:21,0
131
+ DA:24,1
134
132
  DA:25,0
135
133
  DA:26,0
136
- DA:29,2
137
- DA:30,1
138
- DA:31,0
139
- DA:33,1
140
- DA:34,0
141
- DA:40,43
142
- DA:41,0
143
- DA:43,43
144
- DA:44,0
145
- DA:46,43
146
- DA:48,43
147
- DA:49,23
148
- DA:50,23
149
- DA:51,23
150
- DA:52,23
151
- DA:53,0
152
- DA:54,0
153
- DA:55,0
154
- DA:57,0
155
- DA:60,43
156
- DA:61,21
157
- DA:63,22
158
- DA:64,22
159
- DA:65,18
160
- DA:67,4
161
- DA:69,22
162
- DA:70,22
163
- DA:71,22
164
- DA:72,0
165
- DA:73,0
166
- DA:75,22
167
- DA:76,22
168
- LF:46
169
- LH:32
170
- BRDA:13,0,0,1
171
- BRDA:13,0,1,1
172
- BRDA:22,1,0,0
173
- BRDA:22,1,1,2
174
- BRDA:25,2,0,0
175
- BRDA:25,2,1,0
176
- BRDA:29,3,0,1
177
- BRDA:29,3,1,1
178
- BRDA:30,4,0,0
179
- BRDA:30,4,1,1
180
- BRDA:33,5,0,0
181
- BRDA:33,5,1,1
182
- BRDA:39,6,0,20
183
- BRDA:40,7,0,0
184
- BRDA:40,7,1,43
185
- BRDA:43,8,0,0
186
- BRDA:43,8,1,43
187
- BRDA:48,9,0,23
188
- BRDA:48,9,1,20
189
- BRDA:50,10,0,23
190
- BRDA:50,10,1,0
191
- BRDA:53,11,0,0
192
- BRDA:53,11,1,0
193
- BRDA:60,12,0,21
194
- BRDA:60,12,1,22
195
- BRDA:64,13,0,18
196
- BRDA:64,13,1,4
197
- BRDA:71,14,0,0
198
- BRDA:71,14,1,22
199
- BRF:29
200
- BRH:18
134
+ DA:28,0
135
+ DA:29,0
136
+ DA:35,20
137
+ DA:36,0
138
+ DA:38,20
139
+ DA:39,0
140
+ DA:41,20
141
+ DA:42,20
142
+ DA:43,16
143
+ DA:45,4
144
+ DA:47,20
145
+ DA:48,20
146
+ DA:49,20
147
+ DA:50,0
148
+ DA:51,0
149
+ DA:53,20
150
+ DA:54,20
151
+ LF:30
152
+ LH:17
153
+ BRDA:11,0,0,0
154
+ BRDA:11,0,1,1
155
+ BRDA:17,1,0,0
156
+ BRDA:17,1,1,1
157
+ BRDA:20,2,0,0
158
+ BRDA:20,2,1,0
159
+ BRDA:24,3,0,0
160
+ BRDA:24,3,1,1
161
+ BRDA:25,4,0,0
162
+ BRDA:25,4,1,0
163
+ BRDA:28,5,0,0
164
+ BRDA:28,5,1,0
165
+ BRDA:34,6,0,20
166
+ BRDA:35,7,0,0
167
+ BRDA:35,7,1,20
168
+ BRDA:38,8,0,0
169
+ BRDA:38,8,1,20
170
+ BRDA:42,9,0,16
171
+ BRDA:42,9,1,4
172
+ BRDA:49,10,0,0
173
+ BRDA:49,10,1,20
174
+ BRF:21
175
+ BRH:9
201
176
  end_of_record
202
177
  TN:
203
178
  SF:src/server/lib/byteArray.js
@@ -375,11 +350,11 @@ FNDA:3,isIpv6Address
375
350
  DA:2,3
376
351
  DA:3,3
377
352
  DA:4,3
378
- DA:5,98
379
- DA:6,98
353
+ DA:5,99
354
+ DA:6,99
380
355
  DA:9,22
381
356
  DA:10,22
382
- DA:12,76
357
+ DA:12,77
383
358
  DA:13,0
384
359
  DA:17,3
385
360
  DA:18,1
@@ -388,13 +363,13 @@ LF:12
388
363
  LH:11
389
364
  BRDA:6,0,0,3
390
365
  BRDA:6,0,1,22
391
- BRDA:6,0,2,76
366
+ BRDA:6,0,2,77
392
367
  BRDA:12,1,0,0
393
- BRDA:12,1,1,76
394
- BRDA:12,2,0,76
395
- BRDA:12,2,1,76
396
- BRDA:12,2,2,14
397
- BRDA:12,2,3,14
368
+ BRDA:12,1,1,77
369
+ BRDA:12,2,0,77
370
+ BRDA:12,2,1,77
371
+ BRDA:12,2,2,15
372
+ BRDA:12,2,3,15
398
373
  BRDA:17,3,0,1
399
374
  BRDA:17,3,1,2
400
375
  BRF:11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "manner.js",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "Frontend mode project.",
5
5
  "repository": "git@github.com:leobrad/mode.git",
6
6
  "author": "Leo Ely",
@@ -9,7 +9,7 @@
9
9
  "run": "gulp build && node dist/index.js",
10
10
  "build": "gulp build && gulp copy",
11
11
  "clean": "rm -rf client server",
12
- "test": "jest"
12
+ "test": "jest --detectOpenHandles"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@babel/cli": "^7.20.7",
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _net=_interopRequireDefault(require("net")),_advising=require("advising.js"),_Blockable=_interopRequireDefault(require("./Blockable"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}class Blocks extends _Blockable.default{constructor(e){super(),this.dealParams(e),this.interval=e,this.ipv4Block=new _advising.Ipv4Router({debug:!1,hideError:!0}),this.ipv6Block=new _advising.Ipv6Router({debug:!1,hideError:!0})}dealParams(e){if(!Number.isInteger(e))throw new Error("[Error] The interval parameter should be of integer type.");if(e<=0)throw new Error("[Error] The interval should be a positive integer otherwise it has no meaning.")}examine(e){if(void 0!==e){var r,{}=this;if(_net.default.isIPv4(e))return r=this.ipv4Block,this.examineIpAddress(e,r);if(_net.default.isIPv6(e))return r=this.ipv6Block,this.examineIpAddress(e,r);throw new Error("[Error] The Ip type is not expected.")}}}var _default=exports.default=Blocks;
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _net=_interopRequireDefault(require("net")),_advising=require("advising.js");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function getIntervalFromTime(e){var t=(new Date).getTime();return Math.floor(t-e)}class Blocks{constructor(e){this.dealParams(e),this.interval=e,this.count=0,this.ipv4Blocks=new _advising.Ipv4Router({debug:!1,hideError:!0}),this.ipv6Blocks=new _advising.Ipv6Router({debug:!1,hideError:!0})}dealParams(e){if(!Number.isInteger(e))throw new Error("[Error] The interval parameter should be of integer type.");if(e<=0)throw new Error("[Error] The interval should be a positive integer otherwise it has no meaning.")}getCount(){return this.count}setInterval(e){if(!Number.isInteger(e))throw new Error("[Error] The interval parameter should be of integer type.");if(e<=0)throw new Error("[Error] The interval should be a positive integer otherwise it has no meaning.");this.interval=e}cleanIpAddress(e,t){let r;if(_net.default.isIPv4(e))r=this.ipv4Blocks;else{if(!_net.default.isIPv6(e))throw new Error("[Error] The Ip type is not expected");r=this.ipv6Blocks}var i=r.gain(e);void 0!==i&&(i=i.time,t<=getIntervalFromTime(i))&&(r.ruin(e),this.count=0)}examineIpAddress(e,t){let r=!0;var i,n=t.gain(e);return void 0===n?(i=(new Date).getTime(),i=(t.attach(e,{time:i,count:1}),this.count=1,this).interval,setTimeout(()=>this.cleanIpAddress(e,this.interval),i)):(i=n.time,getIntervalFromTime(i)<this.interval?(n=n.count,t.revise(e,{time:i,count:n+=1}),this.count=n,r=!1):(t.ruin(e),this.count=0)),r}examine(e){if(void 0!==e){var t,{}=this;if(_net.default.isIPv4(e))return t=this.ipv4Blocks,this.examineIpAddress(e,t);if(_net.default.isIPv6(e))return t=this.ipv6Blocks,this.examineIpAddress(e,t);throw new Error("[Error] The Ip type is not expected.")}}}var _default=exports.default=Blocks;
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _https=_interopRequireDefault(require("https")),_net=_interopRequireDefault(require("net")),_nodeFetch=_interopRequireDefault(require("node-fetch")),_advising=require("advising.js"),_Blockable=_interopRequireDefault(require("./Blockable"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}class MultiFetch extends _Blockable.default{constructor(e,r){super(),this.index=-1,this.dealParams(e,r),this.bases=e,void 0!==r&&(this.interval=r),this.ipv4Block=new _advising.Ipv4Router({debug:!1,hideError:!0}),this.ipv6Block=new _advising.Ipv6Router({debug:!1,hideError:!0}),this.cleanIpAddress=this.cleanIpAddress.bind(this)}dealParams(e,r){if(!Array.isArray(e))throw new Error("[Error] The bases parameter bases should be a array type.");if(void 0!==r){if(!Number.isInteger(r))throw new Error("[Error] The interval parameter should be of integer type.");if(r<=0)throw new Error("[Error] The interval should be a positive integer otherwise it has no meaning.")}}async fetch(e,r,t={}){if("string"!=typeof e)throw new Error("[Error] The path parameter path should be of string type.");if("object"!=typeof r)throw new Error("[Error] The options parameter should be a object type.");t=t.ip;let i;if(void 0!==t){var{}=this;if(_net.default.isIPv4(t)){var s=this.ipv4Block;i=this.examineIpAddress(t,s)}else{if(!_net.default.isIPv6(t))throw new Error("[Error] The Ip type is not expected.");s=this.ipv6Block;i=this.examineIpAddress(t,s)}}if(!1===i)throw new Error("[Error] The current IP address is blocked because it is accessed too frequently.");var t=this.bases,s=(this.index<t.length-1?this.index+=1:this.index=0,this).index,t=t[s],s=(t.startsWith("https")&&(s=new _https.default.Agent({rejectUnauthorized:!1}),r.agent=s),t+e);return(0,_nodeFetch.default)(s,r)}}var _default=exports.default=MultiFetch;
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _https=_interopRequireDefault(require("https")),_net=_interopRequireDefault(require("net")),_nodeFetch=_interopRequireDefault(require("node-fetch")),_advising=require("advising.js");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}class MultiFetch{constructor(e,r){this.index=-1,this.dealParams(e,r),this.bases=e,void 0!==r&&(this.interval=r)}dealParams(e,r){if(!Array.isArray(e))throw new Error("[Error] The bases parameter bases should be a array type.");if(void 0!==r){if(!Number.isInteger(r))throw new Error("[Error] The interval parameter should be of integer type.");if(r<=0)throw new Error("[Error] The interval should be a positive integer otherwise it has no meaning.")}}async fetch(e,r,t=0){if("string"!=typeof e)throw new Error("[Error] The path parameter path should be of string type.");if("object"!=typeof r)throw new Error("[Error] The options parameter should be a object type.");var i=this.bases,a=(this.index<i.length-1?this.index+=1:this.index=0,this).index,i=i[a],a=(i.startsWith("https")&&(a=new _https.default.Agent({rejectUnauthorized:!1}),r.agent=a),i+e);return(0,_nodeFetch.default)(a,r)}}var _default=exports.default=MultiFetch;