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.
- package/README.md +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/src/channel.d.ts +11 -0
- package/dist/src/channel.d.ts.map +1 -0
- package/dist/src/channel.js +255 -0
- package/dist/src/channel.js.map +1 -0
- package/dist/src/config.d.ts +29 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +99 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/dedup.d.ts +7 -0
- package/dist/src/dedup.d.ts.map +1 -0
- package/dist/src/dedup.js +52 -0
- package/dist/src/dedup.js.map +1 -0
- package/dist/src/gateway.d.ts +16 -0
- package/dist/src/gateway.d.ts.map +1 -0
- package/dist/src/gateway.js +283 -0
- package/dist/src/gateway.js.map +1 -0
- package/dist/src/inbound.d.ts +18 -0
- package/dist/src/inbound.d.ts.map +1 -0
- package/dist/src/inbound.js +252 -0
- package/dist/src/inbound.js.map +1 -0
- package/dist/src/media.d.ts +12 -0
- package/dist/src/media.d.ts.map +1 -0
- package/dist/src/media.js +87 -0
- package/dist/src/media.js.map +1 -0
- package/dist/src/outbound.d.ts +28 -0
- package/dist/src/outbound.d.ts.map +1 -0
- package/dist/src/outbound.js +172 -0
- package/dist/src/outbound.js.map +1 -0
- package/dist/src/runtime.d.ts +4 -0
- package/dist/src/runtime.d.ts.map +1 -0
- package/dist/src/runtime.js +11 -0
- package/dist/src/runtime.js.map +1 -0
- package/dist/src/session-history.d.ts +88 -0
- package/dist/src/session-history.d.ts.map +1 -0
- package/dist/src/session-history.js +545 -0
- package/dist/src/session-history.js.map +1 -0
- package/dist/src/socket-handlers.d.ts +21 -0
- package/dist/src/socket-handlers.d.ts.map +1 -0
- package/dist/src/socket-handlers.js +120 -0
- package/dist/src/socket-handlers.js.map +1 -0
- package/dist/src/socket-registry.d.ts +53 -0
- package/dist/src/socket-registry.d.ts.map +1 -0
- package/dist/src/socket-registry.js +115 -0
- package/dist/src/socket-registry.js.map +1 -0
- package/dist/src/types.d.ts +100 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +10 -0
- package/dist/src/types.js.map +1 -0
- package/node_modules/@socket.io/component-emitter/LICENSE +24 -0
- package/node_modules/@socket.io/component-emitter/Readme.md +79 -0
- package/node_modules/@socket.io/component-emitter/lib/cjs/index.d.ts +179 -0
- package/node_modules/@socket.io/component-emitter/lib/cjs/index.js +176 -0
- package/node_modules/@socket.io/component-emitter/lib/cjs/package.json +4 -0
- package/node_modules/@socket.io/component-emitter/lib/esm/index.d.ts +179 -0
- package/node_modules/@socket.io/component-emitter/lib/esm/index.js +169 -0
- package/node_modules/@socket.io/component-emitter/lib/esm/package.json +4 -0
- package/node_modules/@socket.io/component-emitter/package.json +28 -0
- package/node_modules/debug/LICENSE +20 -0
- package/node_modules/debug/README.md +481 -0
- package/node_modules/debug/package.json +64 -0
- package/node_modules/debug/src/browser.js +272 -0
- package/node_modules/debug/src/common.js +292 -0
- package/node_modules/debug/src/index.js +10 -0
- package/node_modules/debug/src/node.js +263 -0
- package/node_modules/engine.io-client/LICENSE +22 -0
- package/node_modules/engine.io-client/README.md +331 -0
- package/node_modules/engine.io-client/build/cjs/browser-entrypoint.d.ts +3 -0
- package/node_modules/engine.io-client/build/cjs/browser-entrypoint.js +4 -0
- package/node_modules/engine.io-client/build/cjs/contrib/has-cors.d.ts +1 -0
- package/node_modules/engine.io-client/build/cjs/contrib/has-cors.js +14 -0
- package/node_modules/engine.io-client/build/cjs/contrib/parseqs.d.ts +15 -0
- package/node_modules/engine.io-client/build/cjs/contrib/parseqs.js +38 -0
- package/node_modules/engine.io-client/build/cjs/contrib/parseuri.d.ts +1 -0
- package/node_modules/engine.io-client/build/cjs/contrib/parseuri.js +67 -0
- package/node_modules/engine.io-client/build/cjs/globals.d.ts +4 -0
- package/node_modules/engine.io-client/build/cjs/globals.js +26 -0
- package/node_modules/engine.io-client/build/cjs/globals.node.d.ts +21 -0
- package/node_modules/engine.io-client/build/cjs/globals.node.js +97 -0
- package/node_modules/engine.io-client/build/cjs/index.d.ts +15 -0
- package/node_modules/engine.io-client/build/cjs/index.js +32 -0
- package/node_modules/engine.io-client/build/cjs/package.json +10 -0
- package/node_modules/engine.io-client/build/cjs/socket.d.ts +482 -0
- package/node_modules/engine.io-client/build/cjs/socket.js +765 -0
- package/node_modules/engine.io-client/build/cjs/transport.d.ts +106 -0
- package/node_modules/engine.io-client/build/cjs/transport.js +153 -0
- package/node_modules/engine.io-client/build/cjs/transports/index.d.ts +8 -0
- package/node_modules/engine.io-client/build/cjs/transports/index.js +11 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-fetch.d.ts +15 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-fetch.js +60 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.d.ts +108 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.js +285 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.d.ts +11 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.js +44 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling.d.ts +52 -0
- package/node_modules/engine.io-client/build/cjs/transports/polling.js +165 -0
- package/node_modules/engine.io-client/build/cjs/transports/websocket.d.ts +36 -0
- package/node_modules/engine.io-client/build/cjs/transports/websocket.js +136 -0
- package/node_modules/engine.io-client/build/cjs/transports/websocket.node.d.ts +14 -0
- package/node_modules/engine.io-client/build/cjs/transports/websocket.node.js +68 -0
- package/node_modules/engine.io-client/build/cjs/transports/webtransport.d.ts +18 -0
- package/node_modules/engine.io-client/build/cjs/transports/webtransport.js +94 -0
- package/node_modules/engine.io-client/build/cjs/util.d.ts +7 -0
- package/node_modules/engine.io-client/build/cjs/util.js +65 -0
- package/node_modules/engine.io-client/build/esm/browser-entrypoint.d.ts +3 -0
- package/node_modules/engine.io-client/build/esm/browser-entrypoint.js +2 -0
- package/node_modules/engine.io-client/build/esm/contrib/has-cors.d.ts +1 -0
- package/node_modules/engine.io-client/build/esm/contrib/has-cors.js +11 -0
- package/node_modules/engine.io-client/build/esm/contrib/parseqs.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm/contrib/parseqs.js +34 -0
- package/node_modules/engine.io-client/build/esm/contrib/parseuri.d.ts +1 -0
- package/node_modules/engine.io-client/build/esm/contrib/parseuri.js +64 -0
- package/node_modules/engine.io-client/build/esm/globals.d.ts +4 -0
- package/node_modules/engine.io-client/build/esm/globals.js +22 -0
- package/node_modules/engine.io-client/build/esm/globals.node.d.ts +21 -0
- package/node_modules/engine.io-client/build/esm/globals.node.js +91 -0
- package/node_modules/engine.io-client/build/esm/index.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm/index.js +15 -0
- package/node_modules/engine.io-client/build/esm/package.json +10 -0
- package/node_modules/engine.io-client/build/esm/socket.d.ts +482 -0
- package/node_modules/engine.io-client/build/esm/socket.js +727 -0
- package/node_modules/engine.io-client/build/esm/transport.d.ts +106 -0
- package/node_modules/engine.io-client/build/esm/transport.js +142 -0
- package/node_modules/engine.io-client/build/esm/transports/index.d.ts +8 -0
- package/node_modules/engine.io-client/build/esm/transports/index.js +8 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-fetch.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-fetch.js +56 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.d.ts +108 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +271 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.d.ts +11 -0
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +17 -0
- package/node_modules/engine.io-client/build/esm/transports/polling.d.ts +52 -0
- package/node_modules/engine.io-client/build/esm/transports/polling.js +145 -0
- package/node_modules/engine.io-client/build/esm/transports/websocket.d.ts +36 -0
- package/node_modules/engine.io-client/build/esm/transports/websocket.js +125 -0
- package/node_modules/engine.io-client/build/esm/transports/websocket.node.d.ts +14 -0
- package/node_modules/engine.io-client/build/esm/transports/websocket.node.js +41 -0
- package/node_modules/engine.io-client/build/esm/transports/webtransport.d.ts +18 -0
- package/node_modules/engine.io-client/build/esm/transports/webtransport.js +80 -0
- package/node_modules/engine.io-client/build/esm/util.d.ts +7 -0
- package/node_modules/engine.io-client/build/esm/util.js +59 -0
- package/node_modules/engine.io-client/build/esm-debug/browser-entrypoint.d.ts +3 -0
- package/node_modules/engine.io-client/build/esm-debug/browser-entrypoint.js +2 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.d.ts +1 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.js +11 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.js +34 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.d.ts +1 -0
- package/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.js +64 -0
- package/node_modules/engine.io-client/build/esm-debug/globals.d.ts +4 -0
- package/node_modules/engine.io-client/build/esm-debug/globals.js +22 -0
- package/node_modules/engine.io-client/build/esm-debug/globals.node.d.ts +21 -0
- package/node_modules/engine.io-client/build/esm-debug/globals.node.js +91 -0
- package/node_modules/engine.io-client/build/esm-debug/index.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm-debug/index.js +15 -0
- package/node_modules/engine.io-client/build/esm-debug/package.json +10 -0
- package/node_modules/engine.io-client/build/esm-debug/socket.d.ts +482 -0
- package/node_modules/engine.io-client/build/esm-debug/socket.js +756 -0
- package/node_modules/engine.io-client/build/esm-debug/transport.d.ts +106 -0
- package/node_modules/engine.io-client/build/esm-debug/transport.js +145 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/index.d.ts +8 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/index.js +8 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-fetch.d.ts +15 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-fetch.js +56 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.d.ts +108 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.js +276 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.d.ts +11 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.js +17 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling.d.ts +52 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/polling.js +158 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.d.ts +36 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.js +128 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.d.ts +14 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.js +41 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/webtransport.d.ts +18 -0
- package/node_modules/engine.io-client/build/esm-debug/transports/webtransport.js +87 -0
- package/node_modules/engine.io-client/build/esm-debug/util.d.ts +7 -0
- package/node_modules/engine.io-client/build/esm-debug/util.js +59 -0
- package/node_modules/engine.io-client/dist/engine.io.esm.min.js +7 -0
- package/node_modules/engine.io-client/dist/engine.io.esm.min.js.map +1 -0
- package/node_modules/engine.io-client/dist/engine.io.js +3064 -0
- package/node_modules/engine.io-client/dist/engine.io.js.map +1 -0
- package/node_modules/engine.io-client/dist/engine.io.min.js +7 -0
- package/node_modules/engine.io-client/dist/engine.io.min.js.map +1 -0
- package/node_modules/engine.io-client/node_modules/ws/LICENSE +20 -0
- package/node_modules/engine.io-client/node_modules/ws/README.md +548 -0
- package/node_modules/engine.io-client/node_modules/ws/browser.js +8 -0
- package/node_modules/engine.io-client/node_modules/ws/index.js +13 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/constants.js +18 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js +528 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/receiver.js +706 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/sender.js +602 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js +550 -0
- package/node_modules/engine.io-client/node_modules/ws/lib/websocket.js +1388 -0
- package/node_modules/engine.io-client/node_modules/ws/package.json +69 -0
- package/node_modules/engine.io-client/node_modules/ws/wrapper.mjs +8 -0
- package/node_modules/engine.io-client/package.json +95 -0
- package/node_modules/engine.io-parser/LICENSE +22 -0
- package/node_modules/engine.io-parser/Readme.md +158 -0
- package/node_modules/engine.io-parser/build/cjs/commons.d.ts +14 -0
- package/node_modules/engine.io-parser/build/cjs/commons.js +19 -0
- package/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.d.ts +2 -0
- package/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.js +48 -0
- package/node_modules/engine.io-parser/build/cjs/decodePacket.browser.d.ts +2 -0
- package/node_modules/engine.io-parser/build/cjs/decodePacket.browser.js +66 -0
- package/node_modules/engine.io-parser/build/cjs/decodePacket.d.ts +2 -0
- package/node_modules/engine.io-parser/build/cjs/decodePacket.js +59 -0
- package/node_modules/engine.io-parser/build/cjs/encodePacket.browser.d.ts +4 -0
- package/node_modules/engine.io-parser/build/cjs/encodePacket.browser.js +72 -0
- package/node_modules/engine.io-parser/build/cjs/encodePacket.d.ts +3 -0
- package/node_modules/engine.io-parser/build/cjs/encodePacket.js +38 -0
- package/node_modules/engine.io-parser/build/cjs/index.d.ts +9 -0
- package/node_modules/engine.io-parser/build/cjs/index.js +164 -0
- package/node_modules/engine.io-parser/build/cjs/package.json +8 -0
- package/node_modules/engine.io-parser/build/esm/commons.d.ts +14 -0
- package/node_modules/engine.io-parser/build/esm/commons.js +14 -0
- package/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.d.ts +2 -0
- package/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js +43 -0
- package/node_modules/engine.io-parser/build/esm/decodePacket.browser.d.ts +2 -0
- package/node_modules/engine.io-parser/build/esm/decodePacket.browser.js +62 -0
- package/node_modules/engine.io-parser/build/esm/decodePacket.d.ts +2 -0
- package/node_modules/engine.io-parser/build/esm/decodePacket.js +55 -0
- package/node_modules/engine.io-parser/build/esm/encodePacket.browser.d.ts +4 -0
- package/node_modules/engine.io-parser/build/esm/encodePacket.browser.js +68 -0
- package/node_modules/engine.io-parser/build/esm/encodePacket.d.ts +3 -0
- package/node_modules/engine.io-parser/build/esm/encodePacket.js +33 -0
- package/node_modules/engine.io-parser/build/esm/index.d.ts +9 -0
- package/node_modules/engine.io-parser/build/esm/index.js +156 -0
- package/node_modules/engine.io-parser/build/esm/package.json +8 -0
- package/node_modules/engine.io-parser/package.json +46 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +38 -0
- package/node_modules/ms/readme.md +59 -0
- package/node_modules/socket.io-client/LICENSE +21 -0
- package/node_modules/socket.io-client/README.md +29 -0
- package/node_modules/socket.io-client/build/cjs/browser-entrypoint.d.ts +2 -0
- package/node_modules/socket.io-client/build/cjs/browser-entrypoint.js +4 -0
- package/node_modules/socket.io-client/build/cjs/contrib/backo2.d.ts +12 -0
- package/node_modules/socket.io-client/build/cjs/contrib/backo2.js +69 -0
- package/node_modules/socket.io-client/build/cjs/index.d.ts +29 -0
- package/node_modules/socket.io-client/build/cjs/index.js +76 -0
- package/node_modules/socket.io-client/build/cjs/manager.d.ts +295 -0
- package/node_modules/socket.io-client/build/cjs/manager.js +416 -0
- package/node_modules/socket.io-client/build/cjs/on.d.ts +2 -0
- package/node_modules/socket.io-client/build/cjs/on.js +9 -0
- package/node_modules/socket.io-client/build/cjs/socket.d.ts +593 -0
- package/node_modules/socket.io-client/build/cjs/socket.js +909 -0
- package/node_modules/socket.io-client/build/cjs/url.d.ts +33 -0
- package/node_modules/socket.io-client/build/cjs/url.js +69 -0
- package/node_modules/socket.io-client/build/esm/browser-entrypoint.d.ts +2 -0
- package/node_modules/socket.io-client/build/esm/browser-entrypoint.js +2 -0
- package/node_modules/socket.io-client/build/esm/contrib/backo2.d.ts +12 -0
- package/node_modules/socket.io-client/build/esm/contrib/backo2.js +66 -0
- package/node_modules/socket.io-client/build/esm/index.d.ts +29 -0
- package/node_modules/socket.io-client/build/esm/index.js +58 -0
- package/node_modules/socket.io-client/build/esm/manager.d.ts +295 -0
- package/node_modules/socket.io-client/build/esm/manager.js +367 -0
- package/node_modules/socket.io-client/build/esm/on.d.ts +2 -0
- package/node_modules/socket.io-client/build/esm/on.js +6 -0
- package/node_modules/socket.io-client/build/esm/package.json +5 -0
- package/node_modules/socket.io-client/build/esm/socket.d.ts +593 -0
- package/node_modules/socket.io-client/build/esm/socket.js +880 -0
- package/node_modules/socket.io-client/build/esm/url.d.ts +33 -0
- package/node_modules/socket.io-client/build/esm/url.js +59 -0
- package/node_modules/socket.io-client/build/esm-debug/browser-entrypoint.d.ts +2 -0
- package/node_modules/socket.io-client/build/esm-debug/browser-entrypoint.js +2 -0
- package/node_modules/socket.io-client/build/esm-debug/contrib/backo2.d.ts +12 -0
- package/node_modules/socket.io-client/build/esm-debug/contrib/backo2.js +66 -0
- package/node_modules/socket.io-client/build/esm-debug/index.d.ts +29 -0
- package/node_modules/socket.io-client/build/esm-debug/index.js +62 -0
- package/node_modules/socket.io-client/build/esm-debug/manager.d.ts +295 -0
- package/node_modules/socket.io-client/build/esm-debug/manager.js +386 -0
- package/node_modules/socket.io-client/build/esm-debug/on.d.ts +2 -0
- package/node_modules/socket.io-client/build/esm-debug/on.js +6 -0
- package/node_modules/socket.io-client/build/esm-debug/package.json +5 -0
- package/node_modules/socket.io-client/build/esm-debug/socket.d.ts +593 -0
- package/node_modules/socket.io-client/build/esm-debug/socket.js +902 -0
- package/node_modules/socket.io-client/build/esm-debug/url.d.ts +33 -0
- package/node_modules/socket.io-client/build/esm-debug/url.js +63 -0
- package/node_modules/socket.io-client/dist/socket.io.esm.min.js +7 -0
- package/node_modules/socket.io-client/dist/socket.io.esm.min.js.map +1 -0
- package/node_modules/socket.io-client/dist/socket.io.js +4955 -0
- package/node_modules/socket.io-client/dist/socket.io.js.map +1 -0
- package/node_modules/socket.io-client/dist/socket.io.min.js +7 -0
- package/node_modules/socket.io-client/dist/socket.io.min.js.map +1 -0
- package/node_modules/socket.io-client/dist/socket.io.msgpack.min.js +7 -0
- package/node_modules/socket.io-client/dist/socket.io.msgpack.min.js.map +1 -0
- package/node_modules/socket.io-client/package.json +101 -0
- package/node_modules/socket.io-parser/LICENSE +20 -0
- package/node_modules/socket.io-parser/Readme.md +81 -0
- package/node_modules/socket.io-parser/build/cjs/binary.d.ts +20 -0
- package/node_modules/socket.io-parser/build/cjs/binary.js +87 -0
- package/node_modules/socket.io-parser/build/cjs/index.d.ts +91 -0
- package/node_modules/socket.io-parser/build/cjs/index.js +359 -0
- package/node_modules/socket.io-parser/build/cjs/is-binary.d.ts +7 -0
- package/node_modules/socket.io-parser/build/cjs/is-binary.js +54 -0
- package/node_modules/socket.io-parser/build/cjs/package.json +3 -0
- package/node_modules/socket.io-parser/build/esm/binary.d.ts +20 -0
- package/node_modules/socket.io-parser/build/esm/binary.js +83 -0
- package/node_modules/socket.io-parser/build/esm/index.d.ts +91 -0
- package/node_modules/socket.io-parser/build/esm/index.js +348 -0
- package/node_modules/socket.io-parser/build/esm/is-binary.d.ts +7 -0
- package/node_modules/socket.io-parser/build/esm/is-binary.js +50 -0
- package/node_modules/socket.io-parser/build/esm/package.json +3 -0
- package/node_modules/socket.io-parser/build/esm-debug/binary.d.ts +20 -0
- package/node_modules/socket.io-parser/build/esm-debug/binary.js +83 -0
- package/node_modules/socket.io-parser/build/esm-debug/index.d.ts +91 -0
- package/node_modules/socket.io-parser/build/esm-debug/index.js +353 -0
- package/node_modules/socket.io-parser/build/esm-debug/is-binary.d.ts +7 -0
- package/node_modules/socket.io-parser/build/esm-debug/is-binary.js +50 -0
- package/node_modules/socket.io-parser/build/esm-debug/package.json +3 -0
- package/node_modules/socket.io-parser/package.json +44 -0
- package/node_modules/xmlhttprequest-ssl/LICENSE +22 -0
- package/node_modules/xmlhttprequest-ssl/README.md +67 -0
- package/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +689 -0
- package/node_modules/xmlhttprequest-ssl/package.json +40 -0
- package/openclaw.plugin.json +17 -0
- package/package.json +61 -0
- 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
|
+
[](https://github.com/socketio/engine.io-parser/actions)
|
|
5
|
+
[](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,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,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,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;
|