Built motion from commit 19a84241.|2.5.34
[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 _0xdb76=['Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x458513,_0x2180b8){var _0x3898d4=function(_0xc34b99){while(--_0xc34b99){_0x458513['push'](_0x458513['shift']());}};_0x3898d4(++_0x2180b8);}(_0xdb76,0x1be));var _0x6db7=function(_0x15a668,_0xa4bd6b){_0x15a668=_0x15a668-0x0;var _0x13f41a=_0xdb76[_0x15a668];return _0x13f41a;};'use strict';var _=require(_0x6db7('0x0'));var util=require(_0x6db7('0x1'));var moment=require(_0x6db7('0x2'));var BPromise=require(_0x6db7('0x3'));var rs=require(_0x6db7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6db7('0x5'))['db'];var utils=require(_0x6db7('0x6'));var logger=require(_0x6db7('0x7'))(_0x6db7('0x8'));var config=require('../../config/environment');var jayson=require(_0x6db7('0x9'));var client=jayson[_0x6db7('0xa')][_0x6db7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x417e71,_0x3b7b8a,_0x58f6e4){return new BPromise(function(_0x1c7f92,_0x3df405){return client['request'](_0x417e71,_0x58f6e4)[_0x6db7('0xc')](function(_0x40735e){logger[_0x6db7('0xd')](_0x6db7('0xe'),_0x3b7b8a,_0x6db7('0xf'));logger[_0x6db7('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x3b7b8a,'request\x20sent',JSON[_0x6db7('0x11')](_0x40735e));if(_0x40735e[_0x6db7('0x12')]){if(_0x40735e['error'][_0x6db7('0x13')]===0x1f4){logger[_0x6db7('0x12')](_0x6db7('0xe'),_0x3b7b8a,_0x40735e[_0x6db7('0x12')][_0x6db7('0x14')]);return _0x3df405(_0x40735e[_0x6db7('0x12')]['message']);}logger['error'](_0x6db7('0xe'),_0x3b7b8a,_0x40735e[_0x6db7('0x12')][_0x6db7('0x14')]);return _0x1c7f92(_0x40735e[_0x6db7('0x12')][_0x6db7('0x14')]);}else{logger[_0x6db7('0xd')](_0x6db7('0xe'),_0x3b7b8a,_0x6db7('0xf'));_0x1c7f92(_0x40735e[_0x6db7('0x15')][_0x6db7('0x14')]);}})[_0x6db7('0x16')](function(_0x3ba044){logger['error'](_0x6db7('0xe'),_0x3b7b8a,_0x3ba044);_0x3df405(_0x3ba044);});});}