UNPKG

@gqlts/cli

Version:

Generate a client sdk from your GraphQl API

24 lines 1.26 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateConfigs = validateConfigs; const colors_1 = __importDefault(require("colors")); function validateConfigs(configs) { const errors = []; if (configs.length === 0) errors.push('config array is empty'); configs.forEach((config, i) => { const whichConfig = configs.length === 1 ? 'the config' : `config #${i + 1}`; if (!config.endpoint && !config.schema) errors.push(`you didn't provide either \`endpoint\`, \`schema\` or \`fetcher\` option in ${whichConfig}`); if ([config.endpoint, config.schema].filter((i) => i).length > 1) errors.push(`you provided two or more conflicting options in ${whichConfig}, only one of either \`endpoint\`, \`schema\` or \`fetcher\` is allowed`); if (!config.output) errors.push(`you didn't provide an \`output\` option in ${whichConfig}`); }); errors.forEach((error) => console.log(colors_1.default.red(`Error: ${error}`))); return errors.length === 0; } //# sourceMappingURL=validateConfigs.js.map