753ecd0ad79ce5486fc7d6062bd58bdd8b335eb4
[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 _0x9090=['jayson/promise','client','http','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','Migration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0xfee10f,_0x53470e){var _0xb91051=function(_0x3c6d81){while(--_0x3c6d81){_0xfee10f['push'](_0xfee10f['shift']());}};_0xb91051(++_0x53470e);}(_0x9090,0x17f));var _0x0909=function(_0x495059,_0x58adfe){_0x495059=_0x495059-0x0;var _0x42b82a=_0x9090[_0x495059];return _0x42b82a;};'use strict';var _=require(_0x0909('0x0'));var util=require(_0x0909('0x1'));var moment=require(_0x0909('0x2'));var BPromise=require(_0x0909('0x3'));var rs=require(_0x0909('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0909('0x5'));var logger=require(_0x0909('0x6'))(_0x0909('0x7'));var config=require('../../config/environment');var jayson=require(_0x0909('0x8'));var client=jayson[_0x0909('0x9')][_0x0909('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41d8fc,_0x26dfbe,_0x32bf48){return new BPromise(function(_0x1755ee,_0x571b3c){return client[_0x0909('0xb')](_0x41d8fc,_0x32bf48)[_0x0909('0xc')](function(_0x4f961d){logger[_0x0909('0xd')]('Migration,\x20%s,\x20%s',_0x26dfbe,_0x0909('0xe'));logger[_0x0909('0xf')](_0x0909('0x10'),_0x26dfbe,_0x0909('0xe'),JSON['stringify'](_0x4f961d));if(_0x4f961d[_0x0909('0x11')]){if(_0x4f961d[_0x0909('0x11')][_0x0909('0x12')]===0x1f4){logger[_0x0909('0x11')]('Migration,\x20%s,\x20%s',_0x26dfbe,_0x4f961d[_0x0909('0x11')][_0x0909('0x13')]);return _0x571b3c(_0x4f961d[_0x0909('0x11')][_0x0909('0x13')]);}logger[_0x0909('0x11')](_0x0909('0x14'),_0x26dfbe,_0x4f961d[_0x0909('0x11')][_0x0909('0x13')]);return _0x1755ee(_0x4f961d[_0x0909('0x11')][_0x0909('0x13')]);}else{logger['info'](_0x0909('0x14'),_0x26dfbe,_0x0909('0xe'));_0x1755ee(_0x4f961d[_0x0909('0x15')][_0x0909('0x13')]);}})[_0x0909('0x16')](function(_0x1d68cd){logger[_0x0909('0x11')](_0x0909('0x14'),_0x26dfbe,_0x1d68cd);_0x571b3c(_0x1d68cd);});});}