UNPKG

mysterium-vpn-js

Version:
30 lines (29 loc) 1.18 kB
"use strict"; /** * Copyright (c) 2020 BlockDev AG * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.parseProposalList = exports.parseProposal = void 0; const validation_1 = require("../fmt/validation"); // eslint-disable-next-line @typescript-eslint/no-explicit-any function parseProposal(data) { (0, validation_1.validateMultiple)('Proposal', data, [ { name: 'format', type: 'string' }, { name: 'compatibility', type: 'number' }, { name: 'providerId', type: 'string' }, { name: 'serviceType', type: 'string' }, { name: 'location', type: 'object' }, { name: 'price', type: 'object' }, ]); return data; } exports.parseProposal = parseProposal; // eslint-disable-next-line @typescript-eslint/no-explicit-any function parseProposalList(responseData) { (0, validation_1.validate)('ProposalList', responseData, { name: 'proposals', type: 'array' }); return { proposals: responseData.proposals.map(parseProposal) }; } exports.parseProposalList = parseProposalList;