Built motion from commit e781dc3c.|2.5.42
[motion2.git] / server / api / mailApplication / mailApplication.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 _0x328f=['request\x20sent','stringify','error','code','message','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','then','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s'];(function(_0x31d3de,_0x323e54){var _0x19ea78=function(_0x5558db){while(--_0x5558db){_0x31d3de['push'](_0x31d3de['shift']());}};_0x19ea78(++_0x323e54);}(_0x328f,0xd4));var _0xf328=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x328f[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xf328('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf328('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf328('0x2'));var db=require(_0xf328('0x3'))['db'];var utils=require(_0xf328('0x4'));var logger=require(_0xf328('0x5'))(_0xf328('0x6'));var config=require(_0xf328('0x7'));var jayson=require(_0xf328('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ef061,_0x60c2e9,_0x790e64){return new BPromise(function(_0x2232e3,_0x4d9d4a){return client['request'](_0x5ef061,_0x790e64)['then'](function(_0x5c4354){logger['info'](_0xf328('0x9'),_0x60c2e9,'request\x20sent');logger[_0xf328('0xa')](_0xf328('0xb'),_0x60c2e9,_0xf328('0xc'),JSON[_0xf328('0xd')](_0x5c4354));if(_0x5c4354[_0xf328('0xe')]){if(_0x5c4354[_0xf328('0xe')][_0xf328('0xf')]===0x1f4){logger[_0xf328('0xe')](_0xf328('0x9'),_0x60c2e9,_0x5c4354['error']['message']);return _0x4d9d4a(_0x5c4354[_0xf328('0xe')][_0xf328('0x10')]);}logger[_0xf328('0xe')]('MailApplication,\x20%s,\x20%s',_0x60c2e9,_0x5c4354['error'][_0xf328('0x10')]);return _0x2232e3(_0x5c4354[_0xf328('0xe')][_0xf328('0x10')]);}else{logger['info'](_0xf328('0x9'),_0x60c2e9,'request\x20sent');_0x2232e3(_0x5c4354['result']['message']);}})['catch'](function(_0x4ec9e3){logger[_0xf328('0xe')](_0xf328('0x9'),_0x60c2e9,_0x4ec9e3);_0x4d9d4a(_0x4ec9e3);});});}exports[_0xf328('0x11')]=function(_0x41aabd){var _0x3c02c5=this;return new Promise(function(_0x7105af,_0x2acada){return db[_0xf328('0x12')][_0xf328('0x13')](_0x41aabd[_0xf328('0x14')],{'raw':_0x41aabd[_0xf328('0x15')]?_0x41aabd[_0xf328('0x15')][_0xf328('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41aabd[_0xf328('0x15')]?_0x41aabd[_0xf328('0x15')][_0xf328('0x17')]||null:null,'attributes':_0x41aabd[_0xf328('0x15')]?_0x41aabd[_0xf328('0x15')][_0xf328('0x18')]||null:null,'limit':_0x41aabd[_0xf328('0x15')]?_0x41aabd[_0xf328('0x15')][_0xf328('0x19')]||null:null})[_0xf328('0x1a')](function(_0x3cb1b8){logger['info'](_0xf328('0x11'),_0x41aabd);logger[_0xf328('0xa')](_0xf328('0x11'),_0x41aabd,JSON[_0xf328('0xd')](_0x3cb1b8));_0x7105af(_0x3cb1b8);})[_0xf328('0x1b')](function(_0x16112e){logger[_0xf328('0xe')](_0xf328('0x11'),_0x16112e[_0xf328('0x10')],_0x41aabd);_0x2acada(_0x3c02c5[_0xf328('0xe')](0x1f4,_0x16112e['message']));});});};