db06d5d2f757e4bdb2376c650fc7f6c8305ec697
[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 _0x34ab=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0x34ab,0x169));var _0xb34a=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x34ab[_0x2272b5];return _0x110156;};'use strict';var _=require(_0xb34a('0x0'));var util=require(_0xb34a('0x1'));var moment=require(_0xb34a('0x2'));var BPromise=require(_0xb34a('0x3'));var rs=require(_0xb34a('0x4'));var fs=require('fs');var Redis=require(_0xb34a('0x5'));var db=require(_0xb34a('0x6'))['db'];var utils=require(_0xb34a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xb34a('0x8'));var jayson=require(_0xb34a('0x9'));var client=jayson[_0xb34a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b8d3e,_0x492c6d,_0x14c0d2){return new BPromise(function(_0xb915fb,_0x3afc6d){return client[_0xb34a('0xb')](_0x2b8d3e,_0x14c0d2)[_0xb34a('0xc')](function(_0x286281){logger[_0xb34a('0xd')]('Migration,\x20%s,\x20%s',_0x492c6d,_0xb34a('0xe'));logger[_0xb34a('0xf')](_0xb34a('0x10'),_0x492c6d,'request\x20sent',JSON[_0xb34a('0x11')](_0x286281));if(_0x286281[_0xb34a('0x12')]){if(_0x286281[_0xb34a('0x12')][_0xb34a('0x13')]===0x1f4){logger[_0xb34a('0x12')](_0xb34a('0x14'),_0x492c6d,_0x286281['error']['message']);return _0x3afc6d(_0x286281['error']['message']);}logger[_0xb34a('0x12')]('Migration,\x20%s,\x20%s',_0x492c6d,_0x286281['error'][_0xb34a('0x15')]);return _0xb915fb(_0x286281[_0xb34a('0x12')][_0xb34a('0x15')]);}else{logger['info'](_0xb34a('0x14'),_0x492c6d,_0xb34a('0xe'));_0xb915fb(_0x286281[_0xb34a('0x16')]['message']);}})[_0xb34a('0x17')](function(_0x4f4abe){logger[_0xb34a('0x12')](_0xb34a('0x14'),_0x492c6d,_0x4f4abe);_0x3afc6d(_0x4f4abe);});});}