Built motion from commit (unavailable).|2.4.18
[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 _0xae41=['error','code','message','Migration,\x20%s,\x20%s','result','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0xae41,0xaf));var _0x1ae4=function(_0x5ee216,_0x1588fc){_0x5ee216=_0x5ee216-0x0;var _0x3589fb=_0xae41[_0x5ee216];return _0x3589fb;};'use strict';var _=require(_0x1ae4('0x0'));var util=require(_0x1ae4('0x1'));var moment=require(_0x1ae4('0x2'));var BPromise=require(_0x1ae4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1ae4('0x4'));var logger=require('../../config/logger')(_0x1ae4('0x5'));var config=require(_0x1ae4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1ae4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14b07a,_0xd7c5,_0x435721){return new BPromise(function(_0x5e7371,_0xfc7fb3){return client[_0x1ae4('0x8')](_0x14b07a,_0x435721)[_0x1ae4('0x9')](function(_0x1a0de1){logger[_0x1ae4('0xa')]('Migration,\x20%s,\x20%s',_0xd7c5,'request\x20sent');logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0xd7c5,_0x1ae4('0xb'),JSON['stringify'](_0x1a0de1));if(_0x1a0de1[_0x1ae4('0xc')]){if(_0x1a0de1[_0x1ae4('0xc')][_0x1ae4('0xd')]===0x1f4){logger[_0x1ae4('0xc')]('Migration,\x20%s,\x20%s',_0xd7c5,_0x1a0de1[_0x1ae4('0xc')][_0x1ae4('0xe')]);return _0xfc7fb3(_0x1a0de1[_0x1ae4('0xc')][_0x1ae4('0xe')]);}logger[_0x1ae4('0xc')](_0x1ae4('0xf'),_0xd7c5,_0x1a0de1['error']['message']);return _0x5e7371(_0x1a0de1[_0x1ae4('0xc')][_0x1ae4('0xe')]);}else{logger[_0x1ae4('0xa')](_0x1ae4('0xf'),_0xd7c5,_0x1ae4('0xb'));_0x5e7371(_0x1a0de1[_0x1ae4('0x10')][_0x1ae4('0xe')]);}})['catch'](function(_0xe075){logger['error'](_0x1ae4('0xf'),_0xd7c5,_0xe075);_0xfc7fb3(_0xe075);});});}