lightclaw2 0.0.1

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 (331) hide show
  1. package/README.md +1 -0
  2. package/dist/index.d.ts +21 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +26 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/src/channel.d.ts +11 -0
  7. package/dist/src/channel.d.ts.map +1 -0
  8. package/dist/src/channel.js +255 -0
  9. package/dist/src/channel.js.map +1 -0
  10. package/dist/src/config.d.ts +29 -0
  11. package/dist/src/config.d.ts.map +1 -0
  12. package/dist/src/config.js +99 -0
  13. package/dist/src/config.js.map +1 -0
  14. package/dist/src/dedup.d.ts +7 -0
  15. package/dist/src/dedup.d.ts.map +1 -0
  16. package/dist/src/dedup.js +52 -0
  17. package/dist/src/dedup.js.map +1 -0
  18. package/dist/src/gateway.d.ts +16 -0
  19. package/dist/src/gateway.d.ts.map +1 -0
  20. package/dist/src/gateway.js +283 -0
  21. package/dist/src/gateway.js.map +1 -0
  22. package/dist/src/inbound.d.ts +18 -0
  23. package/dist/src/inbound.d.ts.map +1 -0
  24. package/dist/src/inbound.js +252 -0
  25. package/dist/src/inbound.js.map +1 -0
  26. package/dist/src/media.d.ts +12 -0
  27. package/dist/src/media.d.ts.map +1 -0
  28. package/dist/src/media.js +87 -0
  29. package/dist/src/media.js.map +1 -0
  30. package/dist/src/outbound.d.ts +28 -0
  31. package/dist/src/outbound.d.ts.map +1 -0
  32. package/dist/src/outbound.js +172 -0
  33. package/dist/src/outbound.js.map +1 -0
  34. package/dist/src/runtime.d.ts +4 -0
  35. package/dist/src/runtime.d.ts.map +1 -0
  36. package/dist/src/runtime.js +11 -0
  37. package/dist/src/runtime.js.map +1 -0
  38. package/dist/src/session-history.d.ts +88 -0
  39. package/dist/src/session-history.d.ts.map +1 -0
  40. package/dist/src/session-history.js +545 -0
  41. package/dist/src/session-history.js.map +1 -0
  42. package/dist/src/socket-handlers.d.ts +21 -0
  43. package/dist/src/socket-handlers.d.ts.map +1 -0
  44. package/dist/src/socket-handlers.js +120 -0
  45. package/dist/src/socket-handlers.js.map +1 -0
  46. package/dist/src/socket-registry.d.ts +53 -0
  47. package/dist/src/socket-registry.d.ts.map +1 -0
  48. package/dist/src/socket-registry.js +115 -0
  49. package/dist/src/socket-registry.js.map +1 -0
  50. package/dist/src/types.d.ts +100 -0
  51. package/dist/src/types.d.ts.map +1 -0
  52. package/dist/src/types.js +10 -0
  53. package/dist/src/types.js.map +1 -0
  54. package/node_modules/@socket.io/component-emitter/LICENSE +24 -0
  55. package/node_modules/@socket.io/component-emitter/Readme.md +79 -0
  56. package/node_modules/@socket.io/component-emitter/lib/cjs/index.d.ts +179 -0
  57. package/node_modules/@socket.io/component-emitter/lib/cjs/index.js +176 -0
  58. package/node_modules/@socket.io/component-emitter/lib/cjs/package.json +4 -0
  59. package/node_modules/@socket.io/component-emitter/lib/esm/index.d.ts +179 -0
  60. package/node_modules/@socket.io/component-emitter/lib/esm/index.js +169 -0
  61. package/node_modules/@socket.io/component-emitter/lib/esm/package.json +4 -0
  62. package/node_modules/@socket.io/component-emitter/package.json +28 -0
  63. package/node_modules/debug/LICENSE +20 -0
  64. package/node_modules/debug/README.md +481 -0
  65. package/node_modules/debug/package.json +64 -0
  66. package/node_modules/debug/src/browser.js +272 -0
  67. package/node_modules/debug/src/common.js +292 -0
  68. package/node_modules/debug/src/index.js +10 -0
  69. package/node_modules/debug/src/node.js +263 -0
  70. package/node_modules/engine.io-client/LICENSE +22 -0
  71. package/node_modules/engine.io-client/README.md +331 -0
  72. package/node_modules/engine.io-client/build/cjs/browser-entrypoint.d.ts +3 -0
  73. package/node_modules/engine.io-client/build/cjs/browser-entrypoint.js +4 -0
  74. package/node_modules/engine.io-client/build/cjs/contrib/has-cors.d.ts +1 -0
  75. package/node_modules/engine.io-client/build/cjs/contrib/has-cors.js +14 -0
  76. package/node_modules/engine.io-client/build/cjs/contrib/parseqs.d.ts +15 -0
  77. package/node_modules/engine.io-client/build/cjs/contrib/parseqs.js +38 -0
  78. package/node_modules/engine.io-client/build/cjs/contrib/parseuri.d.ts +1 -0
  79. package/node_modules/engine.io-client/build/cjs/contrib/parseuri.js +67 -0
  80. package/node_modules/engine.io-client/build/cjs/globals.d.ts +4 -0
  81. package/node_modules/engine.io-client/build/cjs/globals.js +26 -0
  82. package/node_modules/engine.io-client/build/cjs/globals.node.d.ts +21 -0
  83. package/node_modules/engine.io-client/build/cjs/globals.node.js +97 -0
  84. package/node_modules/engine.io-client/build/cjs/index.d.ts +15 -0
  85. package/node_modules/engine.io-client/build/cjs/index.js +32 -0
  86. package/node_modules/engine.io-client/build/cjs/package.json +10 -0
  87. package/node_modules/engine.io-client/build/cjs/socket.d.ts +482 -0
  88. package/node_modules/engine.io-client/build/cjs/socket.js +765 -0
  89. package/node_modules/engine.io-client/build/cjs/transport.d.ts +106 -0
  90. package/node_modules/engine.io-client/build/cjs/transport.js +153 -0
  91. package/node_modules/engine.io-client/build/cjs/transports/index.d.ts +8 -0
  92. package/node_modules/engine.io-client/build/cjs/transports/index.js +11 -0
  93. package/node_modules/engine.io-client/build/cjs/transports/polling-fetch.d.ts +15 -0
  94. package/node_modules/engine.io-client/build/cjs/transports/polling-fetch.js +60 -0
  95. package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.d.ts +108 -0
  96. package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.js +285 -0
  97. package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.d.ts +11 -0
  98. package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.js +44 -0
  99. package/node_modules/engine.io-client/build/cjs/transports/polling.d.ts +52 -0
  100. package/node_modules/engine.io-client/build/cjs/transports/polling.js +165 -0
  101. package/node_modules/engine.io-client/build/cjs/transports/websocket.d.ts +36 -0
  102. package/node_modules/engine.io-client/build/cjs/transports/websocket.js +136 -0
  103. package/node_modules/engine.io-client/build/cjs/transports/websocket.node.d.ts +14 -0
  104. package/node_modules/engine.io-client/build/cjs/transports/websocket.node.js +68 -0
  105. package/node_modules/engine.io-client/build/cjs/transports/webtransport.d.ts +18 -0
  106. package/node_modules/engine.io-client/build/cjs/transports/webtransport.js +94 -0
  107. package/node_modules/engine.io-client/build/cjs/util.d.ts +7 -0
  108. package/node_modules/engine.io-client/build/cjs/util.js +65 -0
  109. package/node_modules/engine.io-client/build/esm/browser-entrypoint.d.ts +3 -0
  110. package/node_modules/engine.io-client/build/esm/browser-entrypoint.js +2 -0
  111. package/node_modules/engine.io-client/build/esm/contrib/has-cors.d.ts +1 -0
  112. package/node_modules/engine.io-client/build/esm/contrib/has-cors.js +11 -0
  113. package/node_modules/engine.io-client/build/esm/contrib/parseqs.d.ts +15 -0
  114. package/node_modules/engine.io-client/build/esm/contrib/parseqs.js +34 -0
  115. package/node_modules/engine.io-client/build/esm/contrib/parseuri.d.ts +1 -0
  116. package/node_modules/engine.io-client/build/esm/contrib/parseuri.js +64 -0
  117. package/node_modules/engine.io-client/build/esm/globals.d.ts +4 -0
  118. package/node_modules/engine.io-client/build/esm/globals.js +22 -0
  119. package/node_modules/engine.io-client/build/esm/globals.node.d.ts +21 -0
  120. package/node_modules/engine.io-client/build/esm/globals.node.js +91 -0
  121. package/node_modules/engine.io-client/build/esm/index.d.ts +15 -0
  122. package/node_modules/engine.io-client/build/esm/index.js +15 -0
  123. package/node_modules/engine.io-client/build/esm/package.json +10 -0
  124. package/node_modules/engine.io-client/build/esm/socket.d.ts +482 -0
  125. package/node_modules/engine.io-client/build/esm/socket.js +727 -0
  126. package/node_modules/engine.io-client/build/esm/transport.d.ts +106 -0
  127. package/node_modules/engine.io-client/build/esm/transport.js +142 -0
  128. package/node_modules/engine.io-client/build/esm/transports/index.d.ts +8 -0
  129. package/node_modules/engine.io-client/build/esm/transports/index.js +8 -0
  130. package/node_modules/engine.io-client/build/esm/transports/polling-fetch.d.ts +15 -0
  131. package/node_modules/engine.io-client/build/esm/transports/polling-fetch.js +56 -0
  132. package/node_modules/engine.io-client/build/esm/transports/polling-xhr.d.ts +108 -0
  133. package/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +271 -0
  134. package/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.d.ts +11 -0
  135. package/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +17 -0
  136. package/node_modules/engine.io-client/build/esm/transports/polling.d.ts +52 -0
  137. package/node_modules/engine.io-client/build/esm/transports/polling.js +145 -0
  138. package/node_modules/engine.io-client/build/esm/transports/websocket.d.ts +36 -0
  139. package/node_modules/engine.io-client/build/esm/transports/websocket.js +125 -0
  140. package/node_modules/engine.io-client/build/esm/transports/websocket.node.d.ts +14 -0
  141. package/node_modules/engine.io-client/build/esm/transports/websocket.node.js +41 -0
  142. package/node_modules/engine.io-client/build/esm/transports/webtransport.d.ts +18 -0
  143. package/node_modules/engine.io-client/build/esm/transports/webtransport.js +80 -0
  144. package/node_modules/engine.io-client/build/esm/util.d.ts +7 -0
  145. package/node_modules/engine.io-client/build/esm/util.js +59 -0
  146. package/node_modules/engine.io-client/build/esm-debug/browser-entrypoint.d.ts +3 -0
  147. package/node_modules/engine.io-client/build/esm-debug/browser-entrypoint.js +2 -0
  148. package/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.d.ts +1 -0
  149. package/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.js +11 -0
  150. package/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.d.ts +15 -0
  151. package/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.js +34 -0
  152. package/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.d.ts +1 -0
  153. package/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.js +64 -0
  154. package/node_modules/engine.io-client/build/esm-debug/globals.d.ts +4 -0
  155. package/node_modules/engine.io-client/build/esm-debug/globals.js +22 -0
  156. package/node_modules/engine.io-client/build/esm-debug/globals.node.d.ts +21 -0
  157. package/node_modules/engine.io-client/build/esm-debug/globals.node.js +91 -0
  158. package/node_modules/engine.io-client/build/esm-debug/index.d.ts +15 -0
  159. package/node_modules/engine.io-client/build/esm-debug/index.js +15 -0
  160. package/node_modules/engine.io-client/build/esm-debug/package.json +10 -0
  161. package/node_modules/engine.io-client/build/esm-debug/socket.d.ts +482 -0
  162. package/node_modules/engine.io-client/build/esm-debug/socket.js +756 -0
  163. package/node_modules/engine.io-client/build/esm-debug/transport.d.ts +106 -0
  164. package/node_modules/engine.io-client/build/esm-debug/transport.js +145 -0
  165. package/node_modules/engine.io-client/build/esm-debug/transports/index.d.ts +8 -0
  166. package/node_modules/engine.io-client/build/esm-debug/transports/index.js +8 -0
  167. package/node_modules/engine.io-client/build/esm-debug/transports/polling-fetch.d.ts +15 -0
  168. package/node_modules/engine.io-client/build/esm-debug/transports/polling-fetch.js +56 -0
  169. package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.d.ts +108 -0
  170. package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.js +276 -0
  171. package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.d.ts +11 -0
  172. package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.js +17 -0
  173. package/node_modules/engine.io-client/build/esm-debug/transports/polling.d.ts +52 -0
  174. package/node_modules/engine.io-client/build/esm-debug/transports/polling.js +158 -0
  175. package/node_modules/engine.io-client/build/esm-debug/transports/websocket.d.ts +36 -0
  176. package/node_modules/engine.io-client/build/esm-debug/transports/websocket.js +128 -0
  177. package/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.d.ts +14 -0
  178. package/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.js +41 -0
  179. package/node_modules/engine.io-client/build/esm-debug/transports/webtransport.d.ts +18 -0
  180. package/node_modules/engine.io-client/build/esm-debug/transports/webtransport.js +87 -0
  181. package/node_modules/engine.io-client/build/esm-debug/util.d.ts +7 -0
  182. package/node_modules/engine.io-client/build/esm-debug/util.js +59 -0
  183. package/node_modules/engine.io-client/dist/engine.io.esm.min.js +7 -0
  184. package/node_modules/engine.io-client/dist/engine.io.esm.min.js.map +1 -0
  185. package/node_modules/engine.io-client/dist/engine.io.js +3064 -0
  186. package/node_modules/engine.io-client/dist/engine.io.js.map +1 -0
  187. package/node_modules/engine.io-client/dist/engine.io.min.js +7 -0
  188. package/node_modules/engine.io-client/dist/engine.io.min.js.map +1 -0
  189. package/node_modules/engine.io-client/node_modules/ws/LICENSE +20 -0
  190. package/node_modules/engine.io-client/node_modules/ws/README.md +548 -0
  191. package/node_modules/engine.io-client/node_modules/ws/browser.js +8 -0
  192. package/node_modules/engine.io-client/node_modules/ws/index.js +13 -0
  193. package/node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js +131 -0
  194. package/node_modules/engine.io-client/node_modules/ws/lib/constants.js +18 -0
  195. package/node_modules/engine.io-client/node_modules/ws/lib/event-target.js +292 -0
  196. package/node_modules/engine.io-client/node_modules/ws/lib/extension.js +203 -0
  197. package/node_modules/engine.io-client/node_modules/ws/lib/limiter.js +55 -0
  198. package/node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js +528 -0
  199. package/node_modules/engine.io-client/node_modules/ws/lib/receiver.js +706 -0
  200. package/node_modules/engine.io-client/node_modules/ws/lib/sender.js +602 -0
  201. package/node_modules/engine.io-client/node_modules/ws/lib/stream.js +161 -0
  202. package/node_modules/engine.io-client/node_modules/ws/lib/subprotocol.js +62 -0
  203. package/node_modules/engine.io-client/node_modules/ws/lib/validation.js +152 -0
  204. package/node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js +550 -0
  205. package/node_modules/engine.io-client/node_modules/ws/lib/websocket.js +1388 -0
  206. package/node_modules/engine.io-client/node_modules/ws/package.json +69 -0
  207. package/node_modules/engine.io-client/node_modules/ws/wrapper.mjs +8 -0
  208. package/node_modules/engine.io-client/package.json +95 -0
  209. package/node_modules/engine.io-parser/LICENSE +22 -0
  210. package/node_modules/engine.io-parser/Readme.md +158 -0
  211. package/node_modules/engine.io-parser/build/cjs/commons.d.ts +14 -0
  212. package/node_modules/engine.io-parser/build/cjs/commons.js +19 -0
  213. package/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.d.ts +2 -0
  214. package/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.js +48 -0
  215. package/node_modules/engine.io-parser/build/cjs/decodePacket.browser.d.ts +2 -0
  216. package/node_modules/engine.io-parser/build/cjs/decodePacket.browser.js +66 -0
  217. package/node_modules/engine.io-parser/build/cjs/decodePacket.d.ts +2 -0
  218. package/node_modules/engine.io-parser/build/cjs/decodePacket.js +59 -0
  219. package/node_modules/engine.io-parser/build/cjs/encodePacket.browser.d.ts +4 -0
  220. package/node_modules/engine.io-parser/build/cjs/encodePacket.browser.js +72 -0
  221. package/node_modules/engine.io-parser/build/cjs/encodePacket.d.ts +3 -0
  222. package/node_modules/engine.io-parser/build/cjs/encodePacket.js +38 -0
  223. package/node_modules/engine.io-parser/build/cjs/index.d.ts +9 -0
  224. package/node_modules/engine.io-parser/build/cjs/index.js +164 -0
  225. package/node_modules/engine.io-parser/build/cjs/package.json +8 -0
  226. package/node_modules/engine.io-parser/build/esm/commons.d.ts +14 -0
  227. package/node_modules/engine.io-parser/build/esm/commons.js +14 -0
  228. package/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.d.ts +2 -0
  229. package/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js +43 -0
  230. package/node_modules/engine.io-parser/build/esm/decodePacket.browser.d.ts +2 -0
  231. package/node_modules/engine.io-parser/build/esm/decodePacket.browser.js +62 -0
  232. package/node_modules/engine.io-parser/build/esm/decodePacket.d.ts +2 -0
  233. package/node_modules/engine.io-parser/build/esm/decodePacket.js +55 -0
  234. package/node_modules/engine.io-parser/build/esm/encodePacket.browser.d.ts +4 -0
  235. package/node_modules/engine.io-parser/build/esm/encodePacket.browser.js +68 -0
  236. package/node_modules/engine.io-parser/build/esm/encodePacket.d.ts +3 -0
  237. package/node_modules/engine.io-parser/build/esm/encodePacket.js +33 -0
  238. package/node_modules/engine.io-parser/build/esm/index.d.ts +9 -0
  239. package/node_modules/engine.io-parser/build/esm/index.js +156 -0
  240. package/node_modules/engine.io-parser/build/esm/package.json +8 -0
  241. package/node_modules/engine.io-parser/package.json +46 -0
  242. package/node_modules/ms/index.js +162 -0
  243. package/node_modules/ms/license.md +21 -0
  244. package/node_modules/ms/package.json +38 -0
  245. package/node_modules/ms/readme.md +59 -0
  246. package/node_modules/socket.io-client/LICENSE +21 -0
  247. package/node_modules/socket.io-client/README.md +29 -0
  248. package/node_modules/socket.io-client/build/cjs/browser-entrypoint.d.ts +2 -0
  249. package/node_modules/socket.io-client/build/cjs/browser-entrypoint.js +4 -0
  250. package/node_modules/socket.io-client/build/cjs/contrib/backo2.d.ts +12 -0
  251. package/node_modules/socket.io-client/build/cjs/contrib/backo2.js +69 -0
  252. package/node_modules/socket.io-client/build/cjs/index.d.ts +29 -0
  253. package/node_modules/socket.io-client/build/cjs/index.js +76 -0
  254. package/node_modules/socket.io-client/build/cjs/manager.d.ts +295 -0
  255. package/node_modules/socket.io-client/build/cjs/manager.js +416 -0
  256. package/node_modules/socket.io-client/build/cjs/on.d.ts +2 -0
  257. package/node_modules/socket.io-client/build/cjs/on.js +9 -0
  258. package/node_modules/socket.io-client/build/cjs/socket.d.ts +593 -0
  259. package/node_modules/socket.io-client/build/cjs/socket.js +909 -0
  260. package/node_modules/socket.io-client/build/cjs/url.d.ts +33 -0
  261. package/node_modules/socket.io-client/build/cjs/url.js +69 -0
  262. package/node_modules/socket.io-client/build/esm/browser-entrypoint.d.ts +2 -0
  263. package/node_modules/socket.io-client/build/esm/browser-entrypoint.js +2 -0
  264. package/node_modules/socket.io-client/build/esm/contrib/backo2.d.ts +12 -0
  265. package/node_modules/socket.io-client/build/esm/contrib/backo2.js +66 -0
  266. package/node_modules/socket.io-client/build/esm/index.d.ts +29 -0
  267. package/node_modules/socket.io-client/build/esm/index.js +58 -0
  268. package/node_modules/socket.io-client/build/esm/manager.d.ts +295 -0
  269. package/node_modules/socket.io-client/build/esm/manager.js +367 -0
  270. package/node_modules/socket.io-client/build/esm/on.d.ts +2 -0
  271. package/node_modules/socket.io-client/build/esm/on.js +6 -0
  272. package/node_modules/socket.io-client/build/esm/package.json +5 -0
  273. package/node_modules/socket.io-client/build/esm/socket.d.ts +593 -0
  274. package/node_modules/socket.io-client/build/esm/socket.js +880 -0
  275. package/node_modules/socket.io-client/build/esm/url.d.ts +33 -0
  276. package/node_modules/socket.io-client/build/esm/url.js +59 -0
  277. package/node_modules/socket.io-client/build/esm-debug/browser-entrypoint.d.ts +2 -0
  278. package/node_modules/socket.io-client/build/esm-debug/browser-entrypoint.js +2 -0
  279. package/node_modules/socket.io-client/build/esm-debug/contrib/backo2.d.ts +12 -0
  280. package/node_modules/socket.io-client/build/esm-debug/contrib/backo2.js +66 -0
  281. package/node_modules/socket.io-client/build/esm-debug/index.d.ts +29 -0
  282. package/node_modules/socket.io-client/build/esm-debug/index.js +62 -0
  283. package/node_modules/socket.io-client/build/esm-debug/manager.d.ts +295 -0
  284. package/node_modules/socket.io-client/build/esm-debug/manager.js +386 -0
  285. package/node_modules/socket.io-client/build/esm-debug/on.d.ts +2 -0
  286. package/node_modules/socket.io-client/build/esm-debug/on.js +6 -0
  287. package/node_modules/socket.io-client/build/esm-debug/package.json +5 -0
  288. package/node_modules/socket.io-client/build/esm-debug/socket.d.ts +593 -0
  289. package/node_modules/socket.io-client/build/esm-debug/socket.js +902 -0
  290. package/node_modules/socket.io-client/build/esm-debug/url.d.ts +33 -0
  291. package/node_modules/socket.io-client/build/esm-debug/url.js +63 -0
  292. package/node_modules/socket.io-client/dist/socket.io.esm.min.js +7 -0
  293. package/node_modules/socket.io-client/dist/socket.io.esm.min.js.map +1 -0
  294. package/node_modules/socket.io-client/dist/socket.io.js +4955 -0
  295. package/node_modules/socket.io-client/dist/socket.io.js.map +1 -0
  296. package/node_modules/socket.io-client/dist/socket.io.min.js +7 -0
  297. package/node_modules/socket.io-client/dist/socket.io.min.js.map +1 -0
  298. package/node_modules/socket.io-client/dist/socket.io.msgpack.min.js +7 -0
  299. package/node_modules/socket.io-client/dist/socket.io.msgpack.min.js.map +1 -0
  300. package/node_modules/socket.io-client/package.json +101 -0
  301. package/node_modules/socket.io-parser/LICENSE +20 -0
  302. package/node_modules/socket.io-parser/Readme.md +81 -0
  303. package/node_modules/socket.io-parser/build/cjs/binary.d.ts +20 -0
  304. package/node_modules/socket.io-parser/build/cjs/binary.js +87 -0
  305. package/node_modules/socket.io-parser/build/cjs/index.d.ts +91 -0
  306. package/node_modules/socket.io-parser/build/cjs/index.js +359 -0
  307. package/node_modules/socket.io-parser/build/cjs/is-binary.d.ts +7 -0
  308. package/node_modules/socket.io-parser/build/cjs/is-binary.js +54 -0
  309. package/node_modules/socket.io-parser/build/cjs/package.json +3 -0
  310. package/node_modules/socket.io-parser/build/esm/binary.d.ts +20 -0
  311. package/node_modules/socket.io-parser/build/esm/binary.js +83 -0
  312. package/node_modules/socket.io-parser/build/esm/index.d.ts +91 -0
  313. package/node_modules/socket.io-parser/build/esm/index.js +348 -0
  314. package/node_modules/socket.io-parser/build/esm/is-binary.d.ts +7 -0
  315. package/node_modules/socket.io-parser/build/esm/is-binary.js +50 -0
  316. package/node_modules/socket.io-parser/build/esm/package.json +3 -0
  317. package/node_modules/socket.io-parser/build/esm-debug/binary.d.ts +20 -0
  318. package/node_modules/socket.io-parser/build/esm-debug/binary.js +83 -0
  319. package/node_modules/socket.io-parser/build/esm-debug/index.d.ts +91 -0
  320. package/node_modules/socket.io-parser/build/esm-debug/index.js +353 -0
  321. package/node_modules/socket.io-parser/build/esm-debug/is-binary.d.ts +7 -0
  322. package/node_modules/socket.io-parser/build/esm-debug/is-binary.js +50 -0
  323. package/node_modules/socket.io-parser/build/esm-debug/package.json +3 -0
  324. package/node_modules/socket.io-parser/package.json +44 -0
  325. package/node_modules/xmlhttprequest-ssl/LICENSE +22 -0
  326. package/node_modules/xmlhttprequest-ssl/README.md +67 -0
  327. package/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +689 -0
  328. package/node_modules/xmlhttprequest-ssl/package.json +40 -0
  329. package/openclaw.plugin.json +17 -0
  330. package/package.json +61 -0
  331. package/skills/lightclaw-cron/SKILL.md +381 -0
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "ws",
3
+ "version": "8.18.3",
4
+ "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
5
+ "keywords": [
6
+ "HyBi",
7
+ "Push",
8
+ "RFC-6455",
9
+ "WebSocket",
10
+ "WebSockets",
11
+ "real-time"
12
+ ],
13
+ "homepage": "https://github.com/websockets/ws",
14
+ "bugs": "https://github.com/websockets/ws/issues",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/websockets/ws.git"
18
+ },
19
+ "author": "Einar Otto Stangvik <einaros@gmail.com> (http://2x.io)",
20
+ "license": "MIT",
21
+ "main": "index.js",
22
+ "exports": {
23
+ ".": {
24
+ "browser": "./browser.js",
25
+ "import": "./wrapper.mjs",
26
+ "require": "./index.js"
27
+ },
28
+ "./package.json": "./package.json"
29
+ },
30
+ "browser": "browser.js",
31
+ "engines": {
32
+ "node": ">=10.0.0"
33
+ },
34
+ "files": [
35
+ "browser.js",
36
+ "index.js",
37
+ "lib/*.js",
38
+ "wrapper.mjs"
39
+ ],
40
+ "scripts": {
41
+ "test": "nyc --reporter=lcov --reporter=text mocha --throw-deprecation test/*.test.js",
42
+ "integration": "mocha --throw-deprecation test/*.integration.js",
43
+ "lint": "eslint . && prettier --check --ignore-path .gitignore \"**/*.{json,md,yaml,yml}\""
44
+ },
45
+ "peerDependencies": {
46
+ "bufferutil": "^4.0.1",
47
+ "utf-8-validate": ">=5.0.2"
48
+ },
49
+ "peerDependenciesMeta": {
50
+ "bufferutil": {
51
+ "optional": true
52
+ },
53
+ "utf-8-validate": {
54
+ "optional": true
55
+ }
56
+ },
57
+ "devDependencies": {
58
+ "benchmark": "^2.1.4",
59
+ "bufferutil": "^4.0.1",
60
+ "eslint": "^9.0.0",
61
+ "eslint-config-prettier": "^10.0.1",
62
+ "eslint-plugin-prettier": "^5.0.0",
63
+ "globals": "^16.0.0",
64
+ "mocha": "^8.4.0",
65
+ "nyc": "^15.0.0",
66
+ "prettier": "^3.0.0",
67
+ "utf-8-validate": "^6.0.0"
68
+ }
69
+ }
@@ -0,0 +1,8 @@
1
+ import createWebSocketStream from './lib/stream.js';
2
+ import Receiver from './lib/receiver.js';
3
+ import Sender from './lib/sender.js';
4
+ import WebSocket from './lib/websocket.js';
5
+ import WebSocketServer from './lib/websocket-server.js';
6
+
7
+ export { createWebSocketStream, Receiver, Sender, WebSocket, WebSocketServer };
8
+ export default WebSocket;
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "engine.io-client",
3
+ "description": "Client for the realtime Engine",
4
+ "license": "MIT",
5
+ "version": "6.6.4",
6
+ "main": "./build/cjs/index.js",
7
+ "module": "./build/esm/index.js",
8
+ "exports": {
9
+ "./package.json": "./package.json",
10
+ "./dist/engine.io.esm.min.js": "./dist/engine.io.esm.min.js",
11
+ "./dist/engine.io.js": "./dist/engine.io.js",
12
+ "./dist/engine.io.min.js": "./dist/engine.io.min.js",
13
+ ".": {
14
+ "import": {
15
+ "types": "./build/esm/index.d.ts",
16
+ "node": "./build/esm-debug/index.js",
17
+ "default": "./build/esm/index.js"
18
+ },
19
+ "require": {
20
+ "types": "./build/cjs/index.d.ts",
21
+ "default": "./build/cjs/index.js"
22
+ }
23
+ },
24
+ "./debug": {
25
+ "import": {
26
+ "types": "./build/esm/index.d.ts",
27
+ "default": "./build/esm-debug/index.js"
28
+ },
29
+ "require": {
30
+ "types": "./build/cjs/index.d.ts",
31
+ "default": "./build/cjs/index.js"
32
+ }
33
+ }
34
+ },
35
+ "types": "build/esm/index.d.ts",
36
+ "contributors": [
37
+ {
38
+ "name": "Guillermo Rauch",
39
+ "email": "rauchg@gmail.com"
40
+ },
41
+ {
42
+ "name": "Vladimir Dronnikov",
43
+ "email": "dronnikov@gmail.com"
44
+ },
45
+ {
46
+ "name": "Christoph Dorn",
47
+ "web": "https://github.com/cadorn"
48
+ },
49
+ {
50
+ "name": "Mark Mokryn",
51
+ "email": "mokesmokes@gmail.com"
52
+ }
53
+ ],
54
+ "dependencies": {
55
+ "@socket.io/component-emitter": "~3.1.0",
56
+ "debug": "~4.4.1",
57
+ "engine.io-parser": "~5.2.1",
58
+ "ws": "~8.18.3",
59
+ "xmlhttprequest-ssl": "~2.1.1"
60
+ },
61
+ "scripts": {
62
+ "compile": "rimraf ./build && tsc && tsc -p tsconfig.esm.json && ./postcompile.sh",
63
+ "test": "npm run format:check && npm run compile && if test \"$BROWSERS\" = \"1\" ; then npm run test:browser; else npm run test:node; fi",
64
+ "test:node": "mocha --bail --require test/support/hooks.js test/index.js test/webtransport.mjs",
65
+ "test:node-fetch": "USE_FETCH=1 npm run test:node",
66
+ "test:node-builtin-ws": "USE_BUILTIN_WS=1 npm run test:node",
67
+ "test:browser": "zuul test/index.js",
68
+ "build": "rimraf ./dist && rollup -c support/rollup.config.umd.js && rollup -c support/rollup.config.esm.js",
69
+ "bundle-size": "node support/bundle-size.js",
70
+ "format:check": "prettier --check 'lib/**/*.ts' 'test/**/*.js' 'test/webtransport.mjs' 'support/**/*.js'",
71
+ "format:fix": "prettier --write 'lib/**/*.ts' 'test/**/*.js' 'test/webtransport.mjs' 'support/**/*.js'",
72
+ "prepack": "npm run compile"
73
+ },
74
+ "browser": {
75
+ "./test/node.js": false,
76
+ "./build/esm/transports/polling-xhr.node.js": "./build/esm/transports/polling-xhr.js",
77
+ "./build/esm/transports/websocket.node.js": "./build/esm/transports/websocket.js",
78
+ "./build/esm/globals.node.js": "./build/esm/globals.js",
79
+ "./build/cjs/transports/polling-xhr.node.js": "./build/cjs/transports/polling-xhr.js",
80
+ "./build/cjs/transports/websocket.node.js": "./build/cjs/transports/websocket.js",
81
+ "./build/cjs/globals.node.js": "./build/cjs/globals.js"
82
+ },
83
+ "homepage": "https://github.com/socketio/socket.io/tree/main/packages/engine.io-client#readme",
84
+ "repository": {
85
+ "type": "git",
86
+ "url": "git+https://github.com/socketio/socket.io.git"
87
+ },
88
+ "bugs": {
89
+ "url": "https://github.com/socketio/socket.io/issues"
90
+ },
91
+ "files": [
92
+ "build/",
93
+ "dist/"
94
+ ]
95
+ }
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2014-present Guillermo Rauch and Socket.IO contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,158 @@
1
+
2
+ # engine.io-parser
3
+
4
+ [![Build Status](https://github.com/socketio/engine.io-parser/workflows/CI/badge.svg?branch=main)](https://github.com/socketio/engine.io-parser/actions)
5
+ [![NPM version](https://badge.fury.io/js/engine.io-parser.svg)](https://npmjs.com/package/engine.io-parser)
6
+
7
+ This is the JavaScript parser for the engine.io protocol encoding,
8
+ shared by both
9
+ [engine.io-client](https://github.com/socketio/engine.io-client) and
10
+ [engine.io](https://github.com/socketio/engine.io).
11
+
12
+ ## How to use
13
+
14
+ ### Standalone
15
+
16
+ The parser can encode/decode packets, payloads, and payloads as binary
17
+ with the following methods: `encodePacket`, `decodePacket`, `encodePayload`,
18
+ `decodePayload`.
19
+
20
+ Example:
21
+
22
+ ```js
23
+ const parser = require("engine.io-parser");
24
+ const data = Buffer.from([ 1, 2, 3, 4 ]);
25
+
26
+ parser.encodePacket({ type: "message", data }, encoded => {
27
+ const decodedData = parser.decodePacket(encoded); // decodedData === data
28
+ });
29
+ ```
30
+
31
+ ### With browserify
32
+
33
+ Engine.IO Parser is a commonjs module, which means you can include it by using
34
+ `require` on the browser and package using [browserify](http://browserify.org/):
35
+
36
+ 1. install the parser package
37
+
38
+ ```shell
39
+ npm install engine.io-parser
40
+ ```
41
+
42
+ 1. write your app code
43
+
44
+ ```js
45
+ const parser = require("engine.io-parser");
46
+
47
+ const testBuffer = new Int8Array(10);
48
+ for (let i = 0; i < testBuffer.length; i++) testBuffer[i] = i;
49
+
50
+ const packets = [{ type: "message", data: testBuffer.buffer }, { type: "message", data: "hello" }];
51
+
52
+ parser.encodePayload(packets, encoded => {
53
+ parser.decodePayload(encoded,
54
+ (packet, index, total) => {
55
+ const isLast = index + 1 == total;
56
+ if (!isLast) {
57
+ const buffer = new Int8Array(packet.data); // testBuffer
58
+ } else {
59
+ const message = packet.data; // "hello"
60
+ }
61
+ });
62
+ });
63
+ ```
64
+
65
+ 1. build your app bundle
66
+
67
+ ```bash
68
+ $ browserify app.js > bundle.js
69
+ ```
70
+
71
+ 1. include on your page
72
+
73
+ ```html
74
+ <script src="/path/to/bundle.js"></script>
75
+ ```
76
+
77
+ ## Features
78
+
79
+ - Runs on browser and node.js seamlessly
80
+ - Runs inside HTML5 WebWorker
81
+ - Can encode and decode packets
82
+ - Encodes from/to ArrayBuffer or Blob when in browser, and Buffer or ArrayBuffer in Node
83
+
84
+ ## API
85
+
86
+ Note: `cb(type)` means the type is a callback function that contains a parameter of type `type` when called.
87
+
88
+ ### Node
89
+
90
+ - `encodePacket`
91
+ - Encodes a packet.
92
+ - **Parameters**
93
+ - `Object`: the packet to encode, has `type` and `data`.
94
+ - `data`: can be a `String`, `Number`, `Buffer`, `ArrayBuffer`
95
+ - `Boolean`: binary support
96
+ - `Function`: callback, returns the encoded packet (`cb(String)`)
97
+ - `decodePacket`
98
+ - Decodes a packet. Data also available as an ArrayBuffer if requested.
99
+ - Returns data as `String` or (`Blob` on browser, `ArrayBuffer` on Node)
100
+ - **Parameters**
101
+ - `String` | `ArrayBuffer`: the packet to decode, has `type` and `data`
102
+ - `String`: optional, the binary type
103
+
104
+ - `encodePayload`
105
+ - Encodes multiple messages (payload).
106
+ - If any contents are binary, they will be encoded as base64 strings. Base64
107
+ encoded strings are marked with a b before the length specifier
108
+ - **Parameters**
109
+ - `Array`: an array of packets
110
+ - `Function`: callback, returns the encoded payload (`cb(String)`)
111
+ - `decodePayload`
112
+ - Decodes data when a payload is maybe expected. Possible binary contents are
113
+ decoded from their base64 representation.
114
+ - **Parameters**
115
+ - `String`: the payload
116
+ - `Function`: callback, returns (cb(`Object`: packet, `Number`:packet index, `Number`:packet total))
117
+
118
+ ## Tests
119
+
120
+ Standalone tests can be run with `npm test` which will run the node.js tests.
121
+
122
+ Browser tests are run using [zuul](https://github.com/defunctzombie/zuul).
123
+ (You must have zuul setup with a saucelabs account.)
124
+
125
+ You can run the tests locally using the following command:
126
+
127
+ ```
128
+ npm run test:browser
129
+ ```
130
+
131
+ ## Support
132
+
133
+ The support channels for `engine.io-parser` are the same as `socket.io`:
134
+ - irc.freenode.net **#socket.io**
135
+ - [Github Discussions](https://github.com/socketio/socket.io/discussions)
136
+ - [Website](https://socket.io)
137
+
138
+ ## Development
139
+
140
+ To contribute patches, run tests or benchmarks, make sure to clone the
141
+ repository:
142
+
143
+ ```bash
144
+ git clone git://github.com/socketio/engine.io-parser.git
145
+ ```
146
+
147
+ Then:
148
+
149
+ ```bash
150
+ cd engine.io-parser
151
+ npm ci
152
+ ```
153
+
154
+ See the `Tests` section above for how to run tests before submitting any patches.
155
+
156
+ ## License
157
+
158
+ MIT
@@ -0,0 +1,14 @@
1
+ declare const PACKET_TYPES: any;
2
+ declare const PACKET_TYPES_REVERSE: any;
3
+ declare const ERROR_PACKET: Packet;
4
+ export { PACKET_TYPES, PACKET_TYPES_REVERSE, ERROR_PACKET };
5
+ export type PacketType = "open" | "close" | "ping" | "pong" | "message" | "upgrade" | "noop" | "error";
6
+ export type RawData = any;
7
+ export interface Packet {
8
+ type: PacketType;
9
+ options?: {
10
+ compress: boolean;
11
+ };
12
+ data?: RawData;
13
+ }
14
+ export type BinaryType = "nodebuffer" | "arraybuffer" | "blob";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ERROR_PACKET = exports.PACKET_TYPES_REVERSE = exports.PACKET_TYPES = void 0;
4
+ const PACKET_TYPES = Object.create(null); // no Map = no polyfill
5
+ exports.PACKET_TYPES = PACKET_TYPES;
6
+ PACKET_TYPES["open"] = "0";
7
+ PACKET_TYPES["close"] = "1";
8
+ PACKET_TYPES["ping"] = "2";
9
+ PACKET_TYPES["pong"] = "3";
10
+ PACKET_TYPES["message"] = "4";
11
+ PACKET_TYPES["upgrade"] = "5";
12
+ PACKET_TYPES["noop"] = "6";
13
+ const PACKET_TYPES_REVERSE = Object.create(null);
14
+ exports.PACKET_TYPES_REVERSE = PACKET_TYPES_REVERSE;
15
+ Object.keys(PACKET_TYPES).forEach((key) => {
16
+ PACKET_TYPES_REVERSE[PACKET_TYPES[key]] = key;
17
+ });
18
+ const ERROR_PACKET = { type: "error", data: "parser error" };
19
+ exports.ERROR_PACKET = ERROR_PACKET;
@@ -0,0 +1,2 @@
1
+ export declare const encode: (arraybuffer: ArrayBuffer) => string;
2
+ export declare const decode: (base64: string) => ArrayBuffer;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decode = exports.encode = void 0;
4
+ // imported from https://github.com/socketio/base64-arraybuffer
5
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
6
+ // Use a lookup table to find the index.
7
+ const lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
8
+ for (let i = 0; i < chars.length; i++) {
9
+ lookup[chars.charCodeAt(i)] = i;
10
+ }
11
+ const encode = (arraybuffer) => {
12
+ let bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';
13
+ for (i = 0; i < len; i += 3) {
14
+ base64 += chars[bytes[i] >> 2];
15
+ base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
16
+ base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
17
+ base64 += chars[bytes[i + 2] & 63];
18
+ }
19
+ if (len % 3 === 2) {
20
+ base64 = base64.substring(0, base64.length - 1) + '=';
21
+ }
22
+ else if (len % 3 === 1) {
23
+ base64 = base64.substring(0, base64.length - 2) + '==';
24
+ }
25
+ return base64;
26
+ };
27
+ exports.encode = encode;
28
+ const decode = (base64) => {
29
+ let bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
30
+ if (base64[base64.length - 1] === '=') {
31
+ bufferLength--;
32
+ if (base64[base64.length - 2] === '=') {
33
+ bufferLength--;
34
+ }
35
+ }
36
+ const arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);
37
+ for (i = 0; i < len; i += 4) {
38
+ encoded1 = lookup[base64.charCodeAt(i)];
39
+ encoded2 = lookup[base64.charCodeAt(i + 1)];
40
+ encoded3 = lookup[base64.charCodeAt(i + 2)];
41
+ encoded4 = lookup[base64.charCodeAt(i + 3)];
42
+ bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
43
+ bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
44
+ bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
45
+ }
46
+ return arraybuffer;
47
+ };
48
+ exports.decode = decode;
@@ -0,0 +1,2 @@
1
+ import { Packet, BinaryType, RawData } from "./commons.js";
2
+ export declare const decodePacket: (encodedPacket: RawData, binaryType?: BinaryType) => Packet;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decodePacket = void 0;
4
+ const commons_js_1 = require("./commons.js");
5
+ const base64_arraybuffer_js_1 = require("./contrib/base64-arraybuffer.js");
6
+ const withNativeArrayBuffer = typeof ArrayBuffer === "function";
7
+ const decodePacket = (encodedPacket, binaryType) => {
8
+ if (typeof encodedPacket !== "string") {
9
+ return {
10
+ type: "message",
11
+ data: mapBinary(encodedPacket, binaryType),
12
+ };
13
+ }
14
+ const type = encodedPacket.charAt(0);
15
+ if (type === "b") {
16
+ return {
17
+ type: "message",
18
+ data: decodeBase64Packet(encodedPacket.substring(1), binaryType),
19
+ };
20
+ }
21
+ const packetType = commons_js_1.PACKET_TYPES_REVERSE[type];
22
+ if (!packetType) {
23
+ return commons_js_1.ERROR_PACKET;
24
+ }
25
+ return encodedPacket.length > 1
26
+ ? {
27
+ type: commons_js_1.PACKET_TYPES_REVERSE[type],
28
+ data: encodedPacket.substring(1),
29
+ }
30
+ : {
31
+ type: commons_js_1.PACKET_TYPES_REVERSE[type],
32
+ };
33
+ };
34
+ exports.decodePacket = decodePacket;
35
+ const decodeBase64Packet = (data, binaryType) => {
36
+ if (withNativeArrayBuffer) {
37
+ const decoded = (0, base64_arraybuffer_js_1.decode)(data);
38
+ return mapBinary(decoded, binaryType);
39
+ }
40
+ else {
41
+ return { base64: true, data }; // fallback for old browsers
42
+ }
43
+ };
44
+ const mapBinary = (data, binaryType) => {
45
+ switch (binaryType) {
46
+ case "blob":
47
+ if (data instanceof Blob) {
48
+ // from WebSocket + binaryType "blob"
49
+ return data;
50
+ }
51
+ else {
52
+ // from HTTP long-polling or WebTransport
53
+ return new Blob([data]);
54
+ }
55
+ case "arraybuffer":
56
+ default:
57
+ if (data instanceof ArrayBuffer) {
58
+ // from HTTP long-polling (base64) or WebSocket + binaryType "arraybuffer"
59
+ return data;
60
+ }
61
+ else {
62
+ // from WebTransport (Uint8Array)
63
+ return data.buffer;
64
+ }
65
+ }
66
+ };
@@ -0,0 +1,2 @@
1
+ import { Packet, BinaryType, RawData } from "./commons.js";
2
+ export declare const decodePacket: (encodedPacket: RawData, binaryType?: BinaryType) => Packet;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decodePacket = void 0;
4
+ const commons_js_1 = require("./commons.js");
5
+ const decodePacket = (encodedPacket, binaryType) => {
6
+ if (typeof encodedPacket !== "string") {
7
+ return {
8
+ type: "message",
9
+ data: mapBinary(encodedPacket, binaryType),
10
+ };
11
+ }
12
+ const type = encodedPacket.charAt(0);
13
+ if (type === "b") {
14
+ const buffer = Buffer.from(encodedPacket.substring(1), "base64");
15
+ return {
16
+ type: "message",
17
+ data: mapBinary(buffer, binaryType),
18
+ };
19
+ }
20
+ if (!commons_js_1.PACKET_TYPES_REVERSE[type]) {
21
+ return commons_js_1.ERROR_PACKET;
22
+ }
23
+ return encodedPacket.length > 1
24
+ ? {
25
+ type: commons_js_1.PACKET_TYPES_REVERSE[type],
26
+ data: encodedPacket.substring(1),
27
+ }
28
+ : {
29
+ type: commons_js_1.PACKET_TYPES_REVERSE[type],
30
+ };
31
+ };
32
+ exports.decodePacket = decodePacket;
33
+ const mapBinary = (data, binaryType) => {
34
+ switch (binaryType) {
35
+ case "arraybuffer":
36
+ if (data instanceof ArrayBuffer) {
37
+ // from WebSocket & binaryType "arraybuffer"
38
+ return data;
39
+ }
40
+ else if (Buffer.isBuffer(data)) {
41
+ // from HTTP long-polling
42
+ return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
43
+ }
44
+ else {
45
+ // from WebTransport (Uint8Array)
46
+ return data.buffer;
47
+ }
48
+ case "nodebuffer":
49
+ default:
50
+ if (Buffer.isBuffer(data)) {
51
+ // from HTTP long-polling or WebSocket & binaryType "nodebuffer" (default)
52
+ return data;
53
+ }
54
+ else {
55
+ // from WebTransport (Uint8Array)
56
+ return Buffer.from(data);
57
+ }
58
+ }
59
+ };
@@ -0,0 +1,4 @@
1
+ import { Packet, RawData } from "./commons.js";
2
+ declare const encodePacket: ({ type, data }: Packet, supportsBinary: boolean, callback: (encodedPacket: RawData) => void) => void;
3
+ export declare function encodePacketToBinary(packet: Packet, callback: (encodedPacket: RawData) => void): void | Promise<void>;
4
+ export { encodePacket };
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.encodePacket = void 0;
4
+ exports.encodePacketToBinary = encodePacketToBinary;
5
+ const commons_js_1 = require("./commons.js");
6
+ const withNativeBlob = typeof Blob === "function" ||
7
+ (typeof Blob !== "undefined" &&
8
+ Object.prototype.toString.call(Blob) === "[object BlobConstructor]");
9
+ const withNativeArrayBuffer = typeof ArrayBuffer === "function";
10
+ // ArrayBuffer.isView method is not defined in IE10
11
+ const isView = (obj) => {
12
+ return typeof ArrayBuffer.isView === "function"
13
+ ? ArrayBuffer.isView(obj)
14
+ : obj && obj.buffer instanceof ArrayBuffer;
15
+ };
16
+ const encodePacket = ({ type, data }, supportsBinary, callback) => {
17
+ if (withNativeBlob && data instanceof Blob) {
18
+ if (supportsBinary) {
19
+ return callback(data);
20
+ }
21
+ else {
22
+ return encodeBlobAsBase64(data, callback);
23
+ }
24
+ }
25
+ else if (withNativeArrayBuffer &&
26
+ (data instanceof ArrayBuffer || isView(data))) {
27
+ if (supportsBinary) {
28
+ return callback(data);
29
+ }
30
+ else {
31
+ return encodeBlobAsBase64(new Blob([data]), callback);
32
+ }
33
+ }
34
+ // plain string
35
+ return callback(commons_js_1.PACKET_TYPES[type] + (data || ""));
36
+ };
37
+ exports.encodePacket = encodePacket;
38
+ const encodeBlobAsBase64 = (data, callback) => {
39
+ const fileReader = new FileReader();
40
+ fileReader.onload = function () {
41
+ const content = fileReader.result.split(",")[1];
42
+ callback("b" + (content || ""));
43
+ };
44
+ return fileReader.readAsDataURL(data);
45
+ };
46
+ function toArray(data) {
47
+ if (data instanceof Uint8Array) {
48
+ return data;
49
+ }
50
+ else if (data instanceof ArrayBuffer) {
51
+ return new Uint8Array(data);
52
+ }
53
+ else {
54
+ return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
55
+ }
56
+ }
57
+ let TEXT_ENCODER;
58
+ function encodePacketToBinary(packet, callback) {
59
+ if (withNativeBlob && packet.data instanceof Blob) {
60
+ return packet.data.arrayBuffer().then(toArray).then(callback);
61
+ }
62
+ else if (withNativeArrayBuffer &&
63
+ (packet.data instanceof ArrayBuffer || isView(packet.data))) {
64
+ return callback(toArray(packet.data));
65
+ }
66
+ encodePacket(packet, false, (encoded) => {
67
+ if (!TEXT_ENCODER) {
68
+ TEXT_ENCODER = new TextEncoder();
69
+ }
70
+ callback(TEXT_ENCODER.encode(encoded));
71
+ });
72
+ }
@@ -0,0 +1,3 @@
1
+ import { Packet, RawData } from "./commons.js";
2
+ export declare const encodePacket: ({ type, data }: Packet, supportsBinary: boolean, callback: (encodedPacket: RawData) => void) => void;
3
+ export declare function encodePacketToBinary(packet: Packet, callback: (encodedPacket: RawData) => void): void;