@yume-chan/adb 0.0.8 → 0.0.11
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/CHANGELOG.json +49 -0
- package/CHANGELOG.md +30 -0
- package/LICENSE +21 -21
- package/README.md +240 -257
- package/esm/adb.d.ts +48 -0
- package/esm/adb.d.ts.map +1 -0
- package/esm/adb.js +141 -145
- package/esm/adb.js.map +1 -1
- package/{dts → esm}/auth.d.ts +17 -7
- package/esm/auth.d.ts.map +1 -0
- package/esm/auth.js +69 -109
- package/esm/auth.js.map +1 -1
- package/esm/backend.d.ts +9 -0
- package/esm/backend.d.ts.map +1 -0
- package/{dts → esm}/commands/base.d.ts +1 -1
- package/esm/commands/base.d.ts.map +1 -0
- package/esm/commands/base.js +1 -0
- package/esm/commands/base.js.map +1 -1
- package/{dts → esm}/commands/framebuffer.d.ts +3 -3
- package/esm/commands/framebuffer.d.ts.map +1 -0
- package/esm/commands/framebuffer.js +15 -18
- package/esm/commands/framebuffer.js.map +1 -1
- package/esm/commands/index.d.ts +9 -0
- package/esm/commands/index.d.ts.map +1 -0
- package/esm/commands/index.js +8 -8
- package/esm/commands/index.js.map +1 -1
- package/esm/commands/install.d.ts +4 -0
- package/esm/commands/install.d.ts.map +1 -0
- package/esm/commands/install.js +21 -13
- package/esm/commands/install.js.map +1 -1
- package/esm/commands/power.d.ts +23 -0
- package/esm/commands/power.d.ts.map +1 -0
- package/esm/commands/power.js +45 -0
- package/esm/commands/power.js.map +1 -0
- package/{dts → esm}/commands/reverse.d.ts +3 -3
- package/esm/commands/reverse.d.ts.map +1 -0
- package/esm/commands/reverse.js +50 -60
- package/esm/commands/reverse.js.map +1 -1
- package/esm/commands/subprocess/index.d.ts +57 -0
- package/esm/commands/subprocess/index.d.ts.map +1 -0
- package/esm/commands/subprocess/index.js +83 -0
- package/esm/commands/subprocess/index.js.map +1 -0
- package/esm/commands/subprocess/legacy.d.ts +28 -0
- package/esm/commands/subprocess/legacy.d.ts.map +1 -0
- package/esm/commands/subprocess/legacy.js +44 -0
- package/esm/commands/subprocess/legacy.js.map +1 -0
- package/esm/commands/subprocess/protocol.d.ts +38 -0
- package/esm/commands/subprocess/protocol.d.ts.map +1 -0
- package/esm/commands/subprocess/protocol.js +155 -0
- package/esm/commands/subprocess/protocol.js.map +1 -0
- package/esm/commands/subprocess/types.d.ts +47 -0
- package/esm/commands/subprocess/types.d.ts.map +1 -0
- package/esm/commands/{shell → subprocess}/types.js +0 -0
- package/{cjs/commands/shell → esm/commands/subprocess}/types.js.map +1 -1
- package/{dts/commands/shell → esm/commands/subprocess}/utils.d.ts +0 -0
- package/esm/commands/subprocess/utils.d.ts.map +1 -0
- package/esm/commands/{shell → subprocess}/utils.js +0 -0
- package/esm/commands/subprocess/utils.js.map +1 -0
- package/esm/commands/sync/index.d.ts +8 -0
- package/esm/commands/sync/index.d.ts.map +1 -0
- package/esm/commands/sync/index.js +7 -7
- package/esm/commands/sync/index.js.map +1 -1
- package/{dts → esm}/commands/sync/list.d.ts +4 -4
- package/esm/commands/sync/list.d.ts.map +1 -0
- package/esm/commands/sync/list.js +16 -19
- package/esm/commands/sync/list.js.map +1 -1
- package/esm/commands/sync/pull.d.ts +11 -0
- package/esm/commands/sync/pull.d.ts.map +1 -0
- package/esm/commands/sync/pull.js +17 -11
- package/esm/commands/sync/pull.js.map +1 -1
- package/esm/commands/sync/push.d.ts +8 -0
- package/esm/commands/sync/push.d.ts.map +1 -0
- package/esm/commands/sync/push.js +19 -37
- package/esm/commands/sync/push.js.map +1 -1
- package/{dts → esm}/commands/sync/request.d.ts +3 -3
- package/esm/commands/sync/request.d.ts.map +1 -0
- package/esm/commands/sync/request.js +24 -26
- package/esm/commands/sync/request.js.map +1 -1
- package/{dts → esm}/commands/sync/response.d.ts +3 -3
- package/esm/commands/sync/response.d.ts.map +1 -0
- package/esm/commands/sync/response.js +16 -19
- package/esm/commands/sync/response.js.map +1 -1
- package/{dts → esm}/commands/sync/stat.d.ts +4 -4
- package/esm/commands/sync/stat.d.ts.map +1 -0
- package/esm/commands/sync/stat.js +22 -27
- package/esm/commands/sync/stat.js.map +1 -1
- package/esm/commands/sync/sync.d.ts +83 -0
- package/esm/commands/sync/sync.d.ts.map +1 -0
- package/esm/commands/sync/sync.js +92 -89
- package/esm/commands/sync/sync.js.map +1 -1
- package/{dts → esm}/commands/tcpip.d.ts +1 -1
- package/{dts → esm}/commands/tcpip.d.ts.map +1 -1
- package/esm/commands/tcpip.js +14 -19
- package/esm/commands/tcpip.js.map +1 -1
- package/esm/crypto.d.ts +24 -0
- package/esm/crypto.d.ts.map +1 -0
- package/esm/crypto.js +33 -31
- package/esm/crypto.js.map +1 -1
- package/{dts → esm}/features.d.ts +0 -0
- package/{dts → esm}/features.d.ts.map +0 -0
- package/esm/features.js +1 -1
- package/esm/features.js.map +1 -1
- package/esm/index.d.ts +11 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +10 -10
- package/esm/index.js.map +1 -1
- package/esm/packet.d.ts +28 -0
- package/esm/packet.d.ts.map +1 -0
- package/esm/packet.js +26 -53
- package/esm/packet.js.map +1 -1
- package/esm/socket/controller.d.ts +37 -0
- package/esm/socket/controller.d.ts.map +1 -0
- package/esm/socket/controller.js +52 -66
- package/esm/socket/controller.js.map +1 -1
- package/{dts → esm}/socket/dispatcher.d.ts +10 -23
- package/esm/socket/dispatcher.d.ts.map +1 -0
- package/esm/socket/dispatcher.js +148 -164
- package/esm/socket/dispatcher.js.map +1 -1
- package/esm/socket/index.d.ts +3 -0
- package/esm/socket/index.d.ts.map +1 -0
- package/esm/socket/index.js +2 -6
- package/esm/socket/index.js.map +1 -1
- package/esm/socket/socket.d.ts +34 -0
- package/esm/socket/socket.d.ts.map +1 -0
- package/esm/socket/socket.js +69 -14
- package/esm/socket/socket.js.map +1 -1
- package/esm/stream/buffered.d.ts +35 -0
- package/esm/stream/buffered.d.ts.map +1 -0
- package/esm/stream/buffered.js +123 -0
- package/esm/stream/buffered.js.map +1 -0
- package/esm/stream/detect.bak.d.ts +240 -0
- package/esm/stream/detect.bak.d.ts.map +1 -0
- package/esm/stream/detect.bak.js +60 -0
- package/esm/stream/detect.bak.js.map +1 -0
- package/esm/stream/detect.d.ts +18 -0
- package/esm/stream/detect.d.ts.map +1 -0
- package/esm/stream/detect.js +6 -0
- package/esm/stream/detect.js.map +1 -0
- package/esm/stream/detect.native.d.ts +240 -0
- package/esm/stream/detect.native.d.ts.map +1 -0
- package/esm/stream/detect.native.js +60 -0
- package/esm/stream/detect.native.js.map +1 -0
- package/esm/stream/detect.polyfill.d.ts +18 -0
- package/esm/stream/detect.polyfill.d.ts.map +1 -0
- package/esm/stream/detect.polyfill.js +6 -0
- package/esm/stream/detect.polyfill.js.map +1 -0
- package/esm/stream/index.d.ts +4 -0
- package/esm/stream/index.d.ts.map +1 -0
- package/esm/stream/index.js +3 -2
- package/esm/stream/index.js.map +1 -1
- package/esm/stream/transform.d.ts +98 -0
- package/esm/stream/transform.d.ts.map +1 -0
- package/esm/stream/transform.js +352 -0
- package/esm/stream/transform.js.map +1 -0
- package/{dts → esm}/utils/auto-reset-event.d.ts +1 -1
- package/esm/utils/auto-reset-event.d.ts.map +1 -0
- package/esm/utils/auto-reset-event.js +2 -1
- package/esm/utils/auto-reset-event.js.map +1 -1
- package/esm/utils/base64.d.ts +5 -0
- package/esm/utils/base64.d.ts.map +1 -0
- package/esm/utils/base64.js +116 -80
- package/esm/utils/base64.js.map +1 -1
- package/esm/utils/encoding.d.ts +3 -0
- package/esm/utils/encoding.d.ts.map +1 -0
- package/esm/utils/encoding.js +11 -0
- package/esm/utils/encoding.js.map +1 -0
- package/esm/utils/index.d.ts +4 -0
- package/esm/utils/index.d.ts.map +1 -0
- package/esm/utils/index.js +3 -4
- package/esm/utils/index.js.map +1 -1
- package/package.json +49 -50
- package/src/adb.ts +247 -242
- package/src/auth.ts +170 -156
- package/src/backend.ts +11 -24
- package/src/commands/base.ts +11 -11
- package/src/commands/framebuffer.ts +73 -73
- package/src/commands/index.ts +8 -8
- package/src/commands/install.ts +32 -21
- package/src/commands/power.ts +54 -0
- package/src/commands/reverse.ts +136 -133
- package/src/commands/subprocess/index.ts +124 -0
- package/src/commands/subprocess/legacy.ts +58 -0
- package/src/commands/subprocess/protocol.ts +185 -0
- package/src/commands/subprocess/types.ts +55 -0
- package/src/commands/{shell → subprocess}/utils.ts +20 -20
- package/src/commands/sync/index.ts +7 -7
- package/src/commands/sync/list.ts +40 -39
- package/src/commands/sync/pull.ts +43 -34
- package/src/commands/sync/push.ts +41 -46
- package/src/commands/sync/request.ts +49 -48
- package/src/commands/sync/response.ts +58 -57
- package/src/commands/sync/stat.ts +123 -121
- package/src/commands/sync/sync.ts +145 -113
- package/src/commands/tcpip.ts +21 -21
- package/src/crypto.ts +280 -280
- package/src/features.ts +5 -5
- package/src/index.ts +11 -10
- package/src/packet.ts +69 -89
- package/src/socket/dispatcher.ts +256 -269
- package/src/socket/index.ts +2 -6
- package/src/socket/socket.ts +129 -28
- package/src/stream/buffered.ts +147 -0
- package/src/stream/detect.native.ts +362 -0
- package/src/stream/detect.polyfill.ts +25 -0
- package/src/stream/detect.ts +25 -0
- package/src/stream/index.ts +3 -2
- package/src/stream/transform.ts +427 -0
- package/src/utils/auto-reset-event.ts +41 -41
- package/src/utils/base64.ts +306 -274
- package/src/utils/encoding.ts +13 -0
- package/src/utils/index.ts +3 -4
- package/tsconfig.build.json +3 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.test.json +10 -0
- package/cjs/adb.js +0 -205
- package/cjs/adb.js.map +0 -1
- package/cjs/auth.js +0 -141
- package/cjs/auth.js.map +0 -1
- package/cjs/backend.js +0 -3
- package/cjs/backend.js.map +0 -1
- package/cjs/commands/base.js +0 -12
- package/cjs/commands/base.js.map +0 -1
- package/cjs/commands/demo-mode.js +0 -174
- package/cjs/commands/demo-mode.js.map +0 -1
- package/cjs/commands/framebuffer.js +0 -66
- package/cjs/commands/framebuffer.js.map +0 -1
- package/cjs/commands/index.js +0 -12
- package/cjs/commands/index.js.map +0 -1
- package/cjs/commands/install.js +0 -20
- package/cjs/commands/install.js.map +0 -1
- package/cjs/commands/reverse.js +0 -105
- package/cjs/commands/reverse.js.map +0 -1
- package/cjs/commands/shell/index.js +0 -56
- package/cjs/commands/shell/index.js.map +0 -1
- package/cjs/commands/shell/legacy.js +0 -37
- package/cjs/commands/shell/legacy.js.map +0 -1
- package/cjs/commands/shell/protocol.js +0 -83
- package/cjs/commands/shell/protocol.js.map +0 -1
- package/cjs/commands/shell/types.js +0 -3
- package/cjs/commands/shell/utils.js +0 -23
- package/cjs/commands/shell/utils.js.map +0 -1
- package/cjs/commands/sync/index.js +0 -11
- package/cjs/commands/sync/index.js.map +0 -1
- package/cjs/commands/sync/list.js +0 -36
- package/cjs/commands/sync/list.js.map +0 -1
- package/cjs/commands/sync/pull.js +0 -34
- package/cjs/commands/sync/pull.js.map +0 -1
- package/cjs/commands/sync/push.js +0 -49
- package/cjs/commands/sync/push.js.map +0 -1
- package/cjs/commands/sync/request.js +0 -48
- package/cjs/commands/sync/request.js.map +0 -1
- package/cjs/commands/sync/response.js +0 -53
- package/cjs/commands/sync/response.js.map +0 -1
- package/cjs/commands/sync/stat.js +0 -109
- package/cjs/commands/sync/stat.js.map +0 -1
- package/cjs/commands/sync/sync.js +0 -118
- package/cjs/commands/sync/sync.js.map +0 -1
- package/cjs/commands/tcpip.js +0 -28
- package/cjs/commands/tcpip.js.map +0 -1
- package/cjs/crypto.js +0 -231
- package/cjs/crypto.js.map +0 -1
- package/cjs/features.js +0 -10
- package/cjs/features.js.map +0 -1
- package/cjs/index.js +0 -14
- package/cjs/index.js.map +0 -1
- package/cjs/packet.js +0 -77
- package/cjs/packet.js.map +0 -1
- package/cjs/socket/close-event-emitter.js +0 -32
- package/cjs/socket/close-event-emitter.js.map +0 -1
- package/cjs/socket/controller.js +0 -84
- package/cjs/socket/controller.js.map +0 -1
- package/cjs/socket/data-event-emitter.js +0 -29
- package/cjs/socket/data-event-emitter.js.map +0 -1
- package/cjs/socket/dispatcher.js +0 -219
- package/cjs/socket/dispatcher.js.map +0 -1
- package/cjs/socket/index.js +0 -10
- package/cjs/socket/index.js.map +0 -1
- package/cjs/socket/logger.js +0 -3
- package/cjs/socket/logger.js.map +0 -1
- package/cjs/socket/socket.js +0 -24
- package/cjs/socket/socket.js.map +0 -1
- package/cjs/stream/buffered-stream.js +0 -78
- package/cjs/stream/buffered-stream.js.map +0 -1
- package/cjs/stream/index.js +0 -6
- package/cjs/stream/index.js.map +0 -1
- package/cjs/stream/stream.js +0 -45
- package/cjs/stream/stream.js.map +0 -1
- package/cjs/utils/auto-reset-event.js +0 -37
- package/cjs/utils/auto-reset-event.js.map +0 -1
- package/cjs/utils/base64.js +0 -210
- package/cjs/utils/base64.js.map +0 -1
- package/cjs/utils/chunk.js +0 -75
- package/cjs/utils/chunk.js.map +0 -1
- package/cjs/utils/event-queue.js +0 -108
- package/cjs/utils/event-queue.js.map +0 -1
- package/cjs/utils/index.js +0 -8
- package/cjs/utils/index.js.map +0 -1
- package/dts/adb.d.ts +0 -46
- package/dts/adb.d.ts.map +0 -1
- package/dts/auth.d.ts.map +0 -1
- package/dts/backend.d.ts +0 -15
- package/dts/backend.d.ts.map +0 -1
- package/dts/commands/base.d.ts.map +0 -1
- package/dts/commands/demo-mode.d.ts +0 -41
- package/dts/commands/demo-mode.d.ts.map +0 -1
- package/dts/commands/framebuffer.d.ts.map +0 -1
- package/dts/commands/index.d.ts +0 -9
- package/dts/commands/index.d.ts.map +0 -1
- package/dts/commands/install.d.ts +0 -3
- package/dts/commands/install.d.ts.map +0 -1
- package/dts/commands/reverse.d.ts.map +0 -1
- package/dts/commands/shell/index.d.ts +0 -20
- package/dts/commands/shell/index.d.ts.map +0 -1
- package/dts/commands/shell/legacy.d.ts +0 -27
- package/dts/commands/shell/legacy.d.ts.map +0 -1
- package/dts/commands/shell/protocol.d.ts +0 -37
- package/dts/commands/shell/protocol.d.ts.map +0 -1
- package/dts/commands/shell/types.d.ts +0 -15
- package/dts/commands/shell/types.d.ts.map +0 -1
- package/dts/commands/shell/utils.d.ts.map +0 -1
- package/dts/commands/sync/index.d.ts +0 -8
- package/dts/commands/sync/index.d.ts.map +0 -1
- package/dts/commands/sync/list.d.ts.map +0 -1
- package/dts/commands/sync/pull.d.ts +0 -11
- package/dts/commands/sync/pull.d.ts.map +0 -1
- package/dts/commands/sync/push.d.ts +0 -8
- package/dts/commands/sync/push.d.ts.map +0 -1
- package/dts/commands/sync/request.d.ts.map +0 -1
- package/dts/commands/sync/response.d.ts.map +0 -1
- package/dts/commands/sync/stat.d.ts.map +0 -1
- package/dts/commands/sync/sync.d.ts +0 -68
- package/dts/commands/sync/sync.d.ts.map +0 -1
- package/dts/crypto.d.ts +0 -17
- package/dts/crypto.d.ts.map +0 -1
- package/dts/index.d.ts +0 -11
- package/dts/index.d.ts.map +0 -1
- package/dts/packet.d.ts +0 -27
- package/dts/packet.d.ts.map +0 -1
- package/dts/socket/close-event-emitter.d.ts +0 -8
- package/dts/socket/close-event-emitter.d.ts.map +0 -1
- package/dts/socket/controller.d.ts +0 -43
- package/dts/socket/controller.d.ts.map +0 -1
- package/dts/socket/data-event-emitter.d.ts +0 -10
- package/dts/socket/data-event-emitter.d.ts.map +0 -1
- package/dts/socket/dispatcher.d.ts.map +0 -1
- package/dts/socket/index.d.ts +0 -7
- package/dts/socket/index.d.ts.map +0 -1
- package/dts/socket/logger.d.ts +0 -9
- package/dts/socket/logger.d.ts.map +0 -1
- package/dts/socket/socket.d.ts +0 -22
- package/dts/socket/socket.d.ts.map +0 -1
- package/dts/stream/buffered-stream.d.ts +0 -30
- package/dts/stream/buffered-stream.d.ts.map +0 -1
- package/dts/stream/index.d.ts +0 -3
- package/dts/stream/index.d.ts.map +0 -1
- package/dts/stream/stream.d.ts +0 -15
- package/dts/stream/stream.d.ts.map +0 -1
- package/dts/utils/auto-reset-event.d.ts.map +0 -1
- package/dts/utils/base64.d.ts +0 -7
- package/dts/utils/base64.d.ts.map +0 -1
- package/dts/utils/chunk.d.ts +0 -3
- package/dts/utils/chunk.d.ts.map +0 -1
- package/dts/utils/event-queue.d.ts +0 -35
- package/dts/utils/event-queue.d.ts.map +0 -1
- package/dts/utils/index.d.ts +0 -5
- package/dts/utils/index.d.ts.map +0 -1
- package/esm/commands/demo-mode.js +0 -170
- package/esm/commands/demo-mode.js.map +0 -1
- package/esm/commands/shell/index.js +0 -52
- package/esm/commands/shell/index.js.map +0 -1
- package/esm/commands/shell/legacy.js +0 -33
- package/esm/commands/shell/legacy.js.map +0 -1
- package/esm/commands/shell/protocol.js +0 -79
- package/esm/commands/shell/protocol.js.map +0 -1
- package/esm/commands/shell/types.js.map +0 -1
- package/esm/commands/shell/utils.js.map +0 -1
- package/esm/socket/close-event-emitter.js +0 -28
- package/esm/socket/close-event-emitter.js.map +0 -1
- package/esm/socket/data-event-emitter.js +0 -25
- package/esm/socket/data-event-emitter.js.map +0 -1
- package/esm/socket/logger.js +0 -2
- package/esm/socket/logger.js.map +0 -1
- package/esm/stream/buffered-stream.js +0 -73
- package/esm/stream/buffered-stream.js.map +0 -1
- package/esm/stream/stream.js +0 -41
- package/esm/stream/stream.js.map +0 -1
- package/esm/utils/chunk.js +0 -70
- package/esm/utils/chunk.js.map +0 -1
- package/esm/utils/event-queue.js +0 -104
- package/esm/utils/event-queue.js.map +0 -1
- package/src/commands/demo-mode.ts +0 -160
- package/src/commands/shell/index.ts +0 -68
- package/src/commands/shell/legacy.ts +0 -42
- package/src/commands/shell/protocol.ts +0 -94
- package/src/commands/shell/types.ts +0 -21
- package/src/socket/close-event-emitter.ts +0 -28
- package/src/socket/controller.ts +0 -105
- package/src/socket/data-event-emitter.ts +0 -27
- package/src/socket/logger.ts +0 -12
- package/src/stream/buffered-stream.ts +0 -100
- package/src/stream/stream.ts +0 -50
- package/src/utils/chunk.ts +0 -70
- package/src/utils/event-queue.ts +0 -145
- package/tsconfig.cjs.json +0 -11
- package/tsconfig.esm.json +0 -28
- package/tsconfig.esm.tsbuildinfo +0 -1305
- package/tsconfig.json +0 -18
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import Struct, { placeholder } from '@yume-chan/struct';
|
|
3
|
-
import { AdbSyncRequestId, adbSyncWriteRequest } from './request';
|
|
4
|
-
import { adbSyncReadResponse, AdbSyncResponseId } from './response';
|
|
2
|
+
import { AdbSyncRequestId, adbSyncWriteRequest } from './request.js';
|
|
3
|
+
import { adbSyncReadResponse, AdbSyncResponseId } from './response.js';
|
|
5
4
|
// https://github.com/python/cpython/blob/4e581d64b8aff3e2eda99b12f080c877bb78dfca/Lib/stat.py#L36
|
|
6
5
|
export var LinuxFileType;
|
|
7
6
|
(function (LinuxFileType) {
|
|
8
7
|
LinuxFileType[LinuxFileType["Directory"] = 4] = "Directory";
|
|
9
8
|
LinuxFileType[LinuxFileType["File"] = 8] = "File";
|
|
10
9
|
LinuxFileType[LinuxFileType["Link"] = 10] = "Link";
|
|
11
|
-
})(LinuxFileType || (LinuxFileType = {}));
|
|
10
|
+
})(LinuxFileType = LinuxFileType || (LinuxFileType = {}));
|
|
12
11
|
export const AdbSyncLstatResponse = new Struct({ littleEndian: true })
|
|
13
12
|
.int32('mode')
|
|
14
13
|
.int32('size')
|
|
@@ -16,7 +15,7 @@ export const AdbSyncLstatResponse = new Struct({ littleEndian: true })
|
|
|
16
15
|
.extra({
|
|
17
16
|
id: AdbSyncResponseId.Lstat,
|
|
18
17
|
get type() { return this.mode >> 12; },
|
|
19
|
-
get permission() { return this.mode &
|
|
18
|
+
get permission() { return this.mode & 0b00001111_11111111; },
|
|
20
19
|
})
|
|
21
20
|
.postDeserialize((object) => {
|
|
22
21
|
if (object.mode === 0 &&
|
|
@@ -47,7 +46,7 @@ export var AdbSyncStatErrorCode;
|
|
|
47
46
|
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EPERM"] = 1] = "EPERM";
|
|
48
47
|
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EROFS"] = 30] = "EROFS";
|
|
49
48
|
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ETXTBSY"] = 26] = "ETXTBSY";
|
|
50
|
-
})(AdbSyncStatErrorCode || (AdbSyncStatErrorCode = {}));
|
|
49
|
+
})(AdbSyncStatErrorCode = AdbSyncStatErrorCode || (AdbSyncStatErrorCode = {}));
|
|
51
50
|
export const AdbSyncStatResponse = new Struct({ littleEndian: true })
|
|
52
51
|
.uint32('error', placeholder())
|
|
53
52
|
.uint64('dev')
|
|
@@ -63,7 +62,7 @@ export const AdbSyncStatResponse = new Struct({ littleEndian: true })
|
|
|
63
62
|
.extra({
|
|
64
63
|
id: AdbSyncResponseId.Stat,
|
|
65
64
|
get type() { return this.mode >> 12; },
|
|
66
|
-
get permission() { return this.mode &
|
|
65
|
+
get permission() { return this.mode & 0b00001111_11111111; },
|
|
67
66
|
})
|
|
68
67
|
.postDeserialize((object) => {
|
|
69
68
|
if (object.error) {
|
|
@@ -79,26 +78,22 @@ const LstatResponseType = {
|
|
|
79
78
|
const Lstat2ResponseType = {
|
|
80
79
|
[AdbSyncResponseId.Lstat2]: AdbSyncStatResponse,
|
|
81
80
|
};
|
|
82
|
-
export function adbSyncLstat(stream, path, v2) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return adbSyncReadResponse(stream, responseType);
|
|
96
|
-
});
|
|
81
|
+
export async function adbSyncLstat(stream, writer, path, v2) {
|
|
82
|
+
let requestId;
|
|
83
|
+
let responseType;
|
|
84
|
+
if (v2) {
|
|
85
|
+
requestId = AdbSyncRequestId.Lstat2;
|
|
86
|
+
responseType = Lstat2ResponseType;
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
requestId = AdbSyncRequestId.Lstat;
|
|
90
|
+
responseType = LstatResponseType;
|
|
91
|
+
}
|
|
92
|
+
await adbSyncWriteRequest(writer, requestId, path);
|
|
93
|
+
return adbSyncReadResponse(stream, responseType);
|
|
97
94
|
}
|
|
98
|
-
export function adbSyncStat(stream, path) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return adbSyncReadResponse(stream, StatResponseType);
|
|
102
|
-
});
|
|
95
|
+
export async function adbSyncStat(stream, writer, path) {
|
|
96
|
+
await adbSyncWriteRequest(writer, AdbSyncRequestId.Stat, path);
|
|
97
|
+
return await adbSyncReadResponse(stream, StatResponseType);
|
|
103
98
|
}
|
|
104
99
|
//# sourceMappingURL=stat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat.js","sourceRoot":"","sources":["../../../src/commands/sync/stat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stat.js","sourceRoot":"","sources":["../../../src/commands/sync/stat.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvE,kGAAkG;AAClG,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,2DAAgB,CAAA;IAChB,iDAAW,CAAA;IACX,kDAAW,CAAA;AACf,CAAC,EAJW,aAAa,GAAb,aAAa,KAAb,aAAa,QAIxB;AAED,MAAM,CAAC,MAAM,oBAAoB,GAC7B,IAAI,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;KAC7B,KAAK,CAAC,MAAM,CAAC;KACb,KAAK,CAAC,MAAM,CAAC;KACb,KAAK,CAAC,OAAO,CAAC;KACd,KAAK,CAAC;IACH,EAAE,EAAE,iBAAiB,CAAC,KAAc;IACpC,IAAI,IAAI,KAAK,OAAO,IAAI,C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,KAAK,UAAU,WAAW,CAC7B,MAAyB,EACzB,MAA+C,EAC/C,IAAY;IAEZ,MAAM,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/D,OAAO,MAAM,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { AutoDisposable } from '@yume-chan/event';
|
|
2
|
+
import type { Adb } from '../../adb.js';
|
|
3
|
+
import type { AdbSocket } from '../../socket/index.js';
|
|
4
|
+
import { AdbBufferedStream, ReadableStream, WritableStream, WritableStreamDefaultWriter } from '../../stream/index.js';
|
|
5
|
+
import { AutoResetEvent } from '../../utils/index.js';
|
|
6
|
+
import { AdbSyncEntryResponse } from './list.js';
|
|
7
|
+
export declare class AdbSync extends AutoDisposable {
|
|
8
|
+
protected adb: Adb;
|
|
9
|
+
protected stream: AdbBufferedStream;
|
|
10
|
+
protected writer: WritableStreamDefaultWriter<Uint8Array>;
|
|
11
|
+
protected sendLock: AutoResetEvent;
|
|
12
|
+
get supportsStat(): boolean;
|
|
13
|
+
constructor(adb: Adb, socket: AdbSocket);
|
|
14
|
+
lstat(path: string): Promise<{
|
|
15
|
+
id: import("./response.js").AdbSyncResponseId.Lstat;
|
|
16
|
+
readonly type: import("./stat.js").LinuxFileType;
|
|
17
|
+
readonly permission: number;
|
|
18
|
+
mode: number;
|
|
19
|
+
size: number;
|
|
20
|
+
mtime: number;
|
|
21
|
+
} | {
|
|
22
|
+
id: import("./response.js").AdbSyncResponseId.Stat;
|
|
23
|
+
readonly type: import("./stat.js").LinuxFileType;
|
|
24
|
+
readonly permission: number;
|
|
25
|
+
error: import("./stat.js").AdbSyncStatErrorCode;
|
|
26
|
+
dev: bigint;
|
|
27
|
+
ino: bigint;
|
|
28
|
+
mode: number;
|
|
29
|
+
nlink: number;
|
|
30
|
+
uid: number;
|
|
31
|
+
gid: number;
|
|
32
|
+
size: bigint;
|
|
33
|
+
atime: bigint;
|
|
34
|
+
mtime: bigint;
|
|
35
|
+
ctime: bigint;
|
|
36
|
+
}>;
|
|
37
|
+
stat(path: string): Promise<{
|
|
38
|
+
id: import("./response.js").AdbSyncResponseId.Stat;
|
|
39
|
+
readonly type: import("./stat.js").LinuxFileType;
|
|
40
|
+
readonly permission: number;
|
|
41
|
+
error: import("./stat.js").AdbSyncStatErrorCode;
|
|
42
|
+
dev: bigint;
|
|
43
|
+
ino: bigint;
|
|
44
|
+
mode: number;
|
|
45
|
+
nlink: number;
|
|
46
|
+
uid: number;
|
|
47
|
+
gid: number;
|
|
48
|
+
size: bigint;
|
|
49
|
+
atime: bigint;
|
|
50
|
+
mtime: bigint;
|
|
51
|
+
ctime: bigint;
|
|
52
|
+
}>;
|
|
53
|
+
isDirectory(path: string): Promise<boolean>;
|
|
54
|
+
opendir(path: string): AsyncGenerator<AdbSyncEntryResponse, void, void>;
|
|
55
|
+
readdir(path: string): Promise<{
|
|
56
|
+
id: import("./response.js").AdbSyncResponseId.Entry;
|
|
57
|
+
readonly type: import("./stat.js").LinuxFileType;
|
|
58
|
+
readonly permission: number;
|
|
59
|
+
mode: number;
|
|
60
|
+
size: number;
|
|
61
|
+
mtime: number;
|
|
62
|
+
nameLength: number;
|
|
63
|
+
name: string;
|
|
64
|
+
}[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Read the content of a file on device.
|
|
67
|
+
*
|
|
68
|
+
* @param filename The full path of the file on device to read.
|
|
69
|
+
* @returns A `ReadableStream` that reads from the file.
|
|
70
|
+
*/
|
|
71
|
+
read(filename: string): ReadableStream<Uint8Array>;
|
|
72
|
+
/**
|
|
73
|
+
* Write (or overwrite) a file on device.
|
|
74
|
+
*
|
|
75
|
+
* @param filename The full path of the file on device to write.
|
|
76
|
+
* @param mode The unix permissions of the file.
|
|
77
|
+
* @param mtime The modified time of the file.
|
|
78
|
+
* @returns A `WritableStream` that writes to the file.
|
|
79
|
+
*/
|
|
80
|
+
write(filename: string, mode?: number, mtime?: number): WritableStream<Uint8Array>;
|
|
81
|
+
dispose(): Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAA0C,cAAc,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAC/J,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAkB,MAAM,WAAW,CAAC;AAKjE,qBAAa,OAAQ,SAAQ,cAAc;IACvC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC;IAEnB,SAAS,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAEpC,SAAS,CAAC,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,CAAC;IAE1D,SAAS,CAAC,QAAQ,iBAA4C;IAE9D,IAAW,YAAY,IAAI,OAAO,CAEjC;gBAEkB,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS;IAQjC,KAAK,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;IAUlB,IAAI,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;;;;;;;IAcjB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAS1C,OAAO,CACjB,IAAI,EAAE,MAAM,GACb,cAAc,CAAC,oBAAoB,EAAE,IAAI,EAAE,IAAI,CAAC;IAUtC,OAAO,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;IAQjC;;;;;OAKG;IACI,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC;IAezD;;;;;;;OAOG;IACI,KAAK,CACR,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,GACf,cAAc,CAAC,UAAU,CAAC;IAqBP,OAAO;CAKhC"}
|
|
@@ -1,114 +1,117 @@
|
|
|
1
|
-
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await, __awaiter } from "tslib";
|
|
2
1
|
import { AutoDisposable } from '@yume-chan/event';
|
|
3
|
-
import { AdbFeatures } from '../../features';
|
|
4
|
-
import { AdbBufferedStream } from '../../stream';
|
|
5
|
-
import { AutoResetEvent } from '../../utils';
|
|
6
|
-
import { adbSyncOpenDir } from './list';
|
|
7
|
-
import { adbSyncPull } from './pull';
|
|
8
|
-
import { adbSyncPush } from './push';
|
|
9
|
-
import { adbSyncLstat, adbSyncStat } from './stat';
|
|
2
|
+
import { AdbFeatures } from '../../features.js';
|
|
3
|
+
import { AdbBufferedStream, WrapReadableStream, WrapWritableStream } from '../../stream/index.js';
|
|
4
|
+
import { AutoResetEvent } from '../../utils/index.js';
|
|
5
|
+
import { adbSyncOpenDir } from './list.js';
|
|
6
|
+
import { adbSyncPull } from './pull.js';
|
|
7
|
+
import { adbSyncPush } from './push.js';
|
|
8
|
+
import { adbSyncLstat, adbSyncStat } from './stat.js';
|
|
10
9
|
export class AdbSync extends AutoDisposable {
|
|
10
|
+
adb;
|
|
11
|
+
stream;
|
|
12
|
+
writer;
|
|
13
|
+
sendLock = this.addDisposable(new AutoResetEvent());
|
|
14
|
+
get supportsStat() {
|
|
15
|
+
return this.adb.features.includes(AdbFeatures.StatV2);
|
|
16
|
+
}
|
|
11
17
|
constructor(adb, socket) {
|
|
12
18
|
super();
|
|
13
|
-
this.sendLock = this.addDisposable(new AutoResetEvent());
|
|
14
19
|
this.adb = adb;
|
|
15
20
|
this.stream = new AdbBufferedStream(socket);
|
|
21
|
+
this.writer = socket.writable.getWriter();
|
|
16
22
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
finally {
|
|
27
|
-
this.sendLock.notify();
|
|
28
|
-
}
|
|
29
|
-
});
|
|
23
|
+
async lstat(path) {
|
|
24
|
+
await this.sendLock.wait();
|
|
25
|
+
try {
|
|
26
|
+
return adbSyncLstat(this.stream, this.writer, path, this.supportsStat);
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
this.sendLock.notify();
|
|
30
|
+
}
|
|
30
31
|
}
|
|
31
|
-
stat(path) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
});
|
|
32
|
+
async stat(path) {
|
|
33
|
+
if (!this.supportsStat) {
|
|
34
|
+
throw new Error('Not supported');
|
|
35
|
+
}
|
|
36
|
+
await this.sendLock.wait();
|
|
37
|
+
try {
|
|
38
|
+
return adbSyncStat(this.stream, this.writer, path);
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
this.sendLock.notify();
|
|
42
|
+
}
|
|
44
43
|
}
|
|
45
|
-
isDirectory(path) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
});
|
|
44
|
+
async isDirectory(path) {
|
|
45
|
+
try {
|
|
46
|
+
await this.lstat(path + '/');
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
55
52
|
}
|
|
56
|
-
opendir(path) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
});
|
|
53
|
+
async *opendir(path) {
|
|
54
|
+
await this.sendLock.wait();
|
|
55
|
+
try {
|
|
56
|
+
yield* adbSyncOpenDir(this.stream, this.writer, path);
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
this.sendLock.notify();
|
|
60
|
+
}
|
|
66
61
|
}
|
|
67
|
-
readdir(path) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const entry = _c.value;
|
|
74
|
-
results.push(entry);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
78
|
-
finally {
|
|
79
|
-
try {
|
|
80
|
-
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
|
|
81
|
-
}
|
|
82
|
-
finally { if (e_1) throw e_1.error; }
|
|
83
|
-
}
|
|
84
|
-
return results;
|
|
85
|
-
});
|
|
62
|
+
async readdir(path) {
|
|
63
|
+
const results = [];
|
|
64
|
+
for await (const entry of this.opendir(path)) {
|
|
65
|
+
results.push(entry);
|
|
66
|
+
}
|
|
67
|
+
return results;
|
|
86
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Read the content of a file on device.
|
|
71
|
+
*
|
|
72
|
+
* @param filename The full path of the file on device to read.
|
|
73
|
+
* @returns A `ReadableStream` that reads from the file.
|
|
74
|
+
*/
|
|
87
75
|
read(filename) {
|
|
88
|
-
return
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
76
|
+
return new WrapReadableStream({
|
|
77
|
+
start: async () => {
|
|
78
|
+
await this.sendLock.wait();
|
|
79
|
+
return {
|
|
80
|
+
readable: adbSyncPull(this.stream, this.writer, filename),
|
|
81
|
+
state: undefined,
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
close: async () => {
|
|
94
85
|
this.sendLock.notify();
|
|
95
|
-
}
|
|
86
|
+
},
|
|
96
87
|
});
|
|
97
88
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Write (or overwrite) a file on device.
|
|
91
|
+
*
|
|
92
|
+
* @param filename The full path of the file on device to write.
|
|
93
|
+
* @param mode The unix permissions of the file.
|
|
94
|
+
* @param mtime The modified time of the file.
|
|
95
|
+
* @returns A `WritableStream` that writes to the file.
|
|
96
|
+
*/
|
|
97
|
+
write(filename, mode, mtime) {
|
|
98
|
+
return new WrapWritableStream({
|
|
99
|
+
start: async () => {
|
|
100
|
+
await this.sendLock.wait();
|
|
101
|
+
return {
|
|
102
|
+
writable: adbSyncPush(this.stream, this.writer, filename, mode, mtime),
|
|
103
|
+
state: undefined,
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
close: async () => {
|
|
105
107
|
this.sendLock.notify();
|
|
106
108
|
}
|
|
107
109
|
});
|
|
108
110
|
}
|
|
109
|
-
dispose() {
|
|
111
|
+
async dispose() {
|
|
110
112
|
super.dispose();
|
|
111
113
|
this.stream.close();
|
|
114
|
+
await this.writer.close();
|
|
112
115
|
}
|
|
113
116
|
}
|
|
114
117
|
//# sourceMappingURL=sync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAkB,kBAAkB,EAAE,kBAAkB,EAA+C,MAAM,uBAAuB,CAAC;AAC/J,OA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MAAM,EAAE,QAAQ,CAAC;oBACzD,KAAK,EAAE,SAAS;iBACnB,CAAC;YACN,CAAC;YACD,KAAK,EAAE,KAAK,IAAI,EAAE;gBACd,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC3B,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CACR,QAAgB,EAChB,IAAa,EACb,KAAc;QAEd,OAAO,IAAI,kBAAkB,CAAC;YAC1B,KAAK,EAAE,KAAK,IAAI,EAAE;gBACd,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAC3B,OAAO;oBACH,QAAQ,EAAE,WAAW,CACjB,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,QAAQ,EACR,IAAI,EACJ,KAAK,CACR;oBACD,KAAK,EAAE,SAAS;iBACnB,CAAC;YACN,CAAC;YACD,KAAK,EAAE,KAAK,IAAI,EAAE;gBACd,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC3B,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;IAEe,KAAK,CAAC,OAAO;QACzB,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcpip.d.ts","sourceRoot":"","sources":["../../src/commands/tcpip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tcpip.d.ts","sourceRoot":"","sources":["../../src/commands/tcpip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,qBAAa,eAAgB,SAAQ,cAAc;IAClC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWpC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAMxC"}
|
package/esm/commands/tcpip.js
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AdbCommandBase } from './base';
|
|
1
|
+
import { AdbCommandBase } from './base.js';
|
|
3
2
|
export class AdbTcpIpCommand extends AdbCommandBase {
|
|
4
|
-
setPort(port) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
});
|
|
3
|
+
async setPort(port) {
|
|
4
|
+
if (port <= 0) {
|
|
5
|
+
throw new Error(`Invalid port ${port}`);
|
|
6
|
+
}
|
|
7
|
+
const output = await this.adb.createSocketAndWait(`tcpip:${port}`);
|
|
8
|
+
if (output !== `restarting in TCP mode port: ${port}\n`) {
|
|
9
|
+
throw new Error('Invalid response');
|
|
10
|
+
}
|
|
14
11
|
}
|
|
15
|
-
disable() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
});
|
|
12
|
+
async disable() {
|
|
13
|
+
const output = await this.adb.createSocketAndWait('usb:');
|
|
14
|
+
if (output !== 'restarting in USB mode\n') {
|
|
15
|
+
throw new Error('Invalid response');
|
|
16
|
+
}
|
|
22
17
|
}
|
|
23
18
|
}
|
|
24
19
|
//# sourceMappingURL=tcpip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcpip.js","sourceRoot":"","sources":["../../src/commands/tcpip.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tcpip.js","sourceRoot":"","sources":["../../src/commands/tcpip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,OAAO,eAAgB,SAAQ,cAAc;IACxC,KAAK,CAAC,OAAO,CAAC,IAAY;QAC7B,IAAI,IAAI,IAAI,CAAC,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;SAC3C;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QACnE,IAAI,MAAM,KAAK,gCAAgC,IAAI,IAAI,EAAE;YACrD,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;SACvC;IACL,CAAC;IAEM,KAAK,CAAC,OAAO;QAChB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC1D,IAAI,MAAM,KAAK,0BAA0B,EAAE;YACvC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;SACvC;IACL,CAAC;CACJ"}
|
package/esm/crypto.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare function getBig(array: Uint8Array, offset?: number, length?: number): bigint;
|
|
2
|
+
export declare function setBig(buffer: ArrayBuffer, value: bigint, offset?: number): void;
|
|
3
|
+
export declare function setBigLE(array: Uint8Array, value: bigint, offset?: number): void;
|
|
4
|
+
export declare function parsePrivateKey(key: Uint8Array): [n: bigint, d: bigint];
|
|
5
|
+
export declare function modInverse(a: number, m: number): number;
|
|
6
|
+
export declare function calculatePublicKeyLength(): number;
|
|
7
|
+
export declare function calculatePublicKey(privateKey: Uint8Array): Uint8Array;
|
|
8
|
+
export declare function calculatePublicKey(privateKey: Uint8Array, output: Uint8Array): number;
|
|
9
|
+
/**
|
|
10
|
+
* Modular exponentiation.
|
|
11
|
+
*
|
|
12
|
+
* Calculate `(base ** exponent) % modulus` without actually calculating `(base ** exponent)`.
|
|
13
|
+
*
|
|
14
|
+
* See https://en.wikipedia.org/wiki/Modular_exponentiation#Implementation_in_Lua
|
|
15
|
+
*/
|
|
16
|
+
export declare function powMod(base: bigint, exponent: bigint, modulus: bigint): bigint;
|
|
17
|
+
export declare const Sha1DigestLength = 20;
|
|
18
|
+
export declare const Asn1Sequence = 48;
|
|
19
|
+
export declare const Asn1OctetString = 4;
|
|
20
|
+
export declare const Asn1Null = 5;
|
|
21
|
+
export declare const Asn1Oid = 6;
|
|
22
|
+
export declare const Sha1DigestInfo: Uint8Array;
|
|
23
|
+
export declare function sign(privateKey: Uint8Array, data: Uint8Array): ArrayBuffer;
|
|
24
|
+
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAOA,wBAAgB,MAAM,CAClB,KAAK,EAAE,UAAU,EACjB,MAAM,SAAI,EACV,MAAM,SAA4B,GACnC,MAAM,CAeR;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,QAY5E;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,SAAI,QAOpE;AA4BD,wBAAgB,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAKvE;AAKD,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAsB9C;AAED,wBAAgB,wBAAwB,WAEvC;AAED,wBAAgB,kBAAkB,CAC9B,UAAU,EAAE,UAAU,GACvB,UAAU,CAAC;AACd,wBAAgB,kBAAkB,CAC9B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,UAAU,GACnB,MAAM,CAAC;AAwEV;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAkB9E;AAED,eAAO,MAAM,gBAAg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