Built motion from commit (unavailable).|2.5.22
[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 _0x9137=['request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s'];(function(_0x54eddb,_0x5c27e0){var _0x12002b=function(_0x127559){while(--_0x127559){_0x54eddb['push'](_0x54eddb['shift']());}};_0x12002b(++_0x5c27e0);}(_0x9137,0x7b));var _0x7913=function(_0x4adce1,_0x41d240){_0x4adce1=_0x4adce1-0x0;var _0x9110fa=_0x9137[_0x4adce1];return _0x9110fa;};'use strict';var _=require(_0x7913('0x0'));var util=require(_0x7913('0x1'));var moment=require(_0x7913('0x2'));var BPromise=require(_0x7913('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7913('0x4'));var db=require(_0x7913('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7913('0x6'))(_0x7913('0x7'));var config=require('../../config/environment');var jayson=require(_0x7913('0x8'));var client=jayson[_0x7913('0x9')][_0x7913('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e99c,_0x1226f2,_0x37f46b){return new BPromise(function(_0x479929,_0x38abbe){return client[_0x7913('0xb')](_0x45e99c,_0x37f46b)[_0x7913('0xc')](function(_0x52b5ef){logger[_0x7913('0xd')](_0x7913('0xe'),_0x1226f2,_0x7913('0xf'));logger['debug'](_0x7913('0x10'),_0x1226f2,'request\x20sent',JSON[_0x7913('0x11')](_0x52b5ef));if(_0x52b5ef['error']){if(_0x52b5ef[_0x7913('0x12')][_0x7913('0x13')]===0x1f4){logger['error'](_0x7913('0xe'),_0x1226f2,_0x52b5ef[_0x7913('0x12')][_0x7913('0x14')]);return _0x38abbe(_0x52b5ef[_0x7913('0x12')][_0x7913('0x14')]);}logger[_0x7913('0x12')](_0x7913('0xe'),_0x1226f2,_0x52b5ef[_0x7913('0x12')][_0x7913('0x14')]);return _0x479929(_0x52b5ef[_0x7913('0x12')][_0x7913('0x14')]);}else{logger[_0x7913('0xd')]('Migration,\x20%s,\x20%s',_0x1226f2,_0x7913('0xf'));_0x479929(_0x52b5ef[_0x7913('0x15')][_0x7913('0x14')]);}})[_0x7913('0x16')](function(_0x1ef8ca){logger[_0x7913('0x12')](_0x7913('0xe'),_0x1226f2,_0x1ef8ca);_0x38abbe(_0x1ef8ca);});});}