e114e66de8e6704a99b2a06087a81492b77428e8
[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 _0x13ea=['Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','then','info','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x2940e7,_0x3d9683){var _0x4b3a0c=function(_0x50afec){while(--_0x50afec){_0x2940e7['push'](_0x2940e7['shift']());}};_0x4b3a0c(++_0x3d9683);}(_0x13ea,0xa9));var _0xa13e=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x13ea[_0xbe40ad];return _0x50fac9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa13e('0x0'));var BPromise=require(_0xa13e('0x1'));var rs=require(_0xa13e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa13e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa13e('0x4'))('rpc');var config=require(_0xa13e('0x5'));var jayson=require(_0xa13e('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a8075,_0x53dceb,_0x72089){return new BPromise(function(_0x200db4,_0x2f2b68){return client['request'](_0x5a8075,_0x72089)[_0xa13e('0x7')](function(_0x38825b){logger[_0xa13e('0x8')](_0xa13e('0x9'),_0x53dceb,_0xa13e('0xa'));logger['debug'](_0xa13e('0xb'),_0x53dceb,_0xa13e('0xa'),JSON[_0xa13e('0xc')](_0x38825b));if(_0x38825b[_0xa13e('0xd')]){if(_0x38825b['error'][_0xa13e('0xe')]===0x1f4){logger[_0xa13e('0xd')](_0xa13e('0x9'),_0x53dceb,_0x38825b[_0xa13e('0xd')][_0xa13e('0xf')]);return _0x2f2b68(_0x38825b['error'][_0xa13e('0xf')]);}logger[_0xa13e('0xd')]('Migration,\x20%s,\x20%s',_0x53dceb,_0x38825b['error'][_0xa13e('0xf')]);return _0x200db4(_0x38825b['error'][_0xa13e('0xf')]);}else{logger['info'](_0xa13e('0x9'),_0x53dceb,_0xa13e('0xa'));_0x200db4(_0x38825b[_0xa13e('0x10')][_0xa13e('0xf')]);}})[_0xa13e('0x11')](function(_0x4bf720){logger[_0xa13e('0xd')](_0xa13e('0x9'),_0x53dceb,_0x4bf720);_0x2f2b68(_0x4bf720);});});}