lightclawbot 1.1.2 → 1.2.0-beta.0

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 (397) hide show
  1. package/README.md +0 -1
  2. package/dist/index.js +38 -31
  3. package/dist/setup-entry.js +32 -0
  4. package/dist/src/channel.js +301 -257
  5. package/dist/src/channel.setup.js +16 -0
  6. package/dist/src/config.js +31 -124
  7. package/dist/src/dedup.js +0 -1
  8. package/dist/src/download-tool.js +0 -1
  9. package/dist/src/file-storage.js +2 -2
  10. package/dist/src/gateway.js +226 -178
  11. package/dist/src/history/cron-utils.js +0 -1
  12. package/dist/src/history/index.js +0 -1
  13. package/dist/src/history/message-parser.js +0 -1
  14. package/dist/src/history/session-reader.js +3 -1
  15. package/dist/src/history/session-store.js +0 -1
  16. package/dist/src/history/text-processing.js +0 -1
  17. package/dist/src/history/types.js +0 -1
  18. package/dist/src/inbound.js +183 -234
  19. package/dist/src/media.js +0 -1
  20. package/dist/src/messaging.js +65 -0
  21. package/dist/src/outbound.js +131 -45
  22. package/dist/src/runtime.js +29 -11
  23. package/dist/src/setup-core.js +27 -0
  24. package/dist/src/shared.js +141 -0
  25. package/dist/src/socket/handlers.js +72 -49
  26. package/dist/src/socket/index.js +0 -1
  27. package/dist/src/socket/native-socket.js +385 -0
  28. package/dist/src/socket/registry.js +0 -1
  29. package/dist/src/socket/reliable-emitter.js +188 -50
  30. package/dist/src/streaming/delta-tracker.js +140 -0
  31. package/dist/src/streaming/index.js +12 -0
  32. package/dist/src/streaming/stream-reply-sink.js +387 -0
  33. package/dist/src/streaming/types.js +4 -0
  34. package/dist/src/tools.js +13 -0
  35. package/dist/src/types.js +23 -2
  36. package/dist/src/upload-tool.js +0 -1
  37. package/dist/src/utils/account.js +73 -0
  38. package/dist/src/utils/common.js +48 -0
  39. package/dist/src/utils/index.js +2 -0
  40. package/node_modules/ws/index.js +22 -0
  41. package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/constants.js +1 -0
  42. package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/permessage-deflate.js +6 -6
  43. package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/websocket-server.js +10 -6
  44. package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/websocket.js +19 -14
  45. package/node_modules/{engine.io-client/node_modules/ws → ws}/package.json +4 -3
  46. package/node_modules/ws/wrapper.mjs +21 -0
  47. package/openclaw.plugin.json +0 -7
  48. package/package.json +8 -5
  49. package/dist/index.d.ts +0 -24
  50. package/dist/index.d.ts.map +0 -1
  51. package/dist/index.js.map +0 -1
  52. package/dist/public/data/scripts/manifest.json +0 -11
  53. package/dist/public/data/scripts/preflight.9af62b39.sh +0 -191
  54. package/dist/public/data/scripts/preflight.sh +0 -191
  55. package/dist/src/channel.d.ts +0 -11
  56. package/dist/src/channel.d.ts.map +0 -1
  57. package/dist/src/channel.js.map +0 -1
  58. package/dist/src/config.d.ts +0 -129
  59. package/dist/src/config.d.ts.map +0 -1
  60. package/dist/src/config.js.map +0 -1
  61. package/dist/src/dedup.d.ts +0 -12
  62. package/dist/src/dedup.d.ts.map +0 -1
  63. package/dist/src/dedup.js.map +0 -1
  64. package/dist/src/download-tool.d.ts +0 -32
  65. package/dist/src/download-tool.d.ts.map +0 -1
  66. package/dist/src/download-tool.js.map +0 -1
  67. package/dist/src/file-storage.d.ts +0 -74
  68. package/dist/src/file-storage.d.ts.map +0 -1
  69. package/dist/src/file-storage.js.map +0 -1
  70. package/dist/src/format-urls.d.ts +0 -26
  71. package/dist/src/format-urls.d.ts.map +0 -1
  72. package/dist/src/format-urls.js +0 -53
  73. package/dist/src/format-urls.js.map +0 -1
  74. package/dist/src/gateway.d.ts +0 -16
  75. package/dist/src/gateway.d.ts.map +0 -1
  76. package/dist/src/gateway.js.map +0 -1
  77. package/dist/src/history/cron-utils.d.ts +0 -76
  78. package/dist/src/history/cron-utils.d.ts.map +0 -1
  79. package/dist/src/history/cron-utils.js.map +0 -1
  80. package/dist/src/history/index.d.ts +0 -20
  81. package/dist/src/history/index.d.ts.map +0 -1
  82. package/dist/src/history/index.js.map +0 -1
  83. package/dist/src/history/message-parser.d.ts +0 -52
  84. package/dist/src/history/message-parser.d.ts.map +0 -1
  85. package/dist/src/history/message-parser.js.map +0 -1
  86. package/dist/src/history/session-reader.d.ts +0 -58
  87. package/dist/src/history/session-reader.d.ts.map +0 -1
  88. package/dist/src/history/session-reader.js.map +0 -1
  89. package/dist/src/history/session-store.d.ts +0 -42
  90. package/dist/src/history/session-store.d.ts.map +0 -1
  91. package/dist/src/history/session-store.js.map +0 -1
  92. package/dist/src/history/text-processing.d.ts +0 -41
  93. package/dist/src/history/text-processing.d.ts.map +0 -1
  94. package/dist/src/history/text-processing.js.map +0 -1
  95. package/dist/src/history/types.d.ts +0 -134
  96. package/dist/src/history/types.d.ts.map +0 -1
  97. package/dist/src/history/types.js.map +0 -1
  98. package/dist/src/inbound.d.ts +0 -18
  99. package/dist/src/inbound.d.ts.map +0 -1
  100. package/dist/src/inbound.js.map +0 -1
  101. package/dist/src/media.d.ts +0 -12
  102. package/dist/src/media.d.ts.map +0 -1
  103. package/dist/src/media.js.map +0 -1
  104. package/dist/src/outbound.d.ts +0 -28
  105. package/dist/src/outbound.d.ts.map +0 -1
  106. package/dist/src/outbound.js.map +0 -1
  107. package/dist/src/runtime.d.ts +0 -4
  108. package/dist/src/runtime.d.ts.map +0 -1
  109. package/dist/src/runtime.js.map +0 -1
  110. package/dist/src/socket/handlers.d.ts +0 -26
  111. package/dist/src/socket/handlers.d.ts.map +0 -1
  112. package/dist/src/socket/handlers.js.map +0 -1
  113. package/dist/src/socket/index.d.ts +0 -11
  114. package/dist/src/socket/index.d.ts.map +0 -1
  115. package/dist/src/socket/index.js.map +0 -1
  116. package/dist/src/socket/registry.d.ts +0 -59
  117. package/dist/src/socket/registry.d.ts.map +0 -1
  118. package/dist/src/socket/registry.js.map +0 -1
  119. package/dist/src/socket/reliable-emitter.d.ts +0 -79
  120. package/dist/src/socket/reliable-emitter.d.ts.map +0 -1
  121. package/dist/src/socket/reliable-emitter.js.map +0 -1
  122. package/dist/src/types.d.ts +0 -112
  123. package/dist/src/types.d.ts.map +0 -1
  124. package/dist/src/types.js.map +0 -1
  125. package/dist/src/upload-tool.d.ts +0 -27
  126. package/dist/src/upload-tool.d.ts.map +0 -1
  127. package/dist/src/upload-tool.js.map +0 -1
  128. package/node_modules/@socket.io/component-emitter/LICENSE +0 -24
  129. package/node_modules/@socket.io/component-emitter/Readme.md +0 -79
  130. package/node_modules/@socket.io/component-emitter/lib/cjs/index.d.ts +0 -179
  131. package/node_modules/@socket.io/component-emitter/lib/cjs/index.js +0 -176
  132. package/node_modules/@socket.io/component-emitter/lib/cjs/package.json +0 -4
  133. package/node_modules/@socket.io/component-emitter/lib/esm/index.d.ts +0 -179
  134. package/node_modules/@socket.io/component-emitter/lib/esm/index.js +0 -169
  135. package/node_modules/@socket.io/component-emitter/lib/esm/package.json +0 -4
  136. package/node_modules/@socket.io/component-emitter/package.json +0 -28
  137. package/node_modules/debug/LICENSE +0 -20
  138. package/node_modules/debug/README.md +0 -481
  139. package/node_modules/debug/package.json +0 -64
  140. package/node_modules/debug/src/browser.js +0 -272
  141. package/node_modules/debug/src/common.js +0 -292
  142. package/node_modules/debug/src/index.js +0 -10
  143. package/node_modules/debug/src/node.js +0 -263
  144. package/node_modules/engine.io-client/LICENSE +0 -22
  145. package/node_modules/engine.io-client/README.md +0 -331
  146. package/node_modules/engine.io-client/build/cjs/browser-entrypoint.d.ts +0 -3
  147. package/node_modules/engine.io-client/build/cjs/browser-entrypoint.js +0 -4
  148. package/node_modules/engine.io-client/build/cjs/contrib/has-cors.d.ts +0 -1
  149. package/node_modules/engine.io-client/build/cjs/contrib/has-cors.js +0 -14
  150. package/node_modules/engine.io-client/build/cjs/contrib/parseqs.d.ts +0 -15
  151. package/node_modules/engine.io-client/build/cjs/contrib/parseqs.js +0 -38
  152. package/node_modules/engine.io-client/build/cjs/contrib/parseuri.d.ts +0 -1
  153. package/node_modules/engine.io-client/build/cjs/contrib/parseuri.js +0 -67
  154. package/node_modules/engine.io-client/build/cjs/globals.d.ts +0 -4
  155. package/node_modules/engine.io-client/build/cjs/globals.js +0 -26
  156. package/node_modules/engine.io-client/build/cjs/globals.node.d.ts +0 -21
  157. package/node_modules/engine.io-client/build/cjs/globals.node.js +0 -97
  158. package/node_modules/engine.io-client/build/cjs/index.d.ts +0 -15
  159. package/node_modules/engine.io-client/build/cjs/index.js +0 -32
  160. package/node_modules/engine.io-client/build/cjs/package.json +0 -10
  161. package/node_modules/engine.io-client/build/cjs/socket.d.ts +0 -482
  162. package/node_modules/engine.io-client/build/cjs/socket.js +0 -765
  163. package/node_modules/engine.io-client/build/cjs/transport.d.ts +0 -106
  164. package/node_modules/engine.io-client/build/cjs/transport.js +0 -153
  165. package/node_modules/engine.io-client/build/cjs/transports/index.d.ts +0 -8
  166. package/node_modules/engine.io-client/build/cjs/transports/index.js +0 -11
  167. package/node_modules/engine.io-client/build/cjs/transports/polling-fetch.d.ts +0 -15
  168. package/node_modules/engine.io-client/build/cjs/transports/polling-fetch.js +0 -60
  169. package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.d.ts +0 -108
  170. package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.js +0 -285
  171. package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.d.ts +0 -11
  172. package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.js +0 -44
  173. package/node_modules/engine.io-client/build/cjs/transports/polling.d.ts +0 -52
  174. package/node_modules/engine.io-client/build/cjs/transports/polling.js +0 -165
  175. package/node_modules/engine.io-client/build/cjs/transports/websocket.d.ts +0 -36
  176. package/node_modules/engine.io-client/build/cjs/transports/websocket.js +0 -136
  177. package/node_modules/engine.io-client/build/cjs/transports/websocket.node.d.ts +0 -14
  178. package/node_modules/engine.io-client/build/cjs/transports/websocket.node.js +0 -68
  179. package/node_modules/engine.io-client/build/cjs/transports/webtransport.d.ts +0 -18
  180. package/node_modules/engine.io-client/build/cjs/transports/webtransport.js +0 -94
  181. package/node_modules/engine.io-client/build/cjs/util.d.ts +0 -7
  182. package/node_modules/engine.io-client/build/cjs/util.js +0 -65
  183. package/node_modules/engine.io-client/build/esm/browser-entrypoint.d.ts +0 -3
  184. package/node_modules/engine.io-client/build/esm/browser-entrypoint.js +0 -2
  185. package/node_modules/engine.io-client/build/esm/contrib/has-cors.d.ts +0 -1
  186. package/node_modules/engine.io-client/build/esm/contrib/has-cors.js +0 -11
  187. package/node_modules/engine.io-client/build/esm/contrib/parseqs.d.ts +0 -15
  188. package/node_modules/engine.io-client/build/esm/contrib/parseqs.js +0 -34
  189. package/node_modules/engine.io-client/build/esm/contrib/parseuri.d.ts +0 -1
  190. package/node_modules/engine.io-client/build/esm/contrib/parseuri.js +0 -64
  191. package/node_modules/engine.io-client/build/esm/globals.d.ts +0 -4
  192. package/node_modules/engine.io-client/build/esm/globals.js +0 -22
  193. package/node_modules/engine.io-client/build/esm/globals.node.d.ts +0 -21
  194. package/node_modules/engine.io-client/build/esm/globals.node.js +0 -91
  195. package/node_modules/engine.io-client/build/esm/index.d.ts +0 -15
  196. package/node_modules/engine.io-client/build/esm/index.js +0 -15
  197. package/node_modules/engine.io-client/build/esm/package.json +0 -10
  198. package/node_modules/engine.io-client/build/esm/socket.d.ts +0 -482
  199. package/node_modules/engine.io-client/build/esm/socket.js +0 -727
  200. package/node_modules/engine.io-client/build/esm/transport.d.ts +0 -106
  201. package/node_modules/engine.io-client/build/esm/transport.js +0 -142
  202. package/node_modules/engine.io-client/build/esm/transports/index.d.ts +0 -8
  203. package/node_modules/engine.io-client/build/esm/transports/index.js +0 -8
  204. package/node_modules/engine.io-client/build/esm/transports/polling-fetch.d.ts +0 -15
  205. package/node_modules/engine.io-client/build/esm/transports/polling-fetch.js +0 -56
  206. package/node_modules/engine.io-client/build/esm/transports/polling-xhr.d.ts +0 -108
  207. package/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +0 -271
  208. package/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.d.ts +0 -11
  209. package/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +0 -17
  210. package/node_modules/engine.io-client/build/esm/transports/polling.d.ts +0 -52
  211. package/node_modules/engine.io-client/build/esm/transports/polling.js +0 -145
  212. package/node_modules/engine.io-client/build/esm/transports/websocket.d.ts +0 -36
  213. package/node_modules/engine.io-client/build/esm/transports/websocket.js +0 -125
  214. package/node_modules/engine.io-client/build/esm/transports/websocket.node.d.ts +0 -14
  215. package/node_modules/engine.io-client/build/esm/transports/websocket.node.js +0 -41
  216. package/node_modules/engine.io-client/build/esm/transports/webtransport.d.ts +0 -18
  217. package/node_modules/engine.io-client/build/esm/transports/webtransport.js +0 -80
  218. package/node_modules/engine.io-client/build/esm/util.d.ts +0 -7
  219. package/node_modules/engine.io-client/build/esm/util.js +0 -59
  220. package/node_modules/engine.io-client/build/esm-debug/browser-entrypoint.d.ts +0 -3
  221. package/node_modules/engine.io-client/build/esm-debug/browser-entrypoint.js +0 -2
  222. package/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.d.ts +0 -1
  223. package/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.js +0 -11
  224. package/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.d.ts +0 -15
  225. package/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.js +0 -34
  226. package/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.d.ts +0 -1
  227. package/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.js +0 -64
  228. package/node_modules/engine.io-client/build/esm-debug/globals.d.ts +0 -4
  229. package/node_modules/engine.io-client/build/esm-debug/globals.js +0 -22
  230. package/node_modules/engine.io-client/build/esm-debug/globals.node.d.ts +0 -21
  231. package/node_modules/engine.io-client/build/esm-debug/globals.node.js +0 -91
  232. package/node_modules/engine.io-client/build/esm-debug/index.d.ts +0 -15
  233. package/node_modules/engine.io-client/build/esm-debug/index.js +0 -15
  234. package/node_modules/engine.io-client/build/esm-debug/package.json +0 -10
  235. package/node_modules/engine.io-client/build/esm-debug/socket.d.ts +0 -482
  236. package/node_modules/engine.io-client/build/esm-debug/socket.js +0 -756
  237. package/node_modules/engine.io-client/build/esm-debug/transport.d.ts +0 -106
  238. package/node_modules/engine.io-client/build/esm-debug/transport.js +0 -145
  239. package/node_modules/engine.io-client/build/esm-debug/transports/index.d.ts +0 -8
  240. package/node_modules/engine.io-client/build/esm-debug/transports/index.js +0 -8
  241. package/node_modules/engine.io-client/build/esm-debug/transports/polling-fetch.d.ts +0 -15
  242. package/node_modules/engine.io-client/build/esm-debug/transports/polling-fetch.js +0 -56
  243. package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.d.ts +0 -108
  244. package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.js +0 -276
  245. package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.d.ts +0 -11
  246. package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.js +0 -17
  247. package/node_modules/engine.io-client/build/esm-debug/transports/polling.d.ts +0 -52
  248. package/node_modules/engine.io-client/build/esm-debug/transports/polling.js +0 -158
  249. package/node_modules/engine.io-client/build/esm-debug/transports/websocket.d.ts +0 -36
  250. package/node_modules/engine.io-client/build/esm-debug/transports/websocket.js +0 -128
  251. package/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.d.ts +0 -14
  252. package/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.js +0 -41
  253. package/node_modules/engine.io-client/build/esm-debug/transports/webtransport.d.ts +0 -18
  254. package/node_modules/engine.io-client/build/esm-debug/transports/webtransport.js +0 -87
  255. package/node_modules/engine.io-client/build/esm-debug/util.d.ts +0 -7
  256. package/node_modules/engine.io-client/build/esm-debug/util.js +0 -59
  257. package/node_modules/engine.io-client/dist/engine.io.esm.min.js +0 -7
  258. package/node_modules/engine.io-client/dist/engine.io.esm.min.js.map +0 -1
  259. package/node_modules/engine.io-client/dist/engine.io.js +0 -3064
  260. package/node_modules/engine.io-client/dist/engine.io.js.map +0 -1
  261. package/node_modules/engine.io-client/dist/engine.io.min.js +0 -7
  262. package/node_modules/engine.io-client/dist/engine.io.min.js.map +0 -1
  263. package/node_modules/engine.io-client/node_modules/ws/index.js +0 -13
  264. package/node_modules/engine.io-client/node_modules/ws/wrapper.mjs +0 -8
  265. package/node_modules/engine.io-client/package.json +0 -95
  266. package/node_modules/engine.io-parser/LICENSE +0 -22
  267. package/node_modules/engine.io-parser/Readme.md +0 -158
  268. package/node_modules/engine.io-parser/build/cjs/commons.d.ts +0 -14
  269. package/node_modules/engine.io-parser/build/cjs/commons.js +0 -19
  270. package/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.d.ts +0 -2
  271. package/node_modules/engine.io-parser/build/cjs/contrib/base64-arraybuffer.js +0 -48
  272. package/node_modules/engine.io-parser/build/cjs/decodePacket.browser.d.ts +0 -2
  273. package/node_modules/engine.io-parser/build/cjs/decodePacket.browser.js +0 -66
  274. package/node_modules/engine.io-parser/build/cjs/decodePacket.d.ts +0 -2
  275. package/node_modules/engine.io-parser/build/cjs/decodePacket.js +0 -59
  276. package/node_modules/engine.io-parser/build/cjs/encodePacket.browser.d.ts +0 -4
  277. package/node_modules/engine.io-parser/build/cjs/encodePacket.browser.js +0 -72
  278. package/node_modules/engine.io-parser/build/cjs/encodePacket.d.ts +0 -3
  279. package/node_modules/engine.io-parser/build/cjs/encodePacket.js +0 -38
  280. package/node_modules/engine.io-parser/build/cjs/index.d.ts +0 -9
  281. package/node_modules/engine.io-parser/build/cjs/index.js +0 -164
  282. package/node_modules/engine.io-parser/build/cjs/package.json +0 -8
  283. package/node_modules/engine.io-parser/build/esm/commons.d.ts +0 -14
  284. package/node_modules/engine.io-parser/build/esm/commons.js +0 -14
  285. package/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.d.ts +0 -2
  286. package/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.js +0 -43
  287. package/node_modules/engine.io-parser/build/esm/decodePacket.browser.d.ts +0 -2
  288. package/node_modules/engine.io-parser/build/esm/decodePacket.browser.js +0 -62
  289. package/node_modules/engine.io-parser/build/esm/decodePacket.d.ts +0 -2
  290. package/node_modules/engine.io-parser/build/esm/decodePacket.js +0 -55
  291. package/node_modules/engine.io-parser/build/esm/encodePacket.browser.d.ts +0 -4
  292. package/node_modules/engine.io-parser/build/esm/encodePacket.browser.js +0 -68
  293. package/node_modules/engine.io-parser/build/esm/encodePacket.d.ts +0 -3
  294. package/node_modules/engine.io-parser/build/esm/encodePacket.js +0 -33
  295. package/node_modules/engine.io-parser/build/esm/index.d.ts +0 -9
  296. package/node_modules/engine.io-parser/build/esm/index.js +0 -156
  297. package/node_modules/engine.io-parser/build/esm/package.json +0 -8
  298. package/node_modules/engine.io-parser/package.json +0 -46
  299. package/node_modules/ms/index.js +0 -162
  300. package/node_modules/ms/license.md +0 -21
  301. package/node_modules/ms/package.json +0 -38
  302. package/node_modules/ms/readme.md +0 -59
  303. package/node_modules/socket.io-client/LICENSE +0 -21
  304. package/node_modules/socket.io-client/README.md +0 -29
  305. package/node_modules/socket.io-client/build/cjs/browser-entrypoint.d.ts +0 -2
  306. package/node_modules/socket.io-client/build/cjs/browser-entrypoint.js +0 -4
  307. package/node_modules/socket.io-client/build/cjs/contrib/backo2.d.ts +0 -12
  308. package/node_modules/socket.io-client/build/cjs/contrib/backo2.js +0 -69
  309. package/node_modules/socket.io-client/build/cjs/index.d.ts +0 -29
  310. package/node_modules/socket.io-client/build/cjs/index.js +0 -76
  311. package/node_modules/socket.io-client/build/cjs/manager.d.ts +0 -295
  312. package/node_modules/socket.io-client/build/cjs/manager.js +0 -416
  313. package/node_modules/socket.io-client/build/cjs/on.d.ts +0 -2
  314. package/node_modules/socket.io-client/build/cjs/on.js +0 -9
  315. package/node_modules/socket.io-client/build/cjs/socket.d.ts +0 -593
  316. package/node_modules/socket.io-client/build/cjs/socket.js +0 -909
  317. package/node_modules/socket.io-client/build/cjs/url.d.ts +0 -33
  318. package/node_modules/socket.io-client/build/cjs/url.js +0 -69
  319. package/node_modules/socket.io-client/build/esm/browser-entrypoint.d.ts +0 -2
  320. package/node_modules/socket.io-client/build/esm/browser-entrypoint.js +0 -2
  321. package/node_modules/socket.io-client/build/esm/contrib/backo2.d.ts +0 -12
  322. package/node_modules/socket.io-client/build/esm/contrib/backo2.js +0 -66
  323. package/node_modules/socket.io-client/build/esm/index.d.ts +0 -29
  324. package/node_modules/socket.io-client/build/esm/index.js +0 -58
  325. package/node_modules/socket.io-client/build/esm/manager.d.ts +0 -295
  326. package/node_modules/socket.io-client/build/esm/manager.js +0 -367
  327. package/node_modules/socket.io-client/build/esm/on.d.ts +0 -2
  328. package/node_modules/socket.io-client/build/esm/on.js +0 -6
  329. package/node_modules/socket.io-client/build/esm/package.json +0 -5
  330. package/node_modules/socket.io-client/build/esm/socket.d.ts +0 -593
  331. package/node_modules/socket.io-client/build/esm/socket.js +0 -880
  332. package/node_modules/socket.io-client/build/esm/url.d.ts +0 -33
  333. package/node_modules/socket.io-client/build/esm/url.js +0 -59
  334. package/node_modules/socket.io-client/build/esm-debug/browser-entrypoint.d.ts +0 -2
  335. package/node_modules/socket.io-client/build/esm-debug/browser-entrypoint.js +0 -2
  336. package/node_modules/socket.io-client/build/esm-debug/contrib/backo2.d.ts +0 -12
  337. package/node_modules/socket.io-client/build/esm-debug/contrib/backo2.js +0 -66
  338. package/node_modules/socket.io-client/build/esm-debug/index.d.ts +0 -29
  339. package/node_modules/socket.io-client/build/esm-debug/index.js +0 -62
  340. package/node_modules/socket.io-client/build/esm-debug/manager.d.ts +0 -295
  341. package/node_modules/socket.io-client/build/esm-debug/manager.js +0 -386
  342. package/node_modules/socket.io-client/build/esm-debug/on.d.ts +0 -2
  343. package/node_modules/socket.io-client/build/esm-debug/on.js +0 -6
  344. package/node_modules/socket.io-client/build/esm-debug/package.json +0 -5
  345. package/node_modules/socket.io-client/build/esm-debug/socket.d.ts +0 -593
  346. package/node_modules/socket.io-client/build/esm-debug/socket.js +0 -902
  347. package/node_modules/socket.io-client/build/esm-debug/url.d.ts +0 -33
  348. package/node_modules/socket.io-client/build/esm-debug/url.js +0 -63
  349. package/node_modules/socket.io-client/dist/socket.io.esm.min.js +0 -7
  350. package/node_modules/socket.io-client/dist/socket.io.esm.min.js.map +0 -1
  351. package/node_modules/socket.io-client/dist/socket.io.js +0 -4955
  352. package/node_modules/socket.io-client/dist/socket.io.js.map +0 -1
  353. package/node_modules/socket.io-client/dist/socket.io.min.js +0 -7
  354. package/node_modules/socket.io-client/dist/socket.io.min.js.map +0 -1
  355. package/node_modules/socket.io-client/dist/socket.io.msgpack.min.js +0 -7
  356. package/node_modules/socket.io-client/dist/socket.io.msgpack.min.js.map +0 -1
  357. package/node_modules/socket.io-client/package.json +0 -101
  358. package/node_modules/socket.io-parser/LICENSE +0 -20
  359. package/node_modules/socket.io-parser/Readme.md +0 -81
  360. package/node_modules/socket.io-parser/build/cjs/binary.d.ts +0 -20
  361. package/node_modules/socket.io-parser/build/cjs/binary.js +0 -87
  362. package/node_modules/socket.io-parser/build/cjs/index.d.ts +0 -101
  363. package/node_modules/socket.io-parser/build/cjs/index.js +0 -367
  364. package/node_modules/socket.io-parser/build/cjs/is-binary.d.ts +0 -7
  365. package/node_modules/socket.io-parser/build/cjs/is-binary.js +0 -54
  366. package/node_modules/socket.io-parser/build/cjs/package.json +0 -3
  367. package/node_modules/socket.io-parser/build/esm/binary.d.ts +0 -20
  368. package/node_modules/socket.io-parser/build/esm/binary.js +0 -83
  369. package/node_modules/socket.io-parser/build/esm/index.d.ts +0 -101
  370. package/node_modules/socket.io-parser/build/esm/index.js +0 -356
  371. package/node_modules/socket.io-parser/build/esm/is-binary.d.ts +0 -7
  372. package/node_modules/socket.io-parser/build/esm/is-binary.js +0 -50
  373. package/node_modules/socket.io-parser/build/esm/package.json +0 -3
  374. package/node_modules/socket.io-parser/build/esm-debug/binary.d.ts +0 -20
  375. package/node_modules/socket.io-parser/build/esm-debug/binary.js +0 -83
  376. package/node_modules/socket.io-parser/build/esm-debug/index.d.ts +0 -101
  377. package/node_modules/socket.io-parser/build/esm-debug/index.js +0 -361
  378. package/node_modules/socket.io-parser/build/esm-debug/is-binary.d.ts +0 -7
  379. package/node_modules/socket.io-parser/build/esm-debug/is-binary.js +0 -50
  380. package/node_modules/socket.io-parser/build/esm-debug/package.json +0 -3
  381. package/node_modules/socket.io-parser/package.json +0 -44
  382. package/node_modules/xmlhttprequest-ssl/LICENSE +0 -22
  383. package/node_modules/xmlhttprequest-ssl/README.md +0 -67
  384. package/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +0 -689
  385. package/node_modules/xmlhttprequest-ssl/package.json +0 -40
  386. /package/node_modules/{engine.io-client/node_modules/ws → ws}/LICENSE +0 -0
  387. /package/node_modules/{engine.io-client/node_modules/ws → ws}/README.md +0 -0
  388. /package/node_modules/{engine.io-client/node_modules/ws → ws}/browser.js +0 -0
  389. /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/buffer-util.js +0 -0
  390. /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/event-target.js +0 -0
  391. /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/extension.js +0 -0
  392. /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/limiter.js +0 -0
  393. /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/receiver.js +0 -0
  394. /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/sender.js +0 -0
  395. /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/stream.js +0 -0
  396. /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/subprotocol.js +0 -0
  397. /package/node_modules/{engine.io-client/node_modules/ws → ws}/lib/validation.js +0 -0
@@ -1,55 +0,0 @@
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
- };
@@ -1,4 +0,0 @@
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 };
@@ -1,68 +0,0 @@
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 };
@@ -1,3 +0,0 @@
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;
@@ -1,33 +0,0 @@
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
- }
@@ -1,9 +0,0 @@
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, };
@@ -1,156 +0,0 @@
1
- import { encodePacket, encodePacketToBinary } from "./encodePacket.js";
2
- import { decodePacket } from "./decodePacket.js";
3
- import { ERROR_PACKET, } from "./commons.js";
4
- const SEPARATOR = String.fromCharCode(30); // see https://en.wikipedia.org/wiki/Delimiter#ASCII_delimited_text
5
- const encodePayload = (packets, callback) => {
6
- // some packets may be added to the array while encoding, so the initial length must be saved
7
- const length = packets.length;
8
- const encodedPackets = new Array(length);
9
- let count = 0;
10
- packets.forEach((packet, i) => {
11
- // force base64 encoding for binary packets
12
- encodePacket(packet, false, (encodedPacket) => {
13
- encodedPackets[i] = encodedPacket;
14
- if (++count === length) {
15
- callback(encodedPackets.join(SEPARATOR));
16
- }
17
- });
18
- });
19
- };
20
- const decodePayload = (encodedPayload, binaryType) => {
21
- const encodedPackets = encodedPayload.split(SEPARATOR);
22
- const packets = [];
23
- for (let i = 0; i < encodedPackets.length; i++) {
24
- const decodedPacket = decodePacket(encodedPackets[i], binaryType);
25
- packets.push(decodedPacket);
26
- if (decodedPacket.type === "error") {
27
- break;
28
- }
29
- }
30
- return packets;
31
- };
32
- export function createPacketEncoderStream() {
33
- return new TransformStream({
34
- transform(packet, controller) {
35
- encodePacketToBinary(packet, (encodedPacket) => {
36
- const payloadLength = encodedPacket.length;
37
- let header;
38
- // inspired by the WebSocket format: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#decoding_payload_length
39
- if (payloadLength < 126) {
40
- header = new Uint8Array(1);
41
- new DataView(header.buffer).setUint8(0, payloadLength);
42
- }
43
- else if (payloadLength < 65536) {
44
- header = new Uint8Array(3);
45
- const view = new DataView(header.buffer);
46
- view.setUint8(0, 126);
47
- view.setUint16(1, payloadLength);
48
- }
49
- else {
50
- header = new Uint8Array(9);
51
- const view = new DataView(header.buffer);
52
- view.setUint8(0, 127);
53
- view.setBigUint64(1, BigInt(payloadLength));
54
- }
55
- // first bit indicates whether the payload is plain text (0) or binary (1)
56
- if (packet.data && typeof packet.data !== "string") {
57
- header[0] |= 0x80;
58
- }
59
- controller.enqueue(header);
60
- controller.enqueue(encodedPacket);
61
- });
62
- },
63
- });
64
- }
65
- let TEXT_DECODER;
66
- function totalLength(chunks) {
67
- return chunks.reduce((acc, chunk) => acc + chunk.length, 0);
68
- }
69
- function concatChunks(chunks, size) {
70
- if (chunks[0].length === size) {
71
- return chunks.shift();
72
- }
73
- const buffer = new Uint8Array(size);
74
- let j = 0;
75
- for (let i = 0; i < size; i++) {
76
- buffer[i] = chunks[0][j++];
77
- if (j === chunks[0].length) {
78
- chunks.shift();
79
- j = 0;
80
- }
81
- }
82
- if (chunks.length && j < chunks[0].length) {
83
- chunks[0] = chunks[0].slice(j);
84
- }
85
- return buffer;
86
- }
87
- export function createPacketDecoderStream(maxPayload, binaryType) {
88
- if (!TEXT_DECODER) {
89
- TEXT_DECODER = new TextDecoder();
90
- }
91
- const chunks = [];
92
- let state = 0 /* State.READ_HEADER */;
93
- let expectedLength = -1;
94
- let isBinary = false;
95
- return new TransformStream({
96
- transform(chunk, controller) {
97
- chunks.push(chunk);
98
- while (true) {
99
- if (state === 0 /* State.READ_HEADER */) {
100
- if (totalLength(chunks) < 1) {
101
- break;
102
- }
103
- const header = concatChunks(chunks, 1);
104
- isBinary = (header[0] & 0x80) === 0x80;
105
- expectedLength = header[0] & 0x7f;
106
- if (expectedLength < 126) {
107
- state = 3 /* State.READ_PAYLOAD */;
108
- }
109
- else if (expectedLength === 126) {
110
- state = 1 /* State.READ_EXTENDED_LENGTH_16 */;
111
- }
112
- else {
113
- state = 2 /* State.READ_EXTENDED_LENGTH_64 */;
114
- }
115
- }
116
- else if (state === 1 /* State.READ_EXTENDED_LENGTH_16 */) {
117
- if (totalLength(chunks) < 2) {
118
- break;
119
- }
120
- const headerArray = concatChunks(chunks, 2);
121
- expectedLength = new DataView(headerArray.buffer, headerArray.byteOffset, headerArray.length).getUint16(0);
122
- state = 3 /* State.READ_PAYLOAD */;
123
- }
124
- else if (state === 2 /* State.READ_EXTENDED_LENGTH_64 */) {
125
- if (totalLength(chunks) < 8) {
126
- break;
127
- }
128
- const headerArray = concatChunks(chunks, 8);
129
- const view = new DataView(headerArray.buffer, headerArray.byteOffset, headerArray.length);
130
- const n = view.getUint32(0);
131
- if (n > Math.pow(2, 53 - 32) - 1) {
132
- // the maximum safe integer in JavaScript is 2^53 - 1
133
- controller.enqueue(ERROR_PACKET);
134
- break;
135
- }
136
- expectedLength = n * Math.pow(2, 32) + view.getUint32(4);
137
- state = 3 /* State.READ_PAYLOAD */;
138
- }
139
- else {
140
- if (totalLength(chunks) < expectedLength) {
141
- break;
142
- }
143
- const data = concatChunks(chunks, expectedLength);
144
- controller.enqueue(decodePacket(isBinary ? data : TEXT_DECODER.decode(data), binaryType));
145
- state = 0 /* State.READ_HEADER */;
146
- }
147
- if (expectedLength === 0 || expectedLength > maxPayload) {
148
- controller.enqueue(ERROR_PACKET);
149
- break;
150
- }
151
- }
152
- },
153
- });
154
- }
155
- export const protocol = 4;
156
- export { encodePacket, encodePayload, decodePacket, decodePayload, };
@@ -1,8 +0,0 @@
1
- {
2
- "name": "engine.io-parser",
3
- "type": "module",
4
- "browser": {
5
- "./encodePacket.js": "./encodePacket.browser.js",
6
- "./decodePacket.js": "./decodePacket.browser.js"
7
- }
8
- }
@@ -1,46 +0,0 @@
1
- {
2
- "name": "engine.io-parser",
3
- "description": "Parser for the client for the realtime Engine",
4
- "license": "MIT",
5
- "version": "5.2.3",
6
- "main": "./build/cjs/index.js",
7
- "module": "./build/esm/index.js",
8
- "exports": {
9
- "import": "./build/esm/index.js",
10
- "require": "./build/cjs/index.js"
11
- },
12
- "types": "build/esm/index.d.ts",
13
- "devDependencies": {
14
- "prettier": "^3.3.2"
15
- },
16
- "scripts": {
17
- "compile": "rimraf ./build && tsc && tsc -p tsconfig.esm.json && ./postcompile.sh",
18
- "test": "npm run format:check && npm run compile && if test \"$BROWSERS\" = \"1\" ; then npm run test:browser; else npm run test:node; fi",
19
- "test:node": "nyc mocha -r ts-node/register test/index.ts",
20
- "test:browser": "zuul test/index.ts --no-coverage",
21
- "format:check": "prettier --check 'lib/**/*.ts' 'test/**/*.ts'",
22
- "format:fix": "prettier --write 'lib/**/*.ts' 'test/**/*.ts'",
23
- "prepack": "npm run compile"
24
- },
25
- "homepage": "https://github.com/socketio/socket.io/tree/main/packages/engine.io-parser#readme",
26
- "repository": {
27
- "type": "git",
28
- "url": "https://github.com/socketio/socket.io.git"
29
- },
30
- "bugs": {
31
- "url": "https://github.com/socketio/socket.io/issues"
32
- },
33
- "files": [
34
- "build/"
35
- ],
36
- "browser": {
37
- "./test/node": "./test/browser",
38
- "./build/esm/encodePacket.js": "./build/esm/encodePacket.browser.js",
39
- "./build/esm/decodePacket.js": "./build/esm/decodePacket.browser.js",
40
- "./build/cjs/encodePacket.js": "./build/cjs/encodePacket.browser.js",
41
- "./build/cjs/decodePacket.js": "./build/cjs/decodePacket.browser.js"
42
- },
43
- "engines": {
44
- "node": ">=10.0.0"
45
- }
46
- }
@@ -1,162 +0,0 @@
1
- /**
2
- * Helpers.
3
- */
4
-
5
- var s = 1000;
6
- var m = s * 60;
7
- var h = m * 60;
8
- var d = h * 24;
9
- var w = d * 7;
10
- var y = d * 365.25;
11
-
12
- /**
13
- * Parse or format the given `val`.
14
- *
15
- * Options:
16
- *
17
- * - `long` verbose formatting [false]
18
- *
19
- * @param {String|Number} val
20
- * @param {Object} [options]
21
- * @throws {Error} throw an error if val is not a non-empty string or a number
22
- * @return {String|Number}
23
- * @api public
24
- */
25
-
26
- module.exports = function (val, options) {
27
- options = options || {};
28
- var type = typeof val;
29
- if (type === 'string' && val.length > 0) {
30
- return parse(val);
31
- } else if (type === 'number' && isFinite(val)) {
32
- return options.long ? fmtLong(val) : fmtShort(val);
33
- }
34
- throw new Error(
35
- 'val is not a non-empty string or a valid number. val=' +
36
- JSON.stringify(val)
37
- );
38
- };
39
-
40
- /**
41
- * Parse the given `str` and return milliseconds.
42
- *
43
- * @param {String} str
44
- * @return {Number}
45
- * @api private
46
- */
47
-
48
- function parse(str) {
49
- str = String(str);
50
- if (str.length > 100) {
51
- return;
52
- }
53
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
54
- str
55
- );
56
- if (!match) {
57
- return;
58
- }
59
- var n = parseFloat(match[1]);
60
- var type = (match[2] || 'ms').toLowerCase();
61
- switch (type) {
62
- case 'years':
63
- case 'year':
64
- case 'yrs':
65
- case 'yr':
66
- case 'y':
67
- return n * y;
68
- case 'weeks':
69
- case 'week':
70
- case 'w':
71
- return n * w;
72
- case 'days':
73
- case 'day':
74
- case 'd':
75
- return n * d;
76
- case 'hours':
77
- case 'hour':
78
- case 'hrs':
79
- case 'hr':
80
- case 'h':
81
- return n * h;
82
- case 'minutes':
83
- case 'minute':
84
- case 'mins':
85
- case 'min':
86
- case 'm':
87
- return n * m;
88
- case 'seconds':
89
- case 'second':
90
- case 'secs':
91
- case 'sec':
92
- case 's':
93
- return n * s;
94
- case 'milliseconds':
95
- case 'millisecond':
96
- case 'msecs':
97
- case 'msec':
98
- case 'ms':
99
- return n;
100
- default:
101
- return undefined;
102
- }
103
- }
104
-
105
- /**
106
- * Short format for `ms`.
107
- *
108
- * @param {Number} ms
109
- * @return {String}
110
- * @api private
111
- */
112
-
113
- function fmtShort(ms) {
114
- var msAbs = Math.abs(ms);
115
- if (msAbs >= d) {
116
- return Math.round(ms / d) + 'd';
117
- }
118
- if (msAbs >= h) {
119
- return Math.round(ms / h) + 'h';
120
- }
121
- if (msAbs >= m) {
122
- return Math.round(ms / m) + 'm';
123
- }
124
- if (msAbs >= s) {
125
- return Math.round(ms / s) + 's';
126
- }
127
- return ms + 'ms';
128
- }
129
-
130
- /**
131
- * Long format for `ms`.
132
- *
133
- * @param {Number} ms
134
- * @return {String}
135
- * @api private
136
- */
137
-
138
- function fmtLong(ms) {
139
- var msAbs = Math.abs(ms);
140
- if (msAbs >= d) {
141
- return plural(ms, msAbs, d, 'day');
142
- }
143
- if (msAbs >= h) {
144
- return plural(ms, msAbs, h, 'hour');
145
- }
146
- if (msAbs >= m) {
147
- return plural(ms, msAbs, m, 'minute');
148
- }
149
- if (msAbs >= s) {
150
- return plural(ms, msAbs, s, 'second');
151
- }
152
- return ms + ' ms';
153
- }
154
-
155
- /**
156
- * Pluralization helper.
157
- */
158
-
159
- function plural(ms, msAbs, n, name) {
160
- var isPlural = msAbs >= n * 1.5;
161
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
162
- }
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2020 Vercel, Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,38 +0,0 @@
1
- {
2
- "name": "ms",
3
- "version": "2.1.3",
4
- "description": "Tiny millisecond conversion utility",
5
- "repository": "vercel/ms",
6
- "main": "./index",
7
- "files": [
8
- "index.js"
9
- ],
10
- "scripts": {
11
- "precommit": "lint-staged",
12
- "lint": "eslint lib/* bin/*",
13
- "test": "mocha tests.js"
14
- },
15
- "eslintConfig": {
16
- "extends": "eslint:recommended",
17
- "env": {
18
- "node": true,
19
- "es6": true
20
- }
21
- },
22
- "lint-staged": {
23
- "*.js": [
24
- "npm run lint",
25
- "prettier --single-quote --write",
26
- "git add"
27
- ]
28
- },
29
- "license": "MIT",
30
- "devDependencies": {
31
- "eslint": "4.18.2",
32
- "expect.js": "0.3.1",
33
- "husky": "0.14.3",
34
- "lint-staged": "5.0.0",
35
- "mocha": "4.0.1",
36
- "prettier": "2.0.5"
37
- }
38
- }
@@ -1,59 +0,0 @@
1
- # ms
2
-
3
- ![CI](https://github.com/vercel/ms/workflows/CI/badge.svg)
4
-
5
- Use this package to easily convert various time formats to milliseconds.
6
-
7
- ## Examples
8
-
9
- ```js
10
- ms('2 days') // 172800000
11
- ms('1d') // 86400000
12
- ms('10h') // 36000000
13
- ms('2.5 hrs') // 9000000
14
- ms('2h') // 7200000
15
- ms('1m') // 60000
16
- ms('5s') // 5000
17
- ms('1y') // 31557600000
18
- ms('100') // 100
19
- ms('-3 days') // -259200000
20
- ms('-1h') // -3600000
21
- ms('-200') // -200
22
- ```
23
-
24
- ### Convert from Milliseconds
25
-
26
- ```js
27
- ms(60000) // "1m"
28
- ms(2 * 60000) // "2m"
29
- ms(-3 * 60000) // "-3m"
30
- ms(ms('10 hours')) // "10h"
31
- ```
32
-
33
- ### Time Format Written-Out
34
-
35
- ```js
36
- ms(60000, { long: true }) // "1 minute"
37
- ms(2 * 60000, { long: true }) // "2 minutes"
38
- ms(-3 * 60000, { long: true }) // "-3 minutes"
39
- ms(ms('10 hours'), { long: true }) // "10 hours"
40
- ```
41
-
42
- ## Features
43
-
44
- - Works both in [Node.js](https://nodejs.org) and in the browser
45
- - If a number is supplied to `ms`, a string with a unit is returned
46
- - If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
47
- - If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
48
-
49
- ## Related Packages
50
-
51
- - [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
52
-
53
- ## Caught a Bug?
54
-
55
- 1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
56
- 2. Link the package to the global module directory: `npm link`
57
- 3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
58
-
59
- As always, you can run the tests using: `npm test`