Built motion from commit (unavailable).|2.5.21
[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 _0x6c39=['error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','map','include','model','find','info','ShowServicenowAccount','lodash','moment','randomstring','../../mysqldb','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x14d082,_0x5dda85){var _0x72fec4=function(_0x4b8185){while(--_0x4b8185){_0x14d082['push'](_0x14d082['shift']());}};_0x72fec4(++_0x5dda85);}(_0x6c39,0x15c));var _0x96c3=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0x6c39[_0x592e40];return _0x5d4288;};'use strict';var _=require(_0x96c3('0x0'));var util=require('util');var moment=require(_0x96c3('0x1'));var BPromise=require('bluebird');var rs=require(_0x96c3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96c3('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x96c3('0x4'));var client=jayson['client'][_0x96c3('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2b0209,_0x19c933,_0x8b4b06){return new BPromise(function(_0x55439b,_0x470710){return client[_0x96c3('0x6')](_0x2b0209,_0x8b4b06)[_0x96c3('0x7')](function(_0x6bf1b1){logger['info'](_0x96c3('0x8'),_0x19c933,_0x96c3('0x9'));logger[_0x96c3('0xa')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x19c933,'request\x20sent',JSON[_0x96c3('0xb')](_0x6bf1b1));if(_0x6bf1b1[_0x96c3('0xc')]){if(_0x6bf1b1[_0x96c3('0xc')][_0x96c3('0xd')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x19c933,_0x6bf1b1['error'][_0x96c3('0xe')]);return _0x470710(_0x6bf1b1[_0x96c3('0xc')][_0x96c3('0xe')]);}logger[_0x96c3('0xc')](_0x96c3('0x8'),_0x19c933,_0x6bf1b1[_0x96c3('0xc')]['message']);return _0x55439b(_0x6bf1b1[_0x96c3('0xc')][_0x96c3('0xe')]);}else{logger['info'](_0x96c3('0x8'),_0x19c933,_0x96c3('0x9'));_0x55439b(_0x6bf1b1[_0x96c3('0xf')][_0x96c3('0xe')]);}})[_0x96c3('0x10')](function(_0x3f0ff5){logger[_0x96c3('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x19c933,_0x3f0ff5);_0x470710(_0x3f0ff5);});});}exports[_0x96c3('0x11')]=function(_0x392a70){var _0x4f16d2=this;return new Promise(function(_0xc3bf67,_0x1b7e32){return db[_0x96c3('0x12')][_0x96c3('0x13')]({'raw':_0x392a70[_0x96c3('0x14')]?_0x392a70['options'][_0x96c3('0x15')]===undefined?!![]:![]:!![],'where':_0x392a70['options']?_0x392a70[_0x96c3('0x14')][_0x96c3('0x16')]||null:null,'attributes':_0x392a70[_0x96c3('0x14')]?_0x392a70[_0x96c3('0x14')][_0x96c3('0x17')]||null:null,'limit':_0x392a70['options']?_0x392a70[_0x96c3('0x14')]['limit']||null:null,'include':_0x392a70['options']?_0x392a70[_0x96c3('0x14')]['include']?_[_0x96c3('0x18')](_0x392a70[_0x96c3('0x14')][_0x96c3('0x19')],function(_0x522592){return{'model':db[_0x522592[_0x96c3('0x1a')]],'as':_0x522592['as'],'attributes':_0x522592[_0x96c3('0x17')],'include':_0x522592[_0x96c3('0x19')]?_[_0x96c3('0x18')](_0x522592['include'],function(_0x25f05d){return{'model':db[_0x25f05d['model']],'as':_0x25f05d['as'],'attributes':_0x25f05d[_0x96c3('0x17')],'include':_0x25f05d[_0x96c3('0x19')]?_[_0x96c3('0x18')](_0x25f05d['include'],function(_0x280977){return{'model':db[_0x280977[_0x96c3('0x1a')]],'as':_0x280977['as'],'attributes':_0x280977[_0x96c3('0x17')]};}):[]};}):[]};}):[]:[]})[_0x96c3('0x7')](function(_0x373c77){logger['info'](_0x96c3('0x11'),_0x392a70);logger[_0x96c3('0xa')](_0x96c3('0x11'),_0x392a70,JSON[_0x96c3('0xb')](_0x373c77));_0xc3bf67(_0x373c77);})[_0x96c3('0x10')](function(_0x51724a){logger[_0x96c3('0xc')](_0x96c3('0x11'),_0x51724a[_0x96c3('0xe')],_0x392a70);_0x1b7e32(_0x4f16d2[_0x96c3('0xc')](0x1f4,_0x51724a['message']));});});};exports['ShowServicenowAccount']=function(_0x339da0){var _0x510c5e=this;return new Promise(function(_0x5c0f29,_0x50b0fb){return db[_0x96c3('0x12')][_0x96c3('0x1b')]({'raw':_0x339da0[_0x96c3('0x14')]?_0x339da0[_0x96c3('0x14')][_0x96c3('0x15')]===undefined?!![]:![]:!![],'where':_0x339da0[_0x96c3('0x14')]?_0x339da0[_0x96c3('0x14')]['where']||null:null,'attributes':_0x339da0['options']?_0x339da0[_0x96c3('0x14')][_0x96c3('0x17')]||null:null,'include':_0x339da0[_0x96c3('0x14')]?_0x339da0['options'][_0x96c3('0x19')]?_['map'](_0x339da0[_0x96c3('0x14')][_0x96c3('0x19')],function(_0x1744a2){return{'model':db[_0x1744a2[_0x96c3('0x1a')]],'as':_0x1744a2['as'],'attributes':_0x1744a2[_0x96c3('0x17')],'include':_0x1744a2[_0x96c3('0x19')]?_[_0x96c3('0x18')](_0x1744a2[_0x96c3('0x19')],function(_0x539fc8){return{'model':db[_0x539fc8['model']],'as':_0x539fc8['as'],'attributes':_0x539fc8['attributes'],'include':_0x539fc8[_0x96c3('0x19')]?_[_0x96c3('0x18')](_0x539fc8['include'],function(_0x5be05b){return{'model':db[_0x5be05b['model']],'as':_0x5be05b['as'],'attributes':_0x5be05b[_0x96c3('0x17')]};}):[]};}):[]};}):[]:[]})[_0x96c3('0x7')](function(_0x3d02c7){logger[_0x96c3('0x1c')](_0x96c3('0x1d'),_0x339da0);logger[_0x96c3('0xa')](_0x96c3('0x1d'),_0x339da0,JSON[_0x96c3('0xb')](_0x3d02c7));_0x5c0f29(_0x3d02c7);})[_0x96c3('0x10')](function(_0x298860){logger[_0x96c3('0xc')](_0x96c3('0x1d'),_0x298860['message'],_0x339da0);_0x50b0fb(_0x510c5e[_0x96c3('0xc')](0x1f4,_0x298860[_0x96c3('0xe')]));});});};