b1f1099d5c30a33b188c75d4c4cd1cd1b6a46763
[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 _0x6f54=['request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Migration,\x20%s,\x20%s'];(function(_0xec389d,_0x167bfb){var _0x206197=function(_0x5687e2){while(--_0x5687e2){_0xec389d['push'](_0xec389d['shift']());}};_0x206197(++_0x167bfb);}(_0x6f54,0xcf));var _0x46f5=function(_0x1c81be,_0x38517f){_0x1c81be=_0x1c81be-0x0;var _0x3be677=_0x6f54[_0x1c81be];return _0x3be677;};'use strict';var _=require(_0x46f5('0x0'));var util=require(_0x46f5('0x1'));var moment=require(_0x46f5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46f5('0x3'));var db=require(_0x46f5('0x4'))['db'];var utils=require(_0x46f5('0x5'));var logger=require(_0x46f5('0x6'))('rpc');var config=require(_0x46f5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x46f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x576e52,_0x30d52f,_0x2ef094){return new BPromise(function(_0x227a68,_0x3a2939){return client[_0x46f5('0x9')](_0x576e52,_0x2ef094)[_0x46f5('0xa')](function(_0x927efa){logger[_0x46f5('0xb')](_0x46f5('0xc'),_0x30d52f,_0x46f5('0xd'));logger[_0x46f5('0xe')](_0x46f5('0xf'),_0x30d52f,_0x46f5('0xd'),JSON[_0x46f5('0x10')](_0x927efa));if(_0x927efa['error']){if(_0x927efa[_0x46f5('0x11')][_0x46f5('0x12')]===0x1f4){logger[_0x46f5('0x11')]('Migration,\x20%s,\x20%s',_0x30d52f,_0x927efa[_0x46f5('0x11')][_0x46f5('0x13')]);return _0x3a2939(_0x927efa['error'][_0x46f5('0x13')]);}logger[_0x46f5('0x11')](_0x46f5('0xc'),_0x30d52f,_0x927efa[_0x46f5('0x11')]['message']);return _0x227a68(_0x927efa['error'][_0x46f5('0x13')]);}else{logger[_0x46f5('0xb')](_0x46f5('0xc'),_0x30d52f,_0x46f5('0xd'));_0x227a68(_0x927efa[_0x46f5('0x14')][_0x46f5('0x13')]);}})[_0x46f5('0x15')](function(_0x444756){logger[_0x46f5('0x11')](_0x46f5('0xc'),_0x30d52f,_0x444756);_0x3a2939(_0x444756);});});}