Built motion from commit 3c2ce842.|2.6.31
[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 _0x9010=['../../config/logger','jayson/promise','http','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetServicenowAccount','findAll','options','where','include','model','map','ServicenowAccount','find','raw','attributes','ShowServicenowAccount','debug','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x5247f1,_0x16defa){var _0x18b6fa=function(_0x189b5d){while(--_0x189b5d){_0x5247f1['push'](_0x5247f1['shift']());}};_0x18b6fa(++_0x16defa);}(_0x9010,0x7e));var _0x0901=function(_0x2e013a,_0x46fcb1){_0x2e013a=_0x2e013a-0x0;var _0x4163f8=_0x9010[_0x2e013a];return _0x4163f8;};'use strict';var _=require(_0x0901('0x0'));var util=require(_0x0901('0x1'));var moment=require(_0x0901('0x2'));var BPromise=require(_0x0901('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0901('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0901('0x5'));var logger=require(_0x0901('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0901('0x7'));var client=jayson['client'][_0x0901('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58774d,_0x5af0b1,_0x2a8fc1){return new BPromise(function(_0x21f4ee,_0x2a2861){return client['request'](_0x58774d,_0x2a8fc1)[_0x0901('0x9')](function(_0x5638bb){logger['info'](_0x0901('0xa'),_0x5af0b1,_0x0901('0xb'));logger['debug'](_0x0901('0xc'),_0x5af0b1,'request\x20sent',JSON[_0x0901('0xd')](_0x5638bb));if(_0x5638bb[_0x0901('0xe')]){if(_0x5638bb[_0x0901('0xe')][_0x0901('0xf')]===0x1f4){logger[_0x0901('0xe')](_0x0901('0xa'),_0x5af0b1,_0x5638bb['error'][_0x0901('0x10')]);return _0x2a2861(_0x5638bb[_0x0901('0xe')]['message']);}logger[_0x0901('0xe')](_0x0901('0xa'),_0x5af0b1,_0x5638bb['error'][_0x0901('0x10')]);return _0x21f4ee(_0x5638bb[_0x0901('0xe')][_0x0901('0x10')]);}else{logger[_0x0901('0x11')](_0x0901('0xa'),_0x5af0b1,'request\x20sent');_0x21f4ee(_0x5638bb[_0x0901('0x12')][_0x0901('0x10')]);}})[_0x0901('0x13')](function(_0x194e7d){logger[_0x0901('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x5af0b1,_0x194e7d);_0x2a2861(_0x194e7d);});});}exports[_0x0901('0x14')]=function(_0x52c140){var _0x5ca995=this;return new Promise(function(_0x4c7b46,_0x261158){return db['ServicenowAccount'][_0x0901('0x15')]({'raw':_0x52c140[_0x0901('0x16')]?_0x52c140[_0x0901('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x52c140[_0x0901('0x16')]?_0x52c140[_0x0901('0x16')][_0x0901('0x17')]||null:null,'attributes':_0x52c140[_0x0901('0x16')]?_0x52c140[_0x0901('0x16')]['attributes']||null:null,'limit':_0x52c140['options']?_0x52c140[_0x0901('0x16')]['limit']||null:null,'include':_0x52c140[_0x0901('0x16')]?_0x52c140[_0x0901('0x16')]['include']?_['map'](_0x52c140['options'][_0x0901('0x18')],function(_0x1a91f5){return{'model':db[_0x1a91f5[_0x0901('0x19')]],'as':_0x1a91f5['as'],'attributes':_0x1a91f5['attributes'],'include':_0x1a91f5[_0x0901('0x18')]?_[_0x0901('0x1a')](_0x1a91f5[_0x0901('0x18')],function(_0x2e0248){return{'model':db[_0x2e0248['model']],'as':_0x2e0248['as'],'attributes':_0x2e0248['attributes'],'include':_0x2e0248['include']?_[_0x0901('0x1a')](_0x2e0248['include'],function(_0x456b66){return{'model':db[_0x456b66[_0x0901('0x19')]],'as':_0x456b66['as'],'attributes':_0x456b66['attributes']};}):[]};}):[]};}):[]:[]})[_0x0901('0x9')](function(_0x230ede){logger[_0x0901('0x11')](_0x0901('0x14'),_0x52c140);logger['debug'](_0x0901('0x14'),_0x52c140,JSON['stringify'](_0x230ede));_0x4c7b46(_0x230ede);})[_0x0901('0x13')](function(_0x3ba863){logger[_0x0901('0xe')]('GetServicenowAccount',_0x3ba863[_0x0901('0x10')],_0x52c140);_0x261158(_0x5ca995[_0x0901('0xe')](0x1f4,_0x3ba863[_0x0901('0x10')]));});});};exports['ShowServicenowAccount']=function(_0x223b3c){var _0xa3709b=this;return new Promise(function(_0x262099,_0x27c633){return db[_0x0901('0x1b')][_0x0901('0x1c')]({'raw':_0x223b3c[_0x0901('0x16')]?_0x223b3c[_0x0901('0x16')][_0x0901('0x1d')]===undefined?!![]:![]:!![],'where':_0x223b3c[_0x0901('0x16')]?_0x223b3c[_0x0901('0x16')][_0x0901('0x17')]||null:null,'attributes':_0x223b3c[_0x0901('0x16')]?_0x223b3c[_0x0901('0x16')]['attributes']||null:null,'include':_0x223b3c[_0x0901('0x16')]?_0x223b3c[_0x0901('0x16')]['include']?_['map'](_0x223b3c['options']['include'],function(_0x352c3f){return{'model':db[_0x352c3f['model']],'as':_0x352c3f['as'],'attributes':_0x352c3f[_0x0901('0x1e')],'include':_0x352c3f[_0x0901('0x18')]?_[_0x0901('0x1a')](_0x352c3f[_0x0901('0x18')],function(_0x2e713c){return{'model':db[_0x2e713c[_0x0901('0x19')]],'as':_0x2e713c['as'],'attributes':_0x2e713c[_0x0901('0x1e')],'include':_0x2e713c[_0x0901('0x18')]?_[_0x0901('0x1a')](_0x2e713c[_0x0901('0x18')],function(_0x27e7c0){return{'model':db[_0x27e7c0[_0x0901('0x19')]],'as':_0x27e7c0['as'],'attributes':_0x27e7c0[_0x0901('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0901('0x9')](function(_0x267a52){logger[_0x0901('0x11')](_0x0901('0x1f'),_0x223b3c);logger[_0x0901('0x20')]('ShowServicenowAccount',_0x223b3c,JSON['stringify'](_0x267a52));_0x262099(_0x267a52);})['catch'](function(_0x5e5bbc){logger[_0x0901('0xe')]('ShowServicenowAccount',_0x5e5bbc[_0x0901('0x10')],_0x223b3c);_0x27c633(_0xa3709b[_0x0901('0xe')](0x1f4,_0x5e5bbc[_0x0901('0x10')]));});});};