026e4fbcb0290a208cc64d07e159d833d984a6e6
[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 _0x8d92=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0x8d92,0x13c));var _0x28d9=function(_0x585b83,_0x25d403){_0x585b83=_0x585b83-0x0;var _0x2faa24=_0x8d92[_0x585b83];return _0x2faa24;};'use strict';var _=require(_0x28d9('0x0'));var util=require(_0x28d9('0x1'));var moment=require(_0x28d9('0x2'));var BPromise=require(_0x28d9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28d9('0x4'));var db=require(_0x28d9('0x5'))['db'];var utils=require(_0x28d9('0x6'));var logger=require(_0x28d9('0x7'))(_0x28d9('0x8'));var config=require(_0x28d9('0x9'));var jayson=require(_0x28d9('0xa'));var client=jayson[_0x28d9('0xb')][_0x28d9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46a979,_0x2e7a8f,_0x4e3c16){return new BPromise(function(_0x50c129,_0x208b9c){return client[_0x28d9('0xd')](_0x46a979,_0x4e3c16)[_0x28d9('0xe')](function(_0x3decde){logger['info']('Migration,\x20%s,\x20%s',_0x2e7a8f,_0x28d9('0xf'));logger[_0x28d9('0x10')](_0x28d9('0x11'),_0x2e7a8f,_0x28d9('0xf'),JSON[_0x28d9('0x12')](_0x3decde));if(_0x3decde['error']){if(_0x3decde[_0x28d9('0x13')][_0x28d9('0x14')]===0x1f4){logger[_0x28d9('0x13')](_0x28d9('0x15'),_0x2e7a8f,_0x3decde[_0x28d9('0x13')][_0x28d9('0x16')]);return _0x208b9c(_0x3decde['error'][_0x28d9('0x16')]);}logger['error'](_0x28d9('0x15'),_0x2e7a8f,_0x3decde[_0x28d9('0x13')]['message']);return _0x50c129(_0x3decde['error'][_0x28d9('0x16')]);}else{logger['info'](_0x28d9('0x15'),_0x2e7a8f,'request\x20sent');_0x50c129(_0x3decde[_0x28d9('0x17')][_0x28d9('0x16')]);}})[_0x28d9('0x18')](function(_0x51b5ba){logger[_0x28d9('0x13')]('Migration,\x20%s,\x20%s',_0x2e7a8f,_0x51b5ba);_0x208b9c(_0x51b5ba);});});}