assistsx-js 0.0.2039 → 0.0.2041
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/dist/AssistsXAsync.d.ts +24 -0
- package/dist/AssistsXAsync.js +25 -0
- package/dist/CallMethod.d.ts +2 -0
- package/dist/CallMethod.js +3 -0
- package/dist/Step.d.ts +9 -1
- package/dist/Step.js +25 -2
- package/package.json +41 -41
- package/src/AssistsXAsync.ts +42 -0
- package/src/CallMethod.ts +4 -0
- package/src/Step.ts +793 -755
package/dist/AssistsXAsync.d.ts
CHANGED
|
@@ -38,6 +38,16 @@ export interface RecognizeTextRegion {
|
|
|
38
38
|
width?: number;
|
|
39
39
|
height?: number;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* 联系人信息
|
|
43
|
+
*/
|
|
44
|
+
export interface Contact {
|
|
45
|
+
id: string;
|
|
46
|
+
name: string;
|
|
47
|
+
phoneNumbers: string[];
|
|
48
|
+
emails: string[];
|
|
49
|
+
address: string;
|
|
50
|
+
}
|
|
41
51
|
export declare class AssistsXAsync {
|
|
42
52
|
/**
|
|
43
53
|
* 执行异步调用
|
|
@@ -432,4 +442,18 @@ export declare class AssistsXAsync {
|
|
|
432
442
|
static audioStop({ timeout, }: {
|
|
433
443
|
timeout?: number;
|
|
434
444
|
}): Promise<boolean | null | undefined>;
|
|
445
|
+
/**
|
|
446
|
+
* 添加联系人
|
|
447
|
+
* @param name 联系人姓名(必填)
|
|
448
|
+
* @param phoneNumber 电话号码(必填)
|
|
449
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
450
|
+
* @returns 是否添加成功
|
|
451
|
+
*/
|
|
452
|
+
static addContact(name: string, phoneNumber: string, timeout?: number): Promise<boolean>;
|
|
453
|
+
/**
|
|
454
|
+
* 获取所有联系人
|
|
455
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
456
|
+
* @returns 联系人列表
|
|
457
|
+
*/
|
|
458
|
+
static getAllContacts(timeout?: number): Promise<Contact[]>;
|
|
435
459
|
}
|
package/dist/AssistsXAsync.js
CHANGED
|
@@ -681,4 +681,29 @@ export class AssistsXAsync {
|
|
|
681
681
|
});
|
|
682
682
|
return response.getDataOrDefault(false);
|
|
683
683
|
}
|
|
684
|
+
/**
|
|
685
|
+
* 添加联系人
|
|
686
|
+
* @param name 联系人姓名(必填)
|
|
687
|
+
* @param phoneNumber 电话号码(必填)
|
|
688
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
689
|
+
* @returns 是否添加成功
|
|
690
|
+
*/
|
|
691
|
+
static async addContact(name, phoneNumber, timeout) {
|
|
692
|
+
const response = await this.asyncCall(CallMethod.addContact, {
|
|
693
|
+
args: { name, phoneNumber },
|
|
694
|
+
timeout,
|
|
695
|
+
});
|
|
696
|
+
return response.getDataOrDefault(false);
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* 获取所有联系人
|
|
700
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
701
|
+
* @returns 联系人列表
|
|
702
|
+
*/
|
|
703
|
+
static async getAllContacts(timeout) {
|
|
704
|
+
const response = await this.asyncCall(CallMethod.getAllContacts, {
|
|
705
|
+
timeout,
|
|
706
|
+
});
|
|
707
|
+
return response.getDataOrDefault([]);
|
|
708
|
+
}
|
|
684
709
|
}
|
package/dist/CallMethod.d.ts
CHANGED
|
@@ -56,5 +56,7 @@ export declare const CallMethod: {
|
|
|
56
56
|
readonly download: "download";
|
|
57
57
|
readonly audioPlayFromFile: "audioPlayFromFile";
|
|
58
58
|
readonly audioStop: "audioStop";
|
|
59
|
+
readonly addContact: "addContact";
|
|
60
|
+
readonly getAllContacts: "getAllContacts";
|
|
59
61
|
};
|
|
60
62
|
export type CallMethodType = (typeof CallMethod)[keyof typeof CallMethod];
|
package/dist/CallMethod.js
CHANGED
package/dist/Step.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ export declare class Step {
|
|
|
101
101
|
* 步骤标签
|
|
102
102
|
*/
|
|
103
103
|
tag: string | undefined;
|
|
104
|
+
isEnd: boolean;
|
|
104
105
|
/**
|
|
105
106
|
* 步骤数据
|
|
106
107
|
*/
|
|
@@ -121,13 +122,14 @@ export declare class Step {
|
|
|
121
122
|
* @param data 步骤数据
|
|
122
123
|
* @param delayMs 步骤延迟时间(毫秒)
|
|
123
124
|
*/
|
|
124
|
-
constructor({ stepId, impl, tag, data, delayMs, repeatCountMax, }: {
|
|
125
|
+
constructor({ stepId, impl, tag, data, delayMs, repeatCountMax, isEnd, }: {
|
|
125
126
|
stepId: string;
|
|
126
127
|
impl: StepImpl;
|
|
127
128
|
tag?: string | undefined;
|
|
128
129
|
data?: any | undefined;
|
|
129
130
|
delayMs?: number;
|
|
130
131
|
repeatCountMax?: number;
|
|
132
|
+
isEnd?: boolean;
|
|
131
133
|
});
|
|
132
134
|
get async(): StepAsync;
|
|
133
135
|
/**
|
|
@@ -144,6 +146,12 @@ export declare class Step {
|
|
|
144
146
|
delayMs?: number;
|
|
145
147
|
repeatCountMax?: number;
|
|
146
148
|
}): Step;
|
|
149
|
+
end(impl: StepImpl, { tag, data, delayMs, repeatCountMax, }?: {
|
|
150
|
+
tag?: string | undefined;
|
|
151
|
+
data?: any | undefined;
|
|
152
|
+
delayMs?: number;
|
|
153
|
+
repeatCountMax?: number;
|
|
154
|
+
}): Step;
|
|
147
155
|
/**
|
|
148
156
|
* 重复当前步骤
|
|
149
157
|
* @param stepId 步骤ID
|
package/dist/Step.js
CHANGED
|
@@ -98,6 +98,12 @@ export class Step {
|
|
|
98
98
|
Step.assert(currentStep.stepId);
|
|
99
99
|
if (nextStep) {
|
|
100
100
|
currentStep = nextStep;
|
|
101
|
+
if (currentStep.isEnd) {
|
|
102
|
+
if (Step.showLog) {
|
|
103
|
+
console.log(`步骤${implnName}结束`);
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
101
107
|
}
|
|
102
108
|
else {
|
|
103
109
|
break;
|
|
@@ -132,6 +138,9 @@ export class Step {
|
|
|
132
138
|
*/
|
|
133
139
|
static assert(stepId) {
|
|
134
140
|
if (stepId && Step.stepId != stepId) {
|
|
141
|
+
if (Step.stepId === "STEP_STOP") {
|
|
142
|
+
throw new Error("主动中断步骤");
|
|
143
|
+
}
|
|
135
144
|
throw new Error("StepId mismatch");
|
|
136
145
|
}
|
|
137
146
|
}
|
|
@@ -151,7 +160,7 @@ export class Step {
|
|
|
151
160
|
* 停止当前步骤执行
|
|
152
161
|
*/
|
|
153
162
|
static stop() {
|
|
154
|
-
this._stepId =
|
|
163
|
+
this._stepId = "STEP_STOP";
|
|
155
164
|
}
|
|
156
165
|
/**
|
|
157
166
|
* 添加步骤拦截器
|
|
@@ -236,7 +245,7 @@ export class Step {
|
|
|
236
245
|
* @param data 步骤数据
|
|
237
246
|
* @param delayMs 步骤延迟时间(毫秒)
|
|
238
247
|
*/
|
|
239
|
-
constructor({ stepId, impl, tag, data, delayMs = Step.delayMsDefault, repeatCountMax = Step.repeatCountMaxDefault, }) {
|
|
248
|
+
constructor({ stepId, impl, tag, data, delayMs = Step.delayMsDefault, repeatCountMax = Step.repeatCountMaxDefault, isEnd = false, }) {
|
|
240
249
|
/**
|
|
241
250
|
* 步骤ID
|
|
242
251
|
*/
|
|
@@ -249,6 +258,7 @@ export class Step {
|
|
|
249
258
|
* 步骤重复执行最大次数,默认不限制
|
|
250
259
|
*/
|
|
251
260
|
this.repeatCountMax = Step.repeatCountMaxDefault;
|
|
261
|
+
this.isEnd = false;
|
|
252
262
|
/**
|
|
253
263
|
* 步骤延迟时间(毫秒)
|
|
254
264
|
*/
|
|
@@ -259,6 +269,7 @@ export class Step {
|
|
|
259
269
|
this.impl = impl;
|
|
260
270
|
this.delayMs = delayMs;
|
|
261
271
|
this.repeatCountMax = repeatCountMax;
|
|
272
|
+
this.isEnd = isEnd;
|
|
262
273
|
}
|
|
263
274
|
get async() {
|
|
264
275
|
return new StepAsync(this);
|
|
@@ -282,6 +293,18 @@ export class Step {
|
|
|
282
293
|
repeatCountMax,
|
|
283
294
|
});
|
|
284
295
|
}
|
|
296
|
+
end(impl, { tag, data, delayMs = Step.delayMsDefault, repeatCountMax = Step.repeatCountMaxDefault, } = {}) {
|
|
297
|
+
Step.assert(this.stepId);
|
|
298
|
+
return new Step({
|
|
299
|
+
stepId: this.stepId,
|
|
300
|
+
impl,
|
|
301
|
+
tag,
|
|
302
|
+
data: data !== null && data !== void 0 ? data : this.data,
|
|
303
|
+
delayMs,
|
|
304
|
+
repeatCountMax,
|
|
305
|
+
isEnd: true,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
285
308
|
/**
|
|
286
309
|
* 重复当前步骤
|
|
287
310
|
* @param stepId 步骤ID
|
package/package.json
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
"name": "assistsx-js",
|
|
3
|
+
"version": "0.0.2041",
|
|
4
|
+
"description": "assistsx-js自动化开发SDK",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"require": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc",
|
|
24
|
+
"prepublish": "npm run build",
|
|
25
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"assistsx",
|
|
29
|
+
"assists",
|
|
30
|
+
"android assistsx",
|
|
31
|
+
"assistsx webview",
|
|
32
|
+
"AccessibilityService",
|
|
33
|
+
"dev"
|
|
34
|
+
],
|
|
35
|
+
"author": "Ven",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"typescript": "^5.3.3"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"pinia": "^3.0.3"
|
|
17
42
|
}
|
|
18
|
-
|
|
19
|
-
"publishConfig": {
|
|
20
|
-
"access": "public"
|
|
21
|
-
},
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "tsc",
|
|
24
|
-
"prepublish": "npm run build",
|
|
25
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
26
|
-
},
|
|
27
|
-
"keywords": [
|
|
28
|
-
"assistsx",
|
|
29
|
-
"assists",
|
|
30
|
-
"android assistsx",
|
|
31
|
-
"assistsx webview",
|
|
32
|
-
"AccessibilityService",
|
|
33
|
-
"dev"
|
|
34
|
-
],
|
|
35
|
-
"author": "Ven",
|
|
36
|
-
"license": "MIT",
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"typescript": "^5.3.3"
|
|
39
|
-
},
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"pinia": "^3.0.3"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
43
|
+
}
|
package/src/AssistsXAsync.ts
CHANGED
|
@@ -51,6 +51,17 @@ export interface RecognizeTextRegion {
|
|
|
51
51
|
height?: number;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* 联系人信息
|
|
56
|
+
*/
|
|
57
|
+
export interface Contact {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
phoneNumbers: string[];
|
|
61
|
+
emails: string[];
|
|
62
|
+
address: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
54
65
|
export class AssistsXAsync {
|
|
55
66
|
/**
|
|
56
67
|
* 执行异步调用
|
|
@@ -1030,6 +1041,37 @@ export class AssistsXAsync {
|
|
|
1030
1041
|
return response.getDataOrDefault(false);
|
|
1031
1042
|
}
|
|
1032
1043
|
|
|
1044
|
+
/**
|
|
1045
|
+
* 添加联系人
|
|
1046
|
+
* @param name 联系人姓名(必填)
|
|
1047
|
+
* @param phoneNumber 电话号码(必填)
|
|
1048
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
1049
|
+
* @returns 是否添加成功
|
|
1050
|
+
*/
|
|
1051
|
+
public static async addContact(
|
|
1052
|
+
name: string,
|
|
1053
|
+
phoneNumber: string,
|
|
1054
|
+
timeout?: number
|
|
1055
|
+
): Promise<boolean> {
|
|
1056
|
+
const response = await this.asyncCall(CallMethod.addContact, {
|
|
1057
|
+
args: { name, phoneNumber },
|
|
1058
|
+
timeout,
|
|
1059
|
+
});
|
|
1060
|
+
return response.getDataOrDefault(false);
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
/**
|
|
1064
|
+
* 获取所有联系人
|
|
1065
|
+
* @param timeout 超时时间(秒),默认30秒
|
|
1066
|
+
* @returns 联系人列表
|
|
1067
|
+
*/
|
|
1068
|
+
public static async getAllContacts(timeout?: number): Promise<Contact[]> {
|
|
1069
|
+
const response = await this.asyncCall(CallMethod.getAllContacts, {
|
|
1070
|
+
timeout,
|
|
1071
|
+
});
|
|
1072
|
+
return response.getDataOrDefault([]);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1033
1075
|
/**
|
|
1034
1076
|
* 发送HTTP请求
|
|
1035
1077
|
* @param options 请求选项
|
package/src/CallMethod.ts
CHANGED