eb537c7abeea6a00ea6b0f50a7ab29164e6e51de
[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 _0x560e=['../../config/environment','jayson/promise','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x19d433,_0x4b63f8){var _0x18d114=function(_0x3f3d45){while(--_0x3f3d45){_0x19d433['push'](_0x19d433['shift']());}};_0x18d114(++_0x4b63f8);}(_0x560e,0x1ee));var _0xe560=function(_0x2eb6f6,_0x2476fa){_0x2eb6f6=_0x2eb6f6-0x0;var _0x2387f6=_0x560e[_0x2eb6f6];return _0x2387f6;};'use strict';var _=require(_0xe560('0x0'));var util=require(_0xe560('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe560('0x2'))['db'];var utils=require(_0xe560('0x3'));var logger=require(_0xe560('0x4'))(_0xe560('0x5'));var config=require(_0xe560('0x6'));var jayson=require(_0xe560('0x7'));var client=jayson['client'][_0xe560('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d75b7,_0x91d4c4,_0x35137f){return new BPromise(function(_0x2db1d2,_0x4cc43a){return client[_0xe560('0x9')](_0x4d75b7,_0x35137f)[_0xe560('0xa')](function(_0x3e4995){logger['info'](_0xe560('0xb'),_0x91d4c4,_0xe560('0xc'));logger[_0xe560('0xd')](_0xe560('0xe'),_0x91d4c4,_0xe560('0xc'),JSON[_0xe560('0xf')](_0x3e4995));if(_0x3e4995['error']){if(_0x3e4995[_0xe560('0x10')][_0xe560('0x11')]===0x1f4){logger[_0xe560('0x10')](_0xe560('0xb'),_0x91d4c4,_0x3e4995[_0xe560('0x10')]['message']);return _0x4cc43a(_0x3e4995[_0xe560('0x10')][_0xe560('0x12')]);}logger[_0xe560('0x10')](_0xe560('0xb'),_0x91d4c4,_0x3e4995[_0xe560('0x10')]['message']);return _0x2db1d2(_0x3e4995['error'][_0xe560('0x12')]);}else{logger['info'](_0xe560('0xb'),_0x91d4c4,_0xe560('0xc'));_0x2db1d2(_0x3e4995['result'][_0xe560('0x12')]);}})[_0xe560('0x13')](function(_0x4c0c9e){logger[_0xe560('0x10')](_0xe560('0xb'),_0x91d4c4,_0x4c0c9e);_0x4cc43a(_0x4c0c9e);});});}