@yume-chan/adb 2.6.0 → 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/esm/adb.d.ts +18 -15
- package/esm/adb.d.ts.map +1 -1
- package/esm/adb.js +18 -11
- package/esm/adb.js.map +1 -1
- package/esm/banner.d.ts +1 -1
- package/esm/banner.d.ts.map +1 -1
- package/esm/daemon/auth/authenticator.d.ts +28 -0
- package/esm/daemon/auth/authenticator.d.ts.map +1 -0
- package/esm/daemon/auth/authenticator.js +108 -0
- package/esm/daemon/auth/authenticator.js.map +1 -0
- package/esm/daemon/auth/index.d.ts +5 -0
- package/esm/daemon/auth/index.d.ts.map +1 -0
- package/esm/daemon/auth/index.js +5 -0
- package/esm/daemon/auth/index.js.map +1 -0
- package/esm/daemon/auth/packet-processor.d.ts +42 -0
- package/esm/daemon/auth/packet-processor.d.ts.map +1 -0
- package/esm/daemon/auth/packet-processor.js +129 -0
- package/esm/daemon/auth/packet-processor.js.map +1 -0
- package/esm/daemon/auth/public-key.d.ts +8 -0
- package/esm/daemon/auth/public-key.d.ts.map +1 -0
- package/esm/daemon/auth/public-key.js +74 -0
- package/esm/daemon/auth/public-key.js.map +1 -0
- package/esm/daemon/auth/type.d.ts +5 -0
- package/esm/daemon/auth/type.d.ts.map +1 -0
- package/esm/daemon/auth/type.js +2 -0
- package/esm/daemon/auth/type.js.map +1 -0
- package/esm/daemon/crypto.d.ts +6 -5
- package/esm/daemon/crypto.d.ts.map +1 -1
- package/esm/daemon/crypto.js +23 -73
- package/esm/daemon/crypto.js.map +1 -1
- package/esm/daemon/dispatcher.d.ts +3 -3
- package/esm/daemon/dispatcher.d.ts.map +1 -1
- package/esm/daemon/dispatcher.js +11 -4
- package/esm/daemon/dispatcher.js.map +1 -1
- package/esm/daemon/index.d.ts +1 -1
- package/esm/daemon/index.d.ts.map +1 -1
- package/esm/daemon/index.js +1 -1
- package/esm/daemon/index.js.map +1 -1
- package/esm/daemon/socket.d.ts +3 -3
- package/esm/daemon/socket.d.ts.map +1 -1
- package/esm/daemon/transport.d.ts +13 -65
- package/esm/daemon/transport.d.ts.map +1 -1
- package/esm/daemon/transport.js +18 -140
- package/esm/daemon/transport.js.map +1 -1
- package/esm/device-observer.d.ts +2 -3
- package/esm/device-observer.d.ts.map +1 -1
- package/esm/features-value.d.ts +40 -0
- package/esm/features-value.d.ts.map +1 -0
- package/esm/features-value.js +46 -0
- package/esm/features-value.js.map +1 -0
- package/esm/features.d.ts +4 -12
- package/esm/features.d.ts.map +1 -1
- package/esm/features.js +27 -13
- package/esm/features.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/server/client.d.ts +7 -7
- package/esm/server/client.d.ts.map +1 -1
- package/esm/server/client.js +69 -86
- package/esm/server/client.js.map +1 -1
- package/esm/server/commands/wireless.js +1 -1
- package/esm/server/commands/wireless.js.map +1 -1
- package/esm/server/{stream.d.ts → data-connection.d.ts} +5 -5
- package/esm/server/data-connection.d.ts.map +1 -0
- package/esm/server/{stream.js → data-connection.js} +4 -4
- package/esm/server/data-connection.js.map +1 -0
- package/esm/server/index.d.ts +1 -1
- package/esm/server/index.d.ts.map +1 -1
- package/esm/server/index.js +1 -1
- package/esm/server/index.js.map +1 -1
- package/esm/server/observer.d.ts.map +1 -1
- package/esm/server/observer.js +14 -13
- package/esm/server/observer.js.map +1 -1
- package/esm/server/transport.d.ts +4 -6
- package/esm/server/transport.d.ts.map +1 -1
- package/esm/server/transport.js +9 -24
- package/esm/server/transport.js.map +1 -1
- package/esm/service/framebuffer.d.ts.map +1 -0
- package/esm/service/framebuffer.js.map +1 -0
- package/esm/{commands → service}/index.d.ts +1 -2
- package/esm/service/index.d.ts.map +1 -0
- package/esm/{commands → service}/index.js +1 -2
- package/esm/service/index.js.map +1 -0
- package/esm/{commands → service}/power.d.ts +4 -2
- package/esm/service/power.d.ts.map +1 -0
- package/esm/{commands → service}/power.js +11 -5
- package/esm/service/power.js.map +1 -0
- package/esm/service/reverse/error.d.ts +14 -0
- package/esm/service/reverse/error.d.ts.map +1 -0
- package/esm/service/reverse/error.js +21 -0
- package/esm/service/reverse/error.js.map +1 -0
- package/esm/service/reverse/index.d.ts +3 -0
- package/esm/service/reverse/index.d.ts.map +1 -0
- package/esm/service/reverse/index.js +4 -0
- package/esm/service/reverse/index.js.map +1 -0
- package/esm/service/reverse/response.d.ts +2 -0
- package/esm/service/reverse/response.d.ts.map +1 -0
- package/esm/service/reverse/response.js +30 -0
- package/esm/service/reverse/response.js.map +1 -0
- package/esm/service/reverse/service.d.ts +59 -0
- package/esm/service/reverse/service.d.ts.map +1 -0
- package/esm/{commands/reverse.js → service/reverse/service.js} +16 -45
- package/esm/service/reverse/service.js.map +1 -0
- package/esm/{commands → service}/subprocess/index.d.ts +1 -0
- package/esm/service/subprocess/index.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/index.js +1 -0
- package/esm/service/subprocess/index.js.map +1 -0
- package/esm/service/subprocess/none/index.d.ts.map +1 -0
- package/esm/service/subprocess/none/index.js.map +1 -0
- package/esm/{commands → service}/subprocess/none/process.d.ts +2 -2
- package/esm/service/subprocess/none/process.d.ts.map +1 -0
- package/esm/service/subprocess/none/process.js.map +1 -0
- package/esm/{commands → service}/subprocess/none/pty.d.ts +4 -4
- package/esm/service/subprocess/none/pty.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/none/pty.js +1 -1
- package/esm/service/subprocess/none/pty.js.map +1 -0
- package/esm/service/subprocess/none/service.d.ts +10 -0
- package/esm/service/subprocess/none/service.d.ts.map +1 -0
- package/esm/service/subprocess/none/service.js +44 -0
- package/esm/service/subprocess/none/service.js.map +1 -0
- package/esm/service/subprocess/none/spawner.d.ts +15 -0
- package/esm/service/subprocess/none/spawner.d.ts.map +1 -0
- package/esm/service/subprocess/none/spawner.js +31 -0
- package/esm/service/subprocess/none/spawner.js.map +1 -0
- package/esm/{commands → service}/subprocess/pty.d.ts +1 -1
- package/esm/service/subprocess/pty.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/pty.js.map +1 -1
- package/esm/service/subprocess/service.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/service.js +1 -1
- package/esm/service/subprocess/service.js.map +1 -0
- package/esm/service/subprocess/shell/index.d.ts +5 -0
- package/esm/{commands/subprocess/none → service/subprocess/shell}/index.d.ts.map +1 -1
- package/esm/service/subprocess/shell/index.js +6 -0
- package/esm/{commands/subprocess/none → service/subprocess/shell}/index.js.map +1 -1
- package/esm/{commands → service}/subprocess/shell/process.d.ts +2 -2
- package/esm/service/subprocess/shell/process.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/shell/process.js +4 -6
- package/esm/service/subprocess/shell/process.js.map +1 -0
- package/esm/{commands → service}/subprocess/shell/pty.d.ts +4 -4
- package/esm/service/subprocess/shell/pty.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/shell/pty.js +11 -9
- package/esm/service/subprocess/shell/pty.js.map +1 -0
- package/esm/service/subprocess/shell/service.d.ts +34 -0
- package/esm/service/subprocess/shell/service.d.ts.map +1 -0
- package/esm/service/subprocess/shell/service.js +52 -0
- package/esm/service/subprocess/shell/service.js.map +1 -0
- package/esm/service/subprocess/shell/shared.d.ts +2 -0
- package/esm/service/subprocess/shell/shared.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/shell/shared.js +2 -0
- package/esm/service/subprocess/shell/shared.js.map +1 -0
- package/esm/{commands → service}/subprocess/shell/spawner.d.ts +3 -7
- package/esm/service/subprocess/shell/spawner.d.ts.map +1 -0
- package/esm/service/subprocess/shell/spawner.js +45 -0
- package/esm/service/subprocess/shell/spawner.js.map +1 -0
- package/esm/service/subprocess/types.d.ts +14 -0
- package/esm/service/subprocess/types.d.ts.map +1 -0
- package/esm/service/subprocess/types.js +2 -0
- package/esm/service/subprocess/types.js.map +1 -0
- package/esm/service/subprocess/utils.d.ts +39 -0
- package/esm/service/subprocess/utils.d.ts.map +1 -0
- package/esm/service/subprocess/utils.js +142 -0
- package/esm/service/subprocess/utils.js.map +1 -0
- package/esm/service/sync/android.d.ts +34 -0
- package/esm/service/sync/android.d.ts.map +1 -0
- package/esm/service/sync/android.js +34 -0
- package/esm/service/sync/android.js.map +1 -0
- package/esm/service/sync/compression/compression.d.ts +17 -0
- package/esm/service/sync/compression/compression.d.ts.map +1 -0
- package/esm/service/sync/compression/compression.js +92 -0
- package/esm/service/sync/compression/compression.js.map +1 -0
- package/esm/service/sync/compression/format-ns.d.ts +5 -0
- package/esm/service/sync/compression/format-ns.d.ts.map +1 -0
- package/esm/service/sync/compression/format-ns.js +5 -0
- package/esm/service/sync/compression/format-ns.js.map +1 -0
- package/esm/service/sync/compression/format.d.ts +4 -0
- package/esm/service/sync/compression/format.d.ts.map +1 -0
- package/esm/service/sync/compression/format.js +3 -0
- package/esm/service/sync/compression/format.js.map +1 -0
- package/esm/service/sync/compression/index.d.ts +2 -0
- package/esm/service/sync/compression/index.d.ts.map +1 -0
- package/esm/service/sync/compression/index.js +2 -0
- package/esm/service/sync/compression/index.js.map +1 -0
- package/esm/service/sync/id/common.d.ts +17 -0
- package/esm/service/sync/id/common.d.ts.map +1 -0
- package/esm/service/sync/id/common.js +29 -0
- package/esm/service/sync/id/common.js.map +1 -0
- package/esm/service/sync/id/index.d.ts +4 -0
- package/esm/service/sync/id/index.d.ts.map +1 -0
- package/esm/service/sync/id/index.js +6 -0
- package/esm/service/sync/id/index.js.map +1 -0
- package/esm/service/sync/id/request.d.ts +7 -0
- package/esm/service/sync/id/request.d.ts.map +1 -0
- package/esm/service/sync/id/request.js +9 -0
- package/esm/service/sync/id/request.js.map +1 -0
- package/esm/service/sync/id/response.d.ts +6 -0
- package/esm/service/sync/id/response.d.ts.map +1 -0
- package/esm/service/sync/id/response.js +8 -0
- package/esm/service/sync/id/response.js.map +1 -0
- package/esm/service/sync/index-ns.d.ts +7 -0
- package/esm/service/sync/index-ns.d.ts.map +1 -0
- package/esm/service/sync/index-ns.js +7 -0
- package/esm/service/sync/index-ns.js.map +1 -0
- package/esm/service/sync/index.d.ts +3 -0
- package/esm/service/sync/index.d.ts.map +1 -0
- package/esm/service/sync/index.js +3 -0
- package/esm/service/sync/index.js.map +1 -0
- package/esm/service/sync/request/index.d.ts +5 -0
- package/esm/service/sync/request/index.d.ts.map +1 -0
- package/esm/service/sync/request/index.js +5 -0
- package/esm/service/sync/request/index.js.map +1 -0
- package/esm/{commands/sync → service/sync/request}/list.d.ts +21 -19
- package/esm/service/sync/request/list.d.ts.map +1 -0
- package/esm/service/sync/request/list.js +77 -0
- package/esm/service/sync/request/list.js.map +1 -0
- package/esm/service/sync/request/pull.d.ts +12 -0
- package/esm/service/sync/request/pull.d.ts.map +1 -0
- package/esm/service/sync/request/pull.js +28 -0
- package/esm/service/sync/request/pull.js.map +1 -0
- package/esm/service/sync/request/push.d.ts +54 -0
- package/esm/service/sync/request/push.d.ts.map +1 -0
- package/esm/service/sync/request/push.js +95 -0
- package/esm/service/sync/request/push.js.map +1 -0
- package/esm/{commands/sync → service/sync/request}/stat.d.ts +40 -50
- package/esm/service/sync/request/stat.d.ts.map +1 -0
- package/esm/service/sync/request/stat.js +89 -0
- package/esm/service/sync/request/stat.js.map +1 -0
- package/esm/service/sync/service.d.ts +123 -0
- package/esm/service/sync/service.d.ts.map +1 -0
- package/esm/service/sync/service.js +170 -0
- package/esm/service/sync/service.js.map +1 -0
- package/esm/service/sync/socket-pool.d.ts +11 -0
- package/esm/service/sync/socket-pool.d.ts.map +1 -0
- package/esm/service/sync/socket-pool.js +80 -0
- package/esm/service/sync/socket-pool.js.map +1 -0
- package/esm/service/sync/socket.d.ts +40 -0
- package/esm/service/sync/socket.d.ts.map +1 -0
- package/esm/service/sync/socket.js +153 -0
- package/esm/service/sync/socket.js.map +1 -0
- package/esm/{commands → service}/tcpip.d.ts +4 -2
- package/esm/service/tcpip.d.ts.map +1 -0
- package/esm/{commands → service}/tcpip.js +10 -7
- package/esm/service/tcpip.js.map +1 -0
- package/esm/utils/array-buffer.d.ts.map +1 -1
- package/esm/utils/array-buffer.js +2 -3
- package/esm/utils/array-buffer.js.map +1 -1
- package/esm/utils/base64.d.ts.map +1 -1
- package/esm/utils/base64.js +22 -12
- package/esm/utils/base64.js.map +1 -1
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +1 -0
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/md5.d.ts +8 -0
- package/esm/utils/md5.d.ts.map +1 -0
- package/esm/utils/md5.js +149 -0
- package/esm/utils/md5.js.map +1 -0
- package/package.json +10 -10
- package/src/adb.ts +44 -34
- package/src/daemon/auth/authenticator.ts +186 -0
- package/src/daemon/auth/index.ts +4 -0
- package/src/daemon/auth/packet-processor.ts +212 -0
- package/src/daemon/auth/public-key.ts +112 -0
- package/src/daemon/auth/type.ts +5 -0
- package/src/daemon/crypto.ts +36 -102
- package/src/daemon/dispatcher.ts +15 -8
- package/src/daemon/index.ts +1 -1
- package/src/daemon/socket.ts +3 -3
- package/src/daemon/transport.ts +35 -253
- package/src/device-observer.ts +3 -3
- package/src/features-value.ts +47 -0
- package/src/features.ts +31 -14
- package/src/index.ts +1 -1
- package/src/server/client.ts +96 -94
- package/src/server/commands/wireless.ts +1 -1
- package/src/server/{stream.ts → data-connection.ts} +4 -4
- package/src/server/index.ts +1 -1
- package/src/server/observer.ts +21 -19
- package/src/server/transport.ts +13 -34
- package/src/{commands → service}/index.ts +1 -2
- package/src/{commands → service}/power.ts +14 -5
- package/src/service/reverse/error.ts +35 -0
- package/src/service/reverse/index.ts +3 -0
- package/src/service/reverse/response.ts +38 -0
- package/src/{commands/reverse.ts → service/reverse/service.ts} +32 -72
- package/src/{commands → service}/subprocess/index.ts +1 -0
- package/src/{commands → service}/subprocess/none/process.ts +3 -3
- package/src/{commands → service}/subprocess/none/pty.ts +5 -5
- package/src/service/subprocess/none/service.ts +57 -0
- package/src/service/subprocess/none/spawner.ts +81 -0
- package/src/{commands → service}/subprocess/pty.ts +1 -1
- package/src/{commands → service}/subprocess/service.ts +1 -1
- package/src/{commands → service}/subprocess/shell/index.ts +1 -1
- package/src/{commands → service}/subprocess/shell/process.ts +6 -7
- package/src/{commands → service}/subprocess/shell/pty.ts +15 -13
- package/src/service/subprocess/shell/service.ts +75 -0
- package/src/{commands → service}/subprocess/shell/shared.ts +5 -0
- package/src/service/subprocess/shell/spawner.ts +109 -0
- package/src/service/subprocess/types.ts +19 -0
- package/src/service/subprocess/utils.ts +166 -0
- package/src/service/sync/android.ts +43 -0
- package/src/service/sync/compression/compression.ts +126 -0
- package/src/service/sync/compression/format-ns.ts +4 -0
- package/src/service/sync/compression/format.ts +5 -0
- package/src/service/sync/compression/index.ts +1 -0
- package/src/service/sync/id/common.ts +33 -0
- package/src/service/sync/id/index.ts +7 -0
- package/src/service/sync/id/request.ts +12 -0
- package/src/service/sync/id/response.ts +11 -0
- package/src/service/sync/index-ns.ts +6 -0
- package/src/service/sync/index.ts +2 -0
- package/src/service/sync/request/index.ts +4 -0
- package/src/service/sync/request/list.ts +110 -0
- package/src/service/sync/request/pull.ts +49 -0
- package/src/service/sync/request/push.ts +184 -0
- package/src/service/sync/request/stat.ts +127 -0
- package/src/service/sync/service.ts +255 -0
- package/src/service/sync/socket-pool.ts +97 -0
- package/src/service/sync/socket.ts +201 -0
- package/src/{commands → service}/tcpip.ts +13 -7
- package/src/utils/array-buffer.ts +2 -3
- package/src/utils/base64.ts +24 -12
- package/src/utils/index.ts +1 -0
- package/src/utils/md5.ts +185 -0
- package/yume-chan-adb-3.0.0-beta.0.tgz +0 -0
- package/CHANGELOG.md +0 -251
- package/esm/commands/base.d.ts +0 -8
- package/esm/commands/base.d.ts.map +0 -1
- package/esm/commands/base.js +0 -12
- package/esm/commands/base.js.map +0 -1
- package/esm/commands/framebuffer.d.ts.map +0 -1
- package/esm/commands/framebuffer.js.map +0 -1
- package/esm/commands/index.d.ts.map +0 -1
- package/esm/commands/index.js.map +0 -1
- package/esm/commands/power.d.ts.map +0 -1
- package/esm/commands/power.js.map +0 -1
- package/esm/commands/reverse.d.ts +0 -48
- package/esm/commands/reverse.d.ts.map +0 -1
- package/esm/commands/reverse.js.map +0 -1
- package/esm/commands/subprocess/index.d.ts.map +0 -1
- package/esm/commands/subprocess/index.js.map +0 -1
- package/esm/commands/subprocess/none/process.d.ts.map +0 -1
- package/esm/commands/subprocess/none/process.js.map +0 -1
- package/esm/commands/subprocess/none/pty.d.ts.map +0 -1
- package/esm/commands/subprocess/none/pty.js.map +0 -1
- package/esm/commands/subprocess/none/service.d.ts +0 -10
- package/esm/commands/subprocess/none/service.d.ts.map +0 -1
- package/esm/commands/subprocess/none/service.js +0 -34
- package/esm/commands/subprocess/none/service.js.map +0 -1
- package/esm/commands/subprocess/none/spawner.d.ts +0 -19
- package/esm/commands/subprocess/none/spawner.d.ts.map +0 -1
- package/esm/commands/subprocess/none/spawner.js +0 -26
- package/esm/commands/subprocess/none/spawner.js.map +0 -1
- package/esm/commands/subprocess/pty.d.ts.map +0 -1
- package/esm/commands/subprocess/service.d.ts.map +0 -1
- package/esm/commands/subprocess/service.js.map +0 -1
- package/esm/commands/subprocess/shell/index.d.ts +0 -6
- package/esm/commands/subprocess/shell/index.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/index.js +0 -6
- package/esm/commands/subprocess/shell/index.js.map +0 -1
- package/esm/commands/subprocess/shell/process.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/process.js.map +0 -1
- package/esm/commands/subprocess/shell/pty.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/pty.js.map +0 -1
- package/esm/commands/subprocess/shell/service.d.ts +0 -14
- package/esm/commands/subprocess/shell/service.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/service.js +0 -41
- package/esm/commands/subprocess/shell/service.js.map +0 -1
- package/esm/commands/subprocess/shell/shared.d.ts +0 -19
- package/esm/commands/subprocess/shell/shared.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/shared.js.map +0 -1
- package/esm/commands/subprocess/shell/spawner.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/spawner.js +0 -38
- package/esm/commands/subprocess/shell/spawner.js.map +0 -1
- package/esm/commands/subprocess/utils.d.ts +0 -3
- package/esm/commands/subprocess/utils.d.ts.map +0 -1
- package/esm/commands/subprocess/utils.js +0 -56
- package/esm/commands/subprocess/utils.js.map +0 -1
- package/esm/commands/sync/index.d.ts +0 -9
- package/esm/commands/sync/index.d.ts.map +0 -1
- package/esm/commands/sync/index.js +0 -9
- package/esm/commands/sync/index.js.map +0 -1
- package/esm/commands/sync/list.d.ts.map +0 -1
- package/esm/commands/sync/list.js +0 -64
- package/esm/commands/sync/list.js.map +0 -1
- package/esm/commands/sync/pull.d.ts +0 -12
- package/esm/commands/sync/pull.d.ts.map +0 -1
- package/esm/commands/sync/pull.js +0 -33
- package/esm/commands/sync/pull.js.map +0 -1
- package/esm/commands/sync/push.d.ts +0 -61
- package/esm/commands/sync/push.d.ts.map +0 -1
- package/esm/commands/sync/push.js +0 -83
- package/esm/commands/sync/push.js.map +0 -1
- package/esm/commands/sync/request.d.ts +0 -24
- package/esm/commands/sync/request.d.ts.map +0 -1
- package/esm/commands/sync/request.js +0 -32
- package/esm/commands/sync/request.js.map +0 -1
- package/esm/commands/sync/response.d.ts +0 -28
- package/esm/commands/sync/response.d.ts.map +0 -1
- package/esm/commands/sync/response.js +0 -81
- package/esm/commands/sync/response.js.map +0 -1
- package/esm/commands/sync/socket.d.ts +0 -22
- package/esm/commands/sync/socket.d.ts.map +0 -1
- package/esm/commands/sync/socket.js +0 -78
- package/esm/commands/sync/socket.js.map +0 -1
- package/esm/commands/sync/stat.d.ts.map +0 -1
- package/esm/commands/sync/stat.js +0 -121
- package/esm/commands/sync/stat.js.map +0 -1
- package/esm/commands/sync/sync.d.ts +0 -82
- package/esm/commands/sync/sync.d.ts.map +0 -1
- package/esm/commands/sync/sync.js +0 -138
- package/esm/commands/sync/sync.js.map +0 -1
- package/esm/commands/tcpip.d.ts.map +0 -1
- package/esm/commands/tcpip.js.map +0 -1
- package/esm/daemon/auth.d.ts +0 -54
- package/esm/daemon/auth.d.ts.map +0 -1
- package/esm/daemon/auth.js +0 -104
- package/esm/daemon/auth.js.map +0 -1
- package/esm/server/stream.d.ts.map +0 -1
- package/esm/server/stream.js.map +0 -1
- package/src/commands/base.ts +0 -15
- package/src/commands/subprocess/none/service.ts +0 -45
- package/src/commands/subprocess/none/spawner.ts +0 -68
- package/src/commands/subprocess/shell/service.ts +0 -58
- package/src/commands/subprocess/shell/spawner.ts +0 -90
- package/src/commands/subprocess/utils.ts +0 -61
- package/src/commands/sync/index.ts +0 -8
- package/src/commands/sync/list.ts +0 -99
- package/src/commands/sync/pull.ts +0 -55
- package/src/commands/sync/push.ts +0 -172
- package/src/commands/sync/request.ts +0 -53
- package/src/commands/sync/response.ts +0 -105
- package/src/commands/sync/socket.ts +0 -109
- package/src/commands/sync/stat.ts +0 -177
- package/src/commands/sync/sync.ts +0 -175
- package/src/daemon/auth.ts +0 -204
- package/tsconfig.build.tsbuildinfo +0 -1
- /package/esm/{commands → service}/framebuffer.d.ts +0 -0
- /package/esm/{commands → service}/framebuffer.js +0 -0
- /package/esm/{commands → service}/subprocess/none/index.d.ts +0 -0
- /package/esm/{commands → service}/subprocess/none/index.js +0 -0
- /package/esm/{commands → service}/subprocess/none/process.js +0 -0
- /package/esm/{commands → service}/subprocess/pty.js +0 -0
- /package/esm/{commands → service}/subprocess/service.d.ts +0 -0
- /package/src/{commands → service}/framebuffer.ts +0 -0
- /package/src/{commands → service}/subprocess/none/index.ts +0 -0
|
@@ -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,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAIpD,eAAO,MAAM,aAAa,QAAY,CAAC;AAEvC,eAAO,MAAM,UAAU;;;;GAAkD,CAAC;AA2C1E,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;IAClD,IAAI,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,wBAAgB,MAAM,CAAC,EACnB,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,IAAyB,EACzB,UAAkB,EAClB,KAA+B,EAC/B,UAA0B,GAC7B,EAAE,aAAa,iBAaf;AAED,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEzE,eAAO,MAAM,aAAa;;;;;;;;GAGzB,CAAC;AAEF,MAAM,WAAW,aAAc,SAAQ,aAAa;IAChD,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC;IAE7C;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAChC;AAED,wBAAgB,MAAM,CAAC,EACnB,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,IAAyB,EACzB,UAAkB,EAClB,KAA+B,EAC/B,UAA0B,EAC1B,WAAqC,EACrC,MAAc,GACjB,EAAE,aAAa,iBA6Bf;AAED,MAAM,WAAW,WAAY,SAAQ,aAAa;IAC9C,OAAO,EAAE,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,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AA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C/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 {
|
|
3
|
-
|
|
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
|
|
36
|
-
export declare
|
|
37
|
-
|
|
38
|
-
|
|
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<
|
|
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
|
|
92
|
-
|
|
93
|
-
|
|
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,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EACpC;IACI,YAAY,EAAE,IAAI;IAClB,KAAK,EAAE;QACH,IAAI,IAAI;YACJ,OAAO,CAAC,IAAI,CAAC,IAAI,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AC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QACpC,MAAM,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAChD,OAAO,MAAM,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { AbortSignal, MaybeConsumable, ReadableStream } from "@yume-chan/stream-extra";
|
|
2
|
+
import type { Adb } from "../../adb.js";
|
|
3
|
+
import type { LinuxFileType } from "./android.js";
|
|
4
|
+
import { Compression } from "./compression/index.js";
|
|
5
|
+
import { OpenDir, Stat } from "./request/index.js";
|
|
6
|
+
import type { Socket } from "./socket.js";
|
|
7
|
+
export interface ServiceOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Maximum number of sockets to keep in the pool for reuse.
|
|
10
|
+
* Extra sockets beyond this limit will be closed when released.
|
|
11
|
+
* @default 4
|
|
12
|
+
*/
|
|
13
|
+
maxPoolSize?: number | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Time in milliseconds to keep idle sockets in the pool before closing them.
|
|
16
|
+
* Set to 0 to disable idle timeout (sockets will remain until pool is disposed).
|
|
17
|
+
* @default 60000 (1 minute)
|
|
18
|
+
*/
|
|
19
|
+
idleTimeout?: number | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Abort signal to dispose the socket pool when aborted.
|
|
22
|
+
*/
|
|
23
|
+
signal?: AbortSignal | undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A simplified `dirname` function that only handles absolute unix paths.
|
|
27
|
+
* @param path an absolute unix path
|
|
28
|
+
* @returns the directory name of the input path
|
|
29
|
+
*/
|
|
30
|
+
export declare function dirname(path: string): string;
|
|
31
|
+
export interface WriteOptions {
|
|
32
|
+
filename: string;
|
|
33
|
+
file: ReadableStream<MaybeConsumable<Uint8Array>>;
|
|
34
|
+
type?: LinuxFileType | undefined;
|
|
35
|
+
permission?: number | undefined;
|
|
36
|
+
mtime?: number | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* The format to compress the file stream for sending.
|
|
39
|
+
*
|
|
40
|
+
* If the device doesn't support compressed sending, it will be ignored.
|
|
41
|
+
*
|
|
42
|
+
* If the device or current runtime doesn't support the specified format,
|
|
43
|
+
* an Error will be thrown.
|
|
44
|
+
* {@link Compression.canUseFormat} can be used to check if
|
|
45
|
+
* the device and current runtime both supports the format.
|
|
46
|
+
*/
|
|
47
|
+
compression?: Compression.Format | undefined;
|
|
48
|
+
dryRun?: boolean | undefined;
|
|
49
|
+
}
|
|
50
|
+
export declare class Service {
|
|
51
|
+
#private;
|
|
52
|
+
protected _adb: Adb;
|
|
53
|
+
get supportsStat2(): boolean;
|
|
54
|
+
get supportsLs2(): boolean;
|
|
55
|
+
get fixedPushMkdir(): boolean;
|
|
56
|
+
get supportsSendReceive2(): boolean;
|
|
57
|
+
get needPushMkdirWorkaround(): boolean;
|
|
58
|
+
constructor(adb: Adb, options?: ServiceOptions);
|
|
59
|
+
/**
|
|
60
|
+
* Acquires a socket from the pool for direct use.
|
|
61
|
+
*
|
|
62
|
+
* The socket must be returned to the pool using {@link releaseSocket} after use.
|
|
63
|
+
*
|
|
64
|
+
* @returns A socket from the pool
|
|
65
|
+
*/
|
|
66
|
+
acquireSocket(): Promise<Socket>;
|
|
67
|
+
/**
|
|
68
|
+
* Returns a socket to the pool after use.
|
|
69
|
+
*
|
|
70
|
+
* @param socket The socket to return to the pool
|
|
71
|
+
* @param discard Whether to discard the socket instead of returning it to the pool
|
|
72
|
+
*/
|
|
73
|
+
releaseSocket(socket: Socket, discard?: boolean): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Gets information of a file or folder.
|
|
76
|
+
*
|
|
77
|
+
* If `path` points to a symbolic link, the returned information is about the link itself (with `type` being `LinuxFileType.Link`).
|
|
78
|
+
*/
|
|
79
|
+
lstat(path: string): Promise<Stat.Stat>;
|
|
80
|
+
/**
|
|
81
|
+
* Gets the information of a file or folder.
|
|
82
|
+
*
|
|
83
|
+
* If `path` points to a symbolic link, it will be resolved and the returned information is about the target (with `type` being `LinuxFileType.File` or `LinuxFileType.Directory`).
|
|
84
|
+
*/
|
|
85
|
+
stat(path: string): Promise<import("@yume-chan/struct").FieldsValue<{
|
|
86
|
+
error: import("@yume-chan/struct").Field<import("./android.js").AndroidSyscallErrorCode, never, never, number>;
|
|
87
|
+
dev: import("@yume-chan/struct").NumberField<bigint>;
|
|
88
|
+
ino: import("@yume-chan/struct").NumberField<bigint>;
|
|
89
|
+
mode: import("@yume-chan/struct").NumberField<number>;
|
|
90
|
+
nlink: import("@yume-chan/struct").NumberField<number>;
|
|
91
|
+
uid: import("@yume-chan/struct").NumberField<number>;
|
|
92
|
+
gid: import("@yume-chan/struct").NumberField<number>;
|
|
93
|
+
size: import("@yume-chan/struct").NumberField<bigint>;
|
|
94
|
+
atime: import("@yume-chan/struct").NumberField<bigint>;
|
|
95
|
+
mtime: import("@yume-chan/struct").NumberField<bigint>;
|
|
96
|
+
ctime: import("@yume-chan/struct").NumberField<bigint>;
|
|
97
|
+
}> & {
|
|
98
|
+
readonly type: LinuxFileType;
|
|
99
|
+
readonly permission: number;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* Checks if `path` is a directory, or a symbolic link to a directory.
|
|
103
|
+
*
|
|
104
|
+
* This uses `lstat` internally, thus works on all Android versions.
|
|
105
|
+
*/
|
|
106
|
+
isDirectory(path: string): Promise<boolean>;
|
|
107
|
+
opendir(path: string): AsyncGenerator<OpenDir.Entry, void, void>;
|
|
108
|
+
readdir(path: string): Promise<OpenDir.Entry[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Reads the content of a file on device.
|
|
111
|
+
*
|
|
112
|
+
* @param filename The full path of the file on device to read.
|
|
113
|
+
* @returns A `ReadableStream` that contains the file content.
|
|
114
|
+
*/
|
|
115
|
+
read(filename: string): ReadableStream<Uint8Array>;
|
|
116
|
+
/**
|
|
117
|
+
* Writes a file on device. If the file name already exists, it will be overwritten.
|
|
118
|
+
*
|
|
119
|
+
* @param options The content and options of the file to write.
|
|
120
|
+
*/
|
|
121
|
+
write(options: WriteOptions): Promise<void>;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/service/sync/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EACX,eAAe,EACf,cAAc,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAIxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAiB,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,MAAM,WAAW,cAAc;IAC3B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACpC;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAS5C;AAED,MAAM,WAAW,YAAY;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;IAClD,IAAI,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,KAAK,CAAC,EAAE,MAA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