a5a6ae045682bfeb05114d874cb7b8cd806a1032
[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 _0x764c=['map','model','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include'];(function(_0x2bf991,_0x5a7051){var _0x619ab4=function(_0x17e36b){while(--_0x17e36b){_0x2bf991['push'](_0x2bf991['shift']());}};_0x619ab4(++_0x5a7051);}(_0x764c,0x1cc));var _0xc764=function(_0x195d6e,_0xb8b68f){_0x195d6e=_0x195d6e-0x0;var _0x30f620=_0x764c[_0x195d6e];return _0x30f620;};'use strict';var _=require(_0xc764('0x0'));var util=require(_0xc764('0x1'));var moment=require(_0xc764('0x2'));var BPromise=require(_0xc764('0x3'));var rs=require(_0xc764('0x4'));var fs=require('fs');var Redis=require(_0xc764('0x5'));var db=require(_0xc764('0x6'))['db'];var utils=require(_0xc764('0x7'));var logger=require(_0xc764('0x8'))(_0xc764('0x9'));var config=require(_0xc764('0xa'));var jayson=require(_0xc764('0xb'));var client=jayson[_0xc764('0xc')][_0xc764('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3d9511,_0x4723e4,_0x2da161){return new BPromise(function(_0x26dd26,_0x558bbd){return client[_0xc764('0xe')](_0x3d9511,_0x2da161)[_0xc764('0xf')](function(_0x123347){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x4723e4,'request\x20sent');logger[_0xc764('0x10')](_0xc764('0x11'),_0x4723e4,_0xc764('0x12'),JSON[_0xc764('0x13')](_0x123347));if(_0x123347[_0xc764('0x14')]){if(_0x123347['error']['code']===0x1f4){logger['error'](_0xc764('0x15'),_0x4723e4,_0x123347['error'][_0xc764('0x16')]);return _0x558bbd(_0x123347['error'][_0xc764('0x16')]);}logger[_0xc764('0x14')](_0xc764('0x15'),_0x4723e4,_0x123347[_0xc764('0x14')][_0xc764('0x16')]);return _0x26dd26(_0x123347[_0xc764('0x14')][_0xc764('0x16')]);}else{logger[_0xc764('0x17')]('ServicenowAccount,\x20%s,\x20%s',_0x4723e4,_0xc764('0x12'));_0x26dd26(_0x123347[_0xc764('0x18')]['message']);}})[_0xc764('0x19')](function(_0xe8ea22){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x4723e4,_0xe8ea22);_0x558bbd(_0xe8ea22);});});}exports[_0xc764('0x1a')]=function(_0x474153){var _0x483daa=this;return new Promise(function(_0x532aff,_0x3b9e09){return db[_0xc764('0x1b')]['findAll']({'raw':_0x474153[_0xc764('0x1c')]?_0x474153['options'][_0xc764('0x1d')]===undefined?!![]:![]:!![],'where':_0x474153[_0xc764('0x1c')]?_0x474153[_0xc764('0x1c')][_0xc764('0x1e')]||null:null,'attributes':_0x474153['options']?_0x474153[_0xc764('0x1c')][_0xc764('0x1f')]||null:null,'limit':_0x474153[_0xc764('0x1c')]?_0x474153[_0xc764('0x1c')][_0xc764('0x20')]||null:null,'include':_0x474153['options']?_0x474153[_0xc764('0x1c')][_0xc764('0x21')]?_[_0xc764('0x22')](_0x474153[_0xc764('0x1c')][_0xc764('0x21')],function(_0x2791fd){return{'model':db[_0x2791fd[_0xc764('0x23')]],'as':_0x2791fd['as'],'attributes':_0x2791fd[_0xc764('0x1f')],'include':_0x2791fd[_0xc764('0x21')]?_[_0xc764('0x22')](_0x2791fd[_0xc764('0x21')],function(_0x40a069){return{'model':db[_0x40a069['model']],'as':_0x40a069['as'],'attributes':_0x40a069[_0xc764('0x1f')],'include':_0x40a069['include']?_['map'](_0x40a069['include'],function(_0x35b7ef){return{'model':db[_0x35b7ef[_0xc764('0x23')]],'as':_0x35b7ef['as'],'attributes':_0x35b7ef[_0xc764('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc764('0xf')](function(_0x70e6f8){logger[_0xc764('0x17')]('GetServicenowAccount',_0x474153);logger['debug'](_0xc764('0x1a'),_0x474153,JSON['stringify'](_0x70e6f8));_0x532aff(_0x70e6f8);})[_0xc764('0x19')](function(_0x13f2dc){logger['error']('GetServicenowAccount',_0x13f2dc['message'],_0x474153);_0x3b9e09(_0x483daa['error'](0x1f4,_0x13f2dc['message']));});});};exports[_0xc764('0x24')]=function(_0x180f52){var _0x22fcbe=this;return new Promise(function(_0x425587,_0x20d2e4){return db[_0xc764('0x1b')][_0xc764('0x25')]({'raw':_0x180f52[_0xc764('0x1c')]?_0x180f52[_0xc764('0x1c')][_0xc764('0x1d')]===undefined?!![]:![]:!![],'where':_0x180f52['options']?_0x180f52[_0xc764('0x1c')]['where']||null:null,'attributes':_0x180f52[_0xc764('0x1c')]?_0x180f52[_0xc764('0x1c')][_0xc764('0x1f')]||null:null,'include':_0x180f52['options']?_0x180f52[_0xc764('0x1c')]['include']?_[_0xc764('0x22')](_0x180f52[_0xc764('0x1c')][_0xc764('0x21')],function(_0x29564d){return{'model':db[_0x29564d[_0xc764('0x23')]],'as':_0x29564d['as'],'attributes':_0x29564d[_0xc764('0x1f')],'include':_0x29564d[_0xc764('0x21')]?_[_0xc764('0x22')](_0x29564d[_0xc764('0x21')],function(_0x292d41){return{'model':db[_0x292d41[_0xc764('0x23')]],'as':_0x292d41['as'],'attributes':_0x292d41[_0xc764('0x1f')],'include':_0x292d41[_0xc764('0x21')]?_[_0xc764('0x22')](_0x292d41[_0xc764('0x21')],function(_0x35c63f){return{'model':db[_0x35c63f['model']],'as':_0x35c63f['as'],'attributes':_0x35c63f[_0xc764('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc764('0xf')](function(_0x4d00f0){logger['info']('ShowServicenowAccount',_0x180f52);logger['debug'](_0xc764('0x24'),_0x180f52,JSON[_0xc764('0x13')](_0x4d00f0));_0x425587(_0x4d00f0);})[_0xc764('0x19')](function(_0x3a5e31){logger['error']('ShowServicenowAccount',_0x3a5e31[_0xc764('0x16')],_0x180f52);_0x20d2e4(_0x22fcbe['error'](0x1f4,_0x3a5e31[_0xc764('0x16')]));});});};