f66cfe42ca8efcc3b6cbb8c05c261adb57646a1d
[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 _0xe630=['message','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xe630,0xb5));var _0x0e63=function(_0x319cd8,_0x1fc6e4){_0x319cd8=_0x319cd8-0x0;var _0x5b2306=_0xe630[_0x319cd8];return _0x5b2306;};'use strict';var _=require(_0x0e63('0x0'));var util=require('util');var moment=require(_0x0e63('0x1'));var BPromise=require('bluebird');var rs=require(_0x0e63('0x2'));var fs=require('fs');var Redis=require(_0x0e63('0x3'));var db=require(_0x0e63('0x4'))['db'];var utils=require(_0x0e63('0x5'));var logger=require(_0x0e63('0x6'))('rpc');var config=require(_0x0e63('0x7'));var jayson=require(_0x0e63('0x8'));var client=jayson[_0x0e63('0x9')][_0x0e63('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfa25c8,_0x3cd6f0,_0x4480d2){return new BPromise(function(_0x402b99,_0x1eca26){return client[_0x0e63('0xb')](_0xfa25c8,_0x4480d2)['then'](function(_0xab7d1){logger[_0x0e63('0xc')](_0x0e63('0xd'),_0x3cd6f0,_0x0e63('0xe'));logger['debug'](_0x0e63('0xf'),_0x3cd6f0,_0x0e63('0xe'),JSON[_0x0e63('0x10')](_0xab7d1));if(_0xab7d1[_0x0e63('0x11')]){if(_0xab7d1[_0x0e63('0x11')][_0x0e63('0x12')]===0x1f4){logger['error'](_0x0e63('0xd'),_0x3cd6f0,_0xab7d1[_0x0e63('0x11')][_0x0e63('0x13')]);return _0x1eca26(_0xab7d1[_0x0e63('0x11')][_0x0e63('0x13')]);}logger[_0x0e63('0x11')](_0x0e63('0xd'),_0x3cd6f0,_0xab7d1[_0x0e63('0x11')][_0x0e63('0x13')]);return _0x402b99(_0xab7d1['error'][_0x0e63('0x13')]);}else{logger['info'](_0x0e63('0xd'),_0x3cd6f0,_0x0e63('0xe'));_0x402b99(_0xab7d1['result'][_0x0e63('0x13')]);}})['catch'](function(_0x43f383){logger[_0x0e63('0x11')]('Migration,\x20%s,\x20%s',_0x3cd6f0,_0x43f383);_0x1eca26(_0x43f383);});});}