UNPKG

xrmcli

Version:

A suite of cli tools to support Xrm/D365/Dataverse development

44 lines 1.67 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.publishsome = void 0; const node_fetch_1 = __importDefault(require("node-fetch")); const progress_1 = __importDefault(require("progress")); const header_1 = require("./header"); const publishsome = async (authToken, url, parameterxml) => { const bar = new progress_1.default('Publishing customizations :bar :elapsed seconds', { total: 50 }); let barReverse = false; const timer = setInterval(() => { bar.tick(barReverse ? -1 : 1); if (bar.curr === bar.total - 1 || bar.curr <= 1) { barReverse = !(bar.curr <= 1); } }, 500); try { const result = await (0, node_fetch_1.default)(`${url}/api/data/v9.2/PublishXml`, { headers: (0, header_1.initHeader)(authToken.accessToken), method: 'POST', body: JSON.stringify({ ParameterXml: parameterxml, }), }); if (result) { if (result.status >= 200 && result.status < 300) { console.log('\nCustomizations published.'); } else { console.error(`\nError publishing customizations. ${result.statusText}`); } } } catch (e) { console.error(`\n${e.message || 'Error publishing customizations.'}`); } finally { clearInterval(timer); } }; exports.publishsome = publishsome; //# sourceMappingURL=publish.js.map