1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0x3ae9=['then','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','Migration,\x20%s,\x20%s','message','info','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x50f1c5,_0x564b0d){var _0x302741=function(_0x49f3fd){while(--_0x49f3fd){_0x50f1c5['push'](_0x50f1c5['shift']());}};_0x302741(++_0x564b0d);}(_0x3ae9,0xdb));var _0x93ae=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x3ae9[_0x2ec461];return _0x28603d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x93ae('0x0'));var BPromise=require(_0x93ae('0x1'));var rs=require(_0x93ae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93ae('0x3'))['db'];var utils=require(_0x93ae('0x4'));var logger=require(_0x93ae('0x5'))(_0x93ae('0x6'));var config=require('../../config/environment');var jayson=require(_0x93ae('0x7'));var client=jayson['client'][_0x93ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32564c,_0x2a0972,_0x36e141){return new BPromise(function(_0x22761c,_0x354bf9){return client['request'](_0x32564c,_0x36e141)[_0x93ae('0x9')](function(_0x4ac4b0){logger['info']('Migration,\x20%s,\x20%s',_0x2a0972,_0x93ae('0xa'));logger[_0x93ae('0xb')](_0x93ae('0xc'),_0x2a0972,_0x93ae('0xa'),JSON[_0x93ae('0xd')](_0x4ac4b0));if(_0x4ac4b0[_0x93ae('0xe')]){if(_0x4ac4b0['error']['code']===0x1f4){logger[_0x93ae('0xe')](_0x93ae('0xf'),_0x2a0972,_0x4ac4b0['error']['message']);return _0x354bf9(_0x4ac4b0[_0x93ae('0xe')]['message']);}logger[_0x93ae('0xe')](_0x93ae('0xf'),_0x2a0972,_0x4ac4b0['error'][_0x93ae('0x10')]);return _0x22761c(_0x4ac4b0[_0x93ae('0xe')][_0x93ae('0x10')]);}else{logger[_0x93ae('0x11')](_0x93ae('0xf'),_0x2a0972,_0x93ae('0xa'));_0x22761c(_0x4ac4b0['result'][_0x93ae('0x10')]);}})[_0x93ae('0x12')](function(_0x129e44){logger['error'](_0x93ae('0xf'),_0x2a0972,_0x129e44);_0x354bf9(_0x129e44);});});}