ef8e9c8e0fed7b42572f7f329af96a94cfd8e27e
[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 _0x75f6=['attributes','include','map','model','find','raw','where','ShowServicenowAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','catch','GetServicenowAccount','options'];(function(_0x48cbdd,_0x5168cb){var _0x4d174b=function(_0xc16960){while(--_0xc16960){_0x48cbdd['push'](_0x48cbdd['shift']());}};_0x4d174b(++_0x5168cb);}(_0x75f6,0x128));var _0x675f=function(_0xa51bdc,_0x3e7c1a){_0xa51bdc=_0xa51bdc-0x0;var _0x1cd07e=_0x75f6[_0xa51bdc];return _0x1cd07e;};'use strict';var _=require(_0x675f('0x0'));var util=require(_0x675f('0x1'));var moment=require(_0x675f('0x2'));var BPromise=require(_0x675f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x675f('0x4'));var db=require(_0x675f('0x5'))['db'];var utils=require(_0x675f('0x6'));var logger=require(_0x675f('0x7'))(_0x675f('0x8'));var config=require(_0x675f('0x9'));var jayson=require(_0x675f('0xa'));var client=jayson['client'][_0x675f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37cd65,_0x340c4f,_0x3553c7){return new BPromise(function(_0x14f734,_0xc1923c){return client['request'](_0x37cd65,_0x3553c7)[_0x675f('0xc')](function(_0x3d3af7){logger[_0x675f('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x340c4f,_0x675f('0xe'));logger[_0x675f('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x340c4f,_0x675f('0xe'),JSON[_0x675f('0x10')](_0x3d3af7));if(_0x3d3af7['error']){if(_0x3d3af7[_0x675f('0x11')][_0x675f('0x12')]===0x1f4){logger['error'](_0x675f('0x13'),_0x340c4f,_0x3d3af7[_0x675f('0x11')][_0x675f('0x14')]);return _0xc1923c(_0x3d3af7[_0x675f('0x11')][_0x675f('0x14')]);}logger[_0x675f('0x11')](_0x675f('0x13'),_0x340c4f,_0x3d3af7[_0x675f('0x11')][_0x675f('0x14')]);return _0x14f734(_0x3d3af7['error']['message']);}else{logger['info'](_0x675f('0x13'),_0x340c4f,'request\x20sent');_0x14f734(_0x3d3af7['result']['message']);}})[_0x675f('0x15')](function(_0x4f482c){logger[_0x675f('0x11')](_0x675f('0x13'),_0x340c4f,_0x4f482c);_0xc1923c(_0x4f482c);});});}exports[_0x675f('0x16')]=function(_0x4abeeb){var _0xefeff6=this;return new Promise(function(_0x4483fa,_0x3fc688){return db['ServicenowAccount']['findAll']({'raw':_0x4abeeb[_0x675f('0x17')]?_0x4abeeb['options']['raw']===undefined?!![]:![]:!![],'where':_0x4abeeb['options']?_0x4abeeb['options']['where']||null:null,'attributes':_0x4abeeb['options']?_0x4abeeb[_0x675f('0x17')][_0x675f('0x18')]||null:null,'limit':_0x4abeeb[_0x675f('0x17')]?_0x4abeeb[_0x675f('0x17')]['limit']||null:null,'include':_0x4abeeb[_0x675f('0x17')]?_0x4abeeb['options'][_0x675f('0x19')]?_[_0x675f('0x1a')](_0x4abeeb['options']['include'],function(_0x4e3383){return{'model':db[_0x4e3383[_0x675f('0x1b')]],'as':_0x4e3383['as'],'attributes':_0x4e3383[_0x675f('0x18')],'include':_0x4e3383['include']?_['map'](_0x4e3383[_0x675f('0x19')],function(_0x344548){return{'model':db[_0x344548[_0x675f('0x1b')]],'as':_0x344548['as'],'attributes':_0x344548[_0x675f('0x18')],'include':_0x344548['include']?_['map'](_0x344548[_0x675f('0x19')],function(_0x3e59cf){return{'model':db[_0x3e59cf[_0x675f('0x1b')]],'as':_0x3e59cf['as'],'attributes':_0x3e59cf[_0x675f('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4933ca){logger[_0x675f('0xd')](_0x675f('0x16'),_0x4abeeb);logger[_0x675f('0xf')](_0x675f('0x16'),_0x4abeeb,JSON[_0x675f('0x10')](_0x4933ca));_0x4483fa(_0x4933ca);})[_0x675f('0x15')](function(_0x112da1){logger[_0x675f('0x11')](_0x675f('0x16'),_0x112da1[_0x675f('0x14')],_0x4abeeb);_0x3fc688(_0xefeff6[_0x675f('0x11')](0x1f4,_0x112da1[_0x675f('0x14')]));});});};exports['ShowServicenowAccount']=function(_0x2fa3b2){var _0x3011d0=this;return new Promise(function(_0x3c5f81,_0x39c25e){return db['ServicenowAccount'][_0x675f('0x1c')]({'raw':_0x2fa3b2[_0x675f('0x17')]?_0x2fa3b2[_0x675f('0x17')][_0x675f('0x1d')]===undefined?!![]:![]:!![],'where':_0x2fa3b2['options']?_0x2fa3b2['options'][_0x675f('0x1e')]||null:null,'attributes':_0x2fa3b2[_0x675f('0x17')]?_0x2fa3b2[_0x675f('0x17')][_0x675f('0x18')]||null:null,'include':_0x2fa3b2['options']?_0x2fa3b2[_0x675f('0x17')][_0x675f('0x19')]?_['map'](_0x2fa3b2[_0x675f('0x17')][_0x675f('0x19')],function(_0x48e4ef){return{'model':db[_0x48e4ef[_0x675f('0x1b')]],'as':_0x48e4ef['as'],'attributes':_0x48e4ef[_0x675f('0x18')],'include':_0x48e4ef[_0x675f('0x19')]?_[_0x675f('0x1a')](_0x48e4ef[_0x675f('0x19')],function(_0x1acaf8){return{'model':db[_0x1acaf8[_0x675f('0x1b')]],'as':_0x1acaf8['as'],'attributes':_0x1acaf8['attributes'],'include':_0x1acaf8['include']?_[_0x675f('0x1a')](_0x1acaf8[_0x675f('0x19')],function(_0x247937){return{'model':db[_0x247937[_0x675f('0x1b')]],'as':_0x247937['as'],'attributes':_0x247937[_0x675f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x675f('0xc')](function(_0x334206){logger[_0x675f('0xd')](_0x675f('0x1f'),_0x2fa3b2);logger['debug'](_0x675f('0x1f'),_0x2fa3b2,JSON[_0x675f('0x10')](_0x334206));_0x3c5f81(_0x334206);})[_0x675f('0x15')](function(_0x3a2666){logger[_0x675f('0x11')](_0x675f('0x1f'),_0x3a2666[_0x675f('0x14')],_0x2fa3b2);_0x39c25e(_0x3011d0[_0x675f('0x11')](0x1f4,_0x3a2666[_0x675f('0x14')]));});});};