askui 0.18.1 → 0.20.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 +10 -0
- package/dist/cjs/core/ai-element/ai-element-collection.js +78 -0
- package/dist/cjs/core/ai-element/ai-element-error.d.ts +2 -0
- package/dist/cjs/core/ai-element/ai-element-error.js +6 -0
- package/dist/cjs/core/ai-element/ai-element.d.ts +27 -0
- package/dist/cjs/core/ai-element/ai-element.js +31 -0
- package/dist/cjs/execution/dsl.d.ts +127 -17
- package/dist/cjs/execution/dsl.js +158 -17
- package/dist/cjs/execution/index.d.ts +1 -1
- package/dist/cjs/execution/index.js +11 -3
- package/dist/cjs/execution/ui-control-client-dependency-builder.d.ts +1 -0
- package/dist/cjs/execution/ui-control-client-dependency-builder.js +3 -0
- package/dist/cjs/execution/ui-control-client.d.ts +101 -16
- package/dist/cjs/execution/ui-control-client.js +145 -52
- package/dist/cjs/main.d.ts +1 -1
- package/dist/cjs/main.js +12 -3
- package/dist/cjs/utils/analytics/analytics.d.ts +1 -1
- package/dist/esm/core/ai-element/ai-element-collection.d.ts +10 -0
- package/dist/esm/core/ai-element/ai-element-collection.js +71 -0
- package/dist/esm/core/ai-element/ai-element-error.d.ts +2 -0
- package/dist/esm/core/ai-element/ai-element-error.js +2 -0
- package/dist/esm/core/ai-element/ai-element.d.ts +27 -0
- package/dist/esm/core/ai-element/ai-element.js +28 -0
- package/dist/esm/execution/dsl.d.ts +127 -17
- package/dist/esm/execution/dsl.js +158 -17
- package/dist/esm/execution/index.d.ts +1 -1
- package/dist/esm/execution/index.js +1 -1
- package/dist/esm/execution/ui-control-client-dependency-builder.d.ts +1 -0
- package/dist/esm/execution/ui-control-client-dependency-builder.js +3 -0
- package/dist/esm/execution/ui-control-client.d.ts +101 -16
- package/dist/esm/execution/ui-control-client.js +145 -49
- package/dist/esm/main.d.ts +1 -1
- package/dist/esm/main.js +1 -1
- package/dist/esm/utils/analytics/analytics.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/core/annotation/annotation-writer.js.map +0 -1
- package/dist/cjs/core/annotation/annotation.js.map +0 -1
- package/dist/cjs/core/inference-response/inference-response.js.map +0 -1
- package/dist/cjs/core/inference-response/invalid-model-type-error.js.map +0 -1
- package/dist/cjs/core/inference-response/model-type.js.map +0 -1
- package/dist/cjs/core/model/annotation-result/annotation-interface.js.map +0 -1
- package/dist/cjs/core/model/annotation-result/boundary-box.js.map +0 -1
- package/dist/cjs/core/model/annotation-result/detected-element.js.map +0 -1
- package/dist/cjs/core/model/custom-element-json.js.map +0 -1
- package/dist/cjs/core/model/custom-element.js.map +0 -1
- package/dist/cjs/core/reporting/default-step.js.map +0 -1
- package/dist/cjs/core/reporting/index.js.map +0 -1
- package/dist/cjs/core/reporting/instruction.js.map +0 -1
- package/dist/cjs/core/reporting/reporter-config.js.map +0 -1
- package/dist/cjs/core/reporting/reporter.js.map +0 -1
- package/dist/cjs/core/reporting/snapshot-detail-level.js.map +0 -1
- package/dist/cjs/core/reporting/snapshot.js.map +0 -1
- package/dist/cjs/core/reporting/step-reporter.js.map +0 -1
- package/dist/cjs/core/reporting/step-run.js.map +0 -1
- package/dist/cjs/core/reporting/step-status-end.js.map +0 -1
- package/dist/cjs/core/reporting/step-status.js.map +0 -1
- package/dist/cjs/core/reporting/step.js.map +0 -1
- package/dist/cjs/core/runner-protocol/index.js.map +0 -1
- package/dist/cjs/core/runner-protocol/request/capture-screenshot-request.js.map +0 -1
- package/dist/cjs/core/runner-protocol/request/control-request.js.map +0 -1
- package/dist/cjs/core/runner-protocol/request/get-server-process-pid.js.map +0 -1
- package/dist/cjs/core/runner-protocol/request/index.js.map +0 -1
- package/dist/cjs/core/runner-protocol/request/interactive-annotation-request.js.map +0 -1
- package/dist/cjs/core/runner-protocol/request/read-recording-request.js.map +0 -1
- package/dist/cjs/core/runner-protocol/request/runner-protocol-request.js.map +0 -1
- package/dist/cjs/core/runner-protocol/request/start-recording-request.js.map +0 -1
- package/dist/cjs/core/runner-protocol/request/stop-recording-request.js.map +0 -1
- package/dist/cjs/core/runner-protocol/response/index.js.map +0 -1
- package/dist/cjs/core/ui-control-commands/action.js.map +0 -1
- package/dist/cjs/core/ui-control-commands/control-command-code.js.map +0 -1
- package/dist/cjs/core/ui-control-commands/control-command.js.map +0 -1
- package/dist/cjs/core/ui-control-commands/index.js.map +0 -1
- package/dist/cjs/core/ui-control-commands/input-event.js.map +0 -1
- package/dist/cjs/execution/config-error.js.map +0 -1
- package/dist/cjs/execution/control-command-error.js.map +0 -1
- package/dist/cjs/execution/credentials-args.js.map +0 -1
- package/dist/cjs/execution/dsl.js.map +0 -1
- package/dist/cjs/execution/execution-runtime.js.map +0 -1
- package/dist/cjs/execution/index.js.map +0 -1
- package/dist/cjs/execution/inference-client.js.map +0 -1
- package/dist/cjs/execution/inference-response-error.js.map +0 -1
- package/dist/cjs/execution/is-image-required-interface.js.map +0 -1
- package/dist/cjs/execution/misc.js.map +0 -1
- package/dist/cjs/execution/model-composition-branch.js.map +0 -1
- package/dist/cjs/execution/read-environment-credentials.js.map +0 -1
- package/dist/cjs/execution/read-recording-response-stream-handler.js.map +0 -1
- package/dist/cjs/execution/repeat-error.js.map +0 -1
- package/dist/cjs/execution/ui-control-client-dependency-builder.js.map +0 -1
- package/dist/cjs/execution/ui-control-client.js.map +0 -1
- package/dist/cjs/execution/ui-controller-client-connection-state.js.map +0 -1
- package/dist/cjs/execution/ui-controller-client-error.js.map +0 -1
- package/dist/cjs/execution/ui-controller-client-interface.js.map +0 -1
- package/dist/cjs/execution/ui-controller-client.js.map +0 -1
- package/dist/cjs/lib/download-binaries.js.map +0 -1
- package/dist/cjs/lib/index.js.map +0 -1
- package/dist/cjs/lib/interactive_cli/add-script-package-json.d.ts +0 -1
- package/dist/cjs/lib/interactive_cli/add-script-package-json.js +0 -39
- package/dist/cjs/lib/interactive_cli/add-script-package-json.js.map +0 -1
- package/dist/cjs/lib/interactive_cli/cli-options-interface.js.map +0 -1
- package/dist/cjs/lib/interactive_cli/cli.js.map +0 -1
- package/dist/cjs/lib/interactive_cli/create-example-project.js.map +0 -1
- package/dist/cjs/lib/interactive_cli/index.js.map +0 -1
- package/dist/cjs/lib/libfuse-error.js.map +0 -1
- package/dist/cjs/lib/logger.js.map +0 -1
- package/dist/cjs/lib/timeout-error.js.map +0 -1
- package/dist/cjs/lib/ui-controller-args.js.map +0 -1
- package/dist/cjs/lib/ui-controller-darwin.js.map +0 -1
- package/dist/cjs/lib/ui-controller-facade.js.map +0 -1
- package/dist/cjs/lib/ui-controller-linux.js.map +0 -1
- package/dist/cjs/lib/ui-controller-win32.js.map +0 -1
- package/dist/cjs/lib/ui-controller.js.map +0 -1
- package/dist/cjs/lib/unkown-error.js.map +0 -1
- package/dist/cjs/lib/wayland-error.js.map +0 -1
- package/dist/cjs/main.js.map +0 -1
- package/dist/cjs/shared/index.js.map +0 -1
- package/dist/cjs/shared/log-levels.js.map +0 -1
- package/dist/cjs/shared/proxy-agent-args.js.map +0 -1
- package/dist/cjs/utils/analytics/analytics-interface.js.map +0 -1
- package/dist/cjs/utils/analytics/analytics.js.map +0 -1
- package/dist/cjs/utils/analytics/index.js.map +0 -1
- package/dist/cjs/utils/analytics/installation-timestamp-create-error.js.map +0 -1
- package/dist/cjs/utils/analytics/installation-timestamp-get-error.js.map +0 -1
- package/dist/cjs/utils/analytics/installation-timestamp.js.map +0 -1
- package/dist/cjs/utils/analytics/user-identifier-interface.js.map +0 -1
- package/dist/cjs/utils/analytics/user-identifier.js.map +0 -1
- package/dist/cjs/utils/base_64_image/base-64-image-error.js.map +0 -1
- package/dist/cjs/utils/base_64_image/base-64-image-string-error.js.map +0 -1
- package/dist/cjs/utils/base_64_image/base-64-image.js.map +0 -1
- package/dist/cjs/utils/base_64_image/sharp.js.map +0 -1
- package/dist/cjs/utils/http/credentials.js.map +0 -1
- package/dist/cjs/utils/http/custom-errors/authentication-http-client-error.js.map +0 -1
- package/dist/cjs/utils/http/custom-errors/client-http-client-error.js.map +0 -1
- package/dist/cjs/utils/http/custom-errors/general-http-client-error.js.map +0 -1
- package/dist/cjs/utils/http/custom-errors/http-client-error.js.map +0 -1
- package/dist/cjs/utils/http/custom-errors/index.js.map +0 -1
- package/dist/cjs/utils/http/custom-errors/server-http-client-error.js.map +0 -1
- package/dist/cjs/utils/http/custom-errors/unkown-http-client-error.js.map +0 -1
- package/dist/cjs/utils/http/http-client-got.js.map +0 -1
- package/dist/cjs/utils/http/index.js.map +0 -1
- package/dist/cjs/utils/image-resize-errors/image-resizing-base-error.js.map +0 -1
- package/dist/cjs/utils/image-resize-errors/index.js.map +0 -1
- package/dist/cjs/utils/path.js.map +0 -1
- package/dist/cjs/utils/proxy/proxy-builder.js.map +0 -1
- package/dist/cjs/utils/resized-image-interface.js.map +0 -1
- package/dist/cjs/utils/transformations.js.map +0 -1
- package/dist/esm/core/annotation/annotation-writer.js.map +0 -1
- package/dist/esm/core/annotation/annotation.js.map +0 -1
- package/dist/esm/core/inference-response/inference-response.js.map +0 -1
- package/dist/esm/core/inference-response/invalid-model-type-error.js.map +0 -1
- package/dist/esm/core/inference-response/model-type.js.map +0 -1
- package/dist/esm/core/model/annotation-result/annotation-interface.js.map +0 -1
- package/dist/esm/core/model/annotation-result/boundary-box.js.map +0 -1
- package/dist/esm/core/model/annotation-result/detected-element.js.map +0 -1
- package/dist/esm/core/model/custom-element-json.js.map +0 -1
- package/dist/esm/core/model/custom-element.js.map +0 -1
- package/dist/esm/core/reporting/default-step.js.map +0 -1
- package/dist/esm/core/reporting/index.js.map +0 -1
- package/dist/esm/core/reporting/instruction.js.map +0 -1
- package/dist/esm/core/reporting/reporter-config.js.map +0 -1
- package/dist/esm/core/reporting/reporter.js.map +0 -1
- package/dist/esm/core/reporting/snapshot-detail-level.js.map +0 -1
- package/dist/esm/core/reporting/snapshot.js.map +0 -1
- package/dist/esm/core/reporting/step-reporter.js.map +0 -1
- package/dist/esm/core/reporting/step-run.js.map +0 -1
- package/dist/esm/core/reporting/step-status-end.js.map +0 -1
- package/dist/esm/core/reporting/step-status.js.map +0 -1
- package/dist/esm/core/reporting/step.js.map +0 -1
- package/dist/esm/core/runner-protocol/index.js.map +0 -1
- package/dist/esm/core/runner-protocol/request/capture-screenshot-request.js.map +0 -1
- package/dist/esm/core/runner-protocol/request/control-request.js.map +0 -1
- package/dist/esm/core/runner-protocol/request/get-server-process-pid.js.map +0 -1
- package/dist/esm/core/runner-protocol/request/index.js.map +0 -1
- package/dist/esm/core/runner-protocol/request/interactive-annotation-request.js.map +0 -1
- package/dist/esm/core/runner-protocol/request/read-recording-request.js.map +0 -1
- package/dist/esm/core/runner-protocol/request/runner-protocol-request.js.map +0 -1
- package/dist/esm/core/runner-protocol/request/start-recording-request.js.map +0 -1
- package/dist/esm/core/runner-protocol/request/stop-recording-request.js.map +0 -1
- package/dist/esm/core/runner-protocol/response/index.js.map +0 -1
- package/dist/esm/core/ui-control-commands/action.js.map +0 -1
- package/dist/esm/core/ui-control-commands/control-command-code.js.map +0 -1
- package/dist/esm/core/ui-control-commands/control-command.js.map +0 -1
- package/dist/esm/core/ui-control-commands/index.js.map +0 -1
- package/dist/esm/core/ui-control-commands/input-event.js.map +0 -1
- package/dist/esm/execution/config-error.js.map +0 -1
- package/dist/esm/execution/control-command-error.js.map +0 -1
- package/dist/esm/execution/credentials-args.js.map +0 -1
- package/dist/esm/execution/dsl.js.map +0 -1
- package/dist/esm/execution/execution-runtime.js.map +0 -1
- package/dist/esm/execution/index.js.map +0 -1
- package/dist/esm/execution/inference-client.js.map +0 -1
- package/dist/esm/execution/inference-response-error.js.map +0 -1
- package/dist/esm/execution/is-image-required-interface.js.map +0 -1
- package/dist/esm/execution/misc.js.map +0 -1
- package/dist/esm/execution/model-composition-branch.js.map +0 -1
- package/dist/esm/execution/read-environment-credentials.js.map +0 -1
- package/dist/esm/execution/read-recording-response-stream-handler.js.map +0 -1
- package/dist/esm/execution/repeat-error.js.map +0 -1
- package/dist/esm/execution/ui-control-client-dependency-builder.js.map +0 -1
- package/dist/esm/execution/ui-control-client.js.map +0 -1
- package/dist/esm/execution/ui-controller-client-connection-state.js.map +0 -1
- package/dist/esm/execution/ui-controller-client-error.js.map +0 -1
- package/dist/esm/execution/ui-controller-client-interface.js.map +0 -1
- package/dist/esm/execution/ui-controller-client.js.map +0 -1
- package/dist/esm/lib/download-binaries.js.map +0 -1
- package/dist/esm/lib/index.js.map +0 -1
- package/dist/esm/lib/interactive_cli/add-script-package-json.d.ts +0 -1
- package/dist/esm/lib/interactive_cli/add-script-package-json.js +0 -32
- package/dist/esm/lib/interactive_cli/add-script-package-json.js.map +0 -1
- package/dist/esm/lib/interactive_cli/cli-options-interface.js.map +0 -1
- package/dist/esm/lib/interactive_cli/cli.js.map +0 -1
- package/dist/esm/lib/interactive_cli/create-example-project.js.map +0 -1
- package/dist/esm/lib/interactive_cli/index.js.map +0 -1
- package/dist/esm/lib/libfuse-error.js.map +0 -1
- package/dist/esm/lib/logger.js.map +0 -1
- package/dist/esm/lib/timeout-error.js.map +0 -1
- package/dist/esm/lib/ui-controller-args.js.map +0 -1
- package/dist/esm/lib/ui-controller-darwin.js.map +0 -1
- package/dist/esm/lib/ui-controller-facade.js.map +0 -1
- package/dist/esm/lib/ui-controller-linux.js.map +0 -1
- package/dist/esm/lib/ui-controller-win32.js.map +0 -1
- package/dist/esm/lib/ui-controller.js.map +0 -1
- package/dist/esm/lib/unkown-error.js.map +0 -1
- package/dist/esm/lib/wayland-error.js.map +0 -1
- package/dist/esm/main.js.map +0 -1
- package/dist/esm/shared/index.js.map +0 -1
- package/dist/esm/shared/log-levels.js.map +0 -1
- package/dist/esm/shared/proxy-agent-args.js.map +0 -1
- package/dist/esm/utils/analytics/analytics-interface.js.map +0 -1
- package/dist/esm/utils/analytics/analytics.js.map +0 -1
- package/dist/esm/utils/analytics/index.js.map +0 -1
- package/dist/esm/utils/analytics/installation-timestamp-create-error.js.map +0 -1
- package/dist/esm/utils/analytics/installation-timestamp-get-error.js.map +0 -1
- package/dist/esm/utils/analytics/installation-timestamp.js.map +0 -1
- package/dist/esm/utils/analytics/user-identifier-interface.js.map +0 -1
- package/dist/esm/utils/analytics/user-identifier.js.map +0 -1
- package/dist/esm/utils/base_64_image/base-64-image-error.js.map +0 -1
- package/dist/esm/utils/base_64_image/base-64-image-string-error.js.map +0 -1
- package/dist/esm/utils/base_64_image/base-64-image.js.map +0 -1
- package/dist/esm/utils/base_64_image/sharp.js.map +0 -1
- package/dist/esm/utils/http/credentials.js.map +0 -1
- package/dist/esm/utils/http/custom-errors/authentication-http-client-error.js.map +0 -1
- package/dist/esm/utils/http/custom-errors/client-http-client-error.js.map +0 -1
- package/dist/esm/utils/http/custom-errors/general-http-client-error.js.map +0 -1
- package/dist/esm/utils/http/custom-errors/http-client-error.js.map +0 -1
- package/dist/esm/utils/http/custom-errors/index.js.map +0 -1
- package/dist/esm/utils/http/custom-errors/server-http-client-error.js.map +0 -1
- package/dist/esm/utils/http/custom-errors/unkown-http-client-error.js.map +0 -1
- package/dist/esm/utils/http/http-client-got.js.map +0 -1
- package/dist/esm/utils/http/index.js.map +0 -1
- package/dist/esm/utils/image-resize-errors/image-resizing-base-error.js.map +0 -1
- package/dist/esm/utils/image-resize-errors/index.js.map +0 -1
- package/dist/esm/utils/path.js.map +0 -1
- package/dist/esm/utils/proxy/proxy-builder.js.map +0 -1
- package/dist/esm/utils/resized-image-interface.js.map +0 -1
- package/dist/esm/utils/transformations.js.map +0 -1
- package/dist/example_projects_templates/configs/jasmine.config.json +0 -12
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AIElement } from './ai-element';
|
|
2
|
+
import { CustomElementJson } from '../model/custom-element-json';
|
|
3
|
+
export declare class AIElementCollection {
|
|
4
|
+
private elements;
|
|
5
|
+
static AI_ELEMENT_FOLDER: string;
|
|
6
|
+
constructor(elements: AIElement[]);
|
|
7
|
+
static collectForWorkspaceId(workspaceId: string | undefined): Promise<AIElementCollection>;
|
|
8
|
+
getByName(name: string): CustomElementJson[];
|
|
9
|
+
getByNames(names: string[]): CustomElementJson[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AIElementCollection = void 0;
|
|
16
|
+
const os_1 = __importDefault(require("os"));
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
19
|
+
const ai_element_1 = require("./ai-element");
|
|
20
|
+
const lib_1 = require("../../lib");
|
|
21
|
+
const ai_element_error_1 = require("./ai-element-error");
|
|
22
|
+
class AIElementCollection {
|
|
23
|
+
constructor(elements) {
|
|
24
|
+
this.elements = elements;
|
|
25
|
+
}
|
|
26
|
+
static collectForWorkspaceId(workspaceId) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
lib_1.logger.debug(`Collecting AIElements for workspace '${workspaceId}' ...`);
|
|
29
|
+
if (workspaceId === undefined) {
|
|
30
|
+
throw new ai_element_error_1.AIElementError("Value of 'workspaceId' must be defined.");
|
|
31
|
+
}
|
|
32
|
+
const workspaceAIElementFolder = path_1.default.join(AIElementCollection.AI_ELEMENT_FOLDER, workspaceId);
|
|
33
|
+
if (!(yield fs_extra_1.default.pathExists(workspaceAIElementFolder))) {
|
|
34
|
+
throw new ai_element_error_1.AIElementError(`Missing AIElement folder for workspace '${workspaceId}' at '${workspaceAIElementFolder}'.`);
|
|
35
|
+
}
|
|
36
|
+
const files = yield fs_extra_1.default.readdir(workspaceAIElementFolder);
|
|
37
|
+
if (files.length === 0) {
|
|
38
|
+
throw new ai_element_error_1.AIElementError(`'${workspaceAIElementFolder}' is empty. No AIElement files found for workspace '${workspaceId}'.`);
|
|
39
|
+
}
|
|
40
|
+
const aiElements = yield Promise.all(files
|
|
41
|
+
.filter((file) => path_1.default.extname(file) === '.json')
|
|
42
|
+
.map((file) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const jsonFile = path_1.default.join(workspaceAIElementFolder, file);
|
|
44
|
+
const baseName = path_1.default.basename(jsonFile, '.json');
|
|
45
|
+
const pngFile = path_1.default.join(workspaceAIElementFolder, `${baseName}.png`);
|
|
46
|
+
if (yield fs_extra_1.default.pathExists(pngFile)) {
|
|
47
|
+
const metadata = JSON.parse(yield fs_extra_1.default.readFile(jsonFile, 'utf-8'));
|
|
48
|
+
return ai_element_1.AIElement.fromJson(metadata, pngFile);
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
})));
|
|
52
|
+
const validAIElements = aiElements.filter((element) => element !== null);
|
|
53
|
+
if (validAIElements.length === 0) {
|
|
54
|
+
throw new ai_element_error_1.AIElementError(`No AIElement files found for workspace '${workspaceId}' at '${workspaceAIElementFolder}'.`);
|
|
55
|
+
}
|
|
56
|
+
return new AIElementCollection(validAIElements);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
getByName(name) {
|
|
60
|
+
if (name === '') {
|
|
61
|
+
throw new ai_element_error_1.AIElementError("Parameter 'name' must be non-empty. This might be due to corrupted metadata.");
|
|
62
|
+
}
|
|
63
|
+
lib_1.logger.debug(`Getting all CustomElementJson with the name '${name}' ...`);
|
|
64
|
+
const elements = this.elements.filter((element) => element.hasName(name));
|
|
65
|
+
if (elements.length === 0) {
|
|
66
|
+
throw new ai_element_error_1.AIElementError(`No AIElement with the name '${name}' was found.`);
|
|
67
|
+
}
|
|
68
|
+
return elements.map((element) => element.toCustomElement());
|
|
69
|
+
}
|
|
70
|
+
getByNames(names) {
|
|
71
|
+
if (names.length === 0) {
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
return names.flatMap((name) => this.getByName(name));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.AIElementCollection = AIElementCollection;
|
|
78
|
+
AIElementCollection.AI_ELEMENT_FOLDER = path_1.default.join(os_1.default.homedir(), '.askui', 'SnippingTool', 'AIElement');
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CustomElementJson } from '../model/custom-element-json';
|
|
2
|
+
interface AIElementJson {
|
|
3
|
+
version: number;
|
|
4
|
+
name: string;
|
|
5
|
+
image?: {
|
|
6
|
+
mask?: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
declare class AIElement {
|
|
13
|
+
name: string;
|
|
14
|
+
imagePath: string;
|
|
15
|
+
mask?: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}[] | undefined;
|
|
19
|
+
constructor(name: string, imagePath: string, mask?: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
}[] | undefined);
|
|
23
|
+
static fromJson(json: AIElementJson, imagePath: string): AIElement;
|
|
24
|
+
toCustomElement(): CustomElementJson;
|
|
25
|
+
hasName(name: string): boolean;
|
|
26
|
+
}
|
|
27
|
+
export { AIElement, AIElementJson };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AIElement = void 0;
|
|
4
|
+
const lib_1 = require("../../lib");
|
|
5
|
+
const ai_element_error_1 = require("./ai-element-error");
|
|
6
|
+
class AIElement {
|
|
7
|
+
constructor(name, imagePath, mask) {
|
|
8
|
+
this.name = name;
|
|
9
|
+
this.imagePath = imagePath;
|
|
10
|
+
this.mask = mask;
|
|
11
|
+
}
|
|
12
|
+
static fromJson(json, imagePath) {
|
|
13
|
+
var _a;
|
|
14
|
+
if (json.version === 1) {
|
|
15
|
+
return new AIElement(json.name, imagePath, (_a = json.image) === null || _a === void 0 ? void 0 : _a.mask);
|
|
16
|
+
}
|
|
17
|
+
throw new ai_element_error_1.AIElementError(`Unsupported AIElement version '${json.version}'.`);
|
|
18
|
+
}
|
|
19
|
+
toCustomElement() {
|
|
20
|
+
lib_1.logger.debug('Converting AIElement to CustomElementJson.');
|
|
21
|
+
return {
|
|
22
|
+
customImage: this.imagePath,
|
|
23
|
+
mask: this.mask,
|
|
24
|
+
name: this.name,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
hasName(name) {
|
|
28
|
+
return this.name === name;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.AIElement = AIElement;
|
|
@@ -8,6 +8,10 @@ export declare type ANDROID_KEY = 'home' | 'back' | 'call' | 'endcall' | '0' | '
|
|
|
8
8
|
export declare type MODIFIER_KEY = 'command' | 'alt' | 'control' | 'shift' | 'right_shift';
|
|
9
9
|
export declare type COLOR = 'black' | 'white' | 'red' | 'green' | 'yellow green' | 'orange' | 'yellow' | 'purple' | 'pink' | 'gray' | 'lime green' | 'royal blue';
|
|
10
10
|
export declare type PC_AND_MODIFIER_KEY = 'command' | 'alt' | 'control' | 'shift' | 'right_shift' | 'backspace' | 'delete' | 'enter' | 'tab' | 'escape' | 'up' | 'down' | 'right' | 'left' | 'home' | 'end' | 'pageup' | 'pagedown' | 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12' | 'space' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z' | '!' | '"' | '#' | '$' | '%' | '&' | "'" | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~ ';
|
|
11
|
+
export interface CommandExecutorContext {
|
|
12
|
+
customElementsJson: CustomElementJson[];
|
|
13
|
+
aiElementNames: string[];
|
|
14
|
+
}
|
|
11
15
|
declare abstract class FluentBase {
|
|
12
16
|
protected prev?: FluentBase | undefined;
|
|
13
17
|
constructor(prev?: FluentBase | undefined);
|
|
@@ -202,6 +206,14 @@ export declare class FluentFilters extends FluentBase {
|
|
|
202
206
|
* @return {FluentFiltersOrRelations}
|
|
203
207
|
*/
|
|
204
208
|
customElement(customElement: CustomElementJson): FluentFiltersOrRelations;
|
|
209
|
+
/**
|
|
210
|
+
* Detects an AI Element created with the workflow creator.
|
|
211
|
+
*
|
|
212
|
+
* @param {string} aiElementName - Name of the AI Element.
|
|
213
|
+
*
|
|
214
|
+
* @return {FluentFiltersOrRelations}
|
|
215
|
+
*/
|
|
216
|
+
aiElement(aiElementName: string): FluentFiltersOrRelations;
|
|
205
217
|
/**
|
|
206
218
|
* Filters for a UI element 'image'.
|
|
207
219
|
*
|
|
@@ -354,7 +366,17 @@ export declare class FluentFilters extends FluentBase {
|
|
|
354
366
|
*
|
|
355
367
|
* **Examples:**
|
|
356
368
|
* ```typescript
|
|
357
|
-
*
|
|
369
|
+
* // Select the black sneaker from a bunch of sneakers
|
|
370
|
+
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
371
|
+
*
|
|
372
|
+
* // Select an image that has text in it
|
|
373
|
+
* await aui.click().element().matching('has Burger King in it').exec();
|
|
374
|
+
* await aui.click().element().matching('has adidas in it').exec();
|
|
375
|
+
*
|
|
376
|
+
* // Target a logo/image by describing it
|
|
377
|
+
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
378
|
+
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
379
|
+
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
358
380
|
* ```
|
|
359
381
|
*
|
|
360
382
|
* @param {string} text - A description of the target element.
|
|
@@ -827,6 +849,14 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
827
849
|
* @return {FluentFiltersOrRelationsCondition}
|
|
828
850
|
*/
|
|
829
851
|
customElement(customElement: CustomElementJson): FluentFiltersOrRelationsCondition;
|
|
852
|
+
/**
|
|
853
|
+
* Detects an AI Element created with the workflow creator.
|
|
854
|
+
*
|
|
855
|
+
* @param {string} aiElementName - Name of the AI Element.
|
|
856
|
+
*
|
|
857
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
858
|
+
*/
|
|
859
|
+
aiElement(aiElementName: string): FluentFiltersOrRelationsCondition;
|
|
830
860
|
/**
|
|
831
861
|
* Filters for a UI element 'image'.
|
|
832
862
|
*
|
|
@@ -979,7 +1009,17 @@ export declare class FluentFiltersCondition extends FluentBase {
|
|
|
979
1009
|
*
|
|
980
1010
|
* **Examples:**
|
|
981
1011
|
* ```typescript
|
|
982
|
-
*
|
|
1012
|
+
* // Select the black sneaker from a bunch of sneakers
|
|
1013
|
+
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
1014
|
+
*
|
|
1015
|
+
* // Select an image that has text in it
|
|
1016
|
+
* await aui.click().element().matching('has Burger King in it').exec();
|
|
1017
|
+
* await aui.click().element().matching('has adidas in it').exec();
|
|
1018
|
+
*
|
|
1019
|
+
* // Target a logo/image by describing it
|
|
1020
|
+
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
1021
|
+
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
1022
|
+
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
983
1023
|
* ```
|
|
984
1024
|
*
|
|
985
1025
|
* @param {string} text - A description of the target element.
|
|
@@ -1770,7 +1810,7 @@ export declare abstract class FluentCommand extends FluentBase {
|
|
|
1770
1810
|
* @return {Exec}
|
|
1771
1811
|
*/
|
|
1772
1812
|
pressAndroidKey(key: ANDROID_KEY): Exec;
|
|
1773
|
-
abstract fluentCommandExecutor(instruction: string,
|
|
1813
|
+
abstract fluentCommandExecutor(instruction: string, context: CommandExecutorContext): Promise<void>;
|
|
1774
1814
|
}
|
|
1775
1815
|
export interface ExecutableGetter {
|
|
1776
1816
|
exec(): Promise<DetectedElement[]>;
|
|
@@ -1955,6 +1995,14 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
1955
1995
|
* @return {FluentFiltersOrRelationsGetter}
|
|
1956
1996
|
*/
|
|
1957
1997
|
customElement(customElement: CustomElementJson): FluentFiltersOrRelationsGetter;
|
|
1998
|
+
/**
|
|
1999
|
+
* Detects an AI Element created with the workflow creator.
|
|
2000
|
+
*
|
|
2001
|
+
* @param {string} aiElementName - Name of the AI Element.
|
|
2002
|
+
*
|
|
2003
|
+
* @return {FluentFiltersOrRelationsGetter}
|
|
2004
|
+
*/
|
|
2005
|
+
aiElement(aiElementName: string): FluentFiltersOrRelationsGetter;
|
|
1958
2006
|
/**
|
|
1959
2007
|
* Filters for a UI element 'image'.
|
|
1960
2008
|
*
|
|
@@ -2107,7 +2155,17 @@ export declare class FluentFiltersGetter extends FluentBase {
|
|
|
2107
2155
|
*
|
|
2108
2156
|
* **Examples:**
|
|
2109
2157
|
* ```typescript
|
|
2110
|
-
*
|
|
2158
|
+
* // Select the black sneaker from a bunch of sneakers
|
|
2159
|
+
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
2160
|
+
*
|
|
2161
|
+
* // Select an image that has text in it
|
|
2162
|
+
* await aui.click().element().matching('has Burger King in it').exec();
|
|
2163
|
+
* await aui.click().element().matching('has adidas in it').exec();
|
|
2164
|
+
*
|
|
2165
|
+
* // Target a logo/image by describing it
|
|
2166
|
+
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
2167
|
+
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
2168
|
+
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
2111
2169
|
* ```
|
|
2112
2170
|
*
|
|
2113
2171
|
* @param {string} text - A description of the target element.
|
|
@@ -2420,20 +2478,72 @@ export declare abstract class Getter extends FluentCommand {
|
|
|
2420
2478
|
* ```typescript
|
|
2421
2479
|
* const text = await aui.get().text('Sign').exec();
|
|
2422
2480
|
* console.log(text);
|
|
2481
|
+
*
|
|
2482
|
+
* // Console output
|
|
2483
|
+
* [
|
|
2484
|
+
* DetectedElement {
|
|
2485
|
+
* name: 'TEXT',
|
|
2486
|
+
* text: 'Sign In',
|
|
2487
|
+
* bndbox: BoundingBox {
|
|
2488
|
+
* xmin: 1128.2720982142857,
|
|
2489
|
+
* ymin: 160.21332310267857,
|
|
2490
|
+
* xmax: 1178.8204241071428,
|
|
2491
|
+
* ymax: 180.83512834821428
|
|
2492
|
+
* }
|
|
2493
|
+
* }
|
|
2494
|
+
* ]
|
|
2423
2495
|
* ```
|
|
2424
|
-
*
|
|
2425
|
-
*
|
|
2496
|
+
*
|
|
2497
|
+
* // *************************************************** //
|
|
2498
|
+
* // Examples on how to work with the returned elements //
|
|
2499
|
+
* // *************************************************** //
|
|
2500
|
+
* const texts = await aui.get().text().below().textfield().exec();
|
|
2501
|
+
*
|
|
2502
|
+
* // We can get a lot of elements this way
|
|
2503
|
+
* console.log(texts);
|
|
2504
|
+
*
|
|
2505
|
+
* // Console output
|
|
2506
|
+
* [
|
|
2426
2507
|
* DetectedElement {
|
|
2427
|
-
*
|
|
2428
|
-
*
|
|
2429
|
-
*
|
|
2430
|
-
*
|
|
2431
|
-
*
|
|
2432
|
-
*
|
|
2433
|
-
*
|
|
2434
|
-
*
|
|
2435
|
-
*
|
|
2436
|
-
*
|
|
2508
|
+
* name: 'TEXT',
|
|
2509
|
+
* text: 'Sign In',
|
|
2510
|
+
* bndbox: BoundingBox {
|
|
2511
|
+
* xmin: 1128.2720982142857,
|
|
2512
|
+
* ymin: 160.21332310267857,
|
|
2513
|
+
* xmax: 1178.8204241071428,
|
|
2514
|
+
* ymax: 180.83512834821428
|
|
2515
|
+
* },
|
|
2516
|
+
* },
|
|
2517
|
+
* DetectedElement {
|
|
2518
|
+
* name: 'TEXT',
|
|
2519
|
+
* text: 'Login',
|
|
2520
|
+
* bndbox: BoundingBox {
|
|
2521
|
+
* xmin: 250.8204241071428,
|
|
2522
|
+
* ymin: 300.21332310267857,
|
|
2523
|
+
* xmax: 450.6304241071428,
|
|
2524
|
+
* ymax: 950.47812834821428
|
|
2525
|
+
* },
|
|
2526
|
+
* },
|
|
2527
|
+
* ... 10 more items
|
|
2528
|
+
* ]
|
|
2529
|
+
*
|
|
2530
|
+
* // Extract the FIRST element
|
|
2531
|
+
* // Arrays start with index 0!
|
|
2532
|
+
* const firstTextElement = texts[0];
|
|
2533
|
+
* const textOfFirstElement = firstElement.text;
|
|
2534
|
+
*
|
|
2535
|
+
* console.log(textOfFirstElement);
|
|
2536
|
+
*
|
|
2537
|
+
* // Console output
|
|
2538
|
+
* Sign In
|
|
2539
|
+
*
|
|
2540
|
+
* // Log the text of the SECOND element
|
|
2541
|
+
* // with shorter code
|
|
2542
|
+
* const texts = await aui.get().text().below().textfield().exec();
|
|
2543
|
+
* console.log(texts[1].text)
|
|
2544
|
+
*
|
|
2545
|
+
* // Console output
|
|
2546
|
+
* Login
|
|
2437
2547
|
* ```
|
|
2438
2548
|
*
|
|
2439
2549
|
* @return {FluentFiltersGetter}
|
|
@@ -2479,7 +2589,7 @@ export declare abstract class Getter extends FluentCommand {
|
|
|
2479
2589
|
* @return {ExecGetter}
|
|
2480
2590
|
*/
|
|
2481
2591
|
getAll(): ExecGetter;
|
|
2482
|
-
abstract getterExecutor(instruction: string,
|
|
2592
|
+
abstract getterExecutor(instruction: string, context: CommandExecutorContext): Promise<DetectedElement[]>;
|
|
2483
2593
|
}
|
|
2484
2594
|
export declare abstract class ApiCommands extends Getter {
|
|
2485
2595
|
}
|
|
@@ -31,7 +31,11 @@ class FluentBase {
|
|
|
31
31
|
if (this instanceof FluentCommand) {
|
|
32
32
|
const fluentCommand = this;
|
|
33
33
|
const customElements = newParamsList.has('customElement') ? newParamsList.get('customElement') : [];
|
|
34
|
-
|
|
34
|
+
const aiElementNames = newParamsList.has('aiElementName') ? newParamsList.get('aiElementName') : [];
|
|
35
|
+
return fluentCommand.fluentCommandExecutor(newCurrentInstruction.trim(), {
|
|
36
|
+
customElementsJson: customElements,
|
|
37
|
+
aiElementNames,
|
|
38
|
+
});
|
|
35
39
|
}
|
|
36
40
|
if (!this.prev) {
|
|
37
41
|
throw new Error('Prev element not defined');
|
|
@@ -44,7 +48,11 @@ class FluentBase {
|
|
|
44
48
|
if (this instanceof Getter) {
|
|
45
49
|
const getter = this;
|
|
46
50
|
const customElements = newParamsList.has('customElement') ? newParamsList.get('customElement') : [];
|
|
47
|
-
|
|
51
|
+
const aiElementNames = newParamsList.has('aiElementName') ? newParamsList.get('aiElementName') : [];
|
|
52
|
+
return getter.getterExecutor(newCurrentInstruction.trim(), {
|
|
53
|
+
customElementsJson: customElements,
|
|
54
|
+
aiElementNames,
|
|
55
|
+
});
|
|
48
56
|
}
|
|
49
57
|
if (!this.prev) {
|
|
50
58
|
throw new Error('Prev element not defined');
|
|
@@ -307,6 +315,23 @@ class FluentFilters extends FluentBase {
|
|
|
307
315
|
this._params.set('customElement', customElement);
|
|
308
316
|
return new FluentFiltersOrRelations(this);
|
|
309
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* Detects an AI Element created with the workflow creator.
|
|
320
|
+
*
|
|
321
|
+
* @param {string} aiElementName - Name of the AI Element.
|
|
322
|
+
*
|
|
323
|
+
* @return {FluentFiltersOrRelations}
|
|
324
|
+
*/
|
|
325
|
+
aiElement(aiElementName) {
|
|
326
|
+
this._textStr = '';
|
|
327
|
+
this._textStr += 'ai';
|
|
328
|
+
this._textStr += ' element';
|
|
329
|
+
this._textStr += ' with';
|
|
330
|
+
this._textStr += ' name';
|
|
331
|
+
this._textStr += ` ${Separators.STRING}${aiElementName}${Separators.STRING}`;
|
|
332
|
+
this._params.set('aiElementName', aiElementName);
|
|
333
|
+
return new FluentFiltersOrRelations(this);
|
|
334
|
+
}
|
|
310
335
|
/**
|
|
311
336
|
* Filters for a UI element 'image'.
|
|
312
337
|
*
|
|
@@ -495,7 +520,17 @@ class FluentFilters extends FluentBase {
|
|
|
495
520
|
*
|
|
496
521
|
* **Examples:**
|
|
497
522
|
* ```typescript
|
|
498
|
-
*
|
|
523
|
+
* // Select the black sneaker from a bunch of sneakers
|
|
524
|
+
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
525
|
+
*
|
|
526
|
+
* // Select an image that has text in it
|
|
527
|
+
* await aui.click().element().matching('has Burger King in it').exec();
|
|
528
|
+
* await aui.click().element().matching('has adidas in it').exec();
|
|
529
|
+
*
|
|
530
|
+
* // Target a logo/image by describing it
|
|
531
|
+
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
532
|
+
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
533
|
+
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
499
534
|
* ```
|
|
500
535
|
*
|
|
501
536
|
* @param {string} text - A description of the target element.
|
|
@@ -1099,6 +1134,23 @@ class FluentFiltersCondition extends FluentBase {
|
|
|
1099
1134
|
this._params.set('customElement', customElement);
|
|
1100
1135
|
return new FluentFiltersOrRelationsCondition(this);
|
|
1101
1136
|
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Detects an AI Element created with the workflow creator.
|
|
1139
|
+
*
|
|
1140
|
+
* @param {string} aiElementName - Name of the AI Element.
|
|
1141
|
+
*
|
|
1142
|
+
* @return {FluentFiltersOrRelationsCondition}
|
|
1143
|
+
*/
|
|
1144
|
+
aiElement(aiElementName) {
|
|
1145
|
+
this._textStr = '';
|
|
1146
|
+
this._textStr += 'ai';
|
|
1147
|
+
this._textStr += ' element';
|
|
1148
|
+
this._textStr += ' with';
|
|
1149
|
+
this._textStr += ' name';
|
|
1150
|
+
this._textStr += ` ${Separators.STRING}${aiElementName}${Separators.STRING}`;
|
|
1151
|
+
this._params.set('aiElementName', aiElementName);
|
|
1152
|
+
return new FluentFiltersOrRelationsCondition(this);
|
|
1153
|
+
}
|
|
1102
1154
|
/**
|
|
1103
1155
|
* Filters for a UI element 'image'.
|
|
1104
1156
|
*
|
|
@@ -1287,7 +1339,17 @@ class FluentFiltersCondition extends FluentBase {
|
|
|
1287
1339
|
*
|
|
1288
1340
|
* **Examples:**
|
|
1289
1341
|
* ```typescript
|
|
1290
|
-
*
|
|
1342
|
+
* // Select the black sneaker from a bunch of sneakers
|
|
1343
|
+
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
1344
|
+
*
|
|
1345
|
+
* // Select an image that has text in it
|
|
1346
|
+
* await aui.click().element().matching('has Burger King in it').exec();
|
|
1347
|
+
* await aui.click().element().matching('has adidas in it').exec();
|
|
1348
|
+
*
|
|
1349
|
+
* // Target a logo/image by describing it
|
|
1350
|
+
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
1351
|
+
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
1352
|
+
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
1291
1353
|
* ```
|
|
1292
1354
|
*
|
|
1293
1355
|
* @param {string} text - A description of the target element.
|
|
@@ -2572,6 +2634,23 @@ class FluentFiltersGetter extends FluentBase {
|
|
|
2572
2634
|
this._params.set('customElement', customElement);
|
|
2573
2635
|
return new FluentFiltersOrRelationsGetter(this);
|
|
2574
2636
|
}
|
|
2637
|
+
/**
|
|
2638
|
+
* Detects an AI Element created with the workflow creator.
|
|
2639
|
+
*
|
|
2640
|
+
* @param {string} aiElementName - Name of the AI Element.
|
|
2641
|
+
*
|
|
2642
|
+
* @return {FluentFiltersOrRelationsGetter}
|
|
2643
|
+
*/
|
|
2644
|
+
aiElement(aiElementName) {
|
|
2645
|
+
this._textStr = '';
|
|
2646
|
+
this._textStr += 'ai';
|
|
2647
|
+
this._textStr += ' element';
|
|
2648
|
+
this._textStr += ' with';
|
|
2649
|
+
this._textStr += ' name';
|
|
2650
|
+
this._textStr += ` ${Separators.STRING}${aiElementName}${Separators.STRING}`;
|
|
2651
|
+
this._params.set('aiElementName', aiElementName);
|
|
2652
|
+
return new FluentFiltersOrRelationsGetter(this);
|
|
2653
|
+
}
|
|
2575
2654
|
/**
|
|
2576
2655
|
* Filters for a UI element 'image'.
|
|
2577
2656
|
*
|
|
@@ -2760,7 +2839,17 @@ class FluentFiltersGetter extends FluentBase {
|
|
|
2760
2839
|
*
|
|
2761
2840
|
* **Examples:**
|
|
2762
2841
|
* ```typescript
|
|
2763
|
-
*
|
|
2842
|
+
* // Select the black sneaker from a bunch of sneakers
|
|
2843
|
+
* await aui.click().element().matching('a black sneaker shoe').exec();
|
|
2844
|
+
*
|
|
2845
|
+
* // Select an image that has text in it
|
|
2846
|
+
* await aui.click().element().matching('has Burger King in it').exec();
|
|
2847
|
+
* await aui.click().element().matching('has adidas in it').exec();
|
|
2848
|
+
*
|
|
2849
|
+
* // Target a logo/image by describing it
|
|
2850
|
+
* await aui.click().element().matching('a mask on purple background and a firefox logo').exec();
|
|
2851
|
+
* await aui.click().element().matching('logo looking like an apple with one bite bitten off').exec();
|
|
2852
|
+
* await aui.click().element().matching('logo looking like a seashell').exec();
|
|
2764
2853
|
* ```
|
|
2765
2854
|
*
|
|
2766
2855
|
* @param {string} text - A description of the target element.
|
|
@@ -3135,20 +3224,72 @@ class Getter extends FluentCommand {
|
|
|
3135
3224
|
* ```typescript
|
|
3136
3225
|
* const text = await aui.get().text('Sign').exec();
|
|
3137
3226
|
* console.log(text);
|
|
3227
|
+
*
|
|
3228
|
+
* // Console output
|
|
3229
|
+
* [
|
|
3230
|
+
* DetectedElement {
|
|
3231
|
+
* name: 'TEXT',
|
|
3232
|
+
* text: 'Sign In',
|
|
3233
|
+
* bndbox: BoundingBox {
|
|
3234
|
+
* xmin: 1128.2720982142857,
|
|
3235
|
+
* ymin: 160.21332310267857,
|
|
3236
|
+
* xmax: 1178.8204241071428,
|
|
3237
|
+
* ymax: 180.83512834821428
|
|
3238
|
+
* }
|
|
3239
|
+
* }
|
|
3240
|
+
* ]
|
|
3138
3241
|
* ```
|
|
3139
|
-
*
|
|
3140
|
-
*
|
|
3242
|
+
*
|
|
3243
|
+
* // *************************************************** //
|
|
3244
|
+
* // Examples on how to work with the returned elements //
|
|
3245
|
+
* // *************************************************** //
|
|
3246
|
+
* const texts = await aui.get().text().below().textfield().exec();
|
|
3247
|
+
*
|
|
3248
|
+
* // We can get a lot of elements this way
|
|
3249
|
+
* console.log(texts);
|
|
3250
|
+
*
|
|
3251
|
+
* // Console output
|
|
3252
|
+
* [
|
|
3141
3253
|
* DetectedElement {
|
|
3142
|
-
*
|
|
3143
|
-
*
|
|
3144
|
-
*
|
|
3145
|
-
*
|
|
3146
|
-
*
|
|
3147
|
-
*
|
|
3148
|
-
*
|
|
3149
|
-
*
|
|
3150
|
-
*
|
|
3151
|
-
*
|
|
3254
|
+
* name: 'TEXT',
|
|
3255
|
+
* text: 'Sign In',
|
|
3256
|
+
* bndbox: BoundingBox {
|
|
3257
|
+
* xmin: 1128.2720982142857,
|
|
3258
|
+
* ymin: 160.21332310267857,
|
|
3259
|
+
* xmax: 1178.8204241071428,
|
|
3260
|
+
* ymax: 180.83512834821428
|
|
3261
|
+
* },
|
|
3262
|
+
* },
|
|
3263
|
+
* DetectedElement {
|
|
3264
|
+
* name: 'TEXT',
|
|
3265
|
+
* text: 'Login',
|
|
3266
|
+
* bndbox: BoundingBox {
|
|
3267
|
+
* xmin: 250.8204241071428,
|
|
3268
|
+
* ymin: 300.21332310267857,
|
|
3269
|
+
* xmax: 450.6304241071428,
|
|
3270
|
+
* ymax: 950.47812834821428
|
|
3271
|
+
* },
|
|
3272
|
+
* },
|
|
3273
|
+
* ... 10 more items
|
|
3274
|
+
* ]
|
|
3275
|
+
*
|
|
3276
|
+
* // Extract the FIRST element
|
|
3277
|
+
* // Arrays start with index 0!
|
|
3278
|
+
* const firstTextElement = texts[0];
|
|
3279
|
+
* const textOfFirstElement = firstElement.text;
|
|
3280
|
+
*
|
|
3281
|
+
* console.log(textOfFirstElement);
|
|
3282
|
+
*
|
|
3283
|
+
* // Console output
|
|
3284
|
+
* Sign In
|
|
3285
|
+
*
|
|
3286
|
+
* // Log the text of the SECOND element
|
|
3287
|
+
* // with shorter code
|
|
3288
|
+
* const texts = await aui.get().text().below().textfield().exec();
|
|
3289
|
+
* console.log(texts[1].text)
|
|
3290
|
+
*
|
|
3291
|
+
* // Console output
|
|
3292
|
+
* Login
|
|
3152
3293
|
* ```
|
|
3153
3294
|
*
|
|
3154
3295
|
* @return {FluentFiltersGetter}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './ui-control-client';
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports
|
|
4
|
-
var ui_control_client_1 = require("./ui-control-client");
|
|
5
|
-
Object.defineProperty(exports, "UiControlClient", { enumerable: true, get: function () { return ui_control_client_1.UiControlClient; } });
|
|
13
|
+
__exportStar(require("./ui-control-client"), exports);
|
|
@@ -8,6 +8,7 @@ export declare class UiControlClientDependencyBuilder {
|
|
|
8
8
|
static build(clientArgs: ClientArgsWithDefaults): Promise<{
|
|
9
9
|
executionRuntime: ExecutionRuntime;
|
|
10
10
|
stepReporter: StepReporter;
|
|
11
|
+
workspaceId: string | undefined;
|
|
11
12
|
}>;
|
|
12
13
|
static getClientArgsWithDefaults(clientArgs: ClientArgs): Promise<ClientArgsWithDefaults>;
|
|
13
14
|
}
|
|
@@ -43,13 +43,16 @@ class UiControlClientDependencyBuilder {
|
|
|
43
43
|
return new ui_controller_client_1.UiControllerClient(clientArgs.uiControllerUrl);
|
|
44
44
|
}
|
|
45
45
|
static build(clientArgs) {
|
|
46
|
+
var _a;
|
|
46
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
48
|
const uiControllerClient = UiControlClientDependencyBuilder.buildUiControllerClient(clientArgs);
|
|
48
49
|
const inferenceClient = yield UiControlClientDependencyBuilder.buildInferenceClient(clientArgs);
|
|
49
50
|
const stepReporter = new reporting_1.StepReporter(clientArgs.reporter);
|
|
51
|
+
const workspaceId = (_a = clientArgs.credentials) === null || _a === void 0 ? void 0 : _a.workspaceId;
|
|
50
52
|
return {
|
|
51
53
|
executionRuntime: new execution_runtime_1.ExecutionRuntime(uiControllerClient, inferenceClient, stepReporter),
|
|
52
54
|
stepReporter,
|
|
55
|
+
workspaceId,
|
|
53
56
|
};
|
|
54
57
|
});
|
|
55
58
|
}
|