@yume-chan/adb 0.0.9 → 0.0.12

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 (407) hide show
  1. package/CHANGELOG.json +55 -0
  2. package/CHANGELOG.md +35 -0
  3. package/LICENSE +21 -21
  4. package/README.md +240 -257
  5. package/esm/adb.d.ts +48 -0
  6. package/esm/adb.d.ts.map +1 -0
  7. package/esm/adb.js +141 -145
  8. package/esm/adb.js.map +1 -1
  9. package/{dts → esm}/auth.d.ts +17 -7
  10. package/esm/auth.d.ts.map +1 -0
  11. package/esm/auth.js +69 -109
  12. package/esm/auth.js.map +1 -1
  13. package/esm/backend.d.ts +9 -0
  14. package/esm/backend.d.ts.map +1 -0
  15. package/{dts → esm}/commands/base.d.ts +1 -1
  16. package/esm/commands/base.d.ts.map +1 -0
  17. package/esm/commands/base.js +1 -0
  18. package/esm/commands/base.js.map +1 -1
  19. package/{dts → esm}/commands/framebuffer.d.ts +3 -3
  20. package/esm/commands/framebuffer.d.ts.map +1 -0
  21. package/esm/commands/framebuffer.js +15 -18
  22. package/esm/commands/framebuffer.js.map +1 -1
  23. package/esm/commands/index.d.ts +9 -0
  24. package/esm/commands/index.d.ts.map +1 -0
  25. package/esm/commands/index.js +8 -8
  26. package/esm/commands/index.js.map +1 -1
  27. package/esm/commands/install.d.ts +4 -0
  28. package/esm/commands/install.d.ts.map +1 -0
  29. package/esm/commands/install.js +21 -13
  30. package/esm/commands/install.js.map +1 -1
  31. package/esm/commands/power.d.ts +23 -0
  32. package/esm/commands/power.d.ts.map +1 -0
  33. package/esm/commands/power.js +45 -0
  34. package/esm/commands/power.js.map +1 -0
  35. package/{dts → esm}/commands/reverse.d.ts +3 -3
  36. package/esm/commands/reverse.d.ts.map +1 -0
  37. package/esm/commands/reverse.js +50 -60
  38. package/esm/commands/reverse.js.map +1 -1
  39. package/esm/commands/subprocess/index.d.ts +57 -0
  40. package/esm/commands/subprocess/index.d.ts.map +1 -0
  41. package/esm/commands/subprocess/index.js +83 -0
  42. package/esm/commands/subprocess/index.js.map +1 -0
  43. package/esm/commands/subprocess/legacy.d.ts +28 -0
  44. package/esm/commands/subprocess/legacy.d.ts.map +1 -0
  45. package/esm/commands/subprocess/legacy.js +44 -0
  46. package/esm/commands/subprocess/legacy.js.map +1 -0
  47. package/esm/commands/subprocess/protocol.d.ts +38 -0
  48. package/esm/commands/subprocess/protocol.d.ts.map +1 -0
  49. package/esm/commands/subprocess/protocol.js +155 -0
  50. package/esm/commands/subprocess/protocol.js.map +1 -0
  51. package/esm/commands/subprocess/types.d.ts +47 -0
  52. package/esm/commands/subprocess/types.d.ts.map +1 -0
  53. package/esm/commands/{shell → subprocess}/types.js +0 -0
  54. package/{cjs/commands/shell → esm/commands/subprocess}/types.js.map +1 -1
  55. package/{dts/commands/shell → esm/commands/subprocess}/utils.d.ts +0 -0
  56. package/esm/commands/subprocess/utils.d.ts.map +1 -0
  57. package/esm/commands/{shell → subprocess}/utils.js +0 -0
  58. package/esm/commands/subprocess/utils.js.map +1 -0
  59. package/esm/commands/sync/index.d.ts +8 -0
  60. package/esm/commands/sync/index.d.ts.map +1 -0
  61. package/esm/commands/sync/index.js +7 -7
  62. package/esm/commands/sync/index.js.map +1 -1
  63. package/{dts → esm}/commands/sync/list.d.ts +4 -4
  64. package/esm/commands/sync/list.d.ts.map +1 -0
  65. package/esm/commands/sync/list.js +16 -19
  66. package/esm/commands/sync/list.js.map +1 -1
  67. package/esm/commands/sync/pull.d.ts +11 -0
  68. package/esm/commands/sync/pull.d.ts.map +1 -0
  69. package/esm/commands/sync/pull.js +17 -11
  70. package/esm/commands/sync/pull.js.map +1 -1
  71. package/esm/commands/sync/push.d.ts +8 -0
  72. package/esm/commands/sync/push.d.ts.map +1 -0
  73. package/esm/commands/sync/push.js +19 -37
  74. package/esm/commands/sync/push.js.map +1 -1
  75. package/{dts → esm}/commands/sync/request.d.ts +3 -3
  76. package/esm/commands/sync/request.d.ts.map +1 -0
  77. package/esm/commands/sync/request.js +24 -26
  78. package/esm/commands/sync/request.js.map +1 -1
  79. package/{dts → esm}/commands/sync/response.d.ts +3 -3
  80. package/esm/commands/sync/response.d.ts.map +1 -0
  81. package/esm/commands/sync/response.js +16 -19
  82. package/esm/commands/sync/response.js.map +1 -1
  83. package/{dts → esm}/commands/sync/stat.d.ts +4 -4
  84. package/esm/commands/sync/stat.d.ts.map +1 -0
  85. package/esm/commands/sync/stat.js +22 -27
  86. package/esm/commands/sync/stat.js.map +1 -1
  87. package/esm/commands/sync/sync.d.ts +83 -0
  88. package/esm/commands/sync/sync.d.ts.map +1 -0
  89. package/esm/commands/sync/sync.js +92 -89
  90. package/esm/commands/sync/sync.js.map +1 -1
  91. package/{dts → esm}/commands/tcpip.d.ts +1 -1
  92. package/{dts → esm}/commands/tcpip.d.ts.map +1 -1
  93. package/esm/commands/tcpip.js +14 -19
  94. package/esm/commands/tcpip.js.map +1 -1
  95. package/esm/crypto.d.ts +24 -0
  96. package/esm/crypto.d.ts.map +1 -0
  97. package/esm/crypto.js +33 -31
  98. package/esm/crypto.js.map +1 -1
  99. package/{dts → esm}/features.d.ts +0 -0
  100. package/{dts → esm}/features.d.ts.map +0 -0
  101. package/esm/features.js +1 -1
  102. package/esm/features.js.map +1 -1
  103. package/esm/index.d.ts +11 -0
  104. package/esm/index.d.ts.map +1 -0
  105. package/esm/index.js +10 -10
  106. package/esm/index.js.map +1 -1
  107. package/esm/packet.d.ts +28 -0
  108. package/esm/packet.d.ts.map +1 -0
  109. package/esm/packet.js +26 -53
  110. package/esm/packet.js.map +1 -1
  111. package/esm/socket/controller.d.ts +37 -0
  112. package/esm/socket/controller.d.ts.map +1 -0
  113. package/esm/socket/controller.js +52 -66
  114. package/esm/socket/controller.js.map +1 -1
  115. package/{dts → esm}/socket/dispatcher.d.ts +10 -23
  116. package/esm/socket/dispatcher.d.ts.map +1 -0
  117. package/esm/socket/dispatcher.js +148 -164
  118. package/esm/socket/dispatcher.js.map +1 -1
  119. package/esm/socket/index.d.ts +3 -0
  120. package/esm/socket/index.d.ts.map +1 -0
  121. package/esm/socket/index.js +2 -6
  122. package/esm/socket/index.js.map +1 -1
  123. package/esm/socket/socket.d.ts +34 -0
  124. package/esm/socket/socket.d.ts.map +1 -0
  125. package/esm/socket/socket.js +69 -14
  126. package/esm/socket/socket.js.map +1 -1
  127. package/esm/stream/buffered.d.ts +35 -0
  128. package/esm/stream/buffered.d.ts.map +1 -0
  129. package/esm/stream/buffered.js +123 -0
  130. package/esm/stream/buffered.js.map +1 -0
  131. package/esm/stream/detect.bak.d.ts +240 -0
  132. package/esm/stream/detect.bak.d.ts.map +1 -0
  133. package/esm/stream/detect.bak.js +60 -0
  134. package/esm/stream/detect.bak.js.map +1 -0
  135. package/esm/stream/detect.d.ts +18 -0
  136. package/esm/stream/detect.d.ts.map +1 -0
  137. package/esm/stream/detect.js +6 -0
  138. package/esm/stream/detect.js.map +1 -0
  139. package/esm/stream/detect.native.d.ts +240 -0
  140. package/esm/stream/detect.native.d.ts.map +1 -0
  141. package/esm/stream/detect.native.js +60 -0
  142. package/esm/stream/detect.native.js.map +1 -0
  143. package/esm/stream/detect.polyfill.d.ts +18 -0
  144. package/esm/stream/detect.polyfill.d.ts.map +1 -0
  145. package/esm/stream/detect.polyfill.js +6 -0
  146. package/esm/stream/detect.polyfill.js.map +1 -0
  147. package/esm/stream/index.d.ts +4 -0
  148. package/esm/stream/index.d.ts.map +1 -0
  149. package/esm/stream/index.js +3 -2
  150. package/esm/stream/index.js.map +1 -1
  151. package/esm/stream/transform.d.ts +98 -0
  152. package/esm/stream/transform.d.ts.map +1 -0
  153. package/esm/stream/transform.js +352 -0
  154. package/esm/stream/transform.js.map +1 -0
  155. package/{dts → esm}/utils/auto-reset-event.d.ts +1 -1
  156. package/esm/utils/auto-reset-event.d.ts.map +1 -0
  157. package/esm/utils/auto-reset-event.js +2 -1
  158. package/esm/utils/auto-reset-event.js.map +1 -1
  159. package/esm/utils/base64.d.ts +5 -0
  160. package/esm/utils/base64.d.ts.map +1 -0
  161. package/esm/utils/base64.js +116 -80
  162. package/esm/utils/base64.js.map +1 -1
  163. package/esm/utils/encoding.d.ts +3 -0
  164. package/esm/utils/encoding.d.ts.map +1 -0
  165. package/esm/utils/encoding.js +11 -0
  166. package/esm/utils/encoding.js.map +1 -0
  167. package/esm/utils/index.d.ts +4 -0
  168. package/esm/utils/index.d.ts.map +1 -0
  169. package/esm/utils/index.js +3 -4
  170. package/esm/utils/index.js.map +1 -1
  171. package/package.json +49 -50
  172. package/src/adb.ts +247 -242
  173. package/src/auth.ts +170 -156
  174. package/src/backend.ts +11 -24
  175. package/src/commands/base.ts +11 -11
  176. package/src/commands/framebuffer.ts +73 -73
  177. package/src/commands/index.ts +8 -8
  178. package/src/commands/install.ts +32 -21
  179. package/src/commands/power.ts +54 -0
  180. package/src/commands/reverse.ts +136 -133
  181. package/src/commands/subprocess/index.ts +124 -0
  182. package/src/commands/subprocess/legacy.ts +58 -0
  183. package/src/commands/subprocess/protocol.ts +185 -0
  184. package/src/commands/subprocess/types.ts +55 -0
  185. package/src/commands/{shell → subprocess}/utils.ts +20 -20
  186. package/src/commands/sync/index.ts +7 -7
  187. package/src/commands/sync/list.ts +40 -39
  188. package/src/commands/sync/pull.ts +43 -34
  189. package/src/commands/sync/push.ts +41 -46
  190. package/src/commands/sync/request.ts +49 -48
  191. package/src/commands/sync/response.ts +58 -57
  192. package/src/commands/sync/stat.ts +123 -121
  193. package/src/commands/sync/sync.ts +145 -113
  194. package/src/commands/tcpip.ts +21 -21
  195. package/src/crypto.ts +280 -280
  196. package/src/features.ts +5 -5
  197. package/src/index.ts +11 -10
  198. package/src/packet.ts +69 -89
  199. package/src/socket/dispatcher.ts +256 -269
  200. package/src/socket/index.ts +2 -6
  201. package/src/socket/socket.ts +129 -28
  202. package/src/stream/buffered.ts +147 -0
  203. package/src/stream/detect.native.ts +362 -0
  204. package/src/stream/detect.polyfill.ts +25 -0
  205. package/src/stream/detect.ts +25 -0
  206. package/src/stream/index.ts +3 -2
  207. package/src/stream/transform.ts +427 -0
  208. package/src/utils/auto-reset-event.ts +41 -41
  209. package/src/utils/base64.ts +306 -274
  210. package/src/utils/encoding.ts +13 -0
  211. package/src/utils/index.ts +3 -4
  212. package/tsconfig.build.json +3 -0
  213. package/tsconfig.build.tsbuildinfo +1 -0
  214. package/tsconfig.test.json +10 -0
  215. package/cjs/adb.js +0 -205
  216. package/cjs/adb.js.map +0 -1
  217. package/cjs/auth.js +0 -141
  218. package/cjs/auth.js.map +0 -1
  219. package/cjs/backend.js +0 -3
  220. package/cjs/backend.js.map +0 -1
  221. package/cjs/commands/base.js +0 -12
  222. package/cjs/commands/base.js.map +0 -1
  223. package/cjs/commands/demo-mode.js +0 -174
  224. package/cjs/commands/demo-mode.js.map +0 -1
  225. package/cjs/commands/framebuffer.js +0 -66
  226. package/cjs/commands/framebuffer.js.map +0 -1
  227. package/cjs/commands/index.js +0 -12
  228. package/cjs/commands/index.js.map +0 -1
  229. package/cjs/commands/install.js +0 -20
  230. package/cjs/commands/install.js.map +0 -1
  231. package/cjs/commands/reverse.js +0 -105
  232. package/cjs/commands/reverse.js.map +0 -1
  233. package/cjs/commands/shell/index.js +0 -56
  234. package/cjs/commands/shell/index.js.map +0 -1
  235. package/cjs/commands/shell/legacy.js +0 -37
  236. package/cjs/commands/shell/legacy.js.map +0 -1
  237. package/cjs/commands/shell/protocol.js +0 -83
  238. package/cjs/commands/shell/protocol.js.map +0 -1
  239. package/cjs/commands/shell/types.js +0 -3
  240. package/cjs/commands/shell/utils.js +0 -23
  241. package/cjs/commands/shell/utils.js.map +0 -1
  242. package/cjs/commands/sync/index.js +0 -11
  243. package/cjs/commands/sync/index.js.map +0 -1
  244. package/cjs/commands/sync/list.js +0 -36
  245. package/cjs/commands/sync/list.js.map +0 -1
  246. package/cjs/commands/sync/pull.js +0 -34
  247. package/cjs/commands/sync/pull.js.map +0 -1
  248. package/cjs/commands/sync/push.js +0 -49
  249. package/cjs/commands/sync/push.js.map +0 -1
  250. package/cjs/commands/sync/request.js +0 -48
  251. package/cjs/commands/sync/request.js.map +0 -1
  252. package/cjs/commands/sync/response.js +0 -53
  253. package/cjs/commands/sync/response.js.map +0 -1
  254. package/cjs/commands/sync/stat.js +0 -109
  255. package/cjs/commands/sync/stat.js.map +0 -1
  256. package/cjs/commands/sync/sync.js +0 -118
  257. package/cjs/commands/sync/sync.js.map +0 -1
  258. package/cjs/commands/tcpip.js +0 -28
  259. package/cjs/commands/tcpip.js.map +0 -1
  260. package/cjs/crypto.js +0 -231
  261. package/cjs/crypto.js.map +0 -1
  262. package/cjs/features.js +0 -10
  263. package/cjs/features.js.map +0 -1
  264. package/cjs/index.js +0 -14
  265. package/cjs/index.js.map +0 -1
  266. package/cjs/packet.js +0 -77
  267. package/cjs/packet.js.map +0 -1
  268. package/cjs/socket/close-event-emitter.js +0 -32
  269. package/cjs/socket/close-event-emitter.js.map +0 -1
  270. package/cjs/socket/controller.js +0 -84
  271. package/cjs/socket/controller.js.map +0 -1
  272. package/cjs/socket/data-event-emitter.js +0 -29
  273. package/cjs/socket/data-event-emitter.js.map +0 -1
  274. package/cjs/socket/dispatcher.js +0 -219
  275. package/cjs/socket/dispatcher.js.map +0 -1
  276. package/cjs/socket/index.js +0 -10
  277. package/cjs/socket/index.js.map +0 -1
  278. package/cjs/socket/logger.js +0 -3
  279. package/cjs/socket/logger.js.map +0 -1
  280. package/cjs/socket/socket.js +0 -24
  281. package/cjs/socket/socket.js.map +0 -1
  282. package/cjs/stream/buffered-stream.js +0 -78
  283. package/cjs/stream/buffered-stream.js.map +0 -1
  284. package/cjs/stream/index.js +0 -6
  285. package/cjs/stream/index.js.map +0 -1
  286. package/cjs/stream/stream.js +0 -45
  287. package/cjs/stream/stream.js.map +0 -1
  288. package/cjs/utils/auto-reset-event.js +0 -37
  289. package/cjs/utils/auto-reset-event.js.map +0 -1
  290. package/cjs/utils/base64.js +0 -210
  291. package/cjs/utils/base64.js.map +0 -1
  292. package/cjs/utils/chunk.js +0 -75
  293. package/cjs/utils/chunk.js.map +0 -1
  294. package/cjs/utils/event-queue.js +0 -108
  295. package/cjs/utils/event-queue.js.map +0 -1
  296. package/cjs/utils/index.js +0 -8
  297. package/cjs/utils/index.js.map +0 -1
  298. package/dts/adb.d.ts +0 -46
  299. package/dts/adb.d.ts.map +0 -1
  300. package/dts/auth.d.ts.map +0 -1
  301. package/dts/backend.d.ts +0 -15
  302. package/dts/backend.d.ts.map +0 -1
  303. package/dts/commands/base.d.ts.map +0 -1
  304. package/dts/commands/demo-mode.d.ts +0 -41
  305. package/dts/commands/demo-mode.d.ts.map +0 -1
  306. package/dts/commands/framebuffer.d.ts.map +0 -1
  307. package/dts/commands/index.d.ts +0 -9
  308. package/dts/commands/index.d.ts.map +0 -1
  309. package/dts/commands/install.d.ts +0 -3
  310. package/dts/commands/install.d.ts.map +0 -1
  311. package/dts/commands/reverse.d.ts.map +0 -1
  312. package/dts/commands/shell/index.d.ts +0 -20
  313. package/dts/commands/shell/index.d.ts.map +0 -1
  314. package/dts/commands/shell/legacy.d.ts +0 -27
  315. package/dts/commands/shell/legacy.d.ts.map +0 -1
  316. package/dts/commands/shell/protocol.d.ts +0 -37
  317. package/dts/commands/shell/protocol.d.ts.map +0 -1
  318. package/dts/commands/shell/types.d.ts +0 -15
  319. package/dts/commands/shell/types.d.ts.map +0 -1
  320. package/dts/commands/shell/utils.d.ts.map +0 -1
  321. package/dts/commands/sync/index.d.ts +0 -8
  322. package/dts/commands/sync/index.d.ts.map +0 -1
  323. package/dts/commands/sync/list.d.ts.map +0 -1
  324. package/dts/commands/sync/pull.d.ts +0 -11
  325. package/dts/commands/sync/pull.d.ts.map +0 -1
  326. package/dts/commands/sync/push.d.ts +0 -8
  327. package/dts/commands/sync/push.d.ts.map +0 -1
  328. package/dts/commands/sync/request.d.ts.map +0 -1
  329. package/dts/commands/sync/response.d.ts.map +0 -1
  330. package/dts/commands/sync/stat.d.ts.map +0 -1
  331. package/dts/commands/sync/sync.d.ts +0 -68
  332. package/dts/commands/sync/sync.d.ts.map +0 -1
  333. package/dts/crypto.d.ts +0 -17
  334. package/dts/crypto.d.ts.map +0 -1
  335. package/dts/index.d.ts +0 -11
  336. package/dts/index.d.ts.map +0 -1
  337. package/dts/packet.d.ts +0 -27
  338. package/dts/packet.d.ts.map +0 -1
  339. package/dts/socket/close-event-emitter.d.ts +0 -8
  340. package/dts/socket/close-event-emitter.d.ts.map +0 -1
  341. package/dts/socket/controller.d.ts +0 -43
  342. package/dts/socket/controller.d.ts.map +0 -1
  343. package/dts/socket/data-event-emitter.d.ts +0 -10
  344. package/dts/socket/data-event-emitter.d.ts.map +0 -1
  345. package/dts/socket/dispatcher.d.ts.map +0 -1
  346. package/dts/socket/index.d.ts +0 -7
  347. package/dts/socket/index.d.ts.map +0 -1
  348. package/dts/socket/logger.d.ts +0 -9
  349. package/dts/socket/logger.d.ts.map +0 -1
  350. package/dts/socket/socket.d.ts +0 -22
  351. package/dts/socket/socket.d.ts.map +0 -1
  352. package/dts/stream/buffered-stream.d.ts +0 -30
  353. package/dts/stream/buffered-stream.d.ts.map +0 -1
  354. package/dts/stream/index.d.ts +0 -3
  355. package/dts/stream/index.d.ts.map +0 -1
  356. package/dts/stream/stream.d.ts +0 -15
  357. package/dts/stream/stream.d.ts.map +0 -1
  358. package/dts/utils/auto-reset-event.d.ts.map +0 -1
  359. package/dts/utils/base64.d.ts +0 -7
  360. package/dts/utils/base64.d.ts.map +0 -1
  361. package/dts/utils/chunk.d.ts +0 -3
  362. package/dts/utils/chunk.d.ts.map +0 -1
  363. package/dts/utils/event-queue.d.ts +0 -35
  364. package/dts/utils/event-queue.d.ts.map +0 -1
  365. package/dts/utils/index.d.ts +0 -5
  366. package/dts/utils/index.d.ts.map +0 -1
  367. package/esm/commands/demo-mode.js +0 -170
  368. package/esm/commands/demo-mode.js.map +0 -1
  369. package/esm/commands/shell/index.js +0 -52
  370. package/esm/commands/shell/index.js.map +0 -1
  371. package/esm/commands/shell/legacy.js +0 -33
  372. package/esm/commands/shell/legacy.js.map +0 -1
  373. package/esm/commands/shell/protocol.js +0 -79
  374. package/esm/commands/shell/protocol.js.map +0 -1
  375. package/esm/commands/shell/types.js.map +0 -1
  376. package/esm/commands/shell/utils.js.map +0 -1
  377. package/esm/socket/close-event-emitter.js +0 -28
  378. package/esm/socket/close-event-emitter.js.map +0 -1
  379. package/esm/socket/data-event-emitter.js +0 -25
  380. package/esm/socket/data-event-emitter.js.map +0 -1
  381. package/esm/socket/logger.js +0 -2
  382. package/esm/socket/logger.js.map +0 -1
  383. package/esm/stream/buffered-stream.js +0 -73
  384. package/esm/stream/buffered-stream.js.map +0 -1
  385. package/esm/stream/stream.js +0 -41
  386. package/esm/stream/stream.js.map +0 -1
  387. package/esm/utils/chunk.js +0 -70
  388. package/esm/utils/chunk.js.map +0 -1
  389. package/esm/utils/event-queue.js +0 -104
  390. package/esm/utils/event-queue.js.map +0 -1
  391. package/src/commands/demo-mode.ts +0 -160
  392. package/src/commands/shell/index.ts +0 -68
  393. package/src/commands/shell/legacy.ts +0 -42
  394. package/src/commands/shell/protocol.ts +0 -94
  395. package/src/commands/shell/types.ts +0 -21
  396. package/src/socket/close-event-emitter.ts +0 -28
  397. package/src/socket/controller.ts +0 -105
  398. package/src/socket/data-event-emitter.ts +0 -27
  399. package/src/socket/logger.ts +0 -12
  400. package/src/stream/buffered-stream.ts +0 -100
  401. package/src/stream/stream.ts +0 -50
  402. package/src/utils/chunk.ts +0 -70
  403. package/src/utils/event-queue.ts +0 -145
  404. package/tsconfig.cjs.json +0 -11
  405. package/tsconfig.esm.json +0 -28
  406. package/tsconfig.esm.tsbuildinfo +0 -1305
  407. package/tsconfig.json +0 -18
package/CHANGELOG.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@yume-chan/adb",
3
+ "entries": [
4
+ {
5
+ "version": "0.0.12",
6
+ "tag": "@yume-chan/adb_v0.0.12",
7
+ "date": "Sun, 03 Apr 2022 11:18:47 GMT",
8
+ "comments": {}
9
+ },
10
+ {
11
+ "version": "0.0.11",
12
+ "tag": "@yume-chan/adb_v0.0.11",
13
+ "date": "Sun, 03 Apr 2022 10:54:15 GMT",
14
+ "comments": {
15
+ "none": [
16
+ {
17
+ "comment": "Add power related API"
18
+ },
19
+ {
20
+ "comment": "Update compatibility matrix"
21
+ },
22
+ {
23
+ "comment": "Update license year"
24
+ }
25
+ ],
26
+ "patch": [
27
+ {
28
+ "comment": "Update to use Web Streams API"
29
+ },
30
+ {
31
+ "comment": "Improve compatibility with Node.js 12 ESM format"
32
+ }
33
+ ]
34
+ }
35
+ },
36
+ {
37
+ "version": "0.0.10",
38
+ "tag": "@yume-chan/adb_v0.0.10",
39
+ "date": "Sun, 09 Jan 2022 15:52:20 GMT",
40
+ "comments": {
41
+ "none": [
42
+ {
43
+ "comment": "Remove `encodeUtf8()` and `decodeUtf8()` from `AdbBackend`"
44
+ }
45
+ ]
46
+ }
47
+ },
48
+ {
49
+ "version": "0.0.9",
50
+ "tag": "@yume-chan/adb_v0.0.9",
51
+ "date": "Sun, 09 Jan 2022 15:50:20 GMT",
52
+ "comments": {}
53
+ }
54
+ ]
55
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,35 @@
1
+ # Change Log - @yume-chan/adb
2
+
3
+ This log was last generated on Sun, 03 Apr 2022 11:18:47 GMT and should not be manually modified.
4
+
5
+ ## 0.0.12
6
+ Sun, 03 Apr 2022 11:18:47 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 0.0.11
11
+ Sun, 03 Apr 2022 10:54:15 GMT
12
+
13
+ ### Patches
14
+
15
+ - Update to use Web Streams API
16
+ - Improve compatibility with Node.js 12 ESM format
17
+
18
+ ### Updates
19
+
20
+ - Add power related API
21
+ - Update compatibility matrix
22
+ - Update license year
23
+
24
+ ## 0.0.10
25
+ Sun, 09 Jan 2022 15:52:20 GMT
26
+
27
+ ### Updates
28
+
29
+ - Remove `encodeUtf8()` and `decodeUtf8()` from `AdbBackend`
30
+
31
+ ## 0.0.9
32
+ Sun, 09 Jan 2022 15:50:20 GMT
33
+
34
+ _Initial release_
35
+
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 Simon Chan
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
+ MIT License
2
+
3
+ Copyright (c) 2020-2022 Simon Chan
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.
package/README.md CHANGED
@@ -1,257 +1,240 @@
1
- # @yume-chan/adb
2
-
3
- TypeScript implementation of Android Debug Bridge (ADB) protocol.
4
-
5
- - [Compatibility](#compatibility)
6
- - [Connection](#connection)
7
- - [Backend](#backend)
8
- - [`read`](#read)
9
- - [`write`](#write)
10
- - [Authenticate](#authenticate)
11
- - [Public key authentication](#public-key-authentication)
12
- - [Backend](#backend-1)
13
- - [`generateKey`](#generatekey)
14
- - [Token authentication](#token-authentication)
15
- - [Backend](#backend-2)
16
- - [`iterateKeys`](#iteratekeys)
17
- - [Stream multiplex](#stream-multiplex)
18
- - [Backend](#backend-3)
19
- - [`encodeUtf8`](#encodeutf8)
20
- - [`decodeUtf8`](#decodeutf8)
21
- - [Commands](#commands)
22
- - [shell](#shell)
23
- - [PTY mode](#pty-mode)
24
- - [ADB shell protocol](#adb-shell-protocol)
25
- - [Raw mode](#raw-mode)
26
- - [usb](#usb)
27
- - [tcpip](#tcpip)
28
- - [sync](#sync)
29
- - [LIST](#list)
30
- - [LIS2](#lis2)
31
- - [STAT](#stat)
32
- - [LST2](#lst2)
33
- - [STA2](#sta2)
34
- - [RECV](#recv)
35
- - [RCV2](#rcv2)
36
- - [SEND](#send)
37
- - [SND2](#snd2)
38
- - [Useful links](#useful-links)
39
-
40
- ## Compatibility
41
-
42
- The main limiting factor of compatibility is [@yume-chan/struct](https://www.npmjs.com/package/@yume-chan/struct).
43
-
44
- This library doesn't use any DOM or Node.js API.
45
-
46
- | | Chrome | Edge | Firefox | Internet Explorer | Safari | Node.js |
47
- | --------------- | ------ | ---- | ------- | ----------------- | -------------- | ------- |
48
- | **Basic usage** | 68 | 79 | 68 | No | 14<sup>1</sup> | 10.4 |
49
-
50
- <sup>1</sup> Requires a polyfill for [`DataView#getBigUint64`][MDN_DataView_getBigUint64] and [`DataView#setBigUint64`][MDN_DataView_setBigUint64]
51
-
52
- [MDN_DataView_getBigUint64]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView/getBigUint64
53
- [MDN_DataView_setBigUint64]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView/setBigUint64
54
-
55
- ## Connection
56
-
57
- This library doesn't tie with a specific transportation method.
58
-
59
- Instead, a `Backend` is responsible for transferring packets in its own way (USB, WebSocket, etc).
60
-
61
- ### Backend
62
-
63
- #### `read`
64
-
65
- ```ts
66
- read(length: number): ArrayBuffer | Promise<ArrayBuffer>
67
- ```
68
-
69
- Read the specified amount of data from the underlying connection.
70
-
71
- The backend should return only the data written by another endpoint in a single operation. That meas, it should never concatenate multiple write operations to fulfill the requested `length`. Here is the reason:
72
-
73
- In normal working condition the client always knows how much data it should read and the server will always send exactly such amount of data in a single operation.
74
-
75
- One exception is that for stateless connections (including USB and TCP), if one client sent a request and died without reading the response, the data will sit in an operating system's internal buffer. When the next client, reusing the connection, want to read a response to its request, it may get that buffered response instead.
76
-
77
- The native ADB implementation tries to detect such a situation by checking length and content of the response data, so do this library. So the backend should not return such a response if possible, or follow this behavior if it can't distinguish.
78
-
79
- #### `write`
80
-
81
- ```ts
82
- write(buffer: ArrayBuffer): void | Promise<void>
83
- ```
84
-
85
- Write data to the underlying connection.
86
-
87
- ## Authenticate
88
-
89
- ADB supports two authentication methods:
90
-
91
- ### Public key authentication
92
-
93
- 1. Client (this library) generates a RSA private key and save it.
94
- 2. Client generates an ADB public key (not RSA public key) based on the RSA private key.
95
- 3. Client transfers the ADB public key to server (device).
96
- 4. Server may ask its user to accept the public key, it will save the public key if accepted.
97
-
98
- #### Backend
99
-
100
- ##### `generateKey`
101
-
102
- ```ts
103
- generateKey(): ArrayBuffer | Promise<ArrayBuffer>
104
- ```
105
-
106
- Generate and store a RSA private key with modulus length 2048 and public exponent 65537.
107
-
108
- The returned `ArrayBuffer` is the private key in PKCS #8 format.
109
-
110
- ### Token authentication
111
-
112
- 1. Server transfers a 20 bytes token to client.
113
- 2. Client RSA encrypts the token with its RSA private key.
114
- 3. Client transfers the encrypted token to server.
115
- 4. Server tries to decrypt the received data with all saved public keys. If any decryption succeed, the authentication succeed.
116
-
117
- #### Backend
118
-
119
- ##### `iterateKeys`
120
-
121
- ```ts
122
- generateKey(): Iterator<ArrayBuffer> | AsyncIterator<ArrayBuffer>
123
- ```
124
-
125
- Synchronously or asynchronously iterate through all stored RSA private keys.
126
-
127
- Each call to `iterateKeys` must returns a different iterator that iterate through all stored keys.
128
-
129
- ## Stream multiplex
130
-
131
- ADB commands are all based on streams. Multiple streams can send and receive at the same time in one connection.
132
-
133
- 1. Client sends an `OPEN` packet to create a stream.
134
- 2. Server responds with `OKAY` or `FAIL`.
135
- 3. Client and server read/write on the stream.
136
- 4. Client/server sends a `CLSE` to close the stream.
137
-
138
- The `Backend` is responsible for encoding and decoding UTF-8 strings.
139
-
140
- ### Backend
141
-
142
- #### `encodeUtf8`
143
-
144
- ```ts
145
- encodeUtf8(input: string): ArrayBuffer
146
- ```
147
-
148
- Encode `input` into an `ArrayBuffer` with UTF-8 encoding.
149
-
150
- #### `decodeUtf8`
151
-
152
- ```ts
153
- decodeUtf8(buffer: ArrayBuffer): string
154
- ```
155
-
156
- Decode `buffer` into a string with UTF-8 encoding.
157
-
158
- ## Commands
159
-
160
- ### shell
161
-
162
- #### PTY mode
163
-
164
- Basic mode, supported on all devices.
165
-
166
- #### ADB shell protocol
167
-
168
- *(Not Implemented)*
169
-
170
- Supported on devices with `shell_v2` feature.
171
-
172
- Supports window size changing event.
173
-
174
- Supports returning process exit code.
175
-
176
- #### Raw mode
177
-
178
- *(Not Implemented)*
179
-
180
- Must be used with ADB shell protocol.
181
-
182
- Supports splitting stdout and stderr.
183
-
184
- ### usb
185
-
186
- Disable ADB over WiFi.
187
-
188
- ### tcpip
189
-
190
- Enable ADB over WiFi.
191
-
192
- ### sync
193
-
194
- Client and server will communicate with another protocol on the opened stream.
195
-
196
- #### LIST
197
-
198
- Request server to list the content of a folder.
199
-
200
- #### LIS2
201
-
202
- *(Not Implemented)*
203
-
204
- Version 2 of the LIST command, contains more information.
205
-
206
- Supported on devices with `ls_v2` feature.
207
-
208
- #### STAT
209
-
210
- Request server to return the information of a file.
211
-
212
- If path is a symbolic link, the returned information is about the link itself.
213
-
214
- So it's actually the [`lstat`](https://linux.die.net/man/2/lstat) system call.
215
-
216
- #### LST2
217
-
218
- Version 2 of the STAT command, contains more information.
219
-
220
- Supported on devices with `stat_v2` feature.
221
-
222
- #### STA2
223
-
224
- Basically identical to LST2, but if path is a symbolic link, the information is about the file it refers to.
225
-
226
- Supported on devices with `stat_v2` feature.
227
-
228
- #### RECV
229
-
230
- Request server to send the content of a file.
231
-
232
- #### RCV2
233
-
234
- *(Not Implemented)*
235
-
236
- Version 2 of the RECV command.
237
-
238
- Supported on devices with `sendrecv_v2` feature.
239
-
240
- #### SEND
241
-
242
- *(Not Implemented)*
243
-
244
- Send a file onto server's file system.
245
-
246
- #### SND2
247
-
248
- *(Not Implemented)*
249
-
250
- Version 2 of the SEND command.
251
-
252
- Supported on devices with `sendrecv_v2` feature.
253
-
254
- ## Useful links
255
-
256
- * [ADB protocol overview](https://android.googlesource.com/platform/packages/modules/adb/+/2fd69306184634c6d90db3ed3be5349e71dcc471/OVERVIEW.TXT)
257
- * [ADB commands](https://android.googlesource.com/platform/packages/modules/adb/+/2fd69306184634c6d90db3ed3be5349e71dcc471/SERVICES.TXT#145)
1
+ # @yume-chan/adb
2
+
3
+ TypeScript implementation of Android Debug Bridge (ADB) protocol.
4
+
5
+ **WARNING:** The public API is UNSTABLE. If you have any questions, please open an issue.
6
+
7
+ - [Compatibility](#compatibility)
8
+ - [Basic usage](#basic-usage)
9
+ - [Use without bundlers](#use-without-bundlers)
10
+ - [Connection](#connection)
11
+ - [Backend](#backend)
12
+ - [`connect`](#connect)
13
+ - [Authentication](#authentication)
14
+ - [AdbCredentialStore](#adbcredentialstore)
15
+ - [`generateKey`](#generatekey)
16
+ - [`iterateKeys`](#iteratekeys)
17
+ - [Implementations](#implementations)
18
+ - [AdbAuthenticator](#adbauthenticator)
19
+ - [`authenticate`](#authenticate)
20
+ - [Stream multiplex](#stream-multiplex)
21
+ - [Backend](#backend-1)
22
+ - [Commands](#commands)
23
+ - [childProcess](#childprocess)
24
+ - [usb](#usb)
25
+ - [tcpip](#tcpip)
26
+ - [sync](#sync)
27
+ - [LIST](#list)
28
+ - [LIS2](#lis2)
29
+ - [STAT](#stat)
30
+ - [LST2](#lst2)
31
+ - [STA2](#sta2)
32
+ - [RECV](#recv)
33
+ - [RCV2](#rcv2)
34
+ - [SEND](#send)
35
+ - [SND2](#snd2)
36
+ - [Useful links](#useful-links)
37
+
38
+ ## Compatibility
39
+
40
+ Here is a list of features, their used APIs, and their compatibilities. If an optional feature is not actually used, its requirements can be ignored.
41
+
42
+ Some features can be polyfilled to support older runtimes, but this library doesn't ship with any polyfills.
43
+
44
+ Each backend may have different requirements.
45
+
46
+ ### Basic usage
47
+
48
+ | | Chrome | Edge | Firefox | Internet Explorer | Safari | Node.js |
49
+ | ------------------------------- | ------ | ---- | ------- | ----------------- | ------ | ------------------- |
50
+ | `@yume-chan/struct`<sup>1</sup> | 67 | 79 | 68 | No | 14 | 8.3<sup>2</sup>, 11 |
51
+ | [Streams][MDN_Streams] | 67 | 79 | No | No | 14.1 | 16.5 |
52
+ | *Overall* | 67 | 79 | No | No | 14.1 | 16.5 |
53
+
54
+ <sup>1</sup> `uint64` and `string` used.
55
+
56
+ <sup>2</sup> `TextEncoder` and `TextDecoder` are only available in `util` module. Need to be assigned to `globalThis`.
57
+
58
+ ### Use without bundlers
59
+
60
+ | | Chrome | Edge | Firefox | Internet Explorer | Safari | Node.js |
61
+ | --------------- | ------ | ---- | ------- | ----------------- | ------ | ------- |
62
+ | Top-level await | 89 | 89 | 89 | No | 15 | 14.8 |
63
+
64
+ [MDN_Streams]: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
65
+
66
+ ## Connection
67
+
68
+ This library doesn't tie to a specific transportation method.
69
+
70
+ Instead, a `Backend` is responsible for transferring data in its own way (USB, WebSocket, TCP, etc).
71
+
72
+ ### Backend
73
+
74
+ #### `connect`
75
+
76
+ ```ts
77
+ connect(): ValueOrPromise<ReadableWritablePair<AdbPacketCore, AdbPacketInit>>
78
+ ```
79
+
80
+ Connect to a device and create a pair of `AdbPacket` streams.
81
+
82
+ The backend is responsible for serializing and deserializing the packets, because it's extreme slow for WebUSB backend (`@yume-chan/adb-backend-webusb`) to read packets with unknown size.
83
+
84
+ ## Authentication
85
+
86
+ For how does ADB authentication work, see https://chensi.moe/blog/2020/09/30/webadb-part2-connection/#auth.
87
+
88
+ In this library, authentication comes in two parts:
89
+
90
+ #### AdbCredentialStore
91
+
92
+ An interface to generate, store and iterate ADB private keys on each runtime. (Because Node.js and Browsers have different APIs to do this)
93
+
94
+ ##### `generateKey`
95
+
96
+ ```ts
97
+ generateKey(): ValueOrPromise<Uint8Array>
98
+ ```
99
+
100
+ Generate and store a RSA private key with modulus length `2048` and public exponent `65537`.
101
+
102
+ The returned `Uint8Array` is the private key in PKCS #8 format.
103
+
104
+ ##### `iterateKeys`
105
+
106
+ ```ts
107
+ iterateKeys(): Iterator<ArrayBuffer> | AsyncIterator<ArrayBuffer>
108
+ ```
109
+
110
+ Synchronously or asynchronously iterate through all stored RSA private keys.
111
+
112
+ Each call to `iterateKeys` must return a different iterator that iterate through all stored keys.
113
+
114
+ ##### Implementations
115
+
116
+ The `@yume-chan/adb-credential-web` package contains a `AdbWebCredentialStore` implementation using Web Crypto API for generating keys and Web Storage API for storing keys.
117
+
118
+ #### AdbAuthenticator
119
+
120
+ An `AdbAuthenticator` generates `AUTH` responses for each `AUTH` request from server.
121
+
122
+ This package contains `AdbSignatureAuthenticator` and `AdbPublicKeyAuthenticator`, the two basic modes.
123
+
124
+ #### `authenticate`
125
+
126
+ ```ts
127
+ static async authenticate(
128
+ connection: ReadableWritablePair<AdbPacketCore, AdbPacketCore>,
129
+ credentialStore: AdbCredentialStore,
130
+ authenticators = AdbDefaultAuthenticators,
131
+ ): Promise<Adb>
132
+ ```
133
+
134
+ Call this method to authenticate the connection and create an `Adb` instance.
135
+
136
+ It's possible to call `authenticate` multiple times on a single connection, every time the device receives a `CNXN` packet, it resets its internal state, and starts a new authentication process.
137
+
138
+ ## Stream multiplex
139
+
140
+ ADB commands are all based on streams. Multiple streams can send and receive at the same time in one connection.
141
+
142
+ 1. Client sends an `OPEN` packet to create a stream.
143
+ 2. Server responds with `OKAY` or `FAIL`.
144
+ 3. Client and server read/write on the stream.
145
+ 4. Client/server sends a `CLSE` to close the stream.
146
+
147
+ The `Backend` is responsible for reading and writing data from underlying source.
148
+
149
+ ### Backend
150
+
151
+ ## Commands
152
+
153
+ ### childProcess
154
+
155
+ Spawns child process on server. ADB has two shell modes:
156
+
157
+ | | Legacy mode | Shell Protocol |
158
+ | --------------------------- | --------------------------- | ---------------------------- |
159
+ | Feature flag | - | `shell_v2` |
160
+ | Implementation | `AdbNoneSubprocessProtocol` | `AdbShellSubprocessProtocol` |
161
+ | Splitting stdout and stderr | No | Yes |
162
+ | Returning exit code | No | Yes |
163
+ | Resizing window | No | Yes |
164
+
165
+ The `Adb#childProcess#shell` and `Adb#childProcess#spawn` methods accepts a list of implementations, and will use the first supported one.
166
+
167
+ For simple command invocation, usually the `AdbNoneSubprocessProtocol` is enough.
168
+
169
+ ### usb
170
+
171
+ Disable ADB over WiFi.
172
+
173
+ ### tcpip
174
+
175
+ Enable ADB over WiFi.
176
+
177
+ ### sync
178
+
179
+ Client and server will communicate with another protocol on the opened stream.
180
+
181
+ #### LIST
182
+
183
+ Request server to list the content of a folder.
184
+
185
+ #### LIS2
186
+
187
+ Version 2 of the LIST command, contains more information.
188
+
189
+ Supported on devices with `ls_v2` feature.
190
+
191
+ #### STAT
192
+
193
+ Request server to return the information of a file.
194
+
195
+ If path is a symbolic link, the returned information is about the link itself.
196
+
197
+ So it's actually the [`lstat`](https://linux.die.net/man/2/lstat) system call.
198
+
199
+ #### LST2
200
+
201
+ Version 2 of the STAT command, contains more information.
202
+
203
+ Supported on devices with `stat_v2` feature.
204
+
205
+ #### STA2
206
+
207
+ Basically identical to LST2, but if path is a symbolic link, the information is about the file it refers to.
208
+
209
+ Supported on devices with `stat_v2` feature.
210
+
211
+ #### RECV
212
+
213
+ Request server to send the content of a file.
214
+
215
+ #### RCV2
216
+
217
+ *(Not Implemented)*
218
+
219
+ Version 2 of the RECV command.
220
+
221
+ Supported on devices with `sendrecv_v2` feature.
222
+
223
+ #### SEND
224
+
225
+ *(Not Implemented)*
226
+
227
+ Send a file onto server's file system.
228
+
229
+ #### SND2
230
+
231
+ *(Not Implemented)*
232
+
233
+ Version 2 of the SEND command.
234
+
235
+ Supported on devices with `sendrecv_v2` feature.
236
+
237
+ ## Useful links
238
+
239
+ * [ADB protocol overview](https://android.googlesource.com/platform/packages/modules/adb/+/2fd69306184634c6d90db3ed3be5349e71dcc471/OVERVIEW.TXT)
240
+ * [ADB commands](https://android.googlesource.com/platform/packages/modules/adb/+/2fd69306184634c6d90db3ed3be5349e71dcc471/SERVICES.TXT#145)