4db248734f232eb4b092bb3fc819a5a613677894
[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 _0x7daf=['error','message','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0x7daf,0xaa));var _0xf7da=function(_0x13fdfc,_0xb197c7){_0x13fdfc=_0x13fdfc-0x0;var _0x377fbb=_0x7daf[_0x13fdfc];return _0x377fbb;};'use strict';var _=require('lodash');var util=require(_0xf7da('0x0'));var moment=require('moment');var BPromise=require(_0xf7da('0x1'));var rs=require(_0xf7da('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7da('0x3'))['db'];var utils=require(_0xf7da('0x4'));var logger=require(_0xf7da('0x5'))(_0xf7da('0x6'));var config=require(_0xf7da('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf7da('0x8')][_0xf7da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b35ec,_0x110cad,_0x2c70ad){return new BPromise(function(_0x468ca3,_0x53d71f){return client[_0xf7da('0xa')](_0x1b35ec,_0x2c70ad)[_0xf7da('0xb')](function(_0x326ff5){logger[_0xf7da('0xc')](_0xf7da('0xd'),_0x110cad,_0xf7da('0xe'));logger[_0xf7da('0xf')](_0xf7da('0x10'),_0x110cad,_0xf7da('0xe'),JSON[_0xf7da('0x11')](_0x326ff5));if(_0x326ff5['error']){if(_0x326ff5['error'][_0xf7da('0x12')]===0x1f4){logger[_0xf7da('0x13')](_0xf7da('0xd'),_0x110cad,_0x326ff5[_0xf7da('0x13')][_0xf7da('0x14')]);return _0x53d71f(_0x326ff5[_0xf7da('0x13')]['message']);}logger[_0xf7da('0x13')](_0xf7da('0xd'),_0x110cad,_0x326ff5['error'][_0xf7da('0x14')]);return _0x468ca3(_0x326ff5[_0xf7da('0x13')][_0xf7da('0x14')]);}else{logger[_0xf7da('0xc')](_0xf7da('0xd'),_0x110cad,_0xf7da('0xe'));_0x468ca3(_0x326ff5['result']['message']);}})['catch'](function(_0x39d9c0){logger[_0xf7da('0x13')](_0xf7da('0xd'),_0x110cad,_0x39d9c0);_0x53d71f(_0x39d9c0);});});}