Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / mailServerIn / mailServerIn.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 _0x711c=['info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','include','map','model','debug','stringify','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x711c,0x74));var _0xc711=function(_0x160426,_0x13c7ff){_0x160426=_0x160426-0x0;var _0x649ad0=_0x711c[_0x160426];return _0x649ad0;};'use strict';var _=require(_0xc711('0x0'));var util=require(_0xc711('0x1'));var moment=require('moment');var BPromise=require(_0xc711('0x2'));var rs=require(_0xc711('0x3'));var fs=require('fs');var Redis=require(_0xc711('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc711('0x5'));var config=require(_0xc711('0x6'));var jayson=require(_0xc711('0x7'));var client=jayson[_0xc711('0x8')][_0xc711('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2181f5,_0x5b1833,_0x33181a){return new BPromise(function(_0xdcca20,_0xf860b7){return client[_0xc711('0xa')](_0x2181f5,_0x33181a)[_0xc711('0xb')](function(_0x4cc6c4){logger[_0xc711('0xc')](_0xc711('0xd'),_0x5b1833,_0xc711('0xe'));logger['debug'](_0xc711('0xf'),_0x5b1833,_0xc711('0xe'),JSON['stringify'](_0x4cc6c4));if(_0x4cc6c4[_0xc711('0x10')]){if(_0x4cc6c4['error'][_0xc711('0x11')]===0x1f4){logger[_0xc711('0x10')](_0xc711('0xd'),_0x5b1833,_0x4cc6c4[_0xc711('0x10')]['message']);return _0xf860b7(_0x4cc6c4['error']['message']);}logger[_0xc711('0x10')](_0xc711('0xd'),_0x5b1833,_0x4cc6c4[_0xc711('0x10')][_0xc711('0x12')]);return _0xdcca20(_0x4cc6c4[_0xc711('0x10')][_0xc711('0x12')]);}else{logger[_0xc711('0xc')](_0xc711('0xd'),_0x5b1833,_0xc711('0xe'));_0xdcca20(_0x4cc6c4[_0xc711('0x13')]['message']);}})[_0xc711('0x14')](function(_0x3bcd5a){logger[_0xc711('0x10')](_0xc711('0xd'),_0x5b1833,_0x3bcd5a);_0xf860b7(_0x3bcd5a);});});}exports[_0xc711('0x15')]=function(_0x1b354d){var _0x74f4d6=this;return new Promise(function(_0x733232,_0x1e234a){return db[_0xc711('0x16')][_0xc711('0x17')]({'raw':_0x1b354d['options']?_0x1b354d[_0xc711('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1b354d['options']?_0x1b354d[_0xc711('0x18')][_0xc711('0x19')]||null:null,'attributes':_0x1b354d[_0xc711('0x18')]?_0x1b354d['options'][_0xc711('0x1a')]||null:null,'limit':_0x1b354d[_0xc711('0x18')]?_0x1b354d['options']['limit']||null:null,'include':_0x1b354d['options']?_0x1b354d[_0xc711('0x18')][_0xc711('0x1b')]?_[_0xc711('0x1c')](_0x1b354d[_0xc711('0x18')][_0xc711('0x1b')],function(_0x3389e2){return{'model':db[_0x3389e2[_0xc711('0x1d')]],'as':_0x3389e2['as'],'attributes':_0x3389e2[_0xc711('0x1a')],'include':_0x3389e2[_0xc711('0x1b')]?_[_0xc711('0x1c')](_0x3389e2[_0xc711('0x1b')],function(_0x4b9239){return{'model':db[_0x4b9239[_0xc711('0x1d')]],'as':_0x4b9239['as'],'attributes':_0x4b9239[_0xc711('0x1a')],'include':_0x4b9239[_0xc711('0x1b')]?_['map'](_0x4b9239['include'],function(_0x4a4ff1){return{'model':db[_0x4a4ff1[_0xc711('0x1d')]],'as':_0x4a4ff1['as'],'attributes':_0x4a4ff1[_0xc711('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51ad14){logger[_0xc711('0xc')](_0xc711('0x15'),_0x1b354d);logger[_0xc711('0x1e')]('GetMailServerIn',_0x1b354d,JSON[_0xc711('0x1f')](_0x51ad14));_0x733232(_0x51ad14);})[_0xc711('0x14')](function(_0x42f7d8){logger[_0xc711('0x10')](_0xc711('0x15'),_0x42f7d8[_0xc711('0x12')],_0x1b354d);_0x1e234a(_0x74f4d6['error'](0x1f4,_0x42f7d8['message']));});});};