814edf0db29072d72f6bd62d811bc3fc88209ebd
[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 _0x09eb=['client','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise'];(function(_0x18c4bf,_0x56dfe5){var _0x5c9674=function(_0x46c6e9){while(--_0x46c6e9){_0x18c4bf['push'](_0x18c4bf['shift']());}};_0x5c9674(++_0x56dfe5);}(_0x09eb,0x1b0));var _0xb09e=function(_0x173eff,_0x55a7d0){_0x173eff=_0x173eff-0x0;var _0x119fbd=_0x09eb[_0x173eff];return _0x119fbd;};'use strict';var _=require(_0xb09e('0x0'));var util=require(_0xb09e('0x1'));var moment=require('moment');var BPromise=require(_0xb09e('0x2'));var rs=require(_0xb09e('0x3'));var fs=require('fs');var Redis=require(_0xb09e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb09e('0x5'))(_0xb09e('0x6'));var config=require('../../config/environment');var jayson=require(_0xb09e('0x7'));var client=jayson[_0xb09e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xae62c2,_0x3b6a2,_0xd85de4){return new BPromise(function(_0x19ef9f,_0x4546a5){return client[_0xb09e('0x9')](_0xae62c2,_0xd85de4)[_0xb09e('0xa')](function(_0x436489){logger['info'](_0xb09e('0xb'),_0x3b6a2,_0xb09e('0xc'));logger[_0xb09e('0xd')](_0xb09e('0xe'),_0x3b6a2,'request\x20sent',JSON['stringify'](_0x436489));if(_0x436489['error']){if(_0x436489[_0xb09e('0xf')][_0xb09e('0x10')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x3b6a2,_0x436489[_0xb09e('0xf')][_0xb09e('0x11')]);return _0x4546a5(_0x436489['error'][_0xb09e('0x11')]);}logger[_0xb09e('0xf')](_0xb09e('0xb'),_0x3b6a2,_0x436489[_0xb09e('0xf')][_0xb09e('0x11')]);return _0x19ef9f(_0x436489[_0xb09e('0xf')][_0xb09e('0x11')]);}else{logger[_0xb09e('0x12')](_0xb09e('0xb'),_0x3b6a2,_0xb09e('0xc'));_0x19ef9f(_0x436489['result'][_0xb09e('0x11')]);}})[_0xb09e('0x13')](function(_0x290074){logger[_0xb09e('0xf')](_0xb09e('0xb'),_0x3b6a2,_0x290074);_0x4546a5(_0x290074);});});}