31ae92d1f2567cc823993de193c8d04f4c970ecf
[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 _0x0ca5=['request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2a07a9,_0x1018a8){var _0x9c0b45=function(_0x31819c){while(--_0x31819c){_0x2a07a9['push'](_0x2a07a9['shift']());}};_0x9c0b45(++_0x1018a8);}(_0x0ca5,0xfc));var _0x50ca=function(_0x54b68d,_0x4a0df4){_0x54b68d=_0x54b68d-0x0;var _0x21252e=_0x0ca5[_0x54b68d];return _0x21252e;};'use strict';var _=require(_0x50ca('0x0'));var util=require(_0x50ca('0x1'));var moment=require(_0x50ca('0x2'));var BPromise=require(_0x50ca('0x3'));var rs=require(_0x50ca('0x4'));var fs=require('fs');var Redis=require(_0x50ca('0x5'));var db=require(_0x50ca('0x6'))['db'];var utils=require(_0x50ca('0x7'));var logger=require('../../config/logger')(_0x50ca('0x8'));var config=require(_0x50ca('0x9'));var jayson=require(_0x50ca('0xa'));var client=jayson[_0x50ca('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e7d2c,_0x18142d,_0x47e1b1){return new BPromise(function(_0x14709d,_0x56e57a){return client[_0x50ca('0xc')](_0x4e7d2c,_0x47e1b1)['then'](function(_0x3ab7a0){logger[_0x50ca('0xd')](_0x50ca('0xe'),_0x18142d,_0x50ca('0xf'));logger[_0x50ca('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x18142d,'request\x20sent',JSON[_0x50ca('0x11')](_0x3ab7a0));if(_0x3ab7a0[_0x50ca('0x12')]){if(_0x3ab7a0[_0x50ca('0x12')][_0x50ca('0x13')]===0x1f4){logger[_0x50ca('0x12')](_0x50ca('0xe'),_0x18142d,_0x3ab7a0[_0x50ca('0x12')][_0x50ca('0x14')]);return _0x56e57a(_0x3ab7a0[_0x50ca('0x12')][_0x50ca('0x14')]);}logger[_0x50ca('0x12')](_0x50ca('0xe'),_0x18142d,_0x3ab7a0[_0x50ca('0x12')][_0x50ca('0x14')]);return _0x14709d(_0x3ab7a0[_0x50ca('0x12')]['message']);}else{logger[_0x50ca('0xd')](_0x50ca('0xe'),_0x18142d,_0x50ca('0xf'));_0x14709d(_0x3ab7a0[_0x50ca('0x15')][_0x50ca('0x14')]);}})['catch'](function(_0x1566f4){logger['error'](_0x50ca('0xe'),_0x18142d,_0x1566f4);_0x56e57a(_0x1566f4);});});}