askui 0.21.2 → 0.23.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/dist/cjs/core/ai-element/ai-element-collection.d.ts +3 -1
- package/dist/cjs/core/ai-element/ai-element-collection.js +47 -24
- package/dist/cjs/core/ai-element/ai-elements-args.d.ts +20 -0
- package/dist/cjs/core/ai-element/ai-elements-args.js +2 -0
- package/dist/cjs/execution/dsl.d.ts +0 -174
- package/dist/cjs/execution/dsl.js +0 -243
- package/dist/cjs/execution/inference-client.js +1 -1
- package/dist/cjs/execution/ui-control-client-dependency-builder.js +7 -4
- package/dist/cjs/execution/ui-control-client.d.ts +1 -6
- package/dist/cjs/execution/ui-control-client.js +4 -13
- package/dist/cjs/execution/ui-controller-client-interface.d.ts +5 -0
- package/dist/esm/core/ai-element/ai-element-collection.d.ts +3 -1
- package/dist/esm/core/ai-element/ai-element-collection.js +47 -24
- package/dist/esm/core/ai-element/ai-elements-args.d.ts +20 -0
- package/dist/esm/core/ai-element/ai-elements-args.js +1 -0
- package/dist/esm/execution/dsl.d.ts +0 -174
- package/dist/esm/execution/dsl.js +0 -243
- package/dist/esm/execution/inference-client.js +1 -1
- package/dist/esm/execution/ui-control-client-dependency-builder.js +7 -4
- package/dist/esm/execution/ui-control-client.d.ts +1 -6
- package/dist/esm/execution/ui-control-client.js +4 -13
- package/dist/esm/execution/ui-controller-client-interface.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { AIElement } from './ai-element';
|
|
2
2
|
import { CustomElementJson } from '../model/custom-element-json';
|
|
3
|
+
import { AIElementArgs } from './ai-elements-args';
|
|
3
4
|
export declare class AIElementCollection {
|
|
4
5
|
private elements;
|
|
5
6
|
static AI_ELEMENT_FOLDER: string;
|
|
6
7
|
constructor(elements: AIElement[]);
|
|
7
|
-
static
|
|
8
|
+
static collectAIElements(workspaceId: string | undefined, aiElementArgs: AIElementArgs): Promise<AIElementCollection>;
|
|
8
9
|
getByName(name: string): CustomElementJson[];
|
|
9
10
|
getByNames(names: string[]): CustomElementJson[];
|
|
11
|
+
private static CollectAiElementsFromLocation;
|
|
10
12
|
}
|
|
@@ -23,37 +23,37 @@ class AIElementCollection {
|
|
|
23
23
|
constructor(elements) {
|
|
24
24
|
this.elements = elements;
|
|
25
25
|
}
|
|
26
|
-
static
|
|
26
|
+
static collectAIElements(workspaceId, aiElementArgs) {
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
|
|
29
|
-
if (workspaceId === undefined) {
|
|
28
|
+
if (!workspaceId) {
|
|
30
29
|
throw new ai_element_error_1.AIElementError("Value of 'workspaceId' must be defined.");
|
|
31
30
|
}
|
|
32
31
|
const workspaceAIElementFolder = path_1.default.join(AIElementCollection.AI_ELEMENT_FOLDER, workspaceId);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
32
|
+
const aiElementsLocations = [
|
|
33
|
+
workspaceAIElementFolder,
|
|
34
|
+
...aiElementArgs.additionalLocations.map((userPath) => path_1.default.resolve(userPath)),
|
|
35
|
+
];
|
|
36
|
+
const aiElements = [];
|
|
37
|
+
yield Promise.all(aiElementsLocations.map((aiElementLocation) => __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
if (yield fs_extra_1.default.pathExists(aiElementLocation)) {
|
|
39
|
+
aiElements.push(...AIElementCollection.CollectAiElementsFromLocation(aiElementLocation));
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const errorMessage = `AIElements location '${aiElementLocation}' does not exist.`;
|
|
43
|
+
if (aiElementArgs.onLocationNotExist === 'error') {
|
|
44
|
+
throw new ai_element_error_1.AIElementError(errorMessage);
|
|
45
|
+
}
|
|
46
|
+
else if (aiElementArgs.onLocationNotExist === 'warn') {
|
|
47
|
+
lib_1.logger.warn(errorMessage);
|
|
48
|
+
}
|
|
49
49
|
}
|
|
50
|
-
return null;
|
|
51
50
|
})));
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
if (aiElements.length === 0) {
|
|
52
|
+
const formattedLocations = aiElementsLocations.map((aiElementsLocation) => `"${aiElementsLocation}"`).join(', ');
|
|
53
|
+
const errorMessage = `No AIElements found in the following location${aiElementsLocations.length > 1 ? 's' : ''}: [${formattedLocations}].`;
|
|
54
|
+
throw new ai_element_error_1.AIElementError(errorMessage);
|
|
55
55
|
}
|
|
56
|
-
return new AIElementCollection(
|
|
56
|
+
return new AIElementCollection(aiElements);
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
getByName(name) {
|
|
@@ -73,6 +73,29 @@ class AIElementCollection {
|
|
|
73
73
|
}
|
|
74
74
|
return names.flatMap((name) => this.getByName(name));
|
|
75
75
|
}
|
|
76
|
+
static CollectAiElementsFromLocation(aiElementLocation) {
|
|
77
|
+
const files = fs_extra_1.default.readdirSync(aiElementLocation);
|
|
78
|
+
if (files.length === 0) {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
const aiElements = files
|
|
82
|
+
.filter((file) => path_1.default.extname(file) === '.json')
|
|
83
|
+
.map((file) => {
|
|
84
|
+
const jsonFile = path_1.default.join(aiElementLocation, file);
|
|
85
|
+
const baseName = path_1.default.basename(jsonFile, '.json');
|
|
86
|
+
const pngFile = path_1.default.join(aiElementLocation, `${baseName}.png`);
|
|
87
|
+
if (fs_extra_1.default.existsSync(pngFile)) {
|
|
88
|
+
const metadata = JSON.parse(fs_extra_1.default.readFileSync(jsonFile, 'utf-8'));
|
|
89
|
+
return ai_element_1.AIElement.fromJson(metadata, pngFile);
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
});
|
|
93
|
+
const validAIElements = aiElements.filter((element) => element !== null);
|
|
94
|
+
if (validAIElements.length === 0) {
|
|
95
|
+
lib_1.logger.debug(`No valid AIElements found in '${aiElementLocation}'.`);
|
|
96
|
+
}
|
|
97
|
+
return validAIElements;
|
|
98
|
+
}
|
|
76
99
|
}
|
|
77
100
|
exports.AIElementCollection = AIElementCollection;
|
|
78
101
|
AIElementCollection.AI_ELEMENT_FOLDER = path_1.default.join(os_1.default.homedir(), '.askui', 'SnippingTool', 'AIElement');
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for configuring how AI elements are collected.
|
|
3
|
+
*
|
|
4
|
+
* @interface AIElementArgs
|
|
5
|
+
*
|
|
6
|
+
* @property {string[]} additionalLocations - Additional directories to search for AI elements.
|
|
7
|
+
* These directories will be checked for the presence of AI element files.
|
|
8
|
+
*
|
|
9
|
+
* @property {'Warn' | 'Error' | 'Ignore'} onLocationNotExist - Action to take when
|
|
10
|
+
* one or more specified directories do not exist.
|
|
11
|
+
* - `'warn'` → Logs a warning if a directory is missing.
|
|
12
|
+
* - `'error'` → Throws an error if a directory is missing.
|
|
13
|
+
* - `'igone'` → Skips missing directories without logging anything.
|
|
14
|
+
* This action is triggered when specified directories do not exist,
|
|
15
|
+
* not when AI elements within those directories are missing.
|
|
16
|
+
*/
|
|
17
|
+
export interface AIElementArgs {
|
|
18
|
+
additionalLocations: string[];
|
|
19
|
+
onLocationNotExist?: 'warn' | 'error' | 'ignore';
|
|
20
|
+
}
|
|
@@ -99,28 +99,6 @@ export declare class FluentFilters extends FluentBase {
|
|
|
99
99
|
* @return {FluentFiltersOrRelations}
|
|
100
100
|
*/
|
|
101
101
|
button(): FluentFiltersOrRelations;
|
|
102
|
-
/**
|
|
103
|
-
*
|
|
104
|
-
* @param {number} index - element index
|
|
105
|
-
*
|
|
106
|
-
* @return {FluentFiltersOrRelations}
|
|
107
|
-
*/
|
|
108
|
-
row(index: number): FluentFiltersOrRelations;
|
|
109
|
-
/**
|
|
110
|
-
*
|
|
111
|
-
* @param {number} index - element index
|
|
112
|
-
*
|
|
113
|
-
* @return {FluentFiltersOrRelations}
|
|
114
|
-
*/
|
|
115
|
-
column(index: number): FluentFiltersOrRelations;
|
|
116
|
-
/**
|
|
117
|
-
*
|
|
118
|
-
* @param {number} row_index - row index
|
|
119
|
-
* @param {number} column_index - column index
|
|
120
|
-
*
|
|
121
|
-
* @return {FluentFiltersOrRelations}
|
|
122
|
-
*/
|
|
123
|
-
cell(row_index: number, column_index: number): FluentFiltersOrRelations;
|
|
124
102
|
/**
|
|
125
103
|
* Filters for a UI element 'table'.
|
|
126
104
|
*
|
|
@@ -387,42 +365,6 @@ export declare class FluentFilters extends FluentBase {
|
|
|
387
365
|
* @return {FluentFiltersOrRelations}
|
|
388
366
|
*/
|
|
389
367
|
pta(text: string): FluentFiltersOrRelations;
|
|
390
|
-
/**
|
|
391
|
-
* Filters elements based on a textual description.
|
|
392
|
-
*
|
|
393
|
-
* **What Should I Write as Matching Text**
|
|
394
|
-
*
|
|
395
|
-
* The text description inside the `matching()` should describe the element visually.
|
|
396
|
-
* It understands color, some famous company/product names, general descriptions.
|
|
397
|
-
*
|
|
398
|
-
* **Important: _Matching only returns the best matching element when you use it with `get()`_**
|
|
399
|
-
*
|
|
400
|
-
* A bit of playing around to find a matching description is sometimes needed:
|
|
401
|
-
* For example, `puzzle piece` can fail while `an icon showing a puzzle piece` might work.
|
|
402
|
-
* Generally, the more detail the better.
|
|
403
|
-
*
|
|
404
|
-
* We also recommend to not restrict the type of element by using the general selector `element()` as shown in the examples below.
|
|
405
|
-
*
|
|
406
|
-
* **Examples:**
|
|
407
|
-
* ```typescript
|
|
408
|
-
* // Select the black sneaker from a bunch of sneakers
|
|
409
|
-
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
410
|
-
*
|
|
411
|
-
* // Select an image that has text in it
|
|
412
|
-
* await aui.click().element().matching('has Burger King in it').exec();
|
|
413
|
-
* await aui.click().element().matching('has adidas in it').exec();
|
|
414
|
-
*
|
|
415
|
-
* // Target a logo/image by describing it
|
|
416
|
-
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
417
|
-
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
418
|
-
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
419
|
-
* ```
|
|
420
|
-
*
|
|
421
|
-
* @param {string} text - A description of the target element.
|
|
422
|
-
*
|
|
423
|
-
* @return {FluentFiltersOrRelations}
|
|
424
|
-
*/
|
|
425
|
-
matching(text: string): FluentFiltersOrRelations;
|
|
426
368
|
}
|
|
427
369
|
export declare class FluentFiltersOrRelations extends FluentFilters {
|
|
428
370
|
/**
|
|
@@ -933,28 +875,6 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
933
875
|
* @return {FluentFiltersOrRelationsCondition}
|
|
934
876
|
*/
|
|
935
877
|
button(): FluentFiltersOrRelationsCondition;
|
|
936
|
-
/**
|
|
937
|
-
*
|
|
938
|
-
* @param {number} index - element index
|
|
939
|
-
*
|
|
940
|
-
* @return {FluentFiltersOrRelationsCondition}
|
|
941
|
-
*/
|
|
942
|
-
row(index: number): FluentFiltersOrRelationsCondition;
|
|
943
|
-
/**
|
|
944
|
-
*
|
|
945
|
-
* @param {number} index - element index
|
|
946
|
-
*
|
|
947
|
-
* @return {FluentFiltersOrRelationsCondition}
|
|
948
|
-
*/
|
|
949
|
-
column(index: number): FluentFiltersOrRelationsCondition;
|
|
950
|
-
/**
|
|
951
|
-
*
|
|
952
|
-
* @param {number} row_index - row index
|
|
953
|
-
* @param {number} column_index - column index
|
|
954
|
-
*
|
|
955
|
-
* @return {FluentFiltersOrRelationsCondition}
|
|
956
|
-
*/
|
|
957
|
-
cell(row_index: number, column_index: number): FluentFiltersOrRelationsCondition;
|
|
958
878
|
/**
|
|
959
879
|
* Filters for a UI element 'table'.
|
|
960
880
|
*
|
|
@@ -1221,42 +1141,6 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
1221
1141
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1222
1142
|
*/
|
|
1223
1143
|
pta(text: string): FluentFiltersOrRelationsCondition;
|
|
1224
|
-
/**
|
|
1225
|
-
* Filters elements based on a textual description.
|
|
1226
|
-
*
|
|
1227
|
-
* **What Should I Write as Matching Text**
|
|
1228
|
-
*
|
|
1229
|
-
* The text description inside the `matching()` should describe the element visually.
|
|
1230
|
-
* It understands color, some famous company/product names, general descriptions.
|
|
1231
|
-
*
|
|
1232
|
-
* **Important: _Matching only returns the best matching element when you use it with `get()`_**
|
|
1233
|
-
*
|
|
1234
|
-
* A bit of playing around to find a matching description is sometimes needed:
|
|
1235
|
-
* For example, `puzzle piece` can fail while `an icon showing a puzzle piece` might work.
|
|
1236
|
-
* Generally, the more detail the better.
|
|
1237
|
-
*
|
|
1238
|
-
* We also recommend to not restrict the type of element by using the general selector `element()` as shown in the examples below.
|
|
1239
|
-
*
|
|
1240
|
-
* **Examples:**
|
|
1241
|
-
* ```typescript
|
|
1242
|
-
* // Select the black sneaker from a bunch of sneakers
|
|
1243
|
-
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
1244
|
-
*
|
|
1245
|
-
* // Select an image that has text in it
|
|
1246
|
-
* await aui.click().element().matching('has Burger King in it').exec();
|
|
1247
|
-
* await aui.click().element().matching('has adidas in it').exec();
|
|
1248
|
-
*
|
|
1249
|
-
* // Target a logo/image by describing it
|
|
1250
|
-
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
1251
|
-
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
1252
|
-
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
1253
|
-
* ```
|
|
1254
|
-
*
|
|
1255
|
-
* @param {string} text - A description of the target element.
|
|
1256
|
-
*
|
|
1257
|
-
* @return {FluentFiltersOrRelationsCondition}
|
|
1258
|
-
*/
|
|
1259
|
-
matching(text: string): FluentFiltersOrRelationsCondition;
|
|
1260
1144
|
}
|
|
1261
1145
|
export declare class FluentFiltersOrRelationsCondition extends FluentFiltersCondition {
|
|
1262
1146
|
/**
|
|
@@ -2271,28 +2155,6 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
2271
2155
|
* @return {FluentFiltersOrRelationsGetter}
|
|
2272
2156
|
*/
|
|
2273
2157
|
button(): FluentFiltersOrRelationsGetter;
|
|
2274
|
-
/**
|
|
2275
|
-
*
|
|
2276
|
-
* @param {number} index - element index
|
|
2277
|
-
*
|
|
2278
|
-
* @return {FluentFiltersOrRelationsGetter}
|
|
2279
|
-
*/
|
|
2280
|
-
row(index: number): FluentFiltersOrRelationsGetter;
|
|
2281
|
-
/**
|
|
2282
|
-
*
|
|
2283
|
-
* @param {number} index - element index
|
|
2284
|
-
*
|
|
2285
|
-
* @return {FluentFiltersOrRelationsGetter}
|
|
2286
|
-
*/
|
|
2287
|
-
column(index: number): FluentFiltersOrRelationsGetter;
|
|
2288
|
-
/**
|
|
2289
|
-
*
|
|
2290
|
-
* @param {number} row_index - row index
|
|
2291
|
-
* @param {number} column_index - column index
|
|
2292
|
-
*
|
|
2293
|
-
* @return {FluentFiltersOrRelationsGetter}
|
|
2294
|
-
*/
|
|
2295
|
-
cell(row_index: number, column_index: number): FluentFiltersOrRelationsGetter;
|
|
2296
2158
|
/**
|
|
2297
2159
|
* Filters for a UI element 'table'.
|
|
2298
2160
|
*
|
|
@@ -2559,42 +2421,6 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
2559
2421
|
* @return {FluentFiltersOrRelationsGetter}
|
|
2560
2422
|
*/
|
|
2561
2423
|
pta(text: string): FluentFiltersOrRelationsGetter;
|
|
2562
|
-
/**
|
|
2563
|
-
* Filters elements based on a textual description.
|
|
2564
|
-
*
|
|
2565
|
-
* **What Should I Write as Matching Text**
|
|
2566
|
-
*
|
|
2567
|
-
* The text description inside the `matching()` should describe the element visually.
|
|
2568
|
-
* It understands color, some famous company/product names, general descriptions.
|
|
2569
|
-
*
|
|
2570
|
-
* **Important: _Matching only returns the best matching element when you use it with `get()`_**
|
|
2571
|
-
*
|
|
2572
|
-
* A bit of playing around to find a matching description is sometimes needed:
|
|
2573
|
-
* For example, `puzzle piece` can fail while `an icon showing a puzzle piece` might work.
|
|
2574
|
-
* Generally, the more detail the better.
|
|
2575
|
-
*
|
|
2576
|
-
* We also recommend to not restrict the type of element by using the general selector `element()` as shown in the examples below.
|
|
2577
|
-
*
|
|
2578
|
-
* **Examples:**
|
|
2579
|
-
* ```typescript
|
|
2580
|
-
* // Select the black sneaker from a bunch of sneakers
|
|
2581
|
-
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
2582
|
-
*
|
|
2583
|
-
* // Select an image that has text in it
|
|
2584
|
-
* await aui.click().element().matching('has Burger King in it').exec();
|
|
2585
|
-
* await aui.click().element().matching('has adidas in it').exec();
|
|
2586
|
-
*
|
|
2587
|
-
* // Target a logo/image by describing it
|
|
2588
|
-
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
2589
|
-
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
2590
|
-
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
2591
|
-
* ```
|
|
2592
|
-
*
|
|
2593
|
-
* @param {string} text - A description of the target element.
|
|
2594
|
-
*
|
|
2595
|
-
* @return {FluentFiltersOrRelationsGetter}
|
|
2596
|
-
*/
|
|
2597
|
-
matching(text: string): FluentFiltersOrRelationsGetter;
|
|
2598
2424
|
}
|
|
2599
2425
|
export declare class FluentFiltersOrRelationsGetter extends FluentFiltersGetter {
|
|
2600
2426
|
/**
|
|
@@ -196,46 +196,6 @@ class FluentFilters extends FluentBase {
|
|
|
196
196
|
this._textStr += 'button';
|
|
197
197
|
return new FluentFiltersOrRelations(this);
|
|
198
198
|
}
|
|
199
|
-
/**
|
|
200
|
-
*
|
|
201
|
-
* @param {number} index - element index
|
|
202
|
-
*
|
|
203
|
-
* @return {FluentFiltersOrRelations}
|
|
204
|
-
*/
|
|
205
|
-
row(index) {
|
|
206
|
-
this._textStr = '';
|
|
207
|
-
this._textStr += 'row';
|
|
208
|
-
this._textStr += ` ${index}`;
|
|
209
|
-
return new FluentFiltersOrRelations(this);
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
*
|
|
213
|
-
* @param {number} index - element index
|
|
214
|
-
*
|
|
215
|
-
* @return {FluentFiltersOrRelations}
|
|
216
|
-
*/
|
|
217
|
-
column(index) {
|
|
218
|
-
this._textStr = '';
|
|
219
|
-
this._textStr += 'column';
|
|
220
|
-
this._textStr += ` ${index}`;
|
|
221
|
-
return new FluentFiltersOrRelations(this);
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
*
|
|
225
|
-
* @param {number} row_index - row index
|
|
226
|
-
* @param {number} column_index - column index
|
|
227
|
-
*
|
|
228
|
-
* @return {FluentFiltersOrRelations}
|
|
229
|
-
*/
|
|
230
|
-
cell(row_index, column_index) {
|
|
231
|
-
this._textStr = '';
|
|
232
|
-
this._textStr += 'cell';
|
|
233
|
-
this._textStr += ' row';
|
|
234
|
-
this._textStr += ` ${row_index}`;
|
|
235
|
-
this._textStr += ' column';
|
|
236
|
-
this._textStr += ` ${column_index}`;
|
|
237
|
-
return new FluentFiltersOrRelations(this);
|
|
238
|
-
}
|
|
239
199
|
/**
|
|
240
200
|
* Filters for a UI element 'table'.
|
|
241
201
|
*
|
|
@@ -580,47 +540,6 @@ class FluentFilters extends FluentBase {
|
|
|
580
540
|
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
581
541
|
return new FluentFiltersOrRelations(this);
|
|
582
542
|
}
|
|
583
|
-
/**
|
|
584
|
-
* Filters elements based on a textual description.
|
|
585
|
-
*
|
|
586
|
-
* **What Should I Write as Matching Text**
|
|
587
|
-
*
|
|
588
|
-
* The text description inside the `matching()` should describe the element visually.
|
|
589
|
-
* It understands color, some famous company/product names, general descriptions.
|
|
590
|
-
*
|
|
591
|
-
* **Important: _Matching only returns the best matching element when you use it with `get()`_**
|
|
592
|
-
*
|
|
593
|
-
* A bit of playing around to find a matching description is sometimes needed:
|
|
594
|
-
* For example, `puzzle piece` can fail while `an icon showing a puzzle piece` might work.
|
|
595
|
-
* Generally, the more detail the better.
|
|
596
|
-
*
|
|
597
|
-
* We also recommend to not restrict the type of element by using the general selector `element()` as shown in the examples below.
|
|
598
|
-
*
|
|
599
|
-
* **Examples:**
|
|
600
|
-
* ```typescript
|
|
601
|
-
* // Select the black sneaker from a bunch of sneakers
|
|
602
|
-
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
603
|
-
*
|
|
604
|
-
* // Select an image that has text in it
|
|
605
|
-
* await aui.click().element().matching('has Burger King in it').exec();
|
|
606
|
-
* await aui.click().element().matching('has adidas in it').exec();
|
|
607
|
-
*
|
|
608
|
-
* // Target a logo/image by describing it
|
|
609
|
-
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
610
|
-
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
611
|
-
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
612
|
-
* ```
|
|
613
|
-
*
|
|
614
|
-
* @param {string} text - A description of the target element.
|
|
615
|
-
*
|
|
616
|
-
* @return {FluentFiltersOrRelations}
|
|
617
|
-
*/
|
|
618
|
-
matching(text) {
|
|
619
|
-
this._textStr = '';
|
|
620
|
-
this._textStr += 'matching';
|
|
621
|
-
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
622
|
-
return new FluentFiltersOrRelations(this);
|
|
623
|
-
}
|
|
624
543
|
}
|
|
625
544
|
exports.FluentFilters = FluentFilters;
|
|
626
545
|
// Relations
|
|
@@ -1232,46 +1151,6 @@ class FluentFiltersCondition extends FluentBase {
|
|
|
1232
1151
|
this._textStr += 'button';
|
|
1233
1152
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1234
1153
|
}
|
|
1235
|
-
/**
|
|
1236
|
-
*
|
|
1237
|
-
* @param {number} index - element index
|
|
1238
|
-
*
|
|
1239
|
-
* @return {FluentFiltersOrRelationsCondition}
|
|
1240
|
-
*/
|
|
1241
|
-
row(index) {
|
|
1242
|
-
this._textStr = '';
|
|
1243
|
-
this._textStr += 'row';
|
|
1244
|
-
this._textStr += ` ${index}`;
|
|
1245
|
-
return new FluentFiltersOrRelationsCondition(this);
|
|
1246
|
-
}
|
|
1247
|
-
/**
|
|
1248
|
-
*
|
|
1249
|
-
* @param {number} index - element index
|
|
1250
|
-
*
|
|
1251
|
-
* @return {FluentFiltersOrRelationsCondition}
|
|
1252
|
-
*/
|
|
1253
|
-
column(index) {
|
|
1254
|
-
this._textStr = '';
|
|
1255
|
-
this._textStr += 'column';
|
|
1256
|
-
this._textStr += ` ${index}`;
|
|
1257
|
-
return new FluentFiltersOrRelationsCondition(this);
|
|
1258
|
-
}
|
|
1259
|
-
/**
|
|
1260
|
-
*
|
|
1261
|
-
* @param {number} row_index - row index
|
|
1262
|
-
* @param {number} column_index - column index
|
|
1263
|
-
*
|
|
1264
|
-
* @return {FluentFiltersOrRelationsCondition}
|
|
1265
|
-
*/
|
|
1266
|
-
cell(row_index, column_index) {
|
|
1267
|
-
this._textStr = '';
|
|
1268
|
-
this._textStr += 'cell';
|
|
1269
|
-
this._textStr += ' row';
|
|
1270
|
-
this._textStr += ` ${row_index}`;
|
|
1271
|
-
this._textStr += ' column';
|
|
1272
|
-
this._textStr += ` ${column_index}`;
|
|
1273
|
-
return new FluentFiltersOrRelationsCondition(this);
|
|
1274
|
-
}
|
|
1275
1154
|
/**
|
|
1276
1155
|
* Filters for a UI element 'table'.
|
|
1277
1156
|
*
|
|
@@ -1616,47 +1495,6 @@ class FluentFiltersCondition extends FluentBase {
|
|
|
1616
1495
|
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
1617
1496
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1618
1497
|
}
|
|
1619
|
-
/**
|
|
1620
|
-
* Filters elements based on a textual description.
|
|
1621
|
-
*
|
|
1622
|
-
* **What Should I Write as Matching Text**
|
|
1623
|
-
*
|
|
1624
|
-
* The text description inside the `matching()` should describe the element visually.
|
|
1625
|
-
* It understands color, some famous company/product names, general descriptions.
|
|
1626
|
-
*
|
|
1627
|
-
* **Important: _Matching only returns the best matching element when you use it with `get()`_**
|
|
1628
|
-
*
|
|
1629
|
-
* A bit of playing around to find a matching description is sometimes needed:
|
|
1630
|
-
* For example, `puzzle piece` can fail while `an icon showing a puzzle piece` might work.
|
|
1631
|
-
* Generally, the more detail the better.
|
|
1632
|
-
*
|
|
1633
|
-
* We also recommend to not restrict the type of element by using the general selector `element()` as shown in the examples below.
|
|
1634
|
-
*
|
|
1635
|
-
* **Examples:**
|
|
1636
|
-
* ```typescript
|
|
1637
|
-
* // Select the black sneaker from a bunch of sneakers
|
|
1638
|
-
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
1639
|
-
*
|
|
1640
|
-
* // Select an image that has text in it
|
|
1641
|
-
* await aui.click().element().matching('has Burger King in it').exec();
|
|
1642
|
-
* await aui.click().element().matching('has adidas in it').exec();
|
|
1643
|
-
*
|
|
1644
|
-
* // Target a logo/image by describing it
|
|
1645
|
-
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
1646
|
-
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
1647
|
-
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
1648
|
-
* ```
|
|
1649
|
-
*
|
|
1650
|
-
* @param {string} text - A description of the target element.
|
|
1651
|
-
*
|
|
1652
|
-
* @return {FluentFiltersOrRelationsCondition}
|
|
1653
|
-
*/
|
|
1654
|
-
matching(text) {
|
|
1655
|
-
this._textStr = '';
|
|
1656
|
-
this._textStr += 'matching';
|
|
1657
|
-
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
1658
|
-
return new FluentFiltersOrRelationsCondition(this);
|
|
1659
|
-
}
|
|
1660
1498
|
}
|
|
1661
1499
|
exports.FluentFiltersCondition = FluentFiltersCondition;
|
|
1662
1500
|
// Relations
|
|
@@ -2951,46 +2789,6 @@ class FluentFiltersGetter extends FluentBase {
|
|
|
2951
2789
|
this._textStr += 'button';
|
|
2952
2790
|
return new FluentFiltersOrRelationsGetter(this);
|
|
2953
2791
|
}
|
|
2954
|
-
/**
|
|
2955
|
-
*
|
|
2956
|
-
* @param {number} index - element index
|
|
2957
|
-
*
|
|
2958
|
-
* @return {FluentFiltersOrRelationsGetter}
|
|
2959
|
-
*/
|
|
2960
|
-
row(index) {
|
|
2961
|
-
this._textStr = '';
|
|
2962
|
-
this._textStr += 'row';
|
|
2963
|
-
this._textStr += ` ${index}`;
|
|
2964
|
-
return new FluentFiltersOrRelationsGetter(this);
|
|
2965
|
-
}
|
|
2966
|
-
/**
|
|
2967
|
-
*
|
|
2968
|
-
* @param {number} index - element index
|
|
2969
|
-
*
|
|
2970
|
-
* @return {FluentFiltersOrRelationsGetter}
|
|
2971
|
-
*/
|
|
2972
|
-
column(index) {
|
|
2973
|
-
this._textStr = '';
|
|
2974
|
-
this._textStr += 'column';
|
|
2975
|
-
this._textStr += ` ${index}`;
|
|
2976
|
-
return new FluentFiltersOrRelationsGetter(this);
|
|
2977
|
-
}
|
|
2978
|
-
/**
|
|
2979
|
-
*
|
|
2980
|
-
* @param {number} row_index - row index
|
|
2981
|
-
* @param {number} column_index - column index
|
|
2982
|
-
*
|
|
2983
|
-
* @return {FluentFiltersOrRelationsGetter}
|
|
2984
|
-
*/
|
|
2985
|
-
cell(row_index, column_index) {
|
|
2986
|
-
this._textStr = '';
|
|
2987
|
-
this._textStr += 'cell';
|
|
2988
|
-
this._textStr += ' row';
|
|
2989
|
-
this._textStr += ` ${row_index}`;
|
|
2990
|
-
this._textStr += ' column';
|
|
2991
|
-
this._textStr += ` ${column_index}`;
|
|
2992
|
-
return new FluentFiltersOrRelationsGetter(this);
|
|
2993
|
-
}
|
|
2994
2792
|
/**
|
|
2995
2793
|
* Filters for a UI element 'table'.
|
|
2996
2794
|
*
|
|
@@ -3335,47 +3133,6 @@ class FluentFiltersGetter extends FluentBase {
|
|
|
3335
3133
|
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
3336
3134
|
return new FluentFiltersOrRelationsGetter(this);
|
|
3337
3135
|
}
|
|
3338
|
-
/**
|
|
3339
|
-
* Filters elements based on a textual description.
|
|
3340
|
-
*
|
|
3341
|
-
* **What Should I Write as Matching Text**
|
|
3342
|
-
*
|
|
3343
|
-
* The text description inside the `matching()` should describe the element visually.
|
|
3344
|
-
* It understands color, some famous company/product names, general descriptions.
|
|
3345
|
-
*
|
|
3346
|
-
* **Important: _Matching only returns the best matching element when you use it with `get()`_**
|
|
3347
|
-
*
|
|
3348
|
-
* A bit of playing around to find a matching description is sometimes needed:
|
|
3349
|
-
* For example, `puzzle piece` can fail while `an icon showing a puzzle piece` might work.
|
|
3350
|
-
* Generally, the more detail the better.
|
|
3351
|
-
*
|
|
3352
|
-
* We also recommend to not restrict the type of element by using the general selector `element()` as shown in the examples below.
|
|
3353
|
-
*
|
|
3354
|
-
* **Examples:**
|
|
3355
|
-
* ```typescript
|
|
3356
|
-
* // Select the black sneaker from a bunch of sneakers
|
|
3357
|
-
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
3358
|
-
*
|
|
3359
|
-
* // Select an image that has text in it
|
|
3360
|
-
* await aui.click().element().matching('has Burger King in it').exec();
|
|
3361
|
-
* await aui.click().element().matching('has adidas in it').exec();
|
|
3362
|
-
*
|
|
3363
|
-
* // Target a logo/image by describing it
|
|
3364
|
-
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
3365
|
-
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
3366
|
-
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
3367
|
-
* ```
|
|
3368
|
-
*
|
|
3369
|
-
* @param {string} text - A description of the target element.
|
|
3370
|
-
*
|
|
3371
|
-
* @return {FluentFiltersOrRelationsGetter}
|
|
3372
|
-
*/
|
|
3373
|
-
matching(text) {
|
|
3374
|
-
this._textStr = '';
|
|
3375
|
-
this._textStr += 'matching';
|
|
3376
|
-
this._textStr += ` ${Separators.STRING}${text}${Separators.STRING}`;
|
|
3377
|
-
return new FluentFiltersOrRelationsGetter(this);
|
|
3378
|
-
}
|
|
3379
3136
|
}
|
|
3380
3137
|
exports.FluentFiltersGetter = FluentFiltersGetter;
|
|
3381
3138
|
// Relations
|
|
@@ -21,7 +21,7 @@ const inference_response_error_1 = require("./inference-response-error");
|
|
|
21
21
|
const config_error_1 = require("./config-error");
|
|
22
22
|
const logger_1 = require("../lib/logger");
|
|
23
23
|
class InferenceClient {
|
|
24
|
-
constructor(baseUrl, httpClient, resize, workspaceId, modelComposition, apiVersion = '
|
|
24
|
+
constructor(baseUrl, httpClient, resize, workspaceId, modelComposition, apiVersion = 'v1') {
|
|
25
25
|
this.baseUrl = baseUrl;
|
|
26
26
|
this.httpClient = httpClient;
|
|
27
27
|
this.resize = resize;
|
|
@@ -59,10 +59,13 @@ class UiControlClientDependencyBuilder {
|
|
|
59
59
|
}
|
|
60
60
|
static getClientArgsWithDefaults(clientArgs) {
|
|
61
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
var _a, _b, _c, _d, _e, _f;
|
|
63
|
-
return Object.assign(Object.assign({}, clientArgs), {
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
63
|
+
return Object.assign(Object.assign({}, clientArgs), { aiElementArgs: {
|
|
64
|
+
additionalLocations: (_b = (_a = clientArgs.aiElementArgs) === null || _a === void 0 ? void 0 : _a.additionalLocations) !== null && _b !== void 0 ? _b : [],
|
|
65
|
+
onLocationNotExist: (_d = (_c = clientArgs.aiElementArgs) === null || _c === void 0 ? void 0 : _c.onLocationNotExist) !== null && _d !== void 0 ? _d : 'error',
|
|
66
|
+
}, context: {
|
|
67
|
+
isCi: (_f = (_e = clientArgs.context) === null || _e === void 0 ? void 0 : _e.isCi) !== null && _f !== void 0 ? _f : is_ci_1.default,
|
|
68
|
+
}, credentials: (0, read_credentials_1.readCredentials)(clientArgs), inferenceServerApiVersion: (_g = clientArgs.inferenceServerApiVersion) !== null && _g !== void 0 ? _g : 'v3', inferenceServerUrl: (_h = clientArgs.inferenceServerUrl) !== null && _h !== void 0 ? _h : 'https://inference.askui.com', proxyAgents: (_j = clientArgs.proxyAgents) !== null && _j !== void 0 ? _j : (yield (0, proxy_builder_1.envProxyAgents)()), uiControllerUrl: (_k = clientArgs.uiControllerUrl) !== null && _k !== void 0 ? _k : 'http://127.0.0.1:6769' });
|
|
66
69
|
});
|
|
67
70
|
}
|
|
68
71
|
}
|