Built motion from commit (unavailable).|2.5.12
[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 _0xc69d=['util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','limit','include','map','model','attributes','lodash'];(function(_0x3999ac,_0x56f9d4){var _0x4a73e7=function(_0x3a081c){while(--_0x3a081c){_0x3999ac['push'](_0x3999ac['shift']());}};_0x4a73e7(++_0x56f9d4);}(_0xc69d,0x9a));var _0xdc69=function(_0x1e1020,_0xd64a27){_0x1e1020=_0x1e1020-0x0;var _0x464719=_0xc69d[_0x1e1020];return _0x464719;};'use strict';var _=require(_0xdc69('0x0'));var util=require(_0xdc69('0x1'));var moment=require(_0xdc69('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc69('0x3'))['db'];var utils=require(_0xdc69('0x4'));var logger=require('../../config/logger')(_0xdc69('0x5'));var config=require(_0xdc69('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdc69('0x7')][_0xdc69('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x170a59,_0x5eaeb3,_0x10b1ae){return new BPromise(function(_0x1b41fa,_0x2e5dd7){return client[_0xdc69('0x9')](_0x170a59,_0x10b1ae)[_0xdc69('0xa')](function(_0xf9e2ed){logger[_0xdc69('0xb')](_0xdc69('0xc'),_0x5eaeb3,_0xdc69('0xd'));logger[_0xdc69('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x5eaeb3,_0xdc69('0xd'),JSON[_0xdc69('0xf')](_0xf9e2ed));if(_0xf9e2ed['error']){if(_0xf9e2ed[_0xdc69('0x10')][_0xdc69('0x11')]===0x1f4){logger[_0xdc69('0x10')](_0xdc69('0xc'),_0x5eaeb3,_0xf9e2ed[_0xdc69('0x10')][_0xdc69('0x12')]);return _0x2e5dd7(_0xf9e2ed['error'][_0xdc69('0x12')]);}logger['error'](_0xdc69('0xc'),_0x5eaeb3,_0xf9e2ed[_0xdc69('0x10')][_0xdc69('0x12')]);return _0x1b41fa(_0xf9e2ed['error']['message']);}else{logger[_0xdc69('0xb')](_0xdc69('0xc'),_0x5eaeb3,_0xdc69('0xd'));_0x1b41fa(_0xf9e2ed[_0xdc69('0x13')][_0xdc69('0x12')]);}})[_0xdc69('0x14')](function(_0x248110){logger[_0xdc69('0x10')](_0xdc69('0xc'),_0x5eaeb3,_0x248110);_0x2e5dd7(_0x248110);});});}exports[_0xdc69('0x15')]=function(_0x403bf7){var _0xe2df5d=this;return new Promise(function(_0x359a55,_0x58ad9b){return db[_0xdc69('0x16')]['findAll']({'raw':_0x403bf7[_0xdc69('0x17')]?_0x403bf7[_0xdc69('0x17')][_0xdc69('0x18')]===undefined?!![]:![]:!![],'where':_0x403bf7[_0xdc69('0x17')]?_0x403bf7[_0xdc69('0x17')][_0xdc69('0x19')]||null:null,'attributes':_0x403bf7[_0xdc69('0x17')]?_0x403bf7[_0xdc69('0x17')]['attributes']||null:null,'limit':_0x403bf7[_0xdc69('0x17')]?_0x403bf7['options'][_0xdc69('0x1a')]||null:null,'include':_0x403bf7['options']?_0x403bf7['options'][_0xdc69('0x1b')]?_[_0xdc69('0x1c')](_0x403bf7[_0xdc69('0x17')][_0xdc69('0x1b')],function(_0x9ba4a4){return{'model':db[_0x9ba4a4[_0xdc69('0x1d')]],'as':_0x9ba4a4['as'],'attributes':_0x9ba4a4['attributes'],'include':_0x9ba4a4[_0xdc69('0x1b')]?_[_0xdc69('0x1c')](_0x9ba4a4[_0xdc69('0x1b')],function(_0x3e3e4c){return{'model':db[_0x3e3e4c[_0xdc69('0x1d')]],'as':_0x3e3e4c['as'],'attributes':_0x3e3e4c[_0xdc69('0x1e')],'include':_0x3e3e4c[_0xdc69('0x1b')]?_['map'](_0x3e3e4c[_0xdc69('0x1b')],function(_0x389aca){return{'model':db[_0x389aca['model']],'as':_0x389aca['as'],'attributes':_0x389aca[_0xdc69('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdc69('0xa')](function(_0x4bfa96){logger[_0xdc69('0xb')]('GetMailServerIn',_0x403bf7);logger[_0xdc69('0xe')](_0xdc69('0x15'),_0x403bf7,JSON[_0xdc69('0xf')](_0x4bfa96));_0x359a55(_0x4bfa96);})[_0xdc69('0x14')](function(_0xe003f4){logger['error'](_0xdc69('0x15'),_0xe003f4[_0xdc69('0x12')],_0x403bf7);_0x58ad9b(_0xe2df5d[_0xdc69('0x10')](0x1f4,_0xe003f4[_0xdc69('0x12')]));});});};