Built motion from commit 953226e6.|2.6.32
[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 _0xcc82=['options','raw','where','limit','include','map','attributes','model','then','find','ShowServicenowAccount','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetServicenowAccount','ServicenowAccount','findAll'];(function(_0x5a0950,_0x38e796){var _0x52b631=function(_0x1cfcab){while(--_0x1cfcab){_0x5a0950['push'](_0x5a0950['shift']());}};_0x52b631(++_0x38e796);}(_0xcc82,0x79));var _0x2cc8=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xcc82[_0x1f71d8];return _0x10b045;};'use strict';var _=require(_0x2cc8('0x0'));var util=require(_0x2cc8('0x1'));var moment=require(_0x2cc8('0x2'));var BPromise=require(_0x2cc8('0x3'));var rs=require(_0x2cc8('0x4'));var fs=require('fs');var Redis=require(_0x2cc8('0x5'));var db=require(_0x2cc8('0x6'))['db'];var utils=require(_0x2cc8('0x7'));var logger=require(_0x2cc8('0x8'))('rpc');var config=require(_0x2cc8('0x9'));var jayson=require(_0x2cc8('0xa'));var client=jayson[_0x2cc8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb4bbc4,_0x1a4b1f,_0x56a58e){return new BPromise(function(_0x1fbe81,_0x3d61a0){return client['request'](_0xb4bbc4,_0x56a58e)['then'](function(_0x1dd841){logger[_0x2cc8('0xc')](_0x2cc8('0xd'),_0x1a4b1f,'request\x20sent');logger[_0x2cc8('0xe')](_0x2cc8('0xf'),_0x1a4b1f,_0x2cc8('0x10'),JSON['stringify'](_0x1dd841));if(_0x1dd841[_0x2cc8('0x11')]){if(_0x1dd841['error'][_0x2cc8('0x12')]===0x1f4){logger[_0x2cc8('0x11')](_0x2cc8('0xd'),_0x1a4b1f,_0x1dd841['error']['message']);return _0x3d61a0(_0x1dd841['error'][_0x2cc8('0x13')]);}logger[_0x2cc8('0x11')](_0x2cc8('0xd'),_0x1a4b1f,_0x1dd841[_0x2cc8('0x11')][_0x2cc8('0x13')]);return _0x1fbe81(_0x1dd841[_0x2cc8('0x11')][_0x2cc8('0x13')]);}else{logger[_0x2cc8('0xc')](_0x2cc8('0xd'),_0x1a4b1f,_0x2cc8('0x10'));_0x1fbe81(_0x1dd841['result'][_0x2cc8('0x13')]);}})['catch'](function(_0x30deec){logger[_0x2cc8('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x1a4b1f,_0x30deec);_0x3d61a0(_0x30deec);});});}exports[_0x2cc8('0x14')]=function(_0x1637bf){var _0x14004a=this;return new Promise(function(_0x51090c,_0x44320b){return db[_0x2cc8('0x15')][_0x2cc8('0x16')]({'raw':_0x1637bf[_0x2cc8('0x17')]?_0x1637bf[_0x2cc8('0x17')][_0x2cc8('0x18')]===undefined?!![]:![]:!![],'where':_0x1637bf['options']?_0x1637bf[_0x2cc8('0x17')][_0x2cc8('0x19')]||null:null,'attributes':_0x1637bf[_0x2cc8('0x17')]?_0x1637bf[_0x2cc8('0x17')]['attributes']||null:null,'limit':_0x1637bf['options']?_0x1637bf[_0x2cc8('0x17')][_0x2cc8('0x1a')]||null:null,'include':_0x1637bf[_0x2cc8('0x17')]?_0x1637bf[_0x2cc8('0x17')][_0x2cc8('0x1b')]?_[_0x2cc8('0x1c')](_0x1637bf['options'][_0x2cc8('0x1b')],function(_0x2b7b18){return{'model':db[_0x2b7b18['model']],'as':_0x2b7b18['as'],'attributes':_0x2b7b18[_0x2cc8('0x1d')],'include':_0x2b7b18[_0x2cc8('0x1b')]?_[_0x2cc8('0x1c')](_0x2b7b18[_0x2cc8('0x1b')],function(_0x2f0d92){return{'model':db[_0x2f0d92[_0x2cc8('0x1e')]],'as':_0x2f0d92['as'],'attributes':_0x2f0d92[_0x2cc8('0x1d')],'include':_0x2f0d92['include']?_['map'](_0x2f0d92[_0x2cc8('0x1b')],function(_0x6474b9){return{'model':db[_0x6474b9[_0x2cc8('0x1e')]],'as':_0x6474b9['as'],'attributes':_0x6474b9[_0x2cc8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2cc8('0x1f')](function(_0x46b323){logger[_0x2cc8('0xc')](_0x2cc8('0x14'),_0x1637bf);logger[_0x2cc8('0xe')](_0x2cc8('0x14'),_0x1637bf,JSON['stringify'](_0x46b323));_0x51090c(_0x46b323);})['catch'](function(_0x32c170){logger[_0x2cc8('0x11')](_0x2cc8('0x14'),_0x32c170[_0x2cc8('0x13')],_0x1637bf);_0x44320b(_0x14004a[_0x2cc8('0x11')](0x1f4,_0x32c170[_0x2cc8('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x210b3e){var _0x44e6e6=this;return new Promise(function(_0x4b4b10,_0x53ef59){return db[_0x2cc8('0x15')][_0x2cc8('0x20')]({'raw':_0x210b3e[_0x2cc8('0x17')]?_0x210b3e[_0x2cc8('0x17')][_0x2cc8('0x18')]===undefined?!![]:![]:!![],'where':_0x210b3e[_0x2cc8('0x17')]?_0x210b3e[_0x2cc8('0x17')][_0x2cc8('0x19')]||null:null,'attributes':_0x210b3e['options']?_0x210b3e[_0x2cc8('0x17')][_0x2cc8('0x1d')]||null:null,'include':_0x210b3e['options']?_0x210b3e['options']['include']?_['map'](_0x210b3e['options'][_0x2cc8('0x1b')],function(_0x3dcd39){return{'model':db[_0x3dcd39[_0x2cc8('0x1e')]],'as':_0x3dcd39['as'],'attributes':_0x3dcd39[_0x2cc8('0x1d')],'include':_0x3dcd39[_0x2cc8('0x1b')]?_[_0x2cc8('0x1c')](_0x3dcd39[_0x2cc8('0x1b')],function(_0x5d1a54){return{'model':db[_0x5d1a54[_0x2cc8('0x1e')]],'as':_0x5d1a54['as'],'attributes':_0x5d1a54[_0x2cc8('0x1d')],'include':_0x5d1a54[_0x2cc8('0x1b')]?_[_0x2cc8('0x1c')](_0x5d1a54['include'],function(_0x58ba4e){return{'model':db[_0x58ba4e[_0x2cc8('0x1e')]],'as':_0x58ba4e['as'],'attributes':_0x58ba4e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3333df){logger[_0x2cc8('0xc')](_0x2cc8('0x21'),_0x210b3e);logger[_0x2cc8('0xe')]('ShowServicenowAccount',_0x210b3e,JSON[_0x2cc8('0x22')](_0x3333df));_0x4b4b10(_0x3333df);})[_0x2cc8('0x23')](function(_0x521a63){logger[_0x2cc8('0x11')](_0x2cc8('0x21'),_0x521a63['message'],_0x210b3e);_0x53ef59(_0x44e6e6['error'](0x1f4,_0x521a63[_0x2cc8('0x13')]));});});};