9d4571d4631d47ad3f3c353a3319cfb71942d01f
[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 _0x2828=['request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','request','then','info'];(function(_0x485abd,_0x32c7c1){var _0x3379f1=function(_0x36b528){while(--_0x36b528){_0x485abd['push'](_0x485abd['shift']());}};_0x3379f1(++_0x32c7c1);}(_0x2828,0x106));var _0x8282=function(_0x64daf7,_0x3ce579){_0x64daf7=_0x64daf7-0x0;var _0x11d8d8=_0x2828[_0x64daf7];return _0x11d8d8;};'use strict';var _=require(_0x8282('0x0'));var util=require(_0x8282('0x1'));var moment=require(_0x8282('0x2'));var BPromise=require(_0x8282('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8282('0x4'));var db=require(_0x8282('0x5'))['db'];var utils=require(_0x8282('0x6'));var logger=require('../../config/logger')(_0x8282('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a6363,_0x32c8b,_0x123a81){return new BPromise(function(_0x52e503,_0xf1d2a9){return client[_0x8282('0x8')](_0x5a6363,_0x123a81)[_0x8282('0x9')](function(_0x38dfc4){logger[_0x8282('0xa')]('Migration,\x20%s,\x20%s',_0x32c8b,_0x8282('0xb'));logger[_0x8282('0xc')](_0x8282('0xd'),_0x32c8b,_0x8282('0xb'),JSON[_0x8282('0xe')](_0x38dfc4));if(_0x38dfc4[_0x8282('0xf')]){if(_0x38dfc4[_0x8282('0xf')][_0x8282('0x10')]===0x1f4){logger[_0x8282('0xf')](_0x8282('0x11'),_0x32c8b,_0x38dfc4[_0x8282('0xf')][_0x8282('0x12')]);return _0xf1d2a9(_0x38dfc4['error'][_0x8282('0x12')]);}logger[_0x8282('0xf')](_0x8282('0x11'),_0x32c8b,_0x38dfc4[_0x8282('0xf')][_0x8282('0x12')]);return _0x52e503(_0x38dfc4[_0x8282('0xf')][_0x8282('0x12')]);}else{logger['info'](_0x8282('0x11'),_0x32c8b,'request\x20sent');_0x52e503(_0x38dfc4[_0x8282('0x13')][_0x8282('0x12')]);}})[_0x8282('0x14')](function(_0x38181e){logger[_0x8282('0xf')](_0x8282('0x11'),_0x32c8b,_0x38181e);_0xf1d2a9(_0x38181e);});});}