@yume-chan/adb 2.6.2 → 3.0.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 (451) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/esm/adb.d.ts +18 -15
  4. package/esm/adb.d.ts.map +1 -1
  5. package/esm/adb.js +18 -11
  6. package/esm/adb.js.map +1 -1
  7. package/esm/banner.d.ts +1 -1
  8. package/esm/banner.d.ts.map +1 -1
  9. package/esm/banner.js.map +1 -1
  10. package/esm/daemon/auth/authenticator.d.ts +28 -0
  11. package/esm/daemon/auth/authenticator.d.ts.map +1 -0
  12. package/esm/daemon/auth/authenticator.js +108 -0
  13. package/esm/daemon/auth/authenticator.js.map +1 -0
  14. package/esm/daemon/auth/index.d.ts +5 -0
  15. package/esm/daemon/auth/index.d.ts.map +1 -0
  16. package/esm/daemon/auth/index.js +5 -0
  17. package/esm/daemon/auth/index.js.map +1 -0
  18. package/esm/daemon/auth/packet-processor.d.ts +42 -0
  19. package/esm/daemon/auth/packet-processor.d.ts.map +1 -0
  20. package/esm/daemon/auth/packet-processor.js +129 -0
  21. package/esm/daemon/auth/packet-processor.js.map +1 -0
  22. package/esm/daemon/auth/public-key.d.ts +8 -0
  23. package/esm/daemon/auth/public-key.d.ts.map +1 -0
  24. package/esm/daemon/auth/public-key.js +74 -0
  25. package/esm/daemon/auth/public-key.js.map +1 -0
  26. package/esm/daemon/auth/type.d.ts +5 -0
  27. package/esm/daemon/auth/type.d.ts.map +1 -0
  28. package/esm/daemon/auth/type.js +2 -0
  29. package/esm/daemon/auth/type.js.map +1 -0
  30. package/esm/daemon/crypto.d.ts +6 -5
  31. package/esm/daemon/crypto.d.ts.map +1 -1
  32. package/esm/daemon/crypto.js +23 -72
  33. package/esm/daemon/crypto.js.map +1 -1
  34. package/esm/daemon/dispatcher.d.ts +3 -3
  35. package/esm/daemon/dispatcher.d.ts.map +1 -1
  36. package/esm/daemon/dispatcher.js +11 -4
  37. package/esm/daemon/dispatcher.js.map +1 -1
  38. package/esm/daemon/index.d.ts +1 -1
  39. package/esm/daemon/index.d.ts.map +1 -1
  40. package/esm/daemon/index.js +1 -1
  41. package/esm/daemon/index.js.map +1 -1
  42. package/esm/daemon/socket.d.ts +3 -3
  43. package/esm/daemon/socket.d.ts.map +1 -1
  44. package/esm/daemon/transport.d.ts +13 -65
  45. package/esm/daemon/transport.d.ts.map +1 -1
  46. package/esm/daemon/transport.js +18 -140
  47. package/esm/daemon/transport.js.map +1 -1
  48. package/esm/device-observer.d.ts +2 -3
  49. package/esm/device-observer.d.ts.map +1 -1
  50. package/esm/features-value.d.ts +40 -0
  51. package/esm/features-value.d.ts.map +1 -0
  52. package/esm/features-value.js +46 -0
  53. package/esm/features-value.js.map +1 -0
  54. package/esm/features.d.ts +4 -12
  55. package/esm/features.d.ts.map +1 -1
  56. package/esm/features.js +27 -13
  57. package/esm/features.js.map +1 -1
  58. package/esm/index.d.ts +1 -1
  59. package/esm/index.d.ts.map +1 -1
  60. package/esm/index.js +1 -1
  61. package/esm/index.js.map +1 -1
  62. package/esm/server/client.d.ts +7 -7
  63. package/esm/server/client.d.ts.map +1 -1
  64. package/esm/server/client.js +69 -86
  65. package/esm/server/client.js.map +1 -1
  66. package/esm/server/commands/wireless.js +1 -1
  67. package/esm/server/commands/wireless.js.map +1 -1
  68. package/esm/server/{stream.d.ts → data-connection.d.ts} +5 -5
  69. package/esm/server/data-connection.d.ts.map +1 -0
  70. package/esm/server/{stream.js → data-connection.js} +4 -4
  71. package/esm/server/data-connection.js.map +1 -0
  72. package/esm/server/index.d.ts +1 -1
  73. package/esm/server/index.d.ts.map +1 -1
  74. package/esm/server/index.js +1 -1
  75. package/esm/server/index.js.map +1 -1
  76. package/esm/server/observer.d.ts.map +1 -1
  77. package/esm/server/observer.js +14 -13
  78. package/esm/server/observer.js.map +1 -1
  79. package/esm/server/transport.d.ts +4 -6
  80. package/esm/server/transport.d.ts.map +1 -1
  81. package/esm/server/transport.js +9 -24
  82. package/esm/server/transport.js.map +1 -1
  83. package/esm/service/framebuffer.d.ts.map +1 -0
  84. package/esm/service/framebuffer.js.map +1 -0
  85. package/esm/{commands → service}/index.d.ts +1 -2
  86. package/esm/service/index.d.ts.map +1 -0
  87. package/esm/{commands → service}/index.js +1 -2
  88. package/esm/service/index.js.map +1 -0
  89. package/esm/{commands → service}/power.d.ts +4 -2
  90. package/esm/service/power.d.ts.map +1 -0
  91. package/esm/{commands → service}/power.js +11 -5
  92. package/esm/service/power.js.map +1 -0
  93. package/esm/service/reverse/error.d.ts +14 -0
  94. package/esm/service/reverse/error.d.ts.map +1 -0
  95. package/esm/service/reverse/error.js +21 -0
  96. package/esm/service/reverse/error.js.map +1 -0
  97. package/esm/service/reverse/index.d.ts +3 -0
  98. package/esm/service/reverse/index.d.ts.map +1 -0
  99. package/esm/service/reverse/index.js +4 -0
  100. package/esm/service/reverse/index.js.map +1 -0
  101. package/esm/service/reverse/response.d.ts +2 -0
  102. package/esm/service/reverse/response.d.ts.map +1 -0
  103. package/esm/service/reverse/response.js +30 -0
  104. package/esm/service/reverse/response.js.map +1 -0
  105. package/esm/service/reverse/service.d.ts +59 -0
  106. package/esm/service/reverse/service.d.ts.map +1 -0
  107. package/esm/{commands/reverse.js → service/reverse/service.js} +16 -45
  108. package/esm/service/reverse/service.js.map +1 -0
  109. package/esm/{commands → service}/subprocess/index.d.ts +1 -0
  110. package/esm/service/subprocess/index.d.ts.map +1 -0
  111. package/esm/{commands → service}/subprocess/index.js +1 -0
  112. package/esm/service/subprocess/index.js.map +1 -0
  113. package/esm/service/subprocess/none/index.d.ts.map +1 -0
  114. package/esm/service/subprocess/none/index.js.map +1 -0
  115. package/esm/{commands → service}/subprocess/none/process.d.ts +2 -2
  116. package/esm/service/subprocess/none/process.d.ts.map +1 -0
  117. package/esm/service/subprocess/none/process.js.map +1 -0
  118. package/esm/{commands → service}/subprocess/none/pty.d.ts +4 -4
  119. package/esm/service/subprocess/none/pty.d.ts.map +1 -0
  120. package/esm/{commands → service}/subprocess/none/pty.js +1 -1
  121. package/esm/service/subprocess/none/pty.js.map +1 -0
  122. package/esm/service/subprocess/none/service.d.ts +10 -0
  123. package/esm/service/subprocess/none/service.d.ts.map +1 -0
  124. package/esm/service/subprocess/none/service.js +44 -0
  125. package/esm/service/subprocess/none/service.js.map +1 -0
  126. package/esm/service/subprocess/none/spawner.d.ts +15 -0
  127. package/esm/service/subprocess/none/spawner.d.ts.map +1 -0
  128. package/esm/service/subprocess/none/spawner.js +31 -0
  129. package/esm/service/subprocess/none/spawner.js.map +1 -0
  130. package/esm/{commands → service}/subprocess/pty.d.ts +1 -1
  131. package/esm/service/subprocess/pty.d.ts.map +1 -0
  132. package/esm/{commands → service}/subprocess/pty.js.map +1 -1
  133. package/esm/service/subprocess/service.d.ts.map +1 -0
  134. package/esm/{commands → service}/subprocess/service.js +1 -1
  135. package/esm/service/subprocess/service.js.map +1 -0
  136. package/esm/service/subprocess/shell/index.d.ts +5 -0
  137. package/esm/{commands/subprocess/none → service/subprocess/shell}/index.d.ts.map +1 -1
  138. package/esm/service/subprocess/shell/index.js +6 -0
  139. package/esm/{commands/subprocess/none → service/subprocess/shell}/index.js.map +1 -1
  140. package/esm/{commands → service}/subprocess/shell/process.d.ts +2 -2
  141. package/esm/service/subprocess/shell/process.d.ts.map +1 -0
  142. package/esm/{commands → service}/subprocess/shell/process.js +4 -6
  143. package/esm/service/subprocess/shell/process.js.map +1 -0
  144. package/esm/{commands → service}/subprocess/shell/pty.d.ts +4 -4
  145. package/esm/service/subprocess/shell/pty.d.ts.map +1 -0
  146. package/esm/{commands → service}/subprocess/shell/pty.js +11 -9
  147. package/esm/service/subprocess/shell/pty.js.map +1 -0
  148. package/esm/service/subprocess/shell/service.d.ts +34 -0
  149. package/esm/service/subprocess/shell/service.d.ts.map +1 -0
  150. package/esm/service/subprocess/shell/service.js +52 -0
  151. package/esm/service/subprocess/shell/service.js.map +1 -0
  152. package/esm/service/subprocess/shell/shared.d.ts +2 -0
  153. package/esm/service/subprocess/shell/shared.d.ts.map +1 -0
  154. package/esm/{commands → service}/subprocess/shell/shared.js +2 -0
  155. package/esm/service/subprocess/shell/shared.js.map +1 -0
  156. package/esm/{commands → service}/subprocess/shell/spawner.d.ts +3 -7
  157. package/esm/service/subprocess/shell/spawner.d.ts.map +1 -0
  158. package/esm/service/subprocess/shell/spawner.js +45 -0
  159. package/esm/service/subprocess/shell/spawner.js.map +1 -0
  160. package/esm/service/subprocess/types.d.ts +14 -0
  161. package/esm/service/subprocess/types.d.ts.map +1 -0
  162. package/esm/service/subprocess/types.js +2 -0
  163. package/esm/service/subprocess/types.js.map +1 -0
  164. package/esm/service/subprocess/utils.d.ts +39 -0
  165. package/esm/service/subprocess/utils.d.ts.map +1 -0
  166. package/esm/service/subprocess/utils.js +142 -0
  167. package/esm/service/subprocess/utils.js.map +1 -0
  168. package/esm/service/sync/android.d.ts +34 -0
  169. package/esm/service/sync/android.d.ts.map +1 -0
  170. package/esm/service/sync/android.js +34 -0
  171. package/esm/service/sync/android.js.map +1 -0
  172. package/esm/service/sync/compression/compression.d.ts +17 -0
  173. package/esm/service/sync/compression/compression.d.ts.map +1 -0
  174. package/esm/service/sync/compression/compression.js +92 -0
  175. package/esm/service/sync/compression/compression.js.map +1 -0
  176. package/esm/service/sync/compression/format-ns.d.ts +5 -0
  177. package/esm/service/sync/compression/format-ns.d.ts.map +1 -0
  178. package/esm/service/sync/compression/format-ns.js +5 -0
  179. package/esm/service/sync/compression/format-ns.js.map +1 -0
  180. package/esm/service/sync/compression/format.d.ts +4 -0
  181. package/esm/service/sync/compression/format.d.ts.map +1 -0
  182. package/esm/service/sync/compression/format.js +3 -0
  183. package/esm/service/sync/compression/format.js.map +1 -0
  184. package/esm/service/sync/compression/index.d.ts +2 -0
  185. package/esm/service/sync/compression/index.d.ts.map +1 -0
  186. package/esm/service/sync/compression/index.js +2 -0
  187. package/esm/service/sync/compression/index.js.map +1 -0
  188. package/esm/service/sync/id/common.d.ts +17 -0
  189. package/esm/service/sync/id/common.d.ts.map +1 -0
  190. package/esm/service/sync/id/common.js +29 -0
  191. package/esm/service/sync/id/common.js.map +1 -0
  192. package/esm/service/sync/id/index.d.ts +4 -0
  193. package/esm/service/sync/id/index.d.ts.map +1 -0
  194. package/esm/service/sync/id/index.js +6 -0
  195. package/esm/service/sync/id/index.js.map +1 -0
  196. package/esm/service/sync/id/request.d.ts +7 -0
  197. package/esm/service/sync/id/request.d.ts.map +1 -0
  198. package/esm/service/sync/id/request.js +9 -0
  199. package/esm/service/sync/id/request.js.map +1 -0
  200. package/esm/service/sync/id/response.d.ts +6 -0
  201. package/esm/service/sync/id/response.d.ts.map +1 -0
  202. package/esm/service/sync/id/response.js +8 -0
  203. package/esm/service/sync/id/response.js.map +1 -0
  204. package/esm/service/sync/index-ns.d.ts +7 -0
  205. package/esm/service/sync/index-ns.d.ts.map +1 -0
  206. package/esm/service/sync/index-ns.js +7 -0
  207. package/esm/service/sync/index-ns.js.map +1 -0
  208. package/esm/service/sync/index.d.ts +3 -0
  209. package/esm/service/sync/index.d.ts.map +1 -0
  210. package/esm/service/sync/index.js +3 -0
  211. package/esm/service/sync/index.js.map +1 -0
  212. package/esm/service/sync/request/index.d.ts +5 -0
  213. package/esm/service/sync/request/index.d.ts.map +1 -0
  214. package/esm/service/sync/request/index.js +5 -0
  215. package/esm/service/sync/request/index.js.map +1 -0
  216. package/esm/{commands/sync → service/sync/request}/list.d.ts +21 -19
  217. package/esm/service/sync/request/list.d.ts.map +1 -0
  218. package/esm/service/sync/request/list.js +77 -0
  219. package/esm/service/sync/request/list.js.map +1 -0
  220. package/esm/service/sync/request/pull.d.ts +12 -0
  221. package/esm/service/sync/request/pull.d.ts.map +1 -0
  222. package/esm/service/sync/request/pull.js +28 -0
  223. package/esm/service/sync/request/pull.js.map +1 -0
  224. package/esm/service/sync/request/push.d.ts +54 -0
  225. package/esm/service/sync/request/push.d.ts.map +1 -0
  226. package/esm/service/sync/request/push.js +95 -0
  227. package/esm/service/sync/request/push.js.map +1 -0
  228. package/esm/{commands/sync → service/sync/request}/stat.d.ts +40 -50
  229. package/esm/service/sync/request/stat.d.ts.map +1 -0
  230. package/esm/service/sync/request/stat.js +89 -0
  231. package/esm/service/sync/request/stat.js.map +1 -0
  232. package/esm/service/sync/service.d.ts +123 -0
  233. package/esm/service/sync/service.d.ts.map +1 -0
  234. package/esm/service/sync/service.js +170 -0
  235. package/esm/service/sync/service.js.map +1 -0
  236. package/esm/service/sync/socket-pool.d.ts +11 -0
  237. package/esm/service/sync/socket-pool.d.ts.map +1 -0
  238. package/esm/service/sync/socket-pool.js +80 -0
  239. package/esm/service/sync/socket-pool.js.map +1 -0
  240. package/esm/service/sync/socket.d.ts +40 -0
  241. package/esm/service/sync/socket.d.ts.map +1 -0
  242. package/esm/service/sync/socket.js +153 -0
  243. package/esm/service/sync/socket.js.map +1 -0
  244. package/esm/{commands → service}/tcpip.d.ts +4 -2
  245. package/esm/service/tcpip.d.ts.map +1 -0
  246. package/esm/{commands → service}/tcpip.js +10 -7
  247. package/esm/service/tcpip.js.map +1 -0
  248. package/esm/utils/array-buffer.d.ts.map +1 -1
  249. package/esm/utils/array-buffer.js +2 -3
  250. package/esm/utils/array-buffer.js.map +1 -1
  251. package/esm/utils/base64.d.ts.map +1 -1
  252. package/esm/utils/base64.js +22 -10
  253. package/esm/utils/base64.js.map +1 -1
  254. package/esm/utils/index.d.ts +1 -0
  255. package/esm/utils/index.d.ts.map +1 -1
  256. package/esm/utils/index.js +1 -0
  257. package/esm/utils/index.js.map +1 -1
  258. package/esm/utils/md5.d.ts +8 -0
  259. package/esm/utils/md5.d.ts.map +1 -0
  260. package/esm/utils/md5.js +149 -0
  261. package/esm/utils/md5.js.map +1 -0
  262. package/package.json +9 -9
  263. package/src/adb.ts +44 -35
  264. package/src/banner.ts +2 -1
  265. package/src/daemon/auth/authenticator.ts +186 -0
  266. package/src/daemon/auth/index.ts +4 -0
  267. package/src/daemon/auth/packet-processor.ts +212 -0
  268. package/src/daemon/auth/public-key.ts +112 -0
  269. package/src/daemon/auth/type.ts +5 -0
  270. package/src/daemon/crypto.ts +36 -101
  271. package/src/daemon/dispatcher.ts +15 -8
  272. package/src/daemon/index.ts +1 -1
  273. package/src/daemon/socket.ts +3 -3
  274. package/src/daemon/transport.ts +35 -253
  275. package/src/device-observer.ts +3 -3
  276. package/src/features-value.ts +47 -0
  277. package/src/features.ts +31 -14
  278. package/src/index.ts +1 -1
  279. package/src/server/client.ts +94 -93
  280. package/src/server/commands/wireless.ts +1 -1
  281. package/src/server/{stream.ts → data-connection.ts} +4 -4
  282. package/src/server/index.ts +1 -1
  283. package/src/server/observer.ts +21 -19
  284. package/src/server/transport.ts +13 -34
  285. package/src/{commands → service}/index.ts +1 -2
  286. package/src/{commands → service}/power.ts +14 -5
  287. package/src/service/reverse/error.ts +35 -0
  288. package/src/service/reverse/index.ts +3 -0
  289. package/src/service/reverse/response.ts +38 -0
  290. package/src/{commands/reverse.ts → service/reverse/service.ts} +32 -72
  291. package/src/{commands → service}/subprocess/index.ts +1 -0
  292. package/src/{commands → service}/subprocess/none/process.ts +3 -3
  293. package/src/{commands → service}/subprocess/none/pty.ts +5 -5
  294. package/src/service/subprocess/none/service.ts +57 -0
  295. package/src/service/subprocess/none/spawner.ts +81 -0
  296. package/src/{commands → service}/subprocess/pty.ts +1 -1
  297. package/src/{commands → service}/subprocess/service.ts +1 -1
  298. package/src/{commands → service}/subprocess/shell/index.ts +1 -1
  299. package/src/{commands → service}/subprocess/shell/process.ts +6 -7
  300. package/src/{commands → service}/subprocess/shell/pty.ts +15 -13
  301. package/src/service/subprocess/shell/service.ts +75 -0
  302. package/src/{commands → service}/subprocess/shell/shared.ts +5 -0
  303. package/src/service/subprocess/shell/spawner.ts +109 -0
  304. package/src/service/subprocess/types.ts +19 -0
  305. package/src/service/subprocess/utils.ts +166 -0
  306. package/src/service/sync/android.ts +43 -0
  307. package/src/service/sync/compression/compression.ts +126 -0
  308. package/src/service/sync/compression/format-ns.ts +4 -0
  309. package/src/service/sync/compression/format.ts +5 -0
  310. package/src/service/sync/compression/index.ts +1 -0
  311. package/src/service/sync/id/common.ts +33 -0
  312. package/src/service/sync/id/index.ts +7 -0
  313. package/src/service/sync/id/request.ts +12 -0
  314. package/src/service/sync/id/response.ts +11 -0
  315. package/src/service/sync/index-ns.ts +6 -0
  316. package/src/service/sync/index.ts +2 -0
  317. package/src/service/sync/request/index.ts +4 -0
  318. package/src/service/sync/request/list.ts +110 -0
  319. package/src/service/sync/request/pull.ts +49 -0
  320. package/src/service/sync/request/push.ts +184 -0
  321. package/src/service/sync/request/stat.ts +127 -0
  322. package/src/service/sync/service.ts +255 -0
  323. package/src/service/sync/socket-pool.ts +97 -0
  324. package/src/service/sync/socket.ts +201 -0
  325. package/src/{commands → service}/tcpip.ts +13 -7
  326. package/src/utils/array-buffer.ts +2 -3
  327. package/src/utils/base64.ts +24 -10
  328. package/src/utils/index.ts +1 -0
  329. package/src/utils/md5.ts +185 -0
  330. package/yume-chan-adb-3.0.0-beta.0.tgz +0 -0
  331. package/CHANGELOG.md +0 -257
  332. package/esm/commands/base.d.ts +0 -8
  333. package/esm/commands/base.d.ts.map +0 -1
  334. package/esm/commands/base.js +0 -12
  335. package/esm/commands/base.js.map +0 -1
  336. package/esm/commands/framebuffer.d.ts.map +0 -1
  337. package/esm/commands/framebuffer.js.map +0 -1
  338. package/esm/commands/index.d.ts.map +0 -1
  339. package/esm/commands/index.js.map +0 -1
  340. package/esm/commands/power.d.ts.map +0 -1
  341. package/esm/commands/power.js.map +0 -1
  342. package/esm/commands/reverse.d.ts +0 -48
  343. package/esm/commands/reverse.d.ts.map +0 -1
  344. package/esm/commands/reverse.js.map +0 -1
  345. package/esm/commands/subprocess/index.d.ts.map +0 -1
  346. package/esm/commands/subprocess/index.js.map +0 -1
  347. package/esm/commands/subprocess/none/process.d.ts.map +0 -1
  348. package/esm/commands/subprocess/none/process.js.map +0 -1
  349. package/esm/commands/subprocess/none/pty.d.ts.map +0 -1
  350. package/esm/commands/subprocess/none/pty.js.map +0 -1
  351. package/esm/commands/subprocess/none/service.d.ts +0 -10
  352. package/esm/commands/subprocess/none/service.d.ts.map +0 -1
  353. package/esm/commands/subprocess/none/service.js +0 -34
  354. package/esm/commands/subprocess/none/service.js.map +0 -1
  355. package/esm/commands/subprocess/none/spawner.d.ts +0 -19
  356. package/esm/commands/subprocess/none/spawner.d.ts.map +0 -1
  357. package/esm/commands/subprocess/none/spawner.js +0 -26
  358. package/esm/commands/subprocess/none/spawner.js.map +0 -1
  359. package/esm/commands/subprocess/pty.d.ts.map +0 -1
  360. package/esm/commands/subprocess/service.d.ts.map +0 -1
  361. package/esm/commands/subprocess/service.js.map +0 -1
  362. package/esm/commands/subprocess/shell/index.d.ts +0 -6
  363. package/esm/commands/subprocess/shell/index.d.ts.map +0 -1
  364. package/esm/commands/subprocess/shell/index.js +0 -6
  365. package/esm/commands/subprocess/shell/index.js.map +0 -1
  366. package/esm/commands/subprocess/shell/process.d.ts.map +0 -1
  367. package/esm/commands/subprocess/shell/process.js.map +0 -1
  368. package/esm/commands/subprocess/shell/pty.d.ts.map +0 -1
  369. package/esm/commands/subprocess/shell/pty.js.map +0 -1
  370. package/esm/commands/subprocess/shell/service.d.ts +0 -14
  371. package/esm/commands/subprocess/shell/service.d.ts.map +0 -1
  372. package/esm/commands/subprocess/shell/service.js +0 -41
  373. package/esm/commands/subprocess/shell/service.js.map +0 -1
  374. package/esm/commands/subprocess/shell/shared.d.ts +0 -19
  375. package/esm/commands/subprocess/shell/shared.d.ts.map +0 -1
  376. package/esm/commands/subprocess/shell/shared.js.map +0 -1
  377. package/esm/commands/subprocess/shell/spawner.d.ts.map +0 -1
  378. package/esm/commands/subprocess/shell/spawner.js +0 -38
  379. package/esm/commands/subprocess/shell/spawner.js.map +0 -1
  380. package/esm/commands/subprocess/utils.d.ts +0 -3
  381. package/esm/commands/subprocess/utils.d.ts.map +0 -1
  382. package/esm/commands/subprocess/utils.js +0 -56
  383. package/esm/commands/subprocess/utils.js.map +0 -1
  384. package/esm/commands/sync/index.d.ts +0 -9
  385. package/esm/commands/sync/index.d.ts.map +0 -1
  386. package/esm/commands/sync/index.js +0 -9
  387. package/esm/commands/sync/index.js.map +0 -1
  388. package/esm/commands/sync/list.d.ts.map +0 -1
  389. package/esm/commands/sync/list.js +0 -64
  390. package/esm/commands/sync/list.js.map +0 -1
  391. package/esm/commands/sync/pull.d.ts +0 -12
  392. package/esm/commands/sync/pull.d.ts.map +0 -1
  393. package/esm/commands/sync/pull.js +0 -33
  394. package/esm/commands/sync/pull.js.map +0 -1
  395. package/esm/commands/sync/push.d.ts +0 -61
  396. package/esm/commands/sync/push.d.ts.map +0 -1
  397. package/esm/commands/sync/push.js +0 -83
  398. package/esm/commands/sync/push.js.map +0 -1
  399. package/esm/commands/sync/request.d.ts +0 -24
  400. package/esm/commands/sync/request.d.ts.map +0 -1
  401. package/esm/commands/sync/request.js +0 -32
  402. package/esm/commands/sync/request.js.map +0 -1
  403. package/esm/commands/sync/response.d.ts +0 -28
  404. package/esm/commands/sync/response.d.ts.map +0 -1
  405. package/esm/commands/sync/response.js +0 -81
  406. package/esm/commands/sync/response.js.map +0 -1
  407. package/esm/commands/sync/socket.d.ts +0 -22
  408. package/esm/commands/sync/socket.d.ts.map +0 -1
  409. package/esm/commands/sync/socket.js +0 -78
  410. package/esm/commands/sync/socket.js.map +0 -1
  411. package/esm/commands/sync/stat.d.ts.map +0 -1
  412. package/esm/commands/sync/stat.js +0 -121
  413. package/esm/commands/sync/stat.js.map +0 -1
  414. package/esm/commands/sync/sync.d.ts +0 -82
  415. package/esm/commands/sync/sync.d.ts.map +0 -1
  416. package/esm/commands/sync/sync.js +0 -138
  417. package/esm/commands/sync/sync.js.map +0 -1
  418. package/esm/commands/tcpip.d.ts.map +0 -1
  419. package/esm/commands/tcpip.js.map +0 -1
  420. package/esm/daemon/auth.d.ts +0 -54
  421. package/esm/daemon/auth.d.ts.map +0 -1
  422. package/esm/daemon/auth.js +0 -104
  423. package/esm/daemon/auth.js.map +0 -1
  424. package/esm/server/stream.d.ts.map +0 -1
  425. package/esm/server/stream.js.map +0 -1
  426. package/src/commands/base.ts +0 -15
  427. package/src/commands/subprocess/none/service.ts +0 -45
  428. package/src/commands/subprocess/none/spawner.ts +0 -68
  429. package/src/commands/subprocess/shell/service.ts +0 -58
  430. package/src/commands/subprocess/shell/spawner.ts +0 -90
  431. package/src/commands/subprocess/utils.ts +0 -61
  432. package/src/commands/sync/index.ts +0 -8
  433. package/src/commands/sync/list.ts +0 -99
  434. package/src/commands/sync/pull.ts +0 -55
  435. package/src/commands/sync/push.ts +0 -172
  436. package/src/commands/sync/request.ts +0 -53
  437. package/src/commands/sync/response.ts +0 -105
  438. package/src/commands/sync/socket.ts +0 -109
  439. package/src/commands/sync/stat.ts +0 -177
  440. package/src/commands/sync/sync.ts +0 -175
  441. package/src/daemon/auth.ts +0 -203
  442. package/tsconfig.build.tsbuildinfo +0 -1
  443. /package/esm/{commands → service}/framebuffer.d.ts +0 -0
  444. /package/esm/{commands → service}/framebuffer.js +0 -0
  445. /package/esm/{commands → service}/subprocess/none/index.d.ts +0 -0
  446. /package/esm/{commands → service}/subprocess/none/index.js +0 -0
  447. /package/esm/{commands → service}/subprocess/none/process.js +0 -0
  448. /package/esm/{commands → service}/subprocess/pty.js +0 -0
  449. /package/esm/{commands → service}/subprocess/service.d.ts +0 -0
  450. /package/src/{commands → service}/framebuffer.ts +0 -0
  451. /package/src/{commands → service}/subprocess/none/index.ts +0 -0
@@ -1,81 +0,0 @@
1
- import { getUint32LittleEndian } from "@yume-chan/no-data-view";
2
- import { decodeUtf8, string, struct, u32 } from "@yume-chan/struct";
3
- import { unreachable } from "../../utils/no-op.js";
4
- function encodeAsciiUnchecked(value) {
5
- const result = new Uint8Array(value.length);
6
- for (let i = 0; i < value.length; i += 1) {
7
- result[i] = value.charCodeAt(i);
8
- }
9
- return result;
10
- }
11
- /**
12
- * Encode ID to numbers for faster comparison
13
- * @param value A 4-character string
14
- * @returns A 32-bit integer by encoding the string as little-endian
15
- *
16
- * #__NO_SIDE_EFFECTS__
17
- */
18
- export function adbSyncEncodeId(value) {
19
- const buffer = encodeAsciiUnchecked(value);
20
- return getUint32LittleEndian(buffer, 0);
21
- }
22
- export const AdbSyncResponseId = {
23
- Entry: adbSyncEncodeId("DENT"),
24
- Entry2: adbSyncEncodeId("DNT2"),
25
- Lstat: adbSyncEncodeId("STAT"),
26
- Stat: adbSyncEncodeId("STA2"),
27
- Lstat2: adbSyncEncodeId("LST2"),
28
- Done: adbSyncEncodeId("DONE"),
29
- Data: adbSyncEncodeId("DATA"),
30
- Ok: adbSyncEncodeId("OKAY"),
31
- Fail: adbSyncEncodeId("FAIL"),
32
- };
33
- export class AdbSyncError extends Error {
34
- }
35
- export const AdbSyncFailResponse = struct({ message: string(u32) }, {
36
- littleEndian: true,
37
- postDeserialize(value) {
38
- throw new AdbSyncError(value.message);
39
- },
40
- });
41
- export async function adbSyncReadResponse(stream, id, type) {
42
- if (typeof id === "string") {
43
- id = adbSyncEncodeId(id);
44
- }
45
- const buffer = await stream.readExactly(4);
46
- switch (getUint32LittleEndian(buffer, 0)) {
47
- case AdbSyncResponseId.Fail:
48
- await AdbSyncFailResponse.deserialize(stream);
49
- throw new Error("Unreachable");
50
- case id:
51
- return await type.deserialize(stream);
52
- default:
53
- throw new Error(`Expected '${id}', but got '${decodeUtf8(buffer)}'`);
54
- }
55
- }
56
- export async function* adbSyncReadResponses(stream, id, type) {
57
- if (typeof id === "string") {
58
- id = adbSyncEncodeId(id);
59
- }
60
- while (true) {
61
- const buffer = await stream.readExactly(4);
62
- switch (getUint32LittleEndian(buffer, 0)) {
63
- case AdbSyncResponseId.Fail:
64
- await AdbSyncFailResponse.deserialize(stream);
65
- unreachable();
66
- case AdbSyncResponseId.Done:
67
- // `DONE` responses' size are always same as the request's normal response.
68
- //
69
- // For example, `DONE` responses for `LIST` requests are 16 bytes (same as `DENT` responses),
70
- // but `DONE` responses for `STAT` requests are 12 bytes (same as `STAT` responses).
71
- await stream.readExactly(type.size);
72
- return;
73
- case id:
74
- yield await type.deserialize(stream);
75
- break;
76
- default:
77
- throw new Error(`Expected '${id}' or '${AdbSyncResponseId.Done}', but got '${decodeUtf8(buffer)}'`);
78
- }
79
- }
80
- }
81
- //# sourceMappingURL=response.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/commands/sync/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,SAAS,oBAAoB,CAAC,KAAa;IACvC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACvC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IACzC,MAAM,MAAM,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC3C,OAAO,qBAAqB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC7B,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC;IAC9B,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC;IAC9B,IAAI,EAAE,eAAe,CAAC,MA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B,CACvC,MAA0B,EAC1B,EAAmB,EACnB,IAA2B;IAE3B,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;QACzB,EAAE,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,IAAI,EAAE,CAAC;QACV,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC3C,QAAQ,qBAAqB,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;YACvC,KAAK,iBAAiB,CAAC,IAAI;gBACvB,MAAM,mBAAmB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBAC9C,WAAW,EAAE,CAAC;YAClB,KAAK,iBAAiB,CAAC,IAAI;gBACvB,2EAA2E;gBAC3E,EAAE;gBACF,6FAA6F;gBAC7F,oFAAoF;gBACpF,MAAM,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACpC,OAAO;YACX,KAAK,EAAE;gBACH,MAAM,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;gBACrC,MAAM;YACV;gBACI,MAAM,IAAI,KAAK,CACX,aAAa,EAAE,SAAS,iBAAiB,CAAC,IAAI,eAAe,UAAU,CAAC,MAAM,CAAC,GAAG,CACrF,CAAC;QACV,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -1,22 +0,0 @@
1
- import type { MaybeConsumable, WritableStreamDefaultWriter } from "@yume-chan/stream-extra";
2
- import { BufferedReadableStream } from "@yume-chan/stream-extra";
3
- import type { AsyncExactReadable } from "@yume-chan/struct";
4
- import type { AdbSocket } from "../../adb.js";
5
- import { AutoResetEvent } from "../../utils/index.js";
6
- export declare class AdbSyncSocketLocked implements AsyncExactReadable {
7
- #private;
8
- get position(): number;
9
- constructor(writer: WritableStreamDefaultWriter<MaybeConsumable<Uint8Array>>, readable: BufferedReadableStream, bufferSize: number, lock: AutoResetEvent);
10
- flush(): Promise<void>;
11
- write(data: Uint8Array): Promise<void>;
12
- readExactly(length: number): Promise<Uint8Array<ArrayBufferLike>>;
13
- release(): void;
14
- close(): Promise<void>;
15
- }
16
- export declare class AdbSyncSocket {
17
- #private;
18
- constructor(socket: AdbSocket, bufferSize: number);
19
- lock(): Promise<AdbSyncSocketLocked>;
20
- close(): Promise<void>;
21
- }
22
- //# sourceMappingURL=socket.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/socket.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,eAAe,EACf,2BAA2B,EAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEH,sBAAsB,EAEzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,qBAAa,mBAAoB,YAAW,kBAAkB;;IAO1D,IAAI,QAAQ,WAEX;gBAGG,MAAM,EAAE,2BAA2B,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,EAChE,QAAQ,EAAE,sBAAsB,EAChC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,cAAc;IAalB,KAAK;IAYL,KAAK,CAAC,IAAI,EAAE,UAAU;IAWtB,WAAW,CAAC,MAAM,EAAE,MAAM;IAOhC,OAAO,IAAI,IAAI;IAOT,KAAK;CAGd;AAED,qBAAa,aAAa;;gBAKV,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM;IAU3C,IAAI;IAKJ,KAAK;CAId"}
@@ -1,78 +0,0 @@
1
- import { BufferCombiner, BufferedReadableStream, Consumable, } from "@yume-chan/stream-extra";
2
- import { AutoResetEvent } from "../../utils/index.js";
3
- export class AdbSyncSocketLocked {
4
- #writer;
5
- #readable;
6
- #socketLock;
7
- #writeLock = new AutoResetEvent();
8
- #combiner;
9
- get position() {
10
- return this.#readable.position;
11
- }
12
- constructor(writer, readable, bufferSize, lock) {
13
- this.#writer = writer;
14
- this.#readable = readable;
15
- this.#socketLock = lock;
16
- this.#combiner = new BufferCombiner(bufferSize);
17
- }
18
- #write(buffer) {
19
- // `#combiner` will reuse the buffer, so we need to use the Consumable pattern
20
- return Consumable.WritableStream.write(this.#writer, buffer);
21
- }
22
- async flush() {
23
- try {
24
- await this.#writeLock.wait();
25
- const buffer = this.#combiner.flush();
26
- if (buffer) {
27
- await this.#write(buffer);
28
- }
29
- }
30
- finally {
31
- this.#writeLock.notifyOne();
32
- }
33
- }
34
- async write(data) {
35
- try {
36
- await this.#writeLock.wait();
37
- for (const buffer of this.#combiner.push(data)) {
38
- await this.#write(buffer);
39
- }
40
- }
41
- finally {
42
- this.#writeLock.notifyOne();
43
- }
44
- }
45
- async readExactly(length) {
46
- // The request may still be in the internal buffer.
47
- // Call `flush` to send it before starting reading
48
- await this.flush();
49
- return await this.#readable.readExactly(length);
50
- }
51
- release() {
52
- // In theory, the writer shouldn't leave anything in the buffer,
53
- // but to be safe, call `flush` to throw away any remaining data.
54
- this.#combiner.flush();
55
- this.#socketLock.notifyOne();
56
- }
57
- async close() {
58
- await this.#readable.cancel();
59
- }
60
- }
61
- export class AdbSyncSocket {
62
- #lock = new AutoResetEvent();
63
- #socket;
64
- #locked;
65
- constructor(socket, bufferSize) {
66
- this.#socket = socket;
67
- this.#locked = new AdbSyncSocketLocked(socket.writable.getWriter(), new BufferedReadableStream(socket.readable), bufferSize, this.#lock);
68
- }
69
- async lock() {
70
- await this.#lock.wait();
71
- return this.#locked;
72
- }
73
- async close() {
74
- await this.#locked.close();
75
- await this.#socket.close();
76
- }
77
- }
78
- //# sourceMappingURL=socket.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"socket.js","sourceRoot":"","sources":["../../../src/commands/sync/socket.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,cAAc,EACd,sB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AG,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAE1E,wBAAsB,YAAY,CAC9B,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,OAAO,GACZ,OAAO,CAAC,WAAW,CAAC,CAiCtB;AAED,wBAAsB,WAAW,CAC7B,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,GACb,OAAO,CAAC,mBAAmB,CAAC,CAY9B"}
@@ -1,121 +0,0 @@
1
- import { struct, u32, u64 } from "@yume-chan/struct";
2
- import { AdbSyncRequestId, adbSyncWriteRequest } from "./request.js";
3
- import { AdbSyncResponseId, adbSyncReadResponse } from "./response.js";
4
- // https://github.com/python/cpython/blob/4e581d64b8aff3e2eda99b12f080c877bb78dfca/Lib/stat.py#L36
5
- export const LinuxFileType = {
6
- Directory: 0o04,
7
- File: 0o10,
8
- Link: 0o12,
9
- };
10
- export const AdbSyncLstatResponse = struct({ mode: u32, size: u32, mtime: u32 }, {
11
- littleEndian: true,
12
- extra: {
13
- get type() {
14
- return (this.mode >> 12);
15
- },
16
- get permission() {
17
- return this.mode & 0b00001111_11111111;
18
- },
19
- },
20
- postDeserialize(value) {
21
- if (value.mode === 0 && value.size === 0 && value.mtime === 0) {
22
- throw new Error("lstat error");
23
- }
24
- return value;
25
- },
26
- });
27
- export const AdbSyncStatErrorCode = {
28
- SUCCESS: 0,
29
- EACCES: 13,
30
- EEXIST: 17,
31
- EFAULT: 14,
32
- EFBIG: 27,
33
- EINTR: 4,
34
- EINVAL: 22,
35
- EIO: 5,
36
- EISDIR: 21,
37
- ELOOP: 40,
38
- EMFILE: 24,
39
- ENAMETOOLONG: 36,
40
- ENFILE: 23,
41
- ENOENT: 2,
42
- ENOMEM: 12,
43
- ENOSPC: 28,
44
- ENOTDIR: 20,
45
- EOVERFLOW: 75,
46
- EPERM: 1,
47
- EROFS: 30,
48
- ETXTBSY: 26,
49
- };
50
- const AdbSyncStatErrorName = /* #__PURE__ */ (() => Object.fromEntries(Object.entries(AdbSyncStatErrorCode).map(([key, value]) => [
51
- value,
52
- key,
53
- ])))();
54
- export const AdbSyncStatResponse = struct({
55
- error: u32(),
56
- dev: u64,
57
- ino: u64,
58
- mode: u32,
59
- nlink: u32,
60
- uid: u32,
61
- gid: u32,
62
- size: u64,
63
- atime: u64,
64
- mtime: u64,
65
- ctime: u64,
66
- }, {
67
- littleEndian: true,
68
- extra: {
69
- get type() {
70
- return (this.mode >> 12);
71
- },
72
- get permission() {
73
- return this.mode & 0b00001111_11111111;
74
- },
75
- },
76
- postDeserialize(value) {
77
- if (value.error) {
78
- throw new Error(AdbSyncStatErrorName[value.error]);
79
- }
80
- return value;
81
- },
82
- });
83
- export async function adbSyncLstat(socket, path, v2) {
84
- const locked = await socket.lock();
85
- try {
86
- if (v2) {
87
- await adbSyncWriteRequest(locked, AdbSyncRequestId.LstatV2, path);
88
- return await adbSyncReadResponse(locked, AdbSyncResponseId.Lstat2, AdbSyncStatResponse);
89
- }
90
- else {
91
- await adbSyncWriteRequest(locked, AdbSyncRequestId.Lstat, path);
92
- const response = await adbSyncReadResponse(locked, AdbSyncResponseId.Lstat, AdbSyncLstatResponse);
93
- return {
94
- mode: response.mode,
95
- // Convert to `BigInt` to make it compatible with `AdbSyncStatResponse`
96
- size: BigInt(response.size),
97
- mtime: BigInt(response.mtime),
98
- get type() {
99
- return response.type;
100
- },
101
- get permission() {
102
- return response.permission;
103
- },
104
- };
105
- }
106
- }
107
- finally {
108
- locked.release();
109
- }
110
- }
111
- export async function adbSyncStat(socket, path) {
112
- const locked = await socket.lock();
113
- try {
114
- await adbSyncWriteRequest(locked, AdbSyncRequestId.Stat, path);
115
- return await adbSyncReadResponse(locked, AdbSyncResponseId.Stat, AdbSyncStatResponse);
116
- }
117
- finally {
118
- locked.release();
119
- }
120
- }
121
- //# sourceMappingURL=stat.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stat.js","sourceRoot":"","sources":["../../../src/commands/sync/stat.ts"],"names":[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C,CAAC;QAC/D,OAAO,MAAM,mBAAmB,CAC5B,MAAM,EACN,iBAAiB,CAAC,IAAI,EACtB,mBAAmB,CACtB,CAAC;IACN,CAAC;YAAS,CAAC;QACP,MAAM,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACL,CAAC"}
@@ -1,82 +0,0 @@
1
- import type { MaybeConsumable, ReadableStream } from "@yume-chan/stream-extra";
2
- import type { Adb, AdbSocket } from "../../adb.js";
3
- import type { AdbSyncEntry } from "./list.js";
4
- import type { AdbSyncSocketLocked } from "./socket.js";
5
- import { AdbSyncSocket } from "./socket.js";
6
- import type { AdbSyncStat, LinuxFileType } from "./stat.js";
7
- /**
8
- * A simplified `dirname` function that only handles absolute unix paths.
9
- * @param path an absolute unix path
10
- * @returns the directory name of the input path
11
- */
12
- export declare function dirname(path: string): string;
13
- export interface AdbSyncWriteOptions {
14
- filename: string;
15
- file: ReadableStream<MaybeConsumable<Uint8Array>>;
16
- type?: LinuxFileType;
17
- permission?: number;
18
- mtime?: number;
19
- dryRun?: boolean;
20
- }
21
- export declare class AdbSync {
22
- #private;
23
- protected _adb: Adb;
24
- protected _socket: AdbSyncSocket;
25
- get supportsStat(): boolean;
26
- get supportsListV2(): boolean;
27
- get fixedPushMkdir(): boolean;
28
- get supportsSendReceiveV2(): boolean;
29
- get needPushMkdirWorkaround(): boolean;
30
- constructor(adb: Adb, socket: AdbSocket);
31
- /**
32
- * Gets information of a file or folder.
33
- *
34
- * If `path` points to a symbolic link, the returned information is about the link itself (with `type` being `LinuxFileType.Link`).
35
- */
36
- lstat(path: string): Promise<AdbSyncStat>;
37
- /**
38
- * Gets the information of a file or folder.
39
- *
40
- * If `path` points to a symbolic link, it will be resolved and the returned information is about the target (with `type` being `LinuxFileType.File` or `LinuxFileType.Directory`).
41
- */
42
- stat(path: string): Promise<import("@yume-chan/struct").FieldsValue<{
43
- error: import("@yume-chan/struct").Field<import("./stat.js").AdbSyncStatErrorCode, never, never, number>;
44
- dev: import("@yume-chan/struct").NumberField<bigint>;
45
- ino: import("@yume-chan/struct").NumberField<bigint>;
46
- mode: import("@yume-chan/struct").NumberField<number>;
47
- nlink: import("@yume-chan/struct").NumberField<number>;
48
- uid: import("@yume-chan/struct").NumberField<number>;
49
- gid: import("@yume-chan/struct").NumberField<number>;
50
- size: import("@yume-chan/struct").NumberField<bigint>;
51
- atime: import("@yume-chan/struct").NumberField<bigint>;
52
- mtime: import("@yume-chan/struct").NumberField<bigint>;
53
- ctime: import("@yume-chan/struct").NumberField<bigint>;
54
- }> & {
55
- readonly type: LinuxFileType;
56
- readonly permission: number;
57
- }>;
58
- /**
59
- * Checks if `path` is a directory, or a symbolic link to a directory.
60
- *
61
- * This uses `lstat` internally, thus works on all Android versions.
62
- */
63
- isDirectory(path: string): Promise<boolean>;
64
- opendir(path: string): AsyncGenerator<AdbSyncEntry, void, void>;
65
- readdir(path: string): Promise<AdbSyncEntry[]>;
66
- /**
67
- * Reads the content of a file on device.
68
- *
69
- * @param filename The full path of the file on device to read.
70
- * @returns A `ReadableStream` that contains the file content.
71
- */
72
- read(filename: string): ReadableStream<Uint8Array>;
73
- /**
74
- * Writes a file on device. If the file name already exists, it will be overwritten.
75
- *
76
- * @param options The content and options of the file to write.
77
- */
78
- write(options: AdbSyncWriteOptions): Promise<void>;
79
- lockSocket(): Promise<AdbSyncSocketLocked>;
80
- dispose(): Promise<void>;
81
- }
82
- //# sourceMappingURL=sync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAInD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;A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CAAC,UAAU,CAAC;IAIlD;;;;OAIG;IACG,KAAK,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBxD,UAAU,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAI1C,OAAO;CAGV"}
@@ -1,138 +0,0 @@
1
- import { AdbFeature } from "../../features.js";
2
- import { escapeArg } from "../subprocess/index.js";
3
- import { adbSyncOpenDir } from "./list.js";
4
- import { adbSyncPull } from "./pull.js";
5
- import { adbSyncPush } from "./push.js";
6
- import { AdbSyncSocket } from "./socket.js";
7
- import { adbSyncLstat, adbSyncStat } from "./stat.js";
8
- /**
9
- * A simplified `dirname` function that only handles absolute unix paths.
10
- * @param path an absolute unix path
11
- * @returns the directory name of the input path
12
- */
13
- export function dirname(path) {
14
- const end = path.lastIndexOf("/");
15
- if (end === -1) {
16
- throw new Error(`Invalid path`);
17
- }
18
- if (end === 0) {
19
- return "/";
20
- }
21
- return path.substring(0, end);
22
- }
23
- export class AdbSync {
24
- _adb;
25
- _socket;
26
- #supportsStat;
27
- #supportsListV2;
28
- #fixedPushMkdir;
29
- #supportsSendReceiveV2;
30
- #needPushMkdirWorkaround;
31
- get supportsStat() {
32
- return this.#supportsStat;
33
- }
34
- get supportsListV2() {
35
- return this.#supportsListV2;
36
- }
37
- get fixedPushMkdir() {
38
- return this.#fixedPushMkdir;
39
- }
40
- get supportsSendReceiveV2() {
41
- return this.#supportsSendReceiveV2;
42
- }
43
- get needPushMkdirWorkaround() {
44
- return this.#needPushMkdirWorkaround;
45
- }
46
- constructor(adb, socket) {
47
- this._adb = adb;
48
- this._socket = new AdbSyncSocket(socket, adb.maxPayloadSize);
49
- this.#supportsStat = adb.canUseFeature(AdbFeature.StatV2);
50
- this.#supportsListV2 = adb.canUseFeature(AdbFeature.ListV2);
51
- this.#fixedPushMkdir = adb.canUseFeature(AdbFeature.FixedPushMkdir);
52
- this.#supportsSendReceiveV2 = adb.canUseFeature(AdbFeature.SendReceiveV2);
53
- // https://android.googlesource.com/platform/packages/modules/adb/+/91768a57b7138166e0a3d11f79cd55909dda7014/client/file_sync_client.cpp#1361
54
- this.#needPushMkdirWorkaround =
55
- this._adb.canUseFeature(AdbFeature.ShellV2) && !this.fixedPushMkdir;
56
- }
57
- /**
58
- * Gets information of a file or folder.
59
- *
60
- * If `path` points to a symbolic link, the returned information is about the link itself (with `type` being `LinuxFileType.Link`).
61
- */
62
- async lstat(path) {
63
- return await adbSyncLstat(this._socket, path, this.#supportsStat);
64
- }
65
- /**
66
- * Gets the information of a file or folder.
67
- *
68
- * If `path` points to a symbolic link, it will be resolved and the returned information is about the target (with `type` being `LinuxFileType.File` or `LinuxFileType.Directory`).
69
- */
70
- async stat(path) {
71
- if (!this.#supportsStat) {
72
- throw new Error("Not supported");
73
- }
74
- return await adbSyncStat(this._socket, path);
75
- }
76
- /**
77
- * Checks if `path` is a directory, or a symbolic link to a directory.
78
- *
79
- * This uses `lstat` internally, thus works on all Android versions.
80
- */
81
- async isDirectory(path) {
82
- try {
83
- await this.lstat(path + "/");
84
- return true;
85
- }
86
- catch {
87
- return false;
88
- }
89
- }
90
- opendir(path) {
91
- return adbSyncOpenDir(this._socket, path, this.supportsListV2);
92
- }
93
- async readdir(path) {
94
- const results = [];
95
- for await (const entry of this.opendir(path)) {
96
- results.push(entry);
97
- }
98
- return results;
99
- }
100
- /**
101
- * Reads the content of a file on device.
102
- *
103
- * @param filename The full path of the file on device to read.
104
- * @returns A `ReadableStream` that contains the file content.
105
- */
106
- read(filename) {
107
- return adbSyncPull(this._socket, filename);
108
- }
109
- /**
110
- * Writes a file on device. If the file name already exists, it will be overwritten.
111
- *
112
- * @param options The content and options of the file to write.
113
- */
114
- async write(options) {
115
- if (this.needPushMkdirWorkaround) {
116
- // It may fail if `filename` already exists.
117
- // Ignore the result.
118
- // TODO: sync: test push mkdir workaround (need an Android 8 device)
119
- await this._adb.subprocess.noneProtocol.spawnWait([
120
- "mkdir",
121
- "-p",
122
- escapeArg(dirname(options.filename)),
123
- ]);
124
- }
125
- await adbSyncPush({
126
- v2: this.supportsSendReceiveV2,
127
- socket: this._socket,
128
- ...options,
129
- });
130
- }
131
- lockSocket() {
132
- return this._socket.lock();
133
- }
134
- dispose() {
135
- return this._socket.close();
136
- }
137
- }
138
- //# sourceMappingURL=sync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEtD;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC;IACD,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;QACZ,OAAO,GAAG,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC;AAWD,MAAM,OAAO,OAAO;IACN,IAAI,CAAM;IACV,OAAO,CAAgB;IAExB,aAAa,CAAU;IACvB,eAAe,CAAU;IACzB,eAAe,CAAU;IACzB,sBAAsB,CAAU;IAChC,wBAAwB,CAAU;IAE3C,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,aAAa,CAAC;IA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BAAqB;YAC9B,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,GAAG,OAAO;SACb,CAAC,CAAC;IACP,CAAC;IAED,UAAU;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAED,OAAO;QACH,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;CACJ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tcpip.d.ts","sourceRoot":"","sources":["../../src/commands/tcpip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,uBAAuB;IACpC,sBAAsB,EAAE,MAAM,EAAE,CAAC;IACjC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AASD,qBAAa,eAAgB,SAAQ,cAAc;IACzC,kBAAkB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAiBtD,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAYtC,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAOnC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tcpip.js","sourceRoot":"","sources":["../../src/commands/tcpip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAsB3C,SAAS,SAAS,CAAC,KAAa;IAC5B,IAAI,CAAC,KAAK,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,OAAO,eAAgB,SAAQ,cAAc;IAC/C,KAAK,CAAC,kBAAkB;QACpB,MAAM,sBAAsB,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CACjD,0BAA0B,CAC7B,CAAC;QACF,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;QAEnE,OAAO;YACH,sBAAsB,EAClB,sBAAsB,IAAI,EAAE;gBACxB,CAAC,CAAC,sBAAsB,CAAC,KAAK,CAAC,GAAG,CAAC;gBACnC,CAAC,CAAC,EAAE;YACZ,WAAW,EAAE,SAAS,CAAC,WAAW,CAAC;YACnC,WAAW,EAAE,SAAS,CAAC,WAAW,CAAC;SACtC,CAAC;IACN,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY;QACtB,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;YACZ,MAAM,IAAI,SAAS,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QACnE,IAAI,MAAM,KAAK,gCAAgC,IAAI,IAAI,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,OAAO;QACT,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC1D,IAAI,MAAM,KAAK,0BAA0B,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"}
@@ -1,54 +0,0 @@
1
- import type { MaybePromiseLike } from "@yume-chan/async";
2
- import type { Disposable } from "@yume-chan/event";
3
- import type { AdbPacketData } from "./packet.js";
4
- export interface AdbPrivateKey {
5
- /**
6
- * The private key in PKCS #8 format.
7
- */
8
- buffer: Uint8Array;
9
- name?: string | undefined;
10
- }
11
- export type AdbKeyIterable = Iterable<AdbPrivateKey> | AsyncIterable<AdbPrivateKey>;
12
- export interface AdbCredentialStore {
13
- /**
14
- * Generates and stores a RSA private key with modulus length `2048` and public exponent `65537`.
15
- */
16
- generateKey(): MaybePromiseLike<AdbPrivateKey>;
17
- /**
18
- * Synchronously or asynchronously iterates through all stored RSA private keys.
19
- *
20
- * Each call to `iterateKeys` must return a different iterator that iterate through all stored keys.
21
- */
22
- iterateKeys(): AdbKeyIterable;
23
- }
24
- export declare const AdbAuthType: {
25
- readonly Token: 1;
26
- readonly Signature: 2;
27
- readonly PublicKey: 3;
28
- };
29
- export type AdbAuthType = (typeof AdbAuthType)[keyof typeof AdbAuthType];
30
- export interface AdbAuthenticator {
31
- /**
32
- * @param getNextRequest
33
- *
34
- * Call this function to get the next authentication request packet from device.
35
- *
36
- * After calling `getNextRequest`, authenticator can `yield` a packet as response, or `return` to indicate its incapability of handling the request.
37
- *
38
- * After `return`, the `AdbAuthenticatorHandler` will move on to next authenticator and never go back.
39
- *
40
- * Calling `getNextRequest` multiple times without `yield` or `return` will always return the same request.
41
- */
42
- (credentialStore: AdbCredentialStore, getNextRequest: () => Promise<AdbPacketData>): AsyncIterable<AdbPacketData>;
43
- }
44
- export declare const AdbSignatureAuthenticator: AdbAuthenticator;
45
- export declare const AdbPublicKeyAuthenticator: AdbAuthenticator;
46
- export declare const ADB_DEFAULT_AUTHENTICATORS: readonly AdbAuthenticator[];
47
- export declare class AdbAuthenticationProcessor implements Disposable {
48
- #private;
49
- readonly authenticators: readonly AdbAuthenticator[];
50
- constructor(authenticators: readonly AdbAuthenticator[], credentialStore: AdbCredentialStore);
51
- process(packet: AdbPacketData): Promise<AdbPacketData>;
52
- dispose(): void;
53
- }
54
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.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