@eclipse-che/theia-remote-impl-che-server
Advanced tools
Comparing version 0.0.1-1613164234 to 0.0.1-1613557425
@@ -15,2 +15,4 @@ "use strict"; | ||
var core_1 = require("@theia/core"); | ||
var devfile_service_1 = require("@eclipse-che/theia-remote-api/lib/common/devfile-service"); | ||
var endpoint_service_1 = require("@eclipse-che/theia-remote-api/lib/common/endpoint-service"); | ||
var factory_service_1 = require("@eclipse-che/theia-remote-api/lib/common/factory-service"); | ||
@@ -24,2 +26,4 @@ var oauth_service_1 = require("@eclipse-che/theia-remote-api/lib/common/oauth-service"); | ||
var che_server_certificate_service_impl_1 = require("./che-server-certificate-service-impl"); | ||
var che_server_devfile_service_impl_1 = require("./che-server-devfile-service-impl"); | ||
var che_server_endpoint_service_impl_1 = require("./che-server-endpoint-service-impl"); | ||
var che_server_factory_service_impl_1 = require("./che-server-factory-service-impl"); | ||
@@ -34,2 +38,8 @@ var che_server_oauth_service_impl_1 = require("./che-server-oauth-service-impl"); | ||
exports.default = new inversify_1.ContainerModule(function (bind) { | ||
// do not do the che server binding if not within a dev workspace | ||
var devWorkspaceName = process.env['DEVWORKSPACE_NAME']; | ||
var cheServerBinding = process.env['REMOTE_API_USE_CHE_SERVER']; | ||
if (devWorkspaceName && !cheServerBinding) { | ||
return; | ||
} | ||
bind(che_server_remote_api_impl_1.CheServerRemoteApiImpl).toSelf().inSingletonScope(); | ||
@@ -43,2 +53,4 @@ bind(che_server_certificate_service_impl_1.CheServerCertificateServiceImpl).toSelf().inSingletonScope(); | ||
bind(che_server_workspace_service_impl_1.CheServerWorkspaceServiceImpl).toSelf().inSingletonScope(); | ||
bind(che_server_devfile_service_impl_1.CheServerDevfileServiceImpl).toSelf().inSingletonScope(); | ||
bind(che_server_endpoint_service_impl_1.CheServerEndpointServiceImpl).toSelf().inSingletonScope(); | ||
bind(che_server_k8s_service_impl_1.CheK8SServiceImpl).toSelf().inSingletonScope(); | ||
@@ -53,2 +65,4 @@ bind(certificate_service_1.CertificateService).to(che_server_certificate_service_impl_1.CheServerCertificateServiceImpl).inSingletonScope(); | ||
bind(k8s_service_1.CheK8SService).to(che_server_k8s_service_impl_1.CheK8SServiceImpl).inSingletonScope(); | ||
bind(devfile_service_1.DevfileService).to(che_server_devfile_service_impl_1.CheServerDevfileServiceImpl).inSingletonScope(); | ||
bind(endpoint_service_1.EndpointService).to(che_server_endpoint_service_impl_1.CheServerEndpointServiceImpl).inSingletonScope(); | ||
bind(core_1.ConnectionHandler) | ||
@@ -78,3 +92,9 @@ .toDynamicValue(function (ctx) { return new core_1.JsonRpcConnectionHandler(certificate_service_1.cheCertificateServicePath, function () { return ctx.container.get(certificate_service_1.CertificateService); }); }) | ||
.inSingletonScope(); | ||
bind(core_1.ConnectionHandler) | ||
.toDynamicValue(function (ctx) { return new core_1.JsonRpcConnectionHandler(devfile_service_1.cheDevfileServicePath, function () { return ctx.container.get(devfile_service_1.DevfileService); }); }) | ||
.inSingletonScope(); | ||
bind(core_1.ConnectionHandler) | ||
.toDynamicValue(function (ctx) { return new core_1.JsonRpcConnectionHandler(endpoint_service_1.cheEndpointServicePath, function () { return ctx.container.get(endpoint_service_1.EndpointService); }); }) | ||
.inSingletonScope(); | ||
}); | ||
//# sourceMappingURL=che-remote-impl-che-server-backend-module.js.map |
@@ -34,5 +34,3 @@ /********************************************************************** | ||
getContainerList(): Promise<Container[]>; | ||
findTerminalServer(): Promise<Endpoint | undefined>; | ||
findEditorContainer(): Promise<string | undefined>; | ||
} | ||
//# sourceMappingURL=che-server-workspace-service-impl.d.ts.map |
@@ -82,4 +82,2 @@ "use strict"; | ||
var che_server_remote_api_impl_1 = require("./che-server-remote-api-impl"); | ||
var TYPE = 'type'; | ||
var EDITOR_SERVER_TYPE = 'ide'; | ||
var CheServerWorkspaceServiceImpl = /** @class */ (function () { | ||
@@ -286,78 +284,2 @@ function CheServerWorkspaceServiceImpl() { | ||
}; | ||
CheServerWorkspaceServiceImpl.prototype.findTerminalServer = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var containers, containers_1, containers_1_1, container, servers, serverName, attrs, attrName; | ||
var e_6, _a; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, this.getContainerList()]; | ||
case 1: | ||
containers = _b.sent(); | ||
try { | ||
for (containers_1 = __values(containers), containers_1_1 = containers_1.next(); !containers_1_1.done; containers_1_1 = containers_1.next()) { | ||
container = containers_1_1.value; | ||
servers = container.servers || {}; | ||
for (serverName in servers) { | ||
if (!servers.hasOwnProperty(serverName)) { | ||
continue; | ||
} | ||
attrs = servers[serverName].attributes || {}; | ||
for (attrName in attrs) { | ||
if (attrName === TYPE && attrs[attrName] === 'terminal') { | ||
return [2 /*return*/, servers[serverName]]; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
catch (e_6_1) { e_6 = { error: e_6_1 }; } | ||
finally { | ||
try { | ||
if (containers_1_1 && !containers_1_1.done && (_a = containers_1.return)) _a.call(containers_1); | ||
} | ||
finally { if (e_6) throw e_6.error; } | ||
} | ||
return [2 /*return*/, undefined]; | ||
} | ||
}); | ||
}); | ||
}; | ||
CheServerWorkspaceServiceImpl.prototype.findEditorContainer = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var containers, containers_2, containers_2_1, container, servers, serverName, attrs, attrName; | ||
var e_7, _a; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, this.getContainerList()]; | ||
case 1: | ||
containers = _b.sent(); | ||
try { | ||
for (containers_2 = __values(containers), containers_2_1 = containers_2.next(); !containers_2_1.done; containers_2_1 = containers_2.next()) { | ||
container = containers_2_1.value; | ||
servers = container.servers || {}; | ||
for (serverName in servers) { | ||
if (!servers.hasOwnProperty(serverName)) { | ||
continue; | ||
} | ||
attrs = servers[serverName].attributes || {}; | ||
for (attrName in attrs) { | ||
if (attrName === TYPE && attrs[attrName] === EDITOR_SERVER_TYPE) { | ||
return [2 /*return*/, container.name]; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
catch (e_7_1) { e_7 = { error: e_7_1 }; } | ||
finally { | ||
try { | ||
if (containers_2_1 && !containers_2_1.done && (_a = containers_2.return)) _a.call(containers_2); | ||
} | ||
finally { if (e_7) throw e_7.error; } | ||
} | ||
return [2 /*return*/, undefined]; | ||
} | ||
}); | ||
}); | ||
}; | ||
__decorate([ | ||
@@ -364,0 +286,0 @@ inversify_1.inject(che_server_remote_api_impl_1.CheServerRemoteApiImpl), |
@@ -9,3 +9,3 @@ { | ||
}, | ||
"version": "0.0.1-1613164234", | ||
"version": "0.0.1-1613557425", | ||
"files": [ | ||
@@ -38,3 +38,25 @@ "lib", | ||
} | ||
] | ||
], | ||
"jest": { | ||
"testEnvironment": "node", | ||
"collectCoverage": true, | ||
"collectCoverageFrom": [ | ||
"src/**/*.ts" | ||
], | ||
"coverageDirectory": "./coverage", | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
"modulePathIgnorePatterns": [ | ||
"<rootDir>/dist" | ||
], | ||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"jsx", | ||
"json" | ||
] | ||
} | ||
} |
@@ -17,2 +17,4 @@ /********************************************************************** | ||
import { ConnectionHandler, JsonRpcConnectionHandler } from '@theia/core'; | ||
import { DevfileService, cheDevfileServicePath } from '@eclipse-che/theia-remote-api/lib/common/devfile-service'; | ||
import { EndpointService, cheEndpointServicePath } from '@eclipse-che/theia-remote-api/lib/common/endpoint-service'; | ||
import { FactoryService, cheFactoryServicePath } from '@eclipse-che/theia-remote-api/lib/common/factory-service'; | ||
@@ -27,2 +29,4 @@ import { OAuthService, cheOAuthServicePath } from '@eclipse-che/theia-remote-api/lib/common/oauth-service'; | ||
import { CheServerCertificateServiceImpl } from './che-server-certificate-service-impl'; | ||
import { CheServerDevfileServiceImpl } from './che-server-devfile-service-impl'; | ||
import { CheServerEndpointServiceImpl } from './che-server-endpoint-service-impl'; | ||
import { CheServerFactoryServiceImpl } from './che-server-factory-service-impl'; | ||
@@ -38,2 +42,9 @@ import { CheServerOAuthServiceImpl } from './che-server-oauth-service-impl'; | ||
export default new ContainerModule(bind => { | ||
// do not do the che server binding if not within a dev workspace | ||
const devWorkspaceName = process.env['DEVWORKSPACE_NAME']; | ||
const cheServerBinding = process.env['REMOTE_API_USE_CHE_SERVER']; | ||
if (devWorkspaceName && !cheServerBinding) { | ||
return; | ||
} | ||
bind(CheServerRemoteApiImpl).toSelf().inSingletonScope(); | ||
@@ -48,2 +59,4 @@ | ||
bind(CheServerWorkspaceServiceImpl).toSelf().inSingletonScope(); | ||
bind(CheServerDevfileServiceImpl).toSelf().inSingletonScope(); | ||
bind(CheServerEndpointServiceImpl).toSelf().inSingletonScope(); | ||
bind(CheK8SServiceImpl).toSelf().inSingletonScope(); | ||
@@ -59,2 +72,4 @@ | ||
bind(CheK8SService).to(CheK8SServiceImpl).inSingletonScope(); | ||
bind(DevfileService).to(CheServerDevfileServiceImpl).inSingletonScope(); | ||
bind(EndpointService).to(CheServerEndpointServiceImpl).inSingletonScope(); | ||
@@ -98,2 +113,12 @@ bind(ConnectionHandler) | ||
.inSingletonScope(); | ||
bind(ConnectionHandler) | ||
.toDynamicValue(ctx => new JsonRpcConnectionHandler(cheDevfileServicePath, () => ctx.container.get(DevfileService))) | ||
.inSingletonScope(); | ||
bind(ConnectionHandler) | ||
.toDynamicValue( | ||
ctx => new JsonRpcConnectionHandler(cheEndpointServicePath, () => ctx.container.get(EndpointService)) | ||
) | ||
.inSingletonScope(); | ||
}); |
@@ -22,5 +22,2 @@ /********************************************************************** | ||
const TYPE: string = 'type'; | ||
const EDITOR_SERVER_TYPE: string = 'ide'; | ||
@injectable() | ||
@@ -146,45 +143,2 @@ export class CheServerWorkspaceServiceImpl implements WorkspaceService { | ||
} | ||
public async findTerminalServer(): Promise<Endpoint | undefined> { | ||
const containers = await this.getContainerList(); | ||
for (const container of containers) { | ||
const servers = container.servers || {}; | ||
for (const serverName in servers) { | ||
if (!servers.hasOwnProperty(serverName)) { | ||
continue; | ||
} | ||
const attrs = servers[serverName].attributes || {}; | ||
for (const attrName in attrs) { | ||
if (attrName === TYPE && attrs[attrName] === 'terminal') { | ||
return servers[serverName]; | ||
} | ||
} | ||
} | ||
} | ||
return undefined; | ||
} | ||
public async findEditorContainer(): Promise<string | undefined> { | ||
const containers = await this.getContainerList(); | ||
for (const container of containers) { | ||
const servers = container.servers || {}; | ||
for (const serverName in servers) { | ||
if (!servers.hasOwnProperty(serverName)) { | ||
continue; | ||
} | ||
const attrs = servers[serverName].attributes || {}; | ||
for (const attrName in attrs) { | ||
if (attrName === TYPE && attrs[attrName] === EDITOR_SERVER_TYPE) { | ||
return container.name; | ||
} | ||
} | ||
} | ||
} | ||
return undefined; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
215465
66
3403
12