Built motion from commit (unavailable).|2.0.71
[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 _0x31ef=['../../config/utils','rpc','client','http','request','then','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Migration,\x20%s,\x20%s','message','info','lodash','util','moment','randomstring'];(function(_0x5f0432,_0x2b29c8){var _0x48eb08=function(_0x1abf0c){while(--_0x1abf0c){_0x5f0432['push'](_0x5f0432['shift']());}};_0x48eb08(++_0x2b29c8);}(_0x31ef,0x18b));var _0xf31e=function(_0x39e133,_0x1ead5c){_0x39e133=_0x39e133-0x0;var _0x8c07aa=_0x31ef[_0x39e133];return _0x8c07aa;};'use strict';var _=require(_0xf31e('0x0'));var util=require(_0xf31e('0x1'));var moment=require(_0xf31e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf31e('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xf31e('0x4'));var logger=require('../../config/logger')(_0xf31e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf31e('0x6')][_0xf31e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x49f0be,_0x3a20ac,_0x270616){return new BPromise(function(_0x3cf218,_0xaaa374){return client[_0xf31e('0x8')](_0x49f0be,_0x270616)[_0xf31e('0x9')](function(_0x1cc2e4){logger['info']('Migration,\x20%s,\x20%s',_0x3a20ac,'request\x20sent');logger[_0xf31e('0xa')](_0xf31e('0xb'),_0x3a20ac,_0xf31e('0xc'),JSON[_0xf31e('0xd')](_0x1cc2e4));if(_0x1cc2e4[_0xf31e('0xe')]){if(_0x1cc2e4[_0xf31e('0xe')][_0xf31e('0xf')]===0x1f4){logger[_0xf31e('0xe')](_0xf31e('0x10'),_0x3a20ac,_0x1cc2e4[_0xf31e('0xe')][_0xf31e('0x11')]);return _0xaaa374(_0x1cc2e4[_0xf31e('0xe')][_0xf31e('0x11')]);}logger[_0xf31e('0xe')](_0xf31e('0x10'),_0x3a20ac,_0x1cc2e4[_0xf31e('0xe')][_0xf31e('0x11')]);return _0x3cf218(_0x1cc2e4['error']['message']);}else{logger[_0xf31e('0x12')](_0xf31e('0x10'),_0x3a20ac,_0xf31e('0xc'));_0x3cf218(_0x1cc2e4['result'][_0xf31e('0x11')]);}})['catch'](function(_0x2e7a9f){logger[_0xf31e('0xe')]('Migration,\x20%s,\x20%s',_0x3a20ac,_0x2e7a9f);_0xaaa374(_0x2e7a9f);});});}