Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / api / intServicenowAccount / intServicenowAccount.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 _0xb70f=['GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowServicenowAccount','lodash','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xb70f,0x102));var _0xfb70=function(_0x50791e,_0xfa3b8f){_0x50791e=_0x50791e-0x0;var _0x4c0750=_0xb70f[_0x50791e];return _0x4c0750;};'use strict';var _=require(_0xfb70('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfb70('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfb70('0x2'));var logger=require(_0xfb70('0x3'))(_0xfb70('0x4'));var config=require(_0xfb70('0x5'));var jayson=require(_0xfb70('0x6'));var client=jayson[_0xfb70('0x7')][_0xfb70('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f1a5c,_0x559f7e,_0x2abf27){return new BPromise(function(_0x5d6125,_0x1ae573){return client[_0xfb70('0x9')](_0x1f1a5c,_0x2abf27)[_0xfb70('0xa')](function(_0x4f43a6){logger[_0xfb70('0xb')](_0xfb70('0xc'),_0x559f7e,_0xfb70('0xd'));logger[_0xfb70('0xe')](_0xfb70('0xf'),_0x559f7e,_0xfb70('0xd'),JSON[_0xfb70('0x10')](_0x4f43a6));if(_0x4f43a6[_0xfb70('0x11')]){if(_0x4f43a6['error'][_0xfb70('0x12')]===0x1f4){logger[_0xfb70('0x11')](_0xfb70('0xc'),_0x559f7e,_0x4f43a6[_0xfb70('0x11')][_0xfb70('0x13')]);return _0x1ae573(_0x4f43a6['error']['message']);}logger[_0xfb70('0x11')](_0xfb70('0xc'),_0x559f7e,_0x4f43a6[_0xfb70('0x11')][_0xfb70('0x13')]);return _0x5d6125(_0x4f43a6['error'][_0xfb70('0x13')]);}else{logger[_0xfb70('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x559f7e,'request\x20sent');_0x5d6125(_0x4f43a6[_0xfb70('0x14')][_0xfb70('0x13')]);}})[_0xfb70('0x15')](function(_0x5a5988){logger[_0xfb70('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x559f7e,_0x5a5988);_0x1ae573(_0x5a5988);});});}exports[_0xfb70('0x16')]=function(_0x302423){var _0x8ce62d=this;return new Promise(function(_0x4f4ad1,_0x1e7d86){return db[_0xfb70('0x17')][_0xfb70('0x18')]({'raw':_0x302423['options']?_0x302423[_0xfb70('0x19')][_0xfb70('0x1a')]===undefined?!![]:![]:!![],'where':_0x302423['options']?_0x302423[_0xfb70('0x19')][_0xfb70('0x1b')]||null:null,'attributes':_0x302423[_0xfb70('0x19')]?_0x302423[_0xfb70('0x19')][_0xfb70('0x1c')]||null:null,'limit':_0x302423[_0xfb70('0x19')]?_0x302423[_0xfb70('0x19')][_0xfb70('0x1d')]||null:null,'include':_0x302423[_0xfb70('0x19')]?_0x302423[_0xfb70('0x19')][_0xfb70('0x1e')]?_[_0xfb70('0x1f')](_0x302423['options'][_0xfb70('0x1e')],function(_0x5896e8){return{'model':db[_0x5896e8['model']],'as':_0x5896e8['as'],'attributes':_0x5896e8[_0xfb70('0x1c')],'include':_0x5896e8[_0xfb70('0x1e')]?_[_0xfb70('0x1f')](_0x5896e8[_0xfb70('0x1e')],function(_0x5af499){return{'model':db[_0x5af499['model']],'as':_0x5af499['as'],'attributes':_0x5af499['attributes'],'include':_0x5af499[_0xfb70('0x1e')]?_['map'](_0x5af499['include'],function(_0xb57e7b){return{'model':db[_0xb57e7b[_0xfb70('0x20')]],'as':_0xb57e7b['as'],'attributes':_0xb57e7b[_0xfb70('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfb70('0xa')](function(_0x49611f){logger[_0xfb70('0xb')](_0xfb70('0x16'),_0x302423);logger[_0xfb70('0xe')](_0xfb70('0x16'),_0x302423,JSON['stringify'](_0x49611f));_0x4f4ad1(_0x49611f);})[_0xfb70('0x15')](function(_0x144936){logger[_0xfb70('0x11')](_0xfb70('0x16'),_0x144936['message'],_0x302423);_0x1e7d86(_0x8ce62d[_0xfb70('0x11')](0x1f4,_0x144936[_0xfb70('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x9fcb9c){var _0xc0aa68=this;return new Promise(function(_0x53d686,_0x449a99){return db[_0xfb70('0x17')][_0xfb70('0x21')]({'raw':_0x9fcb9c[_0xfb70('0x19')]?_0x9fcb9c[_0xfb70('0x19')][_0xfb70('0x1a')]===undefined?!![]:![]:!![],'where':_0x9fcb9c[_0xfb70('0x19')]?_0x9fcb9c['options']['where']||null:null,'attributes':_0x9fcb9c[_0xfb70('0x19')]?_0x9fcb9c[_0xfb70('0x19')][_0xfb70('0x1c')]||null:null,'include':_0x9fcb9c[_0xfb70('0x19')]?_0x9fcb9c['options'][_0xfb70('0x1e')]?_['map'](_0x9fcb9c[_0xfb70('0x19')][_0xfb70('0x1e')],function(_0xadfe04){return{'model':db[_0xadfe04[_0xfb70('0x20')]],'as':_0xadfe04['as'],'attributes':_0xadfe04[_0xfb70('0x1c')],'include':_0xadfe04[_0xfb70('0x1e')]?_['map'](_0xadfe04[_0xfb70('0x1e')],function(_0x5321db){return{'model':db[_0x5321db['model']],'as':_0x5321db['as'],'attributes':_0x5321db[_0xfb70('0x1c')],'include':_0x5321db[_0xfb70('0x1e')]?_[_0xfb70('0x1f')](_0x5321db[_0xfb70('0x1e')],function(_0x248a39){return{'model':db[_0x248a39[_0xfb70('0x20')]],'as':_0x248a39['as'],'attributes':_0x248a39[_0xfb70('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc34761){logger[_0xfb70('0xb')]('ShowServicenowAccount',_0x9fcb9c);logger[_0xfb70('0xe')](_0xfb70('0x22'),_0x9fcb9c,JSON[_0xfb70('0x10')](_0xc34761));_0x53d686(_0xc34761);})[_0xfb70('0x15')](function(_0x18882d){logger[_0xfb70('0x11')](_0xfb70('0x22'),_0x18882d['message'],_0x9fcb9c);_0x449a99(_0xc0aa68[_0xfb70('0x11')](0x1f4,_0x18882d[_0xfb70('0x13')]));});});};