cd26e0d1791090b73f42a266a06c00951c9b9118
[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 _0x6e16=['code','error','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x24a7df,_0x5949fe){var _0x492b5c=function(_0x5d6bb0){while(--_0x5d6bb0){_0x24a7df['push'](_0x24a7df['shift']());}};_0x492b5c(++_0x5949fe);}(_0x6e16,0x1d3));var _0x66e1=function(_0xac1c84,_0x374e50){_0xac1c84=_0xac1c84-0x0;var _0x19bf97=_0x6e16[_0xac1c84];return _0x19bf97;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x66e1('0x0'));var BPromise=require('bluebird');var rs=require(_0x66e1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66e1('0x2'))['db'];var utils=require(_0x66e1('0x3'));var logger=require('../../config/logger')(_0x66e1('0x4'));var config=require('../../config/environment');var jayson=require(_0x66e1('0x5'));var client=jayson[_0x66e1('0x6')][_0x66e1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d1175,_0x37dd64,_0x43b549){return new BPromise(function(_0x257ecd,_0x202c0d){return client[_0x66e1('0x8')](_0x5d1175,_0x43b549)[_0x66e1('0x9')](function(_0x2d5c1a){logger[_0x66e1('0xa')](_0x66e1('0xb'),_0x37dd64,_0x66e1('0xc'));logger[_0x66e1('0xd')](_0x66e1('0xe'),_0x37dd64,_0x66e1('0xc'),JSON[_0x66e1('0xf')](_0x2d5c1a));if(_0x2d5c1a['error']){if(_0x2d5c1a['error'][_0x66e1('0x10')]===0x1f4){logger[_0x66e1('0x11')](_0x66e1('0xb'),_0x37dd64,_0x2d5c1a['error']['message']);return _0x202c0d(_0x2d5c1a[_0x66e1('0x11')]['message']);}logger[_0x66e1('0x11')](_0x66e1('0xb'),_0x37dd64,_0x2d5c1a['error'][_0x66e1('0x12')]);return _0x257ecd(_0x2d5c1a[_0x66e1('0x11')]['message']);}else{logger[_0x66e1('0xa')](_0x66e1('0xb'),_0x37dd64,_0x66e1('0xc'));_0x257ecd(_0x2d5c1a[_0x66e1('0x13')]['message']);}})[_0x66e1('0x14')](function(_0x3e3d19){logger[_0x66e1('0x11')](_0x66e1('0xb'),_0x37dd64,_0x3e3d19);_0x202c0d(_0x3e3d19);});});}