1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.frontendOnlyApplicationModule = exports.bindMessageService = void 0;
|
19 | const inversify_1 = require("inversify");
|
20 | const common_1 = require("../common");
|
21 | const application_protocol_1 = require("../common/application-protocol");
|
22 | const env_variables_1 = require("./../common/env-variables");
|
23 | const frontend_application_bindings_1 = require("../browser/frontend-application-bindings");
|
24 | Object.defineProperty(exports, "bindMessageService", { enumerable: true, get: function () { return frontend_application_bindings_1.bindMessageService; } });
|
25 | const key_store_1 = require("../common/key-store");
|
26 | const quick_pick_service_1 = require("../common/quick-pick-service");
|
27 | const quick_input_1 = require("../browser/quick-input");
|
28 | const request_1 = require("@theia/request");
|
29 | const connection_status_service_1 = require("../browser/connection-status-service");
|
30 |
|
31 | exports.frontendOnlyApplicationModule = new inversify_1.ContainerModule((bind, unbind, isBound, rebind) => {
|
32 | if (isBound(common_1.CommandRegistry)) {
|
33 | rebind(common_1.CommandRegistry).toSelf().inSingletonScope();
|
34 | }
|
35 | else {
|
36 | bind(common_1.CommandRegistry).toSelf().inSingletonScope();
|
37 | }
|
38 | const stopwatch = {
|
39 | start: async (_name, _options) => -1,
|
40 | stop: async (_measurement, _message, _messageArgs) => { }
|
41 | };
|
42 | if (isBound(common_1.BackendStopwatch)) {
|
43 | rebind(common_1.BackendStopwatch).toConstantValue(stopwatch);
|
44 | }
|
45 | else {
|
46 | bind(common_1.BackendStopwatch).toConstantValue(stopwatch);
|
47 | }
|
48 | if (isBound(common_1.CommandRegistry)) {
|
49 | rebind(quick_pick_service_1.QuickPickService).to(quick_input_1.QuickPickServiceImpl).inSingletonScope();
|
50 | }
|
51 | else {
|
52 | bind(quick_pick_service_1.QuickPickService).to(quick_input_1.QuickPickServiceImpl).inSingletonScope();
|
53 | }
|
54 | const mockedApplicationServer = {
|
55 | getExtensionsInfos: async () => [],
|
56 | getApplicationInfo: async () => undefined,
|
57 | getApplicationRoot: async () => '',
|
58 | getBackendOS: async () => common_1.OS.Type.Linux
|
59 | };
|
60 | if (isBound(application_protocol_1.ApplicationServer)) {
|
61 | rebind(application_protocol_1.ApplicationServer).toConstantValue(mockedApplicationServer);
|
62 | }
|
63 | else {
|
64 | bind(application_protocol_1.ApplicationServer).toConstantValue(mockedApplicationServer);
|
65 | }
|
66 | const varServer = {
|
67 | getExecPath: async () => '',
|
68 | getVariables: async () => [],
|
69 | getValue: async (_key) => undefined,
|
70 | getConfigDirUri: async () => '',
|
71 | getHomeDirUri: async () => '',
|
72 | getDrives: async () => []
|
73 | };
|
74 | if (isBound(env_variables_1.EnvVariablesServer)) {
|
75 | rebind(env_variables_1.EnvVariablesServer).toConstantValue(varServer);
|
76 | }
|
77 | else {
|
78 | bind(env_variables_1.EnvVariablesServer).toConstantValue(varServer);
|
79 | }
|
80 | const keyStoreService = {
|
81 | deletePassword: () => Promise.resolve(false),
|
82 | findCredentials: () => Promise.resolve([]),
|
83 | findPassword: () => Promise.resolve(undefined),
|
84 | setPassword: () => Promise.resolve(),
|
85 | getPassword: () => Promise.resolve(undefined)
|
86 | };
|
87 | if (isBound(key_store_1.KeyStoreService)) {
|
88 | rebind(key_store_1.KeyStoreService).toConstantValue(keyStoreService);
|
89 | }
|
90 | else {
|
91 | bind(key_store_1.KeyStoreService).toConstantValue(keyStoreService);
|
92 | }
|
93 | const requestService = {
|
94 | configure: () => Promise.resolve(),
|
95 | request: () => Promise.reject(),
|
96 | resolveProxy: () => Promise.resolve(undefined)
|
97 | };
|
98 | if (isBound(request_1.BackendRequestService)) {
|
99 | rebind(request_1.BackendRequestService).toConstantValue(requestService);
|
100 | }
|
101 | else {
|
102 | bind(request_1.BackendRequestService).toConstantValue(requestService);
|
103 | }
|
104 | const connectionStatusService = {
|
105 | currentStatus: connection_status_service_1.ConnectionStatus.ONLINE,
|
106 | onStatusChange: new common_1.Emitter().event
|
107 | };
|
108 | if (isBound(connection_status_service_1.ConnectionStatusService)) {
|
109 | rebind(connection_status_service_1.ConnectionStatusService).toConstantValue(connectionStatusService);
|
110 | }
|
111 | else {
|
112 | bind(connection_status_service_1.ConnectionStatusService).toConstantValue(connectionStatusService);
|
113 | }
|
114 | });
|
115 |
|
\ | No newline at end of file |