UNPKG

component-dbs-core

Version:

DTO objects shared among device backend

47 lines 2.44 kB
"use strict"; 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 DeviceVerification_1; Object.defineProperty(exports, "__esModule", { value: true }); exports.DeviceVerification = void 0; const common_1 = require("@nestjs/common"); const config_1 = require("../../common_services/config"); const dynamodbService_1 = require("../../common_services/dynamodb/dynamodbService"); let DeviceVerification = DeviceVerification_1 = class DeviceVerification { constructor(dynamodbService, envService) { this.dynamodbService = dynamodbService; this.envService = envService; this.isDeviceTokenValid = (deviceUuid, accessToken) => { DeviceVerification_1.mockIsDeviceTokenValid(); const isTokenValid = deviceUuid !== '' && deviceUuid !== undefined; console.log(`deviceUuid = ${deviceUuid}`); console.log(`accessToken = ${accessToken}`); console.log(`isDeviceTokenValid = ${isTokenValid}`); return isTokenValid; }; this.checkAccessToken = () => { DeviceVerification_1.mockCheckAccessToken(); if (!DeviceVerification_1.accessTokenValid) { throw new Error(); } }; } }; DeviceVerification.deviceTokenValid = true; DeviceVerification.accessTokenValid = true; DeviceVerification.mockIsDeviceTokenValid = jest.fn(); DeviceVerification.mockCheckAccessToken = jest.fn(); DeviceVerification = DeviceVerification_1 = __decorate([ common_1.Injectable(), __metadata("design:paramtypes", [dynamodbService_1.DynamodbService, config_1.EnvironmentService]) ], DeviceVerification); exports.DeviceVerification = DeviceVerification; //# sourceMappingURL=deviceVerification.js.map