3179511c88a19c1281c2187c4ad3ab0311866cc4
[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 _0x7726=['request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2df5f3,_0x56a099){var _0x64b6d0=function(_0x62b423){while(--_0x62b423){_0x2df5f3['push'](_0x2df5f3['shift']());}};_0x64b6d0(++_0x56a099);}(_0x7726,0x107));var _0x6772=function(_0x16b0f0,_0x4540f9){_0x16b0f0=_0x16b0f0-0x0;var _0x5f2416=_0x7726[_0x16b0f0];return _0x5f2416;};'use strict';var _=require(_0x6772('0x0'));var util=require(_0x6772('0x1'));var moment=require(_0x6772('0x2'));var BPromise=require(_0x6772('0x3'));var rs=require(_0x6772('0x4'));var fs=require('fs');var Redis=require(_0x6772('0x5'));var db=require(_0x6772('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6772('0x7'))(_0x6772('0x8'));var config=require(_0x6772('0x9'));var jayson=require(_0x6772('0xa'));var client=jayson[_0x6772('0xb')][_0x6772('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f01bc,_0xe27108,_0x4c6205){return new BPromise(function(_0x4d9fcf,_0x1443ad){return client[_0x6772('0xd')](_0x2f01bc,_0x4c6205)[_0x6772('0xe')](function(_0x934ca8){logger[_0x6772('0xf')](_0x6772('0x10'),_0xe27108,_0x6772('0x11'));logger[_0x6772('0x12')](_0x6772('0x13'),_0xe27108,_0x6772('0x11'),JSON['stringify'](_0x934ca8));if(_0x934ca8[_0x6772('0x14')]){if(_0x934ca8[_0x6772('0x14')]['code']===0x1f4){logger[_0x6772('0x14')]('Migration,\x20%s,\x20%s',_0xe27108,_0x934ca8['error'][_0x6772('0x15')]);return _0x1443ad(_0x934ca8['error'][_0x6772('0x15')]);}logger[_0x6772('0x14')](_0x6772('0x10'),_0xe27108,_0x934ca8[_0x6772('0x14')]['message']);return _0x4d9fcf(_0x934ca8[_0x6772('0x14')]['message']);}else{logger[_0x6772('0xf')]('Migration,\x20%s,\x20%s',_0xe27108,_0x6772('0x11'));_0x4d9fcf(_0x934ca8[_0x6772('0x16')]['message']);}})['catch'](function(_0x36edd7){logger[_0x6772('0x14')]('Migration,\x20%s,\x20%s',_0xe27108,_0x36edd7);_0x1443ad(_0x36edd7);});});}