askui 0.1.5 → 0.2.1
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 +6 -0
- package/bin/askui-postinstall +35 -0
- package/dist/cjs/core/model/test-case-dto/custom-element.d.ts +2 -2
- package/dist/cjs/core/model/test-case-dto/custom-element.js +2 -2
- package/dist/cjs/core/model/test-case-dto/custom-element.spec.js +7 -6
- 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 +6 -17
- package/dist/cjs/execution/dsl.js +4 -21
- package/dist/cjs/execution/execution-runtime.d.ts +7 -5
- package/dist/cjs/execution/execution-runtime.js +35 -23
- package/dist/cjs/execution/index.d.ts +2 -1
- package/dist/cjs/execution/index.js +5 -3
- package/dist/cjs/execution/{control-your-ui-api.d.ts → inference-client.d.ts} +4 -4
- package/dist/cjs/execution/{control-your-ui-api.js → inference-client.js} +9 -9
- package/dist/cjs/execution/ui-control-client-error.d.ts +2 -0
- package/dist/cjs/execution/ui-control-client-error.js +6 -0
- package/dist/cjs/execution/ui-control-client.d.ts +79 -0
- package/dist/cjs/execution/ui-control-client.js +185 -0
- package/dist/cjs/execution/{client-connection-state.d.ts → ui-controller-client-connection-state.d.ts} +1 -1
- package/dist/cjs/execution/ui-controller-client-connection-state.js +10 -0
- package/dist/cjs/execution/ui-controller-client-interface.d.ts +27 -0
- package/dist/cjs/execution/{client-interface.js → ui-controller-client-interface.js} +0 -0
- package/dist/cjs/execution/{control-your-ui-client.d.ts → ui-controller-client.d.ts} +6 -6
- package/dist/cjs/execution/{control-your-ui-client.js → ui-controller-client.js} +28 -28
- package/dist/cjs/lib/copy-example-project.js +2 -1
- package/dist/cjs/lib/download-binaries.js +10 -9
- package/dist/cjs/lib/index.d.ts +1 -1
- package/dist/cjs/lib/index.js +3 -3
- package/dist/cjs/lib/libfuse-error.d.ts +2 -0
- package/dist/cjs/lib/libfuse-error.js +6 -0
- package/dist/cjs/lib/logger.js +1 -1
- package/dist/cjs/lib/timeout-error.d.ts +0 -2
- package/dist/cjs/lib/timeout-error.js +0 -5
- package/dist/cjs/lib/ui-controller-args.d.ts +47 -0
- package/dist/cjs/lib/{control-ui-server-args.js → ui-controller-args.js} +0 -0
- package/dist/cjs/lib/{control-ui-server-args.spec.d.ts → ui-controller-args.spec.d.ts} +0 -0
- package/dist/cjs/lib/{control-ui-server-args.spec.js → ui-controller-args.spec.js} +7 -7
- package/dist/cjs/lib/ui-controller-darwin.d.ts +6 -0
- package/dist/cjs/lib/{control-ui-server-darwin.js → ui-controller-darwin.js} +8 -8
- package/dist/cjs/lib/ui-controller-facade.d.ts +17 -0
- package/dist/cjs/lib/{control-ui-server-facade.js → ui-controller-facade.js} +22 -16
- package/dist/cjs/lib/ui-controller-linux.d.ts +5 -0
- package/dist/cjs/lib/ui-controller-linux.js +52 -0
- package/dist/cjs/lib/ui-controller-win32.d.ts +3 -0
- package/dist/cjs/lib/ui-controller-win32.js +7 -0
- package/dist/cjs/lib/ui-controller.d.ts +8 -0
- package/dist/cjs/lib/{askui-control-server.js → ui-controller.js} +9 -9
- package/dist/cjs/lib/unkown-error.d.ts +0 -2
- package/dist/cjs/lib/unkown-error.js +0 -5
- package/dist/cjs/lib/wayland-error.d.ts +2 -0
- package/dist/cjs/lib/wayland-error.js +6 -0
- package/dist/cjs/main.d.ts +3 -2
- package/dist/cjs/main.js +6 -3
- package/dist/cjs/shared/index.d.ts +1 -0
- package/dist/cjs/shared/index.js +5 -0
- package/dist/cjs/utils/analytics/analytics-interface.d.ts +3 -0
- package/dist/cjs/utils/analytics/analytics-interface.js +2 -0
- package/dist/cjs/utils/analytics/analytics.d.ts +5 -0
- package/dist/cjs/utils/analytics/analytics.js +38 -0
- package/dist/cjs/utils/analytics/index.d.ts +1 -0
- package/dist/cjs/utils/analytics/index.js +5 -0
- 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/analytics/user-identifier-interface.d.ts +3 -0
- package/dist/cjs/utils/analytics/user-identifier-interface.js +2 -0
- package/dist/cjs/utils/analytics/user-identifier.d.ts +4 -0
- package/dist/cjs/utils/analytics/user-identifier.js +22 -0
- package/dist/cjs/utils/base_64_image/base-64-image-error.d.ts +2 -0
- package/dist/cjs/utils/base_64_image/base-64-image-error.js +6 -0
- package/dist/cjs/utils/base_64_image/base-64-image-string-error.d.ts +4 -0
- package/dist/cjs/utils/base_64_image/base-64-image-string-error.js +11 -0
- package/dist/cjs/utils/base_64_image/base-64-image.d.ts +18 -0
- package/dist/cjs/utils/base_64_image/base-64-image.js +86 -0
- package/dist/cjs/utils/http/custom-errors/http-client-error.d.ts +0 -2
- package/dist/cjs/utils/http/custom-errors/http-client-error.js +0 -5
- package/dist/cjs/utils/http/http-client-got.d.ts +6 -5
- package/dist/cjs/utils/http/http-client-got.js +11 -11
- package/dist/cjs/utils/image-resize-errors/image-resizing-base-error.d.ts +0 -2
- package/dist/cjs/utils/image-resize-errors/image-resizing-base-error.js +0 -5
- package/dist/cjs/utils/image-resize-errors/index.d.ts +0 -1
- package/dist/cjs/utils/image-resize-errors/index.js +1 -3
- package/dist/cjs/utils/path.d.ts +1 -0
- package/dist/cjs/utils/path.js +11 -0
- package/dist/cjs/utils/transformations.d.ts +0 -2
- package/dist/cjs/utils/transformations.js +11 -44
- package/dist/esm/core/model/test-case-dto/custom-element.d.ts +2 -2
- package/dist/esm/core/model/test-case-dto/custom-element.js +2 -2
- package/dist/esm/core/model/test-case-dto/custom-element.spec.js +7 -6
- 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 +6 -17
- package/dist/esm/execution/dsl.js +3 -21
- package/dist/esm/execution/execution-runtime.d.ts +7 -5
- package/dist/esm/execution/execution-runtime.js +35 -23
- package/dist/esm/execution/index.d.ts +2 -1
- package/dist/esm/execution/index.js +2 -1
- package/dist/esm/execution/{control-your-ui-api.d.ts → inference-client.d.ts} +4 -4
- package/dist/esm/execution/{control-your-ui-api.js → inference-client.js} +7 -7
- package/dist/esm/execution/ui-control-client-error.d.ts +2 -0
- package/dist/esm/execution/ui-control-client-error.js +2 -0
- package/dist/esm/execution/ui-control-client.d.ts +79 -0
- package/dist/esm/execution/ui-control-client.js +181 -0
- package/dist/esm/execution/{client-connection-state.d.ts → ui-controller-client-connection-state.d.ts} +1 -1
- package/dist/esm/execution/ui-controller-client-connection-state.js +7 -0
- package/dist/esm/execution/ui-controller-client-interface.d.ts +27 -0
- package/dist/esm/execution/{client-interface.js → ui-controller-client-interface.js} +0 -0
- package/dist/esm/execution/{control-your-ui-client.d.ts → ui-controller-client.d.ts} +6 -6
- package/dist/esm/execution/{control-your-ui-client.js → ui-controller-client.js} +26 -26
- package/dist/esm/lib/copy-example-project.js +2 -1
- package/dist/esm/lib/download-binaries.js +10 -9
- package/dist/esm/lib/index.d.ts +1 -1
- package/dist/esm/lib/index.js +1 -1
- package/dist/esm/lib/libfuse-error.d.ts +2 -0
- package/dist/esm/lib/libfuse-error.js +2 -0
- package/dist/esm/lib/logger.js +1 -1
- package/dist/esm/lib/timeout-error.d.ts +0 -2
- package/dist/esm/lib/timeout-error.js +0 -5
- package/dist/esm/lib/ui-controller-args.d.ts +47 -0
- package/dist/esm/lib/{control-ui-server-args.js → ui-controller-args.js} +0 -0
- package/dist/esm/lib/{control-ui-server-args.spec.d.ts → ui-controller-args.spec.d.ts} +0 -0
- package/dist/esm/lib/{control-ui-server-args.spec.js → ui-controller-args.spec.js} +1 -1
- package/dist/esm/lib/ui-controller-darwin.d.ts +6 -0
- package/dist/esm/lib/{control-ui-server-darwin.js → ui-controller-darwin.js} +6 -6
- package/dist/esm/lib/ui-controller-facade.d.ts +17 -0
- package/dist/esm/lib/{control-ui-server-facade.js → ui-controller-facade.js} +17 -11
- package/dist/esm/lib/ui-controller-linux.d.ts +5 -0
- package/dist/esm/lib/ui-controller-linux.js +48 -0
- package/dist/esm/lib/ui-controller-win32.d.ts +3 -0
- package/dist/esm/lib/ui-controller-win32.js +3 -0
- package/dist/esm/lib/ui-controller.d.ts +8 -0
- package/dist/esm/lib/{askui-control-server.js → ui-controller.js} +7 -7
- package/dist/esm/lib/unkown-error.d.ts +0 -2
- package/dist/esm/lib/unkown-error.js +0 -5
- package/dist/esm/lib/wayland-error.d.ts +2 -0
- package/dist/esm/lib/wayland-error.js +2 -0
- package/dist/esm/main.d.ts +3 -2
- package/dist/esm/main.js +3 -2
- package/dist/esm/shared/index.d.ts +1 -0
- package/dist/esm/shared/index.js +1 -0
- package/dist/esm/utils/analytics/analytics-interface.d.ts +3 -0
- package/dist/esm/utils/analytics/analytics-interface.js +1 -0
- package/dist/esm/utils/analytics/analytics.d.ts +5 -0
- package/dist/esm/utils/analytics/analytics.js +31 -0
- package/dist/esm/utils/analytics/index.d.ts +1 -0
- package/dist/esm/utils/analytics/index.js +1 -0
- 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/analytics/user-identifier-interface.d.ts +3 -0
- package/dist/esm/utils/analytics/user-identifier-interface.js +1 -0
- package/dist/esm/utils/analytics/user-identifier.d.ts +4 -0
- package/dist/esm/utils/analytics/user-identifier.js +18 -0
- package/dist/esm/utils/base_64_image/base-64-image-error.d.ts +2 -0
- package/dist/esm/utils/base_64_image/base-64-image-error.js +2 -0
- package/dist/esm/utils/base_64_image/base-64-image-string-error.d.ts +4 -0
- package/dist/esm/utils/base_64_image/base-64-image-string-error.js +7 -0
- package/dist/esm/utils/base_64_image/base-64-image.d.ts +18 -0
- package/dist/esm/utils/base_64_image/base-64-image.js +79 -0
- package/dist/esm/utils/http/custom-errors/http-client-error.d.ts +0 -2
- package/dist/esm/utils/http/custom-errors/http-client-error.js +0 -5
- package/dist/esm/utils/http/http-client-got.d.ts +6 -5
- package/dist/esm/utils/http/http-client-got.js +11 -11
- package/dist/esm/utils/image-resize-errors/image-resizing-base-error.d.ts +0 -2
- package/dist/esm/utils/image-resize-errors/image-resizing-base-error.js +0 -5
- package/dist/esm/utils/image-resize-errors/index.d.ts +0 -1
- package/dist/esm/utils/image-resize-errors/index.js +0 -1
- package/dist/esm/utils/path.d.ts +1 -0
- package/dist/esm/utils/path.js +4 -0
- package/dist/esm/utils/transformations.d.ts +0 -2
- package/dist/esm/utils/transformations.js +11 -39
- package/dist/example_projects_templates/typescript_jest/test/helper/jest.setup.ts +7 -7
- package/dist/example_projects_templates/typescript_jest/test/jest.config.ts +3 -0
- package/package.json +15 -8
- package/dist/cjs/execution/client-connection-state.js +0 -10
- package/dist/cjs/execution/client-error.d.ts +0 -2
- package/dist/cjs/execution/client-error.js +0 -6
- package/dist/cjs/execution/client-interface.d.ts +0 -13
- package/dist/cjs/execution/client.d.ts +0 -25
- package/dist/cjs/execution/client.js +0 -116
- package/dist/cjs/lib/askui-control-server.d.ts +0 -8
- package/dist/cjs/lib/control-ui-server-args.d.ts +0 -21
- package/dist/cjs/lib/control-ui-server-darwin.d.ts +0 -6
- package/dist/cjs/lib/control-ui-server-facade.d.ts +0 -16
- package/dist/cjs/lib/control-ui-server-linux.d.ts +0 -4
- package/dist/cjs/lib/control-ui-server-linux.js +0 -13
- package/dist/cjs/lib/control-ui-server-win32.d.ts +0 -3
- package/dist/cjs/lib/control-ui-server-win32.js +0 -7
- 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/execution/client-connection-state.js +0 -7
- package/dist/esm/execution/client-error.d.ts +0 -2
- package/dist/esm/execution/client-error.js +0 -2
- package/dist/esm/execution/client-interface.d.ts +0 -13
- package/dist/esm/execution/client.d.ts +0 -25
- package/dist/esm/execution/client.js +0 -112
- package/dist/esm/lib/askui-control-server.d.ts +0 -8
- package/dist/esm/lib/control-ui-server-args.d.ts +0 -21
- package/dist/esm/lib/control-ui-server-darwin.d.ts +0 -6
- package/dist/esm/lib/control-ui-server-facade.d.ts +0 -16
- package/dist/esm/lib/control-ui-server-linux.d.ts +0 -4
- package/dist/esm/lib/control-ui-server-linux.js +0 -9
- package/dist/esm/lib/control-ui-server-win32.d.ts +0 -3
- package/dist/esm/lib/control-ui-server-win32.js +0 -3
- 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
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const ui_controller_args_1 = require("./ui-controller-args");
|
|
4
4
|
describe('createCliFlagsFromArgs()', () => {
|
|
5
5
|
test('test createCliFlagsFromArgs should return -d 0 as default output', () => {
|
|
6
6
|
const expected = ['-d 0', '-p 6769', '--host 127.0.0.1', '-m ', '--log-level debug'];
|
|
7
|
-
const argsWithDefaults = (0,
|
|
8
|
-
const actual = (0,
|
|
7
|
+
const argsWithDefaults = (0, ui_controller_args_1.createArgsWithDefaults)();
|
|
8
|
+
const actual = (0, ui_controller_args_1.createCliFlagsFromArgs)(argsWithDefaults);
|
|
9
9
|
expect(actual).toStrictEqual(expected);
|
|
10
10
|
});
|
|
11
11
|
test('test createCliFlagsFromArgs output should include -d 0 when no display was selected', () => {
|
|
12
12
|
const expected = ['-d 0', '-p 6777', '--host 0.0.0.0', '-m ', '--log-level debug'];
|
|
13
|
-
const argsWithDefaults = (0,
|
|
14
|
-
const actual = (0,
|
|
13
|
+
const argsWithDefaults = (0, ui_controller_args_1.createArgsWithDefaults)({ port: 6777, host: '0.0.0.0' });
|
|
14
|
+
const actual = (0, ui_controller_args_1.createCliFlagsFromArgs)(argsWithDefaults);
|
|
15
15
|
expect(actual).toStrictEqual(expected);
|
|
16
16
|
});
|
|
17
17
|
test('test createCliFlagsFromArgs output should include the display that was selected ', () => {
|
|
18
18
|
const expected = ['-d 99', '-p 6777', '--host 0.0.0.0', '-m ', '--log-level debug'];
|
|
19
|
-
const argsWithDefaults = (0,
|
|
20
|
-
const actual = (0,
|
|
19
|
+
const argsWithDefaults = (0, ui_controller_args_1.createArgsWithDefaults)({ port: 6777, host: '0.0.0.0', display: 99 });
|
|
20
|
+
const actual = (0, ui_controller_args_1.createCliFlagsFromArgs)(argsWithDefaults);
|
|
21
21
|
expect(actual).toStrictEqual(expected);
|
|
22
22
|
});
|
|
23
23
|
});
|
|
@@ -3,18 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.UiControllerDarwin = void 0;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
-
const
|
|
10
|
+
const ui_controller_facade_1 = require("./ui-controller-facade");
|
|
11
11
|
const logger_1 = require("./logger");
|
|
12
|
-
class
|
|
12
|
+
class UiControllerDarwin extends ui_controller_facade_1.UiControllerFacade {
|
|
13
13
|
makeBinaryExecutable() {
|
|
14
14
|
this.makeDiskImageExecutable();
|
|
15
15
|
}
|
|
16
16
|
getStartingCommand() {
|
|
17
|
-
return
|
|
17
|
+
return `"${path_1.default.dirname(this.binaryPath)}/controlui-server.app/Contents/MacOS/controlui-server"`;
|
|
18
18
|
}
|
|
19
19
|
makeDiskImageExecutable() {
|
|
20
20
|
const mountPoint = '/Volumes/controlui-server.dmg';
|
|
@@ -24,15 +24,15 @@ class ControlUiServerDarwin extends control_ui_server_facade_1.ControlUiServerFa
|
|
|
24
24
|
'-quiet',
|
|
25
25
|
'-noautofsck',
|
|
26
26
|
'-noautoopen',
|
|
27
|
-
`-mountpoint ${mountPoint}`,
|
|
28
|
-
this.binaryPath
|
|
27
|
+
`-mountpoint "${mountPoint}"`,
|
|
28
|
+
`"${this.binaryPath}"`,
|
|
29
29
|
].join(' '));
|
|
30
30
|
const appBaseName = 'controlui-server.app';
|
|
31
31
|
const appSrcPath = `${mountPoint}/${appBaseName}`;
|
|
32
32
|
const appDestPath = `${path_1.default.dirname(this.binaryPath)}/${appBaseName}`;
|
|
33
33
|
fs_extra_1.default.removeSync(appDestPath);
|
|
34
34
|
fs_extra_1.default.copySync(appSrcPath, appDestPath);
|
|
35
|
-
(0, child_process_1.exec)(`hdiutil detach ${mountPoint}`, (_exception, stdout) => logger_1.logger.debug(stdout));
|
|
35
|
+
(0, child_process_1.exec)(`hdiutil detach "${mountPoint}"`, (_exception, stdout) => logger_1.logger.debug(stdout));
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
exports.
|
|
38
|
+
exports.UiControllerDarwin = UiControllerDarwin;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UiControllerArgs, UiControllerArgsWithDefaults } from './ui-controller-args';
|
|
2
|
+
export declare abstract class UiControllerFacade {
|
|
3
|
+
protected binaryPath: string;
|
|
4
|
+
protected serverLogFile: string;
|
|
5
|
+
protected readonly DefaultmaxWaitingForStartingInMs: number;
|
|
6
|
+
start(args?: UiControllerArgs, maxWaitingForStartingInSeconds?: number): Promise<void>;
|
|
7
|
+
stop(args?: UiControllerArgs, forceStop?: boolean): Promise<void>;
|
|
8
|
+
protected serverLogFilePath(args?: UiControllerArgsWithDefaults): UiControllerArgsWithDefaults;
|
|
9
|
+
protected killPort(port: number, forceStop?: boolean): Promise<void>;
|
|
10
|
+
protected getStartingCommand(): string;
|
|
11
|
+
protected makeBinaryExecutable(): void;
|
|
12
|
+
protected runPreStartChecks(): Promise<void>;
|
|
13
|
+
protected waitUntilStarted(args: UiControllerArgsWithDefaults, maxWaitingForStartingInSeconds?: number): Promise<void>;
|
|
14
|
+
private isBinaryValid;
|
|
15
|
+
private getBinary;
|
|
16
|
+
private startWithDefaults;
|
|
17
|
+
}
|
|
@@ -12,42 +12,43 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.UiControllerFacade = void 0;
|
|
16
16
|
const child_process_1 = require("child_process");
|
|
17
17
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
18
18
|
const wait_port_1 = __importDefault(require("wait-port"));
|
|
19
19
|
const fkill_1 = __importDefault(require("fkill"));
|
|
20
20
|
const os_1 = __importDefault(require("os"));
|
|
21
21
|
const path_1 = __importDefault(require("path"));
|
|
22
|
-
const
|
|
22
|
+
const ui_controller_args_1 = require("./ui-controller-args");
|
|
23
23
|
const download_binaries_1 = require("./download-binaries");
|
|
24
24
|
const logger_1 = require("./logger");
|
|
25
25
|
const timeout_error_1 = require("./timeout-error");
|
|
26
26
|
const unkown_error_1 = require("./unkown-error");
|
|
27
|
-
class
|
|
27
|
+
class UiControllerFacade {
|
|
28
28
|
constructor() {
|
|
29
29
|
this.binaryPath = (0, download_binaries_1.getBinaryPath)('latest');
|
|
30
30
|
this.DefaultmaxWaitingForStartingInMs = 30 * 1000;
|
|
31
31
|
}
|
|
32
32
|
start(args, maxWaitingForStartingInSeconds) {
|
|
33
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
|
|
34
|
+
yield this.runPreStartChecks();
|
|
35
|
+
const argsWithDefaults = (0, ui_controller_args_1.createArgsWithDefaults)(args);
|
|
35
36
|
const argsWithLogPath = this.serverLogFilePath(argsWithDefaults);
|
|
36
37
|
this.binaryPath = (0, download_binaries_1.getBinaryPath)(argsWithLogPath.binaryVersion);
|
|
37
38
|
yield this.getBinary(argsWithLogPath.binaryVersion, argsWithLogPath.overWriteBinary);
|
|
38
39
|
this.makeBinaryExecutable();
|
|
39
|
-
logger_1.logger.debug(`
|
|
40
|
+
logger_1.logger.debug(`UI Controller log path "${this.serverLogFile}"`);
|
|
40
41
|
yield this.startWithDefaults(argsWithLogPath, maxWaitingForStartingInSeconds);
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
stop(args, forceStop) {
|
|
44
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
46
|
try {
|
|
46
|
-
const argsWithDefaults = (0,
|
|
47
|
+
const argsWithDefaults = (0, ui_controller_args_1.createArgsWithDefaults)(args);
|
|
47
48
|
yield this.killPort(argsWithDefaults.port, forceStop);
|
|
48
49
|
}
|
|
49
50
|
catch (err) {
|
|
50
|
-
throw new Error(`An unknown error occured while closing of the
|
|
51
|
+
throw new Error(`An unknown error occured while closing of the UI Controller. Log file: "${this.serverLogFile}". ErrorReason: ${err}`);
|
|
51
52
|
}
|
|
52
53
|
});
|
|
53
54
|
}
|
|
@@ -57,7 +58,7 @@ class ControlUiServerFacade {
|
|
|
57
58
|
return args;
|
|
58
59
|
}
|
|
59
60
|
const tmpDir = fs_extra_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'askui'));
|
|
60
|
-
this.serverLogFile = path_1.default.join(tmpDir, 'askui-
|
|
61
|
+
this.serverLogFile = path_1.default.join(tmpDir, 'askui-ui-controller.log');
|
|
61
62
|
const argPath = { logFilePath: this.serverLogFile };
|
|
62
63
|
return Object.assign(argPath, args);
|
|
63
64
|
}
|
|
@@ -69,13 +70,17 @@ class ControlUiServerFacade {
|
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
getStartingCommand() {
|
|
72
|
-
return this.binaryPath
|
|
73
|
+
return `"${this.binaryPath}"`;
|
|
73
74
|
}
|
|
74
75
|
// eslint-disable-next-line class-methods-use-this
|
|
75
76
|
makeBinaryExecutable() {
|
|
76
77
|
/* Executable out of the box */
|
|
77
78
|
}
|
|
78
79
|
// eslint-disable-next-line class-methods-use-this
|
|
80
|
+
runPreStartChecks() {
|
|
81
|
+
return Promise.resolve();
|
|
82
|
+
}
|
|
83
|
+
// eslint-disable-next-line class-methods-use-this
|
|
79
84
|
waitUntilStarted(args, maxWaitingForStartingInSeconds) {
|
|
80
85
|
return new Promise((resolve, reject) => {
|
|
81
86
|
try {
|
|
@@ -95,7 +100,7 @@ class ControlUiServerFacade {
|
|
|
95
100
|
});
|
|
96
101
|
}
|
|
97
102
|
catch (err) {
|
|
98
|
-
reject(new unkown_error_1.UnkownError(`An unknown error occured while waiting for the
|
|
103
|
+
reject(new unkown_error_1.UnkownError(`An unknown error occured while waiting for the UI Controller: ${err}`));
|
|
99
104
|
}
|
|
100
105
|
});
|
|
101
106
|
}
|
|
@@ -107,25 +112,26 @@ class ControlUiServerFacade {
|
|
|
107
112
|
getBinary(binaryVersion, overWriteBinary = false) {
|
|
108
113
|
return __awaiter(this, void 0, void 0, function* () {
|
|
109
114
|
if (!fs_extra_1.default.existsSync(this.binaryPath) || overWriteBinary || !this.isBinaryValid()) {
|
|
110
|
-
logger_1.logger.debug(`Currently, no binary of the
|
|
115
|
+
logger_1.logger.debug(`Currently, no binary of the UI Controller is available at "${this.binaryPath}"`);
|
|
111
116
|
yield (0, download_binaries_1.downloadServerBinaries)(binaryVersion);
|
|
112
117
|
}
|
|
113
118
|
else {
|
|
114
|
-
logger_1.logger.debug(`Binary of
|
|
119
|
+
logger_1.logger.debug(`Binary of UI Controller is already present at "${this.binaryPath}".`);
|
|
115
120
|
}
|
|
116
121
|
});
|
|
117
122
|
}
|
|
118
123
|
startWithDefaults(args, maxWaitingForStartingInSeconds) {
|
|
119
124
|
return __awaiter(this, void 0, void 0, function* () {
|
|
120
125
|
try {
|
|
121
|
-
logger_1.logger.debug('Starting the
|
|
122
|
-
(0, child_process_1.spawn)(this.getStartingCommand(), (0,
|
|
126
|
+
logger_1.logger.debug('Starting the UI Controller...');
|
|
127
|
+
(0, child_process_1.spawn)(this.getStartingCommand(), (0, ui_controller_args_1.createCliFlagsFromArgs)(args), { shell: true });
|
|
123
128
|
yield this.waitUntilStarted(args, maxWaitingForStartingInSeconds);
|
|
124
129
|
}
|
|
125
130
|
catch (err) {
|
|
126
|
-
throw new Error(`The
|
|
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/askui-ui-controller-starting-problems`);
|
|
127
133
|
}
|
|
128
134
|
});
|
|
129
135
|
}
|
|
130
136
|
}
|
|
131
|
-
exports.
|
|
137
|
+
exports.UiControllerFacade = UiControllerFacade;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UiControllerLinux = void 0;
|
|
13
|
+
const child_process_1 = require("child_process");
|
|
14
|
+
const util_1 = require("util");
|
|
15
|
+
const ui_controller_facade_1 = require("./ui-controller-facade");
|
|
16
|
+
const logger_1 = require("./logger");
|
|
17
|
+
const wayland_error_1 = require("./wayland-error");
|
|
18
|
+
const libfuse_error_1 = require("./libfuse-error");
|
|
19
|
+
class UiControllerLinux extends ui_controller_facade_1.UiControllerFacade {
|
|
20
|
+
// eslint-disable-next-line class-methods-use-this
|
|
21
|
+
makeBinaryExecutable() {
|
|
22
|
+
(0, child_process_1.exec)(`chmod +x "${this.binaryPath}"`, (_exception, stdout) => logger_1.logger.debug(stdout));
|
|
23
|
+
}
|
|
24
|
+
// eslint-disable-next-line class-methods-use-this
|
|
25
|
+
runPreStartChecks() {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const runCommand = (0, util_1.promisify)(child_process_1.exec);
|
|
28
|
+
const waylandStatus = yield runCommand('echo $WAYLAND_DISPLAY');
|
|
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/askui-ui-controller#wayland');
|
|
31
|
+
}
|
|
32
|
+
/* First we want to check if the user is using a debian distribution.
|
|
33
|
+
* and in the following if libfuse2 is installed.
|
|
34
|
+
* With Ubunutu 22.04 libfuse2 is not installed per default.
|
|
35
|
+
* For more information: https://discourse.joplinapp.org/t/appimage-incompatibility-in-ubuntu-22-04/25173
|
|
36
|
+
*/
|
|
37
|
+
try {
|
|
38
|
+
yield runCommand('dpkg --version');
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
yield runCommand('dpkg -s libfuse2 | grep Status');
|
|
45
|
+
}
|
|
46
|
+
catch (_a) {
|
|
47
|
+
throw new libfuse_error_1.LibfuseError('Libfuse2 package is missing: https://docs.askui.com/docs/general/Troubleshooting/askui-ui-controller#libfuse2');
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.UiControllerLinux = UiControllerLinux;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UiControllerWin32 = void 0;
|
|
4
|
+
const ui_controller_facade_1 = require("./ui-controller-facade");
|
|
5
|
+
class UiControllerWin32 extends ui_controller_facade_1.UiControllerFacade {
|
|
6
|
+
}
|
|
7
|
+
exports.UiControllerWin32 = UiControllerWin32;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UiControllerArgs } from './ui-controller-args';
|
|
2
|
+
export declare class UiController {
|
|
3
|
+
private args?;
|
|
4
|
+
private server;
|
|
5
|
+
constructor(args?: UiControllerArgs | undefined);
|
|
6
|
+
start(timeoutInSeconds?: number): Promise<void>;
|
|
7
|
+
stop(forceStop?: boolean): Promise<void>;
|
|
8
|
+
}
|
|
@@ -9,23 +9,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
12
|
+
exports.UiController = void 0;
|
|
13
|
+
const ui_controller_darwin_1 = require("./ui-controller-darwin");
|
|
14
|
+
const ui_controller_linux_1 = require("./ui-controller-linux");
|
|
15
|
+
const ui_controller_win32_1 = require("./ui-controller-win32");
|
|
16
16
|
const download_binaries_1 = require("./download-binaries");
|
|
17
|
-
class
|
|
17
|
+
class UiController {
|
|
18
18
|
constructor(args) {
|
|
19
19
|
this.args = args;
|
|
20
20
|
switch ((0, download_binaries_1.platform)()) {
|
|
21
21
|
case 'darwin':
|
|
22
|
-
this.server = new
|
|
22
|
+
this.server = new ui_controller_darwin_1.UiControllerDarwin();
|
|
23
23
|
break;
|
|
24
24
|
case 'linux':
|
|
25
|
-
this.server = new
|
|
25
|
+
this.server = new ui_controller_linux_1.UiControllerLinux();
|
|
26
26
|
break;
|
|
27
27
|
case 'win32':
|
|
28
|
-
this.server = new
|
|
28
|
+
this.server = new ui_controller_win32_1.UiControllerWin32();
|
|
29
29
|
break;
|
|
30
30
|
default:
|
|
31
31
|
throw new Error(`Platform "${(0, download_binaries_1.platform)()}" not supported.`);
|
|
@@ -42,4 +42,4 @@ class AskuiControlServer {
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
exports.
|
|
45
|
+
exports.UiController = UiController;
|
|
@@ -2,10 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UnkownError = void 0;
|
|
4
4
|
class UnkownError extends Error {
|
|
5
|
-
constructor(message) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.contructorName = this.constructor.name;
|
|
8
|
-
this.name = this.contructorName;
|
|
9
|
-
}
|
|
10
5
|
}
|
|
11
6
|
exports.UnkownError = UnkownError;
|
package/dist/cjs/main.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { UiController } from './lib';
|
|
2
|
+
export { UiControlClient, AnnotationLevel } from './execution';
|
|
3
|
+
export { LogLevels } from './shared';
|
package/dist/cjs/main.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.LogLevels = exports.AnnotationLevel = exports.UiControlClient = exports.UiController = void 0;
|
|
4
4
|
var lib_1 = require("./lib");
|
|
5
|
-
Object.defineProperty(exports, "
|
|
5
|
+
Object.defineProperty(exports, "UiController", { enumerable: true, get: function () { return lib_1.UiController; } });
|
|
6
6
|
var execution_1 = require("./execution");
|
|
7
|
-
Object.defineProperty(exports, "
|
|
7
|
+
Object.defineProperty(exports, "UiControlClient", { enumerable: true, get: function () { return execution_1.UiControlClient; } });
|
|
8
|
+
Object.defineProperty(exports, "AnnotationLevel", { enumerable: true, get: function () { return execution_1.AnnotationLevel; } });
|
|
9
|
+
var shared_1 = require("./shared");
|
|
10
|
+
Object.defineProperty(exports, "LogLevels", { enumerable: true, get: function () { return shared_1.LogLevels; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LogLevels } from './log-levels';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogLevels = void 0;
|
|
4
|
+
var log_levels_1 = require("./log-levels");
|
|
5
|
+
Object.defineProperty(exports, "LogLevels", { enumerable: true, get: function () { return log_levels_1.LogLevels; } });
|
|
@@ -0,0 +1,38 @@
|
|
|
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.Analytics = void 0;
|
|
16
|
+
const os_1 = __importDefault(require("os"));
|
|
17
|
+
const user_identifier_1 = require("./user-identifier");
|
|
18
|
+
const installation_timestamp_1 = require("./installation-timestamp");
|
|
19
|
+
class Analytics {
|
|
20
|
+
constructor() {
|
|
21
|
+
this.userIdentifier = new user_identifier_1.UserIdentifier();
|
|
22
|
+
}
|
|
23
|
+
getAnalyticsHeaders() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const userID = yield this.userIdentifier.userId();
|
|
26
|
+
const headers = {
|
|
27
|
+
'askui-user-id': userID,
|
|
28
|
+
'askui-user-agent': `os:${os_1.default.platform()};arch:${os_1.default.arch()}`,
|
|
29
|
+
};
|
|
30
|
+
const askuiInstalledAt = yield installation_timestamp_1.InstallationTimestamp.get();
|
|
31
|
+
if (askuiInstalledAt) {
|
|
32
|
+
headers['askui-installed-at'] = askuiInstalledAt.toISOString();
|
|
33
|
+
}
|
|
34
|
+
return headers;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.Analytics = Analytics;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Analytics } from './analytics';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Analytics = void 0;
|
|
4
|
+
var analytics_1 = require("./analytics");
|
|
5
|
+
Object.defineProperty(exports, "Analytics", { enumerable: true, get: function () { return analytics_1.Analytics; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstallationTimestampCreateError = void 0;
|
|
4
|
+
class InstallationTimestampCreateError extends Error {
|
|
5
|
+
constructor(err) {
|
|
6
|
+
super(`Installation timestamp could not be created. \n${err.message}`);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.InstallationTimestampCreateError = InstallationTimestampCreateError;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstallationTimestampGetError = void 0;
|
|
4
|
+
class InstallationTimestampGetError extends Error {
|
|
5
|
+
constructor(err) {
|
|
6
|
+
super(`Installation timestamp does not exist. Try reinstalling the lib to create it. \n${err.message}`);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.InstallationTimestampGetError = InstallationTimestampGetError;
|
|
@@ -0,0 +1,68 @@
|
|
|
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.InstallationTimestamp = void 0;
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const lib_1 = require("../../lib");
|
|
19
|
+
const installation_timestamp_create_error_1 = require("./installation-timestamp-create-error");
|
|
20
|
+
const installation_timestamp_get_error_1 = require("./installation-timestamp-get-error");
|
|
21
|
+
const path_2 = require("../path");
|
|
22
|
+
class InstallationTimestamp {
|
|
23
|
+
static create() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const timestamp = new Date().toISOString();
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
fs_1.default.writeFile(InstallationTimestamp.fileName, timestamp, { encoding: 'utf-8' }, (err) => {
|
|
28
|
+
if (err) {
|
|
29
|
+
reject(new installation_timestamp_create_error_1.InstallationTimestampCreateError(err));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
resolve();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
static get() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (InstallationTimestamp.value === undefined) {
|
|
41
|
+
try {
|
|
42
|
+
InstallationTimestamp.value = yield this.getFromFile();
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
InstallationTimestamp.value = null;
|
|
46
|
+
lib_1.logger.warn(err.message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return InstallationTimestamp.value;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
static getFromFile() {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
fs_1.default.readFile(InstallationTimestamp.fileName, 'utf-8', (err, isoDateStr) => {
|
|
56
|
+
if (err) {
|
|
57
|
+
reject(new installation_timestamp_get_error_1.InstallationTimestampGetError(err));
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
resolve(new Date(isoDateStr));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.InstallationTimestamp = InstallationTimestamp;
|
|
68
|
+
InstallationTimestamp.fileName = path_1.default.join((0, path_2.getPathToNodeModulesRoot)(), 'install-timestamp');
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UserIdentifier = void 0;
|
|
13
|
+
const node_machine_id_1 = require("node-machine-id");
|
|
14
|
+
class UserIdentifier {
|
|
15
|
+
// eslint-disable-next-line class-methods-use-this
|
|
16
|
+
userId() {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
return (0, node_machine_id_1.machineId)();
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.UserIdentifier = UserIdentifier;
|