UNPKG

homebridge-config-ui-x

Version:

A web based management, configuration and control platform for Homebridge.

67 lines 3.01 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; import { Inject, UseGuards } from '@nestjs/common'; import { SubscribeMessage, WebSocketGateway, WsException } from '@nestjs/websockets'; import { WsGuard } from '../../core/auth/guards/ws.guard.js'; import { devServerCorsConfig } from '../../core/cors.config.js'; import { AccessoriesService } from './accessories.service.js'; let AccessoriesGateway = class AccessoriesGateway { accessoriesService; constructor(accessoriesService) { this.accessoriesService = accessoriesService; } connect(client, payload) { this.accessoriesService.connect(client); } async getAccessoryLayout(client, payload) { return await this.accessoriesService.getAccessoryLayout(payload.user); } async saveAccessoryLayout(client, payload) { try { return await this.accessoriesService.saveAccessoryLayout(payload.user, payload.layout); } catch (e) { return new WsException(e); } } }; __decorate([ SubscribeMessage('get-accessories'), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, Object]), __metadata("design:returntype", void 0) ], AccessoriesGateway.prototype, "connect", null); __decorate([ SubscribeMessage('get-layout'), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, Object]), __metadata("design:returntype", Promise) ], AccessoriesGateway.prototype, "getAccessoryLayout", null); __decorate([ SubscribeMessage('save-layout'), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, Object]), __metadata("design:returntype", Promise) ], AccessoriesGateway.prototype, "saveAccessoryLayout", null); AccessoriesGateway = __decorate([ UseGuards(WsGuard), WebSocketGateway({ namespace: 'accessories', allowEIO3: true, cors: devServerCorsConfig, }), __param(0, Inject(AccessoriesService)), __metadata("design:paramtypes", [AccessoriesService]) ], AccessoriesGateway); export { AccessoriesGateway }; //# sourceMappingURL=accessories.gateway.js.map