Built motion from commit f623a78c.|2.6.31
[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 _0x4899=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','../../mysqldb'];(function(_0x26ac72,_0x482803){var _0x25fc90=function(_0x5f063c){while(--_0x5f063c){_0x26ac72['push'](_0x26ac72['shift']());}};_0x25fc90(++_0x482803);}(_0x4899,0x74));var _0x9489=function(_0x51b12e,_0x12d3b2){_0x51b12e=_0x51b12e-0x0;var _0x269639=_0x4899[_0x51b12e];return _0x269639;};'use strict';var _=require(_0x9489('0x0'));var util=require('util');var moment=require(_0x9489('0x1'));var BPromise=require('bluebird');var rs=require(_0x9489('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9489('0x3'))['db'];var utils=require(_0x9489('0x4'));var logger=require(_0x9489('0x5'))(_0x9489('0x6'));var config=require(_0x9489('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9489('0x8')][_0x9489('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x411ebe,_0x31e8c3,_0x574279){return new BPromise(function(_0x553c77,_0x1379eb){return client['request'](_0x411ebe,_0x574279)[_0x9489('0xa')](function(_0xb426d8){logger['info'](_0x9489('0xb'),_0x31e8c3,_0x9489('0xc'));logger[_0x9489('0xd')](_0x9489('0xe'),_0x31e8c3,_0x9489('0xc'),JSON[_0x9489('0xf')](_0xb426d8));if(_0xb426d8[_0x9489('0x10')]){if(_0xb426d8[_0x9489('0x10')]['code']===0x1f4){logger[_0x9489('0x10')](_0x9489('0xb'),_0x31e8c3,_0xb426d8[_0x9489('0x10')]['message']);return _0x1379eb(_0xb426d8['error'][_0x9489('0x11')]);}logger[_0x9489('0x10')](_0x9489('0xb'),_0x31e8c3,_0xb426d8['error'][_0x9489('0x11')]);return _0x553c77(_0xb426d8['error'][_0x9489('0x11')]);}else{logger['info'](_0x9489('0xb'),_0x31e8c3,_0x9489('0xc'));_0x553c77(_0xb426d8[_0x9489('0x12')][_0x9489('0x11')]);}})[_0x9489('0x13')](function(_0x4c1389){logger[_0x9489('0x10')]('Migration,\x20%s,\x20%s',_0x31e8c3,_0x4c1389);_0x1379eb(_0x4c1389);});});}