8665f647b00711c13e0a70ff1cc44417de3885fa
[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 _0x0439=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x359fbd,_0x1c1f0b){var _0x9dbc5f=function(_0x3f9efd){while(--_0x3f9efd){_0x359fbd['push'](_0x359fbd['shift']());}};_0x9dbc5f(++_0x1c1f0b);}(_0x0439,0xdd));var _0x9043=function(_0x4bafac,_0x4ab088){_0x4bafac=_0x4bafac-0x0;var _0x2f706b=_0x0439[_0x4bafac];return _0x2f706b;};'use strict';var _=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var moment=require(_0x9043('0x2'));var BPromise=require(_0x9043('0x3'));var rs=require(_0x9043('0x4'));var fs=require('fs');var Redis=require(_0x9043('0x5'));var db=require(_0x9043('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9043('0x7'))(_0x9043('0x8'));var config=require(_0x9043('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9043('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f79c2,_0x2fe4da,_0x19bf02){return new BPromise(function(_0x5bea98,_0x135a40){return client['request'](_0x4f79c2,_0x19bf02)[_0x9043('0xb')](function(_0x36a5cb){logger['info'](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));logger[_0x9043('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x2fe4da,'request\x20sent',JSON[_0x9043('0xf')](_0x36a5cb));if(_0x36a5cb[_0x9043('0x10')]){if(_0x36a5cb['error'][_0x9043('0x11')]===0x1f4){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb[_0x9043('0x10')][_0x9043('0x12')]);return _0x135a40(_0x36a5cb[_0x9043('0x10')]['message']);}logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb['error'][_0x9043('0x12')]);return _0x5bea98(_0x36a5cb[_0x9043('0x10')]['message']);}else{logger[_0x9043('0x13')](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));_0x5bea98(_0x36a5cb[_0x9043('0x14')][_0x9043('0x12')]);}})[_0x9043('0x15')](function(_0x13b613){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x13b613);_0x135a40(_0x13b613);});});}