Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / migration / migration.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xbd99=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd99,0x1df));var _0x9bd9=function(_0x3a0692,_0x1e59ff){_0x3a0692=_0x3a0692-0x0;var _0x5cb6e3=_0xbd99[_0x3a0692];return _0x5cb6e3;};'use strict';var _=require(_0x9bd9('0x0'));var util=require(_0x9bd9('0x1'));var moment=require('moment');var BPromise=require(_0x9bd9('0x2'));var rs=require(_0x9bd9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bd9('0x4'))['db'];var utils=require(_0x9bd9('0x5'));var logger=require(_0x9bd9('0x6'))(_0x9bd9('0x7'));var config=require(_0x9bd9('0x8'));var jayson=require(_0x9bd9('0x9'));var client=jayson[_0x9bd9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b41ea,_0x241303,_0x28b83f){return new BPromise(function(_0x7ddd62,_0x441225){return client[_0x9bd9('0xb')](_0x3b41ea,_0x28b83f)['then'](function(_0x865dc1){logger['info'](_0x9bd9('0xc'),_0x241303,_0x9bd9('0xd'));logger[_0x9bd9('0xe')](_0x9bd9('0xf'),_0x241303,_0x9bd9('0xd'),JSON[_0x9bd9('0x10')](_0x865dc1));if(_0x865dc1[_0x9bd9('0x11')]){if(_0x865dc1['error'][_0x9bd9('0x12')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x241303,_0x865dc1[_0x9bd9('0x11')]['message']);return _0x441225(_0x865dc1[_0x9bd9('0x11')][_0x9bd9('0x13')]);}logger[_0x9bd9('0x11')]('Migration,\x20%s,\x20%s',_0x241303,_0x865dc1[_0x9bd9('0x11')]['message']);return _0x7ddd62(_0x865dc1[_0x9bd9('0x11')][_0x9bd9('0x13')]);}else{logger['info'](_0x9bd9('0xc'),_0x241303,_0x9bd9('0xd'));_0x7ddd62(_0x865dc1[_0x9bd9('0x14')][_0x9bd9('0x13')]);}})['catch'](function(_0x57ffcb){logger[_0x9bd9('0x11')](_0x9bd9('0xc'),_0x241303,_0x57ffcb);_0x441225(_0x57ffcb);});});}