@ekhein/lamda-node-sdk 2.2.2 → 10.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,11 +1,27 @@
1
- <!-- 生成 grpc ts 代码 -->
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=./dist \
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,9 +16,9 @@ export declare class Device {
16
16
  readonly Settings: SettingsClient;
17
17
  private channel;
18
18
  private client;
19
- constructor(lamdaURL?: string);
19
+ constructor();
20
20
  click(selector: Partial<Selector>, corner?: Corner): Promise<import("./rpc/types").Boolean>;
21
- clickEx(keys: string, keyboard: Record<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9", Partial<Selector>>): Promise<void>;
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
  activity(data: string): Promise<import("./rpc/types").Boolean>;
package/dist/main.js CHANGED
@@ -20,8 +20,8 @@ const services_1 = require("./rpc/services");
20
20
  class Device {
21
21
  channel;
22
22
  client;
23
- constructor(lamdaURL = process.env.LAMDA_URL || "http://127.0.0.1:65000") {
24
- const address = new URL(lamdaURL);
23
+ constructor() {
24
+ const address = new URL(process.env.LAMDA_URL, "http://127.0.0.1:65000");
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)());
@@ -51,10 +51,10 @@ class Device {
51
51
  return this.UiAutomator
52
52
  .selectorClick({ selector, corner });
53
53
  }
54
- async clickEx(keys, keyboard) {
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(keyboard[keys[i]]);
57
+ await this.click(selector[keys[i]]);
58
58
  }
59
59
  }
60
60
  async waitFor(selector, timeout = 15e3) {
@@ -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 ApplicationPkgNames {
91
- names: string[];
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 ApplicationPkgNames: MessageFns<ApplicationPkgNames>;
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]>;