sonic-ws 1.0.3 → 1.0.4

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/LICENSE CHANGED
@@ -4,7 +4,13 @@ Licensed under the Apache License, Version 2.0 (the "License");
4
4
  You may not use this software except in compliance with the License.
5
5
  You may obtain a copy of the License at
6
6
 
7
- http://www.apache.org/licenses/LICENSE-2.0
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
8
14
 
9
15
  Apache License
10
16
  Version 2.0, January 2004
@@ -59,7 +59,6 @@ function createValidator(type, dataCap, dataMin, packet) {
59
59
  case PacketType_1.PacketType.ENUMS: return (data, index) => {
60
60
  if (data.length < dataMin || data.length > dataCap || index >= packet.enumData.length)
61
61
  return false;
62
- console.log("~~ENUM~~", packet, packet.enumData, index);
63
62
  const pkg = packet.enumData[index];
64
63
  for (let i = 0; i < data.length; i++) {
65
64
  if (pkg.values.length <= data[i])
@@ -91,8 +90,8 @@ function createValidator(type, dataCap, dataMin, packet) {
91
90
  };
92
91
  case PacketType_1.PacketType.BOOLEANS:
93
92
  {
94
- const min = Math.floor(dataMin * CompressionUtil_1.ONE_EIGHT);
95
- const cap = Math.floor(dataCap * CompressionUtil_1.ONE_EIGHT);
93
+ const min = Math.ceil(dataMin * CompressionUtil_1.ONE_EIGHT);
94
+ const cap = Math.ceil(dataCap * CompressionUtil_1.ONE_EIGHT);
96
95
  return (data) => data.length >= min && data.length <= cap;
97
96
  }
98
97
  ;
@@ -216,7 +216,6 @@ class Packet {
216
216
  const type = data[offset];
217
217
  // do enum stuff
218
218
  const finalType = type == PacketType_1.PacketType.ENUMS ? enums[0] : type; // convert enum to enum package
219
- console.log(tag, finalType, data, offset, data[offset]);
220
219
  // make schema
221
220
  const schema = PacketSchema.single(finalType, dataMax, dataMin, dontSpread, dataBatching, -1, -1);
222
221
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonic-ws",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Ultra-lightweight, high-performance, and bandwidth efficient websocket library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "build": "npm run build_node && npm run build_web",
12
12
  "test_web": "npm run build && node test-site/server.mjs",
13
13
  "test_node": "npm run build_node && node test.mjs",
14
- "publish": "npm run build && copy .\\bundled\\SonicWS_bundle.js .\\release\\SonicWS_bundle.js"
14
+ "publish": "npm run build && cp ./bundled/SonicWS_bundle.js ./release/SonicWS_bundle.js"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",