Built motion from commit (unavailable).|2.5.0
[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 _0x568a=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2cf38c,_0x5b2102){var _0x3b56c6=function(_0x43895c){while(--_0x43895c){_0x2cf38c['push'](_0x2cf38c['shift']());}};_0x3b56c6(++_0x5b2102);}(_0x568a,0xcd));var _0xa568=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x568a[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0xa568('0x0'));var util=require(_0xa568('0x1'));var moment=require(_0xa568('0x2'));var BPromise=require(_0xa568('0x3'));var rs=require(_0xa568('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa568('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa568('0x6')][_0xa568('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x12160d,_0x1cf69c,_0x4ae3ee){return new BPromise(function(_0x2643d9,_0x11b9ae){return client[_0xa568('0x8')](_0x12160d,_0x4ae3ee)[_0xa568('0x9')](function(_0x1aabf7){logger['info'](_0xa568('0xa'),_0x1cf69c,_0xa568('0xb'));logger[_0xa568('0xc')](_0xa568('0xd'),_0x1cf69c,'request\x20sent',JSON[_0xa568('0xe')](_0x1aabf7));if(_0x1aabf7[_0xa568('0xf')]){if(_0x1aabf7[_0xa568('0xf')][_0xa568('0x10')]===0x1f4){logger[_0xa568('0xf')](_0xa568('0xa'),_0x1cf69c,_0x1aabf7[_0xa568('0xf')]['message']);return _0x11b9ae(_0x1aabf7['error'][_0xa568('0x11')]);}logger[_0xa568('0xf')](_0xa568('0xa'),_0x1cf69c,_0x1aabf7[_0xa568('0xf')][_0xa568('0x11')]);return _0x2643d9(_0x1aabf7[_0xa568('0xf')][_0xa568('0x11')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x1cf69c,_0xa568('0xb'));_0x2643d9(_0x1aabf7[_0xa568('0x12')][_0xa568('0x11')]);}})[_0xa568('0x13')](function(_0x114289){logger['error'](_0xa568('0xa'),_0x1cf69c,_0x114289);_0x11b9ae(_0x114289);});});}