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,38 @@
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 encodePacket = ({ type, data }, supportsBinary, callback) => {
7
+ if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {
8
+ return callback(supportsBinary ? data : "b" + toBuffer(data, true).toString("base64"));
9
+ }
10
+ // plain string
11
+ return callback(commons_js_1.PACKET_TYPES[type] + (data || ""));
12
+ };
13
+ exports.encodePacket = encodePacket;
14
+ const toBuffer = (data, forceBufferConversion) => {
15
+ if (Buffer.isBuffer(data) ||
16
+ (data instanceof Uint8Array && !forceBufferConversion)) {
17
+ return data;
18
+ }
19
+ else if (data instanceof ArrayBuffer) {
20
+ return Buffer.from(data);
21
+ }
22
+ else {
23
+ return Buffer.from(data.buffer, data.byteOffset, data.byteLength);
24
+ }
25
+ };
26
+ let TEXT_ENCODER;
27
+ function encodePacketToBinary(packet, callback) {
28
+ if (packet.data instanceof ArrayBuffer || ArrayBuffer.isView(packet.data)) {
29
+ return callback(toBuffer(packet.data, false));
30
+ }
31
+ (0, exports.encodePacket)(packet, true, (encoded) => {
32
+ if (!TEXT_ENCODER) {
33
+ // lazily created for compatibility with Node.js 10
34
+ TEXT_ENCODER = new TextEncoder();
35
+ }
36
+ callback(TEXT_ENCODER.encode(encoded));
37
+ });
38
+ }
@@ -0,0 +1,9 @@
1
+ import { encodePacket } from "./encodePacket.js";
2
+ import { decodePacket } from "./decodePacket.js";
3
+ import { Packet, PacketType, RawData, BinaryType } from "./commons.js";
4
+ declare const encodePayload: (packets: Packet[], callback: (encodedPayload: string) => void) => void;
5
+ declare const decodePayload: (encodedPayload: string, binaryType?: BinaryType) => Packet[];
6
+ export declare function createPacketEncoderStream(): any;
7
+ export declare function createPacketDecoderStream(maxPayload: number, binaryType: BinaryType): any;
8
+ export declare const protocol = 4;
9
+ export { encodePacket, encodePayload, decodePacket, decodePayload, Packet, PacketType, RawData, BinaryType, };
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decodePayload = exports.decodePacket = exports.encodePayload = exports.encodePacket = exports.protocol = void 0;
4
+ exports.createPacketEncoderStream = createPacketEncoderStream;
5
+ exports.createPacketDecoderStream = createPacketDecoderStream;
6
+ const encodePacket_js_1 = require("./encodePacket.js");
7
+ Object.defineProperty(exports, "encodePacket", { enumerable: true, get: function () { return encodePacket_js_1.encodePacket; } });
8
+ const decodePacket_js_1 = require("./decodePacket.js");
9
+ Object.defineProperty(exports, "decodePacket", { enumerable: true, get: function () { return decodePacket_js_1.decodePacket; } });
10
+ const commons_js_1 = require("./commons.js");
11
+ const SEPARATOR = String.fromCharCode(30); // see https://en.wikipedia.org/wiki/Delimiter#ASCII_delimited_text
12
+ const encodePayload = (packets, callback) => {
13
+ // some packets may be added to the array while encoding, so the initial length must be saved
14
+ const length = packets.length;
15
+ const encodedPackets = new Array(length);
16
+ let count = 0;
17
+ packets.forEach((packet, i) => {
18
+ // force base64 encoding for binary packets
19
+ (0, encodePacket_js_1.encodePacket)(packet, false, (encodedPacket) => {
20
+ encodedPackets[i] = encodedPacket;
21
+ if (++count === length) {
22
+ callback(encodedPackets.join(SEPARATOR));
23
+ }
24
+ });
25
+ });
26
+ };
27
+ exports.encodePayload = encodePayload;
28
+ const decodePayload = (encodedPayload, binaryType) => {
29
+ const encodedPackets = encodedPayload.split(SEPARATOR);
30
+ const packets = [];
31
+ for (let i = 0; i < encodedPackets.length; i++) {
32
+ const decodedPacket = (0, decodePacket_js_1.decodePacket)(encodedPackets[i], binaryType);
33
+ packets.push(decodedPacket);
34
+ if (decodedPacket.type === "error") {
35
+ break;
36
+ }
37
+ }
38
+ return packets;
39
+ };
40
+ exports.decodePayload = decodePayload;
41
+ function createPacketEncoderStream() {
42
+ return new TransformStream({
43
+ transform(packet, controller) {
44
+ (0, encodePacket_js_1.encodePacketToBinary)(packet, (encodedPacket) => {
45
+ const payloadLength = encodedPacket.length;
46
+ let header;
47
+ // inspired by the WebSocket format: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#decoding_payload_length
48
+ if (payloadLength < 126) {
49
+ header = new Uint8Array(1);
50
+ new DataView(header.buffer).setUint8(0, payloadLength);
51
+ }
52
+ else if (payloadLength < 65536) {
53
+ header = new Uint8Array(3);
54
+ const view = new DataView(header.buffer);
55
+ view.setUint8(0, 126);
56
+ view.setUint16(1, payloadLength);
57
+ }
58
+ else {
59
+ header = new Uint8Array(9);
60
+ const view = new DataView(header.buffer);
61
+ view.setUint8(0, 127);
62
+ view.setBigUint64(1, BigInt(payloadLength));
63
+ }
64
+ // first bit indicates whether the payload is plain text (0) or binary (1)
65
+ if (packet.data && typeof packet.data !== "string") {
66
+ header[0] |= 0x80;
67
+ }
68
+ controller.enqueue(header);
69
+ controller.enqueue(encodedPacket);
70
+ });
71
+ },
72
+ });
73
+ }
74
+ let TEXT_DECODER;
75
+ function totalLength(chunks) {
76
+ return chunks.reduce((acc, chunk) => acc + chunk.length, 0);
77
+ }
78
+ function concatChunks(chunks, size) {
79
+ if (chunks[0].length === size) {
80
+ return chunks.shift();
81
+ }
82
+ const buffer = new Uint8Array(size);
83
+ let j = 0;
84
+ for (let i = 0; i < size; i++) {
85
+ buffer[i] = chunks[0][j++];
86
+ if (j === chunks[0].length) {
87
+ chunks.shift();
88
+ j = 0;
89
+ }
90
+ }
91
+ if (chunks.length && j < chunks[0].length) {
92
+ chunks[0] = chunks[0].slice(j);
93
+ }
94
+ return buffer;
95
+ }
96
+ function createPacketDecoderStream(maxPayload, binaryType) {
97
+ if (!TEXT_DECODER) {
98
+ TEXT_DECODER = new TextDecoder();
99
+ }
100
+ const chunks = [];
101
+ let state = 0 /* State.READ_HEADER */;
102
+ let expectedLength = -1;
103
+ let isBinary = false;
104
+ return new TransformStream({
105
+ transform(chunk, controller) {
106
+ chunks.push(chunk);
107
+ while (true) {
108
+ if (state === 0 /* State.READ_HEADER */) {
109
+ if (totalLength(chunks) < 1) {
110
+ break;
111
+ }
112
+ const header = concatChunks(chunks, 1);
113
+ isBinary = (header[0] & 0x80) === 0x80;
114
+ expectedLength = header[0] & 0x7f;
115
+ if (expectedLength < 126) {
116
+ state = 3 /* State.READ_PAYLOAD */;
117
+ }
118
+ else if (expectedLength === 126) {
119
+ state = 1 /* State.READ_EXTENDED_LENGTH_16 */;
120
+ }
121
+ else {
122
+ state = 2 /* State.READ_EXTENDED_LENGTH_64 */;
123
+ }
124
+ }
125
+ else if (state === 1 /* State.READ_EXTENDED_LENGTH_16 */) {
126
+ if (totalLength(chunks) < 2) {
127
+ break;
128
+ }
129
+ const headerArray = concatChunks(chunks, 2);
130
+ expectedLength = new DataView(headerArray.buffer, headerArray.byteOffset, headerArray.length).getUint16(0);
131
+ state = 3 /* State.READ_PAYLOAD */;
132
+ }
133
+ else if (state === 2 /* State.READ_EXTENDED_LENGTH_64 */) {
134
+ if (totalLength(chunks) < 8) {
135
+ break;
136
+ }
137
+ const headerArray = concatChunks(chunks, 8);
138
+ const view = new DataView(headerArray.buffer, headerArray.byteOffset, headerArray.length);
139
+ const n = view.getUint32(0);
140
+ if (n > Math.pow(2, 53 - 32) - 1) {
141
+ // the maximum safe integer in JavaScript is 2^53 - 1
142
+ controller.enqueue(commons_js_1.ERROR_PACKET);
143
+ break;
144
+ }
145
+ expectedLength = n * Math.pow(2, 32) + view.getUint32(4);
146
+ state = 3 /* State.READ_PAYLOAD */;
147
+ }
148
+ else {
149
+ if (totalLength(chunks) < expectedLength) {
150
+ break;
151
+ }
152
+ const data = concatChunks(chunks, expectedLength);
153
+ controller.enqueue((0, decodePacket_js_1.decodePacket)(isBinary ? data : TEXT_DECODER.decode(data), binaryType));
154
+ state = 0 /* State.READ_HEADER */;
155
+ }
156
+ if (expectedLength === 0 || expectedLength > maxPayload) {
157
+ controller.enqueue(commons_js_1.ERROR_PACKET);
158
+ break;
159
+ }
160
+ }
161
+ },
162
+ });
163
+ }
164
+ exports.protocol = 4;
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "engine.io-parser",
3
+ "type": "commonjs",
4
+ "browser": {
5
+ "./encodePacket.js": "./encodePacket.browser.js",
6
+ "./decodePacket.js": "./decodePacket.browser.js"
7
+ }
8
+ }
@@ -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,14 @@
1
+ const PACKET_TYPES = Object.create(null); // no Map = no polyfill
2
+ PACKET_TYPES["open"] = "0";
3
+ PACKET_TYPES["close"] = "1";
4
+ PACKET_TYPES["ping"] = "2";
5
+ PACKET_TYPES["pong"] = "3";
6
+ PACKET_TYPES["message"] = "4";
7
+ PACKET_TYPES["upgrade"] = "5";
8
+ PACKET_TYPES["noop"] = "6";
9
+ const PACKET_TYPES_REVERSE = Object.create(null);
10
+ Object.keys(PACKET_TYPES).forEach((key) => {
11
+ PACKET_TYPES_REVERSE[PACKET_TYPES[key]] = key;
12
+ });
13
+ const ERROR_PACKET = { type: "error", data: "parser error" };
14
+ export { PACKET_TYPES, PACKET_TYPES_REVERSE, 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,43 @@
1
+ // imported from https://github.com/socketio/base64-arraybuffer
2
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
3
+ // Use a lookup table to find the index.
4
+ const lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
5
+ for (let i = 0; i < chars.length; i++) {
6
+ lookup[chars.charCodeAt(i)] = i;
7
+ }
8
+ export const encode = (arraybuffer) => {
9
+ let bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';
10
+ for (i = 0; i < len; i += 3) {
11
+ base64 += chars[bytes[i] >> 2];
12
+ base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
13
+ base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
14
+ base64 += chars[bytes[i + 2] & 63];
15
+ }
16
+ if (len % 3 === 2) {
17
+ base64 = base64.substring(0, base64.length - 1) + '=';
18
+ }
19
+ else if (len % 3 === 1) {
20
+ base64 = base64.substring(0, base64.length - 2) + '==';
21
+ }
22
+ return base64;
23
+ };
24
+ export const decode = (base64) => {
25
+ let bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
26
+ if (base64[base64.length - 1] === '=') {
27
+ bufferLength--;
28
+ if (base64[base64.length - 2] === '=') {
29
+ bufferLength--;
30
+ }
31
+ }
32
+ const arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);
33
+ for (i = 0; i < len; i += 4) {
34
+ encoded1 = lookup[base64.charCodeAt(i)];
35
+ encoded2 = lookup[base64.charCodeAt(i + 1)];
36
+ encoded3 = lookup[base64.charCodeAt(i + 2)];
37
+ encoded4 = lookup[base64.charCodeAt(i + 3)];
38
+ bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
39
+ bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
40
+ bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
41
+ }
42
+ return arraybuffer;
43
+ };
@@ -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,62 @@
1
+ import { ERROR_PACKET, PACKET_TYPES_REVERSE, } from "./commons.js";
2
+ import { decode } from "./contrib/base64-arraybuffer.js";
3
+ const withNativeArrayBuffer = typeof ArrayBuffer === "function";
4
+ export const decodePacket = (encodedPacket, binaryType) => {
5
+ if (typeof encodedPacket !== "string") {
6
+ return {
7
+ type: "message",
8
+ data: mapBinary(encodedPacket, binaryType),
9
+ };
10
+ }
11
+ const type = encodedPacket.charAt(0);
12
+ if (type === "b") {
13
+ return {
14
+ type: "message",
15
+ data: decodeBase64Packet(encodedPacket.substring(1), binaryType),
16
+ };
17
+ }
18
+ const packetType = PACKET_TYPES_REVERSE[type];
19
+ if (!packetType) {
20
+ return ERROR_PACKET;
21
+ }
22
+ return encodedPacket.length > 1
23
+ ? {
24
+ type: PACKET_TYPES_REVERSE[type],
25
+ data: encodedPacket.substring(1),
26
+ }
27
+ : {
28
+ type: PACKET_TYPES_REVERSE[type],
29
+ };
30
+ };
31
+ const decodeBase64Packet = (data, binaryType) => {
32
+ if (withNativeArrayBuffer) {
33
+ const decoded = decode(data);
34
+ return mapBinary(decoded, binaryType);
35
+ }
36
+ else {
37
+ return { base64: true, data }; // fallback for old browsers
38
+ }
39
+ };
40
+ const mapBinary = (data, binaryType) => {
41
+ switch (binaryType) {
42
+ case "blob":
43
+ if (data instanceof Blob) {
44
+ // from WebSocket + binaryType "blob"
45
+ return data;
46
+ }
47
+ else {
48
+ // from HTTP long-polling or WebTransport
49
+ return new Blob([data]);
50
+ }
51
+ case "arraybuffer":
52
+ default:
53
+ if (data instanceof ArrayBuffer) {
54
+ // from HTTP long-polling (base64) or WebSocket + binaryType "arraybuffer"
55
+ return data;
56
+ }
57
+ else {
58
+ // from WebTransport (Uint8Array)
59
+ return data.buffer;
60
+ }
61
+ }
62
+ };
@@ -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,55 @@
1
+ import { ERROR_PACKET, PACKET_TYPES_REVERSE, } from "./commons.js";
2
+ export const decodePacket = (encodedPacket, binaryType) => {
3
+ if (typeof encodedPacket !== "string") {
4
+ return {
5
+ type: "message",
6
+ data: mapBinary(encodedPacket, binaryType),
7
+ };
8
+ }
9
+ const type = encodedPacket.charAt(0);
10
+ if (type === "b") {
11
+ const buffer = Buffer.from(encodedPacket.substring(1), "base64");
12
+ return {
13
+ type: "message",
14
+ data: mapBinary(buffer, binaryType),
15
+ };
16
+ }
17
+ if (!PACKET_TYPES_REVERSE[type]) {
18
+ return ERROR_PACKET;
19
+ }
20
+ return encodedPacket.length > 1
21
+ ? {
22
+ type: PACKET_TYPES_REVERSE[type],
23
+ data: encodedPacket.substring(1),
24
+ }
25
+ : {
26
+ type: PACKET_TYPES_REVERSE[type],
27
+ };
28
+ };
29
+ const mapBinary = (data, binaryType) => {
30
+ switch (binaryType) {
31
+ case "arraybuffer":
32
+ if (data instanceof ArrayBuffer) {
33
+ // from WebSocket & binaryType "arraybuffer"
34
+ return data;
35
+ }
36
+ else if (Buffer.isBuffer(data)) {
37
+ // from HTTP long-polling
38
+ return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
39
+ }
40
+ else {
41
+ // from WebTransport (Uint8Array)
42
+ return data.buffer;
43
+ }
44
+ case "nodebuffer":
45
+ default:
46
+ if (Buffer.isBuffer(data)) {
47
+ // from HTTP long-polling or WebSocket & binaryType "nodebuffer" (default)
48
+ return data;
49
+ }
50
+ else {
51
+ // from WebTransport (Uint8Array)
52
+ return Buffer.from(data);
53
+ }
54
+ }
55
+ };
@@ -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,68 @@
1
+ import { PACKET_TYPES } from "./commons.js";
2
+ const withNativeBlob = typeof Blob === "function" ||
3
+ (typeof Blob !== "undefined" &&
4
+ Object.prototype.toString.call(Blob) === "[object BlobConstructor]");
5
+ const withNativeArrayBuffer = typeof ArrayBuffer === "function";
6
+ // ArrayBuffer.isView method is not defined in IE10
7
+ const isView = (obj) => {
8
+ return typeof ArrayBuffer.isView === "function"
9
+ ? ArrayBuffer.isView(obj)
10
+ : obj && obj.buffer instanceof ArrayBuffer;
11
+ };
12
+ const encodePacket = ({ type, data }, supportsBinary, callback) => {
13
+ if (withNativeBlob && data instanceof Blob) {
14
+ if (supportsBinary) {
15
+ return callback(data);
16
+ }
17
+ else {
18
+ return encodeBlobAsBase64(data, callback);
19
+ }
20
+ }
21
+ else if (withNativeArrayBuffer &&
22
+ (data instanceof ArrayBuffer || isView(data))) {
23
+ if (supportsBinary) {
24
+ return callback(data);
25
+ }
26
+ else {
27
+ return encodeBlobAsBase64(new Blob([data]), callback);
28
+ }
29
+ }
30
+ // plain string
31
+ return callback(PACKET_TYPES[type] + (data || ""));
32
+ };
33
+ const encodeBlobAsBase64 = (data, callback) => {
34
+ const fileReader = new FileReader();
35
+ fileReader.onload = function () {
36
+ const content = fileReader.result.split(",")[1];
37
+ callback("b" + (content || ""));
38
+ };
39
+ return fileReader.readAsDataURL(data);
40
+ };
41
+ function toArray(data) {
42
+ if (data instanceof Uint8Array) {
43
+ return data;
44
+ }
45
+ else if (data instanceof ArrayBuffer) {
46
+ return new Uint8Array(data);
47
+ }
48
+ else {
49
+ return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
50
+ }
51
+ }
52
+ let TEXT_ENCODER;
53
+ export function encodePacketToBinary(packet, callback) {
54
+ if (withNativeBlob && packet.data instanceof Blob) {
55
+ return packet.data.arrayBuffer().then(toArray).then(callback);
56
+ }
57
+ else if (withNativeArrayBuffer &&
58
+ (packet.data instanceof ArrayBuffer || isView(packet.data))) {
59
+ return callback(toArray(packet.data));
60
+ }
61
+ encodePacket(packet, false, (encoded) => {
62
+ if (!TEXT_ENCODER) {
63
+ TEXT_ENCODER = new TextEncoder();
64
+ }
65
+ callback(TEXT_ENCODER.encode(encoded));
66
+ });
67
+ }
68
+ export { encodePacket };
@@ -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;
@@ -0,0 +1,33 @@
1
+ import { PACKET_TYPES } from "./commons.js";
2
+ export const encodePacket = ({ type, data }, supportsBinary, callback) => {
3
+ if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {
4
+ return callback(supportsBinary ? data : "b" + toBuffer(data, true).toString("base64"));
5
+ }
6
+ // plain string
7
+ return callback(PACKET_TYPES[type] + (data || ""));
8
+ };
9
+ const toBuffer = (data, forceBufferConversion) => {
10
+ if (Buffer.isBuffer(data) ||
11
+ (data instanceof Uint8Array && !forceBufferConversion)) {
12
+ return data;
13
+ }
14
+ else if (data instanceof ArrayBuffer) {
15
+ return Buffer.from(data);
16
+ }
17
+ else {
18
+ return Buffer.from(data.buffer, data.byteOffset, data.byteLength);
19
+ }
20
+ };
21
+ let TEXT_ENCODER;
22
+ export function encodePacketToBinary(packet, callback) {
23
+ if (packet.data instanceof ArrayBuffer || ArrayBuffer.isView(packet.data)) {
24
+ return callback(toBuffer(packet.data, false));
25
+ }
26
+ encodePacket(packet, true, (encoded) => {
27
+ if (!TEXT_ENCODER) {
28
+ // lazily created for compatibility with Node.js 10
29
+ TEXT_ENCODER = new TextEncoder();
30
+ }
31
+ callback(TEXT_ENCODER.encode(encoded));
32
+ });
33
+ }
@@ -0,0 +1,9 @@
1
+ import { encodePacket } from "./encodePacket.js";
2
+ import { decodePacket } from "./decodePacket.js";
3
+ import { Packet, PacketType, RawData, BinaryType } from "./commons.js";
4
+ declare const encodePayload: (packets: Packet[], callback: (encodedPayload: string) => void) => void;
5
+ declare const decodePayload: (encodedPayload: string, binaryType?: BinaryType) => Packet[];
6
+ export declare function createPacketEncoderStream(): any;
7
+ export declare function createPacketDecoderStream(maxPayload: number, binaryType: BinaryType): any;
8
+ export declare const protocol = 4;
9
+ export { encodePacket, encodePayload, decodePacket, decodePayload, Packet, PacketType, RawData, BinaryType, };