Built motion from commit (unavailable).|2.5.4
[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 _0xaf0b=['options','raw','where','attributes','limit','include','map','model','GetServicenowAccount','stringify','ShowServicenowAccount','ServicenowAccount','find','lodash','moment','bluebird','../../mysqldb','../../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','error','code','message','catch','findAll'];(function(_0x20118a,_0x3dbdf3){var _0x538b5f=function(_0x31c5b4){while(--_0x31c5b4){_0x20118a['push'](_0x20118a['shift']());}};_0x538b5f(++_0x3dbdf3);}(_0xaf0b,0xc1));var _0xbaf0=function(_0x4ded1e,_0x5991da){_0x4ded1e=_0x4ded1e-0x0;var _0x427b7f=_0xaf0b[_0x4ded1e];return _0x427b7f;};'use strict';var _=require(_0xbaf0('0x0'));var util=require('util');var moment=require(_0xbaf0('0x1'));var BPromise=require(_0xbaf0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbaf0('0x3'))['db'];var utils=require(_0xbaf0('0x4'));var logger=require(_0xbaf0('0x5'))(_0xbaf0('0x6'));var config=require(_0xbaf0('0x7'));var jayson=require(_0xbaf0('0x8'));var client=jayson[_0xbaf0('0x9')][_0xbaf0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x346fc4,_0x449eb1,_0x5cf14c){return new BPromise(function(_0x5f357b,_0x3ac32d){return client[_0xbaf0('0xb')](_0x346fc4,_0x5cf14c)[_0xbaf0('0xc')](function(_0xe96115){logger[_0xbaf0('0xd')](_0xbaf0('0xe'),_0x449eb1,_0xbaf0('0xf'));logger[_0xbaf0('0x10')](_0xbaf0('0x11'),_0x449eb1,_0xbaf0('0xf'),JSON['stringify'](_0xe96115));if(_0xe96115[_0xbaf0('0x12')]){if(_0xe96115[_0xbaf0('0x12')][_0xbaf0('0x13')]===0x1f4){logger['error'](_0xbaf0('0xe'),_0x449eb1,_0xe96115[_0xbaf0('0x12')][_0xbaf0('0x14')]);return _0x3ac32d(_0xe96115[_0xbaf0('0x12')]['message']);}logger[_0xbaf0('0x12')](_0xbaf0('0xe'),_0x449eb1,_0xe96115[_0xbaf0('0x12')]['message']);return _0x5f357b(_0xe96115[_0xbaf0('0x12')][_0xbaf0('0x14')]);}else{logger[_0xbaf0('0xd')](_0xbaf0('0xe'),_0x449eb1,_0xbaf0('0xf'));_0x5f357b(_0xe96115['result']['message']);}})[_0xbaf0('0x15')](function(_0xa4efa0){logger[_0xbaf0('0x12')](_0xbaf0('0xe'),_0x449eb1,_0xa4efa0);_0x3ac32d(_0xa4efa0);});});}exports['GetServicenowAccount']=function(_0x352a8f){var _0x2a3d28=this;return new Promise(function(_0x5d0120,_0x3f1cb3){return db['ServicenowAccount'][_0xbaf0('0x16')]({'raw':_0x352a8f['options']?_0x352a8f[_0xbaf0('0x17')][_0xbaf0('0x18')]===undefined?!![]:![]:!![],'where':_0x352a8f['options']?_0x352a8f[_0xbaf0('0x17')][_0xbaf0('0x19')]||null:null,'attributes':_0x352a8f[_0xbaf0('0x17')]?_0x352a8f[_0xbaf0('0x17')][_0xbaf0('0x1a')]||null:null,'limit':_0x352a8f[_0xbaf0('0x17')]?_0x352a8f[_0xbaf0('0x17')][_0xbaf0('0x1b')]||null:null,'include':_0x352a8f[_0xbaf0('0x17')]?_0x352a8f[_0xbaf0('0x17')][_0xbaf0('0x1c')]?_[_0xbaf0('0x1d')](_0x352a8f[_0xbaf0('0x17')]['include'],function(_0x5cedc0){return{'model':db[_0x5cedc0['model']],'as':_0x5cedc0['as'],'attributes':_0x5cedc0[_0xbaf0('0x1a')],'include':_0x5cedc0['include']?_[_0xbaf0('0x1d')](_0x5cedc0[_0xbaf0('0x1c')],function(_0x1b48bc){return{'model':db[_0x1b48bc[_0xbaf0('0x1e')]],'as':_0x1b48bc['as'],'attributes':_0x1b48bc[_0xbaf0('0x1a')],'include':_0x1b48bc[_0xbaf0('0x1c')]?_[_0xbaf0('0x1d')](_0x1b48bc[_0xbaf0('0x1c')],function(_0x67196a){return{'model':db[_0x67196a[_0xbaf0('0x1e')]],'as':_0x67196a['as'],'attributes':_0x67196a['attributes']};}):[]};}):[]};}):[]:[]})[_0xbaf0('0xc')](function(_0x17606a){logger[_0xbaf0('0xd')](_0xbaf0('0x1f'),_0x352a8f);logger[_0xbaf0('0x10')](_0xbaf0('0x1f'),_0x352a8f,JSON[_0xbaf0('0x20')](_0x17606a));_0x5d0120(_0x17606a);})[_0xbaf0('0x15')](function(_0x4fe845){logger[_0xbaf0('0x12')]('GetServicenowAccount',_0x4fe845['message'],_0x352a8f);_0x3f1cb3(_0x2a3d28[_0xbaf0('0x12')](0x1f4,_0x4fe845['message']));});});};exports[_0xbaf0('0x21')]=function(_0x47f582){var _0x2940e9=this;return new Promise(function(_0x247ae8,_0x3ee498){return db[_0xbaf0('0x22')][_0xbaf0('0x23')]({'raw':_0x47f582[_0xbaf0('0x17')]?_0x47f582[_0xbaf0('0x17')][_0xbaf0('0x18')]===undefined?!![]:![]:!![],'where':_0x47f582['options']?_0x47f582[_0xbaf0('0x17')][_0xbaf0('0x19')]||null:null,'attributes':_0x47f582['options']?_0x47f582[_0xbaf0('0x17')][_0xbaf0('0x1a')]||null:null,'include':_0x47f582[_0xbaf0('0x17')]?_0x47f582[_0xbaf0('0x17')]['include']?_[_0xbaf0('0x1d')](_0x47f582[_0xbaf0('0x17')]['include'],function(_0x465526){return{'model':db[_0x465526[_0xbaf0('0x1e')]],'as':_0x465526['as'],'attributes':_0x465526[_0xbaf0('0x1a')],'include':_0x465526[_0xbaf0('0x1c')]?_[_0xbaf0('0x1d')](_0x465526[_0xbaf0('0x1c')],function(_0x57e274){return{'model':db[_0x57e274['model']],'as':_0x57e274['as'],'attributes':_0x57e274['attributes'],'include':_0x57e274[_0xbaf0('0x1c')]?_[_0xbaf0('0x1d')](_0x57e274[_0xbaf0('0x1c')],function(_0x1fc5c3){return{'model':db[_0x1fc5c3[_0xbaf0('0x1e')]],'as':_0x1fc5c3['as'],'attributes':_0x1fc5c3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e08ae){logger['info']('ShowServicenowAccount',_0x47f582);logger[_0xbaf0('0x10')](_0xbaf0('0x21'),_0x47f582,JSON[_0xbaf0('0x20')](_0x5e08ae));_0x247ae8(_0x5e08ae);})[_0xbaf0('0x15')](function(_0x2eab5e){logger['error'](_0xbaf0('0x21'),_0x2eab5e['message'],_0x47f582);_0x3ee498(_0x2940e9[_0xbaf0('0x12')](0x1f4,_0x2eab5e['message']));});});};