731080914d32fc640252e2e12e42a124c642264c
[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 _0xf81a=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x240859,_0x19b70f){var _0x19aad1=function(_0x328e5b){while(--_0x328e5b){_0x240859['push'](_0x240859['shift']());}};_0x19aad1(++_0x19b70f);}(_0xf81a,0x16b));var _0xaf81=function(_0x5e8e91,_0x289fcb){_0x5e8e91=_0x5e8e91-0x0;var _0x27fcd9=_0xf81a[_0x5e8e91];return _0x27fcd9;};'use strict';var _=require(_0xaf81('0x0'));var util=require(_0xaf81('0x1'));var moment=require(_0xaf81('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf81('0x3'));var fs=require('fs');var Redis=require(_0xaf81('0x4'));var db=require(_0xaf81('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf81('0x6'))(_0xaf81('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf81('0x8'));var client=jayson[_0xaf81('0x9')][_0xaf81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cfd36,_0x268973,_0x365b31){return new BPromise(function(_0x4c3052,_0x3f0ac8){return client[_0xaf81('0xb')](_0x5cfd36,_0x365b31)[_0xaf81('0xc')](function(_0x3efaaf){logger['info'](_0xaf81('0xd'),_0x268973,_0xaf81('0xe'));logger[_0xaf81('0xf')](_0xaf81('0x10'),_0x268973,_0xaf81('0xe'),JSON[_0xaf81('0x11')](_0x3efaaf));if(_0x3efaaf['error']){if(_0x3efaaf['error'][_0xaf81('0x12')]===0x1f4){logger['error'](_0xaf81('0xd'),_0x268973,_0x3efaaf[_0xaf81('0x13')][_0xaf81('0x14')]);return _0x3f0ac8(_0x3efaaf[_0xaf81('0x13')]['message']);}logger[_0xaf81('0x13')](_0xaf81('0xd'),_0x268973,_0x3efaaf[_0xaf81('0x13')][_0xaf81('0x14')]);return _0x4c3052(_0x3efaaf[_0xaf81('0x13')]['message']);}else{logger[_0xaf81('0x15')](_0xaf81('0xd'),_0x268973,'request\x20sent');_0x4c3052(_0x3efaaf[_0xaf81('0x16')][_0xaf81('0x14')]);}})[_0xaf81('0x17')](function(_0x508df4){logger[_0xaf81('0x13')](_0xaf81('0xd'),_0x268973,_0x508df4);_0x3f0ac8(_0x508df4);});});}