UNPKG

contentful-migration

Version:
32 lines 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createManagementClient = void 0; const proxy_1 = require("./proxy"); // One cannot rewire const's // eslint-disable-next-line const contentful_management_1 = require("contentful-management"); // for rewiring during tests let createClient = contentful_management_1.createClient; function createManagementClient(params) { if (!params.application) { throw new Error('Please specify the application name that uses this client instance'); } const proxyFromParams = params.proxy && (0, proxy_1.proxyStringToObject)(params.proxy); if (proxyFromParams) { params.proxy = proxyFromParams; } else { const proxyFromEnv = (0, proxy_1.loadProxyFromEnv)(process.env); if (proxyFromEnv) { params.proxy = proxyFromEnv; } } if (!params.rawProxy) { const { httpsAgent } = (0, proxy_1.agentFromProxy)(params.proxy); params.httpsAgent = httpsAgent; delete params.proxy; } return createClient(params, { type: 'plain' }); } exports.createManagementClient = createManagementClient; //# sourceMappingURL=index.js.map