Built motion from commit 994c64e1.|2.6.1
[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 _0x44d4=['http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client'];(function(_0x323bf6,_0x19aed6){var _0x18da88=function(_0x1111da){while(--_0x1111da){_0x323bf6['push'](_0x323bf6['shift']());}};_0x18da88(++_0x19aed6);}(_0x44d4,0x161));var _0x444d=function(_0x302cd7,_0x2e8e0e){_0x302cd7=_0x302cd7-0x0;var _0x49c218=_0x44d4[_0x302cd7];return _0x49c218;};'use strict';var _=require(_0x444d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x444d('0x1'));var fs=require('fs');var Redis=require(_0x444d('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x444d('0x3'));var config=require(_0x444d('0x4'));var jayson=require(_0x444d('0x5'));var client=jayson[_0x444d('0x6')][_0x444d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33fe8c,_0x300f01,_0x58e34d){return new BPromise(function(_0x38938a,_0x56e84b){return client[_0x444d('0x8')](_0x33fe8c,_0x58e34d)[_0x444d('0x9')](function(_0x87d3e8){logger[_0x444d('0xa')](_0x444d('0xb'),_0x300f01,_0x444d('0xc'));logger[_0x444d('0xd')](_0x444d('0xe'),_0x300f01,_0x444d('0xc'),JSON[_0x444d('0xf')](_0x87d3e8));if(_0x87d3e8[_0x444d('0x10')]){if(_0x87d3e8['error'][_0x444d('0x11')]===0x1f4){logger[_0x444d('0x10')]('Migration,\x20%s,\x20%s',_0x300f01,_0x87d3e8[_0x444d('0x10')][_0x444d('0x12')]);return _0x56e84b(_0x87d3e8[_0x444d('0x10')]['message']);}logger[_0x444d('0x10')](_0x444d('0xb'),_0x300f01,_0x87d3e8[_0x444d('0x10')]['message']);return _0x38938a(_0x87d3e8[_0x444d('0x10')]['message']);}else{logger[_0x444d('0xa')](_0x444d('0xb'),_0x300f01,_0x444d('0xc'));_0x38938a(_0x87d3e8[_0x444d('0x13')]['message']);}})['catch'](function(_0x4da5e3){logger['error'](_0x444d('0xb'),_0x300f01,_0x4da5e3);_0x56e84b(_0x4da5e3);});});}