askui 0.2.0 → 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/bin/askui-postinstall +35 -0
- package/dist/cjs/core/model/test-case-dto/index.js +1 -3
- package/dist/cjs/core/model/test-case-dto/test-step.d.ts +3 -7
- package/dist/cjs/core/model/test-case-dto/test-step.js +0 -12
- package/dist/cjs/core/ui-control-commands/control-command.d.ts +1 -0
- package/dist/cjs/core/ui-control-commands/control-command.js +5 -0
- package/dist/cjs/core/ui-control-commands/input-event.d.ts +1 -2
- package/dist/cjs/core/ui-control-commands/input-event.js +0 -1
- package/dist/cjs/execution/dsl.d.ts +51 -1
- package/dist/cjs/execution/dsl.js +67 -10
- package/dist/cjs/execution/execution-runtime.d.ts +2 -0
- package/dist/cjs/execution/execution-runtime.js +27 -15
- package/dist/cjs/execution/inference-client.d.ts +1 -1
- package/dist/cjs/execution/inference-client.js +1 -1
- 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.d.ts +46 -1
- package/dist/cjs/execution/ui-control-client.js +56 -6
- package/dist/cjs/execution/ui-controller-client-interface.d.ts +1 -1
- package/dist/cjs/lib/copy-example-project.js +2 -1
- package/dist/cjs/lib/download-binaries.js +2 -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/analytics/analytics.js +7 -1
- package/dist/cjs/utils/analytics/installation-timestamp-create-error.d.ts +4 -0
- package/dist/cjs/utils/analytics/installation-timestamp-create-error.js +9 -0
- package/dist/cjs/utils/analytics/installation-timestamp-get-error.d.ts +4 -0
- package/dist/cjs/utils/analytics/installation-timestamp-get-error.js +9 -0
- package/dist/cjs/utils/analytics/installation-timestamp.d.ts +7 -0
- package/dist/cjs/utils/analytics/installation-timestamp.js +68 -0
- 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/cjs/utils/path.d.ts +1 -0
- package/dist/cjs/utils/path.js +11 -0
- package/dist/esm/core/model/test-case-dto/index.js +0 -1
- package/dist/esm/core/model/test-case-dto/test-step.d.ts +3 -7
- package/dist/esm/core/model/test-case-dto/test-step.js +1 -10
- package/dist/esm/core/ui-control-commands/control-command.d.ts +1 -0
- package/dist/esm/core/ui-control-commands/control-command.js +5 -0
- package/dist/esm/core/ui-control-commands/input-event.d.ts +1 -2
- package/dist/esm/core/ui-control-commands/input-event.js +0 -1
- package/dist/esm/execution/dsl.d.ts +51 -1
- package/dist/esm/execution/dsl.js +67 -10
- package/dist/esm/execution/execution-runtime.d.ts +2 -0
- package/dist/esm/execution/execution-runtime.js +27 -15
- package/dist/esm/execution/inference-client.d.ts +1 -1
- package/dist/esm/execution/inference-client.js +1 -1
- 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.d.ts +46 -1
- package/dist/esm/execution/ui-control-client.js +57 -7
- package/dist/esm/execution/ui-controller-client-interface.d.ts +1 -1
- package/dist/esm/lib/copy-example-project.js +2 -1
- package/dist/esm/lib/download-binaries.js +2 -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/analytics/analytics.js +7 -1
- package/dist/esm/utils/analytics/installation-timestamp-create-error.d.ts +4 -0
- package/dist/esm/utils/analytics/installation-timestamp-create-error.js +5 -0
- package/dist/esm/utils/analytics/installation-timestamp-get-error.d.ts +4 -0
- package/dist/esm/utils/analytics/installation-timestamp-get-error.js +5 -0
- package/dist/esm/utils/analytics/installation-timestamp.d.ts +7 -0
- package/dist/esm/utils/analytics/installation-timestamp.js +61 -0
- 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/dist/esm/utils/path.d.ts +1 -0
- package/dist/esm/utils/path.js +4 -0
- package/package.json +12 -4
- package/dist/cjs/utils/base_64_image/base-64-image-path-error.d.ts +0 -4
- package/dist/cjs/utils/base_64_image/base-64-image-path-error.js +0 -11
- package/dist/cjs/utils/image-resize-errors/invalid-base64-image-error.d.ts +0 -3
- package/dist/cjs/utils/image-resize-errors/invalid-base64-image-error.js +0 -7
- package/dist/esm/utils/base_64_image/base-64-image-path-error.d.ts +0 -4
- package/dist/esm/utils/base_64_image/base-64-image-path-error.js +0 -7
- package/dist/esm/utils/image-resize-errors/invalid-base64-image-error.d.ts +0 -3
- package/dist/esm/utils/image-resize-errors/invalid-base64-image-error.js +0 -3
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import fs from 'fs';
|
|
11
|
+
import path from 'path';
|
|
12
|
+
import { logger } from '../../lib';
|
|
13
|
+
import { InstallationTimestampCreateError } from './installation-timestamp-create-error';
|
|
14
|
+
import { InstallationTimestampGetError } from './installation-timestamp-get-error';
|
|
15
|
+
import { getPathToNodeModulesRoot } from '../path';
|
|
16
|
+
export class InstallationTimestamp {
|
|
17
|
+
static create() {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const timestamp = new Date().toISOString();
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
fs.writeFile(InstallationTimestamp.fileName, timestamp, { encoding: 'utf-8' }, (err) => {
|
|
22
|
+
if (err) {
|
|
23
|
+
reject(new InstallationTimestampCreateError(err));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
resolve();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
static get() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
if (InstallationTimestamp.value === undefined) {
|
|
35
|
+
try {
|
|
36
|
+
InstallationTimestamp.value = yield this.getFromFile();
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
InstallationTimestamp.value = null;
|
|
40
|
+
logger.warn(err.message);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return InstallationTimestamp.value;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
static getFromFile() {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
fs.readFile(InstallationTimestamp.fileName, 'utf-8', (err, isoDateStr) => {
|
|
50
|
+
if (err) {
|
|
51
|
+
reject(new InstallationTimestampGetError(err));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
resolve(new Date(isoDateStr));
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
InstallationTimestamp.fileName = path.join(getPathToNodeModulesRoot(), 'install-timestamp');
|
|
@@ -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
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getPathToNodeModulesRoot(): string;
|
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
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
|
-
"bin":
|
|
6
|
+
"bin": {
|
|
7
|
+
"askui": "bin/askui",
|
|
8
|
+
"askui-postinstall": "bin/askui-postinstall"
|
|
9
|
+
},
|
|
7
10
|
"scripts": {
|
|
8
11
|
"build": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && npm run copyTemplate && npm run copyExampleProject",
|
|
9
12
|
"copyTemplate": "shx cp -r src/core/annotation/template.html dist/cjs/core/annotation/ && shx cp -r src/core/annotation/template.html dist/esm/core/annotation/",
|
|
10
13
|
"copyExampleProject": "shx cp -r example_projects_templates/ dist/ && shx cp -r bin/* dist/",
|
|
11
14
|
"lint": "eslint --cache --fix --max-warnings 0 \"./**/*.{js,ts}\"",
|
|
12
15
|
"lint:staged": "lint-staged",
|
|
13
|
-
"test": "jest '/src'"
|
|
16
|
+
"test": "jest '/src'",
|
|
17
|
+
"postinstall": "node -e \"require('./bin/askui-postinstall')\""
|
|
14
18
|
},
|
|
15
19
|
"files": [
|
|
16
20
|
"dist/cjs/",
|
|
@@ -18,6 +22,10 @@
|
|
|
18
22
|
"dist/bin/",
|
|
19
23
|
"dist/example_projects_templates/"
|
|
20
24
|
],
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/askui/askui.git"
|
|
28
|
+
},
|
|
21
29
|
"dependencies": {
|
|
22
30
|
"commander": "~8.3.0",
|
|
23
31
|
"fkill": "~7.2.1",
|
|
@@ -51,4 +59,4 @@
|
|
|
51
59
|
"lint-staged": {
|
|
52
60
|
"./**/*.{js,ts}": "eslint --cache --fix --max-warnings 0"
|
|
53
61
|
}
|
|
54
|
-
}
|
|
62
|
+
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Base64ImagePathError = void 0;
|
|
4
|
-
const base_64_image_error_1 = require("./base-64-image-error");
|
|
5
|
-
class Base64ImagePathError extends base_64_image_error_1.Base64ImageError {
|
|
6
|
-
constructor(path) {
|
|
7
|
-
super(`Can't create Base64Image instance from path:\n${path}\n\n` +
|
|
8
|
-
`No image exists at path.`);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.Base64ImagePathError = Base64ImagePathError;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvalidBase64Image = void 0;
|
|
4
|
-
const image_resizing_base_error_1 = require("./image-resizing-base-error");
|
|
5
|
-
class InvalidBase64Image extends image_resizing_base_error_1.ImageResizingError {
|
|
6
|
-
}
|
|
7
|
-
exports.InvalidBase64Image = InvalidBase64Image;
|