Built motion from commit 4fa9d4a7.|2.6.31
[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 _0xc686=['debug','error','message','Migration,\x20%s,\x20%s','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x4b0830,_0x2e3b0a){var _0x1f53a7=function(_0x4b5503){while(--_0x4b5503){_0x4b0830['push'](_0x4b0830['shift']());}};_0x1f53a7(++_0x2e3b0a);}(_0xc686,0x148));var _0x6c68=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xc686[_0x28947d];return _0x12d2ee;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6c68('0x0'));var BPromise=require('bluebird');var rs=require(_0x6c68('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c68('0x2'))['db'];var utils=require(_0x6c68('0x3'));var logger=require(_0x6c68('0x4'))(_0x6c68('0x5'));var config=require(_0x6c68('0x6'));var jayson=require(_0x6c68('0x7'));var client=jayson[_0x6c68('0x8')][_0x6c68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dc035,_0x1e88b0,_0x12e935){return new BPromise(function(_0x394644,_0x5634c4){return client[_0x6c68('0xa')](_0x3dc035,_0x12e935)[_0x6c68('0xb')](function(_0x4ff2ce){logger[_0x6c68('0xc')]('Migration,\x20%s,\x20%s',_0x1e88b0,_0x6c68('0xd'));logger[_0x6c68('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x1e88b0,_0x6c68('0xd'),JSON['stringify'](_0x4ff2ce));if(_0x4ff2ce[_0x6c68('0xf')]){if(_0x4ff2ce[_0x6c68('0xf')]['code']===0x1f4){logger[_0x6c68('0xf')]('Migration,\x20%s,\x20%s',_0x1e88b0,_0x4ff2ce['error'][_0x6c68('0x10')]);return _0x5634c4(_0x4ff2ce['error'][_0x6c68('0x10')]);}logger[_0x6c68('0xf')](_0x6c68('0x11'),_0x1e88b0,_0x4ff2ce['error'][_0x6c68('0x10')]);return _0x394644(_0x4ff2ce[_0x6c68('0xf')][_0x6c68('0x10')]);}else{logger[_0x6c68('0xc')](_0x6c68('0x11'),_0x1e88b0,'request\x20sent');_0x394644(_0x4ff2ce['result']['message']);}})[_0x6c68('0x12')](function(_0x32cfd2){logger[_0x6c68('0xf')](_0x6c68('0x11'),_0x1e88b0,_0x32cfd2);_0x5634c4(_0x32cfd2);});});}