@yume-chan/adb 2.6.2 → 3.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (450) 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 +11 -10
  63. package/esm/server/client.d.ts.map +1 -1
  64. package/esm/server/client.js +82 -98
  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 +36 -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 +11 -15
  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 +50 -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 +7 -7
  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 +112 -104
  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 +85 -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 +13 -17
  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 +113 -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/CHANGELOG.md +0 -257
  331. package/esm/commands/base.d.ts +0 -8
  332. package/esm/commands/base.d.ts.map +0 -1
  333. package/esm/commands/base.js +0 -12
  334. package/esm/commands/base.js.map +0 -1
  335. package/esm/commands/framebuffer.d.ts.map +0 -1
  336. package/esm/commands/framebuffer.js.map +0 -1
  337. package/esm/commands/index.d.ts.map +0 -1
  338. package/esm/commands/index.js.map +0 -1
  339. package/esm/commands/power.d.ts.map +0 -1
  340. package/esm/commands/power.js.map +0 -1
  341. package/esm/commands/reverse.d.ts +0 -48
  342. package/esm/commands/reverse.d.ts.map +0 -1
  343. package/esm/commands/reverse.js.map +0 -1
  344. package/esm/commands/subprocess/index.d.ts.map +0 -1
  345. package/esm/commands/subprocess/index.js.map +0 -1
  346. package/esm/commands/subprocess/none/process.d.ts.map +0 -1
  347. package/esm/commands/subprocess/none/process.js.map +0 -1
  348. package/esm/commands/subprocess/none/pty.d.ts.map +0 -1
  349. package/esm/commands/subprocess/none/pty.js.map +0 -1
  350. package/esm/commands/subprocess/none/service.d.ts +0 -10
  351. package/esm/commands/subprocess/none/service.d.ts.map +0 -1
  352. package/esm/commands/subprocess/none/service.js +0 -34
  353. package/esm/commands/subprocess/none/service.js.map +0 -1
  354. package/esm/commands/subprocess/none/spawner.d.ts +0 -19
  355. package/esm/commands/subprocess/none/spawner.d.ts.map +0 -1
  356. package/esm/commands/subprocess/none/spawner.js +0 -26
  357. package/esm/commands/subprocess/none/spawner.js.map +0 -1
  358. package/esm/commands/subprocess/pty.d.ts.map +0 -1
  359. package/esm/commands/subprocess/service.d.ts.map +0 -1
  360. package/esm/commands/subprocess/service.js.map +0 -1
  361. package/esm/commands/subprocess/shell/index.d.ts +0 -6
  362. package/esm/commands/subprocess/shell/index.d.ts.map +0 -1
  363. package/esm/commands/subprocess/shell/index.js +0 -6
  364. package/esm/commands/subprocess/shell/index.js.map +0 -1
  365. package/esm/commands/subprocess/shell/process.d.ts.map +0 -1
  366. package/esm/commands/subprocess/shell/process.js.map +0 -1
  367. package/esm/commands/subprocess/shell/pty.d.ts.map +0 -1
  368. package/esm/commands/subprocess/shell/pty.js.map +0 -1
  369. package/esm/commands/subprocess/shell/service.d.ts +0 -14
  370. package/esm/commands/subprocess/shell/service.d.ts.map +0 -1
  371. package/esm/commands/subprocess/shell/service.js +0 -41
  372. package/esm/commands/subprocess/shell/service.js.map +0 -1
  373. package/esm/commands/subprocess/shell/shared.d.ts +0 -19
  374. package/esm/commands/subprocess/shell/shared.d.ts.map +0 -1
  375. package/esm/commands/subprocess/shell/shared.js.map +0 -1
  376. package/esm/commands/subprocess/shell/spawner.d.ts.map +0 -1
  377. package/esm/commands/subprocess/shell/spawner.js +0 -38
  378. package/esm/commands/subprocess/shell/spawner.js.map +0 -1
  379. package/esm/commands/subprocess/utils.d.ts +0 -3
  380. package/esm/commands/subprocess/utils.d.ts.map +0 -1
  381. package/esm/commands/subprocess/utils.js +0 -56
  382. package/esm/commands/subprocess/utils.js.map +0 -1
  383. package/esm/commands/sync/index.d.ts +0 -9
  384. package/esm/commands/sync/index.d.ts.map +0 -1
  385. package/esm/commands/sync/index.js +0 -9
  386. package/esm/commands/sync/index.js.map +0 -1
  387. package/esm/commands/sync/list.d.ts.map +0 -1
  388. package/esm/commands/sync/list.js +0 -64
  389. package/esm/commands/sync/list.js.map +0 -1
  390. package/esm/commands/sync/pull.d.ts +0 -12
  391. package/esm/commands/sync/pull.d.ts.map +0 -1
  392. package/esm/commands/sync/pull.js +0 -33
  393. package/esm/commands/sync/pull.js.map +0 -1
  394. package/esm/commands/sync/push.d.ts +0 -61
  395. package/esm/commands/sync/push.d.ts.map +0 -1
  396. package/esm/commands/sync/push.js +0 -83
  397. package/esm/commands/sync/push.js.map +0 -1
  398. package/esm/commands/sync/request.d.ts +0 -24
  399. package/esm/commands/sync/request.d.ts.map +0 -1
  400. package/esm/commands/sync/request.js +0 -32
  401. package/esm/commands/sync/request.js.map +0 -1
  402. package/esm/commands/sync/response.d.ts +0 -28
  403. package/esm/commands/sync/response.d.ts.map +0 -1
  404. package/esm/commands/sync/response.js +0 -81
  405. package/esm/commands/sync/response.js.map +0 -1
  406. package/esm/commands/sync/socket.d.ts +0 -22
  407. package/esm/commands/sync/socket.d.ts.map +0 -1
  408. package/esm/commands/sync/socket.js +0 -78
  409. package/esm/commands/sync/socket.js.map +0 -1
  410. package/esm/commands/sync/stat.d.ts.map +0 -1
  411. package/esm/commands/sync/stat.js +0 -121
  412. package/esm/commands/sync/stat.js.map +0 -1
  413. package/esm/commands/sync/sync.d.ts +0 -82
  414. package/esm/commands/sync/sync.d.ts.map +0 -1
  415. package/esm/commands/sync/sync.js +0 -138
  416. package/esm/commands/sync/sync.js.map +0 -1
  417. package/esm/commands/tcpip.d.ts.map +0 -1
  418. package/esm/commands/tcpip.js.map +0 -1
  419. package/esm/daemon/auth.d.ts +0 -54
  420. package/esm/daemon/auth.d.ts.map +0 -1
  421. package/esm/daemon/auth.js +0 -104
  422. package/esm/daemon/auth.js.map +0 -1
  423. package/esm/server/stream.d.ts.map +0 -1
  424. package/esm/server/stream.js.map +0 -1
  425. package/src/commands/base.ts +0 -15
  426. package/src/commands/subprocess/none/service.ts +0 -45
  427. package/src/commands/subprocess/none/spawner.ts +0 -68
  428. package/src/commands/subprocess/shell/service.ts +0 -58
  429. package/src/commands/subprocess/shell/spawner.ts +0 -90
  430. package/src/commands/subprocess/utils.ts +0 -61
  431. package/src/commands/sync/index.ts +0 -8
  432. package/src/commands/sync/list.ts +0 -99
  433. package/src/commands/sync/pull.ts +0 -55
  434. package/src/commands/sync/push.ts +0 -172
  435. package/src/commands/sync/request.ts +0 -53
  436. package/src/commands/sync/response.ts +0 -105
  437. package/src/commands/sync/socket.ts +0 -109
  438. package/src/commands/sync/stat.ts +0 -177
  439. package/src/commands/sync/sync.ts +0 -175
  440. package/src/daemon/auth.ts +0 -203
  441. package/tsconfig.build.tsbuildinfo +0 -1
  442. /package/esm/{commands → service}/framebuffer.d.ts +0 -0
  443. /package/esm/{commands → service}/framebuffer.js +0 -0
  444. /package/esm/{commands → service}/subprocess/none/index.d.ts +0 -0
  445. /package/esm/{commands → service}/subprocess/none/index.js +0 -0
  446. /package/esm/{commands → service}/subprocess/none/process.js +0 -0
  447. /package/esm/{commands → service}/subprocess/pty.js +0 -0
  448. /package/esm/{commands → service}/subprocess/service.d.ts +0 -0
  449. /package/src/{commands → service}/framebuffer.ts +0 -0
  450. /package/src/{commands → service}/subprocess/none/index.ts +0 -0
@@ -1,18 +1,15 @@
1
1
  import type { StructValue } from "@yume-chan/struct";
2
- import type { AdbSyncSocket } from "./socket.js";
3
- import type { AdbSyncStat } from "./stat.js";
4
- import { AdbSyncStatErrorCode } from "./stat.js";
5
- export interface AdbSyncEntry extends AdbSyncStat {
6
- name: string;
7
- }
8
- export declare const AdbSyncEntryResponse: import("@yume-chan/struct").Struct<{
2
+ import { AndroidSyscallErrorCode } from "../android.js";
3
+ import type { SocketPool } from "../socket-pool.js";
4
+ import type { Stat } from "./stat.js";
5
+ export declare const EntryResponse: import("@yume-chan/struct").Struct<{
9
6
  mode: import("@yume-chan/struct").NumberField<number>;
10
7
  size: import("@yume-chan/struct").NumberField<number>;
11
8
  mtime: import("@yume-chan/struct").NumberField<number>;
12
9
  } & {
13
10
  name: import("@yume-chan/struct").Field<string, string, never, string>;
14
11
  }, {
15
- readonly type: import("./stat.js").LinuxFileType;
12
+ readonly type: import("../android.js").LinuxFileType;
16
13
  readonly permission: number;
17
14
  }, import("@yume-chan/struct").FieldsValue<{
18
15
  mode: import("@yume-chan/struct").NumberField<number>;
@@ -21,12 +18,13 @@ export declare const AdbSyncEntryResponse: import("@yume-chan/struct").Struct<{
21
18
  } & {
22
19
  name: import("@yume-chan/struct").Field<string, string, never, string>;
23
20
  }> & {
24
- readonly type: import("./stat.js").LinuxFileType;
21
+ readonly type: import("../android.js").LinuxFileType;
25
22
  readonly permission: number;
26
23
  }>;
27
- export type AdbSyncEntryResponse = StructValue<typeof AdbSyncEntryResponse>;
28
- export declare const AdbSyncEntry2Response: import("@yume-chan/struct").Struct<{
29
- error: import("@yume-chan/struct").Field<AdbSyncStatErrorCode, never, never, number>;
24
+ export type EntryResponse = StructValue<typeof EntryResponse>;
25
+ export declare function v1(pool: SocketPool, path: string): AsyncGenerator<EntryResponse, void, void>;
26
+ export declare const EntryV2Response: import("@yume-chan/struct").Struct<{
27
+ error: import("@yume-chan/struct").Field<AndroidSyscallErrorCode, never, never, number>;
30
28
  dev: import("@yume-chan/struct").NumberField<bigint>;
31
29
  ino: import("@yume-chan/struct").NumberField<bigint>;
32
30
  mode: import("@yume-chan/struct").NumberField<number>;
@@ -40,10 +38,10 @@ export declare const AdbSyncEntry2Response: import("@yume-chan/struct").Struct<{
40
38
  } & {
41
39
  name: import("@yume-chan/struct").Field<string, string, never, string>;
42
40
  }, {
43
- readonly type: import("./stat.js").LinuxFileType;
41
+ readonly type: import("../android.js").LinuxFileType;
44
42
  readonly permission: number;
45
43
  }, import("@yume-chan/struct").FieldsValue<{
46
- error: import("@yume-chan/struct").Field<AdbSyncStatErrorCode, never, never, number>;
44
+ error: import("@yume-chan/struct").Field<AndroidSyscallErrorCode, never, never, number>;
47
45
  dev: import("@yume-chan/struct").NumberField<bigint>;
48
46
  ino: import("@yume-chan/struct").NumberField<bigint>;
49
47
  mode: import("@yume-chan/struct").NumberField<number>;
@@ -57,11 +55,15 @@ export declare const AdbSyncEntry2Response: import("@yume-chan/struct").Struct<{
57
55
  } & {
58
56
  name: import("@yume-chan/struct").Field<string, string, never, string>;
59
57
  }> & {
60
- readonly type: import("./stat.js").LinuxFileType;
58
+ readonly type: import("../android.js").LinuxFileType;
61
59
  readonly permission: number;
62
60
  }>;
63
- export type AdbSyncEntry2Response = StructValue<typeof AdbSyncEntry2Response>;
64
- export declare function adbSyncOpenDirV2(socket: AdbSyncSocket, path: string): AsyncGenerator<AdbSyncEntry2Response, void, void>;
65
- export declare function adbSyncOpenDirV1(socket: AdbSyncSocket, path: string): AsyncGenerator<AdbSyncEntryResponse, void, void>;
66
- export declare function adbSyncOpenDir(socket: AdbSyncSocket, path: string, v2: boolean): AsyncGenerator<AdbSyncEntry, void, void>;
61
+ export type EntryV2Response = StructValue<typeof EntryV2Response>;
62
+ export declare function v2(pool: SocketPool, path: string): AsyncGenerator<EntryV2Response, void, void>;
63
+ export interface Entry extends Stat {
64
+ name: string;
65
+ }
66
+ export declare function opendir(pool: SocketPool, path: string, { version }: {
67
+ version: 1 | 2;
68
+ }): AsyncGenerator<Entry, void, void>;
67
69
  //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/request/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGtC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAExB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC;AAE9D,wBAAuB,EAAE,CACrB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,GACb,cAAc,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,CAkB3C;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE1B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,eAAe,CAAC,CAAC;AAElE,wBAAuB,EAAE,CACrB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,GACb,cAAc,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,CAAC,CA6B7C;AAED,MAAM,WAAW,KAAM,SAAQ,IAAI;IAC/B,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,wBAAuB,OAAO,CAC1B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAAA;CAAE,GAChC,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAqBnC"}
@@ -0,0 +1,77 @@
1
+ import { extend, string, u32 } from "@yume-chan/struct";
2
+ import { AndroidSyscallErrorCode } from "../android.js";
3
+ import { RequestId, ResponseId } from "../id/index.js";
4
+ import { Error as AdbSyncError } from "../socket.js";
5
+ import { LstatResponse, StatResponse } from "./stat.js";
6
+ export const EntryResponse = extend(LstatResponse, {
7
+ name: string(u32),
8
+ });
9
+ export async function* v1(pool, path) {
10
+ const socket = await pool.acquire();
11
+ let completed = false;
12
+ let error;
13
+ try {
14
+ await socket.writeRequest(RequestId.List, path);
15
+ yield* socket.readResponses(ResponseId.Entry, EntryResponse);
16
+ completed = true;
17
+ }
18
+ catch (e) {
19
+ error = e;
20
+ throw e;
21
+ }
22
+ finally {
23
+ await pool.release(socket, !(completed || error instanceof AdbSyncError));
24
+ }
25
+ }
26
+ export const EntryV2Response = extend(StatResponse, {
27
+ name: string(u32),
28
+ });
29
+ export async function* v2(pool, path) {
30
+ const socket = await pool.acquire();
31
+ let completed = false;
32
+ let error;
33
+ try {
34
+ await socket.writeRequest(RequestId.ListV2, path);
35
+ for await (const item of socket.readResponses(ResponseId.EntryV2, EntryV2Response)) {
36
+ // `LST2` can return error codes for failed `lstat` calls.
37
+ // `LIST` just ignores them.
38
+ // But they only contain `name` so still pretty useless.
39
+ if (item.error !== AndroidSyscallErrorCode.SUCCESS) {
40
+ continue;
41
+ }
42
+ yield item;
43
+ }
44
+ completed = true;
45
+ }
46
+ catch (e) {
47
+ error = e;
48
+ throw e;
49
+ }
50
+ finally {
51
+ await pool.release(socket, !(completed || error instanceof AdbSyncError));
52
+ }
53
+ }
54
+ export async function* opendir(pool, path, { version }) {
55
+ if (version === 2) {
56
+ yield* v2(pool, path);
57
+ }
58
+ else {
59
+ for await (const item of v1(pool, path)) {
60
+ // Convert to same format as `AdbSyncEntry2Response` for easier consumption.
61
+ // However it will add some overhead.
62
+ yield {
63
+ mode: item.mode,
64
+ size: BigInt(item.size),
65
+ mtime: BigInt(item.mtime),
66
+ get type() {
67
+ return item.type;
68
+ },
69
+ get permission() {
70
+ return item.permission;
71
+ },
72
+ name: item.name,
73
+ };
74
+ }
75
+ }
76
+ }
77
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/service/sync/request/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,UAAU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C;gBACrB,CAAC;gBACD,IAAI,UAAU;oBACV,OAAO,IAAI,CAAC,UAAU,CAAC;gBAC3B,CAAC;gBACD,IAAI,EAAE,IAAI,CAAC,IAAI;aAClB,CAAC;QACN,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { ReadableStream } from "@yume-chan/stream-extra";
2
+ import type { StructValue } from "@yume-chan/struct";
3
+ import type { SocketPool } from "../socket-pool.js";
4
+ export declare const DataResponse: import("@yume-chan/struct").Struct<{
5
+ data: import("@yume-chan/struct").Field<Uint8Array<ArrayBufferLike>, string, never, Uint8Array<ArrayBufferLike>>;
6
+ }, undefined, import("@yume-chan/struct").FieldsValue<{
7
+ data: import("@yume-chan/struct").Field<Uint8Array<ArrayBufferLike>, string, never, Uint8Array<ArrayBufferLike>>;
8
+ }>>;
9
+ export type DataResponse = StructValue<typeof DataResponse>;
10
+ export declare function generator(pool: SocketPool, path: string): AsyncGenerator<Uint8Array, void, void>;
11
+ export declare function stream(pool: SocketPool, path: string): ReadableStream<Uint8Array>;
12
+ //# sourceMappingURL=pull.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/request/pull.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,eAAO,MAAM,YAAY;;;;GAGxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,YAAY,CAAC,CAAC;AAE5D,wBAAuB,SAAS,CAC5B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,GACb,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAuBxC;AAED,wBAAgB,MAAM,CAClB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,GACb,cAAc,CAAC,UAAU,CAAC,CAE5B"}
@@ -0,0 +1,28 @@
1
+ import { ReadableStream } from "@yume-chan/stream-extra";
2
+ import { buffer, struct, u32 } from "@yume-chan/struct";
3
+ import { RequestId, ResponseId } from "../id/index.js";
4
+ import { Error as AdbSyncError } from "../socket.js";
5
+ export const DataResponse = struct({ data: buffer(u32) }, { littleEndian: true });
6
+ export async function* generator(pool, path) {
7
+ const socket = await pool.acquire();
8
+ let completed = false;
9
+ let error;
10
+ try {
11
+ await socket.writeRequest(RequestId.Receive, path);
12
+ for await (const packet of socket.readResponses(ResponseId.Data, DataResponse)) {
13
+ yield packet.data;
14
+ }
15
+ completed = true;
16
+ }
17
+ catch (e) {
18
+ error = e;
19
+ throw e;
20
+ }
21
+ finally {
22
+ await pool.release(socket, !(completed || error instanceof AdbSyncError));
23
+ }
24
+ }
25
+ export function stream(pool, path) {
26
+ return ReadableStream.from(generator(pool, path));
27
+ }
28
+ //# sourceMappingURL=pull.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../../src/service/sync/request/pull.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAC9B,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,EACrB,EAAE,YAAY,EAAE,IAAI,EAAE,CACzB,CAAC;AAIF,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,SAAS,CAC5B,IAAgB,EAChB,IAAY;IAEZ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACpC,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,KAAc,CAAC;IAEnB,IAAI,CAAC;QACD,MAAM,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACnD,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,MAAM,CAAC,aAAa,CAC3C,UAAU,CAAC,IAAI,EACf,YAAY,CACf,EAAE,CAAC;YACA,MAAM,MAAM,CAAC,IAAI,CAAC;QACtB,CAAC;QACD,SAAS,GAAG,IAAI,CAAC;IACrB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,KAAK,GAAG,CAAC,CAAC;QACV,MAAM,CAAC,CAAC;IACZ,CAAC;YAAS,CAAC;QACP,MAAM,IAAI,CAAC,OAAO,CACd,MAAM,EACN,CAAC,CAAC,SAAS,IAAI,KAAK,YAAY,YAAY,CAAC,CAChD,CAAC;IACN,CAAC;AACL,CAAC;AAED,MAAM,UAAU,MAAM,CAClB,IAAgB,EAChB,IAAY;IAEZ,OAAO,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { ReadableStream } from "@yume-chan/stream-extra";
2
+ import { MaybeConsumable } from "@yume-chan/stream-extra";
3
+ import { LinuxFileType } from "../android.js";
4
+ import { Compression } from "../compression/index.js";
5
+ import type { SocketPool } from "../socket-pool.js";
6
+ export declare const MaxPacketSize: number;
7
+ export declare const OkResponse: import("@yume-chan/struct").Struct<{
8
+ unused: import("@yume-chan/struct").NumberField<number>;
9
+ }, undefined, import("@yume-chan/struct").FieldsValue<{
10
+ unused: import("@yume-chan/struct").NumberField<number>;
11
+ }>>;
12
+ export interface SendV1Options {
13
+ pool: SocketPool;
14
+ filename: string;
15
+ file: ReadableStream<MaybeConsumable<Uint8Array>>;
16
+ type?: LinuxFileType | undefined;
17
+ permission?: number | undefined;
18
+ mtime?: number | undefined;
19
+ packetSize?: number | undefined;
20
+ }
21
+ export declare function sendV1({ pool, filename, file, type, permission, mtime, packetSize, }: SendV1Options): Promise<void>;
22
+ export declare const SendV2Flags: {
23
+ readonly None: 0;
24
+ readonly Brotli: 1;
25
+ readonly Lz4: 2;
26
+ readonly Zstd: 4;
27
+ readonly DryRun: 2147483648;
28
+ };
29
+ export type SendV2Flags = (typeof SendV2Flags)[keyof typeof SendV2Flags];
30
+ export declare const SendV2Request: import("@yume-chan/struct").Struct<{
31
+ id: import("@yume-chan/struct").NumberField<number>;
32
+ mode: import("@yume-chan/struct").NumberField<number>;
33
+ flags: import("@yume-chan/struct").NumberField<number>;
34
+ }, undefined, import("@yume-chan/struct").FieldsValue<{
35
+ id: import("@yume-chan/struct").NumberField<number>;
36
+ mode: import("@yume-chan/struct").NumberField<number>;
37
+ flags: import("@yume-chan/struct").NumberField<number>;
38
+ }>>;
39
+ export interface SendV2Options extends SendV1Options {
40
+ compression?: Compression.Format | undefined;
41
+ /**
42
+ * Don't write the file to disk. Requires the `sendrecv_v2` feature.
43
+ *
44
+ * It was used during ADB development to benchmark the performance of
45
+ * compression algorithms.
46
+ */
47
+ dryRun?: boolean | undefined;
48
+ }
49
+ export declare function sendV2({ pool, filename, file, type, permission, mtime, packetSize, compression, dryRun, }: SendV2Options): Promise<void>;
50
+ export interface SendOptions extends SendV2Options {
51
+ version: 1 | 2;
52
+ }
53
+ export declare function send(options: SendOptions): Promise<void>;
54
+ //# sourceMappingURL=push.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/request/push.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAGH,eAAe,EAClB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,W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AAE,CAAC,GAAG,CAAC,CAAC;CAClB;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,WAAW,iBAiBxC"}
@@ -0,0 +1,95 @@
1
+ import { AbortController, DistributionStream, MaybeConsumable, } from "@yume-chan/stream-extra";
2
+ import { struct, u32 } from "@yume-chan/struct";
3
+ import { NOOP } from "../../../utils/index.js";
4
+ import { LinuxFileType } from "../android.js";
5
+ import { Compression } from "../compression/index.js";
6
+ import { RequestId, ResponseId } from "../id/index.js";
7
+ import { Error as AdbSyncError } from "../socket.js";
8
+ export const MaxPacketSize = 64 * 1024;
9
+ export const OkResponse = struct({ unused: u32 }, { littleEndian: true });
10
+ // eslint-disable-next-line @typescript-eslint/max-params
11
+ async function pipeFileData(socket, file, packetSize, mtime, compression) {
12
+ if (compression !== Compression.Format.None) {
13
+ const stream = Compression.createCompressionStream(compression);
14
+ void file
15
+ .pipeTo(new MaybeConsumable.WrapWritableStream(stream.writable))
16
+ .catch(NOOP);
17
+ file = stream.readable;
18
+ }
19
+ // Read and write in parallel,
20
+ // allow error response to abort the write.
21
+ const abortController = new AbortController();
22
+ file.pipeThrough(new DistributionStream(packetSize, true))
23
+ .pipeTo(new MaybeConsumable.WritableStream({
24
+ write(chunk) {
25
+ return socket.writeRequest(RequestId.Data, chunk);
26
+ },
27
+ }), { signal: abortController.signal })
28
+ .then(async () => {
29
+ await socket.writeRequest(RequestId.Done, mtime);
30
+ await socket.flush();
31
+ }, NOOP);
32
+ try {
33
+ await socket.readResponse(ResponseId.Ok, OkResponse);
34
+ }
35
+ catch (e) {
36
+ abortController.abort(e);
37
+ throw e;
38
+ }
39
+ }
40
+ export function sendV1({ pool, filename, file, type = LinuxFileType.File, permission = 0o666, mtime = (Date.now() / 1000) | 0, packetSize = MaxPacketSize, }) {
41
+ return pool.withSocket(async (socket) => {
42
+ const mode = (type << 12) | permission;
43
+ const pathAndMode = `${filename},${mode.toString()}`;
44
+ await socket.writeRequest(RequestId.Send, pathAndMode);
45
+ await pipeFileData(socket, file, packetSize, mtime, Compression.Format.None);
46
+ });
47
+ }
48
+ export const SendV2Flags = {
49
+ None: 0,
50
+ Brotli: 1,
51
+ Lz4: 2,
52
+ Zstd: 4,
53
+ DryRun: 0x80000000,
54
+ };
55
+ export const SendV2Request = struct({ id: u32, mode: u32, flags: u32 }, { littleEndian: true });
56
+ export function sendV2({ pool, filename, file, type = LinuxFileType.File, permission = 0o666, mtime = (Date.now() / 1000) | 0, packetSize = MaxPacketSize, compression = Compression.Format.None, dryRun = false, }) {
57
+ return pool.withSocket(async (socket) => {
58
+ let flags = SendV2Flags.None;
59
+ switch (compression) {
60
+ case Compression.Format.Brotli:
61
+ flags |= SendV2Flags.Brotli;
62
+ break;
63
+ case Compression.Format.Lz4:
64
+ flags |= SendV2Flags.Lz4;
65
+ break;
66
+ case Compression.Format.Zstd:
67
+ flags |= SendV2Flags.Zstd;
68
+ break;
69
+ }
70
+ if (dryRun) {
71
+ flags |= SendV2Flags.DryRun;
72
+ }
73
+ await socket.writeRequest(RequestId.SendV2, filename);
74
+ await socket.write(SendV2Request.serialize({
75
+ id: RequestId.SendV2,
76
+ mode: (type << 12) | permission,
77
+ flags,
78
+ }));
79
+ await pipeFileData(socket, file, packetSize, mtime, compression);
80
+ });
81
+ }
82
+ export function send(options) {
83
+ if (options.version === 2) {
84
+ return sendV2(options);
85
+ }
86
+ if (options.dryRun) {
87
+ throw new AdbSyncError("dryRun is not supported in v1");
88
+ }
89
+ if (options.compression !== undefined &&
90
+ options.compression !== Compression.Format.None) {
91
+ throw new AdbSyncError("compression is not supported in v1");
92
+ }
93
+ return sendV1(options);
94
+ }
95
+ //# sourceMappingURL=push.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push.js","sourceRoot":"","sources":["../../../../src/service/sync/request/push.ts"],"names":[],"mappings":"AACA,OAAO,EACH,eAAe,EACf,kBAAkB,EAClB,eAAe,GAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,GAAG,E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,CACd,aAAa,CAAC,SAAS,CAAC;YACpB,EAAE,EAAE,SAAS,CAAC,MAAM;YACpB,IAAI,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,UAAU;YAC/B,KAAK;SACR,CAAC,CACL,CAAC;QAEF,MAAM,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;AACP,CAAC;AAMD,MAAM,UAAU,IAAI,CAAC,OAAoB;IACrC,IAAI,OAAO,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACjB,MAAM,IAAI,YAAY,CAAC,+BAA+B,CAAC,CAAC;IAC5D,CAAC;IAED,IACI,OAAO,CAAC,WAAW,KAAK,SAAS;QACjC,OAAO,CAAC,WAAW,KAAK,WAAW,CAAC,MAAM,CAAC,IAAI,EACjD,CAAC;QACC,MAAM,IAAI,YAAY,CAAC,oCAAoC,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC"}
@@ -1,23 +1,7 @@
1
1
  import type { StructValue } from "@yume-chan/struct";
2
- import type { AdbSyncSocket } from "./socket.js";
3
- export declare const LinuxFileType: {
4
- readonly Directory: 4;
5
- readonly File: 8;
6
- readonly Link: 10;
7
- };
8
- export type LinuxFileType = (typeof LinuxFileType)[keyof typeof LinuxFileType];
9
- export interface AdbSyncStat {
10
- mode: number;
11
- size: bigint;
12
- mtime: bigint;
13
- get type(): LinuxFileType;
14
- get permission(): number;
15
- uid?: number;
16
- gid?: number;
17
- atime?: bigint;
18
- ctime?: bigint;
19
- }
20
- export declare const AdbSyncLstatResponse: import("@yume-chan/struct").Struct<{
2
+ import type { AndroidSyscallErrorCode, LinuxFileType } from "../android.js";
3
+ import type { SocketPool } from "../socket-pool.js";
4
+ export declare const LstatResponse: import("@yume-chan/struct").Struct<{
21
5
  mode: import("@yume-chan/struct").NumberField<number>;
22
6
  size: import("@yume-chan/struct").NumberField<number>;
23
7
  mtime: import("@yume-chan/struct").NumberField<number>;
@@ -32,33 +16,10 @@ export declare const AdbSyncLstatResponse: import("@yume-chan/struct").Struct<{
32
16
  readonly type: LinuxFileType;
33
17
  readonly permission: number;
34
18
  }>;
35
- export type AdbSyncLstatResponse = StructValue<typeof AdbSyncLstatResponse>;
36
- export declare const AdbSyncStatErrorCode: {
37
- readonly SUCCESS: 0;
38
- readonly EACCES: 13;
39
- readonly EEXIST: 17;
40
- readonly EFAULT: 14;
41
- readonly EFBIG: 27;
42
- readonly EINTR: 4;
43
- readonly EINVAL: 22;
44
- readonly EIO: 5;
45
- readonly EISDIR: 21;
46
- readonly ELOOP: 40;
47
- readonly EMFILE: 24;
48
- readonly ENAMETOOLONG: 36;
49
- readonly ENFILE: 23;
50
- readonly ENOENT: 2;
51
- readonly ENOMEM: 12;
52
- readonly ENOSPC: 28;
53
- readonly ENOTDIR: 20;
54
- readonly EOVERFLOW: 75;
55
- readonly EPERM: 1;
56
- readonly EROFS: 30;
57
- readonly ETXTBSY: 26;
58
- };
59
- export type AdbSyncStatErrorCode = (typeof AdbSyncStatErrorCode)[keyof typeof AdbSyncStatErrorCode];
60
- export declare const AdbSyncStatResponse: import("@yume-chan/struct").Struct<{
61
- error: import("@yume-chan/struct").Field<AdbSyncStatErrorCode, never, never, number>;
19
+ export type LstatResponse = StructValue<typeof LstatResponse>;
20
+ export declare function lstatV1(pool: SocketPool, path: string): Promise<LstatResponse>;
21
+ export declare const StatResponse: import("@yume-chan/struct").Struct<{
22
+ error: import("@yume-chan/struct").Field<AndroidSyscallErrorCode, never, never, number>;
62
23
  dev: import("@yume-chan/struct").NumberField<bigint>;
63
24
  ino: import("@yume-chan/struct").NumberField<bigint>;
64
25
  mode: import("@yume-chan/struct").NumberField<number>;
@@ -73,7 +34,24 @@ export declare const AdbSyncStatResponse: import("@yume-chan/struct").Struct<{
73
34
  readonly type: LinuxFileType;
74
35
  readonly permission: number;
75
36
  }, import("@yume-chan/struct").FieldsValue<{
76
- error: import("@yume-chan/struct").Field<AdbSyncStatErrorCode, never, never, number>;
37
+ error: import("@yume-chan/struct").Field<AndroidSyscallErrorCode, never, never, number>;
38
+ dev: import("@yume-chan/struct").NumberField<bigint>;
39
+ ino: import("@yume-chan/struct").NumberField<bigint>;
40
+ mode: import("@yume-chan/struct").NumberField<number>;
41
+ nlink: import("@yume-chan/struct").NumberField<number>;
42
+ uid: import("@yume-chan/struct").NumberField<number>;
43
+ gid: import("@yume-chan/struct").NumberField<number>;
44
+ size: import("@yume-chan/struct").NumberField<bigint>;
45
+ atime: import("@yume-chan/struct").NumberField<bigint>;
46
+ mtime: import("@yume-chan/struct").NumberField<bigint>;
47
+ ctime: import("@yume-chan/struct").NumberField<bigint>;
48
+ }> & {
49
+ readonly type: LinuxFileType;
50
+ readonly permission: number;
51
+ }>;
52
+ export type StatResponse = StructValue<typeof StatResponse>;
53
+ export declare function lstatV2(pool: SocketPool, path: string): Promise<import("@yume-chan/struct").FieldsValue<{
54
+ error: import("@yume-chan/struct").Field<AndroidSyscallErrorCode, never, never, number>;
77
55
  dev: import("@yume-chan/struct").NumberField<bigint>;
78
56
  ino: import("@yume-chan/struct").NumberField<bigint>;
79
57
  mode: import("@yume-chan/struct").NumberField<number>;
@@ -88,7 +66,19 @@ export declare const AdbSyncStatResponse: import("@yume-chan/struct").Struct<{
88
66
  readonly type: LinuxFileType;
89
67
  readonly permission: number;
90
68
  }>;
91
- export type AdbSyncStatResponse = StructValue<typeof AdbSyncStatResponse>;
92
- export declare function adbSyncLstat(socket: AdbSyncSocket, path: string, v2: boolean): Promise<AdbSyncStat>;
93
- export declare function adbSyncStat(socket: AdbSyncSocket, path: string): Promise<AdbSyncStatResponse>;
69
+ export declare function lstat(pool: SocketPool, path: string, { version }: {
70
+ version: 1 | 2;
71
+ }): Promise<Stat>;
72
+ export interface Stat {
73
+ mode: number;
74
+ size: bigint;
75
+ mtime: bigint;
76
+ get type(): LinuxFileType;
77
+ get permission(): number;
78
+ uid?: number;
79
+ gid?: number;
80
+ atime?: bigint;
81
+ ctime?: bigint;
82
+ }
83
+ export declare function stat(pool: SocketPool, path: string): Promise<StatResponse>;
94
84
  //# sourceMappingURL=stat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stat.d.ts","sourceRoot":"","sources":["../../../../src/service/sync/request/stat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,eAAO,MAAM,aAAa;;;;;mBAKF,aAAa;yBAGP,MAAM;;;;;;mBAHZ,aAAa;yBAGP,MAAM;EAWnC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC;AAE9D,wBAAgB,OAAO,CACnB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,GACb,OAAO,CAAC,aAAa,CAAC,CAKxB;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;mBAiBD,aAAa;yBAGP,MAAM;;;;;;;;;;;;;;mBAHZ,aAAa;yBAGP,MAAM;EAWnC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,YAAY,CAAC,CAAC;AAE5D,wBAAgB,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM;;;;;;;;;;;;;mBAlB9B,aAAa;yBAGP,MAAM;GAoBnC;AAED,wBAAsB,KAAK,CACvB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAAA;CAAE,GAChC,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,MAAM,WAAW,IAAI;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,IAAI,IAAI,aAAa,CAAC;IAC1B,IAAI,UAAU,IAAI,MAAM,CAAC;IAEzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAK1E"}
@@ -0,0 +1,89 @@
1
+ import { struct, u32, u64 } from "@yume-chan/struct";
2
+ import { AndroidSyscallErrorNameMap } from "../android.js";
3
+ import { RequestId, ResponseId } from "../id/index.js";
4
+ import { Error as AdbSyncError } from "../socket.js";
5
+ export const LstatResponse = struct({ mode: u32, size: u32, mtime: u32 }, {
6
+ littleEndian: true,
7
+ extra: {
8
+ get type() {
9
+ return (this.mode >> 12);
10
+ },
11
+ get permission() {
12
+ return this.mode & 0b00001111_11111111;
13
+ },
14
+ },
15
+ postDeserialize(value) {
16
+ if (value.mode === 0 && value.size === 0 && value.mtime === 0) {
17
+ throw new AdbSyncError("lstat error");
18
+ }
19
+ return value;
20
+ },
21
+ });
22
+ export function lstatV1(pool, path) {
23
+ return pool.withSocket(async (socket) => {
24
+ await socket.writeRequest(RequestId.Lstat, path);
25
+ return await socket.readResponse(ResponseId.Lstat, LstatResponse);
26
+ });
27
+ }
28
+ export const StatResponse = struct({
29
+ error: u32(),
30
+ dev: u64,
31
+ ino: u64,
32
+ mode: u32,
33
+ nlink: u32,
34
+ uid: u32,
35
+ gid: u32,
36
+ size: u64,
37
+ atime: u64,
38
+ mtime: u64,
39
+ ctime: u64,
40
+ }, {
41
+ littleEndian: true,
42
+ extra: {
43
+ get type() {
44
+ return (this.mode >> 12);
45
+ },
46
+ get permission() {
47
+ return this.mode & 0b00001111_11111111;
48
+ },
49
+ },
50
+ postDeserialize(value) {
51
+ if (value.error) {
52
+ throw new AdbSyncError(AndroidSyscallErrorNameMap[value.error]);
53
+ }
54
+ return value;
55
+ },
56
+ });
57
+ export function lstatV2(pool, path) {
58
+ return pool.withSocket(async (socket) => {
59
+ await socket.writeRequest(RequestId.LstatV2, path);
60
+ return await socket.readResponse(ResponseId.LstatV2, StatResponse);
61
+ });
62
+ }
63
+ export async function lstat(pool, path, { version }) {
64
+ if (version === 2) {
65
+ return await lstatV2(pool, path);
66
+ }
67
+ else {
68
+ const response = await lstatV1(pool, path);
69
+ return {
70
+ mode: response.mode,
71
+ // Convert to `BigInt` to make it compatible with `StatResponse`
72
+ size: BigInt(response.size),
73
+ mtime: BigInt(response.mtime),
74
+ get type() {
75
+ return response.type;
76
+ },
77
+ get permission() {
78
+ return response.permission;
79
+ },
80
+ };
81
+ }
82
+ }
83
+ export function stat(pool, path) {
84
+ return pool.withSocket(async (socket) => {
85
+ await socket.writeRequest(RequestId.Stat, path);
86
+ return await socket.readResponse(ResponseId.Stat, StatResponse);
87
+ });
88
+ }
89
+ //# sourceMappingURL=stat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stat.js","sourceRoot":"","sources":["../../../../src/service/sync/request/stat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAC/B,EAAE,IAAI,EAAE,GAAG,E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