Built motion from commit (unavailable).|2.5.3
[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 _0x3f88=['findAll','options','raw','where','attributes','limit','include','map','model','then','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount'];(function(_0x5be9ba,_0x26d58e){var _0x50b543=function(_0x370f48){while(--_0x370f48){_0x5be9ba['push'](_0x5be9ba['shift']());}};_0x50b543(++_0x26d58e);}(_0x3f88,0x1ae));var _0x83f8=function(_0x10a7c7,_0x57bdb9){_0x10a7c7=_0x10a7c7-0x0;var _0x35c8d3=_0x3f88[_0x10a7c7];return _0x35c8d3;};'use strict';var _=require(_0x83f8('0x0'));var util=require(_0x83f8('0x1'));var moment=require('moment');var BPromise=require(_0x83f8('0x2'));var rs=require(_0x83f8('0x3'));var fs=require('fs');var Redis=require(_0x83f8('0x4'));var db=require(_0x83f8('0x5'))['db'];var utils=require(_0x83f8('0x6'));var logger=require(_0x83f8('0x7'))(_0x83f8('0x8'));var config=require(_0x83f8('0x9'));var jayson=require(_0x83f8('0xa'));var client=jayson[_0x83f8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xee2fb0,_0x17a4df,_0x13c036){return new BPromise(function(_0x436f3f,_0x4fbe88){return client[_0x83f8('0xc')](_0xee2fb0,_0x13c036)['then'](function(_0x275dbd){logger[_0x83f8('0xd')](_0x83f8('0xe'),_0x17a4df,_0x83f8('0xf'));logger[_0x83f8('0x10')](_0x83f8('0x11'),_0x17a4df,'request\x20sent',JSON[_0x83f8('0x12')](_0x275dbd));if(_0x275dbd[_0x83f8('0x13')]){if(_0x275dbd['error'][_0x83f8('0x14')]===0x1f4){logger[_0x83f8('0x13')](_0x83f8('0xe'),_0x17a4df,_0x275dbd[_0x83f8('0x13')][_0x83f8('0x15')]);return _0x4fbe88(_0x275dbd[_0x83f8('0x13')][_0x83f8('0x15')]);}logger[_0x83f8('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x17a4df,_0x275dbd[_0x83f8('0x13')][_0x83f8('0x15')]);return _0x436f3f(_0x275dbd[_0x83f8('0x13')][_0x83f8('0x15')]);}else{logger[_0x83f8('0xd')](_0x83f8('0xe'),_0x17a4df,_0x83f8('0xf'));_0x436f3f(_0x275dbd[_0x83f8('0x16')][_0x83f8('0x15')]);}})[_0x83f8('0x17')](function(_0xd1443a){logger[_0x83f8('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x17a4df,_0xd1443a);_0x4fbe88(_0xd1443a);});});}exports[_0x83f8('0x18')]=function(_0x178816){var _0x68592b=this;return new Promise(function(_0x59cd09,_0x39faaf){return db[_0x83f8('0x19')][_0x83f8('0x1a')]({'raw':_0x178816[_0x83f8('0x1b')]?_0x178816['options'][_0x83f8('0x1c')]===undefined?!![]:![]:!![],'where':_0x178816[_0x83f8('0x1b')]?_0x178816[_0x83f8('0x1b')][_0x83f8('0x1d')]||null:null,'attributes':_0x178816[_0x83f8('0x1b')]?_0x178816['options'][_0x83f8('0x1e')]||null:null,'limit':_0x178816[_0x83f8('0x1b')]?_0x178816['options'][_0x83f8('0x1f')]||null:null,'include':_0x178816['options']?_0x178816[_0x83f8('0x1b')][_0x83f8('0x20')]?_[_0x83f8('0x21')](_0x178816[_0x83f8('0x1b')][_0x83f8('0x20')],function(_0x3e38cf){return{'model':db[_0x3e38cf[_0x83f8('0x22')]],'as':_0x3e38cf['as'],'attributes':_0x3e38cf['attributes'],'include':_0x3e38cf[_0x83f8('0x20')]?_[_0x83f8('0x21')](_0x3e38cf[_0x83f8('0x20')],function(_0x4ce8b0){return{'model':db[_0x4ce8b0[_0x83f8('0x22')]],'as':_0x4ce8b0['as'],'attributes':_0x4ce8b0[_0x83f8('0x1e')],'include':_0x4ce8b0['include']?_[_0x83f8('0x21')](_0x4ce8b0[_0x83f8('0x20')],function(_0x4413b0){return{'model':db[_0x4413b0[_0x83f8('0x22')]],'as':_0x4413b0['as'],'attributes':_0x4413b0[_0x83f8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x83f8('0x23')](function(_0x4618a9){logger[_0x83f8('0xd')](_0x83f8('0x18'),_0x178816);logger[_0x83f8('0x10')](_0x83f8('0x18'),_0x178816,JSON[_0x83f8('0x12')](_0x4618a9));_0x59cd09(_0x4618a9);})[_0x83f8('0x17')](function(_0x429d98){logger['error']('GetServicenowAccount',_0x429d98[_0x83f8('0x15')],_0x178816);_0x39faaf(_0x68592b[_0x83f8('0x13')](0x1f4,_0x429d98[_0x83f8('0x15')]));});});};exports[_0x83f8('0x24')]=function(_0x51c6e5){var _0x172b70=this;return new Promise(function(_0x13af24,_0x51d9ae){return db[_0x83f8('0x19')][_0x83f8('0x25')]({'raw':_0x51c6e5['options']?_0x51c6e5[_0x83f8('0x1b')][_0x83f8('0x1c')]===undefined?!![]:![]:!![],'where':_0x51c6e5['options']?_0x51c6e5[_0x83f8('0x1b')]['where']||null:null,'attributes':_0x51c6e5[_0x83f8('0x1b')]?_0x51c6e5[_0x83f8('0x1b')][_0x83f8('0x1e')]||null:null,'include':_0x51c6e5[_0x83f8('0x1b')]?_0x51c6e5[_0x83f8('0x1b')][_0x83f8('0x20')]?_['map'](_0x51c6e5[_0x83f8('0x1b')][_0x83f8('0x20')],function(_0x1d7736){return{'model':db[_0x1d7736[_0x83f8('0x22')]],'as':_0x1d7736['as'],'attributes':_0x1d7736[_0x83f8('0x1e')],'include':_0x1d7736[_0x83f8('0x20')]?_['map'](_0x1d7736[_0x83f8('0x20')],function(_0x169836){return{'model':db[_0x169836[_0x83f8('0x22')]],'as':_0x169836['as'],'attributes':_0x169836[_0x83f8('0x1e')],'include':_0x169836[_0x83f8('0x20')]?_[_0x83f8('0x21')](_0x169836['include'],function(_0x375f61){return{'model':db[_0x375f61['model']],'as':_0x375f61['as'],'attributes':_0x375f61[_0x83f8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x83f8('0x23')](function(_0x366967){logger[_0x83f8('0xd')](_0x83f8('0x24'),_0x51c6e5);logger['debug'](_0x83f8('0x24'),_0x51c6e5,JSON[_0x83f8('0x12')](_0x366967));_0x13af24(_0x366967);})['catch'](function(_0x46d952){logger[_0x83f8('0x13')]('ShowServicenowAccount',_0x46d952[_0x83f8('0x15')],_0x51c6e5);_0x51d9ae(_0x172b70[_0x83f8('0x13')](0x1f4,_0x46d952['message']));});});};