askui 0.2.2 → 0.2.3
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 +2 -2
- package/dist/cjs/execution/dsl.d.ts +51 -1
- package/dist/cjs/execution/dsl.js +67 -10
- package/dist/cjs/execution/read-environment-credentials.js +4 -4
- package/dist/cjs/execution/read-environment-credentials.spec.js +2 -2
- package/dist/cjs/execution/ui-control-client.js +1 -1
- package/dist/cjs/execution/ui-controller-client-interface.d.ts +1 -1
- package/dist/cjs/lib/ui-controller-facade.js +1 -1
- package/dist/cjs/lib/ui-controller-linux.js +2 -2
- package/dist/cjs/utils/http/credentials.d.ts +1 -1
- package/dist/cjs/utils/http/credentials.js +1 -1
- package/dist/cjs/utils/http/credentials.spec.js +2 -2
- package/dist/esm/execution/dsl.d.ts +51 -1
- package/dist/esm/execution/dsl.js +67 -10
- package/dist/esm/execution/read-environment-credentials.js +4 -4
- package/dist/esm/execution/read-environment-credentials.spec.js +2 -2
- package/dist/esm/execution/ui-control-client.js +1 -1
- package/dist/esm/execution/ui-controller-client-interface.d.ts +1 -1
- package/dist/esm/lib/ui-controller-facade.js +1 -1
- package/dist/esm/lib/ui-controller-linux.js +2 -2
- package/dist/esm/utils/http/credentials.d.ts +1 -1
- package/dist/esm/utils/http/credentials.js +1 -1
- package/dist/esm/utils/http/credentials.spec.js +2 -2
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -45,8 +45,8 @@ Visit our [documentation](https://docs.askui.com) for examples and a full list o
|
|
|
45
45
|
### Notes
|
|
46
46
|
|
|
47
47
|
Important note for Linux users: Currently, Wayland is not supported.
|
|
48
|
-
You can read more in our [troubleshooting chapter](https://docs.askui.com/docs/general/Troubleshooting/
|
|
49
|
-
If you want to use the askui library libfuse2 is needed ([libfuse2 installation](https://docs.askui.com/docs/general/Troubleshooting/
|
|
48
|
+
You can read more in our [troubleshooting chapter](https://docs.askui.com/docs/general/Troubleshooting/linux#wayland).
|
|
49
|
+
If you want to use the askui library libfuse2 is needed ([libfuse2 installation](https://docs.askui.com/docs/general/Troubleshooting/linux#libfuse2)).
|
|
50
50
|
|
|
51
51
|
## Example
|
|
52
52
|
|
|
@@ -426,6 +426,15 @@ export declare class FluentFilters extends FluentBase {
|
|
|
426
426
|
/**
|
|
427
427
|
* Filters for an UI element 'icon'.
|
|
428
428
|
*
|
|
429
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
430
|
+
*
|
|
431
|
+
* **Examples:**
|
|
432
|
+
* ```typescript
|
|
433
|
+
* icon().withText('plus')
|
|
434
|
+
* ```
|
|
435
|
+
*
|
|
436
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
437
|
+
*
|
|
429
438
|
* @return {FluentFiltersOrRelations}
|
|
430
439
|
*/
|
|
431
440
|
icon(): FluentFiltersOrRelations;
|
|
@@ -461,6 +470,22 @@ export declare class FluentFilters extends FluentBase {
|
|
|
461
470
|
* @return {FluentFiltersOrRelations}
|
|
462
471
|
*/
|
|
463
472
|
withText(text: string): FluentFiltersOrRelations;
|
|
473
|
+
/**
|
|
474
|
+
* Filters for texts, which match the regex pattern.
|
|
475
|
+
*
|
|
476
|
+
* **Examples:**
|
|
477
|
+
*
|
|
478
|
+
* ```typescript
|
|
479
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
480
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
481
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
482
|
+
* ```
|
|
483
|
+
*
|
|
484
|
+
* @param {string} regex_pattern - An regex pattern
|
|
485
|
+
*
|
|
486
|
+
* @return {FluentFiltersOrRelations}
|
|
487
|
+
*/
|
|
488
|
+
withTextRegex(regex_pattern: string): FluentFiltersOrRelations;
|
|
464
489
|
/**
|
|
465
490
|
* Filters for equal text.
|
|
466
491
|
*
|
|
@@ -1060,6 +1085,15 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
1060
1085
|
/**
|
|
1061
1086
|
* Filters for an UI element 'icon'.
|
|
1062
1087
|
*
|
|
1088
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
1089
|
+
*
|
|
1090
|
+
* **Examples:**
|
|
1091
|
+
* ```typescript
|
|
1092
|
+
* icon().withText('plus')
|
|
1093
|
+
* ```
|
|
1094
|
+
*
|
|
1095
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
1096
|
+
*
|
|
1063
1097
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1064
1098
|
*/
|
|
1065
1099
|
icon(): FluentFiltersOrRelationsCondition;
|
|
@@ -1095,6 +1129,22 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
1095
1129
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1096
1130
|
*/
|
|
1097
1131
|
withText(text: string): FluentFiltersOrRelationsCondition;
|
|
1132
|
+
/**
|
|
1133
|
+
* Filters for texts, which match the regex pattern.
|
|
1134
|
+
*
|
|
1135
|
+
* **Examples:**
|
|
1136
|
+
*
|
|
1137
|
+
* ```typescript
|
|
1138
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
1139
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
1140
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
1141
|
+
* ```
|
|
1142
|
+
*
|
|
1143
|
+
* @param {string} regex_pattern - An regex pattern
|
|
1144
|
+
*
|
|
1145
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
1146
|
+
*/
|
|
1147
|
+
withTextRegex(regex_pattern: string): FluentFiltersOrRelationsCondition;
|
|
1098
1148
|
/**
|
|
1099
1149
|
* Filters for equal text.
|
|
1100
1150
|
*
|
|
@@ -1331,7 +1381,7 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1331
1381
|
*/
|
|
1332
1382
|
typeIn(text: string): FluentFilters;
|
|
1333
1383
|
/**
|
|
1334
|
-
* Moves mouse to the filtered element and scrolls in the x and y direction
|
|
1384
|
+
* Moves mouse to the filtered element and scrolls in the x and y direction.
|
|
1335
1385
|
*
|
|
1336
1386
|
* @param {number} x_offset - A (positive/negative) x direction.
|
|
1337
1387
|
* @param {number} y_offset - A (positive/negative) y direction.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
3
3
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
4
4
|
/* eslint-disable max-classes-per-file */
|
|
5
|
+
/* eslint-disable max-len */
|
|
5
6
|
// Autogenerated from typescript.template file
|
|
6
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
8
|
exports.FluentCommand = exports.FluentFiltersOrRelationsCondition = exports.FluentFiltersCondition = exports.FluentFiltersOrRelations = exports.FluentFilters = exports.Exec = void 0;
|
|
@@ -650,6 +651,15 @@ class FluentFilters extends FluentBase {
|
|
|
650
651
|
/**
|
|
651
652
|
* Filters for an UI element 'icon'.
|
|
652
653
|
*
|
|
654
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
655
|
+
*
|
|
656
|
+
* **Examples:**
|
|
657
|
+
* ```typescript
|
|
658
|
+
* icon().withText('plus')
|
|
659
|
+
* ```
|
|
660
|
+
*
|
|
661
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
662
|
+
*
|
|
653
663
|
* @return {FluentFiltersOrRelations}
|
|
654
664
|
*/
|
|
655
665
|
icon() {
|
|
@@ -695,7 +705,26 @@ class FluentFilters extends FluentBase {
|
|
|
695
705
|
* @return {FluentFiltersOrRelations}
|
|
696
706
|
*/
|
|
697
707
|
withText(text) {
|
|
698
|
-
this._textStr = `with text
|
|
708
|
+
this._textStr = `with text <|string|>${text}<|string|>`;
|
|
709
|
+
return new FluentFiltersOrRelations(this);
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Filters for texts, which match the regex pattern.
|
|
713
|
+
*
|
|
714
|
+
* **Examples:**
|
|
715
|
+
*
|
|
716
|
+
* ```typescript
|
|
717
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
718
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
719
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
720
|
+
* ```
|
|
721
|
+
*
|
|
722
|
+
* @param {string} regex_pattern - An regex pattern
|
|
723
|
+
*
|
|
724
|
+
* @return {FluentFiltersOrRelations}
|
|
725
|
+
*/
|
|
726
|
+
withTextRegex(regex_pattern) {
|
|
727
|
+
this._textStr = `match regex pattern <|string|>${regex_pattern}<|string|>`;
|
|
699
728
|
return new FluentFiltersOrRelations(this);
|
|
700
729
|
}
|
|
701
730
|
/**
|
|
@@ -717,7 +746,7 @@ class FluentFilters extends FluentBase {
|
|
|
717
746
|
* @return {FluentFiltersOrRelations}
|
|
718
747
|
*/
|
|
719
748
|
withExactText(text) {
|
|
720
|
-
this._textStr = `equals text
|
|
749
|
+
this._textStr = `equals text <|string|>${text}<|string|>`;
|
|
721
750
|
return new FluentFiltersOrRelations(this);
|
|
722
751
|
}
|
|
723
752
|
/**
|
|
@@ -735,7 +764,7 @@ class FluentFilters extends FluentBase {
|
|
|
735
764
|
* @return {FluentFiltersOrRelations}
|
|
736
765
|
*/
|
|
737
766
|
containsText(text) {
|
|
738
|
-
this._textStr = `contain text
|
|
767
|
+
this._textStr = `contain text <|string|>${text}<|string|>`;
|
|
739
768
|
return new FluentFiltersOrRelations(this);
|
|
740
769
|
}
|
|
741
770
|
/**
|
|
@@ -1534,6 +1563,15 @@ class FluentFiltersCondition extends FluentBase {
|
|
|
1534
1563
|
/**
|
|
1535
1564
|
* Filters for an UI element 'icon'.
|
|
1536
1565
|
*
|
|
1566
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
1567
|
+
*
|
|
1568
|
+
* **Examples:**
|
|
1569
|
+
* ```typescript
|
|
1570
|
+
* icon().withText('plus')
|
|
1571
|
+
* ```
|
|
1572
|
+
*
|
|
1573
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
1574
|
+
*
|
|
1537
1575
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1538
1576
|
*/
|
|
1539
1577
|
icon() {
|
|
@@ -1579,7 +1617,26 @@ class FluentFiltersCondition extends FluentBase {
|
|
|
1579
1617
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1580
1618
|
*/
|
|
1581
1619
|
withText(text) {
|
|
1582
|
-
this._textStr = `with text
|
|
1620
|
+
this._textStr = `with text <|string|>${text}<|string|>`;
|
|
1621
|
+
return new FluentFiltersOrRelationsCondition(this);
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Filters for texts, which match the regex pattern.
|
|
1625
|
+
*
|
|
1626
|
+
* **Examples:**
|
|
1627
|
+
*
|
|
1628
|
+
* ```typescript
|
|
1629
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
1630
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
1631
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
1632
|
+
* ```
|
|
1633
|
+
*
|
|
1634
|
+
* @param {string} regex_pattern - An regex pattern
|
|
1635
|
+
*
|
|
1636
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
1637
|
+
*/
|
|
1638
|
+
withTextRegex(regex_pattern) {
|
|
1639
|
+
this._textStr = `match regex pattern <|string|>${regex_pattern}<|string|>`;
|
|
1583
1640
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1584
1641
|
}
|
|
1585
1642
|
/**
|
|
@@ -1601,7 +1658,7 @@ class FluentFiltersCondition extends FluentBase {
|
|
|
1601
1658
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1602
1659
|
*/
|
|
1603
1660
|
withExactText(text) {
|
|
1604
|
-
this._textStr = `equals text
|
|
1661
|
+
this._textStr = `equals text <|string|>${text}<|string|>`;
|
|
1605
1662
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1606
1663
|
}
|
|
1607
1664
|
/**
|
|
@@ -1619,7 +1676,7 @@ class FluentFiltersCondition extends FluentBase {
|
|
|
1619
1676
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1620
1677
|
*/
|
|
1621
1678
|
containsText(text) {
|
|
1622
|
-
this._textStr = `contain text
|
|
1679
|
+
this._textStr = `contain text <|string|>${text}<|string|>`;
|
|
1623
1680
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1624
1681
|
}
|
|
1625
1682
|
/**
|
|
@@ -1868,11 +1925,11 @@ class FluentCommand extends FluentBase {
|
|
|
1868
1925
|
* @return {FluentFilters}
|
|
1869
1926
|
*/
|
|
1870
1927
|
typeIn(text) {
|
|
1871
|
-
this._textStr = `Type
|
|
1928
|
+
this._textStr = `Type <|string|>${text}<|string|> in`;
|
|
1872
1929
|
return new FluentFilters(this);
|
|
1873
1930
|
}
|
|
1874
1931
|
/**
|
|
1875
|
-
* Moves mouse to the filtered element and scrolls in the x and y direction
|
|
1932
|
+
* Moves mouse to the filtered element and scrolls in the x and y direction.
|
|
1876
1933
|
*
|
|
1877
1934
|
* @param {number} x_offset - A (positive/negative) x direction.
|
|
1878
1935
|
* @param {number} y_offset - A (positive/negative) y direction.
|
|
@@ -1916,7 +1973,7 @@ class FluentCommand extends FluentBase {
|
|
|
1916
1973
|
* @return {Exec}
|
|
1917
1974
|
*/
|
|
1918
1975
|
type(text) {
|
|
1919
|
-
this._textStr = `Type
|
|
1976
|
+
this._textStr = `Type <|string|>${text}<|string|>`;
|
|
1920
1977
|
return new Exec(this);
|
|
1921
1978
|
}
|
|
1922
1979
|
/**
|
|
@@ -1965,7 +2022,7 @@ class FluentCommand extends FluentBase {
|
|
|
1965
2022
|
* @return {Exec}
|
|
1966
2023
|
*/
|
|
1967
2024
|
execOnShell(shell_command) {
|
|
1968
|
-
this._textStr = `Execute shell command
|
|
2025
|
+
this._textStr = `Execute shell command <|string|>${shell_command}<|string|>`;
|
|
1969
2026
|
return new Exec(this);
|
|
1970
2027
|
}
|
|
1971
2028
|
/**
|
|
@@ -4,12 +4,12 @@ exports.envCredentials = void 0;
|
|
|
4
4
|
const lib_1 = require("../lib");
|
|
5
5
|
function envCredentials() {
|
|
6
6
|
const envToken = process.env['ASKUI_TOKEN'];
|
|
7
|
-
const
|
|
7
|
+
const envWorkspaceId = process.env['ASKUI_WORKSPACE_ID'];
|
|
8
8
|
const envEmail = process.env['ASKUI_EMAIL'];
|
|
9
|
-
if (envToken &&
|
|
10
|
-
lib_1.logger.info('Credentials are used from ENV variables: ASKUI_TOKEN,
|
|
9
|
+
if (envToken && envWorkspaceId && envEmail) {
|
|
10
|
+
lib_1.logger.info('Credentials are used from ENV variables: ASKUI_TOKEN, ASKUI_WORKSPACE_ID and ASKUI_EMAIL');
|
|
11
11
|
return {
|
|
12
|
-
|
|
12
|
+
workspaceId: envWorkspaceId,
|
|
13
13
|
email: envEmail,
|
|
14
14
|
token: envToken,
|
|
15
15
|
};
|
|
@@ -4,9 +4,9 @@ const read_environment_credentials_1 = require("./read-environment-credentials")
|
|
|
4
4
|
describe('envCredentials()', () => {
|
|
5
5
|
test('should read the credentials from the environment variables', () => {
|
|
6
6
|
process.env['ASKUI_TOKEN'] = 'token';
|
|
7
|
-
process.env['
|
|
7
|
+
process.env['ASKUI_WORKSPACE_ID'] = 'id123';
|
|
8
8
|
process.env['ASKUI_EMAIL'] = 'name@tenant.com';
|
|
9
9
|
const credentialsFromTheEnv = (0, read_environment_credentials_1.envCredentials)();
|
|
10
|
-
expect(credentialsFromTheEnv).toStrictEqual({
|
|
10
|
+
expect(credentialsFromTheEnv).toStrictEqual({ workspaceId: 'id123', email: 'name@tenant.com', token: 'token' });
|
|
11
11
|
});
|
|
12
12
|
});
|
|
@@ -23,7 +23,7 @@ const annotation_level_1 = require("./annotation-level");
|
|
|
23
23
|
const ui_control_client_error_1 = require("./ui-control-client-error");
|
|
24
24
|
const read_environment_credentials_1 = require("./read-environment-credentials");
|
|
25
25
|
const analytics_1 = require("../utils/analytics");
|
|
26
|
-
const getClientArgsWithDefaults = (clientArgs = {}) => (Object.assign({ uiControllerUrl: 'http://
|
|
26
|
+
const getClientArgsWithDefaults = (clientArgs = {}) => (Object.assign({ uiControllerUrl: 'http://127.0.0.1:6769', inferenceServerUrl: 'https://inference.askui.com', annotationLevel: annotation_level_1.AnnotationLevel.DISABLED }, clientArgs));
|
|
27
27
|
class UiControlClient extends dsl_1.FluentCommand {
|
|
28
28
|
constructor(httpClient, clientArgs) {
|
|
29
29
|
super();
|
|
@@ -3,7 +3,7 @@ import { AnnotationLevel } from './annotation-level';
|
|
|
3
3
|
/**
|
|
4
4
|
* Configuration options for the askui UI Control Client
|
|
5
5
|
*
|
|
6
|
-
* @param {string} uiControllerUrl - Default: http://
|
|
6
|
+
* @param {string} uiControllerUrl - Default: http://127.0.0.1:6769
|
|
7
7
|
* The adress of the askui UI Controller server.
|
|
8
8
|
* @param {string} inferenceClientUrl - Default: https://inference.askui.com`
|
|
9
9
|
* Address of the askui Inference server.
|
|
@@ -129,7 +129,7 @@ class UiControllerFacade {
|
|
|
129
129
|
}
|
|
130
130
|
catch (err) {
|
|
131
131
|
throw new Error(`The UI Controller could not be started. Log file : ${this.serverLogFile}. ErrorReason: ${err}
|
|
132
|
-
Check this website for more information: https://docs.askui.com/docs/general/Troubleshooting
|
|
132
|
+
Check this website for more information: https://docs.askui.com/docs/general/Troubleshooting`);
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
135
|
}
|
|
@@ -27,7 +27,7 @@ class UiControllerLinux extends ui_controller_facade_1.UiControllerFacade {
|
|
|
27
27
|
const runCommand = (0, util_1.promisify)(child_process_1.exec);
|
|
28
28
|
const waylandStatus = yield runCommand('echo $WAYLAND_DISPLAY');
|
|
29
29
|
if (waylandStatus.stdout.trim().includes('wayland')) {
|
|
30
|
-
throw new wayland_error_1.WaylandError('Wayland is not supported: https://docs.askui.com/docs/general/Troubleshooting/
|
|
30
|
+
throw new wayland_error_1.WaylandError('Wayland is not supported: https://docs.askui.com/docs/general/Troubleshooting/linux#wayland');
|
|
31
31
|
}
|
|
32
32
|
/* First we want to check if the user is using a debian distribution.
|
|
33
33
|
* and in the following if libfuse2 is installed.
|
|
@@ -44,7 +44,7 @@ class UiControllerLinux extends ui_controller_facade_1.UiControllerFacade {
|
|
|
44
44
|
yield runCommand('dpkg -s libfuse2 | grep Status');
|
|
45
45
|
}
|
|
46
46
|
catch (_a) {
|
|
47
|
-
throw new libfuse_error_1.LibfuseError('Libfuse2 package is missing: https://docs.askui.com/docs/general/Troubleshooting/
|
|
47
|
+
throw new libfuse_error_1.LibfuseError('Libfuse2 package is missing: https://docs.askui.com/docs/general/Troubleshooting/linux#libfuse2');
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
}
|
|
@@ -12,7 +12,7 @@ class Credentials {
|
|
|
12
12
|
return Buffer.from(`${this.userName}:${this.credentials.token}`);
|
|
13
13
|
}
|
|
14
14
|
get userName() {
|
|
15
|
-
return `${this.credentials.
|
|
15
|
+
return `${this.credentials.workspaceId}|${this.credentials.email}`;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
exports.Credentials = Credentials;
|
|
@@ -4,8 +4,8 @@ const credentials_1 = require("./credentials");
|
|
|
4
4
|
describe('Credentials', () => {
|
|
5
5
|
describe('base64Encoded()', () => {
|
|
6
6
|
test('should return base64-encoded credentials', () => {
|
|
7
|
-
const credentials = new credentials_1.Credentials({
|
|
8
|
-
expect(credentials.base64Encoded).toBe('
|
|
7
|
+
const credentials = new credentials_1.Credentials({ workspaceId: 'id123', email: 'name@tenant.com', token: 'password' });
|
|
8
|
+
expect(credentials.base64Encoded).toBe('aWQxMjN8bmFtZUB0ZW5hbnQuY29tOnBhc3N3b3Jk');
|
|
9
9
|
});
|
|
10
10
|
});
|
|
11
11
|
});
|
|
@@ -426,6 +426,15 @@ export declare class FluentFilters extends FluentBase {
|
|
|
426
426
|
/**
|
|
427
427
|
* Filters for an UI element 'icon'.
|
|
428
428
|
*
|
|
429
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
430
|
+
*
|
|
431
|
+
* **Examples:**
|
|
432
|
+
* ```typescript
|
|
433
|
+
* icon().withText('plus')
|
|
434
|
+
* ```
|
|
435
|
+
*
|
|
436
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
437
|
+
*
|
|
429
438
|
* @return {FluentFiltersOrRelations}
|
|
430
439
|
*/
|
|
431
440
|
icon(): FluentFiltersOrRelations;
|
|
@@ -461,6 +470,22 @@ export declare class FluentFilters extends FluentBase {
|
|
|
461
470
|
* @return {FluentFiltersOrRelations}
|
|
462
471
|
*/
|
|
463
472
|
withText(text: string): FluentFiltersOrRelations;
|
|
473
|
+
/**
|
|
474
|
+
* Filters for texts, which match the regex pattern.
|
|
475
|
+
*
|
|
476
|
+
* **Examples:**
|
|
477
|
+
*
|
|
478
|
+
* ```typescript
|
|
479
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
480
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
481
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
482
|
+
* ```
|
|
483
|
+
*
|
|
484
|
+
* @param {string} regex_pattern - An regex pattern
|
|
485
|
+
*
|
|
486
|
+
* @return {FluentFiltersOrRelations}
|
|
487
|
+
*/
|
|
488
|
+
withTextRegex(regex_pattern: string): FluentFiltersOrRelations;
|
|
464
489
|
/**
|
|
465
490
|
* Filters for equal text.
|
|
466
491
|
*
|
|
@@ -1060,6 +1085,15 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
1060
1085
|
/**
|
|
1061
1086
|
* Filters for an UI element 'icon'.
|
|
1062
1087
|
*
|
|
1088
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
1089
|
+
*
|
|
1090
|
+
* **Examples:**
|
|
1091
|
+
* ```typescript
|
|
1092
|
+
* icon().withText('plus')
|
|
1093
|
+
* ```
|
|
1094
|
+
*
|
|
1095
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
1096
|
+
*
|
|
1063
1097
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1064
1098
|
*/
|
|
1065
1099
|
icon(): FluentFiltersOrRelationsCondition;
|
|
@@ -1095,6 +1129,22 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
1095
1129
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1096
1130
|
*/
|
|
1097
1131
|
withText(text: string): FluentFiltersOrRelationsCondition;
|
|
1132
|
+
/**
|
|
1133
|
+
* Filters for texts, which match the regex pattern.
|
|
1134
|
+
*
|
|
1135
|
+
* **Examples:**
|
|
1136
|
+
*
|
|
1137
|
+
* ```typescript
|
|
1138
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
1139
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
1140
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
1141
|
+
* ```
|
|
1142
|
+
*
|
|
1143
|
+
* @param {string} regex_pattern - An regex pattern
|
|
1144
|
+
*
|
|
1145
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
1146
|
+
*/
|
|
1147
|
+
withTextRegex(regex_pattern: string): FluentFiltersOrRelationsCondition;
|
|
1098
1148
|
/**
|
|
1099
1149
|
* Filters for equal text.
|
|
1100
1150
|
*
|
|
@@ -1331,7 +1381,7 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1331
1381
|
*/
|
|
1332
1382
|
typeIn(text: string): FluentFilters;
|
|
1333
1383
|
/**
|
|
1334
|
-
* Moves mouse to the filtered element and scrolls in the x and y direction
|
|
1384
|
+
* Moves mouse to the filtered element and scrolls in the x and y direction.
|
|
1335
1385
|
*
|
|
1336
1386
|
* @param {number} x_offset - A (positive/negative) x direction.
|
|
1337
1387
|
* @param {number} y_offset - A (positive/negative) y direction.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
2
2
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
3
|
/* eslint-disable max-classes-per-file */
|
|
4
|
+
/* eslint-disable max-len */
|
|
4
5
|
// Autogenerated from typescript.template file
|
|
5
6
|
class FluentBase {
|
|
6
7
|
constructor(prev) {
|
|
@@ -646,6 +647,15 @@ export class FluentFilters extends FluentBase {
|
|
|
646
647
|
/**
|
|
647
648
|
* Filters for an UI element 'icon'.
|
|
648
649
|
*
|
|
650
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
651
|
+
*
|
|
652
|
+
* **Examples:**
|
|
653
|
+
* ```typescript
|
|
654
|
+
* icon().withText('plus')
|
|
655
|
+
* ```
|
|
656
|
+
*
|
|
657
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
658
|
+
*
|
|
649
659
|
* @return {FluentFiltersOrRelations}
|
|
650
660
|
*/
|
|
651
661
|
icon() {
|
|
@@ -691,7 +701,26 @@ export class FluentFilters extends FluentBase {
|
|
|
691
701
|
* @return {FluentFiltersOrRelations}
|
|
692
702
|
*/
|
|
693
703
|
withText(text) {
|
|
694
|
-
this._textStr = `with text
|
|
704
|
+
this._textStr = `with text <|string|>${text}<|string|>`;
|
|
705
|
+
return new FluentFiltersOrRelations(this);
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Filters for texts, which match the regex pattern.
|
|
709
|
+
*
|
|
710
|
+
* **Examples:**
|
|
711
|
+
*
|
|
712
|
+
* ```typescript
|
|
713
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
714
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
715
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
716
|
+
* ```
|
|
717
|
+
*
|
|
718
|
+
* @param {string} regex_pattern - An regex pattern
|
|
719
|
+
*
|
|
720
|
+
* @return {FluentFiltersOrRelations}
|
|
721
|
+
*/
|
|
722
|
+
withTextRegex(regex_pattern) {
|
|
723
|
+
this._textStr = `match regex pattern <|string|>${regex_pattern}<|string|>`;
|
|
695
724
|
return new FluentFiltersOrRelations(this);
|
|
696
725
|
}
|
|
697
726
|
/**
|
|
@@ -713,7 +742,7 @@ export class FluentFilters extends FluentBase {
|
|
|
713
742
|
* @return {FluentFiltersOrRelations}
|
|
714
743
|
*/
|
|
715
744
|
withExactText(text) {
|
|
716
|
-
this._textStr = `equals text
|
|
745
|
+
this._textStr = `equals text <|string|>${text}<|string|>`;
|
|
717
746
|
return new FluentFiltersOrRelations(this);
|
|
718
747
|
}
|
|
719
748
|
/**
|
|
@@ -731,7 +760,7 @@ export class FluentFilters extends FluentBase {
|
|
|
731
760
|
* @return {FluentFiltersOrRelations}
|
|
732
761
|
*/
|
|
733
762
|
containsText(text) {
|
|
734
|
-
this._textStr = `contain text
|
|
763
|
+
this._textStr = `contain text <|string|>${text}<|string|>`;
|
|
735
764
|
return new FluentFiltersOrRelations(this);
|
|
736
765
|
}
|
|
737
766
|
/**
|
|
@@ -1528,6 +1557,15 @@ export class FluentFiltersCondition extends FluentBase {
|
|
|
1528
1557
|
/**
|
|
1529
1558
|
* Filters for an UI element 'icon'.
|
|
1530
1559
|
*
|
|
1560
|
+
* You can combine it with the 'withText' command to look for a specific icon.
|
|
1561
|
+
*
|
|
1562
|
+
* **Examples:**
|
|
1563
|
+
* ```typescript
|
|
1564
|
+
* icon().withText('plus')
|
|
1565
|
+
* ```
|
|
1566
|
+
*
|
|
1567
|
+
* Note: This is an alpha feature. The prediction of the icon name is sometimes unstable. Use custom elements as an alternative.
|
|
1568
|
+
*
|
|
1531
1569
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1532
1570
|
*/
|
|
1533
1571
|
icon() {
|
|
@@ -1573,7 +1611,26 @@ export class FluentFiltersCondition extends FluentBase {
|
|
|
1573
1611
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1574
1612
|
*/
|
|
1575
1613
|
withText(text) {
|
|
1576
|
-
this._textStr = `with text
|
|
1614
|
+
this._textStr = `with text <|string|>${text}<|string|>`;
|
|
1615
|
+
return new FluentFiltersOrRelationsCondition(this);
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* Filters for texts, which match the regex pattern.
|
|
1619
|
+
*
|
|
1620
|
+
* **Examples:**
|
|
1621
|
+
*
|
|
1622
|
+
* ```typescript
|
|
1623
|
+
* 'The rain in Spain' === withTextRegex('\b[Ss]\w+') => true
|
|
1624
|
+
* 'The rain in Portugal' === withTextRegex('\b[Ss]\w+') => false
|
|
1625
|
+
* 'The rain in switzerland' === withTextRegex('\b[Ss]\w+') => true
|
|
1626
|
+
* ```
|
|
1627
|
+
*
|
|
1628
|
+
* @param {string} regex_pattern - An regex pattern
|
|
1629
|
+
*
|
|
1630
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
1631
|
+
*/
|
|
1632
|
+
withTextRegex(regex_pattern) {
|
|
1633
|
+
this._textStr = `match regex pattern <|string|>${regex_pattern}<|string|>`;
|
|
1577
1634
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1578
1635
|
}
|
|
1579
1636
|
/**
|
|
@@ -1595,7 +1652,7 @@ export class FluentFiltersCondition extends FluentBase {
|
|
|
1595
1652
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1596
1653
|
*/
|
|
1597
1654
|
withExactText(text) {
|
|
1598
|
-
this._textStr = `equals text
|
|
1655
|
+
this._textStr = `equals text <|string|>${text}<|string|>`;
|
|
1599
1656
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1600
1657
|
}
|
|
1601
1658
|
/**
|
|
@@ -1613,7 +1670,7 @@ export class FluentFiltersCondition extends FluentBase {
|
|
|
1613
1670
|
* @return {FluentFiltersOrRelationsCondition}
|
|
1614
1671
|
*/
|
|
1615
1672
|
containsText(text) {
|
|
1616
|
-
this._textStr = `contain text
|
|
1673
|
+
this._textStr = `contain text <|string|>${text}<|string|>`;
|
|
1617
1674
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1618
1675
|
}
|
|
1619
1676
|
/**
|
|
@@ -1860,11 +1917,11 @@ export class FluentCommand extends FluentBase {
|
|
|
1860
1917
|
* @return {FluentFilters}
|
|
1861
1918
|
*/
|
|
1862
1919
|
typeIn(text) {
|
|
1863
|
-
this._textStr = `Type
|
|
1920
|
+
this._textStr = `Type <|string|>${text}<|string|> in`;
|
|
1864
1921
|
return new FluentFilters(this);
|
|
1865
1922
|
}
|
|
1866
1923
|
/**
|
|
1867
|
-
* Moves mouse to the filtered element and scrolls in the x and y direction
|
|
1924
|
+
* Moves mouse to the filtered element and scrolls in the x and y direction.
|
|
1868
1925
|
*
|
|
1869
1926
|
* @param {number} x_offset - A (positive/negative) x direction.
|
|
1870
1927
|
* @param {number} y_offset - A (positive/negative) y direction.
|
|
@@ -1908,7 +1965,7 @@ export class FluentCommand extends FluentBase {
|
|
|
1908
1965
|
* @return {Exec}
|
|
1909
1966
|
*/
|
|
1910
1967
|
type(text) {
|
|
1911
|
-
this._textStr = `Type
|
|
1968
|
+
this._textStr = `Type <|string|>${text}<|string|>`;
|
|
1912
1969
|
return new Exec(this);
|
|
1913
1970
|
}
|
|
1914
1971
|
/**
|
|
@@ -1957,7 +2014,7 @@ export class FluentCommand extends FluentBase {
|
|
|
1957
2014
|
* @return {Exec}
|
|
1958
2015
|
*/
|
|
1959
2016
|
execOnShell(shell_command) {
|
|
1960
|
-
this._textStr = `Execute shell command
|
|
2017
|
+
this._textStr = `Execute shell command <|string|>${shell_command}<|string|>`;
|
|
1961
2018
|
return new Exec(this);
|
|
1962
2019
|
}
|
|
1963
2020
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { logger } from '../lib';
|
|
2
2
|
export function envCredentials() {
|
|
3
3
|
const envToken = process.env['ASKUI_TOKEN'];
|
|
4
|
-
const
|
|
4
|
+
const envWorkspaceId = process.env['ASKUI_WORKSPACE_ID'];
|
|
5
5
|
const envEmail = process.env['ASKUI_EMAIL'];
|
|
6
|
-
if (envToken &&
|
|
7
|
-
logger.info('Credentials are used from ENV variables: ASKUI_TOKEN,
|
|
6
|
+
if (envToken && envWorkspaceId && envEmail) {
|
|
7
|
+
logger.info('Credentials are used from ENV variables: ASKUI_TOKEN, ASKUI_WORKSPACE_ID and ASKUI_EMAIL');
|
|
8
8
|
return {
|
|
9
|
-
|
|
9
|
+
workspaceId: envWorkspaceId,
|
|
10
10
|
email: envEmail,
|
|
11
11
|
token: envToken,
|
|
12
12
|
};
|
|
@@ -2,9 +2,9 @@ import { envCredentials } from './read-environment-credentials';
|
|
|
2
2
|
describe('envCredentials()', () => {
|
|
3
3
|
test('should read the credentials from the environment variables', () => {
|
|
4
4
|
process.env['ASKUI_TOKEN'] = 'token';
|
|
5
|
-
process.env['
|
|
5
|
+
process.env['ASKUI_WORKSPACE_ID'] = 'id123';
|
|
6
6
|
process.env['ASKUI_EMAIL'] = 'name@tenant.com';
|
|
7
7
|
const credentialsFromTheEnv = envCredentials();
|
|
8
|
-
expect(credentialsFromTheEnv).toStrictEqual({
|
|
8
|
+
expect(credentialsFromTheEnv).toStrictEqual({ workspaceId: 'id123', email: 'name@tenant.com', token: 'token' });
|
|
9
9
|
});
|
|
10
10
|
});
|
|
@@ -20,7 +20,7 @@ import { AnnotationLevel } from './annotation-level';
|
|
|
20
20
|
import { UiControlClientError } from './ui-control-client-error';
|
|
21
21
|
import { envCredentials } from './read-environment-credentials';
|
|
22
22
|
import { Analytics } from '../utils/analytics';
|
|
23
|
-
const getClientArgsWithDefaults = (clientArgs = {}) => (Object.assign({ uiControllerUrl: 'http://
|
|
23
|
+
const getClientArgsWithDefaults = (clientArgs = {}) => (Object.assign({ uiControllerUrl: 'http://127.0.0.1:6769', inferenceServerUrl: 'https://inference.askui.com', annotationLevel: AnnotationLevel.DISABLED }, clientArgs));
|
|
24
24
|
export class UiControlClient extends FluentCommand {
|
|
25
25
|
constructor(httpClient, clientArgs) {
|
|
26
26
|
super();
|
|
@@ -3,7 +3,7 @@ import { AnnotationLevel } from './annotation-level';
|
|
|
3
3
|
/**
|
|
4
4
|
* Configuration options for the askui UI Control Client
|
|
5
5
|
*
|
|
6
|
-
* @param {string} uiControllerUrl - Default: http://
|
|
6
|
+
* @param {string} uiControllerUrl - Default: http://127.0.0.1:6769
|
|
7
7
|
* The adress of the askui UI Controller server.
|
|
8
8
|
* @param {string} inferenceClientUrl - Default: https://inference.askui.com`
|
|
9
9
|
* Address of the askui Inference server.
|
|
@@ -123,7 +123,7 @@ export class UiControllerFacade {
|
|
|
123
123
|
}
|
|
124
124
|
catch (err) {
|
|
125
125
|
throw new Error(`The UI Controller could not be started. Log file : ${this.serverLogFile}. ErrorReason: ${err}
|
|
126
|
-
Check this website for more information: https://docs.askui.com/docs/general/Troubleshooting
|
|
126
|
+
Check this website for more information: https://docs.askui.com/docs/general/Troubleshooting`);
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
129
|
}
|
|
@@ -24,7 +24,7 @@ export class UiControllerLinux extends UiControllerFacade {
|
|
|
24
24
|
const runCommand = promisify(exec);
|
|
25
25
|
const waylandStatus = yield runCommand('echo $WAYLAND_DISPLAY');
|
|
26
26
|
if (waylandStatus.stdout.trim().includes('wayland')) {
|
|
27
|
-
throw new WaylandError('Wayland is not supported: https://docs.askui.com/docs/general/Troubleshooting/
|
|
27
|
+
throw new WaylandError('Wayland is not supported: https://docs.askui.com/docs/general/Troubleshooting/linux#wayland');
|
|
28
28
|
}
|
|
29
29
|
/* First we want to check if the user is using a debian distribution.
|
|
30
30
|
* and in the following if libfuse2 is installed.
|
|
@@ -41,7 +41,7 @@ export class UiControllerLinux extends UiControllerFacade {
|
|
|
41
41
|
yield runCommand('dpkg -s libfuse2 | grep Status');
|
|
42
42
|
}
|
|
43
43
|
catch (_a) {
|
|
44
|
-
throw new LibfuseError('Libfuse2 package is missing: https://docs.askui.com/docs/general/Troubleshooting/
|
|
44
|
+
throw new LibfuseError('Libfuse2 package is missing: https://docs.askui.com/docs/general/Troubleshooting/linux#libfuse2');
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
}
|
|
@@ -9,6 +9,6 @@ export class Credentials {
|
|
|
9
9
|
return Buffer.from(`${this.userName}:${this.credentials.token}`);
|
|
10
10
|
}
|
|
11
11
|
get userName() {
|
|
12
|
-
return `${this.credentials.
|
|
12
|
+
return `${this.credentials.workspaceId}|${this.credentials.email}`;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -2,8 +2,8 @@ import { Credentials } from './credentials';
|
|
|
2
2
|
describe('Credentials', () => {
|
|
3
3
|
describe('base64Encoded()', () => {
|
|
4
4
|
test('should return base64-encoded credentials', () => {
|
|
5
|
-
const credentials = new Credentials({
|
|
6
|
-
expect(credentials.base64Encoded).toBe('
|
|
5
|
+
const credentials = new Credentials({ workspaceId: 'id123', email: 'name@tenant.com', token: 'password' });
|
|
6
|
+
expect(credentials.base64Encoded).toBe('aWQxMjN8bmFtZUB0ZW5hbnQuY29tOnBhc3N3b3Jk');
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "askui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"main": "./dist/cjs/main.js",
|
|
5
5
|
"module": "./dist/esm/main.js",
|
|
6
6
|
"bin": {
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
"dist/bin/",
|
|
23
23
|
"dist/example_projects_templates/"
|
|
24
24
|
],
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/askui/askui.git"
|
|
28
|
+
},
|
|
25
29
|
"dependencies": {
|
|
26
30
|
"commander": "~8.3.0",
|
|
27
31
|
"fkill": "~7.2.1",
|
|
@@ -55,4 +59,4 @@
|
|
|
55
59
|
"lint-staged": {
|
|
56
60
|
"./**/*.{js,ts}": "eslint --cache --fix --max-warnings 0"
|
|
57
61
|
}
|
|
58
|
-
}
|
|
62
|
+
}
|