Built motion from commit 953226e6.|2.6.32
[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 _0xb627=['rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xb627,0x144));var _0x7b62=function(_0x36a2ed,_0x3815d4){_0x36a2ed=_0x36a2ed-0x0;var _0x2b7be4=_0xb627[_0x36a2ed];return _0x2b7be4;};'use strict';var _=require(_0x7b62('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7b62('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b62('0x2'));var db=require(_0x7b62('0x3'))['db'];var utils=require(_0x7b62('0x4'));var logger=require(_0x7b62('0x5'))(_0x7b62('0x6'));var config=require(_0x7b62('0x7'));var jayson=require(_0x7b62('0x8'));var client=jayson['client'][_0x7b62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x547533,_0x387d76,_0x264cfa){return new BPromise(function(_0x4ae3ef,_0x30652e){return client['request'](_0x547533,_0x264cfa)[_0x7b62('0xa')](function(_0x379d07){logger[_0x7b62('0xb')]('Migration,\x20%s,\x20%s',_0x387d76,_0x7b62('0xc'));logger[_0x7b62('0xd')](_0x7b62('0xe'),_0x387d76,_0x7b62('0xc'),JSON[_0x7b62('0xf')](_0x379d07));if(_0x379d07[_0x7b62('0x10')]){if(_0x379d07[_0x7b62('0x10')][_0x7b62('0x11')]===0x1f4){logger[_0x7b62('0x10')](_0x7b62('0x12'),_0x387d76,_0x379d07[_0x7b62('0x10')][_0x7b62('0x13')]);return _0x30652e(_0x379d07[_0x7b62('0x10')]['message']);}logger[_0x7b62('0x10')]('Migration,\x20%s,\x20%s',_0x387d76,_0x379d07[_0x7b62('0x10')]['message']);return _0x4ae3ef(_0x379d07[_0x7b62('0x10')]['message']);}else{logger['info'](_0x7b62('0x12'),_0x387d76,'request\x20sent');_0x4ae3ef(_0x379d07[_0x7b62('0x14')][_0x7b62('0x13')]);}})[_0x7b62('0x15')](function(_0x4ebaa2){logger[_0x7b62('0x10')]('Migration,\x20%s,\x20%s',_0x387d76,_0x4ebaa2);_0x30652e(_0x4ebaa2);});});}