@wabot-dev/framework 0.0.14 → 0.0.16

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 (361) hide show
  1. package/dist/src/channels/cmd/@cmd.js +1 -1
  2. package/dist/src/channels/cmd/CmdChannel.js +1 -1
  3. package/dist/src/channels/telegram/@telegram.js +1 -1
  4. package/dist/src/channels/telegram/TelegramChannel.js +1 -1
  5. package/dist/src/channels/whatsapp/@whatsapp.js +1 -1
  6. package/dist/src/channels/whatsapp/WhatsAppChannel.js +1 -1
  7. package/dist/src/channels/whatsapp/WhatsAppConnection.js +1 -1
  8. package/dist/src/channels/whatsapp/WhatsAppDevConnection.js +2 -2
  9. package/dist/src/channels/whatsapp/WhatsAppProdConnection.js +1 -1
  10. package/dist/src/controller/socket.io/SocketIO.js +1 -1
  11. package/dist/src/logger/Logger.js +1 -1
  12. package/dist/src/server/runChannel.js +1 -1
  13. package/dist/src/server/runServer.js +4 -4
  14. package/package.json +2 -1
  15. package/dist/src/_virtual/XMLHttpRequest.js +0 -7
  16. package/dist/src/_virtual/_commonjsHelpers.js +0 -32
  17. package/dist/src/_virtual/base64id.js +0 -3
  18. package/dist/src/_virtual/binary.js +0 -3
  19. package/dist/src/_virtual/bom-handling.js +0 -3
  20. package/dist/src/_virtual/broadcast-operator.js +0 -3
  21. package/dist/src/_virtual/browser.js +0 -3
  22. package/dist/src/_virtual/browser2.js +0 -3
  23. package/dist/src/_virtual/browser3.js +0 -3
  24. package/dist/src/_virtual/browser4.js +0 -3
  25. package/dist/src/_virtual/browser5.js +0 -3
  26. package/dist/src/_virtual/buffer-util.js +0 -3
  27. package/dist/src/_virtual/buffer-util2.js +0 -3
  28. package/dist/src/_virtual/buffer-util3.js +0 -3
  29. package/dist/src/_virtual/charset.js +0 -3
  30. package/dist/src/_virtual/charset2.js +0 -3
  31. package/dist/src/_virtual/client.js +0 -3
  32. package/dist/src/_virtual/cluster-adapter.js +0 -3
  33. package/dist/src/_virtual/commons.js +0 -3
  34. package/dist/src/_virtual/dbcs-codec.js +0 -3
  35. package/dist/src/_virtual/decodePacket.js +0 -3
  36. package/dist/src/_virtual/encodePacket.js +0 -3
  37. package/dist/src/_virtual/encoding.js +0 -3
  38. package/dist/src/_virtual/encoding2.js +0 -3
  39. package/dist/src/_virtual/engine.io.js +0 -3
  40. package/dist/src/_virtual/in-memory-adapter.js +0 -3
  41. package/dist/src/_virtual/index.js +0 -7
  42. package/dist/src/_virtual/index10.js +0 -3
  43. package/dist/src/_virtual/index11.js +0 -3
  44. package/dist/src/_virtual/index12.js +0 -3
  45. package/dist/src/_virtual/index13.js +0 -3
  46. package/dist/src/_virtual/index14.js +0 -3
  47. package/dist/src/_virtual/index15.js +0 -3
  48. package/dist/src/_virtual/index16.js +0 -3
  49. package/dist/src/_virtual/index17.js +0 -3
  50. package/dist/src/_virtual/index18.js +0 -3
  51. package/dist/src/_virtual/index19.js +0 -3
  52. package/dist/src/_virtual/index2.js +0 -7
  53. package/dist/src/_virtual/index20.js +0 -3
  54. package/dist/src/_virtual/index21.js +0 -3
  55. package/dist/src/_virtual/index22.js +0 -3
  56. package/dist/src/_virtual/index23.js +0 -3
  57. package/dist/src/_virtual/index24.js +0 -3
  58. package/dist/src/_virtual/index25.js +0 -3
  59. package/dist/src/_virtual/index26.js +0 -3
  60. package/dist/src/_virtual/index27.js +0 -3
  61. package/dist/src/_virtual/index28.js +0 -3
  62. package/dist/src/_virtual/index29.js +0 -3
  63. package/dist/src/_virtual/index3.js +0 -7
  64. package/dist/src/_virtual/index30.js +0 -3
  65. package/dist/src/_virtual/index31.js +0 -3
  66. package/dist/src/_virtual/index32.js +0 -3
  67. package/dist/src/_virtual/index33.js +0 -3
  68. package/dist/src/_virtual/index4.js +0 -3
  69. package/dist/src/_virtual/index5.js +0 -3
  70. package/dist/src/_virtual/index6.js +0 -3
  71. package/dist/src/_virtual/index7.js +0 -3
  72. package/dist/src/_virtual/index8.js +0 -6
  73. package/dist/src/_virtual/index9.js +0 -3
  74. package/dist/src/_virtual/inherits.js +0 -3
  75. package/dist/src/_virtual/inherits_browser.js +0 -3
  76. package/dist/src/_virtual/is-binary.js +0 -3
  77. package/dist/src/_virtual/language.js +0 -3
  78. package/dist/src/_virtual/language2.js +0 -3
  79. package/dist/src/_virtual/mediaType.js +0 -3
  80. package/dist/src/_virtual/mediaType2.js +0 -3
  81. package/dist/src/_virtual/namespace.js +0 -3
  82. package/dist/src/_virtual/node.js +0 -3
  83. package/dist/src/_virtual/node2.js +0 -3
  84. package/dist/src/_virtual/node3.js +0 -3
  85. package/dist/src/_virtual/node4.js +0 -3
  86. package/dist/src/_virtual/node5.js +0 -3
  87. package/dist/src/_virtual/parent-namespace.js +0 -3
  88. package/dist/src/_virtual/polling-jsonp.js +0 -3
  89. package/dist/src/_virtual/polling.js +0 -3
  90. package/dist/src/_virtual/polling2.js +0 -3
  91. package/dist/src/_virtual/receiver.js +0 -3
  92. package/dist/src/_virtual/sbcs-codec.js +0 -3
  93. package/dist/src/_virtual/sender.js +0 -3
  94. package/dist/src/_virtual/server.js +0 -3
  95. package/dist/src/_virtual/socket-types.js +0 -3
  96. package/dist/src/_virtual/socket.js +0 -3
  97. package/dist/src/_virtual/socket2.js +0 -3
  98. package/dist/src/_virtual/stream.js +0 -3
  99. package/dist/src/_virtual/transport.js +0 -3
  100. package/dist/src/_virtual/typed-events.js +0 -3
  101. package/dist/src/_virtual/userver.js +0 -3
  102. package/dist/src/_virtual/utf16.js +0 -3
  103. package/dist/src/_virtual/utf32.js +0 -3
  104. package/dist/src/_virtual/utf7.js +0 -3
  105. package/dist/src/_virtual/uws.js +0 -3
  106. package/dist/src/_virtual/validation.js +0 -3
  107. package/dist/src/_virtual/validation2.js +0 -3
  108. package/dist/src/_virtual/validation3.js +0 -3
  109. package/dist/src/_virtual/websocket-server.js +0 -3
  110. package/dist/src/_virtual/websocket.js +0 -7
  111. package/dist/src/_virtual/websocket2.js +0 -3
  112. package/dist/src/_virtual/websocket3.js +0 -3
  113. package/dist/src/_virtual/webtransport.js +0 -3
  114. package/dist/src/_virtual/yeast.js +0 -3
  115. package/dist/src/node_modules/@socket.io/component-emitter/lib/esm/index.js +0 -171
  116. package/dist/src/node_modules/base64id/lib/base64id.js +0 -117
  117. package/dist/src/node_modules/body-parser/index.js +0 -96
  118. package/dist/src/node_modules/body-parser/lib/read.js +0 -225
  119. package/dist/src/node_modules/body-parser/lib/types/json.js +0 -222
  120. package/dist/src/node_modules/body-parser/lib/types/raw.js +0 -90
  121. package/dist/src/node_modules/body-parser/lib/types/text.js +0 -95
  122. package/dist/src/node_modules/body-parser/lib/types/urlencoded.js +0 -194
  123. package/dist/src/node_modules/body-parser/lib/utils.js +0 -96
  124. package/dist/src/node_modules/bytes/index.js +0 -180
  125. package/dist/src/node_modules/call-bind-apply-helpers/actualApply.js +0 -24
  126. package/dist/src/node_modules/call-bind-apply-helpers/functionApply.js +0 -13
  127. package/dist/src/node_modules/call-bind-apply-helpers/functionCall.js +0 -13
  128. package/dist/src/node_modules/call-bind-apply-helpers/index.js +0 -29
  129. package/dist/src/node_modules/call-bind-apply-helpers/reflectApply.js +0 -13
  130. package/dist/src/node_modules/call-bound/index.js +0 -31
  131. package/dist/src/node_modules/content-type/index.js +0 -235
  132. package/dist/src/node_modules/cookie/index.js +0 -345
  133. package/dist/src/node_modules/cors/lib/index.js +0 -249
  134. package/dist/src/node_modules/debug/src/browser.js +0 -286
  135. package/dist/src/node_modules/debug/src/common.js +0 -303
  136. package/dist/src/node_modules/debug/src/index.js +0 -23
  137. package/dist/src/node_modules/debug/src/node.js +0 -279
  138. package/dist/src/node_modules/depd/index.js +0 -550
  139. package/dist/src/node_modules/dunder-proto/get.js +0 -42
  140. package/dist/src/node_modules/ee-first/index.js +0 -104
  141. package/dist/src/node_modules/engine.io/build/engine.io.js +0 -73
  142. package/dist/src/node_modules/engine.io/build/parser-v3/index.js +0 -429
  143. package/dist/src/node_modules/engine.io/build/parser-v3/utf8.js +0 -198
  144. package/dist/src/node_modules/engine.io/build/server.js +0 -808
  145. package/dist/src/node_modules/engine.io/build/socket.js +0 -469
  146. package/dist/src/node_modules/engine.io/build/transport.js +0 -131
  147. package/dist/src/node_modules/engine.io/build/transports/index.js +0 -37
  148. package/dist/src/node_modules/engine.io/build/transports/polling-jsonp.js +0 -53
  149. package/dist/src/node_modules/engine.io/build/transports/polling.js +0 -346
  150. package/dist/src/node_modules/engine.io/build/transports/websocket.js +0 -106
  151. package/dist/src/node_modules/engine.io/build/transports/webtransport.js +0 -76
  152. package/dist/src/node_modules/engine.io/build/transports-uws/index.js +0 -20
  153. package/dist/src/node_modules/engine.io/build/transports-uws/polling.js +0 -378
  154. package/dist/src/node_modules/engine.io/build/transports-uws/websocket.js +0 -85
  155. package/dist/src/node_modules/engine.io/build/userver.js +0 -292
  156. package/dist/src/node_modules/engine.io/node_modules/accepts/index.js +0 -250
  157. package/dist/src/node_modules/engine.io/node_modules/debug/src/browser.js +0 -285
  158. package/dist/src/node_modules/engine.io/node_modules/debug/src/common.js +0 -285
  159. package/dist/src/node_modules/engine.io/node_modules/debug/src/index.js +0 -23
  160. package/dist/src/node_modules/engine.io/node_modules/debug/src/node.js +0 -279
  161. package/dist/src/node_modules/engine.io/node_modules/mime-db/db.json.js +0 -10704
  162. package/dist/src/node_modules/engine.io/node_modules/mime-db/index.js +0 -24
  163. package/dist/src/node_modules/engine.io/node_modules/mime-types/index.js +0 -202
  164. package/dist/src/node_modules/engine.io/node_modules/negotiator/index.js +0 -96
  165. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/charset.js +0 -179
  166. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/encoding.js +0 -193
  167. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/language.js +0 -188
  168. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/mediaType.js +0 -304
  169. package/dist/src/node_modules/engine.io/node_modules/ws/index.js +0 -28
  170. package/dist/src/node_modules/engine.io/node_modules/ws/lib/buffer-util.js +0 -142
  171. package/dist/src/node_modules/engine.io/node_modules/ws/lib/constants.js +0 -21
  172. package/dist/src/node_modules/engine.io/node_modules/ws/lib/event-target.js +0 -303
  173. package/dist/src/node_modules/engine.io/node_modules/ws/lib/extension.js +0 -214
  174. package/dist/src/node_modules/engine.io/node_modules/ws/lib/limiter.js +0 -64
  175. package/dist/src/node_modules/engine.io/node_modules/ws/lib/permessage-deflate.js +0 -528
  176. package/dist/src/node_modules/engine.io/node_modules/ws/lib/receiver.js +0 -719
  177. package/dist/src/node_modules/engine.io/node_modules/ws/lib/sender.js +0 -513
  178. package/dist/src/node_modules/engine.io/node_modules/ws/lib/stream.js +0 -170
  179. package/dist/src/node_modules/engine.io/node_modules/ws/lib/subprotocol.js +0 -73
  180. package/dist/src/node_modules/engine.io/node_modules/ws/lib/validation.js +0 -141
  181. package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket-server.js +0 -559
  182. package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket.js +0 -1363
  183. package/dist/src/node_modules/engine.io-client/build/esm/contrib/has-cors.js +0 -13
  184. package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseqs.js +0 -36
  185. package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseuri.js +0 -66
  186. package/dist/src/node_modules/engine.io-client/build/esm/globals.node.js +0 -92
  187. package/dist/src/node_modules/engine.io-client/build/esm/index.js +0 -17
  188. package/dist/src/node_modules/engine.io-client/build/esm/socket.js +0 -728
  189. package/dist/src/node_modules/engine.io-client/build/esm/transport.js +0 -143
  190. package/dist/src/node_modules/engine.io-client/build/esm/transports/index.js +0 -11
  191. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +0 -256
  192. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +0 -21
  193. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling.js +0 -146
  194. package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.js +0 -107
  195. package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.node.js +0 -48
  196. package/dist/src/node_modules/engine.io-client/build/esm/transports/webtransport.js +0 -83
  197. package/dist/src/node_modules/engine.io-client/build/esm/util.js +0 -62
  198. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js +0 -142
  199. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/constants.js +0 -21
  200. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/event-target.js +0 -303
  201. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/extension.js +0 -214
  202. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/limiter.js +0 -64
  203. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js +0 -528
  204. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/receiver.js +0 -719
  205. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/sender.js +0 -513
  206. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/stream.js +0 -170
  207. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/subprotocol.js +0 -73
  208. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/validation.js +0 -141
  209. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js +0 -559
  210. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket.js +0 -1363
  211. package/dist/src/node_modules/engine.io-parser/build/cjs/commons.js +0 -29
  212. package/dist/src/node_modules/engine.io-parser/build/cjs/decodePacket.js +0 -70
  213. package/dist/src/node_modules/engine.io-parser/build/cjs/encodePacket.js +0 -51
  214. package/dist/src/node_modules/engine.io-parser/build/cjs/index.js +0 -179
  215. package/dist/src/node_modules/engine.io-parser/build/esm/commons.js +0 -15
  216. package/dist/src/node_modules/engine.io-parser/build/esm/decodePacket.js +0 -58
  217. package/dist/src/node_modules/engine.io-parser/build/esm/encodePacket.js +0 -36
  218. package/dist/src/node_modules/engine.io-parser/build/esm/index.js +0 -158
  219. package/dist/src/node_modules/es-define-property/index.js +0 -23
  220. package/dist/src/node_modules/es-errors/eval.js +0 -13
  221. package/dist/src/node_modules/es-errors/index.js +0 -13
  222. package/dist/src/node_modules/es-errors/range.js +0 -13
  223. package/dist/src/node_modules/es-errors/ref.js +0 -13
  224. package/dist/src/node_modules/es-errors/syntax.js +0 -13
  225. package/dist/src/node_modules/es-errors/type.js +0 -13
  226. package/dist/src/node_modules/es-errors/uri.js +0 -13
  227. package/dist/src/node_modules/es-object-atoms/index.js +0 -13
  228. package/dist/src/node_modules/function-bind/implementation.js +0 -93
  229. package/dist/src/node_modules/function-bind/index.js +0 -16
  230. package/dist/src/node_modules/get-intrinsic/index.js +0 -413
  231. package/dist/src/node_modules/get-proto/Object.getPrototypeOf.js +0 -17
  232. package/dist/src/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -13
  233. package/dist/src/node_modules/get-proto/index.js +0 -40
  234. package/dist/src/node_modules/gopd/gOPD.js +0 -13
  235. package/dist/src/node_modules/gopd/index.js +0 -26
  236. package/dist/src/node_modules/has-symbols/index.js +0 -25
  237. package/dist/src/node_modules/has-symbols/shams.js +0 -54
  238. package/dist/src/node_modules/hasown/index.js +0 -19
  239. package/dist/src/node_modules/http-errors/index.js +0 -306
  240. package/dist/src/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -598
  241. package/dist/src/node_modules/iconv-lite/encodings/dbcs-data.js +0 -206
  242. package/dist/src/node_modules/iconv-lite/encodings/index.js +0 -44
  243. package/dist/src/node_modules/iconv-lite/encodings/internal.js +0 -210
  244. package/dist/src/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -83
  245. package/dist/src/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -460
  246. package/dist/src/node_modules/iconv-lite/encodings/sbcs-data.js +0 -187
  247. package/dist/src/node_modules/iconv-lite/encodings/tables/big5-added.json.js +0 -506
  248. package/dist/src/node_modules/iconv-lite/encodings/tables/cp936.json.js +0 -2621
  249. package/dist/src/node_modules/iconv-lite/encodings/tables/cp949.json.js +0 -2380
  250. package/dist/src/node_modules/iconv-lite/encodings/tables/cp950.json.js +0 -729
  251. package/dist/src/node_modules/iconv-lite/encodings/tables/eucjp.json.js +0 -822
  252. package/dist/src/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json.js +0 -424
  253. package/dist/src/node_modules/iconv-lite/encodings/tables/gbk-added.json.js +0 -264
  254. package/dist/src/node_modules/iconv-lite/encodings/tables/shiftjis.json.js +0 -548
  255. package/dist/src/node_modules/iconv-lite/encodings/utf16.js +0 -206
  256. package/dist/src/node_modules/iconv-lite/encodings/utf32.js +0 -329
  257. package/dist/src/node_modules/iconv-lite/encodings/utf7.js +0 -297
  258. package/dist/src/node_modules/iconv-lite/lib/bom-handling.js +0 -61
  259. package/dist/src/node_modules/iconv-lite/lib/index.js +0 -192
  260. package/dist/src/node_modules/iconv-lite/lib/streams.js +0 -120
  261. package/dist/src/node_modules/inherits/inherits.js +0 -21
  262. package/dist/src/node_modules/inherits/inherits_browser.js +0 -38
  263. package/dist/src/node_modules/math-intrinsics/abs.js +0 -13
  264. package/dist/src/node_modules/math-intrinsics/floor.js +0 -13
  265. package/dist/src/node_modules/math-intrinsics/isNaN.js +0 -15
  266. package/dist/src/node_modules/math-intrinsics/max.js +0 -13
  267. package/dist/src/node_modules/math-intrinsics/min.js +0 -13
  268. package/dist/src/node_modules/math-intrinsics/pow.js +0 -13
  269. package/dist/src/node_modules/math-intrinsics/round.js +0 -13
  270. package/dist/src/node_modules/math-intrinsics/sign.js +0 -22
  271. package/dist/src/node_modules/media-typer/index.js +0 -153
  272. package/dist/src/node_modules/mime-db/db.json.js +0 -11656
  273. package/dist/src/node_modules/mime-db/index.js +0 -24
  274. package/dist/src/node_modules/mime-types/index.js +0 -226
  275. package/dist/src/node_modules/mime-types/mimeScore.js +0 -62
  276. package/dist/src/node_modules/ms/index.js +0 -172
  277. package/dist/src/node_modules/object-assign/index.js +0 -99
  278. package/dist/src/node_modules/object-inspect/index.js +0 -557
  279. package/dist/src/node_modules/object-inspect/util.inspect.js +0 -13
  280. package/dist/src/node_modules/on-finished/index.js +0 -245
  281. package/dist/src/node_modules/qs/lib/formats.js +0 -32
  282. package/dist/src/node_modules/qs/lib/index.js +0 -24
  283. package/dist/src/node_modules/qs/lib/parse.js +0 -339
  284. package/dist/src/node_modules/qs/lib/stringify.js +0 -369
  285. package/dist/src/node_modules/qs/lib/utils.js +0 -279
  286. package/dist/src/node_modules/raw-body/index.js +0 -351
  287. package/dist/src/node_modules/safer-buffer/safer.js +0 -88
  288. package/dist/src/node_modules/setprototypeof/index.js +0 -26
  289. package/dist/src/node_modules/side-channel/index.js +0 -58
  290. package/dist/src/node_modules/side-channel-list/index.js +0 -125
  291. package/dist/src/node_modules/side-channel-map/index.js +0 -82
  292. package/dist/src/node_modules/side-channel-weakmap/index.js +0 -99
  293. package/dist/src/node_modules/socket.io/dist/broadcast-operator.js +0 -448
  294. package/dist/src/node_modules/socket.io/dist/client.js +0 -281
  295. package/dist/src/node_modules/socket.io/dist/index.js +0 -837
  296. package/dist/src/node_modules/socket.io/dist/namespace.js +0 -597
  297. package/dist/src/node_modules/socket.io/dist/parent-namespace.js +0 -101
  298. package/dist/src/node_modules/socket.io/dist/socket-types.js +0 -21
  299. package/dist/src/node_modules/socket.io/dist/socket.js +0 -993
  300. package/dist/src/node_modules/socket.io/dist/typed-events.js +0 -92
  301. package/dist/src/node_modules/socket.io/dist/uws.js +0 -149
  302. package/dist/src/node_modules/socket.io/node_modules/accepts/index.js +0 -250
  303. package/dist/src/node_modules/socket.io/node_modules/debug/src/browser.js +0 -285
  304. package/dist/src/node_modules/socket.io/node_modules/debug/src/common.js +0 -285
  305. package/dist/src/node_modules/socket.io/node_modules/debug/src/index.js +0 -23
  306. package/dist/src/node_modules/socket.io/node_modules/debug/src/node.js +0 -279
  307. package/dist/src/node_modules/socket.io/node_modules/mime-db/db.json.js +0 -10704
  308. package/dist/src/node_modules/socket.io/node_modules/mime-db/index.js +0 -24
  309. package/dist/src/node_modules/socket.io/node_modules/mime-types/index.js +0 -202
  310. package/dist/src/node_modules/socket.io/node_modules/negotiator/index.js +0 -96
  311. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/charset.js +0 -179
  312. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/encoding.js +0 -193
  313. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/language.js +0 -188
  314. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/mediaType.js +0 -304
  315. package/dist/src/node_modules/socket.io/package.json.js +0 -5
  316. package/dist/src/node_modules/socket.io/wrapper.js +0 -5
  317. package/dist/src/node_modules/socket.io-adapter/dist/cluster-adapter.js +0 -689
  318. package/dist/src/node_modules/socket.io-adapter/dist/contrib/yeast.js +0 -64
  319. package/dist/src/node_modules/socket.io-adapter/dist/in-memory-adapter.js +0 -407
  320. package/dist/src/node_modules/socket.io-adapter/dist/index.js +0 -24
  321. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/browser.js +0 -285
  322. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/common.js +0 -285
  323. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/index.js +0 -23
  324. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/node.js +0 -279
  325. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/index.js +0 -28
  326. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/buffer-util.js +0 -142
  327. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/constants.js +0 -21
  328. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/event-target.js +0 -303
  329. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/extension.js +0 -214
  330. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/limiter.js +0 -64
  331. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/permessage-deflate.js +0 -528
  332. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/receiver.js +0 -719
  333. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/sender.js +0 -513
  334. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/stream.js +0 -170
  335. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/subprotocol.js +0 -73
  336. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/validation.js +0 -141
  337. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket-server.js +0 -559
  338. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket.js +0 -1363
  339. package/dist/src/node_modules/socket.io-client/build/esm/contrib/backo2.js +0 -68
  340. package/dist/src/node_modules/socket.io-client/build/esm/index.js +0 -50
  341. package/dist/src/node_modules/socket.io-client/build/esm/manager.js +0 -373
  342. package/dist/src/node_modules/socket.io-client/build/esm/on.js +0 -8
  343. package/dist/src/node_modules/socket.io-client/build/esm/socket.js +0 -884
  344. package/dist/src/node_modules/socket.io-client/build/esm/url.js +0 -63
  345. package/dist/src/node_modules/socket.io-parser/build/cjs/binary.js +0 -99
  346. package/dist/src/node_modules/socket.io-parser/build/cjs/index.js +0 -337
  347. package/dist/src/node_modules/socket.io-parser/build/cjs/is-binary.js +0 -65
  348. package/dist/src/node_modules/socket.io-parser/build/esm/binary.js +0 -86
  349. package/dist/src/node_modules/socket.io-parser/build/esm/index.js +0 -314
  350. package/dist/src/node_modules/socket.io-parser/build/esm/is-binary.js +0 -52
  351. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/browser.js +0 -285
  352. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/common.js +0 -285
  353. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/index.js +0 -23
  354. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/node.js +0 -279
  355. package/dist/src/node_modules/statuses/codes.json.js +0 -67
  356. package/dist/src/node_modules/statuses/index.js +0 -157
  357. package/dist/src/node_modules/toidentifier/index.js +0 -41
  358. package/dist/src/node_modules/type-is/index.js +0 -263
  359. package/dist/src/node_modules/unpipe/index.js +0 -78
  360. package/dist/src/node_modules/vary/index.js +0 -159
  361. package/dist/src/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +0 -702
@@ -1,837 +0,0 @@
1
- import { __module as dist$1 } from '../../../_virtual/index6.js';
2
- import require$$2 from 'http';
3
- import require$$1 from 'fs';
4
- import require$$0$1 from 'zlib';
5
- import { __require as requireAccepts } from '../node_modules/accepts/index.js';
6
- import require$$0 from 'stream';
7
- import path from 'path';
8
- import { __require as requireEngine_io } from '../../engine.io/build/engine.io.js';
9
- import { __require as requireClient } from './client.js';
10
- import require$$0$2 from 'events';
11
- import { __require as requireNamespace } from './namespace.js';
12
- import { __require as requireParentNamespace } from './parent-namespace.js';
13
- import { __require as requireDist$1 } from '../../socket.io-adapter/dist/index.js';
14
- import { __require as requireCjs } from '../../socket.io-parser/build/cjs/index.js';
15
- import { __require as requireSrc } from '../node_modules/debug/src/index.js';
16
- import { __require as requireSocket } from './socket.js';
17
- import { __require as requireTypedEvents } from './typed-events.js';
18
- import { __require as requireUws } from './uws.js';
19
- import { __require as requireLib } from '../../cors/lib/index.js';
20
- import require$$18 from '../package.json.js';
21
-
22
- var dist = dist$1.exports;
23
-
24
- var hasRequiredDist;
25
-
26
- function requireDist () {
27
- if (hasRequiredDist) return dist$1.exports;
28
- hasRequiredDist = 1;
29
- (function (module, exports) {
30
- var __createBinding = (dist && dist.__createBinding) || (Object.create ? (function(o, m, k, k2) {
31
- if (k2 === undefined) k2 = k;
32
- var desc = Object.getOwnPropertyDescriptor(m, k);
33
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
34
- desc = { enumerable: true, get: function() { return m[k]; } };
35
- }
36
- Object.defineProperty(o, k2, desc);
37
- }) : (function(o, m, k, k2) {
38
- if (k2 === undefined) k2 = k;
39
- o[k2] = m[k];
40
- }));
41
- var __setModuleDefault = (dist && dist.__setModuleDefault) || (Object.create ? (function(o, v) {
42
- Object.defineProperty(o, "default", { enumerable: true, value: v });
43
- }) : function(o, v) {
44
- o["default"] = v;
45
- });
46
- var __importStar = (dist && dist.__importStar) || function (mod) {
47
- if (mod && mod.__esModule) return mod;
48
- var result = {};
49
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
50
- __setModuleDefault(result, mod);
51
- return result;
52
- };
53
- var __importDefault = (dist && dist.__importDefault) || function (mod) {
54
- return (mod && mod.__esModule) ? mod : { "default": mod };
55
- };
56
- Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.Namespace = exports.Socket = exports.Server = void 0;
58
- const http = require$$2;
59
- const fs_1 = require$$1;
60
- const zlib_1 = require$$0$1;
61
- const accepts = requireAccepts();
62
- const stream_1 = require$$0;
63
- const path$1 = path;
64
- const engine_io_1 = requireEngine_io();
65
- const client_1 = requireClient();
66
- const events_1 = require$$0$2;
67
- const namespace_1 = requireNamespace();
68
- Object.defineProperty(exports, "Namespace", { enumerable: true, get: function () { return namespace_1.Namespace; } });
69
- const parent_namespace_1 = requireParentNamespace();
70
- const socket_io_adapter_1 = requireDist$1();
71
- const parser = __importStar(requireCjs());
72
- const debug_1 = __importDefault(requireSrc());
73
- const socket_1 = requireSocket();
74
- Object.defineProperty(exports, "Socket", { enumerable: true, get: function () { return socket_1.Socket; } });
75
- const typed_events_1 = requireTypedEvents();
76
- const uws_1 = requireUws();
77
- const cors_1 = __importDefault(requireLib());
78
- const debug = (0, debug_1.default)("socket.io:server");
79
- const clientVersion = require$$18.version;
80
- const dotMapRegex = /\.map/;
81
- /**
82
- * Represents a Socket.IO server.
83
- *
84
- * @example
85
- * import { Server } from "socket.io";
86
- *
87
- * const io = new Server();
88
- *
89
- * io.on("connection", (socket) => {
90
- * console.log(`socket ${socket.id} connected`);
91
- *
92
- * // send an event to the client
93
- * socket.emit("foo", "bar");
94
- *
95
- * socket.on("foobar", () => {
96
- * // an event was received from the client
97
- * });
98
- *
99
- * // upon disconnection
100
- * socket.on("disconnect", (reason) => {
101
- * console.log(`socket ${socket.id} disconnected due to ${reason}`);
102
- * });
103
- * });
104
- *
105
- * io.listen(3000);
106
- */
107
- class Server extends typed_events_1.StrictEventEmitter {
108
- constructor(srv, opts = {}) {
109
- super();
110
- /**
111
- * @private
112
- */
113
- this._nsps = new Map();
114
- this.parentNsps = new Map();
115
- /**
116
- * A subset of the {@link parentNsps} map, only containing {@link ParentNamespace} which are based on a regular
117
- * expression.
118
- *
119
- * @private
120
- */
121
- this.parentNamespacesFromRegExp = new Map();
122
- if ("object" === typeof srv &&
123
- srv instanceof Object &&
124
- !srv.listen) {
125
- opts = srv;
126
- srv = undefined;
127
- }
128
- this.path(opts.path || "/socket.io");
129
- this.connectTimeout(opts.connectTimeout || 45000);
130
- this.serveClient(false !== opts.serveClient);
131
- this._parser = opts.parser || parser;
132
- this.encoder = new this._parser.Encoder();
133
- this.opts = opts;
134
- if (opts.connectionStateRecovery) {
135
- opts.connectionStateRecovery = Object.assign({
136
- maxDisconnectionDuration: 2 * 60 * 1000,
137
- skipMiddlewares: true,
138
- }, opts.connectionStateRecovery);
139
- this.adapter(opts.adapter || socket_io_adapter_1.SessionAwareAdapter);
140
- }
141
- else {
142
- this.adapter(opts.adapter || socket_io_adapter_1.Adapter);
143
- }
144
- opts.cleanupEmptyChildNamespaces = !!opts.cleanupEmptyChildNamespaces;
145
- this.sockets = this.of("/");
146
- if (srv || typeof srv == "number")
147
- this.attach(srv);
148
- if (this.opts.cors) {
149
- this._corsMiddleware = (0, cors_1.default)(this.opts.cors);
150
- }
151
- }
152
- get _opts() {
153
- return this.opts;
154
- }
155
- serveClient(v) {
156
- if (!arguments.length)
157
- return this._serveClient;
158
- this._serveClient = v;
159
- return this;
160
- }
161
- /**
162
- * Executes the middleware for an incoming namespace not already created on the server.
163
- *
164
- * @param name - name of incoming namespace
165
- * @param auth - the auth parameters
166
- * @param fn - callback
167
- *
168
- * @private
169
- */
170
- _checkNamespace(name, auth, fn) {
171
- if (this.parentNsps.size === 0)
172
- return fn(false);
173
- const keysIterator = this.parentNsps.keys();
174
- const run = () => {
175
- const nextFn = keysIterator.next();
176
- if (nextFn.done) {
177
- return fn(false);
178
- }
179
- nextFn.value(name, auth, (err, allow) => {
180
- if (err || !allow) {
181
- return run();
182
- }
183
- if (this._nsps.has(name)) {
184
- // the namespace was created in the meantime
185
- debug("dynamic namespace %s already exists", name);
186
- return fn(this._nsps.get(name));
187
- }
188
- const namespace = this.parentNsps.get(nextFn.value).createChild(name);
189
- debug("dynamic namespace %s was created", name);
190
- fn(namespace);
191
- });
192
- };
193
- run();
194
- }
195
- path(v) {
196
- if (!arguments.length)
197
- return this._path;
198
- this._path = v.replace(/\/$/, "");
199
- const escapedPath = this._path.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
200
- this.clientPathRegex = new RegExp("^" +
201
- escapedPath +
202
- "/socket\\.io(\\.msgpack|\\.esm)?(\\.min)?\\.js(\\.map)?(?:\\?|$)");
203
- return this;
204
- }
205
- connectTimeout(v) {
206
- if (v === undefined)
207
- return this._connectTimeout;
208
- this._connectTimeout = v;
209
- return this;
210
- }
211
- adapter(v) {
212
- if (!arguments.length)
213
- return this._adapter;
214
- this._adapter = v;
215
- for (const nsp of this._nsps.values()) {
216
- nsp._initAdapter();
217
- }
218
- return this;
219
- }
220
- /**
221
- * Attaches socket.io to a server or port.
222
- *
223
- * @param srv - server or port
224
- * @param opts - options passed to engine.io
225
- * @return self
226
- */
227
- listen(srv, opts = {}) {
228
- return this.attach(srv, opts);
229
- }
230
- /**
231
- * Attaches socket.io to a server or port.
232
- *
233
- * @param srv - server or port
234
- * @param opts - options passed to engine.io
235
- * @return self
236
- */
237
- attach(srv, opts = {}) {
238
- if ("function" == typeof srv) {
239
- const msg = "You are trying to attach socket.io to an express " +
240
- "request handler function. Please pass a http.Server instance.";
241
- throw new Error(msg);
242
- }
243
- // handle a port as a string
244
- if (Number(srv) == srv) {
245
- srv = Number(srv);
246
- }
247
- if ("number" == typeof srv) {
248
- debug("creating http server and binding to %d", srv);
249
- const port = srv;
250
- srv = http.createServer((req, res) => {
251
- res.writeHead(404);
252
- res.end();
253
- });
254
- srv.listen(port);
255
- }
256
- // merge the options passed to the Socket.IO server
257
- Object.assign(opts, this.opts);
258
- // set engine.io path to `/socket.io`
259
- opts.path = opts.path || this._path;
260
- this.initEngine(srv, opts);
261
- return this;
262
- }
263
- attachApp(app /*: TemplatedApp */, opts = {}) {
264
- // merge the options passed to the Socket.IO server
265
- Object.assign(opts, this.opts);
266
- // set engine.io path to `/socket.io`
267
- opts.path = opts.path || this._path;
268
- // initialize engine
269
- debug("creating uWebSockets.js-based engine with opts %j", opts);
270
- const engine = new engine_io_1.uServer(opts);
271
- engine.attach(app, opts);
272
- // bind to engine events
273
- this.bind(engine);
274
- if (this._serveClient) {
275
- // attach static file serving
276
- app.get(`${this._path}/*`, (res, req) => {
277
- if (!this.clientPathRegex.test(req.getUrl())) {
278
- req.setYield(true);
279
- return;
280
- }
281
- const filename = req
282
- .getUrl()
283
- .replace(this._path, "")
284
- .replace(/\?.*$/, "")
285
- .replace(/^\//, "");
286
- const isMap = dotMapRegex.test(filename);
287
- const type = isMap ? "map" : "source";
288
- // Per the standard, ETags must be quoted:
289
- // https://tools.ietf.org/html/rfc7232#section-2.3
290
- const expectedEtag = '"' + clientVersion + '"';
291
- const weakEtag = "W/" + expectedEtag;
292
- const etag = req.getHeader("if-none-match");
293
- if (etag) {
294
- if (expectedEtag === etag || weakEtag === etag) {
295
- debug("serve client %s 304", type);
296
- res.writeStatus("304 Not Modified");
297
- res.end();
298
- return;
299
- }
300
- }
301
- debug("serve client %s", type);
302
- res.writeHeader("cache-control", "public, max-age=0");
303
- res.writeHeader("content-type", "application/" + (isMap ? "json" : "javascript") + "; charset=utf-8");
304
- res.writeHeader("etag", expectedEtag);
305
- const filepath = path$1.join(__dirname, "../client-dist/", filename);
306
- (0, uws_1.serveFile)(res, filepath);
307
- });
308
- }
309
- (0, uws_1.patchAdapter)(app);
310
- }
311
- /**
312
- * Initialize engine
313
- *
314
- * @param srv - the server to attach to
315
- * @param opts - options passed to engine.io
316
- * @private
317
- */
318
- initEngine(srv, opts) {
319
- // initialize engine
320
- debug("creating engine.io instance with opts %j", opts);
321
- this.eio = (0, engine_io_1.attach)(srv, opts);
322
- // attach static file serving
323
- if (this._serveClient)
324
- this.attachServe(srv);
325
- // Export http server
326
- this.httpServer = srv;
327
- // bind to engine events
328
- this.bind(this.eio);
329
- }
330
- /**
331
- * Attaches the static file serving.
332
- *
333
- * @param srv http server
334
- * @private
335
- */
336
- attachServe(srv) {
337
- debug("attaching client serving req handler");
338
- const evs = srv.listeners("request").slice(0);
339
- srv.removeAllListeners("request");
340
- srv.on("request", (req, res) => {
341
- if (this.clientPathRegex.test(req.url)) {
342
- if (this._corsMiddleware) {
343
- this._corsMiddleware(req, res, () => {
344
- this.serve(req, res);
345
- });
346
- }
347
- else {
348
- this.serve(req, res);
349
- }
350
- }
351
- else {
352
- for (let i = 0; i < evs.length; i++) {
353
- evs[i].call(srv, req, res);
354
- }
355
- }
356
- });
357
- }
358
- /**
359
- * Handles a request serving of client source and map
360
- *
361
- * @param req
362
- * @param res
363
- * @private
364
- */
365
- serve(req, res) {
366
- const filename = req.url.replace(this._path, "").replace(/\?.*$/, "");
367
- const isMap = dotMapRegex.test(filename);
368
- const type = isMap ? "map" : "source";
369
- // Per the standard, ETags must be quoted:
370
- // https://tools.ietf.org/html/rfc7232#section-2.3
371
- const expectedEtag = '"' + clientVersion + '"';
372
- const weakEtag = "W/" + expectedEtag;
373
- const etag = req.headers["if-none-match"];
374
- if (etag) {
375
- if (expectedEtag === etag || weakEtag === etag) {
376
- debug("serve client %s 304", type);
377
- res.writeHead(304);
378
- res.end();
379
- return;
380
- }
381
- }
382
- debug("serve client %s", type);
383
- res.setHeader("Cache-Control", "public, max-age=0");
384
- res.setHeader("Content-Type", "application/" + (isMap ? "json" : "javascript") + "; charset=utf-8");
385
- res.setHeader("ETag", expectedEtag);
386
- Server.sendFile(filename, req, res);
387
- }
388
- /**
389
- * @param filename
390
- * @param req
391
- * @param res
392
- * @private
393
- */
394
- static sendFile(filename, req, res) {
395
- const readStream = (0, fs_1.createReadStream)(path$1.join(__dirname, "../client-dist/", filename));
396
- const encoding = accepts(req).encodings(["br", "gzip", "deflate"]);
397
- const onError = (err) => {
398
- if (err) {
399
- res.end();
400
- }
401
- };
402
- switch (encoding) {
403
- case "br":
404
- res.writeHead(200, { "content-encoding": "br" });
405
- (0, stream_1.pipeline)(readStream, (0, zlib_1.createBrotliCompress)(), res, onError);
406
- break;
407
- case "gzip":
408
- res.writeHead(200, { "content-encoding": "gzip" });
409
- (0, stream_1.pipeline)(readStream, (0, zlib_1.createGzip)(), res, onError);
410
- break;
411
- case "deflate":
412
- res.writeHead(200, { "content-encoding": "deflate" });
413
- (0, stream_1.pipeline)(readStream, (0, zlib_1.createDeflate)(), res, onError);
414
- break;
415
- default:
416
- res.writeHead(200);
417
- (0, stream_1.pipeline)(readStream, res, onError);
418
- }
419
- }
420
- /**
421
- * Binds socket.io to an engine.io instance.
422
- *
423
- * @param engine engine.io (or compatible) server
424
- * @return self
425
- */
426
- bind(engine) {
427
- // TODO apply strict types to the engine: "connection" event, `close()` and a method to serve static content
428
- // this would allow to provide any custom engine, like one based on Deno or Bun built-in HTTP server
429
- this.engine = engine;
430
- this.engine.on("connection", this.onconnection.bind(this));
431
- return this;
432
- }
433
- /**
434
- * Called with each incoming transport connection.
435
- *
436
- * @param {engine.Socket} conn
437
- * @return self
438
- * @private
439
- */
440
- onconnection(conn) {
441
- debug("incoming connection with id %s", conn.id);
442
- const client = new client_1.Client(this, conn);
443
- if (conn.protocol === 3) {
444
- // @ts-ignore
445
- client.connect("/");
446
- }
447
- return this;
448
- }
449
- /**
450
- * Looks up a namespace.
451
- *
452
- * @example
453
- * // with a simple string
454
- * const myNamespace = io.of("/my-namespace");
455
- *
456
- * // with a regex
457
- * const dynamicNsp = io.of(/^\/dynamic-\d+$/).on("connection", (socket) => {
458
- * const namespace = socket.nsp; // newNamespace.name === "/dynamic-101"
459
- *
460
- * // broadcast to all clients in the given sub-namespace
461
- * namespace.emit("hello");
462
- * });
463
- *
464
- * @param name - nsp name
465
- * @param fn optional, nsp `connection` ev handler
466
- */
467
- of(name, fn) {
468
- if (typeof name === "function" || name instanceof RegExp) {
469
- const parentNsp = new parent_namespace_1.ParentNamespace(this);
470
- debug("initializing parent namespace %s", parentNsp.name);
471
- if (typeof name === "function") {
472
- this.parentNsps.set(name, parentNsp);
473
- }
474
- else {
475
- this.parentNsps.set((nsp, conn, next) => next(null, name.test(nsp)), parentNsp);
476
- this.parentNamespacesFromRegExp.set(name, parentNsp);
477
- }
478
- if (fn) {
479
- // @ts-ignore
480
- parentNsp.on("connect", fn);
481
- }
482
- return parentNsp;
483
- }
484
- if (String(name)[0] !== "/")
485
- name = "/" + name;
486
- let nsp = this._nsps.get(name);
487
- if (!nsp) {
488
- for (const [regex, parentNamespace] of this.parentNamespacesFromRegExp) {
489
- if (regex.test(name)) {
490
- debug("attaching namespace %s to parent namespace %s", name, regex);
491
- return parentNamespace.createChild(name);
492
- }
493
- }
494
- debug("initializing namespace %s", name);
495
- nsp = new namespace_1.Namespace(this, name);
496
- this._nsps.set(name, nsp);
497
- if (name !== "/") {
498
- // @ts-ignore
499
- this.sockets.emitReserved("new_namespace", nsp);
500
- }
501
- }
502
- if (fn)
503
- nsp.on("connect", fn);
504
- return nsp;
505
- }
506
- /**
507
- * Closes server connection
508
- *
509
- * @param [fn] optional, called as `fn([err])` on error OR all conns closed
510
- */
511
- async close(fn) {
512
- await Promise.allSettled([...this._nsps.values()].map(async (nsp) => {
513
- nsp.sockets.forEach((socket) => {
514
- socket._onclose("server shutting down");
515
- });
516
- await nsp.adapter.close();
517
- }));
518
- this.engine.close();
519
- // restore the Adapter prototype, when the Socket.IO server was attached to a uWebSockets.js server
520
- (0, uws_1.restoreAdapter)();
521
- if (this.httpServer) {
522
- this.httpServer.close(fn);
523
- }
524
- else {
525
- fn && fn();
526
- }
527
- }
528
- /**
529
- * Registers a middleware, which is a function that gets executed for every incoming {@link Socket}.
530
- *
531
- * @example
532
- * io.use((socket, next) => {
533
- * // ...
534
- * next();
535
- * });
536
- *
537
- * @param fn - the middleware function
538
- */
539
- use(fn) {
540
- this.sockets.use(fn);
541
- return this;
542
- }
543
- /**
544
- * Targets a room when emitting.
545
- *
546
- * @example
547
- * // the “foo” event will be broadcast to all connected clients in the “room-101” room
548
- * io.to("room-101").emit("foo", "bar");
549
- *
550
- * // with an array of rooms (a client will be notified at most once)
551
- * io.to(["room-101", "room-102"]).emit("foo", "bar");
552
- *
553
- * // with multiple chained calls
554
- * io.to("room-101").to("room-102").emit("foo", "bar");
555
- *
556
- * @param room - a room, or an array of rooms
557
- * @return a new {@link BroadcastOperator} instance for chaining
558
- */
559
- to(room) {
560
- return this.sockets.to(room);
561
- }
562
- /**
563
- * Targets a room when emitting. Similar to `to()`, but might feel clearer in some cases:
564
- *
565
- * @example
566
- * // disconnect all clients in the "room-101" room
567
- * io.in("room-101").disconnectSockets();
568
- *
569
- * @param room - a room, or an array of rooms
570
- * @return a new {@link BroadcastOperator} instance for chaining
571
- */
572
- in(room) {
573
- return this.sockets.in(room);
574
- }
575
- /**
576
- * Excludes a room when emitting.
577
- *
578
- * @example
579
- * // the "foo" event will be broadcast to all connected clients, except the ones that are in the "room-101" room
580
- * io.except("room-101").emit("foo", "bar");
581
- *
582
- * // with an array of rooms
583
- * io.except(["room-101", "room-102"]).emit("foo", "bar");
584
- *
585
- * // with multiple chained calls
586
- * io.except("room-101").except("room-102").emit("foo", "bar");
587
- *
588
- * @param room - a room, or an array of rooms
589
- * @return a new {@link BroadcastOperator} instance for chaining
590
- */
591
- except(room) {
592
- return this.sockets.except(room);
593
- }
594
- /**
595
- * Sends a `message` event to all clients.
596
- *
597
- * This method mimics the WebSocket.send() method.
598
- *
599
- * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send
600
- *
601
- * @example
602
- * io.send("hello");
603
- *
604
- * // this is equivalent to
605
- * io.emit("message", "hello");
606
- *
607
- * @return self
608
- */
609
- send(...args) {
610
- // This type-cast is needed because EmitEvents likely doesn't have `message` as a key.
611
- // if you specify the EmitEvents, the type of args will be never.
612
- this.sockets.emit("message", ...args);
613
- return this;
614
- }
615
- /**
616
- * Sends a `message` event to all clients. Alias of {@link send}.
617
- *
618
- * @return self
619
- */
620
- write(...args) {
621
- // This type-cast is needed because EmitEvents likely doesn't have `message` as a key.
622
- // if you specify the EmitEvents, the type of args will be never.
623
- this.sockets.emit("message", ...args);
624
- return this;
625
- }
626
- /**
627
- * Sends a message to the other Socket.IO servers of the cluster.
628
- *
629
- * @example
630
- * io.serverSideEmit("hello", "world");
631
- *
632
- * io.on("hello", (arg1) => {
633
- * console.log(arg1); // prints "world"
634
- * });
635
- *
636
- * // acknowledgements (without binary content) are supported too:
637
- * io.serverSideEmit("ping", (err, responses) => {
638
- * if (err) {
639
- * // some servers did not acknowledge the event in the given delay
640
- * } else {
641
- * console.log(responses); // one response per server (except the current one)
642
- * }
643
- * });
644
- *
645
- * io.on("ping", (cb) => {
646
- * cb("pong");
647
- * });
648
- *
649
- * @param ev - the event name
650
- * @param args - an array of arguments, which may include an acknowledgement callback at the end
651
- */
652
- serverSideEmit(ev, ...args) {
653
- return this.sockets.serverSideEmit(ev, ...args);
654
- }
655
- /**
656
- * Sends a message and expect an acknowledgement from the other Socket.IO servers of the cluster.
657
- *
658
- * @example
659
- * try {
660
- * const responses = await io.serverSideEmitWithAck("ping");
661
- * console.log(responses); // one response per server (except the current one)
662
- * } catch (e) {
663
- * // some servers did not acknowledge the event in the given delay
664
- * }
665
- *
666
- * @param ev - the event name
667
- * @param args - an array of arguments
668
- *
669
- * @return a Promise that will be fulfilled when all servers have acknowledged the event
670
- */
671
- serverSideEmitWithAck(ev, ...args) {
672
- return this.sockets.serverSideEmitWithAck(ev, ...args);
673
- }
674
- /**
675
- * Gets a list of socket ids.
676
- *
677
- * @deprecated this method will be removed in the next major release, please use {@link Server#serverSideEmit} or
678
- * {@link Server#fetchSockets} instead.
679
- */
680
- allSockets() {
681
- return this.sockets.allSockets();
682
- }
683
- /**
684
- * Sets the compress flag.
685
- *
686
- * @example
687
- * io.compress(false).emit("hello");
688
- *
689
- * @param compress - if `true`, compresses the sending data
690
- * @return a new {@link BroadcastOperator} instance for chaining
691
- */
692
- compress(compress) {
693
- return this.sockets.compress(compress);
694
- }
695
- /**
696
- * Sets a modifier for a subsequent event emission that the event data may be lost if the client is not ready to
697
- * receive messages (because of network slowness or other issues, or because they’re connected through long polling
698
- * and is in the middle of a request-response cycle).
699
- *
700
- * @example
701
- * io.volatile.emit("hello"); // the clients may or may not receive it
702
- *
703
- * @return a new {@link BroadcastOperator} instance for chaining
704
- */
705
- get volatile() {
706
- return this.sockets.volatile;
707
- }
708
- /**
709
- * Sets a modifier for a subsequent event emission that the event data will only be broadcast to the current node.
710
- *
711
- * @example
712
- * // the “foo” event will be broadcast to all connected clients on this node
713
- * io.local.emit("foo", "bar");
714
- *
715
- * @return a new {@link BroadcastOperator} instance for chaining
716
- */
717
- get local() {
718
- return this.sockets.local;
719
- }
720
- /**
721
- * Adds a timeout in milliseconds for the next operation.
722
- *
723
- * @example
724
- * io.timeout(1000).emit("some-event", (err, responses) => {
725
- * if (err) {
726
- * // some clients did not acknowledge the event in the given delay
727
- * } else {
728
- * console.log(responses); // one response per client
729
- * }
730
- * });
731
- *
732
- * @param timeout
733
- */
734
- timeout(timeout) {
735
- return this.sockets.timeout(timeout);
736
- }
737
- /**
738
- * Returns the matching socket instances.
739
- *
740
- * Note: this method also works within a cluster of multiple Socket.IO servers, with a compatible {@link Adapter}.
741
- *
742
- * @example
743
- * // return all Socket instances
744
- * const sockets = await io.fetchSockets();
745
- *
746
- * // return all Socket instances in the "room1" room
747
- * const sockets = await io.in("room1").fetchSockets();
748
- *
749
- * for (const socket of sockets) {
750
- * console.log(socket.id);
751
- * console.log(socket.handshake);
752
- * console.log(socket.rooms);
753
- * console.log(socket.data);
754
- *
755
- * socket.emit("hello");
756
- * socket.join("room1");
757
- * socket.leave("room2");
758
- * socket.disconnect();
759
- * }
760
- */
761
- fetchSockets() {
762
- return this.sockets.fetchSockets();
763
- }
764
- /**
765
- * Makes the matching socket instances join the specified rooms.
766
- *
767
- * Note: this method also works within a cluster of multiple Socket.IO servers, with a compatible {@link Adapter}.
768
- *
769
- * @example
770
- *
771
- * // make all socket instances join the "room1" room
772
- * io.socketsJoin("room1");
773
- *
774
- * // make all socket instances in the "room1" room join the "room2" and "room3" rooms
775
- * io.in("room1").socketsJoin(["room2", "room3"]);
776
- *
777
- * @param room - a room, or an array of rooms
778
- */
779
- socketsJoin(room) {
780
- return this.sockets.socketsJoin(room);
781
- }
782
- /**
783
- * Makes the matching socket instances leave the specified rooms.
784
- *
785
- * Note: this method also works within a cluster of multiple Socket.IO servers, with a compatible {@link Adapter}.
786
- *
787
- * @example
788
- * // make all socket instances leave the "room1" room
789
- * io.socketsLeave("room1");
790
- *
791
- * // make all socket instances in the "room1" room leave the "room2" and "room3" rooms
792
- * io.in("room1").socketsLeave(["room2", "room3"]);
793
- *
794
- * @param room - a room, or an array of rooms
795
- */
796
- socketsLeave(room) {
797
- return this.sockets.socketsLeave(room);
798
- }
799
- /**
800
- * Makes the matching socket instances disconnect.
801
- *
802
- * Note: this method also works within a cluster of multiple Socket.IO servers, with a compatible {@link Adapter}.
803
- *
804
- * @example
805
- * // make all socket instances disconnect (the connections might be kept alive for other namespaces)
806
- * io.disconnectSockets();
807
- *
808
- * // make all socket instances in the "room1" room disconnect and close the underlying connections
809
- * io.in("room1").disconnectSockets(true);
810
- *
811
- * @param close - whether to close the underlying connection
812
- */
813
- disconnectSockets(close = false) {
814
- return this.sockets.disconnectSockets(close);
815
- }
816
- }
817
- exports.Server = Server;
818
- /**
819
- * Expose main namespace (/).
820
- */
821
- const emitterMethods = Object.keys(events_1.EventEmitter.prototype).filter(function (key) {
822
- return typeof events_1.EventEmitter.prototype[key] === "function";
823
- });
824
- emitterMethods.forEach(function (fn) {
825
- Server.prototype[fn] = function () {
826
- return this.sockets[fn].apply(this.sockets, arguments);
827
- };
828
- });
829
- module.exports = (srv, opts) => new Server(srv, opts);
830
- module.exports.Server = Server;
831
- module.exports.Namespace = namespace_1.Namespace;
832
- module.exports.Socket = socket_1.Socket;
833
- } (dist$1, dist$1.exports));
834
- return dist$1.exports;
835
- }
836
-
837
- export { requireDist as __require };