cea5f95ed5c7b81aec81ba63445ce88cd8ede69d
[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 _0x8aaa=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8aaa,0x19f));var _0xa8aa=function(_0x5c027f,_0xa40135){_0x5c027f=_0x5c027f-0x0;var _0x5392f3=_0x8aaa[_0x5c027f];return _0x5392f3;};'use strict';var _=require('lodash');var util=require(_0xa8aa('0x0'));var moment=require(_0xa8aa('0x1'));var BPromise=require(_0xa8aa('0x2'));var rs=require(_0xa8aa('0x3'));var fs=require('fs');var Redis=require(_0xa8aa('0x4'));var db=require(_0xa8aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa8aa('0x6'));var config=require(_0xa8aa('0x7'));var jayson=require(_0xa8aa('0x8'));var client=jayson[_0xa8aa('0x9')][_0xa8aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x348505,_0x3e30fc,_0x1ee027){return new BPromise(function(_0x3d64a4,_0x55a14a){return client['request'](_0x348505,_0x1ee027)[_0xa8aa('0xb')](function(_0x17d622){logger[_0xa8aa('0xc')](_0xa8aa('0xd'),_0x3e30fc,_0xa8aa('0xe'));logger[_0xa8aa('0xf')](_0xa8aa('0x10'),_0x3e30fc,_0xa8aa('0xe'),JSON[_0xa8aa('0x11')](_0x17d622));if(_0x17d622[_0xa8aa('0x12')]){if(_0x17d622[_0xa8aa('0x12')][_0xa8aa('0x13')]===0x1f4){logger[_0xa8aa('0x12')](_0xa8aa('0xd'),_0x3e30fc,_0x17d622['error']['message']);return _0x55a14a(_0x17d622['error'][_0xa8aa('0x14')]);}logger[_0xa8aa('0x12')](_0xa8aa('0xd'),_0x3e30fc,_0x17d622[_0xa8aa('0x12')][_0xa8aa('0x14')]);return _0x3d64a4(_0x17d622[_0xa8aa('0x12')]['message']);}else{logger['info'](_0xa8aa('0xd'),_0x3e30fc,_0xa8aa('0xe'));_0x3d64a4(_0x17d622[_0xa8aa('0x15')][_0xa8aa('0x14')]);}})[_0xa8aa('0x16')](function(_0x5aa0d5){logger['error']('Migration,\x20%s,\x20%s',_0x3e30fc,_0x5aa0d5);_0x55a14a(_0x5aa0d5);});});}