UNPKG

raas-server

Version:
49 lines 2.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const raas_core_1 = require("raas-core"); class InstallableServerService { constructor(clientService) { this.installableServers = new Map(); this.clientService = clientService; } getInstallableServer(id) { return this.installableServers.get(id); } getInstallableServers() { return Array.from(this.installableServers.values()); } addInstallableServer(installableServer) { if (!this.installableServers.has(installableServer.id)) { this.installableServers.set(installableServer.id, installableServer); this.onInstallableServerAdded(installableServer); return true; } return false; } deleteInstallableServer(installableServer) { const deleted = this.installableServers.delete(installableServer.id); if (deleted) { this.onInstallableServerDeleted(installableServer); } return deleted; } updateInstallableServer(installableServer) { if (this.installableServers.has(installableServer.id)) { this.installableServers.set(installableServer.id, installableServer); this.onInstallableServerUpdated(installableServer); return true; } return false; } onInstallableServerAdded(installableServer) { this.clientService.notify(raas_core_1.Messages.Client.InstallableServerAddedNotification.type, installableServer); } onInstallableServerDeleted(installableServer) { this.clientService.notify(raas_core_1.Messages.Client.InstallableServerDeletedNotification.type, installableServer); } onInstallableServerUpdated(installableServer) { this.clientService.notify(raas_core_1.Messages.Client.InstallableServerUpdatedNotification.type, installableServer); } } exports.InstallableServerService = InstallableServerService; //# sourceMappingURL=installableServerService.js.map