Built motion from commit (unavailable).|2.5.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 _0x00ff=['map','model','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include'];(function(_0x5302fb,_0x1a2db3){var _0x43e6a4=function(_0x324ae6){while(--_0x324ae6){_0x5302fb['push'](_0x5302fb['shift']());}};_0x43e6a4(++_0x1a2db3);}(_0x00ff,0x103));var _0xf00f=function(_0x59467b,_0x5da907){_0x59467b=_0x59467b-0x0;var _0x5d69da=_0x00ff[_0x59467b];return _0x5d69da;};'use strict';var _=require(_0xf00f('0x0'));var util=require(_0xf00f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf00f('0x2'));var fs=require('fs');var Redis=require(_0xf00f('0x3'));var db=require(_0xf00f('0x4'))['db'];var utils=require(_0xf00f('0x5'));var logger=require('../../config/logger')(_0xf00f('0x6'));var config=require('../../config/environment');var jayson=require(_0xf00f('0x7'));var client=jayson[_0xf00f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb4fae9,_0x382222,_0x3774d4){return new BPromise(function(_0x1351f4,_0x5609e7){return client[_0xf00f('0x9')](_0xb4fae9,_0x3774d4)['then'](function(_0x42f78a){logger[_0xf00f('0xa')]('MailServerIn,\x20%s,\x20%s',_0x382222,_0xf00f('0xb'));logger[_0xf00f('0xc')](_0xf00f('0xd'),_0x382222,_0xf00f('0xb'),JSON[_0xf00f('0xe')](_0x42f78a));if(_0x42f78a['error']){if(_0x42f78a[_0xf00f('0xf')]['code']===0x1f4){logger[_0xf00f('0xf')](_0xf00f('0x10'),_0x382222,_0x42f78a[_0xf00f('0xf')]['message']);return _0x5609e7(_0x42f78a[_0xf00f('0xf')][_0xf00f('0x11')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x382222,_0x42f78a['error'][_0xf00f('0x11')]);return _0x1351f4(_0x42f78a[_0xf00f('0xf')][_0xf00f('0x11')]);}else{logger[_0xf00f('0xa')](_0xf00f('0x10'),_0x382222,_0xf00f('0xb'));_0x1351f4(_0x42f78a[_0xf00f('0x12')]['message']);}})[_0xf00f('0x13')](function(_0x2840fc){logger[_0xf00f('0xf')](_0xf00f('0x10'),_0x382222,_0x2840fc);_0x5609e7(_0x2840fc);});});}exports[_0xf00f('0x14')]=function(_0x43f481){var _0x26e304=this;return new Promise(function(_0x203e1f,_0x246350){return db[_0xf00f('0x15')][_0xf00f('0x16')]({'raw':_0x43f481[_0xf00f('0x17')]?_0x43f481[_0xf00f('0x17')][_0xf00f('0x18')]===undefined?!![]:![]:!![],'where':_0x43f481[_0xf00f('0x17')]?_0x43f481[_0xf00f('0x17')][_0xf00f('0x19')]||null:null,'attributes':_0x43f481[_0xf00f('0x17')]?_0x43f481[_0xf00f('0x17')][_0xf00f('0x1a')]||null:null,'limit':_0x43f481[_0xf00f('0x17')]?_0x43f481[_0xf00f('0x17')][_0xf00f('0x1b')]||null:null,'include':_0x43f481['options']?_0x43f481[_0xf00f('0x17')]['include']?_['map'](_0x43f481['options']['include'],function(_0x4108b9){return{'model':db[_0x4108b9['model']],'as':_0x4108b9['as'],'attributes':_0x4108b9[_0xf00f('0x1a')],'include':_0x4108b9[_0xf00f('0x1c')]?_[_0xf00f('0x1d')](_0x4108b9[_0xf00f('0x1c')],function(_0x32add6){return{'model':db[_0x32add6[_0xf00f('0x1e')]],'as':_0x32add6['as'],'attributes':_0x32add6[_0xf00f('0x1a')],'include':_0x32add6[_0xf00f('0x1c')]?_[_0xf00f('0x1d')](_0x32add6[_0xf00f('0x1c')],function(_0x502093){return{'model':db[_0x502093['model']],'as':_0x502093['as'],'attributes':_0x502093[_0xf00f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf00f('0x1f')](function(_0xa3beb1){logger[_0xf00f('0xa')](_0xf00f('0x14'),_0x43f481);logger[_0xf00f('0xc')](_0xf00f('0x14'),_0x43f481,JSON[_0xf00f('0xe')](_0xa3beb1));_0x203e1f(_0xa3beb1);})[_0xf00f('0x13')](function(_0x18e1f8){logger['error']('GetMailServerIn',_0x18e1f8[_0xf00f('0x11')],_0x43f481);_0x246350(_0x26e304[_0xf00f('0xf')](0x1f4,_0x18e1f8[_0xf00f('0x11')]));});});};