e035056617a424c5d3ee642edcdfb1696bc3fa9c
[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 _0x292e=['Migration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x346771,_0x3be84c){var _0x8f5f6f=function(_0x4086f5){while(--_0x4086f5){_0x346771['push'](_0x346771['shift']());}};_0x8f5f6f(++_0x3be84c);}(_0x292e,0xcb));var _0xe292=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x292e[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xe292('0x0'));var util=require(_0xe292('0x1'));var moment=require(_0xe292('0x2'));var BPromise=require(_0xe292('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe292('0x4'))['db'];var utils=require(_0xe292('0x5'));var logger=require(_0xe292('0x6'))(_0xe292('0x7'));var config=require('../../config/environment');var jayson=require(_0xe292('0x8'));var client=jayson['client'][_0xe292('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3de36e,_0x3fe83c,_0x11fd14){return new BPromise(function(_0x26b4de,_0x1bac49){return client['request'](_0x3de36e,_0x11fd14)['then'](function(_0x20eb49){logger[_0xe292('0xa')](_0xe292('0xb'),_0x3fe83c,_0xe292('0xc'));logger['debug'](_0xe292('0xd'),_0x3fe83c,_0xe292('0xc'),JSON['stringify'](_0x20eb49));if(_0x20eb49[_0xe292('0xe')]){if(_0x20eb49[_0xe292('0xe')][_0xe292('0xf')]===0x1f4){logger[_0xe292('0xe')](_0xe292('0xb'),_0x3fe83c,_0x20eb49[_0xe292('0xe')]['message']);return _0x1bac49(_0x20eb49[_0xe292('0xe')][_0xe292('0x10')]);}logger[_0xe292('0xe')](_0xe292('0xb'),_0x3fe83c,_0x20eb49[_0xe292('0xe')][_0xe292('0x10')]);return _0x26b4de(_0x20eb49[_0xe292('0xe')]['message']);}else{logger[_0xe292('0xa')](_0xe292('0xb'),_0x3fe83c,'request\x20sent');_0x26b4de(_0x20eb49['result'][_0xe292('0x10')]);}})[_0xe292('0x11')](function(_0x353ced){logger[_0xe292('0xe')]('Migration,\x20%s,\x20%s',_0x3fe83c,_0x353ced);_0x1bac49(_0x353ced);});});}