d2435d3d9a7cee21f99e29cd413677d89b1a28ba
[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 _0xf431=['Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2b9175,_0x3f30cc){var _0xd190c8=function(_0x33e5f5){while(--_0x33e5f5){_0x2b9175['push'](_0x2b9175['shift']());}};_0xd190c8(++_0x3f30cc);}(_0xf431,0x93));var _0x1f43=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0xf431[_0x49fcfb];return _0x964926;};'use strict';var _=require('lodash');var util=require(_0x1f43('0x0'));var moment=require(_0x1f43('0x1'));var BPromise=require(_0x1f43('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f43('0x3'));var db=require(_0x1f43('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f43('0x5'))(_0x1f43('0x6'));var config=require(_0x1f43('0x7'));var jayson=require(_0x1f43('0x8'));var client=jayson[_0x1f43('0x9')][_0x1f43('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48355a,_0x4c6b6d,_0x2e1e4e){return new BPromise(function(_0x184db8,_0x3c9c71){return client[_0x1f43('0xb')](_0x48355a,_0x2e1e4e)[_0x1f43('0xc')](function(_0x52157c){logger[_0x1f43('0xd')](_0x1f43('0xe'),_0x4c6b6d,_0x1f43('0xf'));logger[_0x1f43('0x10')](_0x1f43('0x11'),_0x4c6b6d,_0x1f43('0xf'),JSON[_0x1f43('0x12')](_0x52157c));if(_0x52157c['error']){if(_0x52157c[_0x1f43('0x13')]['code']===0x1f4){logger['error'](_0x1f43('0xe'),_0x4c6b6d,_0x52157c[_0x1f43('0x13')][_0x1f43('0x14')]);return _0x3c9c71(_0x52157c[_0x1f43('0x13')][_0x1f43('0x14')]);}logger[_0x1f43('0x13')](_0x1f43('0xe'),_0x4c6b6d,_0x52157c[_0x1f43('0x13')]['message']);return _0x184db8(_0x52157c[_0x1f43('0x13')][_0x1f43('0x14')]);}else{logger[_0x1f43('0xd')](_0x1f43('0xe'),_0x4c6b6d,_0x1f43('0xf'));_0x184db8(_0x52157c[_0x1f43('0x15')][_0x1f43('0x14')]);}})[_0x1f43('0x16')](function(_0x3866d3){logger[_0x1f43('0x13')](_0x1f43('0xe'),_0x4c6b6d,_0x3866d3);_0x3c9c71(_0x3866d3);});});}