@yume-chan/adb 0.0.16 → 0.0.18
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 +18 -0
- package/CHANGELOG.md +13 -1
- package/LICENSE +1 -1
- package/esm/adb.d.ts +13 -8
- package/esm/adb.d.ts.map +1 -1
- package/esm/adb.js +63 -38
- package/esm/adb.js.map +1 -1
- package/esm/auth.d.ts +4 -4
- package/esm/auth.d.ts.map +1 -1
- package/esm/auth.js +6 -6
- package/esm/auth.js.map +1 -1
- package/esm/backend.d.ts +3 -3
- package/esm/backend.d.ts.map +1 -1
- package/esm/commands/base.d.ts +2 -2
- package/esm/commands/base.d.ts.map +1 -1
- package/esm/commands/base.js +1 -1
- package/esm/commands/base.js.map +1 -1
- package/esm/commands/framebuffer.d.ts +22 -6
- package/esm/commands/framebuffer.d.ts.map +1 -1
- package/esm/commands/framebuffer.js +33 -45
- package/esm/commands/framebuffer.js.map +1 -1
- package/esm/commands/install.d.ts +2 -2
- package/esm/commands/install.d.ts.map +1 -1
- package/esm/commands/install.js +12 -5
- package/esm/commands/install.js.map +1 -1
- package/esm/commands/power.d.ts.map +1 -1
- package/esm/commands/power.js +13 -9
- package/esm/commands/power.js.map +1 -1
- package/esm/commands/reverse.d.ts +5 -5
- package/esm/commands/reverse.d.ts.map +1 -1
- package/esm/commands/reverse.js +20 -18
- package/esm/commands/reverse.js.map +1 -1
- package/esm/commands/subprocess/command.d.ts +52 -0
- package/esm/commands/subprocess/command.d.ts.map +1 -0
- package/esm/commands/subprocess/command.js +81 -0
- package/esm/commands/subprocess/command.js.map +1 -0
- package/esm/commands/subprocess/index.d.ts +1 -53
- package/esm/commands/subprocess/index.d.ts.map +1 -1
- package/esm/commands/subprocess/index.js +1 -85
- package/esm/commands/subprocess/index.js.map +1 -1
- package/esm/commands/subprocess/protocols/none.d.ts +5 -5
- package/esm/commands/subprocess/protocols/none.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/none.js +5 -3
- package/esm/commands/subprocess/protocols/none.js.map +1 -1
- package/esm/commands/subprocess/protocols/shell.d.ts +4 -4
- package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/shell.js +28 -20
- package/esm/commands/subprocess/protocols/shell.js.map +1 -1
- package/esm/commands/subprocess/protocols/types.d.ts +7 -7
- package/esm/commands/subprocess/protocols/types.d.ts.map +1 -1
- package/esm/commands/sync/index.d.ts +1 -1
- package/esm/commands/sync/index.d.ts.map +1 -1
- package/esm/commands/sync/index.js +1 -1
- package/esm/commands/sync/index.js.map +1 -1
- package/esm/commands/sync/list.d.ts +7 -7
- package/esm/commands/sync/list.d.ts.map +1 -1
- package/esm/commands/sync/list.js +34 -50
- package/esm/commands/sync/list.js.map +1 -1
- package/esm/commands/sync/pull.d.ts +5 -4
- package/esm/commands/sync/pull.d.ts.map +1 -1
- package/esm/commands/sync/pull.js +21 -22
- package/esm/commands/sync/pull.js.map +1 -1
- package/esm/commands/sync/push.d.ts +4 -4
- package/esm/commands/sync/push.d.ts.map +1 -1
- package/esm/commands/sync/push.js +7 -11
- package/esm/commands/sync/push.js.map +1 -1
- package/esm/commands/sync/request.d.ts +4 -4
- package/esm/commands/sync/request.d.ts.map +1 -1
- package/esm/commands/sync/request.js +6 -6
- package/esm/commands/sync/request.js.map +1 -1
- package/esm/commands/sync/response.d.ts +5 -10
- package/esm/commands/sync/response.d.ts.map +1 -1
- package/esm/commands/sync/response.js +35 -26
- package/esm/commands/sync/response.js.map +1 -1
- package/esm/commands/sync/stat.d.ts +7 -7
- package/esm/commands/sync/stat.d.ts.map +1 -1
- package/esm/commands/sync/stat.js +48 -55
- package/esm/commands/sync/stat.js.map +1 -1
- package/esm/commands/sync/sync.d.ts +7 -7
- package/esm/commands/sync/sync.d.ts.map +1 -1
- package/esm/commands/sync/sync.js +25 -22
- package/esm/commands/sync/sync.js.map +1 -1
- package/esm/crypto.d.ts.map +1 -1
- package/esm/crypto.js +26 -16
- package/esm/crypto.js.map +1 -1
- package/esm/index.d.ts +9 -10
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +9 -10
- package/esm/index.js.map +1 -1
- package/esm/packet.d.ts +8 -8
- package/esm/packet.d.ts.map +1 -1
- package/esm/packet.js +14 -12
- package/esm/packet.js.map +1 -1
- package/esm/socket/dispatcher.d.ts +11 -6
- package/esm/socket/dispatcher.d.ts.map +1 -1
- package/esm/socket/dispatcher.js +28 -20
- package/esm/socket/dispatcher.js.map +1 -1
- package/esm/socket/index.d.ts +1 -1
- package/esm/socket/index.d.ts.map +1 -1
- package/esm/socket/index.js +1 -1
- package/esm/socket/index.js.map +1 -1
- package/esm/socket/socket.d.ts +5 -5
- package/esm/socket/socket.d.ts.map +1 -1
- package/esm/socket/socket.js +37 -17
- package/esm/socket/socket.js.map +1 -1
- package/esm/utils/auto-reset-event.d.ts +1 -1
- package/esm/utils/auto-reset-event.d.ts.map +1 -1
- package/esm/utils/auto-reset-event.js +2 -2
- package/esm/utils/base64.d.ts +23 -0
- package/esm/utils/base64.d.ts.map +1 -1
- package/esm/utils/base64.js +36 -29
- package/esm/utils/base64.js.map +1 -1
- package/package.json +19 -17
- package/src/adb.ts +140 -86
- package/src/auth.ts +27 -18
- package/src/backend.ts +7 -4
- package/src/commands/base.ts +3 -2
- package/src/commands/framebuffer.ts +48 -47
- package/src/commands/install.ts +20 -10
- package/src/commands/power.ts +14 -10
- package/src/commands/reverse.ts +53 -33
- package/src/commands/subprocess/command.ts +134 -0
- package/src/commands/subprocess/index.ts +1 -137
- package/src/commands/subprocess/protocols/none.ts +10 -6
- package/src/commands/subprocess/protocols/shell.ts +72 -39
- package/src/commands/subprocess/protocols/types.ts +12 -8
- package/src/commands/sync/index.ts +1 -1
- package/src/commands/sync/list.ts +63 -68
- package/src/commands/sync/pull.ts +53 -37
- package/src/commands/sync/push.ts +26 -15
- package/src/commands/sync/request.ts +20 -21
- package/src/commands/sync/response.ts +63 -53
- package/src/commands/sync/stat.ts +91 -90
- package/src/commands/sync/sync.ts +56 -34
- package/src/crypto.ts +61 -33
- package/src/features.ts +1 -1
- package/src/index.ts +9 -11
- package/src/packet.ts +40 -30
- package/src/socket/dispatcher.ts +119 -77
- package/src/socket/index.ts +1 -1
- package/src/socket/socket.ts +68 -26
- package/src/utils/auto-reset-event.ts +3 -3
- package/src/utils/base64.ts +75 -42
- package/tsconfig.build.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/esm/stream/buffered.d.ts +0 -39
- package/esm/stream/buffered.d.ts.map +0 -1
- package/esm/stream/buffered.js +0 -143
- package/esm/stream/buffered.js.map +0 -1
- package/esm/stream/detect.d.ts +0 -2
- package/esm/stream/detect.d.ts.map +0 -1
- package/esm/stream/detect.js +0 -6
- package/esm/stream/detect.js.map +0 -1
- package/esm/stream/detect.native.d.ts +0 -240
- package/esm/stream/detect.native.d.ts.map +0 -1
- package/esm/stream/detect.native.js +0 -60
- package/esm/stream/detect.native.js.map +0 -1
- package/esm/stream/detect.polyfill.d.ts +0 -18
- package/esm/stream/detect.polyfill.d.ts.map +0 -1
- package/esm/stream/detect.polyfill.js +0 -4
- package/esm/stream/detect.polyfill.js.map +0 -1
- package/esm/stream/index.d.ts +0 -4
- package/esm/stream/index.d.ts.map +0 -1
- package/esm/stream/index.js +0 -4
- package/esm/stream/index.js.map +0 -1
- package/esm/stream/transform.d.ts +0 -124
- package/esm/stream/transform.d.ts.map +0 -1
- package/esm/stream/transform.js +0 -379
- package/esm/stream/transform.js.map +0 -1
- package/src/stream/buffered.ts +0 -168
- package/src/stream/detect.native.ts +0 -362
- package/src/stream/detect.polyfill.ts +0 -22
- package/src/stream/detect.ts +0 -7
- package/src/stream/index.ts +0 -3
- package/src/stream/transform.ts +0 -474
- package/tsconfig.test.json +0 -9
- package/web-streams-polyfill-4.0.0-beta.2.tgz +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
3
|
-
import {
|
|
4
|
-
import type
|
|
1
|
+
import { WritableStream, type ReadableStream } from "@yume-chan/stream-extra";
|
|
2
|
+
import { type Adb } from "../../../adb.js";
|
|
3
|
+
import { type AdbSocket } from "../../../socket/index.js";
|
|
4
|
+
import { type AdbSubprocessProtocol } from "./types.js";
|
|
5
5
|
export declare enum AdbShellProtocolId {
|
|
6
6
|
Stdin = 0,
|
|
7
7
|
Stdout = 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/shell.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/shell.ts"],"names":[],"mappings":"AACA,OAAO,EAKH,cAAc,EAGd,KAAK,cAAc,EAEtB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAG1D,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,oBAAY,kBAAkB;IAC1B,KAAK,IAAA;IACL,MAAM,IAAA;IACN,MAAM,IAAA;IACN,IAAI,IAAA;IACJ,UAAU,IAAA;IACV,gBAAgB,IAAA;CACnB;AAgFD;;;;;;;GAOG;AACH,qBAAa,0BAA2B,YAAW,qBAAqB;WACtD,WAAW,CAAC,GAAG,EAAE,GAAG;WAId,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM;WAO7B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM;IAMjD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAY;IACpC,OAAO,CAAC,aAAa,CAA0D;IAE/E,OAAO,CAAC,MAAM,CAA6B;IAC3C,IAAW,KAAK,+BAEf;IAED,OAAO,CAAC,OAAO,CAA6B;IAC5C,IAAW,MAAM,+BAEhB;IAED,OAAO,CAAC,OAAO,CAA6B;IAC5C,IAAW,MAAM,+BAEhB;IAED,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IACvD,IAAW,IAAI,oBAEd;gBAEkB,MAAM,EAAE,SAAS;IAkDvB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAYvC,IAAI;CAGd"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PromiseResolver } from
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { encodeUtf8 } from
|
|
1
|
+
import { PromiseResolver } from '@yume-chan/async';
|
|
2
|
+
import { PushReadableStream, StructDeserializeStream, StructSerializeStream, TransformStream, WritableStream, pipeFrom, } from "@yume-chan/stream-extra";
|
|
3
|
+
import Struct, { placeholder } from '@yume-chan/struct';
|
|
4
|
+
import { AdbFeatures } from '../../../features.js';
|
|
5
|
+
import { encodeUtf8 } from '../../../utils/index.js';
|
|
6
6
|
export var AdbShellProtocolId;
|
|
7
7
|
(function (AdbShellProtocolId) {
|
|
8
8
|
AdbShellProtocolId[AdbShellProtocolId["Stdin"] = 0] = "Stdin";
|
|
@@ -46,10 +46,12 @@ class StdoutDeserializeStream extends TransformStream {
|
|
|
46
46
|
class MultiplexStream {
|
|
47
47
|
_readable;
|
|
48
48
|
_readableController;
|
|
49
|
-
get readable() {
|
|
49
|
+
get readable() {
|
|
50
|
+
return this._readable;
|
|
51
|
+
}
|
|
50
52
|
_activeCount = 0;
|
|
51
53
|
constructor() {
|
|
52
|
-
this._readable = new PushReadableStream(controller => {
|
|
54
|
+
this._readable = new PushReadableStream((controller) => {
|
|
53
55
|
this._readableController = controller;
|
|
54
56
|
});
|
|
55
57
|
}
|
|
@@ -61,13 +63,13 @@ class MultiplexStream {
|
|
|
61
63
|
write: async (chunk) => {
|
|
62
64
|
await this._readableController.enqueue(chunk);
|
|
63
65
|
},
|
|
64
|
-
abort:
|
|
66
|
+
abort: () => {
|
|
65
67
|
this._activeCount -= 1;
|
|
66
68
|
if (this._activeCount === 0) {
|
|
67
69
|
this._readableController.close();
|
|
68
70
|
}
|
|
69
71
|
},
|
|
70
|
-
close:
|
|
72
|
+
close: () => {
|
|
71
73
|
this._activeCount -= 1;
|
|
72
74
|
if (this._activeCount === 0) {
|
|
73
75
|
this._readableController.close();
|
|
@@ -98,13 +100,21 @@ export class AdbSubprocessShellProtocol {
|
|
|
98
100
|
_socket;
|
|
99
101
|
_socketWriter;
|
|
100
102
|
_stdin;
|
|
101
|
-
get stdin() {
|
|
103
|
+
get stdin() {
|
|
104
|
+
return this._stdin;
|
|
105
|
+
}
|
|
102
106
|
_stdout;
|
|
103
|
-
get stdout() {
|
|
107
|
+
get stdout() {
|
|
108
|
+
return this._stdout;
|
|
109
|
+
}
|
|
104
110
|
_stderr;
|
|
105
|
-
get stderr() {
|
|
111
|
+
get stderr() {
|
|
112
|
+
return this._stderr;
|
|
113
|
+
}
|
|
106
114
|
_exit = new PromiseResolver();
|
|
107
|
-
get exit() {
|
|
115
|
+
get exit() {
|
|
116
|
+
return this._exit.promise;
|
|
117
|
+
}
|
|
108
118
|
constructor(socket) {
|
|
109
119
|
this._socket = socket;
|
|
110
120
|
// Check this image to help you understand the stream graph
|
|
@@ -124,15 +134,13 @@ export class AdbSubprocessShellProtocol {
|
|
|
124
134
|
return;
|
|
125
135
|
}
|
|
126
136
|
controller.enqueue(chunk);
|
|
127
|
-
}
|
|
137
|
+
},
|
|
128
138
|
}))
|
|
129
139
|
.tee();
|
|
130
|
-
this._stdout = stdout
|
|
131
|
-
|
|
132
|
-
this._stderr = stderr
|
|
133
|
-
.pipeThrough(new StdoutDeserializeStream(AdbShellProtocolId.Stderr));
|
|
140
|
+
this._stdout = stdout.pipeThrough(new StdoutDeserializeStream(AdbShellProtocolId.Stdout));
|
|
141
|
+
this._stderr = stderr.pipeThrough(new StdoutDeserializeStream(AdbShellProtocolId.Stderr));
|
|
134
142
|
const multiplexer = new MultiplexStream();
|
|
135
|
-
multiplexer.readable
|
|
143
|
+
void multiplexer.readable
|
|
136
144
|
.pipeThrough(new StructSerializeStream(AdbShellProtocolPacket))
|
|
137
145
|
.pipeTo(socket.writable);
|
|
138
146
|
this._stdin = pipeFrom(multiplexer.createWriteable(), new StdinSerializeStream());
|
|
@@ -144,7 +152,7 @@ export class AdbSubprocessShellProtocol {
|
|
|
144
152
|
data: encodeUtf8(
|
|
145
153
|
// The "correct" format is `${rows}x${cols},${x_pixels}x${y_pixels}`
|
|
146
154
|
// However, according to https://linux.die.net/man/4/tty_ioctl
|
|
147
|
-
// `x_pixels` and `y_pixels` are
|
|
155
|
+
// `x_pixels` and `y_pixels` are unused, so always sending `0` should be fine.
|
|
148
156
|
`${rows}x${cols},0x0\0`),
|
|
149
157
|
});
|
|
150
158
|
}
|
|
@@ -1 +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,
|
|
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,EACH,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,QAAQ,GAIX,MAAM,yBAAyB,CAAC;AACjC,OAAO,MAAM,EAAE,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrD,MAAM,CAAN,IAAY,kBAOX;AAPD,WAAY,kBAAkB;IAC1B,6DAAK,CAAA;IACL,+DAAM,CAAA;IACN,+DAAM,CAAA;IACN,2DAAI,CAA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zD,CAAC;QACF,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,WAAW,CAC7B,IAAI,uBAAuB,CAAC,kBAAkB,CAAC,MAAM,CAAC,CACzD,CAAC;QAEF,MAAM,WAAW,GAAG,IAAI,eAAe,EAA8B,CAAC;QACtE,KAAK,WAAW,CAAC,QAAQ;aACpB,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,8EAA8E;YAC9E,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"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
4
|
-
import
|
|
1
|
+
import { type ReadableStream, type WritableStream } from "@yume-chan/stream-extra";
|
|
2
|
+
import { type ValueOrPromise } from "@yume-chan/struct";
|
|
3
|
+
import { type Adb } from "../../../adb.js";
|
|
4
|
+
import { type AdbSocket } from "../../../socket/index.js";
|
|
5
5
|
export interface AdbSubprocessProtocol {
|
|
6
6
|
/**
|
|
7
|
-
* A WritableStream that writes to the `stdin`
|
|
7
|
+
* A WritableStream that writes to the `stdin` stream.
|
|
8
8
|
*/
|
|
9
9
|
readonly stdin: WritableStream<Uint8Array>;
|
|
10
10
|
/**
|
|
11
|
-
* The `stdout`
|
|
11
|
+
* The `stdout` stream of the process.
|
|
12
12
|
*/
|
|
13
13
|
readonly stdout: ReadableStream<Uint8Array>;
|
|
14
14
|
/**
|
|
15
|
-
* The `stderr`
|
|
15
|
+
* The `stderr` stream of the process.
|
|
16
16
|
*
|
|
17
17
|
* Note: Some `AdbSubprocessProtocol` doesn't separate `stdout` and `stderr`,
|
|
18
18
|
* All output will be sent to `stdout`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,cAAc,EACnB,KAAK,cAAc,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,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,KAAK,MAAM,EAAE,SAAS,GAAG,qBAAqB,CAAC;CAClD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './list.js';
|
|
2
2
|
export * from './pull.js';
|
|
3
|
+
export * from './push.js';
|
|
3
4
|
export * from './request.js';
|
|
4
5
|
export * from './response.js';
|
|
5
|
-
export * from './push.js';
|
|
6
6
|
export * from './stat.js';
|
|
7
7
|
export * from './sync.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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,
|
|
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,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './list.js';
|
|
2
2
|
export * from './pull.js';
|
|
3
|
+
export * from './push.js';
|
|
3
4
|
export * from './request.js';
|
|
4
5
|
export * from './response.js';
|
|
5
|
-
export * from './push.js';
|
|
6
6
|
export * from './stat.js';
|
|
7
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,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,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,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { AdbSyncResponseId } from
|
|
4
|
-
import { type AdbSyncStat } from
|
|
1
|
+
import { type BufferedReadableStream, type WritableStreamDefaultWriter } from "@yume-chan/stream-extra";
|
|
2
|
+
import Struct from "@yume-chan/struct";
|
|
3
|
+
import { AdbSyncResponseId } from "./response.js";
|
|
4
|
+
import { type AdbSyncStat } from "./stat.js";
|
|
5
5
|
export interface AdbSyncEntry extends AdbSyncStat {
|
|
6
6
|
name: string;
|
|
7
7
|
}
|
|
@@ -16,7 +16,7 @@ export declare const AdbSyncEntryResponse: Struct<{
|
|
|
16
16
|
readonly permission: number;
|
|
17
17
|
id: AdbSyncResponseId.Entry;
|
|
18
18
|
}, undefined>;
|
|
19
|
-
export
|
|
19
|
+
export type AdbSyncEntryResponse = typeof AdbSyncEntryResponse["TDeserializeResult"];
|
|
20
20
|
export declare const AdbSyncEntry2Response: Struct<{
|
|
21
21
|
error: import("./stat.js").AdbSyncStatErrorCode;
|
|
22
22
|
dev: bigint;
|
|
@@ -36,6 +36,6 @@ export declare const AdbSyncEntry2Response: Struct<{
|
|
|
36
36
|
readonly permission: number;
|
|
37
37
|
id: AdbSyncResponseId.Entry2;
|
|
38
38
|
}, undefined>;
|
|
39
|
-
export
|
|
40
|
-
export declare function adbSyncOpenDir(stream:
|
|
39
|
+
export type AdbSyncEntry2Response = typeof AdbSyncEntry2Response["TDeserializeResult"];
|
|
40
|
+
export declare function adbSyncOpenDir(stream: BufferedReadableStream, writer: WritableStreamDefaultWriter<Uint8Array>, path: string, v2: boolean): AsyncGenerator<AdbSyncEntry, void, void>;
|
|
41
41
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/list.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/list.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,iBAAiB,EAAwB,MAAM,eAAe,CAAC;AACxE,OAAO,EAGH,KAAK,WAAW,EACnB,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC7C,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,oBAAoB;;;;;;;;;;aAImB,CAAC;AAErD,MAAM,MAAM,oBAAoB,GAC5B,OAAO,oBAAoB,CAAC,oBAAoB,CAAC,CAAC;AAEtD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;aAImB,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAC7B,OAAO,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;AAEvD,wBAAuB,cAAc,CACjC,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,EAC/C,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,OAAO,GACZ,cAAc,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAuC1C"}
|
|
@@ -1,63 +1,47 @@
|
|
|
1
|
-
import Struct from
|
|
2
|
-
import { AdbSyncRequestId, adbSyncWriteRequest } from
|
|
3
|
-
import {
|
|
4
|
-
import { AdbSyncLstatResponse, AdbSyncStatResponse } from
|
|
1
|
+
import Struct from "@yume-chan/struct";
|
|
2
|
+
import { AdbSyncRequestId, adbSyncWriteRequest } from "./request.js";
|
|
3
|
+
import { AdbSyncResponseId, adbSyncReadResponses } from "./response.js";
|
|
4
|
+
import { AdbSyncLstatResponse, AdbSyncStatResponse, } from "./stat.js";
|
|
5
5
|
export const AdbSyncEntryResponse = new Struct({ littleEndian: true })
|
|
6
6
|
.fields(AdbSyncLstatResponse)
|
|
7
|
-
.uint32(
|
|
8
|
-
.string(
|
|
7
|
+
.uint32("nameLength")
|
|
8
|
+
.string("name", { lengthField: "nameLength" })
|
|
9
9
|
.extra({ id: AdbSyncResponseId.Entry });
|
|
10
10
|
export const AdbSyncEntry2Response = new Struct({ littleEndian: true })
|
|
11
11
|
.fields(AdbSyncStatResponse)
|
|
12
|
-
.uint32(
|
|
13
|
-
.string(
|
|
12
|
+
.uint32("nameLength")
|
|
13
|
+
.string("name", { lengthField: "nameLength" })
|
|
14
14
|
.extra({ id: AdbSyncResponseId.Entry2 });
|
|
15
|
-
const LIST_V1_RESPONSE_TYPES = {
|
|
16
|
-
[AdbSyncResponseId.Entry]: AdbSyncEntryResponse,
|
|
17
|
-
[AdbSyncResponseId.Done]: new AdbSyncDoneResponse(AdbSyncEntryResponse.size),
|
|
18
|
-
};
|
|
19
|
-
const LIST_V2_RESPONSE_TYPES = {
|
|
20
|
-
[AdbSyncResponseId.Entry2]: AdbSyncEntry2Response,
|
|
21
|
-
[AdbSyncResponseId.Done]: new AdbSyncDoneResponse(AdbSyncEntry2Response.size),
|
|
22
|
-
};
|
|
23
15
|
export async function* adbSyncOpenDir(stream, writer, path, v2) {
|
|
24
|
-
let requestId;
|
|
25
|
-
let responseType;
|
|
26
16
|
if (v2) {
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
await adbSyncWriteRequest(writer, AdbSyncRequestId.List2, path);
|
|
18
|
+
for await (const item of adbSyncReadResponses(stream, AdbSyncResponseId.Entry2, AdbSyncEntry2Response)) {
|
|
19
|
+
// `LST2` can return error codes for failed `lstat` calls.
|
|
20
|
+
// `LIST` just ignores them.
|
|
21
|
+
// But they only contain `name` so still pretty useless.
|
|
22
|
+
if (item.error !== 0) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
yield item;
|
|
26
|
+
}
|
|
29
27
|
}
|
|
30
28
|
else {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
+
await adbSyncWriteRequest(writer, AdbSyncRequestId.List, path);
|
|
30
|
+
for await (const item of adbSyncReadResponses(stream, AdbSyncResponseId.Entry, AdbSyncEntryResponse)) {
|
|
31
|
+
// Convert to same format as `AdbSyncEntry2Response` for easier consumption.
|
|
32
|
+
// However it will add some overhead.
|
|
33
|
+
yield {
|
|
34
|
+
mode: item.mode,
|
|
35
|
+
size: BigInt(item.size),
|
|
36
|
+
mtime: BigInt(item.mtime),
|
|
37
|
+
get type() {
|
|
38
|
+
return item.type;
|
|
39
|
+
},
|
|
40
|
+
get permission() {
|
|
41
|
+
return item.permission;
|
|
42
|
+
},
|
|
43
|
+
name: item.name,
|
|
44
|
+
};
|
|
61
45
|
}
|
|
62
46
|
}
|
|
63
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/sync/list.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/sync/list.ts"],"names":[],"mappings":"AAIA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EACH,oBAAoB,EACpB,mBAAmB,GAEtB,MAAM,WAAW,CAAC;AAMnB,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;KACjE,MAAM,CAAC,oBAAoB,CAAC;KAC5B,MAAM,CAAC,YAAY,CAAC;KACpB,MAAM,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;KAC7C,KAAK,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,KAAc,EAAE,CAAC,CAAC;AAKrD,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;KAClE,MAAM,CAAC,mBAAmB,CAAC;KAC3B,MAAM,CAAC,YAAY,CAAC;KACpB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
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { AdbSyncResponseId } from
|
|
1
|
+
import { ReadableStream, type BufferedReadableStream, type WritableStreamDefaultWriter } from "@yume-chan/stream-extra";
|
|
2
|
+
import Struct from "@yume-chan/struct";
|
|
3
|
+
import { AdbSyncResponseId } from "./response.js";
|
|
4
4
|
export declare const AdbSyncDataResponse: Struct<{
|
|
5
5
|
dataLength: number;
|
|
6
6
|
data: Uint8Array;
|
|
7
7
|
}, "dataLength", {
|
|
8
8
|
id: AdbSyncResponseId.Data;
|
|
9
9
|
}, undefined>;
|
|
10
|
-
export
|
|
10
|
+
export type AdbSyncDataResponse = typeof AdbSyncDataResponse["TDeserializeResult"];
|
|
11
|
+
export declare function adbSyncPull(stream: BufferedReadableStream, writer: WritableStreamDefaultWriter<Uint8Array>, path: string): ReadableStream<Uint8Array>;
|
|
11
12
|
//# sourceMappingURL=pull.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/pull.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/pull.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,EACd,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,iBAAiB,EAAwB,MAAM,eAAe,CAAC;AAExE,eAAO,MAAM,mBAAmB;;;;;aAGmB,CAAC;AAEpD,MAAM,MAAM,mBAAmB,GAC3B,OAAO,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;AAErD,wBAAgB,WAAW,CACvB,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,EAC/C,IAAI,EAAE,MAAM,GACb,cAAc,CAAC,UAAU,CAAC,CAuC5B"}
|
|
@@ -1,39 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { AdbSyncRequestId, adbSyncWriteRequest } from
|
|
4
|
-
import {
|
|
1
|
+
import { ReadableStream, } from "@yume-chan/stream-extra";
|
|
2
|
+
import Struct from "@yume-chan/struct";
|
|
3
|
+
import { AdbSyncRequestId, adbSyncWriteRequest } from "./request.js";
|
|
4
|
+
import { AdbSyncResponseId, adbSyncReadResponses } from "./response.js";
|
|
5
5
|
export const AdbSyncDataResponse = new Struct({ littleEndian: true })
|
|
6
|
-
.uint32(
|
|
7
|
-
.uint8Array(
|
|
6
|
+
.uint32("dataLength")
|
|
7
|
+
.uint8Array("data", { lengthField: "dataLength" })
|
|
8
8
|
.extra({ id: AdbSyncResponseId.Data });
|
|
9
|
-
const RESPONSE_TYPES = {
|
|
10
|
-
[AdbSyncResponseId.Data]: AdbSyncDataResponse,
|
|
11
|
-
[AdbSyncResponseId.Done]: new AdbSyncDoneResponse(AdbSyncDataResponse.size),
|
|
12
|
-
};
|
|
13
9
|
export function adbSyncPull(stream, writer, path) {
|
|
10
|
+
let generator;
|
|
14
11
|
return new ReadableStream({
|
|
15
12
|
async start() {
|
|
13
|
+
// TODO: If `ReadableStream.from(AsyncGenerator)` is added to spec, use it instead.
|
|
16
14
|
await adbSyncWriteRequest(writer, AdbSyncRequestId.Receive, path);
|
|
15
|
+
generator = adbSyncReadResponses(stream, AdbSyncResponseId.Data, AdbSyncDataResponse);
|
|
17
16
|
},
|
|
18
17
|
async pull(controller) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
break;
|
|
24
|
-
case AdbSyncResponseId.Done:
|
|
25
|
-
controller.close();
|
|
26
|
-
break;
|
|
27
|
-
default:
|
|
28
|
-
throw new Error('Unexpected response id');
|
|
18
|
+
const { done, value } = await generator.next();
|
|
19
|
+
if (done) {
|
|
20
|
+
controller.close();
|
|
21
|
+
return;
|
|
29
22
|
}
|
|
23
|
+
controller.enqueue(value.data);
|
|
30
24
|
},
|
|
31
25
|
cancel() {
|
|
32
|
-
|
|
26
|
+
generator.return().catch((e) => {
|
|
27
|
+
void e;
|
|
28
|
+
});
|
|
29
|
+
throw new Error(`Sync commands can't be canceled.`);
|
|
33
30
|
},
|
|
34
31
|
}, {
|
|
35
32
|
highWaterMark: 16 * 1024,
|
|
36
|
-
size(chunk) {
|
|
33
|
+
size(chunk) {
|
|
34
|
+
return chunk.byteLength;
|
|
35
|
+
},
|
|
37
36
|
});
|
|
38
37
|
}
|
|
39
38
|
//# sourceMappingURL=pull.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../src/commands/sync/pull.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../src/commands/sync/pull.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,cAAc,GAGjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAExE,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;KAChE,MAAM,CAAC,YAAY,CAAC;KACpB,UAAU,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;KACjD,KAAK,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,IAAa,EAAE,CAAC,CAAC;AAKpD,MAAM,UAAU,WAAW,CACvB,MAA8B,EAC9B,MAA+C,EAC/C,IAAY;IAEZ,IAAI,SAA2D,CAAC;IAChE,OAAO,IAAI,cAAc,CACrB;QACI,KAAK,CAAC,KAAK;YACP,mFAAmF;YACnF,MAAM,mBAAmB,CACrB,MAAM,EACN,gBAAgB,CAAC,OAAO,EACxB,IAAI,CACP,CAAC;YACF,SAAS,GAAG,oBAAoB,CAC5B,MAAM,EACN,iBAAiB,CAAC,IAAI,EACtB,mBAAmB,CACtB,CAAC;QACN,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,UAAU;YACjB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC;YAC/C,IAAI,IAAI,EAAE;gBACN,UAAU,CAAC,KAAK,EAAE,CAAC;gBACnB,OAAO;aACV;YACD,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;QACD,MAAM;YACF,SAAS,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC3B,KAAK,CAAC,CAAC;YACX,CAAC,CAAC,CAAC;YACH,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACxD,CAAC;KACJ,EACD;QACI,aAAa,EAAE,EAAE,GAAG,IAAI;QACxB,IAAI,CAAC,KAAK;YACN,OAAO,KAAK,CAAC,UAAU,CAAC;QAC5B,CAAC;KACJ,CACJ,CAAC;AACN,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { WritableStream, type BufferedReadableStream, type WritableStreamDefaultWriter } from "@yume-chan/stream-extra";
|
|
2
|
+
import Struct from "@yume-chan/struct";
|
|
3
3
|
export declare const AdbSyncOkResponse: Struct<{
|
|
4
4
|
unused: number;
|
|
5
|
-
}, never,
|
|
5
|
+
}, never, Record<never, never>, undefined>;
|
|
6
6
|
export declare const ADB_SYNC_MAX_PACKET_SIZE: number;
|
|
7
|
-
export declare function adbSyncPush(stream:
|
|
7
|
+
export declare function adbSyncPush(stream: BufferedReadableStream, writer: WritableStreamDefaultWriter<Uint8Array>, filename: string, mode?: number, mtime?: number, packetSize?: number): WritableStream<Uint8Array>;
|
|
8
8
|
//# sourceMappingURL=push.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/push.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/push.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,cAAc,EAEd,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAMvC,eAAO,MAAM,iBAAiB;;0CAE7B,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAAY,CAAC;AAElD,wBAAgB,WAAW,CACvB,MAAM,EAAE,sBAAsB,EAC9B,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,CAyB5B"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { AdbSyncRequestId, adbSyncWriteRequest } from
|
|
4
|
-
import {
|
|
5
|
-
import { LinuxFileType } from
|
|
6
|
-
export const AdbSyncOkResponse = new Struct({ littleEndian: true })
|
|
7
|
-
.uint32('unused');
|
|
8
|
-
const ResponseTypes = {
|
|
9
|
-
[AdbSyncResponseId.Ok]: AdbSyncOkResponse,
|
|
10
|
-
};
|
|
1
|
+
import { ChunkStream, WritableStream, pipeFrom, } from "@yume-chan/stream-extra";
|
|
2
|
+
import Struct from "@yume-chan/struct";
|
|
3
|
+
import { AdbSyncRequestId, adbSyncWriteRequest } from "./request.js";
|
|
4
|
+
import { AdbSyncResponseId, adbSyncReadResponse } from "./response.js";
|
|
5
|
+
import { LinuxFileType } from "./stat.js";
|
|
6
|
+
export const AdbSyncOkResponse = new Struct({ littleEndian: true }).uint32("unused");
|
|
11
7
|
export const ADB_SYNC_MAX_PACKET_SIZE = 64 * 1024;
|
|
12
8
|
export function adbSyncPush(stream, writer, filename, mode = (LinuxFileType.File << 12) | 0o666, mtime = (Date.now() / 1000) | 0, packetSize = ADB_SYNC_MAX_PACKET_SIZE) {
|
|
13
9
|
return pipeFrom(new WritableStream({
|
|
@@ -20,7 +16,7 @@ export function adbSyncPush(stream, writer, filename, mode = (LinuxFileType.File
|
|
|
20
16
|
},
|
|
21
17
|
async close() {
|
|
22
18
|
await adbSyncWriteRequest(writer, AdbSyncRequestId.Done, mtime);
|
|
23
|
-
await adbSyncReadResponse(stream,
|
|
19
|
+
await adbSyncReadResponse(stream, AdbSyncResponseId.Ok, AdbSyncOkResponse);
|
|
24
20
|
},
|
|
25
21
|
}), new ChunkStream(packetSize));
|
|
26
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../../src/commands/sync/push.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../../src/commands/sync/push.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,cAAc,EACd,QAAQ,GAGX,MAAM,yBAAyB,CAAC;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CACtE,QAAQ,CACX,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,IAAI,CAAC;AAElD,MAAM,UAAU,WAAW,CACvB,MAA8B,EAC9B,MAA+C,EAC/C,QAAgB,EAChB,OAAe,CAAC,aAAa,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,KAAK,EACjD,QAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EACvC,aAAqB,wBAAwB;IAE7C,OAAO,QAAQ,CACX,IAAI,cAAc,CAAa;QAC3B,KAAK,CAAC,KAAK;YACP,MAAM,WAAW,GAAG,GAAG,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;YACrD,MAAM,mBAAmB,CACrB,MAAM,EACN,gBAAgB,CAAC,IAAI,EACrB,WAAW,CACd,CAAC;QACN,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,KAAK;YACb,MAAM,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACpE,CAAC;QACD,KAAK,CAAC,KAAK;YACP,MAAM,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAChE,MAAM,mBAAmB,CACrB,MAAM,EACN,iBAAiB,CAAC,EAAE,EACpB,iBAAiB,CACpB,CAAC;QACN,CAAC;KACJ,CAAC,EACF,IAAI,WAAW,CAAC,UAAU,CAAC,CAC9B,CAAC;AACN,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { type WritableStreamDefaultWriter } from "@yume-chan/stream-extra";
|
|
2
|
+
import Struct from "@yume-chan/struct";
|
|
3
3
|
export declare enum AdbSyncRequestId {
|
|
4
4
|
List = "LIST",
|
|
5
5
|
List2 = "LIS2",
|
|
@@ -14,11 +14,11 @@ export declare enum AdbSyncRequestId {
|
|
|
14
14
|
export declare const AdbSyncNumberRequest: Struct<{
|
|
15
15
|
id: string;
|
|
16
16
|
arg: number;
|
|
17
|
-
}, never,
|
|
17
|
+
}, never, Record<never, never>, undefined>;
|
|
18
18
|
export declare const AdbSyncDataRequest: Struct<{
|
|
19
19
|
id: string;
|
|
20
20
|
arg: number;
|
|
21
21
|
data: Uint8Array;
|
|
22
|
-
}, "arg",
|
|
22
|
+
}, "arg", Record<never, never>, undefined>;
|
|
23
23
|
export declare function adbSyncWriteRequest(writer: WritableStreamDefaultWriter<Uint8Array>, id: AdbSyncRequestId | string, value: number | string | Uint8Array): Promise<void>;
|
|
24
24
|
//# sourceMappingURL=request.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/request.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAIvC,oBAAY,gBAAgB;IACxB,IAAI,SAAS;IACb,KAAK,SAAS;IACd,IAAI,SAAS;IACb,KAAK,SAAS;IACd,IAAI,SAAS;IACb,MAAM,SAAS;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,OAAO,SAAS;CACnB;AAED,eAAO,MAAM,oBAAoB;;;0CAEf,CAAC;AAEnB,eAAO,MAAM,kBAAkB;;;;0CAEgB,CAAC;AAEhD,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,2BAA2B,CAAC,UAAU,CAAC,EAC/C,EAAE,EAAE,gBAAgB,GAAG,MAAM,EAC7B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GACpC,OAAO,CAAC,IAAI,CAAC,CAmBf"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Struct from
|
|
1
|
+
import Struct from "@yume-chan/struct";
|
|
2
2
|
import { encodeUtf8 } from "../../utils/index.js";
|
|
3
3
|
export var AdbSyncRequestId;
|
|
4
4
|
(function (AdbSyncRequestId) {
|
|
@@ -13,20 +13,20 @@ export var AdbSyncRequestId;
|
|
|
13
13
|
AdbSyncRequestId["Receive"] = "RECV";
|
|
14
14
|
})(AdbSyncRequestId = AdbSyncRequestId || (AdbSyncRequestId = {}));
|
|
15
15
|
export const AdbSyncNumberRequest = new Struct({ littleEndian: true })
|
|
16
|
-
.string(
|
|
17
|
-
.uint32(
|
|
16
|
+
.string("id", { length: 4 })
|
|
17
|
+
.uint32("arg");
|
|
18
18
|
export const AdbSyncDataRequest = new Struct({ littleEndian: true })
|
|
19
19
|
.fields(AdbSyncNumberRequest)
|
|
20
|
-
.uint8Array(
|
|
20
|
+
.uint8Array("data", { lengthField: "arg" });
|
|
21
21
|
export async function adbSyncWriteRequest(writer, id, value) {
|
|
22
22
|
let buffer;
|
|
23
|
-
if (typeof value ===
|
|
23
|
+
if (typeof value === "number") {
|
|
24
24
|
buffer = AdbSyncNumberRequest.serialize({
|
|
25
25
|
id,
|
|
26
26
|
arg: value,
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
else if (typeof value ===
|
|
29
|
+
else if (typeof value === "string") {
|
|
30
30
|
buffer = AdbSyncDataRequest.serialize({
|
|
31
31
|
id,
|
|
32
32
|
data: encodeUtf8(value),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/commands/sync/request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/commands/sync/request.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,CAAN,IAAY,gBAUX;AAVD,WAAY,gBAAgB;IACxB,iCAAa,CAAA;IACb,kCAAc,CAAA;IACd,iCAAa,CAAA;IACb,kCAAc,CAAA;IACd,iCAAa,CAAA;IACb,mCAAe,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