907f8e65d32536c9d31671960ae02b9a0b789900
[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 _0x7402=['debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','limit','include','model','map','attributes','ShowServicenowAccount','find','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7402,0xfa));var _0x2740=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0x7402[_0x2543d6];return _0x55213c;};'use strict';var _=require(_0x2740('0x0'));var util=require(_0x2740('0x1'));var moment=require('moment');var BPromise=require(_0x2740('0x2'));var rs=require(_0x2740('0x3'));var fs=require('fs');var Redis=require(_0x2740('0x4'));var db=require(_0x2740('0x5'))['db'];var utils=require(_0x2740('0x6'));var logger=require(_0x2740('0x7'))(_0x2740('0x8'));var config=require(_0x2740('0x9'));var jayson=require(_0x2740('0xa'));var client=jayson[_0x2740('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10faac,_0x208282,_0x39f3b9){return new BPromise(function(_0x2ea109,_0x33c3d8){return client[_0x2740('0xc')](_0x10faac,_0x39f3b9)[_0x2740('0xd')](function(_0x964ce0){logger[_0x2740('0xe')](_0x2740('0xf'),_0x208282,'request\x20sent');logger[_0x2740('0x10')](_0x2740('0x11'),_0x208282,_0x2740('0x12'),JSON[_0x2740('0x13')](_0x964ce0));if(_0x964ce0[_0x2740('0x14')]){if(_0x964ce0[_0x2740('0x14')][_0x2740('0x15')]===0x1f4){logger['error'](_0x2740('0xf'),_0x208282,_0x964ce0[_0x2740('0x14')][_0x2740('0x16')]);return _0x33c3d8(_0x964ce0[_0x2740('0x14')][_0x2740('0x16')]);}logger[_0x2740('0x14')](_0x2740('0xf'),_0x208282,_0x964ce0[_0x2740('0x14')][_0x2740('0x16')]);return _0x2ea109(_0x964ce0[_0x2740('0x14')][_0x2740('0x16')]);}else{logger['info'](_0x2740('0xf'),_0x208282,_0x2740('0x12'));_0x2ea109(_0x964ce0[_0x2740('0x17')][_0x2740('0x16')]);}})[_0x2740('0x18')](function(_0x29c0cc){logger['error'](_0x2740('0xf'),_0x208282,_0x29c0cc);_0x33c3d8(_0x29c0cc);});});}exports[_0x2740('0x19')]=function(_0x20c03a){var _0x1ab804=this;return new Promise(function(_0x488e1f,_0x121f95){return db[_0x2740('0x1a')][_0x2740('0x1b')]({'raw':_0x20c03a['options']?_0x20c03a[_0x2740('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x20c03a[_0x2740('0x1c')]?_0x20c03a[_0x2740('0x1c')][_0x2740('0x1d')]||null:null,'attributes':_0x20c03a[_0x2740('0x1c')]?_0x20c03a[_0x2740('0x1c')]['attributes']||null:null,'limit':_0x20c03a[_0x2740('0x1c')]?_0x20c03a[_0x2740('0x1c')][_0x2740('0x1e')]||null:null,'include':_0x20c03a[_0x2740('0x1c')]?_0x20c03a[_0x2740('0x1c')][_0x2740('0x1f')]?_['map'](_0x20c03a['options']['include'],function(_0x4bb79e){return{'model':db[_0x4bb79e[_0x2740('0x20')]],'as':_0x4bb79e['as'],'attributes':_0x4bb79e['attributes'],'include':_0x4bb79e['include']?_[_0x2740('0x21')](_0x4bb79e['include'],function(_0x1e86e0){return{'model':db[_0x1e86e0[_0x2740('0x20')]],'as':_0x1e86e0['as'],'attributes':_0x1e86e0[_0x2740('0x22')],'include':_0x1e86e0[_0x2740('0x1f')]?_[_0x2740('0x21')](_0x1e86e0[_0x2740('0x1f')],function(_0xc245c9){return{'model':db[_0xc245c9[_0x2740('0x20')]],'as':_0xc245c9['as'],'attributes':_0xc245c9[_0x2740('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2740('0xd')](function(_0x5395ea){logger['info'](_0x2740('0x19'),_0x20c03a);logger['debug'](_0x2740('0x19'),_0x20c03a,JSON['stringify'](_0x5395ea));_0x488e1f(_0x5395ea);})['catch'](function(_0x3b3164){logger[_0x2740('0x14')]('GetServicenowAccount',_0x3b3164[_0x2740('0x16')],_0x20c03a);_0x121f95(_0x1ab804[_0x2740('0x14')](0x1f4,_0x3b3164[_0x2740('0x16')]));});});};exports[_0x2740('0x23')]=function(_0x53391d){var _0x14dc32=this;return new Promise(function(_0x124b39,_0x191d38){return db[_0x2740('0x1a')][_0x2740('0x24')]({'raw':_0x53391d['options']?_0x53391d[_0x2740('0x1c')][_0x2740('0x25')]===undefined?!![]:![]:!![],'where':_0x53391d[_0x2740('0x1c')]?_0x53391d[_0x2740('0x1c')][_0x2740('0x1d')]||null:null,'attributes':_0x53391d[_0x2740('0x1c')]?_0x53391d[_0x2740('0x1c')]['attributes']||null:null,'include':_0x53391d[_0x2740('0x1c')]?_0x53391d[_0x2740('0x1c')][_0x2740('0x1f')]?_[_0x2740('0x21')](_0x53391d[_0x2740('0x1c')][_0x2740('0x1f')],function(_0xe785a8){return{'model':db[_0xe785a8[_0x2740('0x20')]],'as':_0xe785a8['as'],'attributes':_0xe785a8['attributes'],'include':_0xe785a8['include']?_[_0x2740('0x21')](_0xe785a8[_0x2740('0x1f')],function(_0xa08ed5){return{'model':db[_0xa08ed5[_0x2740('0x20')]],'as':_0xa08ed5['as'],'attributes':_0xa08ed5[_0x2740('0x22')],'include':_0xa08ed5[_0x2740('0x1f')]?_[_0x2740('0x21')](_0xa08ed5[_0x2740('0x1f')],function(_0x5ee441){return{'model':db[_0x5ee441[_0x2740('0x20')]],'as':_0x5ee441['as'],'attributes':_0x5ee441['attributes']};}):[]};}):[]};}):[]:[]})[_0x2740('0xd')](function(_0x5ad74a){logger[_0x2740('0xe')](_0x2740('0x23'),_0x53391d);logger['debug'](_0x2740('0x23'),_0x53391d,JSON[_0x2740('0x13')](_0x5ad74a));_0x124b39(_0x5ad74a);})['catch'](function(_0x5d1b3f){logger[_0x2740('0x14')](_0x2740('0x23'),_0x5d1b3f[_0x2740('0x16')],_0x53391d);_0x191d38(_0x14dc32[_0x2740('0x14')](0x1f4,_0x5d1b3f[_0x2740('0x16')]));});});};