@ekhein/lamda-node-sdk 2.2.3 → 10.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -5
- package/dist/main.d.ts +4 -4
- package/dist/main.js +10 -10
- package/dist/rpc/application.d.ts +103 -20
- package/dist/rpc/application.js +1386 -212
- package/dist/rpc/proxy.d.ts +22 -0
- package/dist/rpc/proxy.js +134 -1
- package/dist/rpc/services.d.ts +223 -93
- package/dist/rpc/services.js +160 -56
- package/dist/rpc/uiautomator.d.ts +79 -5
- package/dist/rpc/uiautomator.js +1032 -40
- package/dist/rpc/util.d.ts +19 -0
- package/dist/rpc/util.js +172 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
# @ekhein/lamda-node-sdk
|
|
2
|
+
|
|
3
|
+
`lamda` Node.js gRPC SDK,当前 RPC 定义已同步到 FIRERPA `v10.8`。
|
|
4
|
+
|
|
5
|
+
## 从上游重新生成
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm install
|
|
2
9
|
|
|
3
|
-
```
|
|
4
10
|
protoc \
|
|
5
11
|
--plugin=protoc-gen-ts_proto=./node_modules/.bin/protoc-gen-ts_proto \
|
|
6
|
-
--ts_proto_out=./
|
|
12
|
+
--ts_proto_out=./src/rpc \
|
|
7
13
|
--ts_proto_opt=outputServices=nice-grpc,outputServices=generic-definitions,useExactTypes=false \
|
|
8
|
-
--proto_path=./proto/google \
|
|
9
14
|
--proto_path=./proto/rpc \
|
|
15
|
+
--proto_path=./proto \
|
|
10
16
|
./proto/rpc/services.proto
|
|
11
|
-
|
|
17
|
+
|
|
18
|
+
pnpm build
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## v10.8 同步说明
|
|
22
|
+
|
|
23
|
+
- 新增 APK/XAPK 安装会话接口:`installSessionCreate`、`installSessionWrite`、`installSessionCommit`、`installSessionQuery`、`installSessionAbandon`。
|
|
24
|
+
- 新增虚拟显示与多显示器接口,以及针对指定 display 的 UI 自动化参数。
|
|
25
|
+
- 更新 Watcher 协议类型:`WatcherControlRequest`、`WatcherInfo`、`WatcherInfoList`。
|
|
26
|
+
- 新增 `pointLongClick`、`playAudio`、Shadowsocks/HTTPS 代理配置和 `ServerInfoResponse.privileged`。
|
|
27
|
+
- 上游已删除若干旧 RPC;`ApplicationActivityRequest.extras` 已改为 `ActivityExtras`。升级时请按 TypeScript 编译错误调整调用。
|
package/dist/main.d.ts
CHANGED
|
@@ -16,14 +16,14 @@ export declare class Device {
|
|
|
16
16
|
readonly Settings: SettingsClient;
|
|
17
17
|
private channel;
|
|
18
18
|
private client;
|
|
19
|
-
constructor();
|
|
19
|
+
constructor(ipaddr: string, port?: number);
|
|
20
20
|
click(selector: Partial<Selector>, corner?: Corner): Promise<import("./rpc/types").Boolean>;
|
|
21
|
-
|
|
21
|
+
keyboard(keys: string, selector: Record<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9", Partial<Selector>>): Promise<void>;
|
|
22
22
|
waitFor(selector: Partial<Selector>, timeout?: number): Promise<true>;
|
|
23
23
|
sleep(min?: number, max?: number): Promise<unknown>;
|
|
24
|
-
|
|
24
|
+
openURLScheme(data: string): Promise<import("./rpc/types").Boolean>;
|
|
25
25
|
kill(name: string): Promise<import("./rpc/types").Boolean>;
|
|
26
|
-
|
|
26
|
+
start(name: string): Promise<import("./rpc/types").Boolean>;
|
|
27
27
|
restart(name: string): Promise<void>;
|
|
28
28
|
call(args: {
|
|
29
29
|
package: string;
|
package/dist/main.js
CHANGED
|
@@ -20,16 +20,16 @@ const services_1 = require("./rpc/services");
|
|
|
20
20
|
class Device {
|
|
21
21
|
channel;
|
|
22
22
|
client;
|
|
23
|
-
constructor() {
|
|
24
|
-
const address =
|
|
23
|
+
constructor(ipaddr, port = 65000) {
|
|
24
|
+
const address = Array(ipaddr, port).join(":");
|
|
25
25
|
const credentials = nice_grpc_1.ChannelCredentials.createInsecure();
|
|
26
26
|
this.client = (0, nice_grpc_1.createClientFactory)()
|
|
27
27
|
.use((0, remoteException_Interceptor_1.RemoteExceptionInterceptor)());
|
|
28
|
-
this.channel = (0, nice_grpc_1.createChannel)(address
|
|
28
|
+
this.channel = (0, nice_grpc_1.createChannel)(address, credentials, {
|
|
29
29
|
["grpc.max_send_message_length"]: 64 * 1024 * 1024,
|
|
30
30
|
["grpc.max_receive_message_length"]: 128 * 1024 * 1024,
|
|
31
31
|
["grpc.keepalive_time_ms"]: 60 * 1000,
|
|
32
|
-
["grpc.keepalive_timeout_ms"]:
|
|
32
|
+
["grpc.keepalive_timeout_ms"]: 20 * 1000,
|
|
33
33
|
["grpc.keepalive_permit_without_calls"]: 1,
|
|
34
34
|
["grpc.max_pings_without_data"]: 0,
|
|
35
35
|
["grpc.enable_http_proxy"]: 0,
|
|
@@ -51,13 +51,13 @@ class Device {
|
|
|
51
51
|
return this.UiAutomator
|
|
52
52
|
.selectorClick({ selector, corner });
|
|
53
53
|
}
|
|
54
|
-
async
|
|
54
|
+
async keyboard(keys, selector) {
|
|
55
55
|
for (let i = 0; i < keys.length; i++) {
|
|
56
56
|
await this.sleep(100, 200);
|
|
57
|
-
await this.click(
|
|
57
|
+
await this.click(selector[keys[i]]);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
async waitFor(selector, timeout =
|
|
60
|
+
async waitFor(selector, timeout = 15000) {
|
|
61
61
|
return this.UiAutomator
|
|
62
62
|
.selectorWaitForExists({ selector, timeout })
|
|
63
63
|
.then(async (exists) => {
|
|
@@ -70,7 +70,7 @@ class Device {
|
|
|
70
70
|
const ms = Math.random() * (max - min) + min;
|
|
71
71
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
72
72
|
}
|
|
73
|
-
async
|
|
73
|
+
async openURLScheme(data) {
|
|
74
74
|
return this.Application
|
|
75
75
|
.startActivity({
|
|
76
76
|
data,
|
|
@@ -82,14 +82,14 @@ class Device {
|
|
|
82
82
|
return this.Application
|
|
83
83
|
.stopApplication({ name });
|
|
84
84
|
}
|
|
85
|
-
async
|
|
85
|
+
async start(name) {
|
|
86
86
|
return this.Application
|
|
87
87
|
.startApplication({ name });
|
|
88
88
|
}
|
|
89
89
|
async restart(name) {
|
|
90
90
|
await this.kill(name);
|
|
91
91
|
await this.sleep(200);
|
|
92
|
-
await this.
|
|
92
|
+
await this.start(name);
|
|
93
93
|
}
|
|
94
94
|
async call(args) {
|
|
95
95
|
const callinfo = JSON.stringify(args.callinfo);
|
|
@@ -22,43 +22,52 @@ export declare enum ScriptRuntime {
|
|
|
22
22
|
}
|
|
23
23
|
export declare function scriptRuntimeFromJSON(object: any): ScriptRuntime;
|
|
24
24
|
export declare function scriptRuntimeToJSON(object: ScriptRuntime): string;
|
|
25
|
+
export declare enum ActivityExtrasNullValue {
|
|
26
|
+
ACTIVITY_EXTRAS_NULL_VALUE = 0,
|
|
27
|
+
UNRECOGNIZED = -1
|
|
28
|
+
}
|
|
29
|
+
export declare function activityExtrasNullValueFromJSON(object: any): ActivityExtrasNullValue;
|
|
30
|
+
export declare function activityExtrasNullValueToJSON(object: ActivityExtrasNullValue): string;
|
|
31
|
+
export interface ActivityExtrasValue {
|
|
32
|
+
nullValue?: ActivityExtrasNullValue | undefined;
|
|
33
|
+
doubleValue?: number | undefined;
|
|
34
|
+
stringValue?: string | undefined;
|
|
35
|
+
boolValue?: boolean | undefined;
|
|
36
|
+
int64Value?: number | undefined;
|
|
37
|
+
}
|
|
38
|
+
export interface ActivityExtras {
|
|
39
|
+
fields: {
|
|
40
|
+
[key: string]: ActivityExtrasValue;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export interface ActivityExtras_FieldsEntry {
|
|
44
|
+
key: string;
|
|
45
|
+
value: ActivityExtrasValue | undefined;
|
|
46
|
+
}
|
|
25
47
|
export interface ApplicationRequest {
|
|
26
48
|
name: string;
|
|
27
49
|
permission: string;
|
|
28
50
|
mode: GrantType;
|
|
29
51
|
path: string;
|
|
30
52
|
user: number;
|
|
53
|
+
display: number;
|
|
31
54
|
}
|
|
32
55
|
export interface ApplicationActivityRequest {
|
|
33
56
|
package: string;
|
|
34
57
|
action: string;
|
|
35
58
|
category: string;
|
|
36
59
|
component: string;
|
|
37
|
-
extras:
|
|
38
|
-
[key: string]: any;
|
|
39
|
-
} | undefined;
|
|
40
|
-
categories: string[];
|
|
60
|
+
extras: ActivityExtras | undefined;
|
|
41
61
|
flags: number;
|
|
42
62
|
debug: boolean;
|
|
43
63
|
data: string;
|
|
44
64
|
user: number;
|
|
65
|
+
display: number;
|
|
45
66
|
}
|
|
46
67
|
export interface ApplicationActivityInfo {
|
|
47
|
-
package: string;
|
|
48
68
|
action: string;
|
|
49
|
-
category: string;
|
|
50
69
|
component: string;
|
|
51
|
-
extras: {
|
|
52
|
-
[key: string]: any;
|
|
53
|
-
} | undefined;
|
|
54
70
|
categories: string[];
|
|
55
|
-
flags: number;
|
|
56
|
-
debug: boolean;
|
|
57
|
-
data: string;
|
|
58
|
-
user: number;
|
|
59
|
-
}
|
|
60
|
-
export interface ApplicationActivityInfoList {
|
|
61
|
-
activities: ApplicationActivityInfo[];
|
|
62
71
|
}
|
|
63
72
|
export interface ApplicationPermissions {
|
|
64
73
|
permissions: string[];
|
|
@@ -77,18 +86,29 @@ export interface ApplicationInfo {
|
|
|
77
86
|
versionName: string;
|
|
78
87
|
activity: string;
|
|
79
88
|
user: number;
|
|
89
|
+
label: string;
|
|
80
90
|
}
|
|
81
91
|
export interface ApplicationProcess {
|
|
82
92
|
packages: string[];
|
|
83
93
|
processName: string;
|
|
84
94
|
uid: number;
|
|
85
95
|
pid: number;
|
|
96
|
+
label: string;
|
|
86
97
|
}
|
|
87
98
|
export interface ApplicationProcesses {
|
|
88
99
|
processes: ApplicationProcess[];
|
|
89
100
|
}
|
|
90
|
-
export interface
|
|
91
|
-
|
|
101
|
+
export interface InstalledApplicationInfo {
|
|
102
|
+
packageName: string;
|
|
103
|
+
label: string;
|
|
104
|
+
uid: number;
|
|
105
|
+
user: number;
|
|
106
|
+
enabled: boolean;
|
|
107
|
+
system: boolean;
|
|
108
|
+
versionName: string;
|
|
109
|
+
}
|
|
110
|
+
export interface InstalledApplications {
|
|
111
|
+
applications: InstalledApplicationInfo[];
|
|
92
112
|
}
|
|
93
113
|
export interface HookRequest {
|
|
94
114
|
package: string;
|
|
@@ -99,6 +119,7 @@ export interface HookRequest {
|
|
|
99
119
|
standup: number;
|
|
100
120
|
spawn: boolean;
|
|
101
121
|
user: number;
|
|
122
|
+
process: string;
|
|
102
123
|
}
|
|
103
124
|
export interface HookRpcRequest {
|
|
104
125
|
package: string;
|
|
@@ -109,18 +130,80 @@ export interface HookRpcResponse {
|
|
|
109
130
|
package: string;
|
|
110
131
|
callresult: string;
|
|
111
132
|
}
|
|
133
|
+
export interface InstallSessionCreateRequest {
|
|
134
|
+
user: number;
|
|
135
|
+
installerPackageName: string;
|
|
136
|
+
sizeBytes: number;
|
|
137
|
+
package: string;
|
|
138
|
+
dontKillApp: boolean;
|
|
139
|
+
replaceExisting: boolean;
|
|
140
|
+
allowTest: boolean;
|
|
141
|
+
requestDowngrade: boolean;
|
|
142
|
+
grantRuntimePermissions: boolean;
|
|
143
|
+
}
|
|
144
|
+
export interface InstallSessionWriteRequest {
|
|
145
|
+
session: number;
|
|
146
|
+
path: string;
|
|
147
|
+
name: string;
|
|
148
|
+
delete: boolean;
|
|
149
|
+
}
|
|
150
|
+
export interface InstallSessionAbandonRequest {
|
|
151
|
+
session: number;
|
|
152
|
+
}
|
|
153
|
+
export interface InstallSessionQueryRequest {
|
|
154
|
+
session: number;
|
|
155
|
+
}
|
|
156
|
+
export interface InstallSessionCommitRequest {
|
|
157
|
+
session: number;
|
|
158
|
+
wait: boolean;
|
|
159
|
+
timeout: number;
|
|
160
|
+
}
|
|
161
|
+
export interface InstallSessionCreateResponse {
|
|
162
|
+
user: number;
|
|
163
|
+
session: number;
|
|
164
|
+
}
|
|
165
|
+
export interface InstallSessionWriteResponse {
|
|
166
|
+
session: number;
|
|
167
|
+
name: string;
|
|
168
|
+
writtenBytes: number;
|
|
169
|
+
totalBytes: number;
|
|
170
|
+
}
|
|
171
|
+
export interface InstallSessionStatusResponse {
|
|
172
|
+
user: number;
|
|
173
|
+
session: number;
|
|
174
|
+
package: string;
|
|
175
|
+
status: number;
|
|
176
|
+
legacyStatus: number;
|
|
177
|
+
statusMessage: string;
|
|
178
|
+
finished: boolean;
|
|
179
|
+
committed: boolean;
|
|
180
|
+
abandoned: boolean;
|
|
181
|
+
progress: number;
|
|
182
|
+
success: boolean;
|
|
183
|
+
}
|
|
184
|
+
export declare const ActivityExtrasValue: MessageFns<ActivityExtrasValue>;
|
|
185
|
+
export declare const ActivityExtras: MessageFns<ActivityExtras>;
|
|
186
|
+
export declare const ActivityExtras_FieldsEntry: MessageFns<ActivityExtras_FieldsEntry>;
|
|
112
187
|
export declare const ApplicationRequest: MessageFns<ApplicationRequest>;
|
|
113
188
|
export declare const ApplicationActivityRequest: MessageFns<ApplicationActivityRequest>;
|
|
114
189
|
export declare const ApplicationActivityInfo: MessageFns<ApplicationActivityInfo>;
|
|
115
|
-
export declare const ApplicationActivityInfoList: MessageFns<ApplicationActivityInfoList>;
|
|
116
190
|
export declare const ApplicationPermissions: MessageFns<ApplicationPermissions>;
|
|
117
191
|
export declare const ApplicationInfo: MessageFns<ApplicationInfo>;
|
|
118
192
|
export declare const ApplicationProcess: MessageFns<ApplicationProcess>;
|
|
119
193
|
export declare const ApplicationProcesses: MessageFns<ApplicationProcesses>;
|
|
120
|
-
export declare const
|
|
194
|
+
export declare const InstalledApplicationInfo: MessageFns<InstalledApplicationInfo>;
|
|
195
|
+
export declare const InstalledApplications: MessageFns<InstalledApplications>;
|
|
121
196
|
export declare const HookRequest: MessageFns<HookRequest>;
|
|
122
197
|
export declare const HookRpcRequest: MessageFns<HookRpcRequest>;
|
|
123
198
|
export declare const HookRpcResponse: MessageFns<HookRpcResponse>;
|
|
199
|
+
export declare const InstallSessionCreateRequest: MessageFns<InstallSessionCreateRequest>;
|
|
200
|
+
export declare const InstallSessionWriteRequest: MessageFns<InstallSessionWriteRequest>;
|
|
201
|
+
export declare const InstallSessionAbandonRequest: MessageFns<InstallSessionAbandonRequest>;
|
|
202
|
+
export declare const InstallSessionQueryRequest: MessageFns<InstallSessionQueryRequest>;
|
|
203
|
+
export declare const InstallSessionCommitRequest: MessageFns<InstallSessionCommitRequest>;
|
|
204
|
+
export declare const InstallSessionCreateResponse: MessageFns<InstallSessionCreateResponse>;
|
|
205
|
+
export declare const InstallSessionWriteResponse: MessageFns<InstallSessionWriteResponse>;
|
|
206
|
+
export declare const InstallSessionStatusResponse: MessageFns<InstallSessionStatusResponse>;
|
|
124
207
|
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
125
208
|
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
126
209
|
[K in keyof T]?: DeepPartial<T[K]>;
|