Built motion from commit 775e2a94.|2.6.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 _0xea5f=['model','map','debug','ShowServicenowAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x456907,_0x2bbabc){var _0x2a5e93=function(_0x5cab7c){while(--_0x5cab7c){_0x456907['push'](_0x456907['shift']());}};_0x2a5e93(++_0x2bbabc);}(_0xea5f,0x114));var _0xfea5=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xea5f[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0xfea5('0x0'));var util=require('util');var moment=require(_0xfea5('0x1'));var BPromise=require('bluebird');var rs=require(_0xfea5('0x2'));var fs=require('fs');var Redis=require(_0xfea5('0x3'));var db=require(_0xfea5('0x4'))['db'];var utils=require(_0xfea5('0x5'));var logger=require(_0xfea5('0x6'))(_0xfea5('0x7'));var config=require(_0xfea5('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfea5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ee16b,_0x223ab3,_0x111fa9){return new BPromise(function(_0x2f1d02,_0xcc06e0){return client['request'](_0x2ee16b,_0x111fa9)[_0xfea5('0xa')](function(_0x204afb){logger[_0xfea5('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x223ab3,_0xfea5('0xc'));logger['debug'](_0xfea5('0xd'),_0x223ab3,_0xfea5('0xc'),JSON[_0xfea5('0xe')](_0x204afb));if(_0x204afb[_0xfea5('0xf')]){if(_0x204afb[_0xfea5('0xf')][_0xfea5('0x10')]===0x1f4){logger[_0xfea5('0xf')](_0xfea5('0x11'),_0x223ab3,_0x204afb['error'][_0xfea5('0x12')]);return _0xcc06e0(_0x204afb[_0xfea5('0xf')][_0xfea5('0x12')]);}logger[_0xfea5('0xf')](_0xfea5('0x11'),_0x223ab3,_0x204afb[_0xfea5('0xf')][_0xfea5('0x12')]);return _0x2f1d02(_0x204afb['error'][_0xfea5('0x12')]);}else{logger[_0xfea5('0xb')](_0xfea5('0x11'),_0x223ab3,_0xfea5('0xc'));_0x2f1d02(_0x204afb[_0xfea5('0x13')][_0xfea5('0x12')]);}})[_0xfea5('0x14')](function(_0x530516){logger['error'](_0xfea5('0x11'),_0x223ab3,_0x530516);_0xcc06e0(_0x530516);});});}exports[_0xfea5('0x15')]=function(_0x2dfffd){var _0x1a8b8a=this;return new Promise(function(_0x3df3fb,_0x4e7872){return db[_0xfea5('0x16')][_0xfea5('0x17')]({'raw':_0x2dfffd[_0xfea5('0x18')]?_0x2dfffd[_0xfea5('0x18')][_0xfea5('0x19')]===undefined?!![]:![]:!![],'where':_0x2dfffd[_0xfea5('0x18')]?_0x2dfffd['options'][_0xfea5('0x1a')]||null:null,'attributes':_0x2dfffd['options']?_0x2dfffd[_0xfea5('0x18')][_0xfea5('0x1b')]||null:null,'limit':_0x2dfffd[_0xfea5('0x18')]?_0x2dfffd[_0xfea5('0x18')][_0xfea5('0x1c')]||null:null,'include':_0x2dfffd[_0xfea5('0x18')]?_0x2dfffd[_0xfea5('0x18')]['include']?_['map'](_0x2dfffd[_0xfea5('0x18')][_0xfea5('0x1d')],function(_0x2c0526){return{'model':db[_0x2c0526[_0xfea5('0x1e')]],'as':_0x2c0526['as'],'attributes':_0x2c0526[_0xfea5('0x1b')],'include':_0x2c0526[_0xfea5('0x1d')]?_[_0xfea5('0x1f')](_0x2c0526['include'],function(_0xe556fd){return{'model':db[_0xe556fd['model']],'as':_0xe556fd['as'],'attributes':_0xe556fd[_0xfea5('0x1b')],'include':_0xe556fd[_0xfea5('0x1d')]?_[_0xfea5('0x1f')](_0xe556fd['include'],function(_0x54dcbf){return{'model':db[_0x54dcbf[_0xfea5('0x1e')]],'as':_0x54dcbf['as'],'attributes':_0x54dcbf[_0xfea5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfea5('0xa')](function(_0x540d14){logger[_0xfea5('0xb')](_0xfea5('0x15'),_0x2dfffd);logger[_0xfea5('0x20')](_0xfea5('0x15'),_0x2dfffd,JSON[_0xfea5('0xe')](_0x540d14));_0x3df3fb(_0x540d14);})[_0xfea5('0x14')](function(_0x29acf1){logger[_0xfea5('0xf')](_0xfea5('0x15'),_0x29acf1[_0xfea5('0x12')],_0x2dfffd);_0x4e7872(_0x1a8b8a['error'](0x1f4,_0x29acf1['message']));});});};exports['ShowServicenowAccount']=function(_0x23a0ea){var _0x44c6e2=this;return new Promise(function(_0x3b9ed2,_0x1022ac){return db['ServicenowAccount']['find']({'raw':_0x23a0ea[_0xfea5('0x18')]?_0x23a0ea[_0xfea5('0x18')][_0xfea5('0x19')]===undefined?!![]:![]:!![],'where':_0x23a0ea[_0xfea5('0x18')]?_0x23a0ea[_0xfea5('0x18')][_0xfea5('0x1a')]||null:null,'attributes':_0x23a0ea[_0xfea5('0x18')]?_0x23a0ea[_0xfea5('0x18')][_0xfea5('0x1b')]||null:null,'include':_0x23a0ea[_0xfea5('0x18')]?_0x23a0ea['options']['include']?_[_0xfea5('0x1f')](_0x23a0ea[_0xfea5('0x18')][_0xfea5('0x1d')],function(_0x459be8){return{'model':db[_0x459be8[_0xfea5('0x1e')]],'as':_0x459be8['as'],'attributes':_0x459be8[_0xfea5('0x1b')],'include':_0x459be8[_0xfea5('0x1d')]?_[_0xfea5('0x1f')](_0x459be8['include'],function(_0x1b2b20){return{'model':db[_0x1b2b20[_0xfea5('0x1e')]],'as':_0x1b2b20['as'],'attributes':_0x1b2b20[_0xfea5('0x1b')],'include':_0x1b2b20[_0xfea5('0x1d')]?_[_0xfea5('0x1f')](_0x1b2b20[_0xfea5('0x1d')],function(_0x39f104){return{'model':db[_0x39f104[_0xfea5('0x1e')]],'as':_0x39f104['as'],'attributes':_0x39f104['attributes']};}):[]};}):[]};}):[]:[]})[_0xfea5('0xa')](function(_0xf994a7){logger[_0xfea5('0xb')](_0xfea5('0x21'),_0x23a0ea);logger[_0xfea5('0x20')](_0xfea5('0x21'),_0x23a0ea,JSON[_0xfea5('0xe')](_0xf994a7));_0x3b9ed2(_0xf994a7);})[_0xfea5('0x14')](function(_0x441ba5){logger[_0xfea5('0xf')](_0xfea5('0x21'),_0x441ba5[_0xfea5('0x12')],_0x23a0ea);_0x1022ac(_0x44c6e2[_0xfea5('0xf')](0x1f4,_0x441ba5[_0xfea5('0x12')]));});});};