Built motion from commit ae138b72.|2.6.28
[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 _0xe809=['lodash','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount','ServicenowAccount','options','raw','attributes','limit','model','include','stringify','catch','map','ShowServicenowAccount'];(function(_0x3e4077,_0x48d561){var _0x4a35d3=function(_0x3b639c){while(--_0x3b639c){_0x3e4077['push'](_0x3e4077['shift']());}};_0x4a35d3(++_0x48d561);}(_0xe809,0x180));var _0x9e80=function(_0x1ccb42,_0x6dd89e){_0x1ccb42=_0x1ccb42-0x0;var _0x1e3d57=_0xe809[_0x1ccb42];return _0x1e3d57;};'use strict';var _=require(_0x9e80('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9e80('0x1'));var rs=require(_0x9e80('0x2'));var fs=require('fs');var Redis=require(_0x9e80('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9e80('0x4'));var config=require(_0x9e80('0x5'));var jayson=require(_0x9e80('0x6'));var client=jayson[_0x9e80('0x7')][_0x9e80('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1459f6,_0x3e1c68,_0x164a53){return new BPromise(function(_0x24c538,_0x20172c){return client[_0x9e80('0x9')](_0x1459f6,_0x164a53)[_0x9e80('0xa')](function(_0x2179fe){logger[_0x9e80('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x3e1c68,_0x9e80('0xc'));logger[_0x9e80('0xd')](_0x9e80('0xe'),_0x3e1c68,_0x9e80('0xc'),JSON['stringify'](_0x2179fe));if(_0x2179fe[_0x9e80('0xf')]){if(_0x2179fe[_0x9e80('0xf')][_0x9e80('0x10')]===0x1f4){logger[_0x9e80('0xf')](_0x9e80('0x11'),_0x3e1c68,_0x2179fe[_0x9e80('0xf')]['message']);return _0x20172c(_0x2179fe['error'][_0x9e80('0x12')]);}logger[_0x9e80('0xf')](_0x9e80('0x11'),_0x3e1c68,_0x2179fe[_0x9e80('0xf')]['message']);return _0x24c538(_0x2179fe['error'][_0x9e80('0x12')]);}else{logger[_0x9e80('0xb')](_0x9e80('0x11'),_0x3e1c68,_0x9e80('0xc'));_0x24c538(_0x2179fe[_0x9e80('0x13')][_0x9e80('0x12')]);}})['catch'](function(_0x1c4516){logger['error'](_0x9e80('0x11'),_0x3e1c68,_0x1c4516);_0x20172c(_0x1c4516);});});}exports[_0x9e80('0x14')]=function(_0x28b0d4){var _0x8ad220=this;return new Promise(function(_0x2a9b28,_0x51ba00){return db[_0x9e80('0x15')]['findAll']({'raw':_0x28b0d4['options']?_0x28b0d4[_0x9e80('0x16')][_0x9e80('0x17')]===undefined?!![]:![]:!![],'where':_0x28b0d4[_0x9e80('0x16')]?_0x28b0d4[_0x9e80('0x16')]['where']||null:null,'attributes':_0x28b0d4[_0x9e80('0x16')]?_0x28b0d4['options'][_0x9e80('0x18')]||null:null,'limit':_0x28b0d4[_0x9e80('0x16')]?_0x28b0d4[_0x9e80('0x16')][_0x9e80('0x19')]||null:null,'include':_0x28b0d4[_0x9e80('0x16')]?_0x28b0d4[_0x9e80('0x16')]['include']?_['map'](_0x28b0d4[_0x9e80('0x16')]['include'],function(_0x56dc41){return{'model':db[_0x56dc41[_0x9e80('0x1a')]],'as':_0x56dc41['as'],'attributes':_0x56dc41[_0x9e80('0x18')],'include':_0x56dc41[_0x9e80('0x1b')]?_['map'](_0x56dc41[_0x9e80('0x1b')],function(_0xefa33a){return{'model':db[_0xefa33a[_0x9e80('0x1a')]],'as':_0xefa33a['as'],'attributes':_0xefa33a['attributes'],'include':_0xefa33a[_0x9e80('0x1b')]?_['map'](_0xefa33a[_0x9e80('0x1b')],function(_0x4d9f9a){return{'model':db[_0x4d9f9a['model']],'as':_0x4d9f9a['as'],'attributes':_0x4d9f9a[_0x9e80('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9e80('0xa')](function(_0x4fb85b){logger[_0x9e80('0xb')]('GetServicenowAccount',_0x28b0d4);logger['debug'](_0x9e80('0x14'),_0x28b0d4,JSON[_0x9e80('0x1c')](_0x4fb85b));_0x2a9b28(_0x4fb85b);})[_0x9e80('0x1d')](function(_0x21f2e9){logger[_0x9e80('0xf')](_0x9e80('0x14'),_0x21f2e9[_0x9e80('0x12')],_0x28b0d4);_0x51ba00(_0x8ad220['error'](0x1f4,_0x21f2e9['message']));});});};exports['ShowServicenowAccount']=function(_0x51125c){var _0x3cf399=this;return new Promise(function(_0x207dce,_0x1c51fe){return db['ServicenowAccount']['find']({'raw':_0x51125c[_0x9e80('0x16')]?_0x51125c[_0x9e80('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x51125c[_0x9e80('0x16')]?_0x51125c[_0x9e80('0x16')]['where']||null:null,'attributes':_0x51125c['options']?_0x51125c[_0x9e80('0x16')][_0x9e80('0x18')]||null:null,'include':_0x51125c[_0x9e80('0x16')]?_0x51125c[_0x9e80('0x16')][_0x9e80('0x1b')]?_['map'](_0x51125c['options']['include'],function(_0x367346){return{'model':db[_0x367346[_0x9e80('0x1a')]],'as':_0x367346['as'],'attributes':_0x367346['attributes'],'include':_0x367346[_0x9e80('0x1b')]?_[_0x9e80('0x1e')](_0x367346['include'],function(_0x530e47){return{'model':db[_0x530e47[_0x9e80('0x1a')]],'as':_0x530e47['as'],'attributes':_0x530e47[_0x9e80('0x18')],'include':_0x530e47[_0x9e80('0x1b')]?_[_0x9e80('0x1e')](_0x530e47[_0x9e80('0x1b')],function(_0x3082f6){return{'model':db[_0x3082f6[_0x9e80('0x1a')]],'as':_0x3082f6['as'],'attributes':_0x3082f6[_0x9e80('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9e80('0xa')](function(_0x200449){logger[_0x9e80('0xb')]('ShowServicenowAccount',_0x51125c);logger[_0x9e80('0xd')](_0x9e80('0x1f'),_0x51125c,JSON[_0x9e80('0x1c')](_0x200449));_0x207dce(_0x200449);})[_0x9e80('0x1d')](function(_0xdf4619){logger[_0x9e80('0xf')]('ShowServicenowAccount',_0xdf4619[_0x9e80('0x12')],_0x51125c);_0x1c51fe(_0x3cf399[_0x9e80('0xf')](0x1f4,_0xdf4619[_0x9e80('0x12')]));});});};