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.
Files changed (79) hide show
  1. package/README.md +2 -2
  2. package/bin/askui-postinstall +35 -0
  3. package/dist/cjs/core/model/test-case-dto/index.js +1 -3
  4. package/dist/cjs/core/model/test-case-dto/test-step.d.ts +3 -7
  5. package/dist/cjs/core/model/test-case-dto/test-step.js +0 -12
  6. package/dist/cjs/core/ui-control-commands/control-command.d.ts +1 -0
  7. package/dist/cjs/core/ui-control-commands/control-command.js +5 -0
  8. package/dist/cjs/core/ui-control-commands/input-event.d.ts +1 -2
  9. package/dist/cjs/core/ui-control-commands/input-event.js +0 -1
  10. package/dist/cjs/execution/dsl.d.ts +51 -1
  11. package/dist/cjs/execution/dsl.js +67 -10
  12. package/dist/cjs/execution/execution-runtime.d.ts +2 -0
  13. package/dist/cjs/execution/execution-runtime.js +27 -15
  14. package/dist/cjs/execution/inference-client.d.ts +1 -1
  15. package/dist/cjs/execution/inference-client.js +1 -1
  16. package/dist/cjs/execution/read-environment-credentials.js +4 -4
  17. package/dist/cjs/execution/read-environment-credentials.spec.js +2 -2
  18. package/dist/cjs/execution/ui-control-client.d.ts +46 -1
  19. package/dist/cjs/execution/ui-control-client.js +56 -6
  20. package/dist/cjs/execution/ui-controller-client-interface.d.ts +1 -1
  21. package/dist/cjs/lib/copy-example-project.js +2 -1
  22. package/dist/cjs/lib/download-binaries.js +2 -1
  23. package/dist/cjs/lib/ui-controller-facade.js +1 -1
  24. package/dist/cjs/lib/ui-controller-linux.js +2 -2
  25. package/dist/cjs/utils/analytics/analytics.js +7 -1
  26. package/dist/cjs/utils/analytics/installation-timestamp-create-error.d.ts +4 -0
  27. package/dist/cjs/utils/analytics/installation-timestamp-create-error.js +9 -0
  28. package/dist/cjs/utils/analytics/installation-timestamp-get-error.d.ts +4 -0
  29. package/dist/cjs/utils/analytics/installation-timestamp-get-error.js +9 -0
  30. package/dist/cjs/utils/analytics/installation-timestamp.d.ts +7 -0
  31. package/dist/cjs/utils/analytics/installation-timestamp.js +68 -0
  32. package/dist/cjs/utils/http/credentials.d.ts +1 -1
  33. package/dist/cjs/utils/http/credentials.js +1 -1
  34. package/dist/cjs/utils/http/credentials.spec.js +2 -2
  35. package/dist/cjs/utils/path.d.ts +1 -0
  36. package/dist/cjs/utils/path.js +11 -0
  37. package/dist/esm/core/model/test-case-dto/index.js +0 -1
  38. package/dist/esm/core/model/test-case-dto/test-step.d.ts +3 -7
  39. package/dist/esm/core/model/test-case-dto/test-step.js +1 -10
  40. package/dist/esm/core/ui-control-commands/control-command.d.ts +1 -0
  41. package/dist/esm/core/ui-control-commands/control-command.js +5 -0
  42. package/dist/esm/core/ui-control-commands/input-event.d.ts +1 -2
  43. package/dist/esm/core/ui-control-commands/input-event.js +0 -1
  44. package/dist/esm/execution/dsl.d.ts +51 -1
  45. package/dist/esm/execution/dsl.js +67 -10
  46. package/dist/esm/execution/execution-runtime.d.ts +2 -0
  47. package/dist/esm/execution/execution-runtime.js +27 -15
  48. package/dist/esm/execution/inference-client.d.ts +1 -1
  49. package/dist/esm/execution/inference-client.js +1 -1
  50. package/dist/esm/execution/read-environment-credentials.js +4 -4
  51. package/dist/esm/execution/read-environment-credentials.spec.js +2 -2
  52. package/dist/esm/execution/ui-control-client.d.ts +46 -1
  53. package/dist/esm/execution/ui-control-client.js +57 -7
  54. package/dist/esm/execution/ui-controller-client-interface.d.ts +1 -1
  55. package/dist/esm/lib/copy-example-project.js +2 -1
  56. package/dist/esm/lib/download-binaries.js +2 -1
  57. package/dist/esm/lib/ui-controller-facade.js +1 -1
  58. package/dist/esm/lib/ui-controller-linux.js +2 -2
  59. package/dist/esm/utils/analytics/analytics.js +7 -1
  60. package/dist/esm/utils/analytics/installation-timestamp-create-error.d.ts +4 -0
  61. package/dist/esm/utils/analytics/installation-timestamp-create-error.js +5 -0
  62. package/dist/esm/utils/analytics/installation-timestamp-get-error.d.ts +4 -0
  63. package/dist/esm/utils/analytics/installation-timestamp-get-error.js +5 -0
  64. package/dist/esm/utils/analytics/installation-timestamp.d.ts +7 -0
  65. package/dist/esm/utils/analytics/installation-timestamp.js +61 -0
  66. package/dist/esm/utils/http/credentials.d.ts +1 -1
  67. package/dist/esm/utils/http/credentials.js +1 -1
  68. package/dist/esm/utils/http/credentials.spec.js +2 -2
  69. package/dist/esm/utils/path.d.ts +1 -0
  70. package/dist/esm/utils/path.js +4 -0
  71. package/package.json +12 -4
  72. package/dist/cjs/utils/base_64_image/base-64-image-path-error.d.ts +0 -4
  73. package/dist/cjs/utils/base_64_image/base-64-image-path-error.js +0 -11
  74. package/dist/cjs/utils/image-resize-errors/invalid-base64-image-error.d.ts +0 -3
  75. package/dist/cjs/utils/image-resize-errors/invalid-base64-image-error.js +0 -7
  76. package/dist/esm/utils/base_64_image/base-64-image-path-error.d.ts +0 -4
  77. package/dist/esm/utils/base_64_image/base-64-image-path-error.js +0 -7
  78. package/dist/esm/utils/image-resize-errors/invalid-base64-image-error.d.ts +0 -3
  79. 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');
@@ -1,5 +1,5 @@
1
1
  export interface CredentialArgs {
2
- tenant: string;
2
+ workspaceId: string;
3
3
  email: string;
4
4
  token: string;
5
5
  }
@@ -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.tenant}|${this.credentials.email}`;
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({ tenant: 'tenant', email: 'name@tenant.com', token: 'password' });
6
- expect(credentials.base64Encoded).toBe('dGVuYW50fG5hbWVAdGVuYW50LmNvbTpwYXNzd29yZA==');
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;
@@ -0,0 +1,4 @@
1
+ import path from 'path';
2
+ export function getPathToNodeModulesRoot() {
3
+ return path.join(__dirname, '..', '..');
4
+ }
package/package.json CHANGED
@@ -1,16 +1,20 @@
1
1
  {
2
2
  "name": "askui",
3
- "version": "0.2.0",
3
+ "version": "0.2.3",
4
4
  "main": "./dist/cjs/main.js",
5
5
  "module": "./dist/esm/main.js",
6
- "bin": "bin/askui",
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,4 +0,0 @@
1
- import { Base64ImageError } from "./base-64-image-error";
2
- export declare class Base64ImagePathError extends Base64ImageError {
3
- constructor(path: string);
4
- }
@@ -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,3 +0,0 @@
1
- import { ImageResizingError } from './image-resizing-base-error';
2
- export declare class InvalidBase64Image extends ImageResizingError {
3
- }
@@ -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;
@@ -1,4 +0,0 @@
1
- import { Base64ImageError } from "./base-64-image-error";
2
- export declare class Base64ImagePathError extends Base64ImageError {
3
- constructor(path: string);
4
- }
@@ -1,7 +0,0 @@
1
- import { Base64ImageError } from "./base-64-image-error";
2
- export class Base64ImagePathError extends Base64ImageError {
3
- constructor(path) {
4
- super(`Can't create Base64Image instance from path:\n${path}\n\n` +
5
- `No image exists at path.`);
6
- }
7
- }
@@ -1,3 +0,0 @@
1
- import { ImageResizingError } from './image-resizing-base-error';
2
- export declare class InvalidBase64Image extends ImageResizingError {
3
- }
@@ -1,3 +0,0 @@
1
- import { ImageResizingError } from './image-resizing-base-error';
2
- export class InvalidBase64Image extends ImageResizingError {
3
- }