Built motion from commit b5413ace.|2.6.9
[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 _0xd624=['client','request','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x55ba09,_0x498864){var _0x35794f=function(_0x1ea9bc){while(--_0x1ea9bc){_0x55ba09['push'](_0x55ba09['shift']());}};_0x35794f(++_0x498864);}(_0xd624,0x124));var _0x4d62=function(_0x5840db,_0x3c21c1){_0x5840db=_0x5840db-0x0;var _0x4fa493=_0xd624[_0x5840db];return _0x4fa493;};'use strict';var _=require(_0x4d62('0x0'));var util=require(_0x4d62('0x1'));var moment=require('moment');var BPromise=require(_0x4d62('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4d62('0x3'));var logger=require(_0x4d62('0x4'))(_0x4d62('0x5'));var config=require(_0x4d62('0x6'));var jayson=require(_0x4d62('0x7'));var client=jayson[_0x4d62('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ba7a1,_0x133d24,_0x3d6f78){return new BPromise(function(_0x12bf3c,_0x1377c3){return client[_0x4d62('0x9')](_0x4ba7a1,_0x3d6f78)['then'](function(_0x19e6cb){logger[_0x4d62('0xa')](_0x4d62('0xb'),_0x133d24,_0x4d62('0xc'));logger['debug'](_0x4d62('0xd'),_0x133d24,_0x4d62('0xc'),JSON[_0x4d62('0xe')](_0x19e6cb));if(_0x19e6cb[_0x4d62('0xf')]){if(_0x19e6cb[_0x4d62('0xf')][_0x4d62('0x10')]===0x1f4){logger[_0x4d62('0xf')](_0x4d62('0xb'),_0x133d24,_0x19e6cb[_0x4d62('0xf')][_0x4d62('0x11')]);return _0x1377c3(_0x19e6cb[_0x4d62('0xf')][_0x4d62('0x11')]);}logger['error'](_0x4d62('0xb'),_0x133d24,_0x19e6cb[_0x4d62('0xf')][_0x4d62('0x11')]);return _0x12bf3c(_0x19e6cb['error'][_0x4d62('0x11')]);}else{logger[_0x4d62('0xa')](_0x4d62('0xb'),_0x133d24,_0x4d62('0xc'));_0x12bf3c(_0x19e6cb[_0x4d62('0x12')][_0x4d62('0x11')]);}})[_0x4d62('0x13')](function(_0x55060d){logger['error'](_0x4d62('0xb'),_0x133d24,_0x55060d);_0x1377c3(_0x55060d);});});}