2b2057dc40225a878f164cd92d36b1d4a6833fb6
[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 _0x0e35=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1d8b87,_0x32b7ac){var _0xb86d0a=function(_0x312973){while(--_0x312973){_0x1d8b87['push'](_0x1d8b87['shift']());}};_0xb86d0a(++_0x32b7ac);}(_0x0e35,0xc2));var _0x50e3=function(_0x4e812f,_0xb783d0){_0x4e812f=_0x4e812f-0x0;var _0x57388c=_0x0e35[_0x4e812f];return _0x57388c;};'use strict';var _=require(_0x50e3('0x0'));var util=require(_0x50e3('0x1'));var moment=require(_0x50e3('0x2'));var BPromise=require(_0x50e3('0x3'));var rs=require(_0x50e3('0x4'));var fs=require('fs');var Redis=require(_0x50e3('0x5'));var db=require(_0x50e3('0x6'))['db'];var utils=require(_0x50e3('0x7'));var logger=require(_0x50e3('0x8'))(_0x50e3('0x9'));var config=require('../../config/environment');var jayson=require(_0x50e3('0xa'));var client=jayson[_0x50e3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5defe6,_0x2ac084,_0x1ed6ec){return new BPromise(function(_0x57bb5f,_0x48382f){return client[_0x50e3('0xc')](_0x5defe6,_0x1ed6ec)[_0x50e3('0xd')](function(_0x3e0a06){logger[_0x50e3('0xe')](_0x50e3('0xf'),_0x2ac084,_0x50e3('0x10'));logger[_0x50e3('0x11')](_0x50e3('0x12'),_0x2ac084,_0x50e3('0x10'),JSON[_0x50e3('0x13')](_0x3e0a06));if(_0x3e0a06[_0x50e3('0x14')]){if(_0x3e0a06[_0x50e3('0x14')][_0x50e3('0x15')]===0x1f4){logger['error'](_0x50e3('0xf'),_0x2ac084,_0x3e0a06[_0x50e3('0x14')][_0x50e3('0x16')]);return _0x48382f(_0x3e0a06[_0x50e3('0x14')]['message']);}logger[_0x50e3('0x14')](_0x50e3('0xf'),_0x2ac084,_0x3e0a06['error'][_0x50e3('0x16')]);return _0x57bb5f(_0x3e0a06[_0x50e3('0x14')][_0x50e3('0x16')]);}else{logger[_0x50e3('0xe')](_0x50e3('0xf'),_0x2ac084,'request\x20sent');_0x57bb5f(_0x3e0a06[_0x50e3('0x17')]['message']);}})[_0x50e3('0x18')](function(_0x1bf9df){logger[_0x50e3('0x14')]('Migration,\x20%s,\x20%s',_0x2ac084,_0x1bf9df);_0x48382f(_0x1bf9df);});});}