21459d5bd97fa3e2f832cf988c5b5582bd0eab4b
[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 _0xc298=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4447d2,_0x84265d){var _0x2417cc=function(_0x24da5a){while(--_0x24da5a){_0x4447d2['push'](_0x4447d2['shift']());}};_0x2417cc(++_0x84265d);}(_0xc298,0x143));var _0x8c29=function(_0x3cab1f,_0x2de461){_0x3cab1f=_0x3cab1f-0x0;var _0x2b2b3d=_0xc298[_0x3cab1f];return _0x2b2b3d;};'use strict';var _=require('lodash');var util=require(_0x8c29('0x0'));var moment=require(_0x8c29('0x1'));var BPromise=require(_0x8c29('0x2'));var rs=require(_0x8c29('0x3'));var fs=require('fs');var Redis=require(_0x8c29('0x4'));var db=require(_0x8c29('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c29('0x6'))(_0x8c29('0x7'));var config=require(_0x8c29('0x8'));var jayson=require(_0x8c29('0x9'));var client=jayson[_0x8c29('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1acce8,_0x254d3b,_0x366325){return new BPromise(function(_0xef6e28,_0x29e9e0){return client[_0x8c29('0xb')](_0x1acce8,_0x366325)['then'](function(_0x47bae9){logger['info'](_0x8c29('0xc'),_0x254d3b,_0x8c29('0xd'));logger[_0x8c29('0xe')](_0x8c29('0xf'),_0x254d3b,_0x8c29('0xd'),JSON[_0x8c29('0x10')](_0x47bae9));if(_0x47bae9[_0x8c29('0x11')]){if(_0x47bae9[_0x8c29('0x11')][_0x8c29('0x12')]===0x1f4){logger[_0x8c29('0x11')](_0x8c29('0xc'),_0x254d3b,_0x47bae9[_0x8c29('0x11')][_0x8c29('0x13')]);return _0x29e9e0(_0x47bae9[_0x8c29('0x11')][_0x8c29('0x13')]);}logger[_0x8c29('0x11')]('Migration,\x20%s,\x20%s',_0x254d3b,_0x47bae9[_0x8c29('0x11')][_0x8c29('0x13')]);return _0xef6e28(_0x47bae9['error']['message']);}else{logger[_0x8c29('0x14')](_0x8c29('0xc'),_0x254d3b,'request\x20sent');_0xef6e28(_0x47bae9[_0x8c29('0x15')][_0x8c29('0x13')]);}})[_0x8c29('0x16')](function(_0x5588a8){logger[_0x8c29('0x11')](_0x8c29('0xc'),_0x254d3b,_0x5588a8);_0x29e9e0(_0x5588a8);});});}