a12e8dd11cc1b6cc13941829a61de87fe23d795e
[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 _0x5b22=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3caa65,_0x4aa770){var _0x4aeba7=function(_0x2b49f4){while(--_0x2b49f4){_0x3caa65['push'](_0x3caa65['shift']());}};_0x4aeba7(++_0x4aa770);}(_0x5b22,0xab));var _0x25b2=function(_0x304875,_0x50c2d0){_0x304875=_0x304875-0x0;var _0x118d8b=_0x5b22[_0x304875];return _0x118d8b;};'use strict';var _=require(_0x25b2('0x0'));var util=require(_0x25b2('0x1'));var moment=require(_0x25b2('0x2'));var BPromise=require(_0x25b2('0x3'));var rs=require(_0x25b2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x25b2('0x5'))(_0x25b2('0x6'));var config=require('../../config/environment');var jayson=require(_0x25b2('0x7'));var client=jayson['client'][_0x25b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x816c89,_0x23d64d,_0x2ca3cd){return new BPromise(function(_0x114191,_0x2fae4e){return client[_0x25b2('0x9')](_0x816c89,_0x2ca3cd)[_0x25b2('0xa')](function(_0x263073){logger[_0x25b2('0xb')](_0x25b2('0xc'),_0x23d64d,_0x25b2('0xd'));logger[_0x25b2('0xe')](_0x25b2('0xf'),_0x23d64d,_0x25b2('0xd'),JSON['stringify'](_0x263073));if(_0x263073[_0x25b2('0x10')]){if(_0x263073['error'][_0x25b2('0x11')]===0x1f4){logger[_0x25b2('0x10')](_0x25b2('0xc'),_0x23d64d,_0x263073['error'][_0x25b2('0x12')]);return _0x2fae4e(_0x263073[_0x25b2('0x10')][_0x25b2('0x12')]);}logger[_0x25b2('0x10')]('Migration,\x20%s,\x20%s',_0x23d64d,_0x263073['error'][_0x25b2('0x12')]);return _0x114191(_0x263073[_0x25b2('0x10')][_0x25b2('0x12')]);}else{logger['info'](_0x25b2('0xc'),_0x23d64d,'request\x20sent');_0x114191(_0x263073[_0x25b2('0x13')][_0x25b2('0x12')]);}})[_0x25b2('0x14')](function(_0x51f732){logger[_0x25b2('0x10')](_0x25b2('0xc'),_0x23d64d,_0x51f732);_0x2fae4e(_0x51f732);});});}