@wabot-dev/framework 0.0.14 → 0.0.17

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 (370) hide show
  1. package/dist/src/ai/deepseek/DeepSeekChatBotAdapter.js +108 -0
  2. package/dist/src/channels/cmd/@cmd.js +1 -1
  3. package/dist/src/channels/cmd/CmdChannel.js +1 -1
  4. package/dist/src/channels/socket-io/@socket.js +24 -0
  5. package/dist/src/channels/socket-io/SocketChannel.js +78 -0
  6. package/dist/src/channels/socket-io/SocketChannelConfig.js +15 -0
  7. package/dist/src/channels/telegram/@telegram.js +1 -1
  8. package/dist/src/channels/telegram/TelegramChannel.js +1 -1
  9. package/dist/src/channels/whatsapp/@whatsapp.js +1 -1
  10. package/dist/src/channels/whatsapp/WhatsAppChannel.js +1 -1
  11. package/dist/src/channels/whatsapp/WhatsAppConnection.js +1 -1
  12. package/dist/src/channels/whatsapp/WhatsAppDevConnection.js +11 -3
  13. package/dist/src/channels/whatsapp/{whatsAppDevSocketContracts.js → WhatsAppDevSocketContracts.js} +1 -0
  14. package/dist/src/channels/whatsapp/WhatsAppProdConnection.js +4 -1
  15. package/dist/src/channels/whatsapp/WhatsAppSender.js +23 -0
  16. package/dist/src/controller/socket.io/SocketIO.js +1 -1
  17. package/dist/src/index.d.ts +82 -9
  18. package/dist/src/index.js +9 -1
  19. package/dist/src/logger/Logger.js +1 -1
  20. package/dist/src/mindset/MindsetOperator.js +1 -1
  21. package/dist/src/server/runChannel.js +1 -1
  22. package/dist/src/server/runServer.js +4 -4
  23. package/package.json +2 -1
  24. package/dist/src/_virtual/XMLHttpRequest.js +0 -7
  25. package/dist/src/_virtual/_commonjsHelpers.js +0 -32
  26. package/dist/src/_virtual/base64id.js +0 -3
  27. package/dist/src/_virtual/binary.js +0 -3
  28. package/dist/src/_virtual/bom-handling.js +0 -3
  29. package/dist/src/_virtual/broadcast-operator.js +0 -3
  30. package/dist/src/_virtual/browser.js +0 -3
  31. package/dist/src/_virtual/browser2.js +0 -3
  32. package/dist/src/_virtual/browser3.js +0 -3
  33. package/dist/src/_virtual/browser4.js +0 -3
  34. package/dist/src/_virtual/browser5.js +0 -3
  35. package/dist/src/_virtual/buffer-util.js +0 -3
  36. package/dist/src/_virtual/buffer-util2.js +0 -3
  37. package/dist/src/_virtual/buffer-util3.js +0 -3
  38. package/dist/src/_virtual/charset.js +0 -3
  39. package/dist/src/_virtual/charset2.js +0 -3
  40. package/dist/src/_virtual/client.js +0 -3
  41. package/dist/src/_virtual/cluster-adapter.js +0 -3
  42. package/dist/src/_virtual/commons.js +0 -3
  43. package/dist/src/_virtual/dbcs-codec.js +0 -3
  44. package/dist/src/_virtual/decodePacket.js +0 -3
  45. package/dist/src/_virtual/encodePacket.js +0 -3
  46. package/dist/src/_virtual/encoding.js +0 -3
  47. package/dist/src/_virtual/encoding2.js +0 -3
  48. package/dist/src/_virtual/engine.io.js +0 -3
  49. package/dist/src/_virtual/in-memory-adapter.js +0 -3
  50. package/dist/src/_virtual/index.js +0 -7
  51. package/dist/src/_virtual/index10.js +0 -3
  52. package/dist/src/_virtual/index11.js +0 -3
  53. package/dist/src/_virtual/index12.js +0 -3
  54. package/dist/src/_virtual/index13.js +0 -3
  55. package/dist/src/_virtual/index14.js +0 -3
  56. package/dist/src/_virtual/index15.js +0 -3
  57. package/dist/src/_virtual/index16.js +0 -3
  58. package/dist/src/_virtual/index17.js +0 -3
  59. package/dist/src/_virtual/index18.js +0 -3
  60. package/dist/src/_virtual/index19.js +0 -3
  61. package/dist/src/_virtual/index2.js +0 -7
  62. package/dist/src/_virtual/index20.js +0 -3
  63. package/dist/src/_virtual/index21.js +0 -3
  64. package/dist/src/_virtual/index22.js +0 -3
  65. package/dist/src/_virtual/index23.js +0 -3
  66. package/dist/src/_virtual/index24.js +0 -3
  67. package/dist/src/_virtual/index25.js +0 -3
  68. package/dist/src/_virtual/index26.js +0 -3
  69. package/dist/src/_virtual/index27.js +0 -3
  70. package/dist/src/_virtual/index28.js +0 -3
  71. package/dist/src/_virtual/index29.js +0 -3
  72. package/dist/src/_virtual/index3.js +0 -7
  73. package/dist/src/_virtual/index30.js +0 -3
  74. package/dist/src/_virtual/index31.js +0 -3
  75. package/dist/src/_virtual/index32.js +0 -3
  76. package/dist/src/_virtual/index33.js +0 -3
  77. package/dist/src/_virtual/index4.js +0 -3
  78. package/dist/src/_virtual/index5.js +0 -3
  79. package/dist/src/_virtual/index6.js +0 -3
  80. package/dist/src/_virtual/index7.js +0 -3
  81. package/dist/src/_virtual/index8.js +0 -6
  82. package/dist/src/_virtual/index9.js +0 -3
  83. package/dist/src/_virtual/inherits.js +0 -3
  84. package/dist/src/_virtual/inherits_browser.js +0 -3
  85. package/dist/src/_virtual/is-binary.js +0 -3
  86. package/dist/src/_virtual/language.js +0 -3
  87. package/dist/src/_virtual/language2.js +0 -3
  88. package/dist/src/_virtual/mediaType.js +0 -3
  89. package/dist/src/_virtual/mediaType2.js +0 -3
  90. package/dist/src/_virtual/namespace.js +0 -3
  91. package/dist/src/_virtual/node.js +0 -3
  92. package/dist/src/_virtual/node2.js +0 -3
  93. package/dist/src/_virtual/node3.js +0 -3
  94. package/dist/src/_virtual/node4.js +0 -3
  95. package/dist/src/_virtual/node5.js +0 -3
  96. package/dist/src/_virtual/parent-namespace.js +0 -3
  97. package/dist/src/_virtual/polling-jsonp.js +0 -3
  98. package/dist/src/_virtual/polling.js +0 -3
  99. package/dist/src/_virtual/polling2.js +0 -3
  100. package/dist/src/_virtual/receiver.js +0 -3
  101. package/dist/src/_virtual/sbcs-codec.js +0 -3
  102. package/dist/src/_virtual/sender.js +0 -3
  103. package/dist/src/_virtual/server.js +0 -3
  104. package/dist/src/_virtual/socket-types.js +0 -3
  105. package/dist/src/_virtual/socket.js +0 -3
  106. package/dist/src/_virtual/socket2.js +0 -3
  107. package/dist/src/_virtual/stream.js +0 -3
  108. package/dist/src/_virtual/transport.js +0 -3
  109. package/dist/src/_virtual/typed-events.js +0 -3
  110. package/dist/src/_virtual/userver.js +0 -3
  111. package/dist/src/_virtual/utf16.js +0 -3
  112. package/dist/src/_virtual/utf32.js +0 -3
  113. package/dist/src/_virtual/utf7.js +0 -3
  114. package/dist/src/_virtual/uws.js +0 -3
  115. package/dist/src/_virtual/validation.js +0 -3
  116. package/dist/src/_virtual/validation2.js +0 -3
  117. package/dist/src/_virtual/validation3.js +0 -3
  118. package/dist/src/_virtual/websocket-server.js +0 -3
  119. package/dist/src/_virtual/websocket.js +0 -7
  120. package/dist/src/_virtual/websocket2.js +0 -3
  121. package/dist/src/_virtual/websocket3.js +0 -3
  122. package/dist/src/_virtual/webtransport.js +0 -3
  123. package/dist/src/_virtual/yeast.js +0 -3
  124. package/dist/src/node_modules/@socket.io/component-emitter/lib/esm/index.js +0 -171
  125. package/dist/src/node_modules/base64id/lib/base64id.js +0 -117
  126. package/dist/src/node_modules/body-parser/index.js +0 -96
  127. package/dist/src/node_modules/body-parser/lib/read.js +0 -225
  128. package/dist/src/node_modules/body-parser/lib/types/json.js +0 -222
  129. package/dist/src/node_modules/body-parser/lib/types/raw.js +0 -90
  130. package/dist/src/node_modules/body-parser/lib/types/text.js +0 -95
  131. package/dist/src/node_modules/body-parser/lib/types/urlencoded.js +0 -194
  132. package/dist/src/node_modules/body-parser/lib/utils.js +0 -96
  133. package/dist/src/node_modules/bytes/index.js +0 -180
  134. package/dist/src/node_modules/call-bind-apply-helpers/actualApply.js +0 -24
  135. package/dist/src/node_modules/call-bind-apply-helpers/functionApply.js +0 -13
  136. package/dist/src/node_modules/call-bind-apply-helpers/functionCall.js +0 -13
  137. package/dist/src/node_modules/call-bind-apply-helpers/index.js +0 -29
  138. package/dist/src/node_modules/call-bind-apply-helpers/reflectApply.js +0 -13
  139. package/dist/src/node_modules/call-bound/index.js +0 -31
  140. package/dist/src/node_modules/content-type/index.js +0 -235
  141. package/dist/src/node_modules/cookie/index.js +0 -345
  142. package/dist/src/node_modules/cors/lib/index.js +0 -249
  143. package/dist/src/node_modules/debug/src/browser.js +0 -286
  144. package/dist/src/node_modules/debug/src/common.js +0 -303
  145. package/dist/src/node_modules/debug/src/index.js +0 -23
  146. package/dist/src/node_modules/debug/src/node.js +0 -279
  147. package/dist/src/node_modules/depd/index.js +0 -550
  148. package/dist/src/node_modules/dunder-proto/get.js +0 -42
  149. package/dist/src/node_modules/ee-first/index.js +0 -104
  150. package/dist/src/node_modules/engine.io/build/engine.io.js +0 -73
  151. package/dist/src/node_modules/engine.io/build/parser-v3/index.js +0 -429
  152. package/dist/src/node_modules/engine.io/build/parser-v3/utf8.js +0 -198
  153. package/dist/src/node_modules/engine.io/build/server.js +0 -808
  154. package/dist/src/node_modules/engine.io/build/socket.js +0 -469
  155. package/dist/src/node_modules/engine.io/build/transport.js +0 -131
  156. package/dist/src/node_modules/engine.io/build/transports/index.js +0 -37
  157. package/dist/src/node_modules/engine.io/build/transports/polling-jsonp.js +0 -53
  158. package/dist/src/node_modules/engine.io/build/transports/polling.js +0 -346
  159. package/dist/src/node_modules/engine.io/build/transports/websocket.js +0 -106
  160. package/dist/src/node_modules/engine.io/build/transports/webtransport.js +0 -76
  161. package/dist/src/node_modules/engine.io/build/transports-uws/index.js +0 -20
  162. package/dist/src/node_modules/engine.io/build/transports-uws/polling.js +0 -378
  163. package/dist/src/node_modules/engine.io/build/transports-uws/websocket.js +0 -85
  164. package/dist/src/node_modules/engine.io/build/userver.js +0 -292
  165. package/dist/src/node_modules/engine.io/node_modules/accepts/index.js +0 -250
  166. package/dist/src/node_modules/engine.io/node_modules/debug/src/browser.js +0 -285
  167. package/dist/src/node_modules/engine.io/node_modules/debug/src/common.js +0 -285
  168. package/dist/src/node_modules/engine.io/node_modules/debug/src/index.js +0 -23
  169. package/dist/src/node_modules/engine.io/node_modules/debug/src/node.js +0 -279
  170. package/dist/src/node_modules/engine.io/node_modules/mime-db/db.json.js +0 -10704
  171. package/dist/src/node_modules/engine.io/node_modules/mime-db/index.js +0 -24
  172. package/dist/src/node_modules/engine.io/node_modules/mime-types/index.js +0 -202
  173. package/dist/src/node_modules/engine.io/node_modules/negotiator/index.js +0 -96
  174. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/charset.js +0 -179
  175. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/encoding.js +0 -193
  176. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/language.js +0 -188
  177. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/mediaType.js +0 -304
  178. package/dist/src/node_modules/engine.io/node_modules/ws/index.js +0 -28
  179. package/dist/src/node_modules/engine.io/node_modules/ws/lib/buffer-util.js +0 -142
  180. package/dist/src/node_modules/engine.io/node_modules/ws/lib/constants.js +0 -21
  181. package/dist/src/node_modules/engine.io/node_modules/ws/lib/event-target.js +0 -303
  182. package/dist/src/node_modules/engine.io/node_modules/ws/lib/extension.js +0 -214
  183. package/dist/src/node_modules/engine.io/node_modules/ws/lib/limiter.js +0 -64
  184. package/dist/src/node_modules/engine.io/node_modules/ws/lib/permessage-deflate.js +0 -528
  185. package/dist/src/node_modules/engine.io/node_modules/ws/lib/receiver.js +0 -719
  186. package/dist/src/node_modules/engine.io/node_modules/ws/lib/sender.js +0 -513
  187. package/dist/src/node_modules/engine.io/node_modules/ws/lib/stream.js +0 -170
  188. package/dist/src/node_modules/engine.io/node_modules/ws/lib/subprotocol.js +0 -73
  189. package/dist/src/node_modules/engine.io/node_modules/ws/lib/validation.js +0 -141
  190. package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket-server.js +0 -559
  191. package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket.js +0 -1363
  192. package/dist/src/node_modules/engine.io-client/build/esm/contrib/has-cors.js +0 -13
  193. package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseqs.js +0 -36
  194. package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseuri.js +0 -66
  195. package/dist/src/node_modules/engine.io-client/build/esm/globals.node.js +0 -92
  196. package/dist/src/node_modules/engine.io-client/build/esm/index.js +0 -17
  197. package/dist/src/node_modules/engine.io-client/build/esm/socket.js +0 -728
  198. package/dist/src/node_modules/engine.io-client/build/esm/transport.js +0 -143
  199. package/dist/src/node_modules/engine.io-client/build/esm/transports/index.js +0 -11
  200. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +0 -256
  201. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +0 -21
  202. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling.js +0 -146
  203. package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.js +0 -107
  204. package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.node.js +0 -48
  205. package/dist/src/node_modules/engine.io-client/build/esm/transports/webtransport.js +0 -83
  206. package/dist/src/node_modules/engine.io-client/build/esm/util.js +0 -62
  207. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js +0 -142
  208. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/constants.js +0 -21
  209. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/event-target.js +0 -303
  210. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/extension.js +0 -214
  211. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/limiter.js +0 -64
  212. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js +0 -528
  213. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/receiver.js +0 -719
  214. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/sender.js +0 -513
  215. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/stream.js +0 -170
  216. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/subprotocol.js +0 -73
  217. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/validation.js +0 -141
  218. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js +0 -559
  219. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket.js +0 -1363
  220. package/dist/src/node_modules/engine.io-parser/build/cjs/commons.js +0 -29
  221. package/dist/src/node_modules/engine.io-parser/build/cjs/decodePacket.js +0 -70
  222. package/dist/src/node_modules/engine.io-parser/build/cjs/encodePacket.js +0 -51
  223. package/dist/src/node_modules/engine.io-parser/build/cjs/index.js +0 -179
  224. package/dist/src/node_modules/engine.io-parser/build/esm/commons.js +0 -15
  225. package/dist/src/node_modules/engine.io-parser/build/esm/decodePacket.js +0 -58
  226. package/dist/src/node_modules/engine.io-parser/build/esm/encodePacket.js +0 -36
  227. package/dist/src/node_modules/engine.io-parser/build/esm/index.js +0 -158
  228. package/dist/src/node_modules/es-define-property/index.js +0 -23
  229. package/dist/src/node_modules/es-errors/eval.js +0 -13
  230. package/dist/src/node_modules/es-errors/index.js +0 -13
  231. package/dist/src/node_modules/es-errors/range.js +0 -13
  232. package/dist/src/node_modules/es-errors/ref.js +0 -13
  233. package/dist/src/node_modules/es-errors/syntax.js +0 -13
  234. package/dist/src/node_modules/es-errors/type.js +0 -13
  235. package/dist/src/node_modules/es-errors/uri.js +0 -13
  236. package/dist/src/node_modules/es-object-atoms/index.js +0 -13
  237. package/dist/src/node_modules/function-bind/implementation.js +0 -93
  238. package/dist/src/node_modules/function-bind/index.js +0 -16
  239. package/dist/src/node_modules/get-intrinsic/index.js +0 -413
  240. package/dist/src/node_modules/get-proto/Object.getPrototypeOf.js +0 -17
  241. package/dist/src/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -13
  242. package/dist/src/node_modules/get-proto/index.js +0 -40
  243. package/dist/src/node_modules/gopd/gOPD.js +0 -13
  244. package/dist/src/node_modules/gopd/index.js +0 -26
  245. package/dist/src/node_modules/has-symbols/index.js +0 -25
  246. package/dist/src/node_modules/has-symbols/shams.js +0 -54
  247. package/dist/src/node_modules/hasown/index.js +0 -19
  248. package/dist/src/node_modules/http-errors/index.js +0 -306
  249. package/dist/src/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -598
  250. package/dist/src/node_modules/iconv-lite/encodings/dbcs-data.js +0 -206
  251. package/dist/src/node_modules/iconv-lite/encodings/index.js +0 -44
  252. package/dist/src/node_modules/iconv-lite/encodings/internal.js +0 -210
  253. package/dist/src/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -83
  254. package/dist/src/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -460
  255. package/dist/src/node_modules/iconv-lite/encodings/sbcs-data.js +0 -187
  256. package/dist/src/node_modules/iconv-lite/encodings/tables/big5-added.json.js +0 -506
  257. package/dist/src/node_modules/iconv-lite/encodings/tables/cp936.json.js +0 -2621
  258. package/dist/src/node_modules/iconv-lite/encodings/tables/cp949.json.js +0 -2380
  259. package/dist/src/node_modules/iconv-lite/encodings/tables/cp950.json.js +0 -729
  260. package/dist/src/node_modules/iconv-lite/encodings/tables/eucjp.json.js +0 -822
  261. package/dist/src/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json.js +0 -424
  262. package/dist/src/node_modules/iconv-lite/encodings/tables/gbk-added.json.js +0 -264
  263. package/dist/src/node_modules/iconv-lite/encodings/tables/shiftjis.json.js +0 -548
  264. package/dist/src/node_modules/iconv-lite/encodings/utf16.js +0 -206
  265. package/dist/src/node_modules/iconv-lite/encodings/utf32.js +0 -329
  266. package/dist/src/node_modules/iconv-lite/encodings/utf7.js +0 -297
  267. package/dist/src/node_modules/iconv-lite/lib/bom-handling.js +0 -61
  268. package/dist/src/node_modules/iconv-lite/lib/index.js +0 -192
  269. package/dist/src/node_modules/iconv-lite/lib/streams.js +0 -120
  270. package/dist/src/node_modules/inherits/inherits.js +0 -21
  271. package/dist/src/node_modules/inherits/inherits_browser.js +0 -38
  272. package/dist/src/node_modules/math-intrinsics/abs.js +0 -13
  273. package/dist/src/node_modules/math-intrinsics/floor.js +0 -13
  274. package/dist/src/node_modules/math-intrinsics/isNaN.js +0 -15
  275. package/dist/src/node_modules/math-intrinsics/max.js +0 -13
  276. package/dist/src/node_modules/math-intrinsics/min.js +0 -13
  277. package/dist/src/node_modules/math-intrinsics/pow.js +0 -13
  278. package/dist/src/node_modules/math-intrinsics/round.js +0 -13
  279. package/dist/src/node_modules/math-intrinsics/sign.js +0 -22
  280. package/dist/src/node_modules/media-typer/index.js +0 -153
  281. package/dist/src/node_modules/mime-db/db.json.js +0 -11656
  282. package/dist/src/node_modules/mime-db/index.js +0 -24
  283. package/dist/src/node_modules/mime-types/index.js +0 -226
  284. package/dist/src/node_modules/mime-types/mimeScore.js +0 -62
  285. package/dist/src/node_modules/ms/index.js +0 -172
  286. package/dist/src/node_modules/object-assign/index.js +0 -99
  287. package/dist/src/node_modules/object-inspect/index.js +0 -557
  288. package/dist/src/node_modules/object-inspect/util.inspect.js +0 -13
  289. package/dist/src/node_modules/on-finished/index.js +0 -245
  290. package/dist/src/node_modules/qs/lib/formats.js +0 -32
  291. package/dist/src/node_modules/qs/lib/index.js +0 -24
  292. package/dist/src/node_modules/qs/lib/parse.js +0 -339
  293. package/dist/src/node_modules/qs/lib/stringify.js +0 -369
  294. package/dist/src/node_modules/qs/lib/utils.js +0 -279
  295. package/dist/src/node_modules/raw-body/index.js +0 -351
  296. package/dist/src/node_modules/safer-buffer/safer.js +0 -88
  297. package/dist/src/node_modules/setprototypeof/index.js +0 -26
  298. package/dist/src/node_modules/side-channel/index.js +0 -58
  299. package/dist/src/node_modules/side-channel-list/index.js +0 -125
  300. package/dist/src/node_modules/side-channel-map/index.js +0 -82
  301. package/dist/src/node_modules/side-channel-weakmap/index.js +0 -99
  302. package/dist/src/node_modules/socket.io/dist/broadcast-operator.js +0 -448
  303. package/dist/src/node_modules/socket.io/dist/client.js +0 -281
  304. package/dist/src/node_modules/socket.io/dist/index.js +0 -837
  305. package/dist/src/node_modules/socket.io/dist/namespace.js +0 -597
  306. package/dist/src/node_modules/socket.io/dist/parent-namespace.js +0 -101
  307. package/dist/src/node_modules/socket.io/dist/socket-types.js +0 -21
  308. package/dist/src/node_modules/socket.io/dist/socket.js +0 -993
  309. package/dist/src/node_modules/socket.io/dist/typed-events.js +0 -92
  310. package/dist/src/node_modules/socket.io/dist/uws.js +0 -149
  311. package/dist/src/node_modules/socket.io/node_modules/accepts/index.js +0 -250
  312. package/dist/src/node_modules/socket.io/node_modules/debug/src/browser.js +0 -285
  313. package/dist/src/node_modules/socket.io/node_modules/debug/src/common.js +0 -285
  314. package/dist/src/node_modules/socket.io/node_modules/debug/src/index.js +0 -23
  315. package/dist/src/node_modules/socket.io/node_modules/debug/src/node.js +0 -279
  316. package/dist/src/node_modules/socket.io/node_modules/mime-db/db.json.js +0 -10704
  317. package/dist/src/node_modules/socket.io/node_modules/mime-db/index.js +0 -24
  318. package/dist/src/node_modules/socket.io/node_modules/mime-types/index.js +0 -202
  319. package/dist/src/node_modules/socket.io/node_modules/negotiator/index.js +0 -96
  320. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/charset.js +0 -179
  321. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/encoding.js +0 -193
  322. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/language.js +0 -188
  323. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/mediaType.js +0 -304
  324. package/dist/src/node_modules/socket.io/package.json.js +0 -5
  325. package/dist/src/node_modules/socket.io/wrapper.js +0 -5
  326. package/dist/src/node_modules/socket.io-adapter/dist/cluster-adapter.js +0 -689
  327. package/dist/src/node_modules/socket.io-adapter/dist/contrib/yeast.js +0 -64
  328. package/dist/src/node_modules/socket.io-adapter/dist/in-memory-adapter.js +0 -407
  329. package/dist/src/node_modules/socket.io-adapter/dist/index.js +0 -24
  330. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/browser.js +0 -285
  331. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/common.js +0 -285
  332. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/index.js +0 -23
  333. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/node.js +0 -279
  334. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/index.js +0 -28
  335. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/buffer-util.js +0 -142
  336. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/constants.js +0 -21
  337. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/event-target.js +0 -303
  338. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/extension.js +0 -214
  339. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/limiter.js +0 -64
  340. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/permessage-deflate.js +0 -528
  341. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/receiver.js +0 -719
  342. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/sender.js +0 -513
  343. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/stream.js +0 -170
  344. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/subprotocol.js +0 -73
  345. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/validation.js +0 -141
  346. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket-server.js +0 -559
  347. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket.js +0 -1363
  348. package/dist/src/node_modules/socket.io-client/build/esm/contrib/backo2.js +0 -68
  349. package/dist/src/node_modules/socket.io-client/build/esm/index.js +0 -50
  350. package/dist/src/node_modules/socket.io-client/build/esm/manager.js +0 -373
  351. package/dist/src/node_modules/socket.io-client/build/esm/on.js +0 -8
  352. package/dist/src/node_modules/socket.io-client/build/esm/socket.js +0 -884
  353. package/dist/src/node_modules/socket.io-client/build/esm/url.js +0 -63
  354. package/dist/src/node_modules/socket.io-parser/build/cjs/binary.js +0 -99
  355. package/dist/src/node_modules/socket.io-parser/build/cjs/index.js +0 -337
  356. package/dist/src/node_modules/socket.io-parser/build/cjs/is-binary.js +0 -65
  357. package/dist/src/node_modules/socket.io-parser/build/esm/binary.js +0 -86
  358. package/dist/src/node_modules/socket.io-parser/build/esm/index.js +0 -314
  359. package/dist/src/node_modules/socket.io-parser/build/esm/is-binary.js +0 -52
  360. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/browser.js +0 -285
  361. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/common.js +0 -285
  362. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/index.js +0 -23
  363. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/node.js +0 -279
  364. package/dist/src/node_modules/statuses/codes.json.js +0 -67
  365. package/dist/src/node_modules/statuses/index.js +0 -157
  366. package/dist/src/node_modules/toidentifier/index.js +0 -41
  367. package/dist/src/node_modules/type-is/index.js +0 -263
  368. package/dist/src/node_modules/unpipe/index.js +0 -78
  369. package/dist/src/node_modules/vary/index.js +0 -159
  370. package/dist/src/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +0 -702
@@ -1,719 +0,0 @@
1
- import require$$0 from 'stream';
2
- import { __require as requirePermessageDeflate } from './permessage-deflate.js';
3
- import { __require as requireConstants } from './constants.js';
4
- import { __require as requireBufferUtil } from './buffer-util.js';
5
- import { __require as requireValidation } from './validation.js';
6
-
7
- var receiver;
8
- var hasRequiredReceiver;
9
-
10
- function requireReceiver () {
11
- if (hasRequiredReceiver) return receiver;
12
- hasRequiredReceiver = 1;
13
-
14
- const { Writable } = require$$0;
15
-
16
- const PerMessageDeflate = requirePermessageDeflate();
17
- const {
18
- BINARY_TYPES,
19
- EMPTY_BUFFER,
20
- kStatusCode,
21
- kWebSocket
22
- } = requireConstants();
23
- const { concat, toArrayBuffer, unmask } = requireBufferUtil();
24
- const { isValidStatusCode, isValidUTF8 } = requireValidation();
25
-
26
- const FastBuffer = Buffer[Symbol.species];
27
-
28
- const GET_INFO = 0;
29
- const GET_PAYLOAD_LENGTH_16 = 1;
30
- const GET_PAYLOAD_LENGTH_64 = 2;
31
- const GET_MASK = 3;
32
- const GET_DATA = 4;
33
- const INFLATING = 5;
34
- const DEFER_EVENT = 6;
35
-
36
- /**
37
- * HyBi Receiver implementation.
38
- *
39
- * @extends Writable
40
- */
41
- class Receiver extends Writable {
42
- /**
43
- * Creates a Receiver instance.
44
- *
45
- * @param {Object} [options] Options object
46
- * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
47
- * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
48
- * multiple times in the same tick
49
- * @param {String} [options.binaryType=nodebuffer] The type for binary data
50
- * @param {Object} [options.extensions] An object containing the negotiated
51
- * extensions
52
- * @param {Boolean} [options.isServer=false] Specifies whether to operate in
53
- * client or server mode
54
- * @param {Number} [options.maxPayload=0] The maximum allowed message length
55
- * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
56
- * not to skip UTF-8 validation for text and close messages
57
- */
58
- constructor(options = {}) {
59
- super();
60
-
61
- this._allowSynchronousEvents =
62
- options.allowSynchronousEvents !== undefined
63
- ? options.allowSynchronousEvents
64
- : true;
65
- this._binaryType = options.binaryType || BINARY_TYPES[0];
66
- this._extensions = options.extensions || {};
67
- this._isServer = !!options.isServer;
68
- this._maxPayload = options.maxPayload | 0;
69
- this._skipUTF8Validation = !!options.skipUTF8Validation;
70
- this[kWebSocket] = undefined;
71
-
72
- this._bufferedBytes = 0;
73
- this._buffers = [];
74
-
75
- this._compressed = false;
76
- this._payloadLength = 0;
77
- this._mask = undefined;
78
- this._fragmented = 0;
79
- this._masked = false;
80
- this._fin = false;
81
- this._opcode = 0;
82
-
83
- this._totalPayloadLength = 0;
84
- this._messageLength = 0;
85
- this._fragments = [];
86
-
87
- this._errored = false;
88
- this._loop = false;
89
- this._state = GET_INFO;
90
- }
91
-
92
- /**
93
- * Implements `Writable.prototype._write()`.
94
- *
95
- * @param {Buffer} chunk The chunk of data to write
96
- * @param {String} encoding The character encoding of `chunk`
97
- * @param {Function} cb Callback
98
- * @private
99
- */
100
- _write(chunk, encoding, cb) {
101
- if (this._opcode === 0x08 && this._state == GET_INFO) return cb();
102
-
103
- this._bufferedBytes += chunk.length;
104
- this._buffers.push(chunk);
105
- this.startLoop(cb);
106
- }
107
-
108
- /**
109
- * Consumes `n` bytes from the buffered data.
110
- *
111
- * @param {Number} n The number of bytes to consume
112
- * @return {Buffer} The consumed bytes
113
- * @private
114
- */
115
- consume(n) {
116
- this._bufferedBytes -= n;
117
-
118
- if (n === this._buffers[0].length) return this._buffers.shift();
119
-
120
- if (n < this._buffers[0].length) {
121
- const buf = this._buffers[0];
122
- this._buffers[0] = new FastBuffer(
123
- buf.buffer,
124
- buf.byteOffset + n,
125
- buf.length - n
126
- );
127
-
128
- return new FastBuffer(buf.buffer, buf.byteOffset, n);
129
- }
130
-
131
- const dst = Buffer.allocUnsafe(n);
132
-
133
- do {
134
- const buf = this._buffers[0];
135
- const offset = dst.length - n;
136
-
137
- if (n >= buf.length) {
138
- dst.set(this._buffers.shift(), offset);
139
- } else {
140
- dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset);
141
- this._buffers[0] = new FastBuffer(
142
- buf.buffer,
143
- buf.byteOffset + n,
144
- buf.length - n
145
- );
146
- }
147
-
148
- n -= buf.length;
149
- } while (n > 0);
150
-
151
- return dst;
152
- }
153
-
154
- /**
155
- * Starts the parsing loop.
156
- *
157
- * @param {Function} cb Callback
158
- * @private
159
- */
160
- startLoop(cb) {
161
- this._loop = true;
162
-
163
- do {
164
- switch (this._state) {
165
- case GET_INFO:
166
- this.getInfo(cb);
167
- break;
168
- case GET_PAYLOAD_LENGTH_16:
169
- this.getPayloadLength16(cb);
170
- break;
171
- case GET_PAYLOAD_LENGTH_64:
172
- this.getPayloadLength64(cb);
173
- break;
174
- case GET_MASK:
175
- this.getMask();
176
- break;
177
- case GET_DATA:
178
- this.getData(cb);
179
- break;
180
- case INFLATING:
181
- case DEFER_EVENT:
182
- this._loop = false;
183
- return;
184
- }
185
- } while (this._loop);
186
-
187
- if (!this._errored) cb();
188
- }
189
-
190
- /**
191
- * Reads the first two bytes of a frame.
192
- *
193
- * @param {Function} cb Callback
194
- * @private
195
- */
196
- getInfo(cb) {
197
- if (this._bufferedBytes < 2) {
198
- this._loop = false;
199
- return;
200
- }
201
-
202
- const buf = this.consume(2);
203
-
204
- if ((buf[0] & 0x30) !== 0x00) {
205
- const error = this.createError(
206
- RangeError,
207
- 'RSV2 and RSV3 must be clear',
208
- true,
209
- 1002,
210
- 'WS_ERR_UNEXPECTED_RSV_2_3'
211
- );
212
-
213
- cb(error);
214
- return;
215
- }
216
-
217
- const compressed = (buf[0] & 0x40) === 0x40;
218
-
219
- if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
220
- const error = this.createError(
221
- RangeError,
222
- 'RSV1 must be clear',
223
- true,
224
- 1002,
225
- 'WS_ERR_UNEXPECTED_RSV_1'
226
- );
227
-
228
- cb(error);
229
- return;
230
- }
231
-
232
- this._fin = (buf[0] & 0x80) === 0x80;
233
- this._opcode = buf[0] & 0x0f;
234
- this._payloadLength = buf[1] & 0x7f;
235
-
236
- if (this._opcode === 0x00) {
237
- if (compressed) {
238
- const error = this.createError(
239
- RangeError,
240
- 'RSV1 must be clear',
241
- true,
242
- 1002,
243
- 'WS_ERR_UNEXPECTED_RSV_1'
244
- );
245
-
246
- cb(error);
247
- return;
248
- }
249
-
250
- if (!this._fragmented) {
251
- const error = this.createError(
252
- RangeError,
253
- 'invalid opcode 0',
254
- true,
255
- 1002,
256
- 'WS_ERR_INVALID_OPCODE'
257
- );
258
-
259
- cb(error);
260
- return;
261
- }
262
-
263
- this._opcode = this._fragmented;
264
- } else if (this._opcode === 0x01 || this._opcode === 0x02) {
265
- if (this._fragmented) {
266
- const error = this.createError(
267
- RangeError,
268
- `invalid opcode ${this._opcode}`,
269
- true,
270
- 1002,
271
- 'WS_ERR_INVALID_OPCODE'
272
- );
273
-
274
- cb(error);
275
- return;
276
- }
277
-
278
- this._compressed = compressed;
279
- } else if (this._opcode > 0x07 && this._opcode < 0x0b) {
280
- if (!this._fin) {
281
- const error = this.createError(
282
- RangeError,
283
- 'FIN must be set',
284
- true,
285
- 1002,
286
- 'WS_ERR_EXPECTED_FIN'
287
- );
288
-
289
- cb(error);
290
- return;
291
- }
292
-
293
- if (compressed) {
294
- const error = this.createError(
295
- RangeError,
296
- 'RSV1 must be clear',
297
- true,
298
- 1002,
299
- 'WS_ERR_UNEXPECTED_RSV_1'
300
- );
301
-
302
- cb(error);
303
- return;
304
- }
305
-
306
- if (
307
- this._payloadLength > 0x7d ||
308
- (this._opcode === 0x08 && this._payloadLength === 1)
309
- ) {
310
- const error = this.createError(
311
- RangeError,
312
- `invalid payload length ${this._payloadLength}`,
313
- true,
314
- 1002,
315
- 'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH'
316
- );
317
-
318
- cb(error);
319
- return;
320
- }
321
- } else {
322
- const error = this.createError(
323
- RangeError,
324
- `invalid opcode ${this._opcode}`,
325
- true,
326
- 1002,
327
- 'WS_ERR_INVALID_OPCODE'
328
- );
329
-
330
- cb(error);
331
- return;
332
- }
333
-
334
- if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
335
- this._masked = (buf[1] & 0x80) === 0x80;
336
-
337
- if (this._isServer) {
338
- if (!this._masked) {
339
- const error = this.createError(
340
- RangeError,
341
- 'MASK must be set',
342
- true,
343
- 1002,
344
- 'WS_ERR_EXPECTED_MASK'
345
- );
346
-
347
- cb(error);
348
- return;
349
- }
350
- } else if (this._masked) {
351
- const error = this.createError(
352
- RangeError,
353
- 'MASK must be clear',
354
- true,
355
- 1002,
356
- 'WS_ERR_UNEXPECTED_MASK'
357
- );
358
-
359
- cb(error);
360
- return;
361
- }
362
-
363
- if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
364
- else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64;
365
- else this.haveLength(cb);
366
- }
367
-
368
- /**
369
- * Gets extended payload length (7+16).
370
- *
371
- * @param {Function} cb Callback
372
- * @private
373
- */
374
- getPayloadLength16(cb) {
375
- if (this._bufferedBytes < 2) {
376
- this._loop = false;
377
- return;
378
- }
379
-
380
- this._payloadLength = this.consume(2).readUInt16BE(0);
381
- this.haveLength(cb);
382
- }
383
-
384
- /**
385
- * Gets extended payload length (7+64).
386
- *
387
- * @param {Function} cb Callback
388
- * @private
389
- */
390
- getPayloadLength64(cb) {
391
- if (this._bufferedBytes < 8) {
392
- this._loop = false;
393
- return;
394
- }
395
-
396
- const buf = this.consume(8);
397
- const num = buf.readUInt32BE(0);
398
-
399
- //
400
- // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned
401
- // if payload length is greater than this number.
402
- //
403
- if (num > Math.pow(2, 53 - 32) - 1) {
404
- const error = this.createError(
405
- RangeError,
406
- 'Unsupported WebSocket frame: payload length > 2^53 - 1',
407
- false,
408
- 1009,
409
- 'WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH'
410
- );
411
-
412
- cb(error);
413
- return;
414
- }
415
-
416
- this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
417
- this.haveLength(cb);
418
- }
419
-
420
- /**
421
- * Payload length has been read.
422
- *
423
- * @param {Function} cb Callback
424
- * @private
425
- */
426
- haveLength(cb) {
427
- if (this._payloadLength && this._opcode < 0x08) {
428
- this._totalPayloadLength += this._payloadLength;
429
- if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
430
- const error = this.createError(
431
- RangeError,
432
- 'Max payload size exceeded',
433
- false,
434
- 1009,
435
- 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'
436
- );
437
-
438
- cb(error);
439
- return;
440
- }
441
- }
442
-
443
- if (this._masked) this._state = GET_MASK;
444
- else this._state = GET_DATA;
445
- }
446
-
447
- /**
448
- * Reads mask bytes.
449
- *
450
- * @private
451
- */
452
- getMask() {
453
- if (this._bufferedBytes < 4) {
454
- this._loop = false;
455
- return;
456
- }
457
-
458
- this._mask = this.consume(4);
459
- this._state = GET_DATA;
460
- }
461
-
462
- /**
463
- * Reads data bytes.
464
- *
465
- * @param {Function} cb Callback
466
- * @private
467
- */
468
- getData(cb) {
469
- let data = EMPTY_BUFFER;
470
-
471
- if (this._payloadLength) {
472
- if (this._bufferedBytes < this._payloadLength) {
473
- this._loop = false;
474
- return;
475
- }
476
-
477
- data = this.consume(this._payloadLength);
478
-
479
- if (
480
- this._masked &&
481
- (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0
482
- ) {
483
- unmask(data, this._mask);
484
- }
485
- }
486
-
487
- if (this._opcode > 0x07) {
488
- this.controlMessage(data, cb);
489
- return;
490
- }
491
-
492
- if (this._compressed) {
493
- this._state = INFLATING;
494
- this.decompress(data, cb);
495
- return;
496
- }
497
-
498
- if (data.length) {
499
- //
500
- // This message is not compressed so its length is the sum of the payload
501
- // length of all fragments.
502
- //
503
- this._messageLength = this._totalPayloadLength;
504
- this._fragments.push(data);
505
- }
506
-
507
- this.dataMessage(cb);
508
- }
509
-
510
- /**
511
- * Decompresses data.
512
- *
513
- * @param {Buffer} data Compressed data
514
- * @param {Function} cb Callback
515
- * @private
516
- */
517
- decompress(data, cb) {
518
- const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
519
-
520
- perMessageDeflate.decompress(data, this._fin, (err, buf) => {
521
- if (err) return cb(err);
522
-
523
- if (buf.length) {
524
- this._messageLength += buf.length;
525
- if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
526
- const error = this.createError(
527
- RangeError,
528
- 'Max payload size exceeded',
529
- false,
530
- 1009,
531
- 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'
532
- );
533
-
534
- cb(error);
535
- return;
536
- }
537
-
538
- this._fragments.push(buf);
539
- }
540
-
541
- this.dataMessage(cb);
542
- if (this._state === GET_INFO) this.startLoop(cb);
543
- });
544
- }
545
-
546
- /**
547
- * Handles a data message.
548
- *
549
- * @param {Function} cb Callback
550
- * @private
551
- */
552
- dataMessage(cb) {
553
- if (!this._fin) {
554
- this._state = GET_INFO;
555
- return;
556
- }
557
-
558
- const messageLength = this._messageLength;
559
- const fragments = this._fragments;
560
-
561
- this._totalPayloadLength = 0;
562
- this._messageLength = 0;
563
- this._fragmented = 0;
564
- this._fragments = [];
565
-
566
- if (this._opcode === 2) {
567
- let data;
568
-
569
- if (this._binaryType === 'nodebuffer') {
570
- data = concat(fragments, messageLength);
571
- } else if (this._binaryType === 'arraybuffer') {
572
- data = toArrayBuffer(concat(fragments, messageLength));
573
- } else {
574
- data = fragments;
575
- }
576
-
577
- if (this._allowSynchronousEvents) {
578
- this.emit('message', data, true);
579
- this._state = GET_INFO;
580
- } else {
581
- this._state = DEFER_EVENT;
582
- setImmediate(() => {
583
- this.emit('message', data, true);
584
- this._state = GET_INFO;
585
- this.startLoop(cb);
586
- });
587
- }
588
- } else {
589
- const buf = concat(fragments, messageLength);
590
-
591
- if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
592
- const error = this.createError(
593
- Error,
594
- 'invalid UTF-8 sequence',
595
- true,
596
- 1007,
597
- 'WS_ERR_INVALID_UTF8'
598
- );
599
-
600
- cb(error);
601
- return;
602
- }
603
-
604
- if (this._state === INFLATING || this._allowSynchronousEvents) {
605
- this.emit('message', buf, false);
606
- this._state = GET_INFO;
607
- } else {
608
- this._state = DEFER_EVENT;
609
- setImmediate(() => {
610
- this.emit('message', buf, false);
611
- this._state = GET_INFO;
612
- this.startLoop(cb);
613
- });
614
- }
615
- }
616
- }
617
-
618
- /**
619
- * Handles a control message.
620
- *
621
- * @param {Buffer} data Data to handle
622
- * @return {(Error|RangeError|undefined)} A possible error
623
- * @private
624
- */
625
- controlMessage(data, cb) {
626
- if (this._opcode === 0x08) {
627
- if (data.length === 0) {
628
- this._loop = false;
629
- this.emit('conclude', 1005, EMPTY_BUFFER);
630
- this.end();
631
- } else {
632
- const code = data.readUInt16BE(0);
633
-
634
- if (!isValidStatusCode(code)) {
635
- const error = this.createError(
636
- RangeError,
637
- `invalid status code ${code}`,
638
- true,
639
- 1002,
640
- 'WS_ERR_INVALID_CLOSE_CODE'
641
- );
642
-
643
- cb(error);
644
- return;
645
- }
646
-
647
- const buf = new FastBuffer(
648
- data.buffer,
649
- data.byteOffset + 2,
650
- data.length - 2
651
- );
652
-
653
- if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
654
- const error = this.createError(
655
- Error,
656
- 'invalid UTF-8 sequence',
657
- true,
658
- 1007,
659
- 'WS_ERR_INVALID_UTF8'
660
- );
661
-
662
- cb(error);
663
- return;
664
- }
665
-
666
- this._loop = false;
667
- this.emit('conclude', code, buf);
668
- this.end();
669
- }
670
-
671
- this._state = GET_INFO;
672
- return;
673
- }
674
-
675
- if (this._allowSynchronousEvents) {
676
- this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data);
677
- this._state = GET_INFO;
678
- } else {
679
- this._state = DEFER_EVENT;
680
- setImmediate(() => {
681
- this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data);
682
- this._state = GET_INFO;
683
- this.startLoop(cb);
684
- });
685
- }
686
- }
687
-
688
- /**
689
- * Builds an error object.
690
- *
691
- * @param {function(new:Error|RangeError)} ErrorCtor The error constructor
692
- * @param {String} message The error message
693
- * @param {Boolean} prefix Specifies whether or not to add a default prefix to
694
- * `message`
695
- * @param {Number} statusCode The status code
696
- * @param {String} errorCode The exposed error code
697
- * @return {(Error|RangeError)} The error
698
- * @private
699
- */
700
- createError(ErrorCtor, message, prefix, statusCode, errorCode) {
701
- this._loop = false;
702
- this._errored = true;
703
-
704
- const err = new ErrorCtor(
705
- prefix ? `Invalid WebSocket frame: ${message}` : message
706
- );
707
-
708
- Error.captureStackTrace(err, this.createError);
709
- err.code = errorCode;
710
- err[kStatusCode] = statusCode;
711
- return err;
712
- }
713
- }
714
-
715
- receiver = Receiver;
716
- return receiver;
717
- }
718
-
719
- export { requireReceiver as __require };