Built motion from commit 616d3211.|2.6.4
[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 _0x4e83=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','Migration,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x512a39,_0x5cad2f){var _0x29e40e=function(_0xda695a){while(--_0xda695a){_0x512a39['push'](_0x512a39['shift']());}};_0x29e40e(++_0x5cad2f);}(_0x4e83,0x88));var _0x34e8=function(_0x515ae8,_0x2a964f){_0x515ae8=_0x515ae8-0x0;var _0x4cf66a=_0x4e83[_0x515ae8];return _0x4cf66a;};'use strict';var _=require('lodash');var util=require(_0x34e8('0x0'));var moment=require(_0x34e8('0x1'));var BPromise=require(_0x34e8('0x2'));var rs=require(_0x34e8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34e8('0x4'))['db'];var utils=require(_0x34e8('0x5'));var logger=require(_0x34e8('0x6'))(_0x34e8('0x7'));var config=require(_0x34e8('0x8'));var jayson=require(_0x34e8('0x9'));var client=jayson[_0x34e8('0xa')][_0x34e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x320b00,_0x146a1f,_0x188f11){return new BPromise(function(_0x18e178,_0x3ace57){return client['request'](_0x320b00,_0x188f11)[_0x34e8('0xc')](function(_0x200425){logger[_0x34e8('0xd')]('Migration,\x20%s,\x20%s',_0x146a1f,_0x34e8('0xe'));logger[_0x34e8('0xf')](_0x34e8('0x10'),_0x146a1f,_0x34e8('0xe'),JSON[_0x34e8('0x11')](_0x200425));if(_0x200425['error']){if(_0x200425[_0x34e8('0x12')]['code']===0x1f4){logger[_0x34e8('0x12')](_0x34e8('0x13'),_0x146a1f,_0x200425[_0x34e8('0x12')][_0x34e8('0x14')]);return _0x3ace57(_0x200425[_0x34e8('0x12')][_0x34e8('0x14')]);}logger['error'](_0x34e8('0x13'),_0x146a1f,_0x200425['error'][_0x34e8('0x14')]);return _0x18e178(_0x200425['error'][_0x34e8('0x14')]);}else{logger[_0x34e8('0xd')](_0x34e8('0x13'),_0x146a1f,'request\x20sent');_0x18e178(_0x200425[_0x34e8('0x15')]['message']);}})[_0x34e8('0x16')](function(_0xed8219){logger[_0x34e8('0x12')]('Migration,\x20%s,\x20%s',_0x146a1f,_0xed8219);_0x3ace57(_0xed8219);});});}