@yume-chan/adb 0.0.10 → 0.0.13

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 (342) hide show
  1. package/CHANGELOG.json +50 -0
  2. package/CHANGELOG.md +29 -1
  3. package/LICENSE +1 -1
  4. package/README.md +71 -51
  5. package/esm/adb.d.ts +48 -0
  6. package/esm/adb.d.ts.map +1 -0
  7. package/esm/adb.js +149 -136
  8. package/esm/adb.js.map +1 -1
  9. package/{dts → esm}/auth.d.ts +11 -11
  10. package/esm/auth.d.ts.map +1 -0
  11. package/esm/auth.js +72 -110
  12. package/esm/auth.js.map +1 -1
  13. package/esm/backend.d.ts +9 -0
  14. package/esm/backend.d.ts.map +1 -0
  15. package/{dts → esm}/commands/base.d.ts +1 -1
  16. package/esm/commands/base.d.ts.map +1 -0
  17. package/esm/commands/base.js +1 -0
  18. package/esm/commands/base.js.map +1 -1
  19. package/{dts → esm}/commands/framebuffer.d.ts +3 -3
  20. package/esm/commands/framebuffer.d.ts.map +1 -0
  21. package/esm/commands/framebuffer.js +15 -18
  22. package/esm/commands/framebuffer.js.map +1 -1
  23. package/esm/commands/index.d.ts +9 -0
  24. package/esm/commands/index.d.ts.map +1 -0
  25. package/esm/commands/index.js +8 -8
  26. package/esm/commands/index.js.map +1 -1
  27. package/esm/commands/install.d.ts +4 -0
  28. package/esm/commands/install.d.ts.map +1 -0
  29. package/esm/commands/install.js +19 -13
  30. package/esm/commands/install.js.map +1 -1
  31. package/esm/commands/power.d.ts +23 -0
  32. package/esm/commands/power.d.ts.map +1 -0
  33. package/esm/commands/power.js +45 -0
  34. package/esm/commands/power.js.map +1 -0
  35. package/{dts → esm}/commands/reverse.d.ts +3 -3
  36. package/esm/commands/reverse.d.ts.map +1 -0
  37. package/esm/commands/reverse.js +49 -60
  38. package/esm/commands/reverse.js.map +1 -1
  39. package/esm/commands/subprocess/index.d.ts +56 -0
  40. package/esm/commands/subprocess/index.d.ts.map +1 -0
  41. package/esm/commands/subprocess/index.js +88 -0
  42. package/esm/commands/subprocess/index.js.map +1 -0
  43. package/esm/commands/subprocess/legacy.d.ts +35 -0
  44. package/esm/commands/subprocess/legacy.d.ts.map +1 -0
  45. package/esm/commands/subprocess/legacy.js +53 -0
  46. package/esm/commands/subprocess/legacy.js.map +1 -0
  47. package/esm/commands/subprocess/protocol.d.ts +39 -0
  48. package/esm/commands/subprocess/protocol.d.ts.map +1 -0
  49. package/esm/commands/subprocess/protocol.js +157 -0
  50. package/esm/commands/subprocess/protocol.js.map +1 -0
  51. package/esm/commands/subprocess/protocols/index.d.ts +4 -0
  52. package/esm/commands/subprocess/protocols/index.d.ts.map +1 -0
  53. package/esm/commands/subprocess/protocols/index.js +4 -0
  54. package/esm/commands/subprocess/protocols/index.js.map +1 -0
  55. package/esm/commands/subprocess/protocols/none.d.ts +35 -0
  56. package/esm/commands/subprocess/protocols/none.d.ts.map +1 -0
  57. package/esm/commands/subprocess/protocols/none.js +53 -0
  58. package/esm/commands/subprocess/protocols/none.js.map +1 -0
  59. package/esm/commands/subprocess/protocols/shell.d.ts +39 -0
  60. package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -0
  61. package/esm/commands/subprocess/protocols/shell.js +155 -0
  62. package/esm/commands/subprocess/protocols/shell.js.map +1 -0
  63. package/esm/commands/subprocess/protocols/types.d.ts +50 -0
  64. package/esm/commands/subprocess/protocols/types.d.ts.map +1 -0
  65. package/esm/commands/{shell → subprocess/protocols}/types.js +0 -0
  66. package/esm/commands/subprocess/protocols/types.js.map +1 -0
  67. package/esm/commands/subprocess/types.d.ts +50 -0
  68. package/esm/commands/subprocess/types.d.ts.map +1 -0
  69. package/esm/commands/subprocess/types.js +2 -0
  70. package/esm/commands/{shell → subprocess}/types.js.map +1 -1
  71. package/{dts/commands/shell → esm/commands/subprocess}/utils.d.ts +0 -0
  72. package/esm/commands/subprocess/utils.d.ts.map +1 -0
  73. package/esm/commands/{shell → subprocess}/utils.js +0 -0
  74. package/esm/commands/subprocess/utils.js.map +1 -0
  75. package/esm/commands/sync/index.d.ts +8 -0
  76. package/esm/commands/sync/index.d.ts.map +1 -0
  77. package/esm/commands/sync/index.js +7 -7
  78. package/esm/commands/sync/index.js.map +1 -1
  79. package/esm/commands/sync/list.d.ts +41 -0
  80. package/esm/commands/sync/list.d.ts.map +1 -0
  81. package/esm/commands/sync/list.js +52 -20
  82. package/esm/commands/sync/list.js.map +1 -1
  83. package/esm/commands/sync/pull.d.ts +11 -0
  84. package/esm/commands/sync/pull.d.ts.map +1 -0
  85. package/esm/commands/sync/pull.js +17 -11
  86. package/esm/commands/sync/pull.js.map +1 -1
  87. package/esm/commands/sync/push.d.ts +8 -0
  88. package/esm/commands/sync/push.d.ts.map +1 -0
  89. package/esm/commands/sync/push.js +19 -37
  90. package/esm/commands/sync/push.js.map +1 -1
  91. package/{dts → esm}/commands/sync/request.d.ts +4 -3
  92. package/esm/commands/sync/request.d.ts.map +1 -0
  93. package/esm/commands/sync/request.js +25 -27
  94. package/esm/commands/sync/request.js.map +1 -1
  95. package/{dts → esm}/commands/sync/response.d.ts +4 -3
  96. package/esm/commands/sync/response.d.ts.map +1 -0
  97. package/esm/commands/sync/response.js +17 -20
  98. package/esm/commands/sync/response.js.map +1 -1
  99. package/{dts → esm}/commands/sync/stat.d.ts +16 -4
  100. package/esm/commands/sync/stat.d.ts.map +1 -0
  101. package/esm/commands/sync/stat.js +38 -30
  102. package/esm/commands/sync/stat.js.map +1 -1
  103. package/esm/commands/sync/sync.d.ts +61 -0
  104. package/esm/commands/sync/sync.d.ts.map +1 -0
  105. package/esm/commands/sync/sync.js +122 -89
  106. package/esm/commands/sync/sync.js.map +1 -1
  107. package/{dts → esm}/commands/tcpip.d.ts +1 -1
  108. package/{dts → esm}/commands/tcpip.d.ts.map +1 -1
  109. package/esm/commands/tcpip.js +14 -19
  110. package/esm/commands/tcpip.js.map +1 -1
  111. package/esm/crypto.d.ts +37 -0
  112. package/esm/crypto.d.ts.map +1 -0
  113. package/esm/crypto.js +77 -62
  114. package/esm/crypto.js.map +1 -1
  115. package/esm/features.d.ts +8 -0
  116. package/esm/features.d.ts.map +1 -0
  117. package/esm/features.js +7 -3
  118. package/esm/features.js.map +1 -1
  119. package/esm/index.d.ts +11 -0
  120. package/esm/index.d.ts.map +1 -0
  121. package/esm/index.js +10 -10
  122. package/esm/index.js.map +1 -1
  123. package/esm/packet.d.ts +47 -0
  124. package/esm/packet.d.ts.map +1 -0
  125. package/esm/packet.js +27 -52
  126. package/esm/packet.js.map +1 -1
  127. package/esm/socket/controller.d.ts +37 -0
  128. package/esm/socket/controller.d.ts.map +1 -0
  129. package/esm/socket/controller.js +52 -66
  130. package/esm/socket/controller.js.map +1 -1
  131. package/esm/socket/dispatcher.d.ts +44 -0
  132. package/esm/socket/dispatcher.d.ts.map +1 -0
  133. package/esm/socket/dispatcher.js +146 -165
  134. package/esm/socket/dispatcher.js.map +1 -1
  135. package/esm/socket/index.d.ts +3 -0
  136. package/esm/socket/index.d.ts.map +1 -0
  137. package/esm/socket/index.js +2 -6
  138. package/esm/socket/index.js.map +1 -1
  139. package/esm/socket/socket.d.ts +46 -0
  140. package/esm/socket/socket.d.ts.map +1 -0
  141. package/esm/socket/socket.js +77 -13
  142. package/esm/socket/socket.js.map +1 -1
  143. package/esm/stream/buffered.d.ts +35 -0
  144. package/esm/stream/buffered.d.ts.map +1 -0
  145. package/esm/stream/buffered.js +123 -0
  146. package/esm/stream/buffered.js.map +1 -0
  147. package/esm/stream/detect.bak.d.ts +240 -0
  148. package/esm/stream/detect.bak.d.ts.map +1 -0
  149. package/esm/stream/detect.bak.js +60 -0
  150. package/esm/stream/detect.bak.js.map +1 -0
  151. package/esm/stream/detect.d.ts +2 -0
  152. package/esm/stream/detect.d.ts.map +1 -0
  153. package/esm/stream/detect.js +5 -0
  154. package/esm/stream/detect.js.map +1 -0
  155. package/esm/stream/detect.native.d.ts +240 -0
  156. package/esm/stream/detect.native.d.ts.map +1 -0
  157. package/esm/stream/detect.native.js +60 -0
  158. package/esm/stream/detect.native.js.map +1 -0
  159. package/esm/stream/detect.polyfill.d.ts +18 -0
  160. package/esm/stream/detect.polyfill.d.ts.map +1 -0
  161. package/esm/stream/detect.polyfill.js +9 -0
  162. package/esm/stream/detect.polyfill.js.map +1 -0
  163. package/esm/stream/index.d.ts +4 -0
  164. package/esm/stream/index.d.ts.map +1 -0
  165. package/esm/stream/index.js +3 -2
  166. package/esm/stream/index.js.map +1 -1
  167. package/esm/stream/transform.d.ts +98 -0
  168. package/esm/stream/transform.d.ts.map +1 -0
  169. package/esm/stream/transform.js +402 -0
  170. package/esm/stream/transform.js.map +1 -0
  171. package/{dts → esm}/utils/auto-reset-event.d.ts +1 -1
  172. package/esm/utils/auto-reset-event.d.ts.map +1 -0
  173. package/esm/utils/auto-reset-event.js +2 -1
  174. package/esm/utils/auto-reset-event.js.map +1 -1
  175. package/esm/utils/base64.d.ts +5 -0
  176. package/esm/utils/base64.d.ts.map +1 -0
  177. package/esm/utils/base64.js +116 -80
  178. package/esm/utils/base64.js.map +1 -1
  179. package/esm/utils/encoding.d.ts +3 -0
  180. package/esm/utils/encoding.d.ts.map +1 -0
  181. package/esm/utils/encoding.js +1 -1
  182. package/esm/utils/encoding.js.map +1 -1
  183. package/esm/utils/index.d.ts +4 -0
  184. package/esm/utils/index.d.ts.map +1 -0
  185. package/esm/utils/index.js +3 -5
  186. package/esm/utils/index.js.map +1 -1
  187. package/package.json +50 -44
  188. package/src/adb.ts +177 -150
  189. package/src/auth.ts +37 -30
  190. package/src/backend.ts +3 -12
  191. package/src/commands/base.ts +1 -1
  192. package/src/commands/framebuffer.ts +4 -4
  193. package/src/commands/index.ts +8 -8
  194. package/src/commands/install.ts +24 -15
  195. package/src/commands/power.ts +54 -0
  196. package/src/commands/reverse.ts +10 -8
  197. package/src/commands/subprocess/index.ts +139 -0
  198. package/src/commands/subprocess/protocols/index.ts +3 -0
  199. package/src/commands/subprocess/protocols/none.ts +68 -0
  200. package/src/commands/subprocess/protocols/shell.ts +190 -0
  201. package/src/commands/subprocess/protocols/types.ts +59 -0
  202. package/src/commands/{shell → subprocess}/utils.ts +0 -0
  203. package/src/commands/sync/index.ts +7 -7
  204. package/src/commands/sync/list.ts +56 -9
  205. package/src/commands/sync/pull.ts +27 -18
  206. package/src/commands/sync/push.ts +25 -30
  207. package/src/commands/sync/request.ts +8 -7
  208. package/src/commands/sync/response.ts +12 -6
  209. package/src/commands/sync/stat.ts +43 -14
  210. package/src/commands/sync/sync.ts +102 -34
  211. package/src/commands/tcpip.ts +3 -3
  212. package/src/crypto.ts +95 -84
  213. package/src/features.ts +6 -2
  214. package/src/index.ts +11 -10
  215. package/src/packet.ts +49 -53
  216. package/src/socket/dispatcher.ts +110 -109
  217. package/src/socket/index.ts +2 -6
  218. package/src/socket/socket.ts +125 -17
  219. package/src/stream/buffered.ts +147 -0
  220. package/src/stream/detect.native.ts +362 -0
  221. package/src/stream/detect.polyfill.ts +28 -0
  222. package/src/stream/detect.ts +5 -0
  223. package/src/stream/index.ts +3 -2
  224. package/src/stream/transform.ts +483 -0
  225. package/src/utils/auto-reset-event.ts +1 -1
  226. package/src/utils/base64.ts +161 -129
  227. package/src/utils/index.ts +3 -5
  228. package/tsconfig.build.json +3 -0
  229. package/tsconfig.build.tsbuildinfo +1 -0
  230. package/tsconfig.test.json +10 -0
  231. package/dts/adb.d.ts +0 -46
  232. package/dts/adb.d.ts.map +0 -1
  233. package/dts/auth.d.ts.map +0 -1
  234. package/dts/backend.d.ts +0 -13
  235. package/dts/backend.d.ts.map +0 -1
  236. package/dts/commands/base.d.ts.map +0 -1
  237. package/dts/commands/demo-mode.d.ts +0 -41
  238. package/dts/commands/demo-mode.d.ts.map +0 -1
  239. package/dts/commands/framebuffer.d.ts.map +0 -1
  240. package/dts/commands/index.d.ts +0 -9
  241. package/dts/commands/index.d.ts.map +0 -1
  242. package/dts/commands/install.d.ts +0 -3
  243. package/dts/commands/install.d.ts.map +0 -1
  244. package/dts/commands/reverse.d.ts.map +0 -1
  245. package/dts/commands/shell/index.d.ts +0 -46
  246. package/dts/commands/shell/index.d.ts.map +0 -1
  247. package/dts/commands/shell/legacy.d.ts +0 -38
  248. package/dts/commands/shell/legacy.d.ts.map +0 -1
  249. package/dts/commands/shell/protocol.d.ts +0 -45
  250. package/dts/commands/shell/protocol.d.ts.map +0 -1
  251. package/dts/commands/shell/types.d.ts +0 -47
  252. package/dts/commands/shell/types.d.ts.map +0 -1
  253. package/dts/commands/shell/utils.d.ts.map +0 -1
  254. package/dts/commands/sync/index.d.ts +0 -8
  255. package/dts/commands/sync/index.d.ts.map +0 -1
  256. package/dts/commands/sync/list.d.ts +0 -17
  257. package/dts/commands/sync/list.d.ts.map +0 -1
  258. package/dts/commands/sync/pull.d.ts +0 -11
  259. package/dts/commands/sync/pull.d.ts.map +0 -1
  260. package/dts/commands/sync/push.d.ts +0 -8
  261. package/dts/commands/sync/push.d.ts.map +0 -1
  262. package/dts/commands/sync/request.d.ts.map +0 -1
  263. package/dts/commands/sync/response.d.ts.map +0 -1
  264. package/dts/commands/sync/stat.d.ts.map +0 -1
  265. package/dts/commands/sync/sync.d.ts +0 -68
  266. package/dts/commands/sync/sync.d.ts.map +0 -1
  267. package/dts/crypto.d.ts +0 -24
  268. package/dts/crypto.d.ts.map +0 -1
  269. package/dts/features.d.ts +0 -6
  270. package/dts/features.d.ts.map +0 -1
  271. package/dts/index.d.ts +0 -11
  272. package/dts/index.d.ts.map +0 -1
  273. package/dts/packet.d.ts +0 -27
  274. package/dts/packet.d.ts.map +0 -1
  275. package/dts/socket/close-event-emitter.d.ts +0 -8
  276. package/dts/socket/close-event-emitter.d.ts.map +0 -1
  277. package/dts/socket/controller.d.ts +0 -43
  278. package/dts/socket/controller.d.ts.map +0 -1
  279. package/dts/socket/data-event-emitter.d.ts +0 -10
  280. package/dts/socket/data-event-emitter.d.ts.map +0 -1
  281. package/dts/socket/dispatcher.d.ts +0 -53
  282. package/dts/socket/dispatcher.d.ts.map +0 -1
  283. package/dts/socket/index.d.ts +0 -7
  284. package/dts/socket/index.d.ts.map +0 -1
  285. package/dts/socket/logger.d.ts +0 -9
  286. package/dts/socket/logger.d.ts.map +0 -1
  287. package/dts/socket/socket.d.ts +0 -22
  288. package/dts/socket/socket.d.ts.map +0 -1
  289. package/dts/stream/buffered-stream.d.ts +0 -28
  290. package/dts/stream/buffered-stream.d.ts.map +0 -1
  291. package/dts/stream/index.d.ts +0 -3
  292. package/dts/stream/index.d.ts.map +0 -1
  293. package/dts/stream/stream.d.ts +0 -15
  294. package/dts/stream/stream.d.ts.map +0 -1
  295. package/dts/utils/auto-reset-event.d.ts.map +0 -1
  296. package/dts/utils/base64.d.ts +0 -7
  297. package/dts/utils/base64.d.ts.map +0 -1
  298. package/dts/utils/chunk.d.ts +0 -3
  299. package/dts/utils/chunk.d.ts.map +0 -1
  300. package/dts/utils/encoding.d.ts +0 -3
  301. package/dts/utils/encoding.d.ts.map +0 -1
  302. package/dts/utils/event-queue.d.ts +0 -35
  303. package/dts/utils/event-queue.d.ts.map +0 -1
  304. package/dts/utils/index.d.ts +0 -6
  305. package/dts/utils/index.d.ts.map +0 -1
  306. package/esm/commands/demo-mode.js +0 -170
  307. package/esm/commands/demo-mode.js.map +0 -1
  308. package/esm/commands/shell/index.js +0 -62
  309. package/esm/commands/shell/index.js.map +0 -1
  310. package/esm/commands/shell/legacy.js +0 -49
  311. package/esm/commands/shell/legacy.js.map +0 -1
  312. package/esm/commands/shell/protocol.js +0 -106
  313. package/esm/commands/shell/protocol.js.map +0 -1
  314. package/esm/commands/shell/utils.js.map +0 -1
  315. package/esm/socket/close-event-emitter.js +0 -28
  316. package/esm/socket/close-event-emitter.js.map +0 -1
  317. package/esm/socket/data-event-emitter.js +0 -25
  318. package/esm/socket/data-event-emitter.js.map +0 -1
  319. package/esm/socket/logger.js +0 -2
  320. package/esm/socket/logger.js.map +0 -1
  321. package/esm/stream/buffered-stream.js +0 -67
  322. package/esm/stream/buffered-stream.js.map +0 -1
  323. package/esm/stream/stream.js +0 -41
  324. package/esm/stream/stream.js.map +0 -1
  325. package/esm/utils/chunk.js +0 -70
  326. package/esm/utils/chunk.js.map +0 -1
  327. package/esm/utils/event-queue.js +0 -104
  328. package/esm/utils/event-queue.js.map +0 -1
  329. package/src/commands/demo-mode.ts +0 -160
  330. package/src/commands/shell/index.ts +0 -87
  331. package/src/commands/shell/legacy.ts +0 -59
  332. package/src/commands/shell/protocol.ts +0 -121
  333. package/src/commands/shell/types.ts +0 -55
  334. package/src/socket/close-event-emitter.ts +0 -28
  335. package/src/socket/controller.ts +0 -105
  336. package/src/socket/data-event-emitter.ts +0 -27
  337. package/src/socket/logger.ts +0 -12
  338. package/src/stream/buffered-stream.ts +0 -92
  339. package/src/stream/stream.ts +0 -50
  340. package/src/utils/chunk.ts +0 -70
  341. package/src/utils/encoding.ts +0 -13
  342. package/src/utils/event-queue.ts +0 -145
@@ -0,0 +1,155 @@
1
+ import { PromiseResolver } from "@yume-chan/async";
2
+ import Struct, { placeholder } from "@yume-chan/struct";
3
+ import { AdbFeatures } from "../../../features.js";
4
+ import { pipeFrom, PushReadableStream, StructDeserializeStream, StructSerializeStream, TransformStream, WritableStream } from "../../../stream/index.js";
5
+ import { encodeUtf8 } from "../../../utils/index.js";
6
+ export var AdbShellProtocolId;
7
+ (function (AdbShellProtocolId) {
8
+ AdbShellProtocolId[AdbShellProtocolId["Stdin"] = 0] = "Stdin";
9
+ AdbShellProtocolId[AdbShellProtocolId["Stdout"] = 1] = "Stdout";
10
+ AdbShellProtocolId[AdbShellProtocolId["Stderr"] = 2] = "Stderr";
11
+ AdbShellProtocolId[AdbShellProtocolId["Exit"] = 3] = "Exit";
12
+ AdbShellProtocolId[AdbShellProtocolId["CloseStdin"] = 4] = "CloseStdin";
13
+ AdbShellProtocolId[AdbShellProtocolId["WindowSizeChange"] = 5] = "WindowSizeChange";
14
+ })(AdbShellProtocolId = AdbShellProtocolId || (AdbShellProtocolId = {}));
15
+ // This packet format is used in both direction.
16
+ const AdbShellProtocolPacket = new Struct({ littleEndian: true })
17
+ .uint8('id', placeholder())
18
+ .uint32('length')
19
+ .uint8Array('data', { lengthField: 'length' });
20
+ class StdinSerializeStream extends TransformStream {
21
+ constructor() {
22
+ super({
23
+ transform(chunk, controller) {
24
+ controller.enqueue({
25
+ id: AdbShellProtocolId.Stdin,
26
+ data: chunk,
27
+ });
28
+ },
29
+ flush() {
30
+ // TODO: AdbShellSubprocessProtocol: support closing stdin
31
+ }
32
+ });
33
+ }
34
+ }
35
+ class StdoutDeserializeStream extends TransformStream {
36
+ constructor(type) {
37
+ super({
38
+ transform(chunk, controller) {
39
+ if (chunk.id === type) {
40
+ controller.enqueue(chunk.data);
41
+ }
42
+ },
43
+ });
44
+ }
45
+ }
46
+ class MultiplexStream {
47
+ _readable;
48
+ _readableController;
49
+ get readable() { return this._readable; }
50
+ _activeCount = 0;
51
+ constructor() {
52
+ this._readable = new PushReadableStream(controller => {
53
+ this._readableController = controller;
54
+ });
55
+ }
56
+ createWriteable() {
57
+ return new WritableStream({
58
+ start: () => {
59
+ this._activeCount += 1;
60
+ },
61
+ write: async (chunk) => {
62
+ await this._readableController.enqueue(chunk);
63
+ },
64
+ abort: async (e) => {
65
+ this._activeCount -= 1;
66
+ if (this._activeCount === 0) {
67
+ this._readableController.close();
68
+ }
69
+ },
70
+ close: async () => {
71
+ this._activeCount -= 1;
72
+ if (this._activeCount === 0) {
73
+ this._readableController.close();
74
+ }
75
+ },
76
+ });
77
+ }
78
+ }
79
+ /**
80
+ * Shell v2 a.k.a Shell Protocol
81
+ *
82
+ * Features:
83
+ * * `stderr`: Yes
84
+ * * `exit` exit code: Yes
85
+ * * `resize`: Yes
86
+ */
87
+ export class AdbSubprocessShellProtocol {
88
+ static isSupported(adb) {
89
+ return adb.features.includes(AdbFeatures.ShellV2);
90
+ }
91
+ static async pty(adb, command) {
92
+ // TODO: AdbShellSubprocessProtocol: Support setting `XTERM` environment variable
93
+ return new AdbSubprocessShellProtocol(await adb.createSocket(`shell,v2,pty:${command}`));
94
+ }
95
+ static async raw(adb, command) {
96
+ return new AdbSubprocessShellProtocol(await adb.createSocket(`shell,v2,raw:${command}`));
97
+ }
98
+ _socket;
99
+ _socketWriter;
100
+ _stdin;
101
+ get stdin() { return this._stdin; }
102
+ _stdout;
103
+ get stdout() { return this._stdout; }
104
+ _stderr;
105
+ get stderr() { return this._stderr; }
106
+ _exit = new PromiseResolver();
107
+ get exit() { return this._exit.promise; }
108
+ constructor(socket) {
109
+ this._socket = socket;
110
+ // Check this image to help you understand the stream graph
111
+ // cspell: disable-next-line
112
+ // https://www.plantuml.com/plantuml/png/bL91QiCm4Bpx5SAdv90lb1JISmiw5XzaQKf5PIkiLZIqzEyLSg8ks13gYtOykpFhiOw93N6UGjVDqK7rZsxKqNw0U_NTgVAy4empOy2mm4_olC0VEVEE47GUpnGjKdgXoD76q4GIEpyFhOwP_m28hW0NNzxNUig1_JdW0bA7muFIJDco1daJ_1SAX9bgvoPJPyIkSekhNYctvIGXrCH6tIsPL5fs-s6J5yc9BpWXhKtNdF2LgVYPGM_6GlMwfhWUsIt4lbScANrwlgVVUifPSVi__t44qStnwPvZwobdSmHHlL57p2vFuHS0
113
+ // TODO: AdbShellSubprocessProtocol: Optimize stream graph
114
+ const [stdout, stderr] = socket.readable
115
+ .pipeThrough(new StructDeserializeStream(AdbShellProtocolPacket))
116
+ .pipeThrough(new TransformStream({
117
+ transform: (chunk, controller) => {
118
+ if (chunk.id === AdbShellProtocolId.Exit) {
119
+ this._exit.resolve(new Uint8Array(chunk.data)[0]);
120
+ // We can let `StdoutDeserializeStream` to process `AdbShellProtocolId.Exit`,
121
+ // but since we need this `TransformStream` to capture the exit code anyway,
122
+ // terminating child streams here is killing two birds with one stone.
123
+ controller.terminate();
124
+ return;
125
+ }
126
+ controller.enqueue(chunk);
127
+ }
128
+ }))
129
+ .tee();
130
+ this._stdout = stdout
131
+ .pipeThrough(new StdoutDeserializeStream(AdbShellProtocolId.Stdout));
132
+ this._stderr = stderr
133
+ .pipeThrough(new StdoutDeserializeStream(AdbShellProtocolId.Stderr));
134
+ const multiplexer = new MultiplexStream();
135
+ multiplexer.readable
136
+ .pipeThrough(new StructSerializeStream(AdbShellProtocolPacket))
137
+ .pipeTo(socket.writable);
138
+ this._stdin = pipeFrom(multiplexer.createWriteable(), new StdinSerializeStream());
139
+ this._socketWriter = multiplexer.createWriteable().getWriter();
140
+ }
141
+ async resize(rows, cols) {
142
+ await this._socketWriter.write({
143
+ id: AdbShellProtocolId.WindowSizeChange,
144
+ data: encodeUtf8(
145
+ // The "correct" format is `${rows}x${cols},${x_pixels}x${y_pixels}`
146
+ // However, according to https://linux.die.net/man/4/tty_ioctl
147
+ // `x_pixels` and `y_pixels` are not used, so always passing `0` is fine.
148
+ `${rows}x${cols},0x0\0`),
149
+ });
150
+ }
151
+ kill() {
152
+ return this._socket.close();
153
+ }
154
+ }
155
+ //# sourceMappingURL=shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,MAAM,EAAE,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AAE9E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAkB,uBAAuB,EAAE,qBAAqB,EAAE,eAAe,EAAE,cAAc,EAAkE,MAAM,0BAA0B,CAAC;AACzO,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,MAAM,CAAN,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC1B,6DAAK,CAAA;IACL,+DAAM,CAAA;IACN,+DAAM,CAAA;IACN,2DAAI,CAAA;IACJ,uEAAU,CAAA;IACV,mFAAgB,CAAA;AACpB,CAAC,EAPW,kBAAkB,GAAlB,kBAAkB,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WAAW,CAAC,IAAI,uBAAuB,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;QAEzE,MAAM,WAAW,GAAG,IAAI,eAAe,EAA8B,CAAC;QACtE,WAAW,CAAC,QAAQ;aACf,WAAW,CAAC,IAAI,qBAAqB,CAAC,sBAAsB,CAAC,CAAC;aAC9D,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAE7B,IAAI,CAAC,MAAM,GAAG,QAAQ,CAClB,WAAW,CAAC,eAAe,EAAE,EAC7B,IAAI,oBAAoB,EAAE,CAC7B,CAAC;QAEF,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC,eAAe,EAAE,CAAC,SAAS,EAAE,CAAC;IACnE,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,IAAY;QAC1C,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YAC3B,EAAE,EAAE,kBAAkB,CAAC,gBAAgB;YACvC,IAAI,EAAE,UAAU;YACZ,oEAAoE;YACpE,8DAA8D;YAC9D,yEAAyE;YACzE,GAAG,IAAI,IAAI,IAAI,QAAQ,CAC1B;SACJ,CAAC,CAAC;IACP,CAAC;IAEM,IAAI;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;CACJ"}
@@ -0,0 +1,50 @@
1
+ import type { ValueOrPromise } from "@yume-chan/struct";
2
+ import type { Adb } from "../../../adb.js";
3
+ import type { AdbSocket } from "../../../socket/index.js";
4
+ import type { ReadableStream, WritableStream } from "../../../stream/index.js";
5
+ export interface AdbSubprocessProtocol {
6
+ /**
7
+ * A WritableStream that writes to the `stdin` pipe.
8
+ */
9
+ readonly stdin: WritableStream<Uint8Array>;
10
+ /**
11
+ * The `stdout` pipe of the process.
12
+ */
13
+ readonly stdout: ReadableStream<Uint8Array>;
14
+ /**
15
+ * The `stderr` pipe of the process.
16
+ *
17
+ * Note: Some `AdbSubprocessProtocol` doesn't separate `stdout` and `stderr`,
18
+ * All output will be sent to `stdout`.
19
+ */
20
+ readonly stderr: ReadableStream<Uint8Array>;
21
+ /**
22
+ * A `Promise` that resolves to the exit code of the process.
23
+ *
24
+ * Note: Some `AdbSubprocessProtocol` doesn't support exit code,
25
+ * They will always resolve it with `0`.
26
+ */
27
+ readonly exit: Promise<number>;
28
+ /**
29
+ * Resizes the current shell.
30
+ *
31
+ * Some `AdbSubprocessProtocol`s may not support resizing
32
+ * and will ignore calls to this method.
33
+ */
34
+ resize(rows: number, cols: number): ValueOrPromise<void>;
35
+ /**
36
+ * Kills the current process.
37
+ */
38
+ kill(): ValueOrPromise<void>;
39
+ }
40
+ export interface AdbSubprocessProtocolConstructor {
41
+ /** Returns `true` if the `adb` instance supports this shell */
42
+ isSupported(adb: Adb): ValueOrPromise<boolean>;
43
+ /** Spawns an executable in PTY (interactive) mode. */
44
+ pty(adb: Adb, command: string): ValueOrPromise<AdbSubprocessProtocol>;
45
+ /** Spawns an executable and pipe the output. */
46
+ raw(adb: Adb, command: string): ValueOrPromise<AdbSubprocessProtocol>;
47
+ /** Creates a new `AdbShell` by attaching to an exist `AdbSocket` */
48
+ new (socket: AdbSocket): AdbSubprocessProtocol;
49
+ }
50
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/E,MAAM,WAAW,qBAAqB;IAClC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAE3C;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAE5C;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAE5C;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAE/B;;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAEzD;;OAEG;IACH,IAAI,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,gCAAgC;IAC7C,+DAA+D;IAC/D,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAE/C,sDAAsD;IACtD,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,qBAAqB,CAAC,CAAC;IAEtE,gDAAgD;IAChD,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,qBAAqB,CAAC,CAAC;IAEtE,oEAAoE;IACpE,KAAI,MAAM,EAAE,SAAS,GAAG,qBAAqB,CAAC;CACjD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,50 @@
1
+ import type { ValueOrPromise } from "@yume-chan/struct";
2
+ import type { Adb } from "../../adb.js";
3
+ import type { AdbSocket } from "../../socket/index.js";
4
+ import type { ReadableStream, WritableStream } from "../../stream/index.js";
5
+ export interface AdbSubprocessProtocol {
6
+ /**
7
+ * A WritableStream that writes to the `stdin` pipe.
8
+ */
9
+ readonly stdin: WritableStream<Uint8Array>;
10
+ /**
11
+ * The `stdout` pipe of the process.
12
+ */
13
+ readonly stdout: ReadableStream<Uint8Array>;
14
+ /**
15
+ * The `stderr` pipe of the process.
16
+ *
17
+ * Note: Some `AdbSubprocessProtocol` doesn't separate `stdout` and `stderr`,
18
+ * All output will be sent to `stdout`.
19
+ */
20
+ readonly stderr: ReadableStream<Uint8Array>;
21
+ /**
22
+ * A `Promise` that resolves to the exit code of the process.
23
+ *
24
+ * Note: Some `AdbSubprocessProtocol` doesn't support exit code,
25
+ * They will always resolve it with `0`.
26
+ */
27
+ readonly exit: Promise<number>;
28
+ /**
29
+ * Resizes the current shell.
30
+ *
31
+ * Some `AdbSubprocessProtocol`s may not support resizing
32
+ * and will ignore calls to this method.
33
+ */
34
+ resize(rows: number, cols: number): ValueOrPromise<void>;
35
+ /**
36
+ * Kills the current process.
37
+ */
38
+ kill(): ValueOrPromise<void>;
39
+ }
40
+ export interface AdbSubprocessProtocolConstructor {
41
+ /** Returns `true` if the `adb` instance supports this shell */
42
+ isSupported(adb: Adb): ValueOrPromise<boolean>;
43
+ /** Spawns an executable in PTY (interactive) mode. */
44
+ pty(adb: Adb, command: string): ValueOrPromise<AdbSubprocessProtocol>;
45
+ /** Spawns an executable and pipe the output. */
46
+ raw(adb: Adb, command: string): ValueOrPromise<AdbSubprocessProtocol>;
47
+ /** Creates a new `AdbShell` by attaching to an exist `AdbSocket` */
48
+ new (socket: AdbSocket): AdbSubprocessProtocol;
49
+ }
50
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/commands/subprocess/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5E,MAAM,WAAW,qBAAqB;IAClC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAE3C;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAE5C;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAE5C;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAE/B;;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAEzD;;OAEG;IACH,IAAI,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,gCAAgC;IAC7C,+DAA+D;IAC/D,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAE/C,sDAAsD;IACtD,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,qBAAqB,CAAC,CAAC;IAEtE,gDAAgD;IAChD,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,qBAAqB,CAAC,CAAC;IAEtE,oEAAoE;IACpE,KAAI,MAAM,EAAE,SAAS,GAAG,qBAAqB,CAAC;CACjD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/commands/shell/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/commands/subprocess/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/commands/subprocess/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,UAmBlC"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/commands/subprocess/utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS,CAAC,CAAS;IAC/B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,MAAM,IAAI,GAAG,CAAC;IAEd,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,OAAO,IAAI,EAAE;QACT,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACnC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACd,MAAM,IAAI,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5B,MAAM;SACT;QACD,MAAM,IAAI,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACnC,oBAAoB;QACpB,MAAM,IAAI,MAAM,CAAC,GAAG,CAAA,MAAM,CAAC;QAC3B,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC;KACpB;IAED,MAAM,IAAI,GAAG,CAAC;IACd,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * from './list.js';
2
+ export * from './pull.js';
3
+ export * from './request.js';
4
+ export * from './response.js';
5
+ export * from './push.js';
6
+ export * from './stat.js';
7
+ export * from './sync.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
@@ -1,8 +1,8 @@
1
- export * from './list';
2
- export * from './pull';
3
- export * from './request';
4
- export * from './response';
5
- export * from './push';
6
- export * from './stat';
7
- export * from './sync';
1
+ export * from './list.js';
2
+ export * from './pull.js';
3
+ export * from './request.js';
4
+ export * from './response.js';
5
+ export * from './push.js';
6
+ export * from './stat.js';
7
+ export * from './sync.js';
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,41 @@
1
+ import Struct from '@yume-chan/struct';
2
+ import type { AdbBufferedStream, WritableStreamDefaultWriter } from '../../stream/index.js';
3
+ import { AdbSyncResponseId } from './response.js';
4
+ import { type AdbSyncStat } from './stat.js';
5
+ export interface AdbSyncEntry extends AdbSyncStat {
6
+ name: string;
7
+ }
8
+ export declare const AdbSyncEntryResponse: Struct<{
9
+ mode: number;
10
+ size: number;
11
+ mtime: number;
12
+ nameLength: number;
13
+ name: string;
14
+ }, "nameLength", {
15
+ readonly type: import("./stat.js").LinuxFileType;
16
+ readonly permission: number;
17
+ id: AdbSyncResponseId.Entry;
18
+ }, undefined>;
19
+ export declare type AdbSyncEntryResponse = typeof AdbSyncEntryResponse['TDeserializeResult'];
20
+ export declare const AdbSyncEntry2Response: Struct<{
21
+ error: import("./stat.js").AdbSyncStatErrorCode;
22
+ dev: bigint;
23
+ ino: bigint;
24
+ mode: number;
25
+ nlink: number;
26
+ uid: number;
27
+ gid: number;
28
+ size: bigint;
29
+ atime: bigint;
30
+ mtime: bigint;
31
+ ctime: bigint;
32
+ nameLength: number;
33
+ name: string;
34
+ }, "nameLength", {
35
+ readonly type: import("./stat.js").LinuxFileType;
36
+ readonly permission: number;
37
+ id: AdbSyncResponseId.Entry2;
38
+ }, undefined>;
39
+ export declare type AdbSyncEntry2Response = typeof AdbSyncEntry2Response['TDeserializeResult'];
40
+ export declare function adbSyncOpenDir(stream: AdbBufferedStream, writer: WritableStreamDefaultWriter<Uint8Array>, path: string, v2: boolean): AsyncGenerator<AdbSyncEntry, void, void>;
41
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/list.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,EAA4C,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC5F,OAAO,EAA6C,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAExF,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC7C,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,oBAAoB;;;;;;;;;;aAKuB,CAAC;AAEzD,oBAAY,oBAAoB,GAAG,OAAO,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;AAErF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;aAKuB,CAAC;AAE1D,oBAAY,qBAAqB,GAAG,OAAO,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;AAYvF,wBAAuB,cAAc,CACjC,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,EAC/C,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,OAAO,GACZ,cAAc,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CA0C1C"}
@@ -1,32 +1,64 @@
1
- import { __asyncGenerator, __await } from "tslib";
2
1
  import Struct from '@yume-chan/struct';
3
- import { AdbSyncRequestId, adbSyncWriteRequest } from './request';
4
- import { AdbSyncDoneResponse, adbSyncReadResponse, AdbSyncResponseId } from './response';
5
- import { AdbSyncLstatResponse } from './stat';
2
+ import { AdbSyncRequestId, adbSyncWriteRequest } from './request.js';
3
+ import { AdbSyncDoneResponse, adbSyncReadResponse, AdbSyncResponseId } from './response.js';
4
+ import { AdbSyncLstatResponse, AdbSyncStatResponse } from './stat.js';
6
5
  export const AdbSyncEntryResponse = new Struct({ littleEndian: true })
7
6
  .fields(AdbSyncLstatResponse)
8
7
  .uint32('nameLength')
9
8
  .string('name', { lengthField: 'nameLength' })
10
9
  .extra({ id: AdbSyncResponseId.Entry });
11
- const ResponseTypes = {
10
+ export const AdbSyncEntry2Response = new Struct({ littleEndian: true })
11
+ .fields(AdbSyncStatResponse)
12
+ .uint32('nameLength')
13
+ .string('name', { lengthField: 'nameLength' })
14
+ .extra({ id: AdbSyncResponseId.Entry2 });
15
+ const LIST_V1_RESPONSE_TYPES = {
12
16
  [AdbSyncResponseId.Entry]: AdbSyncEntryResponse,
13
17
  [AdbSyncResponseId.Done]: new AdbSyncDoneResponse(AdbSyncEntryResponse.size),
14
18
  };
15
- export function adbSyncOpenDir(stream, path) {
16
- return __asyncGenerator(this, arguments, function* adbSyncOpenDir_1() {
17
- yield __await(adbSyncWriteRequest(stream, AdbSyncRequestId.List, path));
18
- while (true) {
19
- const response = yield __await(adbSyncReadResponse(stream, ResponseTypes));
20
- switch (response.id) {
21
- case AdbSyncResponseId.Entry:
22
- yield yield __await(response);
23
- break;
24
- case AdbSyncResponseId.Done:
25
- return yield __await(void 0);
26
- default:
27
- throw new Error('Unexpected response id');
28
- }
19
+ const LIST_V2_RESPONSE_TYPES = {
20
+ [AdbSyncResponseId.Entry2]: AdbSyncEntry2Response,
21
+ [AdbSyncResponseId.Done]: new AdbSyncDoneResponse(AdbSyncEntry2Response.size),
22
+ };
23
+ export async function* adbSyncOpenDir(stream, writer, path, v2) {
24
+ let requestId;
25
+ let responseType;
26
+ if (v2) {
27
+ requestId = AdbSyncRequestId.List2;
28
+ responseType = LIST_V2_RESPONSE_TYPES;
29
+ }
30
+ else {
31
+ requestId = AdbSyncRequestId.List;
32
+ responseType = LIST_V1_RESPONSE_TYPES;
33
+ }
34
+ await adbSyncWriteRequest(writer, requestId, path);
35
+ while (true) {
36
+ const response = await adbSyncReadResponse(stream, responseType);
37
+ switch (response.id) {
38
+ case AdbSyncResponseId.Entry:
39
+ yield {
40
+ mode: response.mode,
41
+ size: BigInt(response.size),
42
+ mtime: BigInt(response.mtime),
43
+ get type() { return response.type; },
44
+ get permission() { return response.permission; },
45
+ name: response.name,
46
+ };
47
+ break;
48
+ case AdbSyncResponseId.Entry2:
49
+ // `LST2` can return error codes for failed `lstat` calls.
50
+ // `LIST` just ignores them.
51
+ // But they only contain `name` so still pretty useless.
52
+ if (response.error !== 0) {
53
+ continue;
54
+ }
55
+ yield response;
56
+ break;
57
+ case AdbSyncResponseId.Done:
58
+ return;
59
+ default:
60
+ throw new Error('Unexpected response id');
29
61
  }
30
- });
62
+ }
31
63
  }
32
64
  //# sourceMappingURL=list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/sync/list.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAE9C,MAAM,CAAC,MAAM,oBAAoB,GAC7B,IAAI,MAAM,CA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AAG,sBAAsB,CAAC;KACzC;SAAM;QACH,SAAS,GAAG,gBAAgB,CAAC,IAAI,CAAC;QAClC,YAAY,GAAG,sBAAsB,CAAC;KACzC;IAED,MAAM,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAEnD,OAAO,IAAI,EAAE;QACT,MAAM,QAAQ,GAAG,MAAM,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACjE,QAAQ,QAAQ,CAAC,EAAE,EAAE;YACjB,KAAK,iBAAiB,CAAC,KAAK;gBACxB,MAAM;oBACF,IAAI,EAAE,QAAQ,CAAC,IAAI;oBACnB,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;oBAC3B,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;oBAC7B,IAAI,IAAI,KAAK,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;oBACpC,IAAI,UAAU,KAAK,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;oBAChD,IAAI,EAAE,QAAQ,CAAC,IAAI;iBACtB,CAAC;gBACF,MAAM;YACV,KAAK,iBAAiB,CAAC,MAAM;gBACzB,0DAA0D;gBAC1D,4BAA4B;gBAC5B,wDAAwD;gBACxD,IAAI,QAAQ,CAAC,KAAK,KAAK,CAAC,EAAE;oBACtB,SAAS;iBACZ;gBACD,MAAM,QAAQ,CAAC;gBACf,MAAM;YACV,KAAK,iBAAiB,CAAC,IAAI;gBACvB,OAAO;YACX;gBACI,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SACjD;KACJ;AACL,CAAC"}
@@ -0,0 +1,11 @@
1
+ import Struct from '@yume-chan/struct';
2
+ import { AdbBufferedStream, ReadableStream, WritableStreamDefaultWriter } from '../../stream/index.js';
3
+ import { AdbSyncResponseId } from './response.js';
4
+ export declare const AdbSyncDataResponse: Struct<{
5
+ dataLength: number;
6
+ data: Uint8Array;
7
+ }, "dataLength", {
8
+ id: AdbSyncResponseId.Data;
9
+ }, undefined>;
10
+ export declare function adbSyncPull(stream: AdbBufferedStream, writer: WritableStreamDefaultWriter<Uint8Array>, path: string): ReadableStream<Uint8Array>;
11
+ //# sourceMappingURL=pull.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/pull.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEvG,OAAO,EAA4C,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE5F,eAAO,MAAM,mBAAmB;;;;;aAIuB,CAAC;AAOxD,wBAAgB,WAAW,CACvB,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,EAC/C,IAAI,EAAE,MAAM,GACb,cAAc,CAAC,UAAU,CAAC,CAsB5B"}
@@ -1,30 +1,36 @@
1
- import { __asyncGenerator, __await } from "tslib";
2
1
  import Struct from '@yume-chan/struct';
3
- import { AdbSyncRequestId, adbSyncWriteRequest } from './request';
4
- import { AdbSyncDoneResponse, adbSyncReadResponse, AdbSyncResponseId } from './response';
2
+ import { ReadableStream } from '../../stream/index.js';
3
+ import { AdbSyncRequestId, adbSyncWriteRequest } from './request.js';
4
+ import { AdbSyncDoneResponse, adbSyncReadResponse, AdbSyncResponseId } from './response.js';
5
5
  export const AdbSyncDataResponse = new Struct({ littleEndian: true })
6
6
  .uint32('dataLength')
7
- .arrayBuffer('data', { lengthField: 'dataLength' })
7
+ .uint8Array('data', { lengthField: 'dataLength' })
8
8
  .extra({ id: AdbSyncResponseId.Data });
9
9
  const ResponseTypes = {
10
10
  [AdbSyncResponseId.Data]: AdbSyncDataResponse,
11
11
  [AdbSyncResponseId.Done]: new AdbSyncDoneResponse(AdbSyncDataResponse.size),
12
12
  };
13
- export function adbSyncPull(stream, path) {
14
- return __asyncGenerator(this, arguments, function* adbSyncPull_1() {
15
- yield __await(adbSyncWriteRequest(stream, AdbSyncRequestId.Receive, path));
16
- while (true) {
17
- const response = yield __await(adbSyncReadResponse(stream, ResponseTypes));
13
+ export function adbSyncPull(stream, writer, path) {
14
+ return new ReadableStream({
15
+ async start() {
16
+ await adbSyncWriteRequest(writer, AdbSyncRequestId.Receive, path);
17
+ },
18
+ async pull(controller) {
19
+ const response = await adbSyncReadResponse(stream, ResponseTypes);
18
20
  switch (response.id) {
19
21
  case AdbSyncResponseId.Data:
20
- yield yield __await(response.data);
22
+ controller.enqueue(response.data);
21
23
  break;
22
24
  case AdbSyncResponseId.Done:
23
- return yield __await(void 0);
25
+ controller.close();
26
+ break;
24
27
  default:
25
28
  throw new Error('Unexpected response id');
26
29
  }
27
30
  }
31
+ }, {
32
+ highWaterMark: 16 * 1024,
33
+ size(chunk) { return chunk.byteLength; }
28
34
  });
29
35
  }
30
36
  //# sourceMappingURL=pull.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../src/commands/sync/pull.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEzF,MAAM,CAAC,MAAM,mBAAmB,GAC5B,IAAI,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;KAC7B,MAAM,CAAC,YAAY,CAAC;KACpB,WAAW,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;KAClD,KAAK,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,IAAa,EAAE,CAAC,CAAC;AAExD,MAAM,aAAa,GAAG;IAClB,CAAC,iBAAiB,CAAC,IAAI,CAAC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AG;IAClB,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,mBAAmB;IAC7C,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,IAAI,CAAC;CAC9E,CAAC;AAEF,MAAM,UAAU,WAAW,CACvB,MAAyB,EACzB,MAA+C,EAC/C,IAAY;IAEZ,OAAO,IAAI,cAAc,CAAa;QAClC,KAAK,CAAC,KAAK;YACP,MAAM,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACtE,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,UAAU;YACjB,MAAM,QAAQ,GAAG,MAAM,mBAAmB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YAClE,QAAQ,QAAQ,CAAC,EAAE,EAAE;gBACjB,KAAK,iBAAiB,CAAC,IAAI;oBACvB,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAK,CAAC,CAAC;oBACnC,MAAM;gBACV,KAAK,iBAAiB,CAAC,IAAI;oBACvB,UAAU,CAAC,KAAK,EAAE,CAAC;oBACnB,MAAM;gBACV;oBACI,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;aACjD;QACL,CAAC;KACJ,EAAE;QACC,aAAa,EAAE,EAAE,GAAG,IAAI;QACxB,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;KAC3C,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,8 @@
1
+ import Struct from '@yume-chan/struct';
2
+ import { AdbBufferedStream, WritableStream, WritableStreamDefaultWriter } from '../../stream/index.js';
3
+ export declare const AdbSyncOkResponse: Struct<{
4
+ unused: number;
5
+ }, never, {}, undefined>;
6
+ export declare const ADB_SYNC_MAX_PACKET_SIZE: number;
7
+ export declare function adbSyncPush(stream: AdbBufferedStream, writer: WritableStreamDefaultWriter<Uint8Array>, filename: string, mode?: number, mtime?: number, packetSize?: number): WritableStream<Uint8Array>;
8
+ //# sourceMappingURL=push.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/push.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAyB,cAAc,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAK9H,eAAO,MAAM,iBAAiB;;wBAEL,CAAC;AAM1B,eAAO,MAAM,wBAAwB,QAAY,CAAC;AAElD,wBAAgB,WAAW,CACvB,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,EAC/C,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,MAA2C,EACjD,KAAK,GAAE,MAAgC,EACvC,UAAU,GAAE,MAAiC,GAC9C,cAAc,CAAC,UAAU,CAAC,CAiB5B"}